@@ -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 | } |
@@ -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 | } |
@@ -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 | } |
@@ -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 |
@@ -41,13 +41,13 @@ discard block |
||
41 | 41 | $this->serializer = new SerializerIgbinary(); |
42 | 42 | |
43 | 43 | if (!$cacheDir) { |
44 | - $cacheDir = \realpath(\sys_get_temp_dir()) . '/simple_php_cache'; |
|
44 | + $cacheDir = \realpath(\sys_get_temp_dir()).'/simple_php_cache'; |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | if (\is_callable($cacheDir)) { |
48 | - $this->cacheDir = (string) \call_user_func($cacheDir); |
|
48 | + $this->cacheDir = (string)\call_user_func($cacheDir); |
|
49 | 49 | } else { |
50 | - $this->cacheDir = (string) $cacheDir; |
|
50 | + $this->cacheDir = (string)$cacheDir; |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | if ($this->createCacheDirectory($this->cacheDir) === true) { |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | */ |
196 | 196 | protected function getFileName(string $key): string |
197 | 197 | { |
198 | - return $this->cacheDir . \DIRECTORY_SEPARATOR . self::CACHE_FILE_PREFIX . $key . self::CACHE_FILE_SUBFIX; |
|
198 | + return $this->cacheDir.\DIRECTORY_SEPARATOR.self::CACHE_FILE_PREFIX.$key.self::CACHE_FILE_SUBFIX; |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | /** |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | /** @noinspection PhpUnhandledExceptionInspection */ |
88 | 88 | $interfaces = (new \ReflectionClass($replaceAdapter))->getInterfaces(); |
89 | 89 | if (!\array_key_exists(iAdapter::class, $interfaces)) { |
90 | - throw new InvalidArgumentException('"' . $replaceAdapter . '" did not implement the "iAdapter"-interface [' . \print_r($interfaces, true) . ']'); |
|
90 | + throw new InvalidArgumentException('"'.$replaceAdapter.'" did not implement the "iAdapter"-interface ['.\print_r($interfaces, true).']'); |
|
91 | 91 | } |
92 | 92 | } |
93 | 93 | |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | /** @noinspection PhpUnhandledExceptionInspection */ |
118 | 118 | $cacheAdapterManager->addAdapter( |
119 | 119 | AdapterMemcached::class, |
120 | - static function () { |
|
120 | + static function() { |
|
121 | 121 | $memcached = null; |
122 | 122 | $isMemcachedAvailable = false; |
123 | 123 | if (\extension_loaded('memcached')) { |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | /** @noinspection PhpUnhandledExceptionInspection */ |
139 | 139 | $cacheAdapterManager->addAdapter( |
140 | 140 | AdapterMemcache::class, |
141 | - static function () { |
|
141 | + static function() { |
|
142 | 142 | $memcache = null; |
143 | 143 | $isMemcacheAvailable = false; |
144 | 144 | /** @noinspection ClassConstantCanBeUsedInspection */ |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | /** @noinspection PhpUnhandledExceptionInspection */ |
161 | 161 | $cacheAdapterManager->addAdapter( |
162 | 162 | AdapterPredis::class, |
163 | - static function () { |
|
163 | + static function() { |
|
164 | 164 | $redis = null; |
165 | 165 | $isRedisAvailable = false; |
166 | 166 | if ( |
@@ -215,8 +215,8 @@ discard block |
||
215 | 215 | /** @noinspection PhpUnhandledExceptionInspection */ |
216 | 216 | $cacheAdapterManager->addAdapter( |
217 | 217 | AdapterOpCache::class, |
218 | - static function () { |
|
219 | - return \realpath(\sys_get_temp_dir()) . '/simple_php_cache'; |
|
218 | + static function() { |
|
219 | + return \realpath(\sys_get_temp_dir()).'/simple_php_cache'; |
|
220 | 220 | } |
221 | 221 | ); |
222 | 222 |
@@ -91,8 +91,8 @@ |
||
91 | 91 | public function set(string $key, $value): bool |
92 | 92 | { |
93 | 93 | // Make sure we are under the proper limit |
94 | - if (\strlen($this->memcached->getOption(Memcached::OPT_PREFIX_KEY) . $key) > 250) { |
|
95 | - throw new InvalidArgumentException('The passed cache key is over 250 bytes:' . \print_r($key, true)); |
|
94 | + if (\strlen($this->memcached->getOption(Memcached::OPT_PREFIX_KEY).$key) > 250) { |
|
95 | + throw new InvalidArgumentException('The passed cache key is over 250 bytes:'.\print_r($key, true)); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | return $this->memcached->set($key, $value); |
@@ -617,12 +617,12 @@ |
||
617 | 617 | protected function getTheDefaultPrefix(): string |
618 | 618 | { |
619 | 619 | return ($_SERVER['SERVER_NAME'] ?? '') . '_' . |
620 | - ($_SERVER['THEME'] ?? '') . '_' . |
|
621 | - ($_SERVER['STAGE'] ?? '') . '_' . |
|
622 | - ($_SESSION['language'] ?? '') . '_' . |
|
623 | - ($_SESSION['language_extra'] ?? '') . '_' . |
|
624 | - \PHP_VERSION_ID . '_' . |
|
625 | - ($this->serializer ? $this->serializer->getName() : ''); |
|
620 | + ($_SERVER['THEME'] ?? '') . '_' . |
|
621 | + ($_SERVER['STAGE'] ?? '') . '_' . |
|
622 | + ($_SESSION['language'] ?? '') . '_' . |
|
623 | + ($_SESSION['language_extra'] ?? '') . '_' . |
|
624 | + \PHP_VERSION_ID . '_' . |
|
625 | + ($this->serializer ? $this->serializer->getName() : ''); |
|
626 | 626 | } |
627 | 627 | |
628 | 628 | /** |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | */ |
271 | 271 | protected function calculateStoreKey(string $rawKey): string |
272 | 272 | { |
273 | - $str = $this->getPrefix() . $rawKey; |
|
273 | + $str = $this->getPrefix().$rawKey; |
|
274 | 274 | |
275 | 275 | if ($this->adapter instanceof AdapterFileAbstract) { |
276 | 276 | $str = $this->cleanStoreKey($str); |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | } else { |
294 | 294 | |
295 | 295 | // for testing with dev-address |
296 | - $noDev = isset($_GET['noDev']) ? (int) $_GET['noDev'] : 0; |
|
296 | + $noDev = isset($_GET['noDev']) ? (int)$_GET['noDev'] : 0; |
|
297 | 297 | $remoteAddr = $_SERVER['REMOTE_ADDR'] ?? 'NO_REMOTE_ADDR'; |
298 | 298 | |
299 | 299 | if ( |
@@ -518,7 +518,7 @@ discard block |
||
518 | 518 | } |
519 | 519 | |
520 | 520 | // always cache the TTL time, maybe we need this later ... |
521 | - self::$STATIC_CACHE_EXPIRE[$storeKey] = ($ttl ? (int) $ttl + \time() : 0); |
|
521 | + self::$STATIC_CACHE_EXPIRE[$storeKey] = ($ttl ? (int)$ttl + \time() : 0); |
|
522 | 522 | |
523 | 523 | return $this->adapter->setExpired($storeKey, $serialized, $ttl); |
524 | 524 | } |
@@ -616,12 +616,12 @@ discard block |
||
616 | 616 | */ |
617 | 617 | protected function getTheDefaultPrefix(): string |
618 | 618 | { |
619 | - return ($_SERVER['SERVER_NAME'] ?? '') . '_' . |
|
620 | - ($_SERVER['THEME'] ?? '') . '_' . |
|
621 | - ($_SERVER['STAGE'] ?? '') . '_' . |
|
622 | - ($_SESSION['language'] ?? '') . '_' . |
|
623 | - ($_SESSION['language_extra'] ?? '') . '_' . |
|
624 | - \PHP_VERSION_ID . '_' . |
|
619 | + return ($_SERVER['SERVER_NAME'] ?? '').'_'. |
|
620 | + ($_SERVER['THEME'] ?? '').'_'. |
|
621 | + ($_SERVER['STAGE'] ?? '').'_'. |
|
622 | + ($_SESSION['language'] ?? '').'_'. |
|
623 | + ($_SESSION['language_extra'] ?? '').'_'. |
|
624 | + \PHP_VERSION_ID.'_'. |
|
625 | 625 | ($this->serializer ? $this->serializer->getName() : ''); |
626 | 626 | } |
627 | 627 | |
@@ -666,7 +666,7 @@ discard block |
||
666 | 666 | |
667 | 667 | // test the cache, with this GET-parameter |
668 | 668 | if ($this->disableCacheGetParameter) { |
669 | - $testCache = isset($_GET[$this->disableCacheGetParameter]) ? (int) $_GET[$this->disableCacheGetParameter] : 0; |
|
669 | + $testCache = isset($_GET[$this->disableCacheGetParameter]) ? (int)$_GET[$this->disableCacheGetParameter] : 0; |
|
670 | 670 | } else { |
671 | 671 | $testCache = 0; |
672 | 672 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | */ |
75 | 75 | protected function getFileName(string $key): string |
76 | 76 | { |
77 | - return $this->cacheDir . \DIRECTORY_SEPARATOR . self::CACHE_FILE_PREFIX . $key . '.php'; |
|
77 | + return $this->cacheDir.\DIRECTORY_SEPARATOR.self::CACHE_FILE_PREFIX.$key.'.php'; |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | /** |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | ]; |
89 | 89 | $content = \var_export($item, true); |
90 | 90 | |
91 | - $content = '<?php return ' . $content . ';'; |
|
91 | + $content = '<?php return '.$content.';'; |
|
92 | 92 | |
93 | 93 | $cacheFile = $this->getFileName($key); |
94 | 94 |