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

LocalizationServiceProvider::getBasePath()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 4
rs 10
ccs 2
cts 2
cp 1
crap 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