示例#1
0
 protected function processRoute(Annotation $routeAnnotation, array $args)
 {
     $route = current($args);
     $class = null;
     if ($routeAnnotation->isMethod()) {
         $method = $routeAnnotation->getObject();
         $class = $method->getClass();
         $baseRoute = $class->getOne('Route');
         if (!empty($baseRoute)) {
             $route = current($baseRoute->getArgs()) . '/' . $route;
         }
     }
     if (empty($route)) {
         throw new \RuntimeException("@Route must have an argument");
     }
     $url = $this->getUrl($routeAnnotation, $route, $args);
     if ($routeAnnotation->getParent()->has('Method')) {
         foreach ($routeAnnotation->getParent()->get('Method') as $method) {
             foreach ($method->getArgs() as $m) {
                 $nurl = clone $url;
                 $nurl->setMethod($m);
                 $this->urls[] = $nurl;
             }
         }
     } else {
         $this->urls[] = $url;
     }
 }