예제 #1
0
 /**
  * Process the route of current request
  *
  * @param Application $application
  */
 protected function processRoute(Application $application)
 {
     $route = $this->routes->findRouteFor($application->getRequest()->getRequestedPath());
     $route->process($application);
 }
예제 #2
0
 /**
  * Parses the class annotations
  *
  * @param Route $handler
  * @param Application $application
  *
  * @return mixed
  *
  * @throws RuntimeException
  * @throws PageNotFoundException
  */
 protected function parseAnnotation(Route $handler, Application $application)
 {
     $class = new ReflectionClass($handler);
     foreach ($class->getMethods(ReflectionMethod::IS_PUBLIC) as $method) {
         $annotation = $this->annotationReader->getMethodAnnotation($method, '\\Lcobucci\\ActionMapper2\\Routing\\Annotation\\Route');
         if ($annotation && $annotation->match($this, $application->getRequest())) {
             return $method->invokeArgs($handler, array_merge($this->matchedArgs, (array) $annotation->getMatchedArgs()));
         }
     }
     throw new PageNotFoundException('No route for the requested path');
 }