Conditions | 3 |
Paths | 3 |
Total Lines | 19 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 12 |
Changes | 0 |
1 | <?php |
||
23 | public function process(ContainerBuilder $container) |
||
24 | { |
||
25 | if (false === $container->hasDefinition('sculpin_twig.twig')) { |
||
26 | return; |
||
27 | } |
||
28 | |||
29 | $definition = $container->getDefinition('sculpin_twig.twig'); |
||
30 | |||
31 | // Extensions must always be registered before everything else. |
||
32 | // For instance, global variable definitions must be registered |
||
33 | // afterward. If not, the globals from the extensions will never |
||
34 | // be registered. |
||
35 | $calls = $definition->getMethodCalls(); |
||
36 | $definition->setMethodCalls([]); |
||
37 | foreach ($container->findTaggedServiceIds('twig.extension') as $id => $attributes) { |
||
38 | $definition->addMethodCall('addExtension', [new Reference($id)]); |
||
39 | } |
||
40 | $definition->setMethodCalls(array_merge($definition->getMethodCalls(), $calls)); |
||
41 | } |
||
42 | } |
||
43 |