Completed
Push — master ( fe9181...bc0bfa )
by ARCANEDEV
12s
created

LocalizationServiceProvider   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 75
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 12 1
A boot() 0 7 1
A provides() 0 7 1
A registerLocalization() 0 10 1
1
<?php namespace Arcanedev\Localization;
2
3
use Arcanedev\Support\PackageServiceProvider;
4
5
/**
6
 * Class     LocalizationServiceProvider
7
 *
8
 * @package  Arcanedev\Localization
9
 * @author   ARCANEDEV <[email protected]>
10
 */
11
class LocalizationServiceProvider extends PackageServiceProvider
12
{
13
    /* ------------------------------------------------------------------------------------------------
14
     |  Properties
15
     | ------------------------------------------------------------------------------------------------
16
     */
17
    /**
18
     * Package name.
19
     *
20
     * @var string
21
     */
22
    protected $package = 'localization';
23
24
    /* ------------------------------------------------------------------------------------------------
25
     |  Main Functions
26
     | ------------------------------------------------------------------------------------------------
27
     */
28
    /**
29
     * Register the service provider.
30
     */
31 192
    public function register()
32
    {
33 192
        parent::register();
34
35 192
        $this->registerConfig();
36 192
        $this->registerProviders([
37 192
            Providers\RoutingServiceProvider::class,
38 64
            Providers\UtilitiesServiceProvider::class,
39 64
        ]);
40 192
        $this->registerLocalization();
41 192
        $this->registerAliases();
42 192
    }
43
44
    /**
45
     * Boot the package.
46
     */
47 192
    public function boot()
48
    {
49 192
        parent::boot();
50
51 192
        $this->publishConfig();
52 192
        $this->publishViews();
53 192
    }
54
55
    /**
56
     * Get the services provided by the provider.
57
     *
58
     * @return array
59
     */
60 3
    public function provides()
61
    {
62
        return [
63 3
            Contracts\Localization::class,
64 1
            'arcanedev.localization',
65 1
        ];
66
    }
67
68
    /* ------------------------------------------------------------------------------------------------
69
     |  Services Functions
70
     | ------------------------------------------------------------------------------------------------
71
     */
72
    /**
73
     * Register Localization.
74
     */
75 192
    private function registerLocalization()
76
    {
77 192
        $this->singleton(Contracts\Localization::class, Localization::class);
78 192
        $this->singleton('arcanedev.localization', Contracts\Localization::class);
79
80 192
        $this->alias(
81 192
            $this->config()->get('localization.facade', 'Localization'),
82 128
            Facades\Localization::class
83 64
        );
84 192
    }
85
}
86