Conditions | 3 |
Paths | 3 |
Total Lines | 19 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
26 | public function process(ContainerBuilder $container) |
||
27 | { |
||
28 | if (!$container->has('psysh.shell')) { |
||
29 | return; |
||
30 | } |
||
31 | |||
32 | $commands = []; |
||
33 | foreach ($container->findTaggedServiceIds('psysh.command') as $id => $attributes) { |
||
34 | // Workaround to avoid Psysh commands to be registered as regular console commands |
||
35 | // (conflict with service autoconfiguration as Psysh commands inherit from \Symfony\Component\Console\Command\Command as well |
||
36 | // Note that this compiler pass must run with a higher priority than AddConsoleCommandPass to be efficient. |
||
37 | $container->findDefinition($id)->clearTag('console.command'); |
||
38 | $commands[] = new Reference($id); |
||
39 | } |
||
40 | |||
41 | |||
42 | $shellRef = $container->findDefinition('psysh.shell'); |
||
43 | $shellRef->addMethodCall('addCommands', [$commands]); |
||
44 | } |
||
45 | } |
||
46 |