CreateModuleRegistrationFiles   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A execute() 0 5 1
A createEtcModuleFile() 0 14 1
A createRegistrationFile() 0 14 1
1
<?php
2
3
namespace N98\Magento\Command\Developer\Module\Create\SubCommand;
4
5
use N98\Magento\Command\SubCommand\AbstractSubCommand;
6
7
class CreateModuleRegistrationFiles extends AbstractSubCommand
8
{
9
    /**
10
     * @return boolean|null
11
     */
12
    public function execute()
13
    {
14
        $this->createRegistrationFile();
15
        $this->createEtcModuleFile();
16
    }
17
18
    protected function createEtcModuleFile()
19
    {
20
        $outFile = $this->config->getString('moduleDirectory') . '/etc/module.xml';
21
22
        \file_put_contents(
23
            $outFile,
24
            $this->getCommand()->getHelper('twig')->render(
25
                'dev/module/create/app/code/module/etc/module.xml.twig',
26
                $this->config->getArray('twigVars')
27
            )
28
        );
29
30
        $this->output->writeln('<info>Created file: <comment>' . $outFile . '<comment></info>');
31
    }
32
33
    protected function createRegistrationFile()
34
    {
35
        $outFile = $this->config->getString('moduleDirectory') . '/registration.php';
36
37
        \file_put_contents(
38
            $outFile,
39
            $this->getCommand()->getHelper('twig')->render(
40
                'dev/module/create/app/code/module/registration.php.twig',
41
                $this->config->getArray('twigVars')
42
            )
43
        );
44
45
        $this->output->writeln('<info>Created file: <comment>' . $outFile . '<comment></info>');
46
    }
47
}
48