@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | |
| 46 | 46 | public function inflect(string $word) : string |
| 47 | 47 | { |
| 48 | - if (! isset($this->wordInflectionCache[$word])) { |
|
| 48 | + if (!isset($this->wordInflectionCache[$word])) { |
|
| 49 | 49 | $this->wordInflectionCache[$word] = $this->doInflect($word); |
| 50 | 50 | } |
| 51 | 51 | |
@@ -56,11 +56,11 @@ discard block |
||
| 56 | 56 | { |
| 57 | 57 | $irregular = $this->ruleset->getIrregular(); |
| 58 | 58 | |
| 59 | - if (preg_match('/(.*)\\b(' . $this->getIrregularRegex($irregular) . ')$/i', $word, $regs)) { |
|
| 60 | - return $regs[1] . $word[0] . substr($irregular[strtolower($regs[2])], 1); |
|
| 59 | + if (preg_match('/(.*)\\b('.$this->getIrregularRegex($irregular).')$/i', $word, $regs)) { |
|
| 60 | + return $regs[1].$word[0].substr($irregular[strtolower($regs[2])], 1); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | - if (preg_match('/^(' . $this->getUninflectedRegex() . ')$/i', $word, $regs)) { |
|
| 63 | + if (preg_match('/^('.$this->getUninflectedRegex().')$/i', $word, $regs)) { |
|
| 64 | 64 | return $word; |
| 65 | 65 | } |
| 66 | 66 | |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | private function getIrregularRegex(array $irregular) : string |
| 80 | 80 | { |
| 81 | 81 | if ($this->irregularRegex === null) { |
| 82 | - $this->irregularRegex = '(?:' . implode('|', array_keys($irregular)) . ')'; |
|
| 82 | + $this->irregularRegex = '(?:'.implode('|', array_keys($irregular)).')'; |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | return $this->irregularRegex; |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | private function getUninflectedRegex() : string |
| 89 | 89 | { |
| 90 | 90 | if ($this->uninflectedRegex === null) { |
| 91 | - $this->uninflectedRegex = '(?:' . implode('|', $this->ruleset->getUninflected()) . ')'; |
|
| 91 | + $this->uninflectedRegex = '(?:'.implode('|', $this->ruleset->getUninflected()).')'; |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | return $this->uninflectedRegex; |