createEtcModuleFile()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 14
rs 9.4285
cc 1
eloc 8
nc 1
nop 0
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