AnnotationClassLoader::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 2
crap 1
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 18
    public function __construct(Reader $reader, callable $configurationStrategy)
18
    {
19 18
        parent::__construct($reader);
20
21 18
        $this->configurationStrategy = $configurationStrategy;
22 18
    }
23
24 8
    protected function configureRoute(Route $route, \ReflectionClass $class, \ReflectionMethod $method, $annotation)
25
    {
26 8
        $configure = $this->configurationStrategy;
27 8
        $configure($route, $class, $method, $annotation);
28 8
    }
29
}
30