Conditions | 5 |
Paths | 5 |
Total Lines | 20 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
27 | protected function execute(InputInterface $input, OutputInterface $output) |
||
28 | { |
||
29 | $commandName = $input->getArgument("command_name"); |
||
30 | $pluginName = $input->getArgument("plugin_name"); |
||
31 | /** @var \Padawan\Plugin\Package */ |
||
32 | $package = $this->getContainer()->get(Package::class); |
||
33 | $plugins = $package->getPluginsList(); |
||
34 | if ($commandName === 'add') { |
||
35 | if (array_key_exists($pluginName, $plugins)) { |
||
36 | return; |
||
37 | } |
||
38 | $plugins[] = $pluginName; |
||
39 | } elseif ($commandName === 'remove') { |
||
40 | if (!array_key_exists($pluginName, $plugins)) { |
||
41 | return; |
||
42 | } |
||
43 | unset($plugins[$pluginName]); |
||
44 | } |
||
45 | $package->writePluginsList($plugins); |
||
46 | } |
||
47 | } |
||
48 |