1 | <?php |
||||||
2 | |||||||
3 | namespace Bmatovu\MultiAuth\Console\Traits; |
||||||
4 | |||||||
5 | use Illuminate\Filesystem\Filesystem; |
||||||
6 | use Illuminate\Support\Str; |
||||||
7 | |||||||
8 | trait InstallsApiStack |
||||||
9 | { |
||||||
10 | /** |
||||||
11 | * Install the API Breeze stack. |
||||||
12 | * |
||||||
13 | * @return null|int |
||||||
14 | */ |
||||||
15 | 1 | protected function installApiStack() |
|||||
16 | { |
||||||
17 | 1 | $fs = new Filesystem; |
|||||
18 | 1 | $guard = $this->argument('guard'); |
|||||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||||||
19 | 1 | $pluralClass = Str::plural(Str::studly($guard)); |
|||||
20 | 1 | $singularClass = Str::singular(Str::studly($guard)); |
|||||
21 | |||||||
22 | // Module... |
||||||
23 | 1 | $fs->ensureDirectoryExists(app_path("Modules/{$pluralClass}")); |
|||||
24 | 1 | $fs->copyDirectory(__DIR__ . '/../../../.stubs/api/src', app_path("Modules/{$pluralClass}")); |
|||||
25 | |||||||
26 | // Tests... |
||||||
27 | 1 | $fs->ensureDirectoryExists(base_path("tests/Feature/{$pluralClass}")); |
|||||
28 | 1 | if ($this->option('pest')) { |
|||||
0 ignored issues
–
show
It seems like
option() must be provided by classes using this trait. How about adding it as abstract method to this trait?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
29 | $fs->copyDirectory(__DIR__ . '/../../../.stubs/api/pest-tests/Feature', base_path("tests/Feature/{$pluralClass}")); |
||||||
30 | } else { |
||||||
31 | 1 | $fs->copyDirectory(__DIR__ . '/../../../.stubs/api/tests/Feature', base_path("tests/Feature/{$pluralClass}")); |
|||||
32 | } |
||||||
33 | |||||||
34 | // Conclude... |
||||||
35 | 1 | $this->info("{$singularClass} guard successfully setup."); |
|||||
0 ignored issues
–
show
It seems like
info() must be provided by classes using this trait. How about adding it as abstract method to this trait?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
36 | |||||||
37 | 1 | $serviceProvider = "App\\Modules\\{$pluralClass}\\{$singularClass}ServiceProvider::class"; |
|||||
38 | |||||||
39 | 1 | $this->info("\nRegister `{$serviceProvider}` in `config/app.php`"); |
|||||
40 | } |
||||||
41 | } |
||||||
42 |