| Conditions | 5 |
| Paths | 5 |
| Total Lines | 14 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 5 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 15 | 1 | public static function toOrdinal(int $number): ?string |
|
| 16 | { |
||
| 17 | 1 | if (\in_array($number % 100, range(11, 13), true)) { |
|
| 18 | 1 | return $number . 'th'; |
|
| 19 | } |
||
| 20 | 1 | switch ($number % 10) { |
|
| 21 | 1 | case 1: |
|
| 22 | 1 | return $number . 'st'; |
|
| 23 | 1 | case 2: |
|
| 24 | 1 | return $number . 'nd'; |
|
| 25 | 1 | case 3: |
|
| 26 | 1 | return $number . 'rd'; |
|
| 27 | default: |
||
| 28 | 1 | return $number . 'th'; |
|
| 29 | } |
||
| 44 |