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.

ExtensionCollection   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 74
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 21
c 0
b 0
f 0
dl 0
loc 74
ccs 0
cts 41
cp 0
rs 10
wmc 8

6 Methods

Rating   Name   Duplication   Size   Complexity  
A initialize() 0 9 2
A renderable() 0 4 1
A modifyQuery() 0 7 1
A sortByOrder() 0 4 1
A placable() 0 4 1
A placableBlocks() 0 12 2
1
<?php
2
3
namespace SleepingOwl\Admin\Display;
4
5
use Illuminate\Contracts\Support\Renderable;
6
use Illuminate\Database\Eloquent\Builder;
7
use Illuminate\Support\Collection;
8
use SleepingOwl\Admin\Contracts\Display\DisplayExtensionInterface;
9
use SleepingOwl\Admin\Contracts\Display\Placable;
10
use SleepingOwl\Admin\Contracts\Initializable;
11
12
class ExtensionCollection extends Collection
13
{
14
    /**
15
     * @return static
16
     */
17
    public function placable()
18
    {
19
        return $this->filter(function (DisplayExtensionInterface $extension) {
20
            return $extension instanceof Placable;
21
        });
22
    }
23
24
    /**
25
     * @return array
26
     */
27
    public function placableBlocks()
28
    {
29
        $blocks = [];
30
31
        foreach ($this->placable() as $extension) {
32
            $blocks[$extension->getPlacement()][] = app('sleeping_owl.template')->view(
0 ignored issues
show
Bug introduced by
The method view() does not exist on Illuminate\Contracts\Foundation\Application. ( Ignorable by Annotation )

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

32
            $blocks[$extension->getPlacement()][] = app('sleeping_owl.template')->/** @scrutinizer ignore-call */ view(

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
33
                $extension->getView(),
34
                $extension->toArray()
35
            )->render();
36
        }
37
38
        return $blocks;
39
    }
40
41
    /**
42
     * @return static
43
     */
44
    public function renderable()
45
    {
46
        return $this->filter(function (DisplayExtensionInterface $extension) {
47
            return $extension instanceof Renderable;
48
        });
49
    }
50
51
    /**
52
     * @return static
53
     */
54
    public function sortByOrder()
55
    {
56
        return $this->sortBy(function (DisplayExtensionInterface $extension) {
57
            return $extension->getOrder();
58
        });
59
    }
60
61
    /**
62
     * @return $this
63
     */
64
    public function initialize()
65
    {
66
        $this->each(function (DisplayExtensionInterface $extension) {
67
            if ($extension instanceof Initializable) {
68
                $extension->initialize();
69
            }
70
        });
71
72
        return $this;
73
    }
74
75
    /**
76
     * @param \Illuminate\Database\Eloquent\Builder $query
77
     * @return $this
78
     */
79
    public function modifyQuery(Builder $query)
80
    {
81
        $this->each(function (DisplayExtensionInterface $extension) use ($query) {
82
            $extension->modifyQuery($query);
83
        });
84
85
        return $this;
86
    }
87
}
88