EnableModule   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
wmc 3
c 0
b 0
f 0
lcom 1
cbo 4
dl 0
loc 33
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B execute() 0 27 3
1
<?php
2
3
namespace N98\Magento\Command\Developer\Module\Create\SubCommand;
4
5
use N98\Magento\Command\SubCommand\AbstractSubCommand;
6
use Symfony\Component\Console\Input\ArrayInput;
7
8
class EnableModule extends AbstractSubCommand
9
{
10
    /**
11
     * @return bool
0 ignored issues
show
Documentation introduced by
Should the return type not be false|null?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
12
     */
13
    public function execute()
14
    {
15
        if (!$this->config->getBool('shouldEnableModule')) {
16
            return false;
17
        }
18
19
        if ($this->config->getBool('isModmanMode')) {
20
            $this->output->writeln('<error>Module cannot be activated in modman mode</error>');
21
            return false;
22
        }
23
24
        $application = $this->getCommand()->getApplication();
25
26
        $combinedModuleName = $this->config->getString('vendorNamespace')
27
                            . '_'
28
                            . $this->config->getString('moduleName');
29
30
        $application->setAutoExit(false);
31
        $application->run(
32
            new ArrayInput(
33
                [
34
                    'command' => 'module:enable',
35
                    'module'  => [$combinedModuleName],
36
                ]
37
            )
38
        );
39
    }
40
}
41