@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | $fallback = $config->getFallback(); |
| 166 | 166 | $config->setFallback(''); |
| 167 | 167 | \trigger_error(\sprintf('The "%s" driver is unavailable at the moment, the fallback driver "%s" has been used instead.', $driver, |
| 168 | - $fallback), \E_USER_WARNING); |
|
| 168 | + $fallback), \E_USER_WARNING); |
|
| 169 | 169 | return self::getInstance($fallback, $config->getFallbackConfig()); |
| 170 | 170 | } catch (PhpfastcacheInvalidArgumentException $e) { |
| 171 | 171 | throw new PhpfastcacheInvalidConfigurationException('Invalid fallback driver configuration', 0, $e); |
@@ -283,8 +283,8 @@ discard block |
||
| 283 | 283 | public static function clearInstance(ExtendedCacheItemPoolInterface $cachePoolInstance): bool |
| 284 | 284 | { |
| 285 | 285 | $found = false; |
| 286 | - self::$instances = \array_filter(\array_map(function (ExtendedCacheItemPoolInterface $cachePool) use ($cachePoolInstance, &$found){ |
|
| 287 | - if(\spl_object_hash($cachePool) === \spl_object_hash($cachePoolInstance)){ |
|
| 286 | + self::$instances = \array_filter(\array_map(function(ExtendedCacheItemPoolInterface $cachePool) use ($cachePoolInstance, &$found){ |
|
| 287 | + if (\spl_object_hash($cachePool) === \spl_object_hash($cachePoolInstance)) { |
|
| 288 | 288 | $found = true; |
| 289 | 289 | return null; |
| 290 | 290 | } |
@@ -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 | } |
@@ -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; |