getUsia()   C
last analyzed

Complexity

Conditions 13
Paths 13

Size

Total Lines 75
Code Lines 37

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 13
eloc 37
nc 13
nop 1
dl 0
loc 75
rs 6.6166
c 1
b 0
f 0

How to fix   Long Method    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
3
4
    function getUsia($bln)
5
    {
6
        switch ($bln) {
7
8
                    case 1:
9
10
                        return '12';
11
12
                        break;
0 ignored issues
show
Unused Code introduced by
break is not strictly necessary here and could be removed.

The break statement is not necessary if it is preceded for example by a return statement:

switch ($x) {
    case 1:
        return 'foo';
        break; // This break is not necessary and can be left off.
}

If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive.

Loading history...
13
14
                    case 2:
15
16
                        return '11';
17
18
                        break;
19
20
                    case 3:
21
22
                        return '10';
23
24
                        break;
25
26
                    case 4:
27
28
                        return '9';
29
30
                        break;
31
32
                    case 5:
33
34
                        return '8';
35
36
                        break;
37
38
                    case 6:
39
40
                        return '7';
41
42
                        break;
43
44
                    case 7:
45
46
                        return '6';
47
48
                        break;
49
50
                    case 8:
51
52
                        return '5';
53
54
                        break;
55
56
                    case 9:
57
58
                        return '4';
59
60
                        break;
61
62
                    case 10:
63
64
                        return '3';
65
66
                        break;
67
68
                    case 11:
69
70
                        return '2';
71
72
                        break;
73
74
                    case 12:
75
76
                        return '1';
77
78
                        break;
79
80
                }
81
    }
82
83
?>
0 ignored issues
show
Best Practice introduced by
It is not recommended to use PHP's closing tag ?> in files other than templates.

Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore.

A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever.

Loading history...
84
85