Conditions | 6 |
Paths | 8 |
Total Lines | 18 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
14 | public function singular(string $word): string |
||
15 | { |
||
16 | if ($this->uncountable($word)) { |
||
17 | return $word; |
||
18 | } |
||
19 | foreach ($this->getIrregular() as $result => $pattern) { |
||
20 | $pattern = '/' . $pattern . '$/i'; |
||
21 | |||
22 | if (preg_match($pattern, $word)) { |
||
23 | return preg_replace($pattern, $result, $word); |
||
24 | } |
||
25 | } |
||
26 | foreach ($this->getSingular() as $pattern => $result) { |
||
27 | if (preg_match($pattern, $word)) { |
||
28 | return preg_replace($pattern, $result, $word); |
||
29 | } |
||
30 | } |
||
31 | return $word; |
||
32 | } |
||
58 | } |