Completed
Push — master ( bbdd37...061748 )
by Vincenzo
02:24
created

GeneratorHelperCommand::getHead()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
4
namespace App\Lib\Slime\Console;
5
6
7
abstract class GeneratorHelperCommand extends SlimeCommand
8
{
9
    public function run()
10
    {
11
        $result = file_put_contents(
12
            $this->getFilePath() . $this->getFileName() . $this->getFileExtension()
13
            ,
14
            $this->getHead() . $this->getStub()
15
        );
16
        return $result !== false ? 0 : 1;
17
    }
18
19
    protected abstract function getFilePath();
20
21
    protected function getHead()
22
    {
23
        return "<?php" . PHP_EOL;
24
    }
25
26
    protected function getFileName()
27
    {
28
        return $this->getArg(0);
29
    }
30
31
    protected function getFileExtension()
32
    {
33
        return ".php";
34
    }
35
36
    protected function getStub()
37
    {
38
        return "";
39
    }
40
41
}