From 15d56360f32008ed54e917a086e6818124edaf55 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Fri, 13 Apr 2012 14:12:13 +0200 Subject: [PATCH] Return early in case of wrong controller pattern --- Extractor/ApiDocExtractor.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Extractor/ApiDocExtractor.php b/Extractor/ApiDocExtractor.php index 91c9901..64dee26 100644 --- a/Extractor/ApiDocExtractor.php +++ b/Extractor/ApiDocExtractor.php @@ -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; } }