@@ -52,32 +52,32 @@ |
||
| 52 | 52 | return $this->cache['singularize'][$word]; |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - if (! isset($this->rules['merged']['uninflected'])) { |
|
| 55 | + if (!isset($this->rules['merged']['uninflected'])) { |
|
| 56 | 56 | $this->rules['merged']['uninflected'] = array_merge( |
| 57 | 57 | $this->rules['uninflected'], |
| 58 | 58 | $this->uninflected->getUninflected() |
| 59 | 59 | ); |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - if (! isset($this->rules['merged']['irregular'])) { |
|
| 62 | + if (!isset($this->rules['merged']['irregular'])) { |
|
| 63 | 63 | $this->rules['merged']['irregular'] = array_merge( |
| 64 | 64 | $this->rules['irregular'], |
| 65 | 65 | array_flip($this->pluralizer->getRules()['irregular']) |
| 66 | 66 | ); |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - if (! isset($this->rules['cacheUninflected']) || ! isset($this->rules['cacheIrregular'])) { |
|
| 70 | - $this->rules['cacheUninflected'] = '(?:' . implode('|', $this->rules['merged']['uninflected']) . ')'; |
|
| 71 | - $this->rules['cacheIrregular'] = '(?:' . implode('|', array_keys($this->rules['merged']['irregular'])) . ')'; |
|
| 69 | + if (!isset($this->rules['cacheUninflected']) || !isset($this->rules['cacheIrregular'])) { |
|
| 70 | + $this->rules['cacheUninflected'] = '(?:'.implode('|', $this->rules['merged']['uninflected']).')'; |
|
| 71 | + $this->rules['cacheIrregular'] = '(?:'.implode('|', array_keys($this->rules['merged']['irregular'])).')'; |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - if (preg_match('/(.*)\\b(' . $this->rules['cacheIrregular'] . ')$/i', $word, $regs)) { |
|
| 75 | - $this->cache['singularize'][$word] = $regs[1] . $word[0] . substr($this->rules['merged']['irregular'][strtolower($regs[2])], 1); |
|
| 74 | + if (preg_match('/(.*)\\b('.$this->rules['cacheIrregular'].')$/i', $word, $regs)) { |
|
| 75 | + $this->cache['singularize'][$word] = $regs[1].$word[0].substr($this->rules['merged']['irregular'][strtolower($regs[2])], 1); |
|
| 76 | 76 | |
| 77 | 77 | return $this->cache['singularize'][$word]; |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | - if (preg_match('/^(' . $this->rules['cacheUninflected'] . ')$/i', $word, $regs)) { |
|
| 80 | + if (preg_match('/^('.$this->rules['cacheUninflected'].')$/i', $word, $regs)) { |
|
| 81 | 81 | $this->cache['singularize'][$word] = $word; |
| 82 | 82 | |
| 83 | 83 | return $word; |
@@ -47,7 +47,7 @@ |
||
| 47 | 47 | //} |
| 48 | 48 | |
| 49 | 49 | foreach ($rules as $rule => $pattern) { |
| 50 | - if (! is_array($pattern)) { |
|
| 50 | + if (!is_array($pattern)) { |
|
| 51 | 51 | continue; |
| 52 | 52 | } |
| 53 | 53 | |
@@ -47,29 +47,29 @@ |
||
| 47 | 47 | return $this->cache['pluralize'][$word]; |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | - if (! isset($this->rules['merged']['irregular'])) { |
|
| 50 | + if (!isset($this->rules['merged']['irregular'])) { |
|
| 51 | 51 | $this->rules['merged']['irregular'] = $this->rules['irregular']; |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - if (! isset($this->rules['merged']['uninflected'])) { |
|
| 54 | + if (!isset($this->rules['merged']['uninflected'])) { |
|
| 55 | 55 | $this->rules['merged']['uninflected'] = array_merge( |
| 56 | 56 | $this->rules['uninflected'], |
| 57 | 57 | $this->uninflected->getUninflected() |
| 58 | 58 | ); |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | - if (! isset($this->rules['cacheUninflected']) || ! isset($this->rules['cacheIrregular'])) { |
|
| 62 | - $this->rules['cacheUninflected'] = '(?:' . implode('|', $this->rules['merged']['uninflected']) . ')'; |
|
| 63 | - $this->rules['cacheIrregular'] = '(?:' . implode('|', array_keys($this->rules['merged']['irregular'])) . ')'; |
|
| 61 | + if (!isset($this->rules['cacheUninflected']) || !isset($this->rules['cacheIrregular'])) { |
|
| 62 | + $this->rules['cacheUninflected'] = '(?:'.implode('|', $this->rules['merged']['uninflected']).')'; |
|
| 63 | + $this->rules['cacheIrregular'] = '(?:'.implode('|', array_keys($this->rules['merged']['irregular'])).')'; |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - if (preg_match('/(.*)\\b(' . $this->rules['cacheIrregular'] . ')$/i', $word, $regs)) { |
|
| 67 | - $this->cache['pluralize'][$word] = $regs[1] . $word[0] . substr($this->rules['merged']['irregular'][strtolower($regs[2])], 1); |
|
| 66 | + if (preg_match('/(.*)\\b('.$this->rules['cacheIrregular'].')$/i', $word, $regs)) { |
|
| 67 | + $this->cache['pluralize'][$word] = $regs[1].$word[0].substr($this->rules['merged']['irregular'][strtolower($regs[2])], 1); |
|
| 68 | 68 | |
| 69 | 69 | return $this->cache['pluralize'][$word]; |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - if (preg_match('/^(' . $this->rules['cacheUninflected'] . ')$/i', $word, $regs)) { |
|
| 72 | + if (preg_match('/^('.$this->rules['cacheUninflected'].')$/i', $word, $regs)) { |
|
| 73 | 73 | $this->cache['pluralize'][$word] = $word; |
| 74 | 74 | |
| 75 | 75 | return $word; |