*/
abstract class AnnotationClassLoader implements LoaderInterface
{
- /**
- * @var Reader
- */
protected $reader;
/**
*/
protected $defaultRouteIndex = 0;
- /**
- * Constructor.
- *
- * @param Reader $reader
- */
public function __construct(Reader $reader)
{
$this->reader = $reader;
}
}
+ if (0 === $collection->count() && $class->hasMethod('__invoke')) {
+ foreach ($this->reader->getClassAnnotations($class) as $annot) {
+ if ($annot instanceof $this->routeAnnotationClass) {
+ $globals['path'] = '';
+ $globals['name'] = '';
+
+ $this->addRoute($collection, $annot, $globals, $class, $class->getMethod('__invoke'));
+ }
+ }
+ }
+
return $collection;
}
if (null === $name) {
$name = $this->getDefaultRouteName($class, $method);
}
+ $name = $globals['name'].$name;
$defaults = array_replace($globals['defaults'], $annot->getDefaults());
foreach ($method->getParameters() as $param) {
'methods' => array(),
'host' => '',
'condition' => '',
+ 'name' => '',
);
if ($annot = $this->reader->getClassAnnotation($class, $this->routeAnnotationClass)) {
+ if (null !== $annot->getName()) {
+ $globals['name'] = $annot->getName();
+ }
+
if (null !== $annot->getPath()) {
$globals['path'] = $annot->getPath();
}