Completed
Push — master ( 458505...cd7bb2 )
by recca
02:48
created

ScaffoldMakeCommand::handle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 10
ccs 0
cts 8
cp 0
rs 9.4285
cc 1
eloc 7
nc 1
nop 0
crap 2
1
<?php
2
3
namespace Recca0120\Generator\Console;
4
5
use Illuminate\Console\Command;
6
use Symfony\Component\Console\Input\InputOption;
7
use Symfony\Component\Console\Input\InputArgument;
8
9
class ScaffoldMakeCommand extends Command
10
{
11
    /**
12
     * The console command name.
13
     *
14
     * @var string
15
     */
16
    protected $name = 'generate:scaffold';
17
18
    /**
19
     * The console command description.
20
     *
21
     * @var string
22
     */
23
    protected $description = 'Create a new scaffold';
24
25
    /**
26
     * Execute the console command.
27
     *
28
     * @return bool|null
29
     */
30
    public function handle()
31
    {
32
        $name = $this->argument('name');
33
34
        $this->call('generate:controller', ['name' => $name]);
35
        $this->call('generate:view', ['name' => $name, '--view' => 'index']);
36
        $this->call('generate:view', ['name' => $name, '--view' => 'create']);
37
        $this->call('generate:view', ['name' => $name, '--view' => 'edit']);
38
        $this->call('generate:view', ['name' => $name, '--view' => '_form']);
39
    }
40
41
    /**
42
     * Get the console command arguments.
43
     *
44
     * @return array
45
     */
46
    protected function getArguments()
47
    {
48
        return [
49
            ['name', InputArgument::REQUIRED, 'The name of the class'],
50
        ];
51
    }
52
53
    /**
54
     * Get the console command options.
55
     *
56
     * @return array
57
     */
58 View Code Duplication
    protected function getOptions()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
59
    {
60
        return [
61
            ['extend', '', InputOption::VALUE_OPTIONAL, 'controller extend.'],
62
            ['view', '', InputOption::VALUE_OPTIONAL, 'view'],
63
        ];
64
    }
65
}
66