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.
Test Setup Failed
Push — master ( a563ba...728916 )
by Dave
01:24
created

ColumnsTotal   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 6

Importance

Changes 0
Metric Value
wmc 5
c 0
b 0
f 0
lcom 1
cbo 6
dl 0
loc 49
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A set() 0 13 2
A toArray() 0 10 2
1
<?php
2
3
namespace SleepingOwl\Admin\Display\Extension;
4
5
use Illuminate\Support\Collection;
6
use SleepingOwl\Admin\Display\Element;
7
use KodiComponents\Support\HtmlAttributes;
8
use SleepingOwl\Admin\Traits\ElementViewTrait;
9
use SleepingOwl\Admin\Contracts\Display\Placable;
10
use SleepingOwl\Admin\Traits\ElementPlacementTrait;
11
12
class ColumnsTotal extends Extension implements Placable
13
{
14
    use HtmlAttributes, ElementPlacementTrait, ElementViewTrait;
15
16
    /**
17
     * @var string|\Illuminate\View\View
18
     */
19
    protected $view = 'display.extensions.columns_total';
20
21
    /**
22
     * @var string
23
     */
24
    protected $placement = 'table.header';
25
26
    /**
27
     * @var Collection
28
     */
29
    protected $elements;
30
31
    public function __construct()
32
    {
33
        $this->elements = new Collection();
34
    }
35
36
    public function set(array $elements, $columnsNumber = 0)
37
    {
38
        array_map(function ($element) {
39
            if (! is_object($element)) {
40
                $element = Element::create($element);
41
            }
42
            $this->elements->push($element);
43
        },
44
            array_pad($elements, max($columnsNumber, count($elements)), '')
45
        );
46
47
        return $this;
48
    }
49
50
    public function toArray()
51
    {
52
        $this->setHtmlAttribute('class', 'table table-striped');
53
54
        return [
55
            'elements' => $this->elements,
56
            'attributes' => $this->htmlAttributesToString(),
57
            'tag' => $this->getPlacement() == 'table.header' ? 'thead' : 'tfoot',
58
        ];
59
    }
60
}
61