Completed
Pull Request — master (#260)
by Colin
06:42
created

ServiceProvider   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 2
c 2
b 0
f 0
lcom 1
cbo 4
dl 0
loc 37
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
/**
8
 * Class ServiceProvider
9
 *
10
 * @package Cviebrock\EloquentSluggable
11
 */
12
class ServiceProvider extends BaseServiceProvider
13
{
14
15
    /**
16
     * Indicates if loading of the provider is deferred.
17
     *
18
     * @var bool
19
     */
20
    protected $defer = false;
21
22
    /**
23
     * Bootstrap the application events.
24
     *
25
     * @return void
26
     */
27
    public function boot()
28
    {
29
        $this->publishes([
30
            __DIR__ . '/../resources/config/sluggable.php' => config_path('sluggable.php'),
31
        ], 'config');
32
    }
33
34
    /**
35
     * Register the service provider.
36
     *
37
     * @return void
38
     */
39
    public function register()
40
    {
41
        $this->mergeConfigFrom(__DIR__ . '/../resources/config/sluggable.php', 'sluggable');
42
43
        $this->app->singleton(SluggableObserver::class, function ($app) {
44
            return new SluggableObserver(new SlugService(), $app['events']);
45
        });
46
    }
47
48
}
49