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.
Passed
Push — master ( b2510c...ee0bb8 )
by
unknown
12:46
created

FormButton::getUrl()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
ccs 0
cts 2
cp 0
crap 2
rs 10
1
<?php
2
3
4
namespace SleepingOwl\Admin\Form\Buttons;
5
6
use Illuminate\Database\Eloquent\Model;
7
use SleepingOwl\Admin\Traits\Renderable;
8
use KodiComponents\Support\HtmlAttributes;
9
use SleepingOwl\Admin\Contracts\Initializable;
10
use SleepingOwl\Admin\Contracts\Form\FormButtonsInterface;
11
use SleepingOwl\Admin\Contracts\ModelConfigurationInterface;
12
13
class FormButton implements FormButtonsInterface, Initializable
14
{
15
    use HtmlAttributes, Renderable;
16
    /**
17
     * @var string
18
     */
19
    protected $view = 'form.button';
20
21
    /**
22
     * @var
23
     */
24
    protected $iconClass;
25
26
    /**
27
     * @var Model
28
     */
29
    protected $model;
30
    /**
31
     * @var
32
     */
33
    protected $name;
34
35
    /**
36
     * Show button.
37
     */
38
    protected $show;
39
40
    /**
41
     * This is URL.
42
     */
43
    protected $url;
44
45
    /**
46
     * @var
47
     */
48
    protected $text;
49
50
    /**
51
     * @var
52
     */
53
    protected $next_action;
54
55
    /**
56
     * @var
57
     */
58
    protected $groupElements;
59
60
    /**
61
     * @var ModelConfigurationInterface
62
     */
63
    protected $modelConfiguration;
64
65
    public function initialize()
66
    {
67
        $this->canShow();
68
    }
69
70
    public function canShow()
71
    {
72
        return true;
73
    }
74
75
    /**
76
     * @return mixed
77
     */
78
    public function getIconClass()
79
    {
80
        return $this->iconClass;
81
    }
82
83
    /**
84
     * @param $iconClass
85
     * @return $this
86
     */
87
    public function setIconClass($iconClass)
88
    {
89
        $this->iconClass = $iconClass;
90
91
        return $this;
92
    }
93
94
    /**
95
     * @param ModelConfigurationInterface $modelConfiguration
96
     *
97
     * @return $this
98
     */
99
    public function setModelConfiguration(ModelConfigurationInterface $modelConfiguration)
100
    {
101
        $this->modelConfiguration = $modelConfiguration;
102
103
        return $this;
104
    }
105
106
    /**
107
     * @return ModelConfigurationInterface
108
     */
109
    public function getModelConfiguration()
110
    {
111
        return $this->modelConfiguration;
112
    }
113
114
    /**
115
     * @param $text
116
     * @return $this
117
     */
118 10
    public function setText($text)
119
    {
120 10
        $this->text = $text;
121
122 10
        return $this;
123
    }
124
125
    /**
126
     * @return $this
127
     */
128
    public function getText()
129
    {
130
        return $this->text;
131
    }
132
133
    /**
134
     * @param $next_action
135
     * @return $this
136
     */
137
    public function setNextAction($next_action)
138
    {
139
        $this->next_action = $next_action;
140
141
        return $this;
142
    }
143
144
    /**
145
     * @return $this
146
     */
147
    public function getNextAction()
148
    {
149
        return $this->text;
150
    }
151
152
    /**
153
     * Show button.
154
     */
155
    public function show()
156
    {
157
        $this->show = true;
158
    }
159
160
    /**
161
     * Hide button.
162
     */
163
    public function hide()
164
    {
165
        $this->show = false;
166
    }
167
168
    /**
169
     * @param $name
170
     * @return $this
171
     */
172
    public function setName($name)
173
    {
174
        $this->name = $name;
175
176
        return $this;
177
    }
178
179
    /**
180
     * @return mixed
181
     */
182
    public function getName()
183
    {
184
        return $this->name;
185
    }
186
187
    /**
188
     * @param $url
189
     * @return $this
190
     */
191
    public function setUrl($url)
192
    {
193
        $this->url = $url;
194
195
        return $this;
196
    }
197
198
    /**
199
     * @return mixed
200
     */
201
    public function getUrl()
202
    {
203
        return $this->url;
204
    }
205
206
    /**
207
     * @return mixed
208
     */
209
    public function getGroupElements()
210
    {
211
        return $this->groupElements;
212
    }
213
214
    /**
215
     * @param array $elements
216
     * @return $this
217
     */
218 10
    public function setGroupElements(array $elements)
219
    {
220 10
        $this->groupElements = $elements;
221
222 10
        return $this;
223
    }
224
225
    /**
226
     * @param $name
227
     * @param $element
228
     * @return $this
229
     */
230
    public function setGroupElement($name, $element)
231
    {
232
        $this->groupElements[$name] = $element;
233
234
        return $this;
235
    }
236
237
    /**
238
     * @return Model
239
     */
240
    public function getModel()
241
    {
242
        return $this->model;
243
    }
244
245
    /**
246
     * @param Model $model
247
     * @return $this
248
     */
249
    public function setModel(Model $model)
250
    {
251
        $this->model = $model;
252
253
        return $this;
254
    }
255
256
    public function getShow()
257
    {
258
        return $this->show;
259
    }
260
261
    public function toArray()
262
    {
263
        return [
264
            'attributes'    => $this->htmlAttributesToString(),
265
            'groupElements' => $this->getGroupElements(),
266
            'text'          => $this->getText(),
267
            'name'          => $this->getName(),
268
            'show'          => $this->getShow(),
269
            'iconClass'     => $this->getIconClass(),
270
            'url'           => $this->getUrl(),
271
        ];
272
    }
273
274
    /**
275
     * @return bool
276
     */
277
    protected function isTrashed()
278
    {
279
        return method_exists($this->getModel(), 'trashed') ? $this->getModel()->trashed() : false;
280
    }
281
}
282