Completed
Pull Request — master (#5)
by
unknown
04:25
created

ViewModelMakeCommand::getStub()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Spatie\ViewModels\Console;
4
5
use Illuminate\Console\GeneratorCommand;
6
use Symfony\Component\Console\Input\InputOption;
7
8
class ViewModelMakeCommand extends GeneratorCommand
9
{
10
    /**
11
     * The console command name.
12
     *
13
     * @var string
14
     */
15
    protected $name = 'make:view-model';
16
17
    /**
18
     * The console command description.
19
     *
20
     * @var string
21
     */
22
    protected $description = 'Create a new ViewModel class';
23
24
    /**
25
     * The type of class being generated.
26
     *
27
     * @var string
28
     */
29
    protected $type = 'ViewModel';
30
31
    /**
32
     * Execute the console command.
33
     *
34
     * @return void
35
     */
36
    public function handle()
37
    {
38
        if (parent::handle() === false && ! $this->option('force')) {
39
            return;
40
        }
41
    }
42
43
    /**
44
     * Get the stub file for the generator.
45
     *
46
     * @return string
47
     */
48
    protected function getStub()
49
    {
50
        return __DIR__.'/../../stubs/DummyViewModel.stub';
51
    }
52
53
    /**
54
     * Get the console command options.
55
     *
56
     * @return array
57
     */
58
    protected function getOptions(): array
59
    {
60
        return [
61
            ['force', null, InputOption::VALUE_NONE, 'Create the class even if the view-model already exists'],
62
        ];
63
    }
64
}
65