@@ -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 | |
@@ -36,8 +36,8 @@ discard block |
||
| 36 | 36 | |
| 37 | 37 | public function inflect(string $word) : ?string |
| 38 | 38 | { |
| 39 | - if (preg_match('/(.*)\\b(' . $this->getRegex() . ')$/i', $word, $regs)) { |
|
| 40 | - return $regs[1] . $word[0] . substr($this->irregular[strtolower($regs[2])], 1); |
|
| 39 | + if (preg_match('/(.*)\\b('.$this->getRegex().')$/i', $word, $regs)) { |
|
| 40 | + return $regs[1].$word[0].substr($this->irregular[strtolower($regs[2])], 1); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | return null; |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | private function getRegex() : string |
| 47 | 47 | { |
| 48 | 48 | if ($this->regex === null) { |
| 49 | - $this->regex = '(?:' . implode('|', array_keys($this->irregular)) . ')'; |
|
| 49 | + $this->regex = '(?:'.implode('|', array_keys($this->irregular)).')'; |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | return $this->regex; |
@@ -147,13 +147,13 @@ |
||
| 147 | 147 | |
| 148 | 148 | public function isUninflected(string $word) : bool |
| 149 | 149 | { |
| 150 | - return preg_match('/^(' . $this->getRegex() . ')$/i', $word, $regs) === 1; |
|
| 150 | + return preg_match('/^('.$this->getRegex().')$/i', $word, $regs) === 1; |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | private function getRegex() : string |
| 154 | 154 | { |
| 155 | 155 | if ($this->regex === null) { |
| 156 | - $this->regex = '(?:' . implode('|', $this->uninflected) . ')'; |
|
| 156 | + $this->regex = '(?:'.implode('|', $this->uninflected).')'; |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | return $this->regex; |