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
Push — bs4 ( 193743...d4da84 )
by butschster
20:32 queued 14:27
created

EditableColumn::getModifier()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
namespace SleepingOwl\Admin\Display\Column\Editable;
4
5
use SleepingOwl\Admin\Display\Column\NamedColumn;
6
7
class EditableColumn extends NamedColumn
8
{
9
    /**
10
     * @var string
11
     */
12
    protected $url = null;
13
14
    /**
15
     * @var string
16
     */
17
    protected $title = null;
18
19
    /**
20
     * @var string
21
     */
22
    protected $editableMode = 'popup';
23
24
    /**
25
     * @var mixed
26
     */
27
    protected $modifier = null;
28
29
    /**
30
     * Text constructor.
31
     *
32
     * @param             $name
33
     * @param             $label
34
     */
35
    public function __construct($name, $label = null)
36
    {
37
        parent::__construct($name, $label);
38
39
        $this->clearHtmlAttributes();
40
41
        $this->setHtmlAttributes([
42
            'class' => 'inline-editable',
43
        ]);
44
    }
45
46
    /**
47
     * @return mixed
48
     */
49
    public function getModifier()
50
    {
51
        return $this->modifier;
52
    }
53
54
    /**
55
     * @return mixed
56
     */
57
    public function getModifierValue()
58
    {
59
        if (is_callable($this->modifier)) {
60
            return call_user_func($this->modifier, $this);
61
        }
62
63
        if (is_null($this->modifier)) {
64
            return $this->getModelValue();
65
        }
66
67
        return $this->modifier;
68
    }
69
70
    /**
71
     * @param mixed $text
72
     * @return $this
73
     */
74
    public function setModifier($modifier)
75
    {
76
        $this->modifier = $modifier;
77
78
        return $this;
79
    }
80
81
    /**
82
     * @return string
83
     */
84
    public function getTitle()
85
    {
86
        if (isset($this->title)) {
87
            return $this->title;
88
        }
89
90
        return $this->header->getTitle();
91
    }
92
93
    /**
94
     * @param bool $sortable
95
     *
96
     * @return $this
97
     */
98
    public function setTitle($title)
99
    {
100
        $this->title = $title;
101
102
        return $this;
103
    }
104
105
    /**
106
     * @return string
107
     */
108
    public function getUrl()
109
    {
110
        if (! $this->url) {
111
            return request()->url();
112
        }
113
114
        return $this->url;
115
    }
116
117
    /**
118
     * @param $url
119
     * @return string
120
     */
121
    public function setUrl($url)
122
    {
123
        $this->url = $url;
124
125
        return $this;
126
    }
127
128
    /**
129
     * @return string
130
     */
131
    public function getEditableMode()
132
    {
133
        return $this->editableMode;
134
    }
135
136
    /**
137
     * @param $url
138
     * @return string
139
     */
140
    public function setEditableMode($mode)
141
    {
142
        if (isset($mode) && in_array($mode, ['inline', 'popup'])) {
143
            $this->editableMode = $mode;
144
        }
145
146
        return $this;
147
    }
148
149
    /**
150
     * @return array
151
     */
152
    public function toArray()
153
    {
154
        return parent::toArray() + [
155
                'id' => $this->getModel()->getKey(),
156
                'value' => $this->getModelValue(),
157
                'isEditable' => $this->getModelConfiguration()->isEditable($this->getModel()),
158
                'url' => $this->getUrl(),
159
                'title' => $this->getTitle(),
160
                'mode' => $this->getEditableMode(),
161
                'text' => $this->getModifierValue(),
162
            ];
163
    }
164
}
165