Completed
Pull Request — master (#5)
by
unknown
05:20 queued 01:32
created

ViewModelMakeCommand::getOptions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
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
    protected $name = 'make:view-model';
11
12
    protected $description = 'Create a new ViewModel class';
13
14
    protected $type = 'ViewModel';
15
16
    public function handle()
17
    {
18
        if (parent::handle() === false) {
19
            if (! $this->option('force')) {
20
                return;
21
            }
22
        }
23
    }
24
25
    protected function getStub()
26
    {
27
        return __DIR__.'/../../stubs/DummyViewModel.stub';
28
    }
29
30
    protected function getOptions(): array
31
    {
32
        return [
33
            ['force', null, InputOption::VALUE_NONE, 'Create the class even if the view-model already exists'],
34
        ];
35
    }
36
}
37