These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | namespace Skrz\Bundle\AutowiringBundle; |
||
3 | |||
4 | use Doctrine\Common\Annotations\AnnotationReader; |
||
5 | use Doctrine\Common\Annotations\PhpParser; |
||
6 | use Skrz\Bundle\AutowiringBundle\DependencyInjection\ClassMultiMap; |
||
7 | use Skrz\Bundle\AutowiringBundle\DependencyInjection\Compiler\AutowiringCompilerPass; |
||
8 | use Skrz\Bundle\AutowiringBundle\DependencyInjection\Compiler\ClassMapBuildCompilerPass; |
||
9 | use Skrz\Bundle\AutowiringBundle\DependencyInjection\SkrzAutowiringExtension; |
||
10 | use Symfony\Component\DependencyInjection\Compiler\PassConfig; |
||
11 | use Symfony\Component\DependencyInjection\ContainerBuilder; |
||
12 | use Symfony\Component\HttpKernel\Bundle\Bundle; |
||
13 | |||
14 | /** |
||
15 | * @author Jakub Kulhan <[email protected]> |
||
16 | */ |
||
17 | class SkrzAutowiringBundle extends Bundle |
||
18 | { |
||
19 | |||
20 | /** |
||
21 | * {@inheritDoc} |
||
22 | */ |
||
23 | public function getContainerExtension() |
||
24 | 1 | { |
|
25 | if ($this->extension === null) { |
||
26 | 1 | $this->extension = new SkrzAutowiringExtension(); |
|
27 | 1 | } |
|
28 | 1 | ||
29 | return $this->extension; |
||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
![]() |
|||
30 | 1 | } |
|
31 | |||
32 | public function build(ContainerBuilder $container) |
||
33 | 1 | { |
|
34 | $annotationReader = new AnnotationReader(); |
||
35 | 1 | $autowiringClassMap = new ClassMultiMap($container); |
|
36 | 1 | ||
37 | $container->addCompilerPass( |
||
38 | 1 | new ClassMapBuildCompilerPass($autowiringClassMap), |
|
39 | 1 | PassConfig::TYPE_OPTIMIZE |
|
40 | ); |
||
41 | 1 | ||
42 | $container->addCompilerPass( |
||
43 | 1 | new AutowiringCompilerPass($autowiringClassMap, $annotationReader, new PhpParser()), |
|
44 | 1 | PassConfig::TYPE_OPTIMIZE |
|
45 | ); |
||
46 | 1 | } |
|
47 | |||
48 | } |
||
49 |