1 | <?php |
||||||
2 | |||||||
3 | namespace Bmatovu\MultiAuth\Console\Traits; |
||||||
4 | |||||||
5 | use Illuminate\Filesystem\Filesystem; |
||||||
6 | use Illuminate\Support\Str; |
||||||
7 | use Symfony\Component\Finder\Finder; |
||||||
8 | |||||||
9 | trait InstallsBladeStack |
||||||
10 | { |
||||||
11 | /** |
||||||
12 | * Install the Blade Breeze stack. |
||||||
13 | * |
||||||
14 | * @return null|int |
||||||
15 | */ |
||||||
16 | 1 | protected function installBladeStack() |
|||||
17 | { |
||||||
18 | 1 | $fs = new Filesystem; |
|||||
19 | 1 | $guard = $this->argument('guard'); |
|||||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||||||
20 | 1 | $pluralClass = Str::plural(Str::studly($guard)); |
|||||
21 | 1 | $singularSlug = Str::singular(Str::slug($guard)); |
|||||
22 | 1 | $singularClass = Str::singular(Str::studly($guard)); |
|||||
23 | |||||||
24 | 1 | if (!$this->option('dark')) { |
|||||
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
![]() |
|||||||
25 | 1 | $finder = (new Finder) |
|||||
26 | 1 | ->in(__DIR__ . '/../../../.stubs/blade/resources/views') |
|||||
27 | 1 | ->name('*.blade.php') |
|||||
28 | 1 | ->notName('welcome.blade.php'); |
|||||
29 | |||||||
30 | 1 | $this->removeDarkClasses($finder); |
|||||
0 ignored issues
–
show
It seems like
removeDarkClasses() 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
![]() |
|||||||
31 | } |
||||||
32 | |||||||
33 | // Module... |
||||||
34 | 1 | $fs->ensureDirectoryExists(app_path("Modules/{$pluralClass}")); |
|||||
35 | 1 | $fs->copyDirectory(__DIR__ . '/../../../.stubs/blade/src', app_path("Modules/{$pluralClass}")); |
|||||
36 | |||||||
37 | // Views... |
||||||
38 | 1 | $fs->ensureDirectoryExists(resource_path("views/{$singularSlug}")); |
|||||
39 | 1 | $fs->copyDirectory(__DIR__ . '/../../../.stubs/blade/resources/views', resource_path("views/{$singularSlug}")); |
|||||
40 | |||||||
41 | // Tests... |
||||||
42 | 1 | $fs->ensureDirectoryExists(base_path("tests/Feature/{$pluralClass}")); |
|||||
43 | 1 | if ($this->option('pest')) { |
|||||
44 | $fs->copyDirectory(__DIR__ . '/../../../.stubs/blade/pest-tests/Feature', base_path("tests/Feature/{$pluralClass}")); |
||||||
45 | } else { |
||||||
46 | 1 | $fs->copyDirectory(__DIR__ . '/../../../.stubs/blade/tests/Feature', base_path("tests/Feature/{$pluralClass}")); |
|||||
47 | } |
||||||
48 | |||||||
49 | // Conclude... |
||||||
50 | 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
![]() |
|||||||
51 | |||||||
52 | 1 | $serviceProvider = "App\\Modules\\{$pluralClass}\\{$singularClass}ServiceProvider::class"; |
|||||
53 | |||||||
54 | 1 | $this->info("\nRegister `{$serviceProvider}` in `config/app.php`"); |
|||||
55 | } |
||||||
56 | } |
||||||
57 |