Conditions | 4 |
Paths | 4 |
Total Lines | 11 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 4.0312 |
Changes | 0 |
1 | <?php |
||
18 | 6 | public static function getSingularForm(string $name): string |
|
19 | { |
||
20 | 6 | if (preg_match('/.*ies$/', $name)) { |
|
21 | 3 | return preg_replace('/(.*)ies$/', '$1y', $name); |
|
22 | 4 | } elseif (preg_match('/.*ses$/', $name)) { |
|
23 | 1 | return preg_replace('/(.*)ses$/', '$1s', $name); |
|
24 | 3 | } elseif (preg_match('/.*s$/', $name)) { |
|
25 | return preg_replace('/(.*)s$/', '$1', $name); |
||
26 | } |
||
27 | |||
28 | 3 | return $name; |
|
29 | } |
||
52 |