Conditions | 3 |
Paths | 3 |
Total Lines | 9 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Tests | 5 |
CRAP Score | 3.0416 |
Changes | 0 |
1 | <?php |
||
41 | 8 | public static function getPluralForm(string $name): string |
|
42 | { |
||
43 | 8 | if (preg_match('/.*s$/', $name)) { |
|
44 | return preg_replace('/(.*)s$/', '$1ses', $name); |
||
45 | 8 | } elseif (preg_match('/.*y$/', $name)) { |
|
46 | 4 | return preg_replace('/(.*)y$/', '$1ies', $name); |
|
47 | } |
||
48 | |||
49 | 4 | return $name . 's'; |
|
50 | } |
||
52 |