Conditions | 5 |
Paths | 5 |
Total Lines | 20 |
Code Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 30 |
Changes | 0 |
1 | <?php |
||
19 | protected function doOrdinalize($number) |
||
20 | { |
||
21 | if (in_array(($number % 100), range(11, 13))) { |
||
22 | return $number . 'th'; |
||
23 | } else { |
||
24 | switch (($number % 10)) { |
||
25 | case 1: |
||
26 | return $number . 'st'; |
||
27 | break; |
||
|
|||
28 | case 2: |
||
29 | return $number . 'nd'; |
||
30 | break; |
||
31 | case 3: |
||
32 | return $number . 'rd'; |
||
33 | default: |
||
34 | return $number . 'th'; |
||
35 | break; |
||
36 | } |
||
37 | } |
||
38 | } |
||
39 | } |
||
40 |
The break statement is not necessary if it is preceded for example by a return statement:
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.