예제 #1
0
 /**
  * Get the @url annotation value for a particular auto-route callable
  *
  * @param \DocBlock\Element\MethodElement $method
  *
  * @return null
  * @throws \RuntimeException
  */
 private function getRouteAnnotation(MethodElement $method)
 {
     $routeAnnotation = $method->getAnnotation(self::ROUTE);
     if (!empty($routeAnnotation) && (empty($routeAnnotation->values) || empty($routeAnnotation->values[0]))) {
         throw new RuntimeException("The method [" . $method->getClass()->name . "::" . $method->name . "] requires " . "a value for the @" . self::ROUTE . " annotation. Example:\n" . "/**\n" . "* @" . self::ROUTE . " /users/get\n" . "*/");
     }
     if (!empty($routeAnnotation)) {
         return $routeAnnotation->values[0];
     }
     return null;
 }