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

GeneratorCommand   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 3
dl 0
loc 32
ccs 0
cts 12
cp 0
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
A handle() 0 4 1
A getArguments() 0 6 1
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