| 1 | <?php |
||
| 12 | class AddCommandPass implements CompilerPassInterface |
||
| 13 | { |
||
| 14 | /** |
||
| 15 | * @inheritDoc |
||
| 16 | */ |
||
| 17 | 1 | public function process(ContainerBuilder $container) |
|
| 18 | { |
||
| 19 | 1 | if (false === $container->has('psysh.shell')) { |
|
| 20 | return; |
||
| 21 | } |
||
| 22 | |||
| 23 | 1 | $services = $container->findTaggedServiceIds('psysh.command', true); |
|
| 24 | 1 | if (empty($services)) { |
|
| 25 | return; |
||
| 26 | } |
||
| 27 | |||
| 28 | 1 | $container->getDefinition('psysh.shell') |
|
| 29 | 1 | ->addMethodCall('addCommands', [$this->commands($services)]); |
|
| 30 | 1 | } |
|
| 31 | |||
| 32 | 1 | private function commands(array $services): array |
|
| 41 | } |
||
| 42 |