AccessServiceProvider   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 60
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 60
rs 10
wmc 5
lcom 1
cbo 4

5 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 4 1
A register() 0 5 1
A registerAccess() 0 6 1
A registerFacade() 0 7 1
A registerBladeExtensions() 0 3 1
1
<?php
2
3
namespace App\Providers;
4
5
use App\Services\Access\Access;
6
use Illuminate\Support\Facades\Blade;
7
use Illuminate\Support\ServiceProvider;
8
9
/**
10
 * Class AccessServiceProvider.
11
 */
12
class AccessServiceProvider extends ServiceProvider
13
{
14
    /**
15
     * Indicates if loading of the provider is deferred.
16
     *
17
     * @var bool
18
     */
19
    protected $defer = false;
20
21
    /**
22
     * Package boot method.
23
     */
24
    public function boot()
25
    {
26
        $this->registerBladeExtensions();
27
    }
28
29
    /**
30
     * Register the service provider.
31
     *
32
     * @return void
33
     */
34
    public function register()
35
    {
36
        $this->registerAccess();
37
        $this->registerFacade();
38
    }
39
40
    /**
41
     * Register the application bindings.
42
     *
43
     * @return void
44
     */
45
    private function registerAccess()
46
    {
47
        $this->app->bind('access', function ($app) {
48
            return new Access($app);
0 ignored issues
show
Unused Code introduced by
The call to Access::__construct() has too many arguments starting with $app.

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.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
49
        });
50
    }
51
52
    /**
53
     * Register the vault facade without the user having to add it to the app.php file.
54
     *
55
     * @return void
56
     */
57
    public function registerFacade()
58
    {
59
        $this->app->booting(function () {
60
            $loader = \Illuminate\Foundation\AliasLoader::getInstance();
61
            $loader->alias('Access', \App\Services\Access\Facades\Access::class);
62
        });
63
    }
64
65
    /**
66
     * Register the blade extender to use new blade sections.
67
     */
68
    protected function registerBladeExtensions()
69
    {
70
    }
71
}
72