Example #1
0
 /**
  * Returns the requested path
  *
  * @param RouteDefinition $route
  * @param Request $request
  * @return string
  */
 protected function getRequestedPath(RouteDefinition $route, Request $request)
 {
     $pattern = rtrim($route->getPattern(), '/*');
     $regex = RouteDefinitionCreator::createRegex($pattern, false);
     $path = preg_replace($regex, '', $request->getRequestedPath());
     if (substr($path, 0, 1) != '/') {
         $path = '/' . $path;
     }
     if ($path != '/') {
         $path = rtrim($path, '/');
     }
     return $path;
 }