protected function guessMissingFields(Route $annotation, $method, $controllerClass) { if ($method instanceof ReflectionMethod) { $methodName = $method->getName(); } else { if (is_string($method)) { $methodName = $method; } else { throw new Exception('Method must be a string or instance of MethodReflection'); } } if (!$annotation->hasName()) { $annotation->setName($this->filterActionMethodName($methodName)); } if (!$annotation->hasType()) { if (preg_match('/:[\\w\\d]+/', $annotation->getRoute())) { $annotation->setType('segment'); } else { $annotation->setType('literal'); } } if (!$annotation->hasDefaultController()) { $controllerClass = $this->getReferencedController($controllerClass); $annotation->setDefaultController($controllerClass); } if (!$annotation->hasDefaultAction()) { $annotation->setDefaultAction($this->filterActionMethodName($methodName)); } if (!$annotation->hasRoute()) { $annotation->setRoute('/' . $this->filterActionMethodName($methodName)); } return $annotation; }