ServiceProvider   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 13 1
A provides() 0 12 1
A boot() 0 4 1
1
<?php namespace Rocket\Taxonomy\Support\Laravel5;
2
3
use Illuminate\Contracts\Support\DeferrableProvider;
4
use Rocket\Taxonomy\Repositories\TermRepositoryInterface;
5
use Rocket\Taxonomy\Repositories\TermRepository;
6
use Rocket\Taxonomy\Repositories\TermHierarchyRepositoryInterface;
7
use Rocket\Taxonomy\Repositories\TermHierarchyRepository;
8
use Rocket\Taxonomy\Taxonomy;
9
use Rocket\Taxonomy\TaxonomyInterface;
10
11
/**
12
 * Taxonomy Service Provider
13
 */
14
class ServiceProvider extends \Illuminate\Support\ServiceProvider implements DeferrableProvider
15
{
16
17
    /**
18
     * Register the service provider.
19
     *
20
     * @return void
21
     */
22
    public function register()
23 225
    {
24
        $this->app->bind(TermRepositoryInterface::class, TermRepository::class);
25 225
        $this->app->bind(TermHierarchyRepositoryInterface::class, TermHierarchyRepository::class);
26 225
        $this->app->bind(TaxonomyInterface::class, Taxonomy::class);
27 225
        $this->app->alias('i18n', \Rocket\Translation\Taxonomy::class);
28
        $this->app->singleton(
29 225
            'taxonomy',
30 192
            function ($app) {
31 192
                return $app->make(Taxonomy::class);
32
            }
33 225
        );
34 225
    }
35
36
    /**
37
     * Get the services provided by the provider.
38
     *
39
     * @return array
40
     */
41 6
    public function provides()
42
    {
43 6
        return [
44
            'taxonomy',
45
            TaxonomyInterface::class,
46
            Taxonomy::class,
47
            TermRepositoryInterface::class,
48
            TermRepository::class,
49
            TermHierarchyRepositoryInterface::class,
50
            TermHierarchyRepository::class
51
        ];
52
    }
53
54
    /**
55
     * {@inheritdoc}
56
     */
57
    public function boot()
58
    {
59
        $this->loadMigrationsFrom(__DIR__.'/../../migrations');
60
    }
61
}
62