InitializerServiceProvider::boot()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 20

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 13
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 20
ccs 13
cts 13
cp 1
rs 9.6
c 0
b 0
f 0
cc 2
nc 2
nop 0
crap 2
1
<?php
2
3
namespace MadWeb\Initializer;
4
5
use Illuminate\Support\ServiceProvider;
6
use MadWeb\Initializer\Console\Commands\InstallCommand;
7
use MadWeb\Initializer\Console\Commands\UpdateCommand;
8
use MadWeb\Initializer\Contracts\Runner;
9
use NunoMaduro\LaravelConsoleTask\LaravelConsoleTaskServiceProvider;
10
11
class InitializerServiceProvider extends ServiceProvider
12
{
13
    /**
14
     * Bootstrap the application services.
15
     */
16 210
    public function boot()
17
    {
18 210
        $this->publishes([
19 210
            __DIR__.'/../config/initializer.php' => config_path('initializer.php'),
20 210
        ], 'config');
21
22 210
        $this->publishes([
23 210
            __DIR__.'/../stubs/install-class.stub' => app_path('Install.php'),
24 210
            __DIR__.'/../stubs/update-class.stub' => app_path('Update.php'),
25 210
        ], 'initializers');
26
27 210
        $this->app->register(LaravelConsoleTaskServiceProvider::class);
28
29 210
        if ($this->app->runningInConsole()) {
30 210
            $this->commands([
31 210
                InstallCommand::class,
32
                UpdateCommand::class,
33
            ]);
34
        }
35 210
    }
36
37
    /**
38
     * Register the application services.
39
     */
40 210
    public function register()
41
    {
42 210
        $this->mergeConfigFrom(__DIR__.'/../config/initializer.php', 'initializer');
43
44 210
        $this->app->bind('app.installer', \App\Install::class);
45 210
        $this->app->bind('app.updater', \App\Update::class);
46
47 210
        $this->app->bind(Runner::class, Run::class);
48 210
    }
49
}
50