@@ -31,7 +31,7 @@ |
||
31 | 31 | |
32 | 32 | public function inflect(string $word) : string |
33 | 33 | { |
34 | - if (! isset($this->wordInflectionCache[$word])) { |
|
34 | + if (!isset($this->wordInflectionCache[$word])) { |
|
35 | 35 | $this->wordInflectionCache[$word] = $this->doInflect($word); |
36 | 36 | } |
37 | 37 |
@@ -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; |