| Conditions | 5 |
| Paths | 5 |
| Total Lines | 17 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 30 |
| Changes | 1 | ||
| Bugs | 0 | Features | 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 | } |
||
| 40 |
The
breakstatement is not necessary if it is preceded for example by areturnstatement:If you would like to keep this construct to be consistent with other
casestatements, you can safely mark this issue as a false-positive.