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);
}
if (in_array(\DrestCommon\Request\Request::METHOD_GET, $routeMetaData->getVerbs(), true) && !$method->isStatic()) {
throw DrestException::handleForGetRouteMustBeStatic();
}
$routeMetaData->setHandleCall($method->getName());
}
}
}
}
}