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 ( 18e39d...348781 )
by Toby
36:48 queued 23:00
created

FormattedItem::getItem()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 6
ccs 4
cts 4
cp 1
rs 10
cc 3
nc 2
nop 2
crap 3
1
<?php
2
0 ignored issues
show
Coding Style introduced by
Missing file doc comment
Loading history...
3
namespace BristolSU\ControlDB\Export;
4
5
use Illuminate\Contracts\Support\Arrayable;
6
use Illuminate\Contracts\Support\Jsonable;
7
8
class FormattedItem implements Arrayable, Jsonable
0 ignored issues
show
Coding Style introduced by
Missing doc comment for class FormattedItem
Loading history...
9
{
10
11
    /**
12
     * The original item
13
     * 
14
     * @var mixed
15
     */
16
    private $original;
0 ignored issues
show
Coding Style introduced by
Private member variable "original" must be prefixed with an underscore
Loading history...
17
18
    /**
19
     * Formatted items to prepare
20
     * 
21
     * @var array
22
     */
23
    private $prepared = [];
0 ignored issues
show
Coding Style introduced by
Private member variable "prepared" must be prefixed with an underscore
Loading history...
24
25 35
    public function __construct($original)
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function __construct()
Loading history...
26
    {
27 35
        $this->original = $original;
28 35
    }
29
30 25
    public static function create($original)
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function create()
Loading history...
31
    {
32 25
        return new static($original);
33
    }
34
35 16
    public function original()
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function original()
Loading history...
36
    {
37 16
        return $this->original;
38
    }
39
40 10
    public function isType(string $type)
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function isType()
Loading history...
41
    {
42 10
        return $this->original() instanceof $type;
43
    }
44
45
    
46 25
    public function addRow($key, $value)
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function addRow()
Loading history...
47
    {
48 25
        $this->prepared[$key] = $value;
49 25
    }
50
51 9
    public function getColumnNames()
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function getColumnNames()
Loading history...
52
    {
53 9
        return array_keys($this->prepared);
54
    }
55
    
56 12
    public function getItem($column, $default = null)
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function getItem()
Loading history...
57
    {
58 12
        if(array_key_exists($column, $this->prepared) && $this->prepared[$column] !== null) {
0 ignored issues
show
Coding Style introduced by
Expected "if (...) {\n"; found "if(...) {\n"
Loading history...
59 11
            return $this->prepared[$column];
60
        }
61 9
        return $default;
62
    }
63
    
64 10
    public function preparedItems(): array
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function preparedItems()
Loading history...
65
    {
66 10
        return $this->prepared;
67
    }
68
    
69
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
70
     * @inheritDoc
71
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
72 3
    public function toArray()
73
    {
74 3
        return $this->preparedItems();
75
    }
76
77
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
Coding Style introduced by
Parameter $options should have a doc-comment as per coding-style.
Loading history...
78
     * @inheritDoc
79
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
80 2
    public function toJson($options = 0)
81
    {
82 2
        return json_encode($this->toArray(), 0);
83
    }
84
85 1
    public function __toString()
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function __toString()
Loading history...
86
    {
87 1
        return $this->toJson();
88
    }
89
}