@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | $msgid = 'Column'; |
| 128 | 128 | |
| 129 | 129 | $lock = 'mo_' . $locale . '.' . $domain . '.' . ApcuCache::LOADED_KEY; |
| 130 | - apcu_entry($lock, static function () { |
|
| 130 | + apcu_entry($lock, static function() { |
|
| 131 | 131 | sleep(1); |
| 132 | 132 | |
| 133 | 133 | return 1; |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | $method->setAccessible(true); |
| 203 | 203 | |
| 204 | 204 | $key = 'mo_' . $locale . '.' . $domain . '.' . $msgid; |
| 205 | - apcu_entry($key, static function () use ($expected): string { |
|
| 205 | + apcu_entry($key, static function() use ($expected): string { |
|
| 206 | 206 | sleep(1); |
| 207 | 207 | |
| 208 | 208 | return $expected; |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | /** @param CacheInterface|string|null $cache Mo file to load (null for no file) or a CacheInterface implementation */ |
| 115 | 115 | public function __construct($cache) |
| 116 | 116 | { |
| 117 | - if (! $cache instanceof CacheInterface) { |
|
| 117 | + if (!$cache instanceof CacheInterface) { |
|
| 118 | 118 | $cache = new InMemoryCache(new MoParser($cache)); |
| 119 | 119 | } |
| 120 | 120 | |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | { |
| 284 | 284 | // this should contains all strings separated by NULLs |
| 285 | 285 | $key = implode(chr(0), [$msgid, $msgidPlural]); |
| 286 | - if (! $this->cache->has($key)) { |
|
| 286 | + if (!$this->cache->has($key)) { |
|
| 287 | 287 | return $number !== 1 ? $msgidPlural : $msgid; |
| 288 | 288 | } |
| 289 | 289 | |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | |
| 295 | 295 | $list = explode(chr(0), $result); |
| 296 | 296 | |
| 297 | - if (! isset($list[$select])) { |
|
| 297 | + if (!isset($list[$select])) { |
|
| 298 | 298 | return $list[0]; |
| 299 | 299 | } |
| 300 | 300 | |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | bool $reloadOnMiss = true, |
| 46 | 46 | string $prefix = 'mo_', |
| 47 | 47 | ) { |
| 48 | - if (! (function_exists('apcu_enabled') && apcu_enabled())) { |
|
| 48 | + if (!(function_exists('apcu_enabled') && apcu_enabled())) { |
|
| 49 | 49 | throw new CacheException('ACPu extension must be installed and enabled'); |
| 50 | 50 | } |
| 51 | 51 | |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | return $msgstr; |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - if (! $this->reloadOnMiss) { |
|
| 69 | + if (!$this->reloadOnMiss) { |
|
| 70 | 70 | return $msgid; |
| 71 | 71 | } |
| 72 | 72 | |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | private function reloadOnMiss(string $msgid): string |
| 77 | 77 | { |
| 78 | 78 | // store original if translation is not present |
| 79 | - $cached = apcu_entry($this->getKey($msgid), static function () use ($msgid) { |
|
| 79 | + $cached = apcu_entry($this->getKey($msgid), static function() use ($msgid) { |
|
| 80 | 80 | return $msgid; |
| 81 | 81 | }, $this->ttl); |
| 82 | 82 | // if another process has updated cache, return early |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | |
| 105 | 105 | public function setAll(array $translations): void |
| 106 | 106 | { |
| 107 | - $keys = array_map(function (string $msgid): string { |
|
| 107 | + $keys = array_map(function(string $msgid): string { |
|
| 108 | 108 | return $this->getKey($msgid); |
| 109 | 109 | }, array_keys($translations)); |
| 110 | 110 | $translations = array_combine($keys, $translations); |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | // Try to prevent cache slam if multiple processes are trying to load translations. There is still a race |
| 124 | 124 | // between the exists check and creating the entry, but at least it's small |
| 125 | 125 | $key = $this->getKey(self::LOADED_KEY); |
| 126 | - $loaded = apcu_exists($key) || apcu_entry($key, static function (): int { |
|
| 126 | + $loaded = apcu_exists($key) || apcu_entry($key, static function(): int { |
|
| 127 | 127 | return 0; |
| 128 | 128 | }, $this->ttl); |
| 129 | 129 | if ($loaded) { |
@@ -91,7 +91,7 @@ |
||
| 91 | 91 | $translator->getTranslations(); |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | - private function getTranslator(string|null $filename): Translator |
|
| 94 | + private function getTranslator(string | null $filename): Translator |
|
| 95 | 95 | { |
| 96 | 96 | return new Translator(new InMemoryCache(new MoParser($filename))); |
| 97 | 97 | } |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | /** @var string|null */ |
| 52 | 52 | private $filename; |
| 53 | 53 | |
| 54 | - public function __construct(string|null $filename) |
|
| 54 | + public function __construct(string | null $filename) |
|
| 55 | 55 | { |
| 56 | 56 | $this->filename = $filename; |
| 57 | 57 | } |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | return; |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - if (! is_readable($this->filename)) { |
|
| 68 | + if (!is_readable($this->filename)) { |
|
| 69 | 69 | $this->error = self::ERROR_DOES_NOT_EXIST; |
| 70 | 70 | |
| 71 | 71 | return; |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | $translations = $stream->readint($unpack, 16); |
| 92 | 92 | |
| 93 | 93 | /* get original and translations tables */ |
| 94 | - $totalTimesTwo = (int) ($total * 2);// Fix for issue #36 on ARM |
|
| 94 | + $totalTimesTwo = (int) ($total * 2); // Fix for issue #36 on ARM |
|
| 95 | 95 | $tableOriginals = $stream->readintarray($unpack, $originals, $totalTimesTwo); |
| 96 | 96 | $tableTranslations = $stream->readintarray($unpack, $translations, $totalTimesTwo); |
| 97 | 97 | |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | // If the locale name doesn't match POSIX style, just include it as-is. |
| 187 | - if (! in_array($locale, $localeNames)) { |
|
| 187 | + if (!in_array($locale, $localeNames)) { |
|
| 188 | 188 | array_push($localeNames, $locale); |
| 189 | 189 | } |
| 190 | 190 | } |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | /** |
| 196 | 196 | * Sets factory responsible for composing a `CacheInterface` |
| 197 | 197 | */ |
| 198 | - public static function setCacheFactory(CacheFactoryInterface|null $cacheFactory): void |
|
| 198 | + public static function setCacheFactory(CacheFactoryInterface | null $cacheFactory): void |
|
| 199 | 199 | { |
| 200 | 200 | self::$cacheFactory = $cacheFactory; |
| 201 | 201 | } |
@@ -211,11 +211,11 @@ discard block |
||
| 211 | 211 | $domain = $this->defaultDomain; |
| 212 | 212 | } |
| 213 | 213 | |
| 214 | - if (! isset($this->domains[$this->locale])) { |
|
| 214 | + if (!isset($this->domains[$this->locale])) { |
|
| 215 | 215 | $this->domains[$this->locale] = []; |
| 216 | 216 | } |
| 217 | 217 | |
| 218 | - if (! isset($this->domains[$this->locale][$domain])) { |
|
| 218 | + if (!isset($this->domains[$this->locale][$domain])) { |
|
| 219 | 219 | if (isset($this->paths[$domain])) { |
| 220 | 220 | $base = $this->paths[$domain]; |
| 221 | 221 | } else { |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | */ |
| 278 | 278 | public function setlocale(string $locale): string |
| 279 | 279 | { |
| 280 | - if (! empty($locale)) { |
|
| 280 | + if (!empty($locale)) { |
|
| 281 | 281 | $this->locale = $locale; |
| 282 | 282 | } |
| 283 | 283 | |