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 (#688)
by
unknown
18:52
created

EditableColumn::setEditableMode()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 0
cts 5
cp 0
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 4
nc 2
nop 1
crap 12
1
<?php
2
3
namespace SleepingOwl\Admin\Display\Column\Editable;
4
5
use Illuminate\Http\Request;
6
use SleepingOwl\Admin\Display\Column\NamedColumn;
7
8
class EditableColumn extends NamedColumn
9
{
10
    /**
11
     * @var string
12
     */
13
    protected $url = null;
14
15
    /**
16
     * @var string
17
     */
18
    protected $title = null;
19
20
    /**
21
     * @var string
22
     */
23
    protected $editableMode = 'popup';
24
25
    /**
26
     * Text constructor.
27
     *
28
     * @param             $name
29
     * @param             $label
30
     */
31
    public function __construct($name, $label = null)
32
    {
33
        parent::__construct($name, $label);
34
35
        $this->clearHtmlAttributes();
36
37
        $this->setHtmlAttributes([
38
            'class' => 'inline-editable',
39
        ]);
40
    }
41
42
    /**
43
     * @param bool $sortable
0 ignored issues
show
Bug introduced by
There is no parameter named $sortable. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
44
     *
45
     * @return $this
46
     */
47
    public function getTitle()
48
    {
49
        if (isset($this->title)) {
50
            return $this->title;
51
        } else {
52
            return $this->header->getTitle();
53
        }
54
    }
55
56
    /**
57
     * @param bool $sortable
0 ignored issues
show
Bug introduced by
There is no parameter named $sortable. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
58
     *
59
     * @return $this
60
     */
61
    public function setTitle($title)
62
    {
63
        $this->title = $title;
64
65
        return $this;
66
    }
67
68
    /**
69
     * @return string
70
     */
71
    public function getUrl()
72
    {
73
        if (! $this->url) {
74
            return request()->url();
75
        }
76
77
        return $this->url;
78
    }
79
80
    /**
81
     * @param $url
82
     * @return string
83
     */
84
    public function setUrl($url)
85
    {
86
        $this->url = $url;
87
88
        return $this;
89
    }
90
91
    /**
92
     * @return string
93
     */
94
    public function getEditableMode()
95
    {
96
        return $this->editableMode;
97
    }
98
99
    /**
100
     * @param $url
101
     * @return string
102
     */
103
    public function setEditableMode($mode)
104
    {
105
        if (isset($mode) && in_array($mode, ['inline', 'popup'])) {
106
            $this->editableMode = $mode;
107
        }
108
109
        return $this;
110
    }
111
112
    /**
113
     * @return array
114
     */
115
    public function toArray()
116
    {
117
        return parent::toArray() + [
118
                'id'             => $this->getModel()->getKey(),
119
                'value'          => $this->getModelValue(),
120
                'isEditable'     => $this->getModelConfiguration()->isEditable($this->getModel()),
121
                'url'            => $this->getUrl(),
122
                'title'          => $this->getTitle(),
123
                'mode'           => $this->getEditableMode(),
124
            ];
125
    }
126
}
127