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.
Completed
Pull Request — master (#971)
by Dave
22:56 queued 17:27
created

Text::setDefault()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 5
ccs 0
cts 0
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace SleepingOwl\Admin\Display\Column\Filter;
4
5
class Text extends BaseColumnFilter
6
{
7
    /**
8
     * @var string
9
     */
10
    protected $view = 'column.filter.text';
11
12
    /**
13
     * @var string
14
     */
15
    protected $placeholder;
16
17 3
    /**
18
     * @var bool
19 3
     */
20
    protected $defaultValue = null;
21 3
22 3
    public function initialize()
23 3
    {
24 3
        parent::initialize();
25 3
26
        $this->setHtmlAttribute('class', 'form-control column-filter');
27
        $this->setHtmlAttribute('data-type', 'text');
28
        $this->setHtmlAttribute('type', 'text');
29
        $this->setHtmlAttribute('placeholder', $this->getPlaceholder());
30 4
    }
31
32 4
    /**
33
     * @return mixed
34
     */
35
    public function getDefault()
36
    {
37
        return $this->defaultValue;
38
    }
39
40 1
    /**
41
     * @param mixed $value
42 1
     *
43
     * @return $this
44 1
     */
45
    public function setDefault($value)
46
    {
47
        $this->defaultValue = $value;
48
49
        return $this;
50
    }
51
52
    /**
53
     * @return string
54
     */
55
    public function getPlaceholder()
56
    {
57
        return $this->placeholder;
58
    }
59
60
    /**
61
     * @param string $placeholder
62
     *
63
     * @return $this
64
     */
65
    public function setPlaceholder($placeholder)
66
    {
67
        $this->placeholder = $placeholder;
68
69
        return $this;
70
    }
71
72
    /**
73
     * @return array
74
     */
75
    public function toArray()
76
    {
77
        if ($this->getDefault()) {
78
            $this->setHtmlAttribute('value', $this->getDefault());
0 ignored issues
show
Bug introduced by
$this->getDefault() of type true is incompatible with the type array|string expected by parameter $attribute of SleepingOwl\Admin\Displa...ter::setHtmlAttribute(). ( Ignorable by Annotation )

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

78
            $this->setHtmlAttribute('value', /** @scrutinizer ignore-type */ $this->getDefault());
Loading history...
79
        }
80
81
        return parent::toArray() + [
82
                'placeholder' => $this->getPlaceholder(),
83
            ];
84
    }
85
}
86