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.

icons.php ➔ icon()   C
last analyzed

Complexity

Conditions 10
Paths 10

Size

Total Lines 49
Code Lines 35

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 10
eloc 35
nc 10
nop 2
dl 0
loc 49
rs 5.5471
c 0
b 0
f 0

How to fix   Complexity   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
if (!function_exists('icon')) {
3
4
    function icon($type, $options = "")
5
    {
6
        $icon = "fa-check";
0 ignored issues
show
Unused Code introduced by
$icon is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
7
8
        switch ($type):
9
            case 'add':
10
                $icon = "fa-plus";
11
                break;
12
13
            case 'edit':
14
                $icon = "fa-pencil";
15
                break;
16
17
            case 'delete':
18
                $icon = "fa-trash-o";
19
                break;
20
21
            case 'back':
22
                $icon = "fa-arrow-left";
23
                break;
24
25
            case 'next':
26
                $icon = "fa-arrow-right";
27
                break;
28
29
            case 'up':
30
                $icon = "fa-arrow-up";
31
                break;
32
33
            case 'down':
34
                $icon = "fa-arrow-down";
35
                break;
36
37
            case 'save':
38
                $icon = "fa-floppy-o";
39
                break;
40
41
            case 'dashboard':
42
                $icon = "fa-dashboard";
43
                break;
44
45
            // Print the icon parameter
46
            default:
47
                $icon = $type;
48
                break;
49
        endswitch;
50
51
        return \FontAwesome::icon($icon, $options);
52
    }
53
}