Conditions | 2 |
Paths | 2 |
Total Lines | 25 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Tests | 13 |
CRAP Score | 2.0014 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
15 | 1 | protected function installApiStack() |
|
16 | { |
||
17 | 1 | $fs = new Filesystem; |
|
18 | 1 | $guard = $this->argument('guard'); |
|
|
|||
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')) { |
|
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."); |
|
36 | |||
37 | 1 | $serviceProvider = "App\\Modules\\{$pluralClass}\\{$singularClass}ServiceProvider::class"; |
|
38 | |||
39 | 1 | $this->info("\nRegister `{$serviceProvider}` in `config/app.php`"); |
|
40 | } |
||
42 |