Completed
Push — master ( caab36...1437d7 )
by ARCANEDEV
02:59
created

AuthServiceProvider   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 99
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 10
Bugs 0 Features 0
Metric Value
wmc 6
c 10
b 0
f 0
lcom 1
cbo 2
dl 0
loc 99
ccs 34
cts 34
cp 1
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 6 1
A getBasePath() 0 4 1
A register() 0 13 2
A provides() 0 6 1
A registerPublishes() 0 21 1
1
<?php namespace Arcanesoft\Auth;
2
3
use Arcanesoft\Core\Bases\PackageServiceProvider;
4
5
/**
6
 * Class     AuthServiceProvider
7
 *
8
 * @package  Arcanesoft\Auth
9
 * @author   ARCANEDEV <[email protected]>
10
 */
11
class AuthServiceProvider extends PackageServiceProvider
12
{
13
    /* ------------------------------------------------------------------------------------------------
14
     |  Properties
15
     | ------------------------------------------------------------------------------------------------
16
     */
17
    /**
18
     * Package name.
19
     *
20
     * @var string
21
     */
22
    protected $package      = 'auth';
23
24
    /* ------------------------------------------------------------------------------------------------
25
     |  Getters & Setters
26
     | ------------------------------------------------------------------------------------------------
27
     */
28
    /**
29
     * Get the base path of the package.
30
     *
31
     * @return string
32
     */
33 24
    public function getBasePath()
34
    {
35 24
        return dirname(__DIR__);
36
    }
37
38
    /* ------------------------------------------------------------------------------------------------
39
     |  Main Functions
40
     | ------------------------------------------------------------------------------------------------
41
     */
42
    /**
43
     * Register the service provider.
44
     */
45 24
    public function register()
46
    {
47 24
        $this->registerConfig();
48
49 24
        $this->app->register(\Arcanesoft\Core\CoreServiceProvider::class);
50 24
        $this->app->register(Providers\PackagesServiceProvider::class);
51 24
        $this->app->register(Providers\AuthorizationServiceProvider::class);
52 24
        $this->app->register(Providers\ComposerServiceProvider::class);
53
54 24
        if ($this->app->runningInConsole()) {
55 24
            $this->app->register(Providers\CommandServiceProvider::class);
56 18
        }
57 24
    }
58
59
    /**
60
     * Boot the service provider.
61
     */
62 24
    public function boot()
63
    {
64 24
        $this->registerPublishes();
65
66 24
        $this->app->register(Providers\RouteServiceProvider::class);
67 24
    }
68
69
    /**
70
     * Get the services provided by the provider.
71
     *
72
     * @return array
73
     */
74 10
    public function provides()
75
    {
76
        return [
77
            //
78 4
        ];
79 9
    }
80
81
    /* ------------------------------------------------------------------------------------------------
82
     |  Other Functions
83
     | ------------------------------------------------------------------------------------------------
84
     */
85
    /**
86
     * Register publishes.
87
     */
88 24
    private function registerPublishes()
89
    {
90
        // Config
91 24
        $this->publishes([
92 24
            $this->getConfigFile() => config_path("{$this->vendor}/{$this->package}.php"),
93 24
        ], 'config');
94
95
        // Views
96 24
        $viewsPath = $this->getBasePath() . '/resources/views';
97 24
        $this->loadViewsFrom($viewsPath, 'auth');
98 24
        $this->publishes([
99 24
            $viewsPath => base_path('resources/views/vendor/auth'),
100 24
        ], 'views');
101
102
        // Translations
103 24
        $translationsPath = $this->getBasePath() . '/resources/lang';
104 24
        $this->loadTranslationsFrom($translationsPath, 'auth');
105 24
        $this->publishes([
106 24
            $translationsPath => base_path('resources/lang/vendor/auth'),
107 24
        ], 'lang');
108 24
    }
109
}
110