@@ -27,7 +27,7 @@ |
||
27 | 27 | return $this->pattern; |
28 | 28 | } |
29 | 29 | |
30 | - return '/' . $this->pattern . '/i'; |
|
30 | + return '/'.$this->pattern.'/i'; |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | public function matches(string $word) : bool |
@@ -150,11 +150,11 @@ |
||
150 | 150 | private function getRegex() : string |
151 | 151 | { |
152 | 152 | if ($this->regex === null) { |
153 | - $patterns = array_map(function (Pattern $word) : string { |
|
153 | + $patterns = array_map(function(Pattern $word) : string { |
|
154 | 154 | return $word->getPattern(); |
155 | 155 | }, $this->patterns); |
156 | 156 | |
157 | - $this->regex = '/^(?:' . implode('|', $patterns) . ')$/i'; |
|
157 | + $this->regex = '/^(?:'.implode('|', $patterns).')$/i'; |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | return $this->regex; |
@@ -43,8 +43,8 @@ discard block |
||
43 | 43 | |
44 | 44 | public function inflect(string $word) : string |
45 | 45 | { |
46 | - if (preg_match('/(.*)\\b(' . $this->getRegex() . ')$/i', $word, $regs) === 1) { |
|
47 | - return $regs[1] . $word[0] . substr($this->substitutions[strtolower($regs[2])]->getTo()->getWord(), 1); |
|
46 | + if (preg_match('/(.*)\\b('.$this->getRegex().')$/i', $word, $regs) === 1) { |
|
47 | + return $regs[1].$word[0].substr($this->substitutions[strtolower($regs[2])]->getTo()->getWord(), 1); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | return $word; |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | private function getRegex() : string |
54 | 54 | { |
55 | 55 | if ($this->regex === null) { |
56 | - $this->regex = '(?:' . implode('|', array_keys($this->substitutions)) . ')'; |
|
56 | + $this->regex = '(?:'.implode('|', array_keys($this->substitutions)).')'; |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | return $this->regex; |