router = $router; $this->reader = $reader; } public function all() { $array = array(); foreach ($this->router->getRouteCollection()->all() as $route) { preg_match('#(.+)::([\w]+)#', $route->getDefault('_controller'), $matches); $method = new \ReflectionMethod($matches[1], $matches[2]); if ($annot = $this->reader->getMethodAnnotation($method, self::ANNOTATION_CLASS)) { $array[] = array('annotation' => $annot, 'route' => $route); } } return $array; } public function get($controller, $route) { preg_match('#(.+)::([\w]+)#', $controller, $matches); $method = new \ReflectionMethod($matches[1], $matches[2]); if ($annot = $this->reader->getMethodAnnotation($method, self::ANNOTATION_CLASS)) { if ($route = $this->router->getRouteCollection()->get($route)) { return array('annotation' => $annot, 'route' => $route); } } return null; } }