AuthorizationServiceProvider::defineMany()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 2
dl 0
loc 6
ccs 0
cts 4
cp 0
crap 6
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Arcanedev\Support\Providers;
6
7
use Illuminate\Foundation\Support\Providers\AuthServiceProvider;
8
use Illuminate\Support\Facades\Gate;
9
10
/**
11
 * Class     AuthorizationServiceProvider
12
 *
13
 * @author   ARCANEDEV <[email protected]>
14
 */
15
abstract class AuthorizationServiceProvider extends AuthServiceProvider
16
{
17
    /* -----------------------------------------------------------------
18
     |  Main Methods
19
     | -----------------------------------------------------------------
20
     */
21
22
    /**
23
     * Define policies.
24
     *
25
     * @param  string  $class
26
     * @param  array   $policies
27
     */
28
    protected function defineMany($class, array $policies)
29
    {
30
        foreach ($policies as $ability => $method) {
31
            Gate::define($ability, "$class@$method");
32
        }
33
    }
34
}
35