Conditions | 8 |
Paths | 16 |
Total Lines | 29 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Tests | 15 |
CRAP Score | 8 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
29 | 1570 | public function inflect(string $word) : string |
|
30 | { |
||
31 | 1570 | if ($word === '') { |
|
32 | 4 | return ''; |
|
33 | } |
||
34 | |||
35 | 1566 | foreach ($this->rulesets as $ruleset) { |
|
36 | 1566 | if ($ruleset->getUninflected()->matches($word)) { |
|
37 | 626 | return $word; |
|
38 | } |
||
39 | } |
||
40 | |||
41 | 943 | foreach ($this->rulesets as $ruleset) { |
|
42 | 943 | $inflected = $ruleset->getIrregular()->inflect($word); |
|
43 | |||
44 | 943 | if ($inflected !== $word) { |
|
45 | 299 | return $inflected; |
|
46 | } |
||
47 | } |
||
48 | |||
49 | 647 | foreach ($this->rulesets as $ruleset) { |
|
50 | 647 | $inflected = $ruleset->getRegular()->inflect($word); |
|
51 | |||
52 | 647 | if ($inflected !== $word) { |
|
53 | 634 | return $inflected; |
|
54 | } |
||
55 | } |
||
56 | |||
57 | 13 | return $word; |
|
58 | } |
||
60 |