Пример #1
0
 /**
  * @param RestRouteCollection $collection
  * @param string              $routeName
  * @param Route               $route
  * @param bool                $isCollection
  * @param bool                $isInflectable
  * @param RouteAnnotation     $annotation
  */
 private function addRoute(RestRouteCollection $collection, $routeName, $route, $isCollection, $isInflectable, RouteAnnotation $annotation = null)
 {
     if ($annotation && null !== $annotation->getName()) {
         $options = $annotation->getOptions();
         if (isset($options['method_prefix']) && false === $options['method_prefix']) {
             $routeName = $annotation->getName();
         } else {
             $routeName = $routeName . $annotation->getName();
         }
     }
     $fullRouteName = $this->namePrefix . $routeName;
     if ($isCollection && !$isInflectable) {
         $collection->add($this->namePrefix . self::COLLECTION_ROUTE_PREFIX . $routeName, $route);
         if (!$collection->get($fullRouteName)) {
             $collection->add($fullRouteName, clone $route);
         }
     } else {
         $collection->add($fullRouteName, $route);
     }
 }
 /**
  * @param RestRouteCollection $collection
  * @param string              $routeName
  * @param Route               $route
  * @param bool                $isCollection
  * @param bool                $isInflectable
  * @param RouteAnnotation     $annotation
  */
 private function addRoute(RestRouteCollection $collection, $routeName, $route, $isCollection, $isInflectable, RouteAnnotation $annotation = null)
 {
     if ($annotation) {
         $routeName = $routeName . $annotation->getName();
     }
     $fullRouteName = $this->namePrefix . $routeName;
     if ($isCollection && !$isInflectable) {
         $collection->add($this->namePrefix . self::COLLECTION_ROUTE_PREFIX . $routeName, $route);
         if (!$collection->get($fullRouteName)) {
             $collection->add($fullRouteName, clone $route);
         }
     } else {
         $collection->add($fullRouteName, $route);
     }
 }