MagicInitCommand   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 76
Duplicated Lines 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
wmc 3
eloc 43
c 3
b 0
f 0
dl 0
loc 76
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 55 3
1
<?php
2
3
namespace Ikechukwukalu\Magicmake\Console\Commands;
4
5
class MagicInitCommand extends InitCommands
6
{
7
    /**
8
     * The name and signature of the console command.
9
     *
10
     * @var string
11
     */
12
    protected $signature = 'magic:init';
13
14
    /**
15
     * The console command description.
16
     *
17
     * @var string
18
     */
19
    protected $description = 'Scaffold the numerous classes';
20
21
    /**
22
     * Execute the console command.
23
     *
24
     * @return void
25
     */
26
    public function handle()
27
    {
28
        if (env('APP_ENV', 'production') != 'local') {
0 ignored issues
show
introduced by
The condition env('APP_ENV', 'production') != 'local' is always true.
Loading history...
29
            $this->components->error("This app environment is not local");
30
            return;
31
        }
32
33
        if (env('MAGIC_INIT_LOCK', true) === true) {
34
            $this->components->error("This action is blocked. MAGIC_INIT_LOCK is enabled by default");
35
            return;
36
        }
37
38
        $this->handleAppActionPath();
39
        $this->handleAppContractsPath();
40
        $this->handleAppEnumsPath();
41
        $this->handleAppEventsPath();
42
        $this->handleAppExceptionsPath();
43
        $this->handleAppFacadesPath();
44
        $this->handleAppHttpPath();
45
        $this->handleAppHttpControllersPath();
46
        $this->handleAppHttpControllersAuthPath();
47
        $this->handleAppHttpMiddlewarePath();
48
        $this->handleAppHttpRequestsPath();
49
        $this->handleAppHttpRequestsAuthPath();
50
        $this->handleAppListenersPath();
51
        $this->handleAppModelsPath();
52
        $this->handleAppModelsScopesPath();
53
        $this->handleAppNotificationsPath();
54
        $this->handleAppProvidersPath();
55
        $this->handleAppRepositoriesPath();
56
        $this->handleAppRulesPath();
57
        $this->handleAppServicesPath();
58
        $this->handleAppServicesAuthPath();
59
        $this->handleAppTraitsPath();
60
61
        $this->handleConfigPath();
62
63
        $this->handleDatabasePath();
64
65
        $this->handleLangPath();
66
67
        $this->handleRoutesPath();
68
69
        $this->handleTestsPath();
70
71
        $this->handleResourcesPath();
72
73
        $this->callSilently("vendor:publish", ["--provider" => "Laragear\TwoFactor\TwoFactorServiceProvider"]);
74
        $this->components->info("Laragear TwoFactor migration and config file published");
75
76
        $this->callSilently("vendor:publish", ["--provider" => "Spatie\Activitylog\ActivitylogServiceProvider", "--tag" => "activitylog-migrations"]);
77
        $this->components->info("Spatie ActivityLog migration and config file published");
78
79
        $this->callSilently("vendor:publish", ["--provider" => "Spatie\Permission\PermissionServiceProvider"]);
80
        $this->components->info("Spatie Permissions migration and config file published");
81
    }
82
}
83