Conditions | 6 |
Paths | 6 |
Total Lines | 25 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 13 |
CRAP Score | 6 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
29 | 1089 | public function inflect(string $word) : string |
|
30 | { |
||
31 | 1089 | if ($word === '') { |
|
32 | 2 | return ''; |
|
33 | } |
||
34 | |||
35 | 1087 | foreach ($this->rulesets as $ruleset) { |
|
36 | 1087 | if ($ruleset->getUninflected()->matches($word)) { |
|
37 | 401 | return $word; |
|
38 | } |
||
39 | |||
40 | 686 | $inflected = $ruleset->getIrregular()->inflect($word); |
|
41 | |||
42 | 686 | if ($inflected !== $word) { |
|
43 | 195 | return $inflected; |
|
44 | } |
||
45 | |||
46 | 492 | $inflected = $ruleset->getRegular()->inflect($word); |
|
47 | |||
48 | 492 | if ($inflected !== $word) { |
|
49 | 478 | return $inflected; |
|
50 | } |
||
51 | } |
||
52 | |||
53 | 13 | return $word; |
|
54 | } |
||
56 |