mtvbrianking /
multi-auth
| 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 InstallsInertiaReactStack |
||||||
| 10 | { |
||||||
| 11 | /** |
||||||
| 12 | * Install the InertiaReact Breeze stack. |
||||||
| 13 | * |
||||||
| 14 | * @return null|int |
||||||
| 15 | */ |
||||||
| 16 | 1 | protected function installInertiaReactStack() |
|||||
| 17 | { |
||||||
| 18 | 1 | $fs = new Filesystem; |
|||||
| 19 | 1 | $guard = $this->argument('guard'); |
|||||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||||||
| 20 | 1 | $pluralClass = Str::plural(Str::studly($guard)); |
|||||
| 21 | 1 | $singularSlug = Str::singular(Str::slug($guard)); |
|||||
|
0 ignored issues
–
show
|
|||||||
| 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
Loading history...
|
|||||||
| 25 | 1 | $finder = (new Finder) |
|||||
| 26 | 1 | ->in(__DIR__ . "/../../../.stubs/react/resources/js") |
|||||
| 27 | 1 | ->name('*.jsx') |
|||||
| 28 | 1 | ->notName('Welcome.jsx'); |
|||||
| 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
Loading history...
|
|||||||
| 31 | } |
||||||
| 32 | |||||||
| 33 | // Module... |
||||||
| 34 | 1 | $fs->ensureDirectoryExists(app_path("Modules/{$pluralClass}")); |
|||||
| 35 | 1 | $fs->copyDirectory(__DIR__ . '/../../../.stubs/inertia/src', app_path("Modules/{$pluralClass}")); |
|||||
| 36 | |||||||
| 37 | // Views... |
||||||
| 38 | 1 | $fs->ensureDirectoryExists(resource_path("js/{$pluralClass}")); |
|||||
| 39 | 1 | $fs->copyDirectory(__DIR__ . '/../../../.stubs/react/resources/js', resource_path("js/{$pluralClass}")); |
|||||
| 40 | 1 | $fs->copyDirectory(__DIR__ . '/../../../.stubs/react/resources/views', resource_path("views")); |
|||||
| 41 | |||||||
| 42 | // Tests... |
||||||
| 43 | 1 | $fs->ensureDirectoryExists(base_path("tests/Feature/{$pluralClass}")); |
|||||
| 44 | 1 | if ($this->option('pest')) { |
|||||
| 45 | $fs->copyDirectory(__DIR__ . '/../../../.stubs/inertia/pest-tests/Feature', base_path("tests/Feature/{$pluralClass}")); |
||||||
| 46 | } else { |
||||||
| 47 | 1 | $fs->copyDirectory(__DIR__ . '/../../../.stubs/inertia/tests/Feature', base_path("tests/Feature/{$pluralClass}")); |
|||||
| 48 | } |
||||||
| 49 | |||||||
| 50 | // Conclude... |
||||||
| 51 | 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
Loading history...
|
|||||||
| 52 | |||||||
| 53 | 1 | $serviceProvider = "App\\Modules\\{$pluralClass}\\{$singularClass}ServiceProvider::class"; |
|||||
| 54 | |||||||
| 55 | 1 | $this->info("\nRegister `{$serviceProvider}` in `config/app.php`"); |
|||||
| 56 | } |
||||||
| 57 | } |
||||||
| 58 |