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