ServiceProvider   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 12
c 1
b 0
f 0
dl 0
loc 28
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A provides() 0 3 1
A boot() 0 5 1
A register() 0 9 1
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