| @@ -47,8 +47,8 @@ discard block | ||
| 47 | 47 | |
| 48 | 48 | public function inflect(string $word) : string | 
| 49 | 49 |      { | 
| 50 | -        if (preg_match('/(.*)\\b(' . $this->getRegex() . ')$/i', $word, $regs) > 0) { | |
| 51 | - return $regs[1] . $word[0] . substr($this->substitutions[strtolower($regs[2])]->getTo()->getWord(), 1); | |
| 50 | +        if (preg_match('/(.*)\\b('.$this->getRegex().')$/i', $word, $regs) > 0) { | |
| 51 | + return $regs[1].$word[0].substr($this->substitutions[strtolower($regs[2])]->getTo()->getWord(), 1); | |
| 52 | 52 | } | 
| 53 | 53 | |
| 54 | 54 | return $word; | 
| @@ -57,7 +57,7 @@ discard block | ||
| 57 | 57 | private function getRegex() : string | 
| 58 | 58 |      { | 
| 59 | 59 |          if ($this->regex === null) { | 
| 60 | -            $this->regex = '(?:' . implode('|', array_keys($this->substitutions)) . ')'; | |
| 60 | +            $this->regex = '(?:'.implode('|', array_keys($this->substitutions)).')'; | |
| 61 | 61 | } | 
| 62 | 62 | |
| 63 | 63 | return $this->regex; | 
| @@ -60,12 +60,12 @@ | ||
| 60 | 60 | $irregular = $this->irregular ?? new Irregular(...Singular::getIrregular()); | 
| 61 | 61 | $pluralIrregular = $this->pluralIrregular ?? new Irregular(...Plural::getIrregular()); | 
| 62 | 62 | |
| 63 | -        $singularUninflected = new Uninflected(...(static function () use ($uninflected) : iterable { | |
| 63 | +        $singularUninflected = new Uninflected(...(static function() use ($uninflected) : iterable { | |
| 64 | 64 | yield from $uninflected->getPatterns(); | 
| 65 | 65 | yield from Uninflected::getDefault(); | 
| 66 | 66 | })()); | 
| 67 | 67 | |
| 68 | -        $singularIrregular = new Irregular(...(static function () use ($irregular, $pluralIrregular) : iterable { | |
| 68 | +        $singularIrregular = new Irregular(...(static function() use ($irregular, $pluralIrregular) : iterable { | |
| 69 | 69 | yield from $irregular->getSubstitutions(); | 
| 70 | 70 | yield from $pluralIrregular->getFlippedSubstitutions(); | 
| 71 | 71 | })()); | 
| @@ -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; | 
| @@ -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 | 
| @@ -48,7 +48,7 @@ | ||
| 48 | 48 | $uninflected = $this->uninflected ?? new Uninflected(...Plural::getUninflected()); | 
| 49 | 49 | $irregular = $this->irregular ?? new Irregular(...Plural::getIrregular()); | 
| 50 | 50 | |
| 51 | -        $pluralUninflected = new Uninflected(...(static function () use ($uninflected) : iterable { | |
| 51 | +        $pluralUninflected = new Uninflected(...(static function() use ($uninflected) : iterable { | |
| 52 | 52 | yield from $uninflected->getPatterns(); | 
| 53 | 53 | yield from Uninflected::getDefault(); | 
| 54 | 54 | })()); |