1 | <?php |
||||
2 | |||||
3 | namespace InnoFlash\LaraStart\Console\Commands; |
||||
4 | |||||
5 | use InnoFlash\LaraStart\Console\Commands\Helpers\MakeFile; |
||||
6 | use InnoFlash\LaraStart\Helper; |
||||
7 | |||||
8 | class MakeServiceCommand extends MakeFile |
||||
9 | { |
||||
10 | /** |
||||
11 | * The name and signature of the console command. |
||||
12 | * |
||||
13 | * @var string |
||||
14 | */ |
||||
15 | protected $signature = 'make:service {name : The name of the service class with path too} {--m|model= : The model to attach to the service}'; |
||||
16 | |||||
17 | /** |
||||
18 | * The console command description. |
||||
19 | * |
||||
20 | * @var string |
||||
21 | */ |
||||
22 | protected $description = 'This creates a service class for a specified model if supplied'; |
||||
23 | |||||
24 | public function getStub() |
||||
25 | { |
||||
26 | if ($this->hasArgument('name')) { |
||||
27 | return __DIR__.'/stubs/FullService.stub'; |
||||
28 | } else { |
||||
29 | return __DIR__.'/stubs/PlainService.stub'; |
||||
30 | } |
||||
31 | } |
||||
32 | |||||
33 | public function getModel() |
||||
34 | { |
||||
35 | return $this->argument('model'); |
||||
36 | } |
||||
37 | |||||
38 | public function getFilename() |
||||
39 | { |
||||
40 | return Helper::getFileName($this->argument('name')).'.php'; |
||||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||||
41 | } |
||||
42 | |||||
43 | public function getPath() |
||||
44 | { |
||||
45 | return \app_path('Services/'.Helper::getDirName($this->argument('name'))); |
||||
0 ignored issues
–
show
It seems like
$this->argument('name') can also be of type null and string[] ; however, parameter $fullname of InnoFlash\LaraStart\Helper::getDirName() does only seem to accept string , maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
46 | } |
||||
47 | } |
||||
48 |