@@ -152,7 +152,7 @@ |
||
152 | 152 | } |
153 | 153 | try { |
154 | 154 | return \array_map( |
155 | - static function (ExtendedCacheItemInterface $item) { |
|
155 | + static function(ExtendedCacheItemInterface $item) { |
|
156 | 156 | return $item->get(); |
157 | 157 | }, |
158 | 158 | $this->internalCacheInstance->getItems($keys) |
@@ -99,14 +99,14 @@ |
||
99 | 99 | case T_NAMESPACE: |
100 | 100 | $namespace = ''; |
101 | 101 | // If there is a namespace, extract it (PHP 8 test) |
102 | - if(\defined('T_NAME_QUALIFIED')){ |
|
102 | + if (\defined('T_NAME_QUALIFIED')) { |
|
103 | 103 | while (isset($tokens[++$i][1])) { |
104 | 104 | if ($tokens[$i][0] === T_NAME_QUALIFIED) { |
105 | 105 | $namespace = $tokens[$i][1]; |
106 | 106 | break; |
107 | 107 | } |
108 | 108 | } |
109 | - }else{ |
|
109 | + } else { |
|
110 | 110 | while (isset($tokens[++$i][1])) { |
111 | 111 | if (\in_array($tokens[$i][0], [T_STRING, T_NS_SEPARATOR], true)) { |
112 | 112 | $namespace .= $tokens[$i][1]; |
@@ -106,7 +106,7 @@ |
||
106 | 106 | break; |
107 | 107 | } |
108 | 108 | } |
109 | - }else{ |
|
109 | + } else{ |
|
110 | 110 | while (isset($tokens[++$i][1])) { |
111 | 111 | if (\in_array($tokens[$i][0], [T_STRING, T_NS_SEPARATOR], true)) { |
112 | 112 | $namespace .= $tokens[$i][1]; |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | $config = self::validateConfig($config); |
178 | 178 | $driver = self::standardizeDriverName($driver); |
179 | 179 | |
180 | - $instanceId = $instanceId ?: md5($driver . \serialize(\array_filter($config->toArray(), static function ($val){ |
|
180 | + $instanceId = $instanceId ?: md5($driver . \serialize(\array_filter($config->toArray(), static function($val) { |
|
181 | 181 | return !\is_callable($val); |
182 | 182 | }))); |
183 | 183 | |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | $found = false; |
321 | 321 | self::$instances = \array_filter( |
322 | 322 | \array_map( |
323 | - static function (ExtendedCacheItemPoolInterface $cachePool) use ($cachePoolInstance, &$found) { |
|
323 | + static function(ExtendedCacheItemPoolInterface $cachePool) use ($cachePoolInstance, &$found) { |
|
324 | 324 | if (\spl_object_hash($cachePool) === \spl_object_hash($cachePoolInstance)) { |
325 | 325 | $found = true; |
326 | 326 | return null; |
@@ -76,9 +76,9 @@ |
||
76 | 76 | { |
77 | 77 | $file_path = $this->getFilePath($item->getKey(), true); |
78 | 78 | |
79 | - try{ |
|
79 | + try { |
|
80 | 80 | $content = $this->readFile($file_path); |
81 | - }catch (PhpfastcacheIOException $e){ |
|
81 | + } catch (PhpfastcacheIOException $e) { |
|
82 | 82 | return null; |
83 | 83 | } |
84 | 84 |
@@ -78,7 +78,7 @@ |
||
78 | 78 | |
79 | 79 | try{ |
80 | 80 | $content = $this->readFile($file_path); |
81 | - }catch (PhpfastcacheIOException $e){ |
|
81 | + } catch (PhpfastcacheIOException $e){ |
|
82 | 82 | return null; |
83 | 83 | } |
84 | 84 |
@@ -91,8 +91,7 @@ discard block |
||
91 | 91 | return unlink($source); |
92 | 92 | } |
93 | 93 | |
94 | - $files = new RecursiveIteratorIterator |
|
95 | - ( |
|
94 | + $files = new RecursiveIteratorIterator( |
|
96 | 95 | new RecursiveDirectoryIterator($source, RecursiveDirectoryIterator::SKIP_DOTS), |
97 | 96 | RecursiveIteratorIterator::CHILD_FIRST |
98 | 97 | ); |
@@ -102,7 +101,7 @@ discard block |
||
102 | 101 | * @var SplFileInfo $fileinfo |
103 | 102 | */ |
104 | 103 | $realpath = $fileinfo->getRealPath(); |
105 | - if($realpath){ |
|
104 | + if ($realpath) { |
|
106 | 105 | if ($fileinfo->isDir()) { |
107 | 106 | if (self::rrmdir($fileinfo->getRealPath()) === false) { |
108 | 107 | return false; |
@@ -111,7 +110,7 @@ discard block |
||
111 | 110 | return false; |
112 | 111 | } |
113 | 112 | } |
114 | - else{ |
|
113 | + else { |
|
115 | 114 | return false; |
116 | 115 | } |
117 | 116 | } |
@@ -148,7 +147,7 @@ discard block |
||
148 | 147 | /** |
149 | 148 | * Allows to dereference char |
150 | 149 | */ |
151 | - $__FILE__ = preg_replace('~^(([a-z0-9\-]+)://)~', '', __FILE__);// remove file protocols such as "phar://" etc. |
|
150 | + $__FILE__ = preg_replace('~^(([a-z0-9\-]+)://)~', '', __FILE__); // remove file protocols such as "phar://" etc. |
|
152 | 151 | $prefix = $__FILE__[0] === DIRECTORY_SEPARATOR ? DIRECTORY_SEPARATOR : ''; |
153 | 152 | return $prefix . implode(DIRECTORY_SEPARATOR, $absolutes); |
154 | 153 | } |
@@ -110,8 +110,7 @@ |
||
110 | 110 | } elseif (unlink($realpath) === false) { |
111 | 111 | return false; |
112 | 112 | } |
113 | - } |
|
114 | - else{ |
|
113 | + } else{ |
|
115 | 114 | return false; |
116 | 115 | } |
117 | 116 | } |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | * Register Autoload |
31 | 31 | */ |
32 | 32 | spl_autoload_register( |
33 | - static function ($entity): void { |
|
33 | + static function($entity): void { |
|
34 | 34 | $module = explode('\\', $entity, 2); |
35 | 35 | if (!\in_array($module[0], ['Phpfastcache', 'Psr'])) { |
36 | 36 | /** |
@@ -64,9 +64,9 @@ discard block |
||
64 | 64 | |
65 | 65 | $entityPath = str_replace('\\', '/', $entity); |
66 | 66 | |
67 | - if(\strpos($entity, PFC_TESTS_NS) === 0){ |
|
67 | + if (\strpos($entity, PFC_TESTS_NS) === 0) { |
|
68 | 68 | $path = PFC_TESTS_DIR . \str_replace(str_replace('\\', '/', PFC_TESTS_NS), '', $entityPath) . '.' . PFC_PHP_EXT; |
69 | - }else{ |
|
69 | + } else { |
|
70 | 70 | $path = PFC_LIB_DIR . $entityPath . '.' . PFC_PHP_EXT; |
71 | 71 | } |
72 | 72 |
@@ -66,7 +66,7 @@ |
||
66 | 66 | |
67 | 67 | if(\strpos($entity, PFC_TESTS_NS) === 0){ |
68 | 68 | $path = PFC_TESTS_DIR . \str_replace(str_replace('\\', '/', PFC_TESTS_NS), '', $entityPath) . '.' . PFC_PHP_EXT; |
69 | - }else{ |
|
69 | + } else{ |
|
70 | 70 | $path = PFC_LIB_DIR . $entityPath . '.' . PFC_PHP_EXT; |
71 | 71 | } |
72 | 72 |
@@ -122,9 +122,9 @@ discard block |
||
122 | 122 | */ |
123 | 123 | protected function createDatabase() |
124 | 124 | { |
125 | - try{ |
|
125 | + try { |
|
126 | 126 | $this->instance->getDatabaseInfo($this->getDatabaseName()); |
127 | - } catch(HTTPException $e){ |
|
127 | + } catch (HTTPException $e) { |
|
128 | 128 | $this->instance->createDatabase($this->getDatabaseName()); |
129 | 129 | } |
130 | 130 | } |
@@ -279,14 +279,14 @@ discard block |
||
279 | 279 | new \DateTimeZone($value[ExtendedCacheItemPoolInterface::DRIVER_EDATE_WRAPPER_INDEX]['timezone']) |
280 | 280 | ); |
281 | 281 | |
282 | - if(isset($value[ExtendedCacheItemPoolInterface::DRIVER_CDATE_WRAPPER_INDEX])){ |
|
282 | + if (isset($value[ExtendedCacheItemPoolInterface::DRIVER_CDATE_WRAPPER_INDEX])) { |
|
283 | 283 | $value[ExtendedCacheItemPoolInterface::DRIVER_CDATE_WRAPPER_INDEX] = new \DateTime( |
284 | 284 | $value[ExtendedCacheItemPoolInterface::DRIVER_CDATE_WRAPPER_INDEX]['date'], |
285 | 285 | new \DateTimeZone($value[ExtendedCacheItemPoolInterface::DRIVER_CDATE_WRAPPER_INDEX]['timezone']) |
286 | 286 | ); |
287 | 287 | } |
288 | 288 | |
289 | - if(isset($value[ExtendedCacheItemPoolInterface::DRIVER_MDATE_WRAPPER_INDEX])){ |
|
289 | + if (isset($value[ExtendedCacheItemPoolInterface::DRIVER_MDATE_WRAPPER_INDEX])) { |
|
290 | 290 | $value[ExtendedCacheItemPoolInterface::DRIVER_MDATE_WRAPPER_INDEX] = new \DateTime( |
291 | 291 | $value[ExtendedCacheItemPoolInterface::DRIVER_MDATE_WRAPPER_INDEX]['date'], |
292 | 292 | new \DateTimeZone($value[ExtendedCacheItemPoolInterface::DRIVER_MDATE_WRAPPER_INDEX]['timezone']) |
@@ -68,7 +68,7 @@ |
||
68 | 68 | public function setDatabase(string $database): Config |
69 | 69 | { |
70 | 70 | /** @see https://docs.couchdb.org/en/latest/api/database/common.html#put--db */ |
71 | - if(\preg_match('#^[a-z][a-z0-9_\-+\$()/]+$#', $database)){ |
|
71 | + if (\preg_match('#^[a-z][a-z0-9_\-+\$()/]+$#', $database)) { |
|
72 | 72 | $this->database = $database; |
73 | 73 | return $this; |
74 | 74 | } |
@@ -254,7 +254,7 @@ |
||
254 | 254 | protected function driverClear(): bool |
255 | 255 | { |
256 | 256 | try { |
257 | - return $this->collection->deleteMany([])->isAcknowledged(); |
|
257 | + return $this->collection->deleteMany([])->isAcknowledged(); |
|
258 | 258 | } catch (MongoDBException $e) { |
259 | 259 | throw new PhpfastcacheDriverException('Got error while trying to empty the collection: ' . $e->getMessage(), 0, $e); |
260 | 260 | } |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | ) |
98 | 98 | )->toArray()[0]; |
99 | 99 | |
100 | - $array_filter_recursive = static function ($array, callable $callback = null) use (&$array_filter_recursive) { |
|
100 | + $array_filter_recursive = static function($array, callable $callback = null) use (&$array_filter_recursive) { |
|
101 | 101 | $array = $callback($array); |
102 | 102 | |
103 | 103 | if (\is_object($array) || \is_array($array)) { |
@@ -109,12 +109,12 @@ discard block |
||
109 | 109 | return $array; |
110 | 110 | }; |
111 | 111 | |
112 | - $callback = static function ($item) { |
|
112 | + $callback = static function($item) { |
|
113 | 113 | /** |
114 | 114 | * Remove unserializable properties |
115 | 115 | */ |
116 | 116 | if ($item instanceof UTCDateTime) { |
117 | - return (string)$item; |
|
117 | + return (string) $item; |
|
118 | 118 | } |
119 | 119 | return $item; |
120 | 120 | }; |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | ) : new UTCDateTime(time() * 1000)), |
210 | 210 | ]; |
211 | 211 | } |
212 | - $result = (array)$this->getCollection()->updateOne( |
|
212 | + $result = (array) $this->getCollection()->updateOne( |
|
213 | 213 | ['_id' => $this->getMongoDbItemKey($item)], |
214 | 214 | [ |
215 | 215 | '$set' => $set, |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | if (count($servers) > 0) { |
310 | 310 | $host = array_reduce( |
311 | 311 | $servers, |
312 | - static function ($carry, $data) { |
|
312 | + static function($carry, $data) { |
|
313 | 313 | $carry .= ($carry === '' ? '' : ',') . $data['host'] . ':' . $data['port']; |
314 | 314 | return $carry; |
315 | 315 | }, |