Completed
Pull Request — master (#29)
by Kévin
02:21
created

AnnotationClassLoader::supports()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 2
eloc 2
nc 2
nop 2
1
<?php
2
3
/*
4
 * (c) Kévin Dunglas <[email protected]>
5
 *
6
 * This source file is subject to the MIT license that is bundled
7
 * with this source code in the file LICENSE.
8
 */
9
10
namespace Dunglas\ActionBundle\Routing;
11
12
use Doctrine\Common\Annotations\Reader;
13
use Symfony\Component\DependencyInjection\ContainerInterface;
14
use Symfony\Component\Routing\Loader\AnnotationClassLoader as BaseAnnotationClassLoader;
15
use Symfony\Component\Routing\Route;
16
17
/**
18
 * Sets the '_controller' default based on the service name associated with the action.
19
 *
20
 * @author Kévin Dunglas <[email protected]>
21
 */
22
class AnnotationClassLoader extends BaseAnnotationClassLoader
23
{
24
    /**
25
     * {@inheritdoc}
26
     */
27
    protected function configureRoute(Route $route, \ReflectionClass $class, \ReflectionMethod $method, $annot)
28
    {
29
        $route->setDefault('_controller', sprintf('controller.%s:%s', $class->name, $method->name));
30
    }
31
}
32