Completed
Push — master ( 8bc203...e5859f )
by recca
09:43
created

GeneratorCommand::getStubResource()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2.032

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 4
cts 5
cp 0.8
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 5
nc 2
nop 2
crap 2.032
1
<?php
2
3
namespace Recca0120\Generator\Console;
4
5
use Illuminate\Console\Command;
6
use Recca0120\Generator\Generator;
7
use Symfony\Component\Console\Input\InputArgument;
8
9
class GeneratorCommand extends Command
10
{
11
    private $generator;
12
13
    private $command;
14
15
    public function __construct(Generator $generator, $command)
16
    {
17
        $this->generator = $generator;
18
        $this->command = $command;
19
        $this->name = 'generate:'.$command;
20
21
        parent::__construct();
22
    }
23
24
    public function handle()
25
    {
26
        $this->generator->generate($this->command, $this->argument('name'))->store();
27
    }
28
29
    /**
30
     * Get the console command arguments.
31
     *
32
     * @return array
33
     */
34
    protected function getArguments()
35
    {
36
        return [
37
            ['name', InputArgument::REQUIRED, 'name'],
38
        ];
39
    }
40
}
41