ServiceProvider::provides()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
namespace Phpsa\LaravelYourlsPlugin;
4
5
use Illuminate\Contracts\Support\DeferrableProvider;
6
use Illuminate\Support\ServiceProvider as BaseServiceProvider;
7
8
class ServiceProvider extends BaseServiceProvider implements DeferrableProvider
9
{
10
    protected $defer = true;
11
12
    const CONFIG_PATH = __DIR__.'/../config/laravel-yourls-plugin.php';
13
14
    public function boot()
15
    {
16
        $this->publishes([
17
            self::CONFIG_PATH => config_path('laravel-yourls-plugin.php'),
18
        ], 'config');
19
    }
20
21
    public function register()
22
    {
23
        $this->mergeConfigFrom(
24
            self::CONFIG_PATH,
25
            'laravel-yourls-plugin'
26
        );
27
28
        $this->app->singleton(LaravelYourlsPlugin::class, function ($app) {
29
            return new LaravelYourlsPlugin($app['config']['laravel-yourls-plugin']);
30
        });
31
    }
32
33
    public function provides()
34
    {
35
        return [LaravelYourlsPlugin::class];
36
    }
37
}
38