@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | */ |
64 | 64 | public function cacheClear(string $type): bool |
65 | 65 | { |
66 | - return (bool) \apcu_clear_cache(); |
|
66 | + return (bool)\apcu_clear_cache(); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | */ |
85 | 85 | public function exists(string $key): bool |
86 | 86 | { |
87 | - return (bool) \apcu_exists($key); |
|
87 | + return (bool)\apcu_exists($key); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | /** |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | */ |
113 | 113 | public function remove(string $key): bool |
114 | 114 | { |
115 | - return (bool) \apcu_delete($key); |
|
115 | + return (bool)\apcu_delete($key); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | /** |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | */ |
121 | 121 | public function removeAll(): bool |
122 | 122 | { |
123 | - return (bool) ($this->cacheClear('system') && $this->cacheClear('user')); |
|
123 | + return (bool)($this->cacheClear('system') && $this->cacheClear('user')); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | /** |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | */ |
129 | 129 | public function set(string $key, $value): bool |
130 | 130 | { |
131 | - return (bool) \apcu_store($key, $value); |
|
131 | + return (bool)\apcu_store($key, $value); |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | /** |
@@ -136,6 +136,6 @@ discard block |
||
136 | 136 | */ |
137 | 137 | public function setExpired(string $key, $data, int $ttl = 0): bool |
138 | 138 | { |
139 | - return (bool) \apcu_store($key, $data, $ttl); |
|
139 | + return (bool)\apcu_store($key, $data, $ttl); |
|
140 | 140 | } |
141 | 141 | } |
@@ -302,10 +302,10 @@ |
||
302 | 302 | protected function getTheDefaultPrefix(): string |
303 | 303 | { |
304 | 304 | return ($_SERVER['SERVER_NAME'] ?? '') . '_' . |
305 | - ($_SERVER['THEME'] ?? '') . '_' . |
|
306 | - ($_SERVER['STAGE'] ?? '') . '_' . |
|
307 | - ($_SESSION['language'] ?? '') . '_' . |
|
308 | - ($_SESSION['language_extra'] ?? ''); |
|
305 | + ($_SERVER['THEME'] ?? '') . '_' . |
|
306 | + ($_SERVER['STAGE'] ?? '') . '_' . |
|
307 | + ($_SESSION['language'] ?? '') . '_' . |
|
308 | + ($_SESSION['language_extra'] ?? ''); |
|
309 | 309 | } |
310 | 310 | |
311 | 311 | /** |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | */ |
253 | 253 | protected function calculateStoreKey(string $rawKey): string |
254 | 254 | { |
255 | - $str = $this->getPrefix() . $rawKey; |
|
255 | + $str = $this->getPrefix().$rawKey; |
|
256 | 256 | |
257 | 257 | if ($this->adapter instanceof AdapterFileAbstract) { |
258 | 258 | $str = $this->cleanStoreKey($str); |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | } else { |
276 | 276 | |
277 | 277 | // for testing with dev-address |
278 | - $noDev = isset($_GET['noDev']) ? (int) $_GET['noDev'] : 0; |
|
278 | + $noDev = isset($_GET['noDev']) ? (int)$_GET['noDev'] : 0; |
|
279 | 279 | $remoteAddr = $_SERVER['REMOTE_ADDR'] ?? 'NO_REMOTE_ADDR'; |
280 | 280 | |
281 | 281 | if ( |
@@ -500,7 +500,7 @@ discard block |
||
500 | 500 | } |
501 | 501 | |
502 | 502 | // always cache the TTL time, maybe we need this later ... |
503 | - self::$STATIC_CACHE_EXPIRE[$storeKey] = ($ttl ? (int) $ttl + \time() : 0); |
|
503 | + self::$STATIC_CACHE_EXPIRE[$storeKey] = ($ttl ? (int)$ttl + \time() : 0); |
|
504 | 504 | |
505 | 505 | return $this->adapter->setExpired($storeKey, $serialized, $ttl); |
506 | 506 | } |
@@ -598,10 +598,10 @@ discard block |
||
598 | 598 | */ |
599 | 599 | protected function getTheDefaultPrefix(): string |
600 | 600 | { |
601 | - return ($_SERVER['SERVER_NAME'] ?? '') . '_' . |
|
602 | - ($_SERVER['THEME'] ?? '') . '_' . |
|
603 | - ($_SERVER['STAGE'] ?? '') . '_' . |
|
604 | - ($_SESSION['language'] ?? '') . '_' . |
|
601 | + return ($_SERVER['SERVER_NAME'] ?? '').'_'. |
|
602 | + ($_SERVER['THEME'] ?? '').'_'. |
|
603 | + ($_SERVER['STAGE'] ?? '').'_'. |
|
604 | + ($_SESSION['language'] ?? '').'_'. |
|
605 | 605 | ($_SESSION['language_extra'] ?? ''); |
606 | 606 | } |
607 | 607 | |
@@ -646,7 +646,7 @@ discard block |
||
646 | 646 | |
647 | 647 | // test the cache, with this GET-parameter |
648 | 648 | if ($this->disableCacheGetParameter) { |
649 | - $testCache = isset($_GET[$this->disableCacheGetParameter]) ? (int) $_GET[$this->disableCacheGetParameter] : 0; |
|
649 | + $testCache = isset($_GET[$this->disableCacheGetParameter]) ? (int)$_GET[$this->disableCacheGetParameter] : 0; |
|
650 | 650 | } else { |
651 | 651 | $testCache = 0; |
652 | 652 | } |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | { |
95 | 95 | // Make sure we are under the proper limit |
96 | 96 | if (\strlen($key) > 250) { |
97 | - throw new InvalidArgumentException('The passed cache key is over 250 bytes:' . \print_r($key, true)); |
|
97 | + throw new InvalidArgumentException('The passed cache key is over 250 bytes:'.\print_r($key, true)); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | return $this->memcache->set($key, $value, $this->getCompressedFlag()); |
@@ -139,6 +139,6 @@ discard block |
||
139 | 139 | */ |
140 | 140 | public function setCompressed($value) |
141 | 141 | { |
142 | - $this->compressed = (bool) $value; |
|
142 | + $this->compressed = (bool)$value; |
|
143 | 143 | } |
144 | 144 | } |
@@ -90,8 +90,8 @@ |
||
90 | 90 | public function set(string $key, $value): bool |
91 | 91 | { |
92 | 92 | // Make sure we are under the proper limit |
93 | - if (\strlen($this->memcached->getOption(\Memcached::OPT_PREFIX_KEY) . $key) > 250) { |
|
94 | - throw new InvalidArgumentException('The passed cache key is over 250 bytes:' . \print_r($key, true)); |
|
93 | + if (\strlen($this->memcached->getOption(\Memcached::OPT_PREFIX_KEY).$key) > 250) { |
|
94 | + throw new InvalidArgumentException('The passed cache key is over 250 bytes:'.\print_r($key, true)); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | return $this->memcached->set($key, $value); |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | */ |
49 | 49 | public function apc_cache_exists($key): bool |
50 | 50 | { |
51 | - return (bool) \apc_fetch($key); |
|
51 | + return (bool)\apc_fetch($key); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | /** |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | */ |
64 | 64 | public function cacheClear(string $type): bool |
65 | 65 | { |
66 | - return (bool) \apc_clear_cache($type); |
|
66 | + return (bool)\apc_clear_cache($type); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | public function exists(string $key): bool |
87 | 87 | { |
88 | 88 | if (\function_exists('apc_exists')) { |
89 | - return (bool) \apc_exists($key); |
|
89 | + return (bool)\apc_exists($key); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | return $this->apc_cache_exists($key); |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | */ |
118 | 118 | public function remove(string $key): bool |
119 | 119 | { |
120 | - return (bool) \apc_delete($key); |
|
120 | + return (bool)\apc_delete($key); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | /** |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | */ |
126 | 126 | public function removeAll(): bool |
127 | 127 | { |
128 | - return (bool) ($this->cacheClear('system') && $this->cacheClear('user')); |
|
128 | + return (bool)($this->cacheClear('system') && $this->cacheClear('user')); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | /** |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | */ |
134 | 134 | public function set(string $key, $value): bool |
135 | 135 | { |
136 | - return (bool) \apc_store($key, $value); |
|
136 | + return (bool)\apc_store($key, $value); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | /** |
@@ -141,6 +141,6 @@ discard block |
||
141 | 141 | */ |
142 | 142 | public function setExpired(string $key, $data, int $ttl = 0): bool |
143 | 143 | { |
144 | - return (bool) \apc_store($key, $data, $ttl); |
|
144 | + return (bool)\apc_store($key, $data, $ttl); |
|
145 | 145 | } |
146 | 146 | } |
@@ -74,7 +74,7 @@ |
||
74 | 74 | */ |
75 | 75 | public function setExpired(string $key, $value, int $ttl = 0): bool |
76 | 76 | { |
77 | - return (bool) \file_put_contents( |
|
77 | + return (bool)\file_put_contents( |
|
78 | 78 | $this->getFileName($key), |
79 | 79 | $this->serializer->serialize( |
80 | 80 | [ |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | */ |
70 | 70 | protected function getFileName(string $key): string |
71 | 71 | { |
72 | - return $this->cacheDir . \DIRECTORY_SEPARATOR . self::CACHE_FILE_PREFIX . $key . '.php'; |
|
72 | + return $this->cacheDir.\DIRECTORY_SEPARATOR.self::CACHE_FILE_PREFIX.$key.'.php'; |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | /** |
@@ -83,11 +83,11 @@ discard block |
||
83 | 83 | ]; |
84 | 84 | $content = \var_export($item, true); |
85 | 85 | |
86 | - $content = '<?php return ' . $content . ';'; |
|
86 | + $content = '<?php return '.$content.';'; |
|
87 | 87 | |
88 | 88 | $cacheFile = $this->getFileName($key); |
89 | 89 | |
90 | - $result = (bool) \file_put_contents( |
|
90 | + $result = (bool)\file_put_contents( |
|
91 | 91 | $cacheFile, |
92 | 92 | $content, |
93 | 93 | 0, |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | /** @noinspection PhpUnhandledExceptionInspection */ |
89 | 89 | $interfaces = (new \ReflectionClass($replaceAdapter))->getInterfaces(); |
90 | 90 | if (!array_key_exists(iAdapter::class, $interfaces)) { |
91 | - throw new InvalidArgumentException('"' . $replaceAdapter . '" did not implement the "iAdapter"-interface [' . print_r($interfaces, true) . ']'); |
|
91 | + throw new InvalidArgumentException('"'.$replaceAdapter.'" did not implement the "iAdapter"-interface ['.print_r($interfaces, true).']'); |
|
92 | 92 | } |
93 | 93 | } |
94 | 94 | |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | /** @noinspection PhpUnhandledExceptionInspection */ |
119 | 119 | $cacheAdapterManager->addAdapter( |
120 | 120 | AdapterMemcached::class, |
121 | - function () { |
|
121 | + function() { |
|
122 | 122 | $memcached = null; |
123 | 123 | $isMemcachedAvailable = false; |
124 | 124 | if (\extension_loaded('memcached')) { |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | /** @noinspection PhpUnhandledExceptionInspection */ |
140 | 140 | $cacheAdapterManager->addAdapter( |
141 | 141 | AdapterMemcache::class, |
142 | - function () { |
|
142 | + function() { |
|
143 | 143 | $memcache = null; |
144 | 144 | $isMemcacheAvailable = false; |
145 | 145 | /** @noinspection ClassConstantCanBeUsedInspection */ |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | /** @noinspection PhpUnhandledExceptionInspection */ |
162 | 162 | $cacheAdapterManager->addAdapter( |
163 | 163 | AdapterPredis::class, |
164 | - function () { |
|
164 | + function() { |
|
165 | 165 | $redis = null; |
166 | 166 | $isRedisAvailable = false; |
167 | 167 | if ( |
@@ -216,8 +216,8 @@ discard block |
||
216 | 216 | /** @noinspection PhpUnhandledExceptionInspection */ |
217 | 217 | $cacheAdapterManager->addAdapter( |
218 | 218 | AdapterOpCache::class, |
219 | - function () { |
|
220 | - $cacheDir = \realpath(\sys_get_temp_dir()) . '/simple_php_cache'; |
|
219 | + function() { |
|
220 | + $cacheDir = \realpath(\sys_get_temp_dir()).'/simple_php_cache'; |
|
221 | 221 | |
222 | 222 | return $cacheDir; |
223 | 223 | } |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | public function delete($key): bool |
32 | 32 | { |
33 | 33 | if (!\is_string($key)) { |
34 | - throw new InvalidArgumentException('$key is not a string:' . \print_r($key, true)); |
|
34 | + throw new InvalidArgumentException('$key is not a string:'.\print_r($key, true)); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | return $this->removeItem($key); |
@@ -53,11 +53,11 @@ discard block |
||
53 | 53 | && |
54 | 54 | !($keys instanceof \Traversable) |
55 | 55 | ) { |
56 | - throw new InvalidArgumentException('$keys is not iterable:' . \print_r($keys, true)); |
|
56 | + throw new InvalidArgumentException('$keys is not iterable:'.\print_r($keys, true)); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | $results = []; |
60 | - foreach ((array) $keys as $key) { |
|
60 | + foreach ((array)$keys as $key) { |
|
61 | 61 | $results[] = $this->delete($key); |
62 | 62 | } |
63 | 63 | |
@@ -101,11 +101,11 @@ discard block |
||
101 | 101 | && |
102 | 102 | !($keys instanceof \Traversable) |
103 | 103 | ) { |
104 | - throw new InvalidArgumentException('$keys is not iterable:' . \print_r($keys, true)); |
|
104 | + throw new InvalidArgumentException('$keys is not iterable:'.\print_r($keys, true)); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | $result = []; |
108 | - foreach ((array) $keys as $key) { |
|
108 | + foreach ((array)$keys as $key) { |
|
109 | 109 | $result[$key] = $this->has($key) ? $this->get($key) : $default; |
110 | 110 | } |
111 | 111 | |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | public function has($key): bool |
130 | 130 | { |
131 | 131 | if (!\is_string($key)) { |
132 | - throw new InvalidArgumentException('$key is not a string:' . \print_r($key, true)); |
|
132 | + throw new InvalidArgumentException('$key is not a string:'.\print_r($key, true)); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | return $this->existsItem($key); |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | public function set($key, $value, $ttl = null): bool |
152 | 152 | { |
153 | 153 | if (!\is_string($key)) { |
154 | - throw new InvalidArgumentException('$key is not a string:' . \print_r($key, true)); |
|
154 | + throw new InvalidArgumentException('$key is not a string:'.\print_r($key, true)); |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | return $this->setItem($key, $value, $ttl); |
@@ -176,11 +176,11 @@ discard block |
||
176 | 176 | && |
177 | 177 | !($values instanceof \Traversable) |
178 | 178 | ) { |
179 | - throw new InvalidArgumentException('$values is not iterable:' . \print_r($values, true)); |
|
179 | + throw new InvalidArgumentException('$values is not iterable:'.\print_r($values, true)); |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | $results = []; |
183 | - foreach ((array) $values as $key => $value) { |
|
183 | + foreach ((array)$values as $key => $value) { |
|
184 | 184 | $results[] = $this->set($key, $value, $ttl); |
185 | 185 | } |
186 | 186 |