Passed
Pull Request — master (#821)
by Georges
02:16
created
lib/Phpfastcache/CacheManager.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
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/Drivers/Couchbasev3/Driver.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
             /**
85 85
              * CouchbaseBucket::get() returns a GetResult interface
86 86
              */
87
-            return $this->decodeDocument((array)$this->getCollection()->get($item->getEncodedKey())->content());
87
+            return $this->decodeDocument((array) $this->getCollection()->get($item->getEncodedKey())->content());
88 88
         } catch (DocumentNotFoundException $e) {
89 89
             return null;
90 90
         }
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
          */
103 103
         if ($item instanceof Item) {
104 104
             try {
105
-                return (bool)$this->getCollection()->upsert(
105
+                return (bool) $this->getCollection()->upsert(
106 106
                     $item->getEncodedKey(),
107 107
                     $this->encodeDocument($this->driverPreWrap($item)),
108 108
                     (new UpsertOptions())->expiry($item->getTtl())
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
             ->setSize(0)
164 164
             ->setRawData($info)
165 165
             ->setData(implode(', ', array_keys($this->itemInstances)))
166
-            ->setInfo( $info['sdk'] . "\n For more information see RawData.");
166
+            ->setInfo($info['sdk'] . "\n For more information see RawData.");
167 167
     }
168 168
 
169 169
     /**
Please login to merge, or discard this patch.