Passed
Pull Request — master (#832)
by Georges
02:47
created
lib/Phpfastcache/Drivers/Files/Driver.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -76,9 +76,9 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
lib/Phpfastcache/Util/Directory.php 2 patches
Spacing   +4 added lines, -5 removed lines patch added patch discarded remove patch
@@ -91,8 +91,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -110,8 +110,7 @@
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
lib/Phpfastcache/Autoload/Autoload.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
lib/Phpfastcache/Drivers/Couchdb/Driver.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -122,9 +122,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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'])
Please login to merge, or discard this patch.
lib/Phpfastcache/Drivers/Couchdb/Config.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
lib/Phpfastcache/Drivers/Mongodb/Driver.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -254,7 +254,7 @@
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
             )
96 96
         )->toArray()[0];
97 97
 
98
-        $array_filter_recursive = static function ($array, callable $callback = null) use (&$array_filter_recursive) {
98
+        $array_filter_recursive = static function($array, callable $callback = null) use (&$array_filter_recursive) {
99 99
             $array = $callback($array);
100 100
 
101 101
             if (\is_object($array) || \is_array($array)) {
@@ -107,12 +107,12 @@  discard block
 block discarded – undo
107 107
             return $array;
108 108
         };
109 109
 
110
-        $callback = static function ($item) {
110
+        $callback = static function($item) {
111 111
             /**
112 112
              * Remove unserializable properties
113 113
              */
114 114
             if ($item instanceof UTCDateTime) {
115
-                return (string)$item;
115
+                return (string) $item;
116 116
             }
117 117
             return $item;
118 118
         };
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
                         self::DRIVER_CDATE_WRAPPER_INDEX =>  new UTCDateTime($item->getCreationDate()),
202 202
                     ];
203 203
                 }
204
-                $result = (array)$this->getCollection()->updateOne(
204
+                $result = (array) $this->getCollection()->updateOne(
205 205
                     ['_id' => $this->getMongoDbItemKey($item)],
206 206
                     [
207 207
                         '$set' => $set,
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
             $this->database->selectCollection($collectionName)
282 282
                 ->createIndex(
283 283
                     [self::DRIVER_EDATE_WRAPPER_INDEX => 1],
284
-                    ['expireAfterSeconds' => 0,  'name' => 'auto_expire_index']
284
+                    ['expireAfterSeconds' => 0, 'name' => 'auto_expire_index']
285 285
                 );
286 286
         }
287 287
 
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
         if (count($servers) > 0) {
312 312
             $host = array_reduce(
313 313
                 $servers,
314
-                static function ($carry, $data) {
314
+                static function($carry, $data) {
315 315
                     $carry .= ($carry === '' ? '' : ',') . $data['host'] . ':' . $data['port'];
316 316
                     return $carry;
317 317
                 },
Please login to merge, or discard this patch.
lib/Phpfastcache/Drivers/Couchbase/Driver.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
          */
155 155
         if ($item instanceof Item) {
156 156
             try {
157
-                return (bool)$this->getBucket()->upsert(
157
+                return (bool) $this->getBucket()->upsert(
158 158
                     $item->getEncodedKey(),
159 159
                     $this->encodeDocument($this->driverPreWrap($item)),
160 160
                     ['expiry' => $item->getTtl()]
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
          */
180 180
         if ($item instanceof Item) {
181 181
             try {
182
-                return (bool)$this->getBucket()->remove($item->getEncodedKey());
182
+                return (bool) $this->getBucket()->remove($item->getEncodedKey());
183 183
             } catch (Exception $e) {
184 184
                 return $e->getCode() === COUCHBASE_KEY_ENOENT;
185 185
             }
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
         $data[ExtendedCacheItemPoolInterface::DRIVER_DATA_WRAPPER_INDEX] = $this->encode($data[ExtendedCacheItemPoolInterface::DRIVER_DATA_WRAPPER_INDEX]);
198 198
         $data[ExtendedCacheItemPoolInterface::DRIVER_EDATE_WRAPPER_INDEX] = $data[ExtendedCacheItemPoolInterface::DRIVER_EDATE_WRAPPER_INDEX]->format(\DateTime::ATOM);
199 199
 
200
-        if($this->getConfig()->isItemDetailedDate()){
200
+        if ($this->getConfig()->isItemDetailedDate()) {
201 201
             $data[ExtendedCacheItemPoolInterface::DRIVER_CDATE_WRAPPER_INDEX] = $data[ExtendedCacheItemPoolInterface::DRIVER_CDATE_WRAPPER_INDEX]->format(\DateTime::ATOM);
202 202
             $data[ExtendedCacheItemPoolInterface::DRIVER_MDATE_WRAPPER_INDEX] = $data[ExtendedCacheItemPoolInterface::DRIVER_MDATE_WRAPPER_INDEX]->format(\DateTime::ATOM);
203 203
         }
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
             $data[ExtendedCacheItemPoolInterface::DRIVER_EDATE_WRAPPER_INDEX]
218 218
         );
219 219
 
220
-        if($this->getConfig()->isItemDetailedDate()){
220
+        if ($this->getConfig()->isItemDetailedDate()) {
221 221
             $data[ExtendedCacheItemPoolInterface::DRIVER_CDATE_WRAPPER_INDEX] = \DateTime::createFromFormat(
222 222
                 \DateTime::ATOM,
223 223
                 $data[ExtendedCacheItemPoolInterface::DRIVER_CDATE_WRAPPER_INDEX]
Please login to merge, or discard this patch.
lib/Phpfastcache/Core/Pool/TaggableCacheItemPoolTrait.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
      */
35 35
     public function getItemsByTagsAsJsonString(array $tagNames, int $option = 0, int $depth = 512, int $strategy = TaggableCacheItemPoolInterface::TAG_STRATEGY_ONE): string
36 36
     {
37
-        $callback = static function (CacheItemInterface $item) {
37
+        $callback = static function(CacheItemInterface $item) {
38 38
             return $item->get();
39 39
         };
40 40
 
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
         if (\is_string($tagName)) {
88 88
             $driverResponse = $this->getItem($this->getTagKey($tagName));
89 89
             if ($driverResponse->isHit()) {
90
-                $tagsItems = (array)$driverResponse->get();
90
+                $tagsItems = (array) $driverResponse->get();
91 91
 
92 92
                 /**
93 93
                  * getItems() may provides expired item(s)
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
                  */
102 102
                 return \array_filter(
103 103
                     $this->getItems(\array_unique(\array_keys($tagsItems))),
104
-                    static function (ExtendedCacheItemInterface $item) {
104
+                    static function(ExtendedCacheItemInterface $item) {
105 105
                         return $item->isHit();
106 106
                     }
107 107
                 );
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
             }
136 136
         }
137 137
 
138
-        return (bool)$return;
138
+        return (bool) $return;
139 139
     }
140 140
 
141 141
     /**
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
                 }
153 153
             }
154 154
 
155
-            return (bool)$return;
155
+            return (bool) $return;
156 156
         }
157 157
 
158 158
         throw new PhpfastcacheInvalidArgumentException('$tagName must be a string');
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
             }
188 188
         }
189 189
 
190
-        return (bool)$return;
190
+        return (bool) $return;
191 191
     }
192 192
 
193 193
     /**
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
                 $this->saveDeferred($item);
202 202
             }
203 203
 
204
-            return (bool)$this->commit();
204
+            return (bool) $this->commit();
205 205
         }
206 206
 
207 207
         throw new PhpfastcacheInvalidArgumentException('$tagName must be a string and $step an integer');
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
             }
221 221
         }
222 222
 
223
-        return (bool)$return;
223
+        return (bool) $return;
224 224
     }
225 225
 
226 226
     /**
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
                 $this->saveDeferred($item);
235 235
             }
236 236
 
237
-            return (bool)$this->commit();
237
+            return (bool) $this->commit();
238 238
         }
239 239
 
240 240
         throw new PhpfastcacheInvalidArgumentException('$tagName must be a string and $step an integer');
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
             }
254 254
         }
255 255
 
256
-        return (bool)$return;
256
+        return (bool) $return;
257 257
     }
258 258
 
259 259
     /**
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
                 $this->saveDeferred($item);
268 268
             }
269 269
 
270
-            return (bool)$this->commit();
270
+            return (bool) $this->commit();
271 271
         }
272 272
 
273 273
         throw new PhpfastcacheInvalidArgumentException('$tagName must be a string');
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
             }
287 287
         }
288 288
 
289
-        return (bool)$return;
289
+        return (bool) $return;
290 290
     }
291 291
 
292 292
     /**
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
                 $this->saveDeferred($item);
301 301
             }
302 302
 
303
-            return (bool)$this->commit();
303
+            return (bool) $this->commit();
304 304
         }
305 305
 
306 306
         throw new PhpfastcacheInvalidArgumentException('$tagName must be a string');
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
              * that has slow performances
362 362
              */
363 363
 
364
-            $tagsItem->set(\array_merge((array)$data, [$item->getKey() => $expTimestamp]))
364
+            $tagsItem->set(\array_merge((array) $data, [$item->getKey() => $expTimestamp]))
365 365
                 ->expiresAt($item->getExpirationDate());
366 366
 
367 367
             $this->driverWrite($tagsItem);
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
         $tagsItems = $this->getItems($this->getTagKeys($item->getRemovedTags()));
376 376
 
377 377
         foreach ($tagsItems as $tagsItem) {
378
-            $data = (array)$tagsItem->get();
378
+            $data = (array) $tagsItem->get();
379 379
 
380 380
             unset($data[$item->getKey()]);
381 381
             $tagsItem->set($data);
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
     protected function getTagKeys(array $keys): array
407 407
     {
408 408
         return \array_map(
409
-            function (string $key) {
409
+            function(string $key) {
410 410
                 return $this->getTagKey($key);
411 411
             },
412 412
             $keys
Please login to merge, or discard this patch.
lib/Phpfastcache/Drivers/Couchbasev3/Driver.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
             /**
82 82
              * CouchbaseBucket::get() returns a GetResult interface
83 83
              */
84
-            return $this->decodeDocument((array)$this->getCollection()->get($item->getEncodedKey())->content());
84
+            return $this->decodeDocument((array) $this->getCollection()->get($item->getEncodedKey())->content());
85 85
         } catch (DocumentNotFoundException $e) {
86 86
             return null;
87 87
         }
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
             ->setSize(0)
162 162
             ->setRawData($info)
163 163
             ->setData(implode(', ', array_keys($this->itemInstances)))
164
-            ->setInfo( $info['sdk'] . "\n For more information see RawData.");
164
+            ->setInfo($info['sdk'] . "\n For more information see RawData.");
165 165
     }
166 166
 
167 167
     /**
Please login to merge, or discard this patch.