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 — analysis-86ZN54 ( e23b80 )
by butschster
11:56
created

Lists::setSortable()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 2
c 1
b 0
f 1
nc 1
nop 1
dl 0
loc 5
rs 10
1
<?php
2
3
namespace SleepingOwl\Admin\Display\Column;
4
5
use Illuminate\Support\Collection;
6
7
class Lists extends NamedColumn
8
{
9
    /**
10
     * @var string
11
     */
12
    protected $view = 'column.lists';
13
14
    /**
15
     * @var bool
16
     */
17
    protected $orderable = false;
18
19
    /**
20
     * @var bool
21
     */
22
    protected $isSearchable = false;
23
24
    /**
25
     * @var bool
26
     */
27
    protected $sortable = false;
28
29
    /**
30
     * @param bool $sortable
31
     *
32
     * @return $this
33
     */
34
    public function setSortable($sortable)
35
    {
36
        $this->sortable = (bool) $sortable;
37
38
        return $this;
39
    }
40
41
    /**
42
     * @return bool
43
     */
44
    public function isSortable()
45
    {
46
        return $this->sortable;
47
    }
48
49
    /**
50
     * @return mixed
51
     */
52
    public function getModelValue()
53
    {
54
        $values = parent::getModelValue();
55
56
        if ($this->isSortable()) {
57
            if ($values instanceof Collection) {
58
                $values = $values->sort();
59
            } elseif (is_array($values)) {
60
                asort($values);
61
            }
62
        }
63
64
        return $values;
65
    }
66
67
    /**
68
     * @return array
69
     */
70
    public function toArray()
71
    {
72
        return parent::toArray() + [
73
            'values' => $this->getModelValue(),
74
            'append' => $this->getAppends(),
75
        ];
76
    }
77
}
78