Conditions | 4 |
Paths | 4 |
Total Lines | 33 |
Code Lines | 17 |
Lines | 0 |
Ratio | 0 % |
Tests | 20 |
CRAP Score | 4.0016 |
Changes | 0 |
1 | <?php |
||
20 | 5 | public function process(ContainerBuilder $container) |
|
21 | { |
||
22 | 5 | if (!$container->hasDefinition('bankiru_api.chain_driver')) { |
|
23 | return; |
||
24 | } |
||
25 | |||
26 | 5 | $driver = $container->getDefinition('bankiru_api.chain_driver'); |
|
27 | |||
28 | 5 | foreach ($container->getParameter('kernel.bundles') as $bundle) { |
|
29 | 5 | $refl = new \ReflectionClass($bundle); |
|
30 | 5 | $path = dirname($refl->getFileName()) . '/Resources/config/api/'; |
|
31 | |||
32 | 5 | if (!is_dir($path)) { |
|
33 | 5 | continue; |
|
34 | } |
||
35 | |||
36 | 2 | $namespace = $refl->getNamespaceName() . '\Entity'; |
|
37 | |||
38 | 2 | $locatorDef = new Definition( |
|
39 | 2 | SymfonyFileLocator::class, |
|
40 | [ |
||
41 | [ |
||
42 | 2 | $path => $namespace, |
|
43 | 2 | ], |
|
44 | 2 | '.api.yml', |
|
45 | 2 | DIRECTORY_SEPARATOR, |
|
46 | ] |
||
47 | 2 | ); |
|
48 | 2 | $driverDef = new Definition(YmlMetadataDriver::class, [$locatorDef]); |
|
49 | |||
50 | 2 | $driver->addMethodCall('addDriver', [$driverDef, $namespace]); |
|
51 | 5 | } |
|
52 | 5 | } |
|
53 | } |
||
54 |