GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Branch development (184ec4)
by butschster
06:08
created

AdminSectionsServiceProvider::policies()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 0
Metric Value
cc 3
eloc 7
nc 4
nop 1
dl 0
loc 12
ccs 0
cts 9
cp 0
crap 12
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace SleepingOwl\Admin\Providers;
4
5
use Illuminate\Support\ServiceProvider;
6
use Illuminate\Contracts\Auth\Access\Gate;
7
8
class AdminSectionsServiceProvider extends ServiceProvider
9
{
10
    /**
11
     * @var array  Associative array in form of: Model::class => Section::class
12
     */
13
    protected $sections = [];
14
15
    /**
16
     * @return array
17
     */
18 283
    public function sections()
19
    {
20 283
        return $this->sections;
21
    }
22
23
    /**
24
     * @param \SleepingOwl\Admin\Admin $admin
25
     */
26 283
    public function boot(\SleepingOwl\Admin\Admin $admin)
27
    {
28 283
        $admin->registerSections($this->sections());
29 283
    }
30
31
    /**
32
     * Register the service provider.
33
     *
34
     * @return void
35
     */
36
    public function register()
37
    {
38
        // TODO: Implement register() method.
39
    }
40
41
    /**
42
     * @param string|null $namespace
43
     *
44
     * @return array
45
     */
46
    public function policies($namespace = null)
47
    {
48
        if (is_null($namespace)) {
49
            $namespace = config('sleeping_owl.policies_namespace', '\\App\\Policies\\');
50
        }
51
        $policies = [];
52
        foreach ($this->sections as $model => $section) {
53
            $policies[$section] = $namespace.class_basename($section).'SectionModelPolicy';
54
        }
55
56
        return $policies;
57
    }
58
59
    /**
60
     * @param string|null $namespace
61
     */
62
    public function registerPolicies($namespace = null)
63
    {
64
        foreach ($this->policies($namespace) as $section => $policy) {
65
            $this->app[Gate::class]->policy($section, $policy);
66
        }
67
    }
68
}
69