Test Failed
Push — master ( b3bb4f...b721f8 )
by Pascal
07:03
created

AnnotationClassLoader::configureRoute()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 4
1
<?php
2
3
namespace Skalpa\Silex\Symfony\Routing\Loader;
4
5
use Doctrine\Common\Annotations\Reader;
6
use Symfony\Component\Routing\Loader\AnnotationClassLoader as BaseAnnotationClassLoader;
7
use Symfony\Component\Routing\Route;
8
9
/**
10
 * Annotation loader that uses an external callable to configure routes.
11
 */
12
class AnnotationClassLoader extends BaseAnnotationClassLoader
13
{
14
    /** @var callable */
15
    private $configurationStrategy;
16
17
    public function __construct(Reader $reader, callable $configurationStrategy)
18
    {
19
        parent::__construct($reader);
20
21
        $this->configurationStrategy = $configurationStrategy;
22
    }
23
24
    protected function configureRoute(Route $route, \ReflectionClass $class, \ReflectionMethod $method, $annot)
25
    {
26
        $configure = $this->configurationStrategy;
27
        $configure($route, $class, $method, $annot);
28
    }
29
}
30