public function getPatternMatches($request)
{
$matches = array();
if (($pattern = $this->getRegularExpression()) !== '') {
preg_match($pattern, $request->getPathInfo(), $matches);
} else {
preg_match($this->getParameterizedPattern(), trim($request->getPathInfo(), '/') . '/', $matches);
}
if ($this->getIsWildCardPattern() && isset($matches[$this->_serviceID])) {
$matches[$this->_serviceID] = str_replace('*', $matches[$this->_serviceID], $this->_serviceParameter);
}
if (isset($matches['urlparams'])) {
$params = explode('/', $matches['urlparams']);
if ($this->_separator === '/') {
while ($key = array_shift($params)) {
$matches[$key] = ($value = array_shift($params)) ? $value : '';
}
} else {
array_pop($params);
foreach ($params as $param) {
list($key, $value) = explode($this->_separator, $param, 2);
$matches[$key] = $value;
}
}
unset($matches['urlparams']);
}
if (count($matches) > 0 && $this->_constants) {
foreach ($this->_constants->toArray() as $key => $value) {
$matches[$key] = $value;
}
}
return $matches;
}