/** * Process the route of current request * * @param Application $application */ protected function processRoute(Application $application) { $route = $this->routes->findRouteFor($application->getRequest()->getRequestedPath()); $route->process($application); }
/** * Returns a service from the dependency injection container * * @param string $serviceId * @return mixed * * @deprecated Use explicity injection */ public function get($serviceId) { return $this->application->getDependencyContainer()->get($serviceId); }
/** * Redirect to another path * * @param string $url */ public function redirect($url) { $this->application->redirect($url); }
/** * 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'); }