Return early in case of wrong controller pattern

This commit is contained in:
Jordi Boggiano 2012-04-13 14:12:13 +02:00
parent 2791512139
commit 15d56360f3

View File

@ -113,7 +113,10 @@ class ApiDocExtractor
*/
public function get($controller, $route)
{
preg_match('#(.+)::([\w]+)#', $controller, $matches);
if (!preg_match('#(.+)::([\w]+)#', $controller, $matches)) {
return;
}
$method = new \ReflectionMethod($matches[1], $matches[2]);
if ($annot = $this->reader->getMethodAnnotation($method, self::ANNOTATION_CLASS)) {
@ -121,7 +124,5 @@ class ApiDocExtractor
return array('annotation' => $annot, 'route' => $route);
}
}
return null;
}
}