Пример #1
0
 public function match(RequestContext $context)
 {
     if (null === $this->routes) {
         $this->routes = $this->loader->load($this->configuration);
     }
     $path = $context->getPath();
     if (!($route = $this->routes->match($path))) {
         throw new RouteNotFoundException(sprintf('No route found for path %s.', $path));
     }
     $method = $context->getMethod();
     $allowedMethods = $route->getMethods();
     if (count($allowedMethods) && !in_array($method, $allowedMethods)) {
         throw new MethodNotAllowedException($method, $allowedMethods);
     }
     return $route->getParameters();
 }