@@ -21,7 +21,7 @@ |
||
21 | 21 | if ($this->pattern[0] === '/') { |
22 | 22 | $this->regex = $this->pattern; |
23 | 23 | } else { |
24 | - $this->regex = '/' . $this->pattern . '/i'; |
|
24 | + $this->regex = '/'.$this->pattern.'/i'; |
|
25 | 25 | } |
26 | 26 | } |
27 | 27 |
@@ -20,11 +20,11 @@ |
||
20 | 20 | { |
21 | 21 | $this->patterns = $patterns; |
22 | 22 | |
23 | - $patterns = array_map(function (Pattern $word) : string { |
|
23 | + $patterns = array_map(function(Pattern $word) : string { |
|
24 | 24 | return $word->getPattern(); |
25 | 25 | }, $this->patterns); |
26 | 26 | |
27 | - $this->regex = '/^(?:' . implode('|', $patterns) . ')$/i'; |
|
27 | + $this->regex = '/^(?:'.implode('|', $patterns).')$/i'; |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | public function matches(string $word) : bool |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | $this->substitutions[$substitution->getFrom()->getWord()] = $substitution; |
26 | 26 | } |
27 | 27 | |
28 | - $this->regex = '(?:' . implode('|', array_keys($this->substitutions)) . ')'; |
|
28 | + $this->regex = '(?:'.implode('|', array_keys($this->substitutions)).')'; |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | public function getFlippedSubstitutions() : Substitutions |
@@ -45,8 +45,8 @@ discard block |
||
45 | 45 | |
46 | 46 | public function inflect(string $word) : string |
47 | 47 | { |
48 | - if (preg_match('/(.*)\\b(' . $this->regex . ')$/i', $word, $regs) === 1) { |
|
49 | - return $regs[1] . $word[0] . substr($this->substitutions[strtolower($regs[2])]->getTo()->getWord(), 1); |
|
48 | + if (preg_match('/(.*)\\b('.$this->regex.')$/i', $word, $regs) === 1) { |
|
49 | + return $regs[1].$word[0].substr($this->substitutions[strtolower($regs[2])]->getTo()->getWord(), 1); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | return $word; |