UnitsServiceProvider::boot()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 0
crap 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
    /**
19
     * Package name.
20
     *
21
     * @var string
22
     */
23
    protected $package = 'units';
24
25
    /**
26
     * Indicates if loading of the provider is deferred.
27
     *
28
     * @var bool
29
     */
30
    protected $defer = true;
31
32
    /* -----------------------------------------------------------------
33
     |  Main Methods
34
     | -----------------------------------------------------------------
35
     */
36
37
    /**
38
     * Register the service provider.
39
     */
40 90
    public function register()
41
    {
42 90
        parent::register();
43
44 90
        $this->registerConfig();
45 90
        $this->registerManager();
46 90
    }
47
48
    /**
49
     * Boot the service provider.
50
     */
51 90
    public function boot()
52
    {
53 90
        parent::boot();
54
55 90
        $this->publishConfig();
56 90
    }
57
58
    /**
59
     * Get the services provided by the provider.
60
     *
61
     * @return array
62
     */
63 6
    public function provides()
64
    {
65
        return [
66 6
            Contracts\UnitsManager::class,
67
        ];
68
    }
69
70
    /* -----------------------------------------------------------------
71
     |  Other Methods
72
     | -----------------------------------------------------------------
73
     */
74
75
    /**
76
     * Register the Units Manager.
77
     */
78
    private function registerManager()
79
    {
80 90
        $this->singleton(Contracts\UnitsManager::class, function ($app) {
81 21
            return new UnitsManager($app);
82 90
        });
83 90
    }
84
}
85