| Conditions | 6 |
| Paths | 8 |
| Total Lines | 19 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 38 | public function plural(string $word): string |
||
| 39 | { |
||
| 40 | if ($this->uncountable($word)) { |
||
| 41 | return $word; |
||
| 42 | } |
||
| 43 | foreach ($this->getIrregular() as $pattern => $result) { |
||
| 44 | $pattern = '/' . $pattern . '$/i'; |
||
| 45 | |||
| 46 | if (preg_match($pattern, $word)) { |
||
| 47 | return preg_replace($pattern, $result, $word); |
||
| 48 | } |
||
| 49 | } |
||
| 50 | foreach ($this->getPlural() as $pattern => $result) { |
||
| 51 | if (preg_match($pattern, $word)) { |
||
| 52 | return preg_replace($pattern, $result, $word); |
||
| 53 | } |
||
| 54 | } |
||
| 55 | |||
| 56 | return $word; |
||
| 57 | } |
||
| 58 | } |