GeneratorServiceProvider::boot()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 3
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
1
<?php
2
3
namespace Recca0120\Generator;
4
5
use Illuminate\Support\ServiceProvider;
6
7
class GeneratorServiceProvider extends ServiceProvider
8
{
9
    /**
10
     * Bootstrap any application services.
11
     */
12
    public function boot()
13
    {
14
    }
15
16
    /**
17
     * Register the service provider.
18
     */
19
    public function register()
20
    {
21
        $this->mergeConfigFrom(__DIR__.'/../config/generator.php', 'generator');
22
23
        $this->publishes([
24
            __DIR__.'/../config/generator.php' => config_path('generator.php'),
25
        ], 'config');
26
27
        $this->publishes([
28
            __DIR__.'/../resources/stubs' => base_path('resources/stubs'),
29
        ], 'stubs');
30
31
        $this->app->singleton(Generator::class, function ($app) {
32
            return new Generator($app['config']['generator']);
33
        });
34
35
        $this->app->singleton(CommandFactory::class, function ($app) {
36
            return new CommandFactory($app['config']['generator'], $app[Generator::class], $app);
37
        });
38
39
        $this->commands($this->app->make(CommandFactory::class)->create());
40
    }
41
}
42