@@ -70,9 +70,9 @@ discard block |
||
70 | 70 | throw new PhpfastcacheDriverCheckException(\sprintf(self::DRIVER_CHECK_FAILURE, $this->getDriverName())); |
71 | 71 | } |
72 | 72 | |
73 | - try{ |
|
73 | + try { |
|
74 | 74 | $this->driverConnect(); |
75 | - }catch(\Exception $e){ |
|
75 | + } catch (\Exception $e) { |
|
76 | 76 | throw new PhpfastcacheDriverConnectException(\sprintf( |
77 | 77 | self::DRIVER_CONNECT_FAILURE, |
78 | 78 | $this->getDriverName(), |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | */ |
142 | 142 | protected function decode($value) |
143 | 143 | { |
144 | - return \unserialize((string)$value); |
|
144 | + return \unserialize((string) $value); |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | /** |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | * that has slow performances |
282 | 282 | */ |
283 | 283 | |
284 | - $tagsItem->set(\array_merge((array)$data, [$item->getKey() => $expTimestamp])); |
|
284 | + $tagsItem->set(\array_merge((array) $data, [$item->getKey() => $expTimestamp])); |
|
285 | 285 | |
286 | 286 | /** |
287 | 287 | * Set the expiration date |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | $tagsItems = $this->getItems($this->getTagKeys($item->getRemovedTags())); |
304 | 304 | |
305 | 305 | foreach ($tagsItems as $tagsItem) { |
306 | - $data = (array)$tagsItem->get(); |
|
306 | + $data = (array) $tagsItem->get(); |
|
307 | 307 | |
308 | 308 | unset($data[$item->getKey()]); |
309 | 309 | $tagsItem->set($data); |
@@ -72,7 +72,7 @@ |
||
72 | 72 | |
73 | 73 | try{ |
74 | 74 | $this->driverConnect(); |
75 | - }catch(\Exception $e){ |
|
75 | + } catch(\Exception $e){ |
|
76 | 76 | throw new PhpfastcacheDriverConnectException(\sprintf( |
77 | 77 | self::DRIVER_CONNECT_FAILURE, |
78 | 78 | $this->getDriverName(), |
@@ -28,7 +28,7 @@ |
||
28 | 28 | /** |
29 | 29 | * @var int |
30 | 30 | */ |
31 | - protected $port = 8091;// SSL: 18091 |
|
31 | + protected $port = 8091; // SSL: 18091 |
|
32 | 32 | |
33 | 33 | /** |
34 | 34 | * @var string |
@@ -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 | } |
@@ -158,9 +158,9 @@ |
||
158 | 158 | $this->eventManager->dispatch('CacheItemExpireAt', $this, $expiration); |
159 | 159 | $this->expirationDate = $expiration; |
160 | 160 | } |
161 | - elseif(is_array($expiration) && key_exists("date", $expiration) |
|
161 | + elseif (is_array($expiration) && key_exists("date", $expiration) |
|
162 | 162 | && key_exists("timezone_type", $expiration) && key_exists("timezone", $expiration) |
163 | - ){ |
|
163 | + ) { |
|
164 | 164 | /** |
165 | 165 | * Hack for Zend Server and PhpfastcacheInvalidArgumentException $expiration must be an object implementing the DateTimeInterface got: array |
166 | 166 | */ |
@@ -157,16 +157,14 @@ |
||
157 | 157 | */ |
158 | 158 | $this->eventManager->dispatch('CacheItemExpireAt', $this, $expiration); |
159 | 159 | $this->expirationDate = $expiration; |
160 | - } |
|
161 | - elseif(is_array($expiration) && key_exists("date", $expiration) |
|
160 | + } elseif(is_array($expiration) && key_exists("date", $expiration) |
|
162 | 161 | && key_exists("timezone_type", $expiration) && key_exists("timezone", $expiration) |
163 | 162 | ){ |
164 | 163 | /** |
165 | 164 | * Hack for Zend Server and PhpfastcacheInvalidArgumentException $expiration must be an object implementing the DateTimeInterface got: array |
166 | 165 | */ |
167 | 166 | \DateTime::__set_state($expiration); |
168 | - } |
|
169 | - else |
|
167 | + } else |
|
170 | 168 | { |
171 | 169 | throw new PhpfastcacheInvalidArgumentException('$expiration must be an object implementing the DateTimeInterface got: ' . \gettype($expiration)); |
172 | 170 | } |