Drest\DrestException::handleAlreadyDefinedForRoute PHP Method

handleAlreadyDefinedForRoute() public static method

public static handleAlreadyDefinedForRoute ( RouteMetaData $route )
$route Drest\Mapping\RouteMetaData
    public static function handleAlreadyDefinedForRoute(Mapping\RouteMetaData $route)
    {
        return new self('There is a handle already defined for the route ' . $route->getName() . ' on class ' . $route->getClassMetaData()->getClassName());
    }

Usage Example

Example #1
0
 /**
  * Process the method
  * @param $methods
  * @param Mapping\ClassMetaData $metadata
  * @throws DrestException
  */
 protected function processMethods($methods, Mapping\ClassMetaData $metadata)
 {
     // Set the handle calls
     foreach ($methods as $method) {
         /* @var \ReflectionMethod $method */
         if ($method->isPublic()) {
             foreach ($this->reader->getMethodAnnotations($method) as $methodAnnotation) {
                 if ($methodAnnotation instanceof Annotation\Handle) {
                     // Make sure the for is not empty
                     if (empty($methodAnnotation->for) || !is_string($methodAnnotation->for)) {
                         throw DrestException::handleForCannotBeEmpty();
                     }
                     if (($routeMetaData = $metadata->getRouteMetaData($methodAnnotation->for)) === false) {
                         throw DrestException::handleAnnotationDoesntMatchRouteName($methodAnnotation->for);
                     }
                     if ($routeMetaData->hasHandleCall()) {
                         // There is already a handle set for this route
                         throw DrestException::handleAlreadyDefinedForRoute($routeMetaData);
                     }
                     $routeMetaData->setHandleCall($method->getName());
                 }
             }
         }
     }
 }
All Usage Examples Of Drest\DrestException::handleAlreadyDefinedForRoute