Passed
Push — master ( 590453...ad5a85 )
by Arthur
24:49
created

CommandMakeCommand::stubOptions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 6
rs 10
c 0
b 0
f 0
ccs 1
cts 1
cp 1
crap 1
1
<?php
2
3
namespace Foundation\Generator\Commands;
4
5
use Foundation\Generator\Abstracts\AbstractGeneratorCommand;
6
use Foundation\Generator\Abstracts\ClassGeneratorCommand;
7
use Foundation\Generator\Events\CommandGeneratedEvent;
8
use Symfony\Component\Console\Input\InputOption;
9
10
class CommandMakeCommand extends ClassGeneratorCommand
11
{
12
    /**
13
     * The console command name.
14
     *
15
     * @var string
16
     */
17
    protected $name = 'larapi:make:command';
18
19
    /**
20
     * The console command description.
21
     *
22
     * @var string
23
     */
24
    protected $description = 'Generate new Artisan command for the specified module.';
25
26
    /**
27
     * The name of the generated resource.
28
     *
29
     * @var string
30
     */
31
    protected $generatorName = 'command';
32
33
    /**
34
     * The stub name.
35
     *
36
     * @var string
37
     */
38
    protected $stub = 'command.stub';
39
40
    /**
41
     * The event that will fire when the file is created.
42
     *
43
     * @var string
44
     */
45 1
    protected $event = CommandGeneratedEvent::class;
46
47
    /**
48 1
     * The file path.
49 1
     *
50 1
     * @var string
51
     */
52
    protected $filePath = '/Console';
53
54
    protected function stubOptions(): array
55
    {
56
        return [
57
            'CLASS' => $this->getClassName(),
58
            'COMMAND_NAME' => $this->getCommandName(),
59 87
            'NAMESPACE' => $this->getClassNamespace(),
60
        ];
61
    }
62 87
63
    /**
64
     * Get the console command options.
65
     *
66
     * @return array
67
     */
68
    protected function setOptions(): array
69 1
    {
70
        return [
71 1
            ['command', null, InputOption::VALUE_OPTIONAL, 'The terminal command that should be assigned.', null],
72
        ];
73
    }
74
75
    /**
76
     * @return string
77
     */
78
    protected function getCommandName()
79
    {
80
        return $this->getOption('command');
81
    }
82
83
    protected function handleCommandOption($shortcut, $type, $question, $default){
0 ignored issues
show
Unused Code introduced by
The parameter $shortcut is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

83
    protected function handleCommandOption(/** @scrutinizer ignore-unused */ $shortcut, $type, $question, $default){

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $default is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

83
    protected function handleCommandOption($shortcut, $type, $question, /** @scrutinizer ignore-unused */ $default){

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $type is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

83
    protected function handleCommandOption($shortcut, /** @scrutinizer ignore-unused */ $type, $question, $default){

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $question is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

83
    protected function handleCommandOption($shortcut, $type, /** @scrutinizer ignore-unused */ $question, $default){

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
84
        return $this->ask('What is the name of the terminal command?',str_replace('command', '', strtolower($this->getModuleName()) . ':' . strtolower($this->getClassName())));
85
    }
86
}
87