@@ -60,12 +60,12 @@ |
||
| 60 | 60 | $irregular = $this->irregular ?? new Irregular(...Singular::getIrregularRules()); |
| 61 | 61 | $pluralIrregular = $this->pluralIrregular ?? new Irregular(...Plural::getIrregularRules()); |
| 62 | 62 | |
| 63 | - $singularUninflected = new Uninflected(...(static function () use ($uninflected) : iterable { |
|
| 63 | + $singularUninflected = new Uninflected(...(static function() use ($uninflected) : iterable { |
|
| 64 | 64 | yield from $uninflected->getWords(); |
| 65 | 65 | yield from Uninflected::getDefaultWords(); |
| 66 | 66 | })()); |
| 67 | 67 | |
| 68 | - $singularIrregular = new Irregular(...(static function () use ($irregular, $pluralIrregular) : iterable { |
|
| 68 | + $singularIrregular = new Irregular(...(static function() use ($irregular, $pluralIrregular) : iterable { |
|
| 69 | 69 | yield from $irregular->getSubstitutions(); |
| 70 | 70 | yield from $pluralIrregular->getFlippedSubstitutions(); |
| 71 | 71 | })()); |
@@ -47,8 +47,8 @@ discard block |
||
| 47 | 47 | |
| 48 | 48 | public function inflect(string $word) : string |
| 49 | 49 | { |
| 50 | - if (preg_match('/(.*)\\b(' . $this->getRegex() . ')$/i', $word, $regs) > 0) { |
|
| 51 | - return $regs[1] . $word[0] . substr($this->substitutions[strtolower($regs[2])]->getTo()->getWord(), 1); |
|
| 50 | + if (preg_match('/(.*)\\b('.$this->getRegex().')$/i', $word, $regs) > 0) { |
|
| 51 | + return $regs[1].$word[0].substr($this->substitutions[strtolower($regs[2])]->getTo()->getWord(), 1); |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | return $word; |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | private function getRegex() : string |
| 58 | 58 | { |
| 59 | 59 | if ($this->regex === null) { |
| 60 | - $this->regex = '(?:' . implode('|', array_keys($this->substitutions)) . ')'; |
|
| 60 | + $this->regex = '(?:'.implode('|', array_keys($this->substitutions)).')'; |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | return $this->regex; |
@@ -48,7 +48,7 @@ |
||
| 48 | 48 | $uninflected = $this->uninflected ?? new Uninflected(...Plural::getUninflectedWords()); |
| 49 | 49 | $irregular = $this->irregular ?? new Irregular(...Plural::getIrregularRules()); |
| 50 | 50 | |
| 51 | - $pluralUninflected = new Uninflected(...(static function () use ($uninflected) : iterable { |
|
| 51 | + $pluralUninflected = new Uninflected(...(static function() use ($uninflected) : iterable { |
|
| 52 | 52 | yield from $uninflected->getWords(); |
| 53 | 53 | yield from Uninflected::getDefaultWords(); |
| 54 | 54 | })()); |