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.

Issues (389)

Branch: master

src/Display/Extension/Tree.php (2 issues)

1
<?php
2
3
namespace SleepingOwl\Admin\Display\Extension;
4
5
use Illuminate\Contracts\Support\Renderable;
6
use Illuminate\Support\Collection;
7
use KodiComponents\Support\HtmlAttributes;
8
use SleepingOwl\Admin\Contracts\Display\ColumnInterface;
9
use SleepingOwl\Admin\Contracts\Initializable;
10
use SleepingOwl\Admin\Display\Column\Control;
11
12
class Tree extends Extension implements Initializable, Renderable
13
{
14
    use HtmlAttributes, \SleepingOwl\Admin\Traits\Renderable;
15
16
    /**
17
     * @var bool
18
     */
19
    protected $controlActive = true;
20
21
    /**
22
     * @var Collection
23
     */
24
    protected $columns;
25
26
    /**
27
     * @var string|\Illuminate\View\View
28
     */
29
    protected $view = 'display.columns';
30
31
    /**
32
     * @var Control
33
     */
34
    protected $controlColumn;
35
36
    public function __construct()
37
    {
38
        $this->columns = new Collection();
39
40
        $this->setControlColumn(app('sleeping_owl.table.column')->treeControl());
0 ignored issues
show
The method treeControl() 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

40
        $this->setControlColumn(app('sleeping_owl.table.column')->/** @scrutinizer ignore-call */ treeControl());

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...
41
    }
42
43
    /**
44
     * @param ColumnInterface $controlColumn
45
     *
46
     * @return $this
47
     */
48
    public function setControlColumn(ColumnInterface $controlColumn)
49
    {
50
        $this->controlColumn = $controlColumn;
0 ignored issues
show
Documentation Bug introduced by
$controlColumn is of type SleepingOwl\Admin\Contra...Display\ColumnInterface, but the property $controlColumn was declared to be of type SleepingOwl\Admin\Display\Column\Control. Are you sure that you always receive this specific sub-class here, or does it make sense to add an instanceof check?

Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a given class or a super-class is assigned to a property that is type hinted more strictly.

Either this assignment is in error or an instanceof check should be added for that assignment.

class Alien {}

class Dalek extends Alien {}

class Plot
{
    /** @var  Dalek */
    public $villain;
}

$alien = new Alien();
$plot = new Plot();
if ($alien instanceof Dalek) {
    $plot->villain = $alien;
}
Loading history...
51
52
        return $this;
53
    }
54
55
    /**
56
     * @return Control
57
     */
58
    public function getControlColumn()
59
    {
60
        return $this->controlColumn;
61
    }
62
63
    /**
64
     * @return bool
65
     */
66
    public function isControlActive()
67
    {
68
        return $this->controlActive;
69
    }
70
71
    /**
72
     * @return $this
73
     */
74
    public function enableControls()
75
    {
76
        $this->controlActive = true;
77
78
        return $this;
79
    }
80
81
    /**
82
     * @return $this
83
     */
84
    public function disableControls()
85
    {
86
        $this->controlActive = true;
87
88
        return $this;
89
    }
90
91
    /**
92
     * @return Collection|\SleepingOwl\Admin\Contracts\Display\ColumnInterface[]
93
     */
94
    public function all()
95
    {
96
        return $this->columns;
97
    }
98
99
    /**
100
     * @return Collection|\SleepingOwl\Admin\Contracts\Display\ColumnInterface[]
101
     */
102
    public function allWithControl()
103
    {
104
        $columns = $this->all();
105
106
        if ($this->isControlActive()) {
107
            $columns->push($this->getControlColumn());
108
        }
109
110
        return $columns;
111
    }
112
113
    /**
114
     * @param ColumnInterface $column
115
     *
116
     * @return $this
117
     */
118
    public function push(ColumnInterface $column)
119
    {
120
        $this->columns->push($column);
121
122
        return $this;
123
    }
124
125
    /**
126
     * Get the instance as an array.
127
     *
128
     * @return array
129
     */
130
    public function toArray()
131
    {
132
        return [
133
            'columns' => $this->allWithControl(),
134
            'attributes' => $this->htmlAttributesToString(),
135
        ];
136
    }
137
138
    public function initialize()
139
    {
140
        $this->allWithControl()->each(function (ColumnInterface $column) {
141
            $column->initialize();
142
        });
143
144
        $this->setHtmlAttribute('class', 'table table-striped');
145
    }
146
}
147