@@ -146,17 +146,17 @@ |
||
| 146 | 146 | |
| 147 | 147 | public function isUninflected(string $word) : bool |
| 148 | 148 | { |
| 149 | - return preg_match('/^(' . $this->getRegex() . ')$/i', $word, $regs) === 1; |
|
| 149 | + return preg_match('/^('.$this->getRegex().')$/i', $word, $regs) === 1; |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | private function getRegex() : string |
| 153 | 153 | { |
| 154 | 154 | if ($this->regex === null) { |
| 155 | - $words = array_map(function (Word $word) { |
|
| 155 | + $words = array_map(function(Word $word) { |
|
| 156 | 156 | return $word->getWord(); |
| 157 | 157 | }, $this->words); |
| 158 | 158 | |
| 159 | - $this->regex = '(?:' . implode('|', $words) . ')'; |
|
| 159 | + $this->regex = '(?:'.implode('|', $words).')'; |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | return $this->regex; |
@@ -50,8 +50,8 @@ discard block |
||
| 50 | 50 | |
| 51 | 51 | public function inflect(string $word) : ?string |
| 52 | 52 | { |
| 53 | - if (preg_match('/(.*)\\b(' . $this->getRegex() . ')$/i', $word, $regs)) { |
|
| 54 | - return $regs[1] . $word[0] . substr($this->rules[strtolower($regs[2])]->getTo(), 1); |
|
| 53 | + if (preg_match('/(.*)\\b('.$this->getRegex().')$/i', $word, $regs)) { |
|
| 54 | + return $regs[1].$word[0].substr($this->rules[strtolower($regs[2])]->getTo(), 1); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | return null; |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | private function getRegex() : string |
| 61 | 61 | { |
| 62 | 62 | if ($this->regex === null) { |
| 63 | - $this->regex = '(?:' . implode('|', array_keys($this->rules)) . ')'; |
|
| 63 | + $this->regex = '(?:'.implode('|', array_keys($this->rules)).')'; |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | return $this->regex; |
@@ -38,12 +38,12 @@ discard block |
||
| 38 | 38 | $irregular = $irregular ?? new Irregular(...Singular::getIrregularRules()); |
| 39 | 39 | $pluralIrregular = $pluralIrregular ?? new Irregular(...Plural::getIrregularRules()); |
| 40 | 40 | |
| 41 | - $singularUninflected = new Uninflected(...(static function () use ($uninflected) : iterable { |
|
| 41 | + $singularUninflected = new Uninflected(...(static function() use ($uninflected) : iterable { |
|
| 42 | 42 | yield from $uninflected->getWords(); |
| 43 | 43 | yield from Uninflected::getDefaultWords(); |
| 44 | 44 | })()); |
| 45 | 45 | |
| 46 | - $singularIrregular = new Irregular(...(static function () use ($irregular, $pluralIrregular) : iterable { |
|
| 46 | + $singularIrregular = new Irregular(...(static function() use ($irregular, $pluralIrregular) : iterable { |
|
| 47 | 47 | yield from $irregular->getRules(); |
| 48 | 48 | yield from $pluralIrregular->getFlippedRules(); |
| 49 | 49 | })()); |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | $uninflected = $uninflected ?? new Uninflected(...Plural::getUninflectedWords()); |
| 61 | 61 | $irregular = $irregular ?? new Irregular(...Plural::getIrregularRules()); |
| 62 | 62 | |
| 63 | - $pluralUninflected = new Uninflected(...(static function () use ($uninflected) : iterable { |
|
| 63 | + $pluralUninflected = new Uninflected(...(static function() use ($uninflected) : iterable { |
|
| 64 | 64 | yield from $uninflected->getWords(); |
| 65 | 65 | yield from Uninflected::getDefaultWords(); |
| 66 | 66 | })()); |