Conditions | 2 |
Paths | 2 |
Total Lines | 30 |
Code Lines | 17 |
Lines | 0 |
Ratio | 0 % |
Tests | 16 |
CRAP Score | 2.0008 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
15 | 1 | protected function installBladeStack() |
|
16 | { |
||
17 | 1 | $fs = new Filesystem; |
|
18 | 1 | $guard = $this->argument('guard'); |
|
|
|||
19 | 1 | $pluralClass = Str::plural(Str::studly($guard)); |
|
20 | 1 | $singularSlug = Str::singular(Str::slug($guard)); |
|
21 | 1 | $singularClass = Str::singular(Str::studly($guard)); |
|
22 | |||
23 | // Module... |
||
24 | 1 | $fs->ensureDirectoryExists(app_path("Modules/{$pluralClass}")); |
|
25 | 1 | $fs->copyDirectory(__DIR__ . '/../../../.stubs/blade/src', app_path("Modules/{$pluralClass}")); |
|
26 | |||
27 | // Views... |
||
28 | 1 | $fs->ensureDirectoryExists(resource_path("views/{$singularSlug}")); |
|
29 | 1 | $fs->copyDirectory(__DIR__ . '/../../../.stubs/blade/resources/views', resource_path("views/{$singularSlug}")); |
|
30 | |||
31 | // Tests... |
||
32 | 1 | $fs->ensureDirectoryExists(base_path("tests/Feature/{$singularClass}")); |
|
33 | 1 | if ($this->option('pest')) { |
|
34 | $fs->copyDirectory(__DIR__ . '/../../../.stubs/blade/pest-tests/Feature', base_path("tests/Feature/{$singularClass}")); |
||
35 | } else { |
||
36 | 1 | $fs->copyDirectory(__DIR__ . '/../../../.stubs/blade/tests/Feature', base_path("tests/Feature/{$singularClass}")); |
|
37 | } |
||
38 | |||
39 | // Conclude... |
||
40 | 1 | $this->info("{$singularClass} guard successfully setup."); |
|
41 | |||
42 | 1 | $serviceProvider = "App\\Modules\\{$pluralClass}\\{$singularClass}ServiceProvider::class"; |
|
43 | |||
44 | 1 | $this->info("\nRegister `{$serviceProvider}` in `config/app.php`"); |
|
45 | } |
||
47 |