/** * @param \ReflectionMethod $method * @param string $controllerPath * @throws RouterConfigurationException */ private function configureControllerMethod(\ReflectionMethod $method, $controllerPath) { /** @var HttpVerb $httpVerbAnnotation */ $httpVerbAnnotation = null; $annotations = Annotations::ofMethod($method); foreach ($annotations as $annotation) { if (in_array(get_class($annotation), $this->httpVerbsAnnotations)) { $httpVerbAnnotation = $annotation; break; } } if ($httpVerbAnnotation === null) { return; } $methodPath = $httpVerbAnnotation->path; $fullPath = $this->basePath . $controllerPath . $methodPath; $methodFullName = $method->getDeclaringClass()->getName() . '::' . $method->getName(); $httpVerb = $this->httpVerbsByAnnotations[get_class($httpVerbAnnotation)]; $this->routeCollector->addRoute($httpVerb, $fullPath, $methodFullName); }
public function testMalformedParamAnnotationThrowsException() { $this->setExpectedException(self::ANNOTATION_EXCEPTION, 'ParamAnnotation requires a type property'); Annotations::ofMethod('BrokenParamAnnotationClass', 'brokenParamAnnotation'); }