Completed
Push — master ( 111edf...db4c68 )
by ARCANEDEV
05:34
created

LaravelAuthServiceProvider::provides()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 6
rs 9.4286
c 1
b 0
f 0
ccs 2
cts 2
cp 1
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php namespace Arcanedev\LaravelAuth;
2
3
use Arcanedev\Support\PackageServiceProvider as ServiceProvider;
4
5
/**
6
 * Class     LaravelAuthServiceProvider
7
 *
8
 * @package  Arcanedev\LaravelAuth
9
 * @author   ARCANEDEV <[email protected]>
10
 */
11
class LaravelAuthServiceProvider extends ServiceProvider
12
{
13
    /* ------------------------------------------------------------------------------------------------
14
     |  Properties
15
     | ------------------------------------------------------------------------------------------------
16
     */
17
    /**
18
     * Vendor name.
19
     *
20
     * @var string
21
     */
22
    protected $vendor  = 'arcanedev';
23
24
    /**
25
     * Package name.
26
     *
27
     * @var string
28
     */
29
    protected $package = 'laravel-auth';
30
31
    /* ------------------------------------------------------------------------------------------------
32
     |  Getters & Setters
33
     | ------------------------------------------------------------------------------------------------
34
     */
35
    /**
36
     * Get the base path of the package.
37
     *
38
     * @return string
39
     */
40 260
    public function getBasePath()
41
    {
42 260
        return dirname(__DIR__);
43
    }
44
45
    /* ------------------------------------------------------------------------------------------------
46
     |  Main Functions
47
     | ------------------------------------------------------------------------------------------------
48
     */
49
    /**
50
     * Register the service provider.
51
     */
52 260
    public function register()
53
    {
54 260
        $this->registerConfig();
55
56 260
        $this->app->register(Providers\EventServiceProvider::class);
57 260
    }
58
59
    /**
60
     * Boot the service provider.
61
     */
62 260
    public function boot()
63
    {
64 260
        parent::boot();
65
66 260
        $this->registerPublishes();
67 260
        $this->registerBladeDirectives();
0 ignored issues
show
Unused Code introduced by
The call to the method Arcanedev\LaravelAuth\La...gisterBladeDirectives() seems un-needed as the method has no side-effects.

PHP Analyzer performs a side-effects analysis of your code. A side-effect is basically anything that might be visible after the scope of the method is left.

Let’s take a look at an example:

class User
{
    private $email;

    public function getEmail()
    {
        return $this->email;
    }

    public function setEmail($email)
    {
        $this->email = $email;
    }
}

If we look at the getEmail() method, we can see that it has no side-effect. Whether you call this method or not, no future calls to other methods are affected by this. As such code as the following is useless:

$user = new User();
$user->getEmail(); // This line could safely be removed as it has no effect.

On the hand, if we look at the setEmail(), this method _has_ side-effects. In the following case, we could not remove the method call:

$user = new User();
$user->setEmail('email@domain'); // This line has a side-effect (it changes an
                                 // instance variable).
Loading history...
68 260
    }
69
70
    /**
71
     * Get the services provided by the provider.
72
     *
73
     * @return array
74
     */
75 4
    public function provides()
76
    {
77
        return [
78
            //
79 4
        ];
80
    }
81
82
    /* ------------------------------------------------------------------------------------------------
83
     |  Other Functions
84
     | ------------------------------------------------------------------------------------------------
85
     */
86
    /**
87
     * Register all publishable stuff.
88
     */
89 260
    private function registerPublishes()
90
    {
91 260
        $this->publishes([
92 260
            $this->getConfigFile() => config_path("{$this->package}.php"),
93 260
        ], 'config');
94
95 260
        $this->publishes([
96 260
            $this->getBasePath() . DS . 'database/migrations' => database_path('migrations'),
97 260
        ], 'migrations');
98
99 260
        $this->publishes([
100 260
            $this->getBasePath() . DS . 'database/factories' => database_path('factories'),
101 260
        ], 'factories');
102 260
    }
103
104
    /**
105
     * Register blade directives
106
     */
107 260
    private function registerBladeDirectives()
108
    {
109
        // Coming soon
110 260
    }
111
112
    /**
113
     * Check if the environment is testing.
114
     *
115
     * @return bool
116
     */
117
    private function isTesting()
0 ignored issues
show
Unused Code introduced by
This method is not used, and could be removed.
Loading history...
118
    {
119
        return $this->app->environment() == 'testing';
120
    }
121
}
122