Completed
Push — master ( ac48e3...f05831 )
by Tom
04:26
created

CreateSetupFiles   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 54
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 2
Bugs 1 Features 0
Metric Value
wmc 1
c 2
b 1
f 0
lcom 1
cbo 4
dl 0
loc 54
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A execute() 0 48 1
1
<?php
2
3
namespace N98\Magento\Command\Developer\Module\Create\SubCommand;
4
5
use N98\Magento\Command\SubCommand\AbstractSubCommand;
6
7
class CreateSetupFiles extends AbstractSubCommand
8
{
9
    /**
10
     * @return bool
0 ignored issues
show
Documentation introduced by
Should the return type not be boolean|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...
11
     */
12
    public function execute()
13
    {
14
        $setupFolder = $this->config->getString('moduleDirectory') . '/Setup';
15
16
        \file_put_contents(
17
            $setupFolder . '/InstallSchema.php',
18
            $this->getCommand()->getHelper('twig')->render(
19
                'dev/module/create/app/code/module/Setup/InstallSchema.php.twig',
20
                $this->config->getArray('twigVars')
21
            )
22
        );
23
        $this->output->writeln(
24
            '<info>Created file: <comment>' .  $setupFolder . '/InstallSchema.php' .'<comment></info>'
25
        );
26
27
        \file_put_contents(
28
            $setupFolder . '/InstallData.php',
29
            $this->getCommand()->getHelper('twig')->render(
30
                'dev/module/create/app/code/module/Setup/InstallData.php.twig',
31
                $this->config->getArray('twigVars')
32
            )
33
        );
34
        $this->output->writeln(
35
            '<info>Created file: <comment>' .  $setupFolder . '/InstallData.php' .'<comment></info>'
36
        );
37
38
        \file_put_contents(
39
            $setupFolder . '/UpgradeSchema.php',
40
            $this->getCommand()->getHelper('twig')->render(
41
                'dev/module/create/app/code/module/Setup/UpgradeSchema.php.twig',
42
                $this->config->getArray('twigVars')
43
            )
44
        );
45
        $this->output->writeln(
46
            '<info>Created file: <comment>' .  $setupFolder . '/UpgradeSchema.php' .'<comment></info>'
47
        );
48
49
        \file_put_contents(
50
            $setupFolder . '/UpgradeData.php',
51
            $this->getCommand()->getHelper('twig')->render(
52
                'dev/module/create/app/code/module/Setup/UpgradeData.php.twig',
53
                $this->config->getArray('twigVars')
54
            )
55
        );
56
        $this->output->writeln(
57
            '<info>Created file: <comment>' .  $setupFolder . '/UpgradeData.php' .'<comment></info>'
58
        );
59
    }
60
}
61