Example #1
0
 /**
  * Create the auto-route
  *
  * @param MethodElement   $method
  * @param string|object   $class
  * @param RouteDescriptor $descriptor
  *
  * @return Route
  */
 private function createRoute(MethodElement $method, $class, RouteDescriptor $descriptor)
 {
     $uri = $this->getRouteAnnotation($method);
     if (!$uri) {
         return null;
     }
     $name = $this->getNameAnnotation($method);
     $httpMethods = $this->getRouteMethods($method);
     $authorizedUsers = $this->getAuthorizedUsers($method);
     $template = $this->getTemplateAnnotation($method);
     $render = $this->getRenderAnnotation($method);
     $conditions = $this->getConditionAnnotations($method);
     // set the auto-route properties based on the provided annotations
     $route = new Route($descriptor);
     $route->setName($name);
     $route->setUri($uri);
     $route->setMethods($httpMethods);
     $route->setAuthorizedUsers($authorizedUsers);
     $route->setTemplate($template);
     $route->setRender($render);
     $route->setCallback(array($class, $method->name));
     $route->setConditions($conditions);
     return $route;
 }