Completed
Push — master ( 488702...18fedf )
by Stéphane
22:05
created

ServiceProvider   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 44
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0
wmc 3
lcom 1
cbo 2

3 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 13 1
A provides() 0 4 1
A boot() 0 4 1
1
<?php
2
3
/**
4
 * The Laravel 5 Service Provider for Taxonomies
5
 */
6
namespace Rocket\Taxonomy\Support\Laravel5;
7
8
/**
9
 * Taxonomy Service Provider
10
 */
11
class ServiceProvider extends \Illuminate\Support\ServiceProvider
12
{
13
    /**
14
     * @var bool Indicates if loading of the provider is deferred.
15
     */
16
    protected $defer = true;
17
18
    /**
19
     * Register the service provider.
20
     *
21
     * @return void
22
     */
23 225
    public function register()
24
    {
25 225
        $prefix = 'Rocket\Taxonomy\Repositories';
26 225
        $this->app->bind("$prefix\TermRepositoryInterface", "$prefix\TermRepository");
27 225
        $this->app->bind("$prefix\TermHierarchyRepositoryInterface", "$prefix\TermHierarchyRepository");
28
29 225
        $this->app->singleton(
30 192
            'taxonomy',
31 192
            function ($app) {
32
                return $app->make(\Rocket\Taxonomy\Taxonomy::class);
33 225
            }
34 225
        );
35
    }
36
37
    /**
38
     * Get the services provided by the provider.
39
     *
40
     * @return array
41 6
     */
42
    public function provides()
43 6
    {
44
        return ['taxonomy'];
45
    }
46
47
    /**
48
     * {@inheritdoc}
49
     */
50
    public function boot()
51
    {
52
        $this->loadMigrationsFrom(__DIR__.'/../../migrations');
53
    }
54
}
55