AuthorizationServiceProvider   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 80%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 19
ccs 4
cts 5
cp 0.8
rs 10
c 1
b 0
f 0
wmc 2
lcom 0
cbo 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A boot() 0 8 2
1
<?php namespace Arcanesoft\Core\Providers;
2
3
use Arcanedev\Support\Providers\AuthorizationServiceProvider as ServiceProvider;
4
use Arcanesoft\Contracts\Auth\Models\User;
5
use Illuminate\Support\Facades\Gate;
6
7
/**
8
 * Class     AuthorizationServiceProvider
9
 *
10
 * @package  Arcanesoft\Core\Providers
11
 * @author   ARCANEDEV <[email protected]>
12
 */
13
class AuthorizationServiceProvider extends ServiceProvider
14
{
15
    /* -----------------------------------------------------------------
16
     |  Main Methods
17
     | -----------------------------------------------------------------
18
     */
19
20
    /**
21
     * Register any application authentication / authorization services.
22
     */
23 124
    public function boot()
24
    {
25 124
        $this->registerPolicies();
26
27 124
        Gate::before(function (User $user, $ability) {
0 ignored issues
show
Unused Code introduced by
The parameter $ability is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
28
            return $user->isAdmin() ? true : null;
29 124
        });
30
    }
31
}
32