ConsoleServiceProvider   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 3
eloc 44
c 2
b 0
f 0
dl 0
loc 56
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 5 2
A provides() 0 3 1
1
<?php
2
3
namespace Rawilk\LaravelModules\Providers;
4
5
use Illuminate\Support\ServiceProvider;
6
use Rawilk\LaravelModules\Commands\Generators\CommandMakeCommand;
7
use Rawilk\LaravelModules\Commands\Generators\ControllerMakeCommand;
8
use Rawilk\LaravelModules\Commands\Generators\EventMakeCommand;
9
use Rawilk\LaravelModules\Commands\Generators\FactoryMakeCommand;
10
use Rawilk\LaravelModules\Commands\Generators\JobMakeCommand;
11
use Rawilk\LaravelModules\Commands\Generators\ListenerMakeCommand;
12
use Rawilk\LaravelModules\Commands\Generators\MailMakeCommand;
13
use Rawilk\LaravelModules\Commands\Generators\MiddlewareMakeCommand;
14
use Rawilk\LaravelModules\Commands\Generators\MigrationMakeCommand;
15
use Rawilk\LaravelModules\Commands\Generators\ModelMakeCommand;
16
use Rawilk\LaravelModules\Commands\Generators\ModuleMakeCommand;
17
use Rawilk\LaravelModules\Commands\Generators\PolicyMakeCommand;
18
use Rawilk\LaravelModules\Commands\Generators\ProviderMakeCommand;
19
use Rawilk\LaravelModules\Commands\Generators\RepositoryMakeCommand;
20
use Rawilk\LaravelModules\Commands\Generators\RequestMakeCommand;
21
use Rawilk\LaravelModules\Commands\Generators\ResourceMakeCommand;
22
use Rawilk\LaravelModules\Commands\Generators\RouteProviderMakeCommand;
23
use Rawilk\LaravelModules\Commands\Generators\RuleMakeCommand;
24
use Rawilk\LaravelModules\Commands\Generators\SeedMakeCommand;
25
use Rawilk\LaravelModules\Commands\Generators\TestMakeCommand;
26
use Rawilk\LaravelModules\Commands\Other\DisableCommand;
27
use Rawilk\LaravelModules\Commands\Other\DumpCommand;
28
use Rawilk\LaravelModules\Commands\Other\EnableCommand;
29
use Rawilk\LaravelModules\Commands\Other\InstallCommand;
30
use Rawilk\LaravelModules\Commands\Other\ListCommand;
31
use Rawilk\LaravelModules\Commands\Other\MigrateCommand;
32
use Rawilk\LaravelModules\Commands\Other\MigrateRefreshCommand;
33
use Rawilk\LaravelModules\Commands\Other\MigrateResetCommand;
34
use Rawilk\LaravelModules\Commands\Other\MigrateRollbackCommand;
35
use Rawilk\LaravelModules\Commands\Other\PublishCommand;
36
use Rawilk\LaravelModules\Commands\Other\PublishConfigurationCommand;
37
use Rawilk\LaravelModules\Commands\Other\PublishMigrationCommand;
38
use Rawilk\LaravelModules\Commands\Other\PublishTranslationCommand;
39
use Rawilk\LaravelModules\Commands\Other\SeedCommand;
40
use Rawilk\LaravelModules\Commands\Other\UnUseCommand;
41
use Rawilk\LaravelModules\Commands\Other\UpdateCommand;
42
use Rawilk\LaravelModules\Commands\Other\UseCommand;
43
44
class ConsoleServiceProvider extends ServiceProvider
45
{
46
    protected static $generatorCommands = [
47
        CommandMakeCommand::class,
48
        ControllerMakeCommand::class,
49
        EventMakeCommand::class,
50
        FactoryMakeCommand::class,
51
        JobMakeCommand::class,
52
        ListenerMakeCommand::class,
53
        MailMakeCommand::class,
54
        MiddlewareMakeCommand::class,
55
        MigrationMakeCommand::class,
56
        ModelMakeCommand::class,
57
        ModuleMakeCommand::class,
58
        PolicyMakeCommand::class,
59
        ProviderMakeCommand::class,
60
        RepositoryMakeCommand::class,
61
        RequestMakeCommand::class,
62
        ResourceMakeCommand::class,
63
        RouteProviderMakeCommand::class,
64
        RuleMakeCommand::class,
65
        SeedMakeCommand::class,
66
        TestMakeCommand::class,
67
    ];
68
69
    protected static $otherCommands = [
70
        DisableCommand::class,
71
        DumpCommand::class,
72
        EnableCommand::class,
73
        InstallCommand::class,
74
        ListCommand::class,
75
        MigrateCommand::class,
76
        MigrateRefreshCommand::class,
77
        MigrateResetCommand::class,
78
        MigrateRollbackCommand::class,
79
        PublishCommand::class,
80
        PublishConfigurationCommand::class,
81
        PublishMigrationCommand::class,
82
        PublishTranslationCommand::class,
83
        SeedCommand::class,
84
        UnUseCommand::class,
85
        UpdateCommand::class,
86
        UseCommand::class,
87
    ];
88
89
    public function boot(): void
90
    {
91
        if ($this->app->runningInConsole()) {
92
            $this->commands(static::$generatorCommands);
93
            $this->commands(static::$otherCommands);
94
        }
95
    }
96
97
    public function provides(): array
98
    {
99
        return array_merge(static::$generatorCommands, static::$otherCommands);
100
    }
101
}
102