Completed
Push — master ( 60f133...b1ddad )
by Colin
08:08 queued 05:16
created

ServiceProvider   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 3
Bugs 1 Features 0
Metric Value
wmc 2
c 3
b 1
f 0
lcom 1
cbo 4
dl 0
loc 36
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 6 1
A register() 0 8 1
1
<?php namespace Cviebrock\EloquentSluggable;
2
3
use Cviebrock\EloquentSluggable\Services\SlugService;
4
use Illuminate\Support\ServiceProvider as BaseServiceProvider;
5
6
/**
7
 * Class ServiceProvider
8
 *
9
 * @package Cviebrock\EloquentSluggable
10
 */
11
class ServiceProvider extends BaseServiceProvider
12
{
13
14
    /**
15
     * Indicates if loading of the provider is deferred.
16
     *
17
     * @var bool
18
     */
19
    protected $defer = false;
20
21
    /**
22
     * Bootstrap the application events.
23
     *
24
     * @return void
25
     */
26
    public function boot()
27
    {
28
        $this->publishes([
29
            __DIR__ . '/../resources/config/sluggable.php' => config_path('sluggable.php'),
30
        ], 'config');
31
    }
32
33
    /**
34
     * Register the service provider.
35
     *
36
     * @return void
37
     */
38
    public function register()
39
    {
40
        $this->mergeConfigFrom(__DIR__ . '/../resources/config/sluggable.php', 'sluggable');
41
42
        $this->app->singleton(SluggableObserver::class, function ($app) {
43
            return new SluggableObserver(new SlugService(), $app['events']);
44
        });
45
    }
46
}
47