@@ -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 | })()); |
@@ -144,17 +144,17 @@ |
||
144 | 144 | |
145 | 145 | public function isUninflected(string $word) : bool |
146 | 146 | { |
147 | - return preg_match('/^(' . $this->getRegex() . ')$/i', $word, $regs) === 1; |
|
147 | + return preg_match('/^('.$this->getRegex().')$/i', $word, $regs) === 1; |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | private function getRegex() : string |
151 | 151 | { |
152 | 152 | if ($this->regex === null) { |
153 | - $words = array_map(function (Word $word) : string { |
|
153 | + $words = array_map(function(Word $word) : string { |
|
154 | 154 | return $word->getWord(); |
155 | 155 | }, $this->words); |
156 | 156 | |
157 | - $this->regex = '(?:' . implode('|', $words) . ')'; |
|
157 | + $this->regex = '(?:'.implode('|', $words).')'; |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | return $this->regex; |
@@ -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->rules[strtolower($regs[2])]->getTo(), 1); |
|
50 | + if (preg_match('/(.*)\\b('.$this->getRegex().')$/i', $word, $regs) > 0) { |
|
51 | + return $regs[1].$word[0].substr($this->rules[strtolower($regs[2])]->getTo(), 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->rules)) . ')'; |
|
60 | + $this->regex = '(?:'.implode('|', array_keys($this->rules)).')'; |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | return $this->regex; |