Completed
Push — master ( fc24a2...683923 )
by wen
10:29
created

ArtisanServiceProvider::provides()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Sco\Admin\Providers;
4
5
use Illuminate\Support\ServiceProvider;
6
use Sco\Admin\Console\ComponentMakeCommand;
7
use Sco\Admin\Console\InstallCommand;
8
9
class ArtisanServiceProvider extends ServiceProvider
10
{
11
    protected $defer = true;
12
13
    protected $commands = [
14
        'Install' => 'command.install',
15
        'ComponentMake' => 'command.component.make',
16
    ];
17
18
    public function register()
19
    {
20
        $this->registerCommands($this->commands);
21
    }
22
23
    /**
24
     * Register the given commands.
25
     *
26
     * @param  array  $commands
27
     * @return void
28
     */
29
    protected function registerCommands(array $commands)
30
    {
31
        foreach (array_keys($commands) as $command) {
32
            call_user_func_array([$this, "register{$command}Command"], []);
33
        }
34
35
        $this->commands(array_values($commands));
36
    }
37
38
    /**
39
     * Register the command.
40
     *
41
     * @return void
42
     */
43
    protected function registerInstallCommand()
44
    {
45
        $this->app->singleton('command.install', function ($app) {
0 ignored issues
show
Unused Code introduced by
The parameter $app is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
46
            return new InstallCommand;
47
        });
48
    }
49
50
    /**
51
     * Register the command.
52
     *
53
     * @return void
54
     */
55
    protected function registerComponentMakeCommand()
56
    {
57
        $this->app->singleton('command.component.make', function ($app) {
58
            return new ComponentMakeCommand($app['files']);
59
        });
60
    }
61
62
    public function provides()
63
    {
64
        return array_values($this->commands);
65
    }
66
}
67