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

SortByColumn::handles()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 0
cts 2
cp 0
rs 10
cc 1
nc 1
nop 0
crap 2
1
<?php
2
0 ignored issues
show
Coding Style introduced by
Missing file doc comment
Loading history...
3
namespace BristolSU\ControlDB\Export\Formatter\Shared;
4
5
use BristolSU\ControlDB\Export\FormattedItem;
6
use BristolSU\ControlDB\Export\Formatter\Formatter;
7
8
class SortByColumn extends Formatter
0 ignored issues
show
Coding Style introduced by
Missing doc comment for class SortByColumn
Loading history...
9
{
10
11 3
    public function format($items)
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function format()
Loading history...
12
    {
13 3
        $column = $this->config('column', 'id');
14
        
15
        usort($items, function($a, $b) use ($column) {
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
Coding Style introduced by
Expected 1 space after FUNCTION keyword; 0 found
Loading history...
16 3
            $aVal = $a->getItem($column);
17 3
            $bVal = $b->getItem($column);
18 3
            if(is_null($aVal) && is_null($bVal)) {
0 ignored issues
show
Coding Style introduced by
Expected "if (...) {\n"; found "if(...) {\n"
Loading history...
19
                return 0;
20
            }
21 3
            if(is_null($aVal) && !is_null($bVal)) {
0 ignored issues
show
Coding Style introduced by
Expected "if (...) {\n"; found "if(...) {\n"
Loading history...
22
                return 1;
23
            }
24 3
            if(!is_null($aVal) && is_null($bVal)) {
0 ignored issues
show
Coding Style introduced by
Expected "if (...) {\n"; found "if(...) {\n"
Loading history...
25 1
                return -1;
26
            }
27 3
            if(is_string($aVal) || is_string($bVal)) {
0 ignored issues
show
Coding Style introduced by
Expected "if (...) {\n"; found "if(...) {\n"
Loading history...
28 1
                return $this->compareStrings($aVal, $bVal);
29
            }
30 2
            if(is_int($aVal) || is_int($bVal)) {
0 ignored issues
show
Coding Style introduced by
Expected "if (...) {\n"; found "if(...) {\n"
Loading history...
31 2
                return $this->compareInts($aVal, $bVal);
32
            }
33
            return 0;
34 3
        });
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
35 3
        return $items;
36
    }
37
    
38 1
    private function compareStrings(string $a, string $b): int 
0 ignored issues
show
Coding Style introduced by
Private method name "SortByColumn::compareStrings" must be prefixed with an underscore
Loading history...
Coding Style introduced by
Missing doc comment for function compareStrings()
Loading history...
39
    {
40 1
        return strcmp($a, $b);
41
    }
42
43 2
    public function compareInts(int $a, int $b): int
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function compareInts()
Loading history...
44
    {
45 2
        if ($a == $b) {
46
            return 0;
47
        }
48 2
        return ($a < $b) ? -1 : 1;
49
    }
50
 
51
    public function formatItem(FormattedItem $formattedItem): FormattedItem
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function formatItem()
Loading history...
52
    {
53
        return $formattedItem;
54
    }
55
56
    public function handles(): string
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function handles()
Loading history...
57
    {
58
        return static::ALL;
59
    }
60
}