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\AutoscanCompilerPass; |
||
| 8 | use Skrz\Bundle\AutowiringBundle\DependencyInjection\Compiler\AutowiringCompilerPass; |
||
| 9 | use Skrz\Bundle\AutowiringBundle\DependencyInjection\Compiler\ClassMapBuildCompilerPass; |
||
| 10 | use Skrz\Bundle\AutowiringBundle\DependencyInjection\SkrzAutowiringExtension; |
||
| 11 | use Symfony\Component\DependencyInjection\Compiler\PassConfig; |
||
| 12 | use Symfony\Component\DependencyInjection\ContainerBuilder; |
||
| 13 | use Symfony\Component\HttpKernel\Bundle\Bundle; |
||
| 14 | |||
| 15 | /** |
||
| 16 | * @author Jakub Kulhan <[email protected]> |
||
| 17 | */ |
||
| 18 | class SkrzAutowiringBundle extends Bundle |
||
| 19 | { |
||
| 20 | |||
| 21 | /** |
||
| 22 | * {@inheritDoc} |
||
| 23 | */ |
||
| 24 | 1 | public function getContainerExtension() |
|
| 25 | { |
||
| 26 | 1 | if ($this->extension === null) { |
|
| 27 | 1 | $this->extension = new SkrzAutowiringExtension(); |
|
| 28 | 1 | } |
|
| 29 | |||
| 30 | 1 | return $this->extension; |
|
|
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
Loading history...
|
|||
| 31 | } |
||
| 32 | |||
| 33 | 1 | public function build(ContainerBuilder $container) |
|
| 34 | { |
||
| 35 | 1 | $annotationReader = new AnnotationReader; |
|
| 36 | 1 | $autoscanClassMap = new ClassMultiMap; |
|
| 37 | |||
| 38 | 1 | $container->addCompilerPass( |
|
| 39 | 1 | new ClassMapBuildCompilerPass($autoscanClassMap), |
|
| 40 | PassConfig::TYPE_BEFORE_OPTIMIZATION |
||
| 41 | 1 | ); |
|
| 42 | |||
| 43 | 1 | $container->addCompilerPass( |
|
| 44 | 1 | new AutoscanCompilerPass($autoscanClassMap, $annotationReader), |
|
| 45 | PassConfig::TYPE_BEFORE_OPTIMIZATION |
||
| 46 | 1 | ); |
|
| 47 | |||
| 48 | 1 | $autowiringClassMap = new ClassMultiMap; |
|
| 49 | |||
| 50 | 1 | $container->addCompilerPass( |
|
| 51 | 1 | new ClassMapBuildCompilerPass($autowiringClassMap), |
|
| 52 | PassConfig::TYPE_AFTER_REMOVING |
||
| 53 | 1 | ); |
|
| 54 | |||
| 55 | 1 | $container->addCompilerPass( |
|
| 56 | 1 | new AutowiringCompilerPass($autowiringClassMap, $annotationReader, new PhpParser), |
|
| 57 | PassConfig::TYPE_AFTER_REMOVING |
||
| 58 | 1 | ); |
|
| 59 | 1 | } |
|
| 60 | |||
| 61 | } |
||
| 62 |