LocalEnvironmentServiceProvider   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 61
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 13
c 1
b 0
f 0
dl 0
loc 61
rs 10
wmc 7

4 Methods

Rating   Name   Duplication   Size   Complexity  
A registerServiceProviders() 0 4 2
A registerFacadeAliases() 0 5 2
A boot() 0 5 2
A register() 0 2 1
1
<?php
2
3
namespace App\Providers;
4
5
use Illuminate\Foundation\AliasLoader;
6
use Illuminate\Support\ServiceProvider;
7
8
class LocalEnvironmentServiceProvider extends ServiceProvider
9
{
10
    /**
11
     * List of Local Environment Providers.
12
     *
13
     * @var array
14
     */
15
    protected $localProviders = [
16
        \Barryvdh\Debugbar\ServiceProvider::class,
17
    ];
18
19
    /**
20
     * List of only Local Environment Facade Aliases.
21
     *
22
     * @var array
23
     */
24
    protected $facadeAliases = [
25
        'Debugbar' => \Barryvdh\Debugbar\Facade::class,
26
    ];
27
28
    /**
29
     * Bootstrap the application services.
30
     *
31
     * @return void
32
     */
33
    public function boot()
34
    {
35
        if (\App::environment(config('debugbar.enabled_environment'))) {
0 ignored issues
show
Unused Code introduced by
The call to Illuminate\Support\Facades\App::environment() has too many arguments starting with config('debugbar.enabled_environment'). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

35
        if (\App::/** @scrutinizer ignore-call */ environment(config('debugbar.enabled_environment'))) {

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
36
            $this->registerServiceProviders();
37
            $this->registerFacadeAliases();
38
        }
39
    }
40
41
    /**
42
     * Register the application services.
43
     *
44
     * @return void
45
     */
46
    public function register()
47
    {
48
        //
49
    }
50
51
    /**
52
     * Load local service providers.
53
     */
54
    protected function registerServiceProviders()
55
    {
56
        foreach ($this->localProviders as $provider) {
57
            $this->app->register($provider);
58
        }
59
    }
60
61
    /**
62
     * Load additional Aliases.
63
     */
64
    public function registerFacadeAliases()
65
    {
66
        $loader = AliasLoader::getInstance();
67
        foreach ($this->facadeAliases as $alias => $facade) {
68
            $loader->alias($alias, $facade);
69
        }
70
    }
71
}
72