@@ -108,16 +108,16 @@ |
||
108 | 108 | public function setServers(array $servers): self |
109 | 109 | { |
110 | 110 | foreach ($servers as $server) { |
111 | - if($diff = \array_diff(['host', 'port', 'saslUser', 'saslPassword'], \array_keys($server))){ |
|
112 | - throw new PhpfastcacheInvalidConfigurationException('Missing keys for memcached server: '. \implode(', ', $diff)); |
|
111 | + if ($diff = \array_diff(['host', 'port', 'saslUser', 'saslPassword'], \array_keys($server))) { |
|
112 | + throw new PhpfastcacheInvalidConfigurationException('Missing keys for memcached server: ' . \implode(', ', $diff)); |
|
113 | 113 | } |
114 | - if($diff = \array_diff( \array_keys($server), ['host', 'port', 'saslUser', 'saslPassword'])){ |
|
115 | - throw new PhpfastcacheInvalidConfigurationException('Unknown keys for memcached server: '. \implode(', ', $diff)); |
|
114 | + if ($diff = \array_diff(\array_keys($server), ['host', 'port', 'saslUser', 'saslPassword'])) { |
|
115 | + throw new PhpfastcacheInvalidConfigurationException('Unknown keys for memcached server: ' . \implode(', ', $diff)); |
|
116 | 116 | } |
117 | - if(!\is_string($server['host'])){ |
|
117 | + if (!\is_string($server['host'])) { |
|
118 | 118 | throw new PhpfastcacheInvalidConfigurationException('Host must be a valid string in "$server" configuration array'); |
119 | 119 | } |
120 | - if(!\is_int($server['port'])){ |
|
120 | + if (!\is_int($server['port'])) { |
|
121 | 121 | throw new PhpfastcacheInvalidConfigurationException('Port must be a valid integer in "$server" configuration array'); |
122 | 122 | } |
123 | 123 | } |
@@ -136,7 +136,7 @@ |
||
136 | 136 | $keys = \iterator_to_array($keys); |
137 | 137 | } |
138 | 138 | try { |
139 | - return array_map(function (ExtendedCacheItemInterface $item) { |
|
139 | + return array_map(function(ExtendedCacheItemInterface $item) { |
|
140 | 140 | return $item->get(); |
141 | 141 | }, $this->internalCacheInstance->getItems($keys)); |
142 | 142 | } catch (PhpfastcacheInvalidArgumentException $e) { |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | ->getTimestamp()) * 1000) : new UTCDateTime(\time() * 1000)), |
125 | 125 | ]; |
126 | 126 | } |
127 | - $result = (array)$this->getCollection()->updateOne( |
|
127 | + $result = (array) $this->getCollection()->updateOne( |
|
128 | 128 | ['_id' => $item->getEncodedKey()], |
129 | 129 | [ |
130 | 130 | '$set' => $set, |
@@ -234,9 +234,9 @@ discard block |
||
234 | 234 | $username = $this->getConfig()->getUsername(); |
235 | 235 | $password = $this->getConfig()->getPassword(); |
236 | 236 | |
237 | - if( \count($servers) > 0 ){ |
|
238 | - $host = \array_reduce($servers, static function($carry, $data){ |
|
239 | - $carry .= ($carry === '' ? '' : ',').$data['host'].':'.$data['port']; |
|
237 | + if (\count($servers) > 0) { |
|
238 | + $host = \array_reduce($servers, static function($carry, $data) { |
|
239 | + $carry .= ($carry === '' ? '' : ',') . $data['host'] . ':' . $data['port']; |
|
240 | 240 | return $carry; |
241 | 241 | }, ''); |
242 | 242 | $port = false; |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | $host, |
251 | 251 | $port !== 27017 && $port !== false ? ":{$port}" : '', |
252 | 252 | $databaseName ? "/{$databaseName}" : '', |
253 | - \count($options) > 0 ? '?'.\http_build_query($options) : '', |
|
253 | + \count($options) > 0 ? '?' . \http_build_query($options) : '', |
|
254 | 254 | ]); |
255 | 255 | } |
256 | 256 | |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | 'verbose' => true, |
286 | 286 | ]))->toArray()[0]; |
287 | 287 | |
288 | - $array_filter_recursive = function ($array, callable $callback = null) use (&$array_filter_recursive) { |
|
288 | + $array_filter_recursive = function($array, callable $callback = null) use (&$array_filter_recursive) { |
|
289 | 289 | $array = $callback($array); |
290 | 290 | |
291 | 291 | if (\is_object($array) || \is_array($array)) { |
@@ -297,12 +297,12 @@ discard block |
||
297 | 297 | return $array; |
298 | 298 | }; |
299 | 299 | |
300 | - $callback = function ($item) { |
|
300 | + $callback = function($item) { |
|
301 | 301 | /** |
302 | 302 | * Remove unserializable properties |
303 | 303 | */ |
304 | 304 | if ($item instanceof \MongoDB\BSON\UTCDateTime) { |
305 | - return (string)$item; |
|
305 | + return (string) $item; |
|
306 | 306 | } |
307 | 307 | return $item; |
308 | 308 | }; |
@@ -241,7 +241,7 @@ |
||
241 | 241 | */ |
242 | 242 | public function setScheme(string $scheme): Config |
243 | 243 | { |
244 | - if(!\in_array($scheme, ['unix', 'tls'], true)){ |
|
244 | + if (!\in_array($scheme, ['unix', 'tls'], true)) { |
|
245 | 245 | throw new PhpfastcacheInvalidConfigurationException('Invalid scheme: ' . $scheme); |
246 | 246 | } |
247 | 247 | $this->scheme = $scheme; |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | public function __construct() |
42 | 42 | { |
43 | 43 | @\trigger_error(\sprintf('Class "%s" is deprecated and will be removed in the next major release (8.x).', static::class), \E_USER_DEPRECATED); |
44 | - $this->instances =& CacheManager::getInternalInstances(); |
|
44 | + $this->instances = & CacheManager::getInternalInstances(); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | /** |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | */ |
50 | 50 | protected function getGenericCallback(): \Closure |
51 | 51 | { |
52 | - return function ($method, $args) { |
|
52 | + return function($method, $args) { |
|
53 | 53 | $return = []; |
54 | 54 | foreach ($this->instances as $instance) { |
55 | 55 | $reflectionMethod = new \ReflectionMethod(\get_class($instance), $method); |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | public function __construct(...$args) |
104 | 104 | { |
105 | 105 | parent::__construct(...$args); |
106 | - $array =& $this->getArray(); |
|
106 | + $array = & $this->getArray(); |
|
107 | 107 | |
108 | 108 | /** |
109 | 109 | * Detect unwanted keys and throw an exception. |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | $reflectionMethod = new \ReflectionMethod($this, $method); |
144 | 144 | $parameter = $reflectionMethod->getParameters()[0] ?? null; |
145 | 145 | $paraReflectionType = $parameter->getType(); |
146 | - if(method_exists($paraReflectionType, "getName")) { |
|
146 | + if (method_exists($paraReflectionType, "getName")) { |
|
147 | 147 | $typeHintExpected = ($parameter instanceof \ReflectionParameter ? ($paraReflectionType->getName() === 'object' ? $parameter->getClass() : $paraReflectionType->getName()) : 'Unknown type'); |
148 | 148 | throw new PhpfastcacheInvalidConfigurationException(\sprintf( |
149 | 149 | 'Invalid type hint found for "%s", expected "%s" got "%s"', |