Completed
Push — master ( 2055d4...deb6e5 )
by ARCANEDEV
14s
created

UnitsServiceProvider   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 77
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 77
wmc 4
lcom 1
cbo 2
rs 10
ccs 17
cts 17
cp 1

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getBasePath() 0 4 1
A register() 0 10 1
A boot() 0 6 1
A provides() 0 7 1
1
<?php namespace Arcanedev\Units;
2
3
use Arcanedev\Support\PackageServiceProvider;
4
5
/**
6
 * Class     UnitsServiceProvider
7
 *
8
 * @package  Arcanedev\Units
9
 * @author   ARCANEDEV <[email protected]>
10
 */
11
class UnitsServiceProvider extends PackageServiceProvider
12
{
13
    /* ------------------------------------------------------------------------------------------------
14
     |  Properties
15
     | ------------------------------------------------------------------------------------------------
16
     */
17
    /**
18
     * Package name.
19
     *
20
     * @var string
21
     */
22
    protected $package = 'units';
23
24
    /**
25
     * Indicates if loading of the provider is deferred.
26
     *
27
     * @var bool
28
     */
29
    protected $defer = true;
30
31
    /* ------------------------------------------------------------------------------------------------
32
     |  Getters & Setters
33
     | ------------------------------------------------------------------------------------------------
34
     */
35
    /**
36
     * Get the base path of the package.
37
     *
38
     * @return string
39
     */
40 56
    public function getBasePath()
41
    {
42 56
        return dirname(__DIR__);
43
    }
44
45
    /* ------------------------------------------------------------------------------------------------
46
     |  Main Functions
47
     | ------------------------------------------------------------------------------------------------
48
     */
49
    /**
50
     * Register the service provider.
51
     *
52
     * @return void
53
     */
54 56
    public function register()
55
    {
56 56
        $this->registerConfig();
57
58 56
        $this->singleton('arcanedev.units.manager', function ($app) {
59 40
            return new UnitsManager($app);
60 56
        });
61
62 56
        $this->bind(Contracts\UnitsManager::class, 'arcanedev.units.manager');
63 56
    }
64
65
    /**
66
     * Boot the service provider.
67
     */
68 56
    public function boot()
69
    {
70 56
        parent::boot();
71
72 56
        $this->publishConfig();
73 56
    }
74
75
    /**
76
     * Get the services provided by the provider.
77
     *
78
     * @return array
79
     */
80 16
    public function provides()
81
    {
82
        return [
83 16
            'arcanedev.units.manager',
84 12
            Contracts\UnitsManager::class,
85 12
        ];
86
    }
87
}
88