Conditions | 2 |
Paths | 2 |
Total Lines | 19 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Tests | 15 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
22 | 3 | public function execute(InputInterface $input, OutputInterface $output) |
|
23 | { |
||
24 | 3 | $moduleName = $input->getArgument('name'); |
|
25 | 3 | if(!$this->getService('module_manager')->has($moduleName)){ |
|
26 | 1 | $textFinder = new Finder($moduleName, array_keys($this->getService('module_manager')->getAll()->getArrayCopy())); |
|
|
|||
27 | 1 | $output->writeln(sprintf( |
|
28 | 1 | '<error>Module "%s" not found! Did you mean "%s"?</error>', |
|
29 | 1 | $moduleName, |
|
30 | 1 | $textFinder->first() |
|
31 | 1 | )); |
|
32 | 1 | return ITask::BLOCKING_ERROR_CODE; |
|
33 | } |
||
34 | |||
35 | 2 | $module = $this->getService('module_manager')->get($moduleName); |
|
36 | 3 | $module->setIsEnable($input->getArgument('action') === 'enable'); |
|
37 | 2 | $this->getService('module_manager')->modify($moduleName, $module); |
|
38 | 2 | $output->writeln(sprintf('<info>Module "%s" modified</info>', $moduleName)); |
|
39 | 2 | return ITask::NO_ERROR_CODE; |
|
40 | } |
||
41 | } |
||
42 |
Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.