/**
* Process the method
* @param $resource
* @param Mapping\ClassMetaData $metadata
* @throws DrestException
*/
protected function processMethods($resource, Mapping\ClassMetaData $metadata)
{
/* @var \ReflectionMethod $method */
foreach ($resource['routes'] as $route) {
// Make sure the for is not empty
if (!isset($route['name']) || !is_string($route['name'])) {
throw DrestException::handleForCannotBeEmpty();
}
if (($routeMetaData = $metadata->getRouteMetaData($route['name'])) === false) {
throw DrestException::handleAnnotationDoesntMatchRouteName($route['name']);
}
if ($routeMetaData->hasHandleCall()) {
// There is already a handle set for this route
throw DrestException::handleAlreadyDefinedForRoute($routeMetaData);
}
// Set the handle
if (isset($route['handle_call'])) {
$routeMetaData->setHandleCall($route['handle_call']);
}
}
}