Completed
Push — master ( 59e60c...053593 )
by Song
02:38 queued 11s
created

ControllerCommand::getControllerName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 6
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Encore\Admin\Console;
4
5
use Illuminate\Console\GeneratorCommand;
6
use Illuminate\Database\Eloquent\Model;
7
use Illuminate\Support\Str;
8
9
class ControllerCommand extends MakeCommand
10
{
11
    /**
12
     * The console command name.
13
     *
14
     * @var string
15
     */
16
    protected $signature = 'admin:controller {model}
17
        {--title=}
18
        {--stub= : Path to the custom stub file. }
19
        {--namespace=}
20
        {--O|output}';
21
22
    /**
23
     * The console command description.
24
     *
25
     * @var string
26
     */
27
    protected $description = 'Make admin controller from giving model';
28
29
    /**
30
     * @return array|string|null
31
     */
32
    protected function getModelName()
33
    {
34
        return $this->argument('model');
35
    }
36
37
    /**
38
     * @return string
39
     * @throws \ReflectionException
40
     */
41
    protected function getControllerName()
42
    {
43
        $name = (new \ReflectionClass($this->modelName))->getShortName();
44
45
        return $name . 'Controller';
46
    }
47
}
48