Test Setup Failed
Branch v7 (4665c0)
by Georges
04:27 queued 02:14
created
lib/Phpfastcache/CacheManager.php 4 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
     }
171 171
 
172 172
     /**
173
-     * @return array
173
+     * @return string[]
174 174
      */
175 175
     public static function getStaticSystemDrivers()
176 176
     {
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
     }
195 195
 
196 196
     /**
197
-     * @return array
197
+     * @return string[]
198 198
      */
199 199
     public static function getStaticAllDrivers()
200 200
     {
Please login to merge, or discard this patch.
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 use Phpfastcache\Config\ConfigurationOption;
19 19
 use Phpfastcache\Core\Pool\ExtendedCacheItemPoolInterface;
20 20
 use Phpfastcache\Exceptions\{
21
-  phpFastCacheDeprecatedException, phpFastCacheDriverCheckException, phpFastCacheDriverNotFoundException, phpFastCacheInstanceNotFoundException, phpFastCacheInvalidArgumentException, phpFastCacheInvalidConfigurationException
21
+    phpFastCacheDeprecatedException, phpFastCacheDriverCheckException, phpFastCacheDriverNotFoundException, phpFastCacheInstanceNotFoundException, phpFastCacheInvalidArgumentException, phpFastCacheInvalidConfigurationException
22 22
 };
23 23
 
24 24
 /**
@@ -99,8 +99,8 @@  discard block
 block discarded – undo
99 99
         if (is_array($config)) {
100 100
             $config = new ConfigurationOption($config);
101 101
             trigger_error(
102
-              'The CacheManager will drops the support of primitive configuration arrays, use a "\Phpfastcache\Config\ConfigurationOption" object instead',
103
-              E_USER_DEPRECATED
102
+                'The CacheManager will drops the support of primitive configuration arrays, use a "\Phpfastcache\Config\ConfigurationOption" object instead',
103
+                E_USER_DEPRECATED
104 104
             );
105 105
         }elseif ($config === null){
106 106
             $config = self::getDefaultConfig();
@@ -291,27 +291,27 @@  discard block
 block discarded – undo
291 291
          * @todo Reflection reader
292 292
          */
293 293
         return [
294
-          'Apc',
295
-          'Apcu',
296
-          'Cassandra',
297
-          'Couchbase',
298
-          'Couchdb',
299
-          'Devnull',
300
-          'Files',
301
-          'Leveldb',
302
-          'Memcache',
303
-          'Memcached',
304
-          'Memstatic',
305
-          'Mongodb',
306
-          'Predis',
307
-          'Redis',
308
-          'Riak',
309
-          'Ssdb',
310
-          'Sqlite',
311
-          'Wincache',
312
-          'Xcache',
313
-          'Zenddisk',
314
-          'Zendshm',
294
+            'Apc',
295
+            'Apcu',
296
+            'Cassandra',
297
+            'Couchbase',
298
+            'Couchdb',
299
+            'Devnull',
300
+            'Files',
301
+            'Leveldb',
302
+            'Memcache',
303
+            'Memcached',
304
+            'Memstatic',
305
+            'Mongodb',
306
+            'Predis',
307
+            'Redis',
308
+            'Riak',
309
+            'Ssdb',
310
+            'Sqlite',
311
+            'Wincache',
312
+            'Xcache',
313
+            'Zenddisk',
314
+            'Zendshm',
315 315
         ];
316 316
     }
317 317
 
@@ -324,9 +324,9 @@  discard block
 block discarded – undo
324 324
          * @todo Reflection reader
325 325
          */
326 326
         return \array_merge(self::getStaticSystemDrivers(), [
327
-          'Devtrue',
328
-          'Devfalse',
329
-          'Cookie',
327
+            'Devtrue',
328
+            'Devfalse',
329
+            'Cookie',
330 330
         ]);
331 331
     }
332 332
 
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  * @author Georges.L (Geolim4)  <[email protected]>
12 12
  *
13 13
  */
14
-declare(strict_types=1);
14
+declare(strict_types = 1);
15 15
 
16 16
 namespace Phpfastcache;
17 17
 
@@ -102,9 +102,9 @@  discard block
 block discarded – undo
102 102
               'The CacheManager will drops the support of primitive configuration arrays, use a "\Phpfastcache\Config\ConfigurationOption" object instead',
103 103
               E_USER_DEPRECATED
104 104
             );
105
-        }elseif ($config === null){
105
+        }elseif ($config === null) {
106 106
             $config = self::getDefaultConfig();
107
-        }else if(!($config instanceof ConfigurationOption)){
107
+        } else if (!($config instanceof ConfigurationOption)) {
108 108
             throw new phpFastCacheInvalidArgumentException(sprintf('Unsupported config type: %s', gettype($config)));
109 109
         }
110 110
 
@@ -116,14 +116,14 @@  discard block
 block discarded – undo
116 116
 
117 117
         $instance = $instanceId ?: md5($driver . \serialize($config->toArray()));
118 118
 
119
-        if (!isset(self::$instances[ $instance ])) {
120
-            $badPracticeOmeter[ $driver ] = 1;
119
+        if (!isset(self::$instances[$instance])) {
120
+            $badPracticeOmeter[$driver] = 1;
121 121
             $driverClass = self::getNamespacePath() . $driver . '\Driver';
122 122
             try {
123 123
                 if (\class_exists($driverClass)) {
124 124
                     $configClass = $driverClass::getConfigClass();
125
-                    self::$instances[ $instance ] = new $driverClass(new $configClass($config->toArray()), $instance);
126
-                    self::$instances[ $instance ]->setEventManager(EventManager::getInstance());
125
+                    self::$instances[$instance] = new $driverClass(new $configClass($config->toArray()), $instance);
126
+                    self::$instances[$instance]->setEventManager(EventManager::getInstance());
127 127
                 } else {
128 128
                     throw new phpFastCacheDriverNotFoundException(sprintf('The driver "%s" does not exists', $driver));
129 129
                 }
@@ -142,14 +142,14 @@  discard block
 block discarded – undo
142 142
                     throw new phpFastCacheDriverCheckException($e->getMessage(), $e->getCode(), $e);
143 143
                 }
144 144
             }
145
-        } else if ($badPracticeOmeter[ $driver ] >= 2) {
145
+        } else if ($badPracticeOmeter[$driver] >= 2) {
146 146
             trigger_error('[' . $driver . '] Calling many times CacheManager::getInstance() for already instanced drivers is a bad practice and have a significant impact on performances.
147 147
            See https://github.com/PHPSocialNetwork/phpfastcache/wiki/[V5]-Why-calling-getInstance%28%29-each-time-is-a-bad-practice-%3F');
148 148
         }
149 149
 
150
-        $badPracticeOmeter[ $driver ]++;
150
+        $badPracticeOmeter[$driver]++;
151 151
 
152
-        return self::$instances[ $instance ];
152
+        return self::$instances[$instance];
153 153
     }
154 154
 
155 155
     /**
@@ -166,8 +166,8 @@  discard block
 block discarded – undo
166 166
             throw new phpFastCacheInvalidArgumentException('The Instance ID must be a string');
167 167
         }
168 168
 
169
-        if (isset(self::$instances[ $instanceId ])) {
170
-            return self::$instances[ $instanceId ];
169
+        if (isset(self::$instances[$instanceId])) {
170
+            return self::$instances[$instanceId];
171 171
         }
172 172
 
173 173
         throw new phpFastCacheInstanceNotFoundException(sprintf('Instance ID %s not found', $instanceId));
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
      */
235 235
     public static function __callStatic($name, $arguments)
236 236
     {
237
-        $options = (\array_key_exists(0, $arguments) && \is_array($arguments) ? $arguments[ 0 ] : []);
237
+        $options = (\array_key_exists(0, $arguments) && \is_array($arguments) ? $arguments[0] : []);
238 238
 
239 239
         return self::getInstance($name, $options);
240 240
     }
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -102,9 +102,9 @@
 block discarded – undo
102 102
               'The CacheManager will drops the support of primitive configuration arrays, use a "\Phpfastcache\Config\ConfigurationOption" object instead',
103 103
               E_USER_DEPRECATED
104 104
             );
105
-        }elseif ($config === null){
105
+        } elseif ($config === null){
106 106
             $config = self::getDefaultConfig();
107
-        }else if(!($config instanceof ConfigurationOption)){
107
+        } else if(!($config instanceof ConfigurationOption)){
108 108
             throw new phpFastCacheInvalidArgumentException(sprintf('Unsupported config type: %s', gettype($config)));
109 109
         }
110 110
 
Please login to merge, or discard this patch.
lib/Phpfastcache/Config/ConfigurationOption.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -149,7 +149,7 @@
 block discarded – undo
149 149
 
150 150
     /**
151 151
      * @param string $optionName
152
-     * @return mixed|null
152
+     * @return boolean
153 153
      */
154 154
     public function isValidOption(string $optionName)
155 155
     {
Please login to merge, or discard this patch.
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -94,9 +94,9 @@  discard block
 block discarded – undo
94 94
          */
95 95
         if(array_diff_key($array, get_object_vars($this))){
96 96
             throw new phpFastCacheInvalidConfigurationException(sprintf(
97
-              'Invalid option(s) for the config %s: %s',
98
-              static::class,
99
-              implode(', ',  array_keys(array_diff_key($array, get_object_vars($this))))
97
+                'Invalid option(s) for the config %s: %s',
98
+                static::class,
99
+                implode(', ',  array_keys(array_diff_key($array, get_object_vars($this))))
100 100
             ));
101 101
         }
102 102
 
@@ -128,10 +128,10 @@  discard block
 block discarded – undo
128 128
                     $typeHintExpected = ($parameter instanceof \ReflectionParameter ? ($parameter->getType() === 'object' ? $parameter->getClass() : $parameter->getType()) : 'Unknown type');
129 129
 
130 130
                     throw new phpFastCacheInvalidConfigurationException(sprintf(
131
-                      'Invalid type hint found for "%s", expected "%s" got "%s"',
132
-                      lcfirst(substr($method, 3)),
133
-                      $typeHintExpected,
134
-                      $typeHintGot
131
+                        'Invalid type hint found for "%s", expected "%s" got "%s"',
132
+                        lcfirst(substr($method, 3)),
133
+                        $typeHintExpected,
134
+                        $typeHintGot
135 135
                     ));
136 136
                 }
137 137
             }
@@ -396,10 +396,10 @@  discard block
 block discarded – undo
396 396
          * by opening a pull request :)
397 397
          */
398 398
         static $safeFileExtensions = [
399
-          'txt',
400
-          'cache',
401
-          'db',
402
-          'pfc',
399
+            'txt',
400
+            'cache',
401
+            'db',
402
+            'pfc',
403 403
         ];
404 404
 
405 405
         if (\strpos($cacheFileExtension, '.') !== false) {
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
         }
408 408
         if (!\in_array($cacheFileExtension, $safeFileExtensions, true)) {
409 409
             throw new phpFastCacheInvalidConfigurationException(
410
-              "{$cacheFileExtension} is not a safe extension, currently allowed extension: " . \implode(', ', $safeFileExtensions)
410
+                "{$cacheFileExtension} is not a safe extension, currently allowed extension: " . \implode(', ', $safeFileExtensions)
411 411
             );
412 412
         }
413 413
 
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -86,33 +86,33 @@  discard block
 block discarded – undo
86 86
     public function __construct(...$args)
87 87
     {
88 88
         parent::__construct(...$args);
89
-        $array =& $this->getArray();
89
+        $array = & $this->getArray();
90 90
 
91 91
         /**
92 92
          * Detect unwanted keys and throw an exception.
93 93
          * No more kidding now, it's 21th century.
94 94
          */
95
-        if(array_diff_key($array, get_object_vars($this))){
95
+        if (array_diff_key($array, get_object_vars($this))) {
96 96
             throw new phpFastCacheInvalidConfigurationException(sprintf(
97 97
               'Invalid option(s) for the config %s: %s',
98 98
               static::class,
99
-              implode(', ',  array_keys(array_diff_key($array, get_object_vars($this))))
99
+              implode(', ', array_keys(array_diff_key($array, get_object_vars($this))))
100 100
             ));
101 101
         }
102 102
 
103 103
         foreach (get_object_vars($this) as $property => $value) {
104 104
 
105
-            if(array_key_exists($property, $array)){
106
-                $this->$property = &$array[ $property ];
107
-            }else{
108
-                $array[ $property ] = &$this->$property;
105
+            if (array_key_exists($property, $array)) {
106
+                $this->$property = &$array[$property];
107
+            } else {
108
+                $array[$property] = &$this->$property;
109 109
             }
110 110
         }
111 111
 
112 112
         foreach (get_class_methods($this) as $method) {
113
-            if(strpos($method, 'set') === 0){
113
+            if (strpos($method, 'set') === 0) {
114 114
                 $value = null;
115
-                try{
115
+                try {
116 116
                     /**
117 117
                      * We use property instead of getter
118 118
                      * because of is/get conditions and
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
                      */
122 122
                     $value = $this->{lcfirst(substr($method, 3))};
123 123
                     $this->{$method}($value);
124
-                }catch(\TypeError $e){
124
+                } catch (\TypeError $e) {
125 125
                     $typeHintGot = \is_object($value) ? \get_class($value) : \gettype($value);
126 126
                     $reflectionMethod = new \ReflectionMethod($this, $method);
127 127
                     $parameter = $reflectionMethod->getParameters()[0] ?? null;
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 
105 105
             if(array_key_exists($property, $array)){
106 106
                 $this->$property = &$array[ $property ];
107
-            }else{
107
+            } else{
108 108
                 $array[ $property ] = &$this->$property;
109 109
             }
110 110
         }
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
                      */
122 122
                     $value = $this->{lcfirst(substr($method, 3))};
123 123
                     $this->{$method}($value);
124
-                }catch(\TypeError $e){
124
+                } catch(\TypeError $e){
125 125
                     $typeHintGot = \is_object($value) ? \get_class($value) : \gettype($value);
126 126
                     $reflectionMethod = new \ReflectionMethod($this, $method);
127 127
                     $parameter = $reflectionMethod->getParameters()[0] ?? null;
Please login to merge, or discard this patch.
lib/Phpfastcache/Core/Pool/CacheItemPoolTrait.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 
238 238
     /**
239 239
      * @param \Psr\Cache\CacheItemInterface $item
240
-     * @return mixed
240
+     * @return boolean
241 241
      * @throws phpFastCacheInvalidArgumentException
242 242
      * @throws \RuntimeException
243 243
      */
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
     }
295 295
 
296 296
     /**
297
-     * @return mixed|null
297
+     * @return boolean
298 298
      * @throws phpFastCacheInvalidArgumentException
299 299
      */
300 300
     public function commit()
Please login to merge, or discard this patch.
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 use Phpfastcache\Entities\ItemBatch;
22 22
 use Phpfastcache\Util\ClassNamespaceResolverTrait;
23 23
 use Phpfastcache\Exceptions\{
24
-  phpFastCacheInvalidArgumentException, phpFastCacheCoreException, phpFastCacheLogicException
24
+    phpFastCacheInvalidArgumentException, phpFastCacheCoreException, phpFastCacheLogicException
25 25
 };
26 26
 use Phpfastcache\Config\ConfigurationOption;
27 27
 use Psr\Cache\CacheItemInterface;
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
                     if ($driverArray) {
92 92
                         if (!\is_array($driverArray)) {
93 93
                             throw new phpFastCacheCoreException(sprintf('The driverRead method returned an unexpected variable type: %s',
94
-                              \gettype($driverArray)));
94
+                                \gettype($driverArray)));
95 95
                         }
96 96
                         $driverData = $this->driverUnwrapData($driverArray);
97 97
 
@@ -156,9 +156,9 @@  discard block
 block discarded – undo
156 156
                              * Reset the Item
157 157
                              */
158 158
                             $item->set(null)
159
-                              ->expiresAfter(abs((int)$this->getConfig()[ 'defaultTtl' ]))
160
-                              ->setHit(false)
161
-                              ->setTags([]);
159
+                                ->expiresAfter(abs((int)$this->getConfig()[ 'defaultTtl' ]))
160
+                                ->setHit(false)
161
+                                ->setTags([]);
162 162
                             if ($this->getConfigOption( 'itemDetailedDate')) {
163 163
 
164 164
                                 /**
@@ -342,8 +342,8 @@  discard block
 block discarded – undo
342 342
             $class = new \ReflectionClass((new \ReflectionObject($this))->getNamespaceName() . '\Item');
343 343
             $itemBatch = $class->newInstanceArgs([$this, $item->getKey()]);
344 344
             $itemBatch->setEventManager($this->eventManager)
345
-              ->set(new ItemBatch($item->getKey(), new \DateTime()))
346
-              ->expiresAfter($this->getConfigOption('cacheSlamsTimeout'));
345
+                ->set(new ItemBatch($item->getKey(), new \DateTime()))
346
+                ->expiresAfter($this->getConfigOption('cacheSlamsTimeout'));
347 347
 
348 348
             /**
349 349
              * To avoid SPL mismatches
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  * @author Georges.L (Geolim4)  <[email protected]>
12 12
  *
13 13
  */
14
-declare(strict_types=1);
14
+declare(strict_types = 1);
15 15
 
16 16
 namespace Phpfastcache\Core\Pool;
17 17
 
@@ -70,9 +70,9 @@  discard block
 block discarded – undo
70 70
              * due to performance issue on huge
71 71
              * loop dispatching operations
72 72
              */
73
-            if (!isset($this->itemInstances[ $key ])) {
73
+            if (!isset($this->itemInstances[$key])) {
74 74
                 if (preg_match('~([' . preg_quote(self::$unsupportedKeyChars, '~') . ']+)~', $key, $matches)) {
75
-                    throw new phpFastCacheInvalidArgumentException('Unsupported key character detected: "' . $matches[ 1 ] . '". Please check: https://github.com/PHPSocialNetwork/phpfastcache/wiki/%5BV6%5D-Unsupported-characters-in-key-identifiers');
75
+                    throw new phpFastCacheInvalidArgumentException('Unsupported key character detected: "' . $matches[1] . '". Please check: https://github.com/PHPSocialNetwork/phpfastcache/wiki/%5BV6%5D-Unsupported-characters-in-key-identifiers');
76 76
                 }
77 77
 
78 78
                 /**
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
                         }
96 96
                         $driverData = $this->driverUnwrapData($driverArray);
97 97
 
98
-                        if ($this->getConfig()[ 'preventCacheSlams' ]) {
98
+                        if ($this->getConfig()['preventCacheSlams']) {
99 99
                             while ($driverData instanceof ItemBatch) {
100 100
                                 if ($driverData->getItemDate()->getTimestamp() + $this->getConfigOption('cacheSlamsTimeout') < time()) {
101 101
                                     /**
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
                         $item->set($driverData);
130 130
                         $item->expiresAt($this->driverUnwrapEdate($driverArray));
131 131
 
132
-                        if ($this->getConfigOption( 'itemDetailedDate')) {
132
+                        if ($this->getConfigOption('itemDetailedDate')) {
133 133
                             /**
134 134
                              * If the itemDetailedDate has been
135 135
                              * set after caching, we MUST inject
@@ -156,10 +156,10 @@  discard block
 block discarded – undo
156 156
                              * Reset the Item
157 157
                              */
158 158
                             $item->set(null)
159
-                              ->expiresAfter(abs((int)$this->getConfig()[ 'defaultTtl' ]))
159
+                              ->expiresAfter(abs((int) $this->getConfig()['defaultTtl']))
160 160
                               ->setHit(false)
161 161
                               ->setTags([]);
162
-                            if ($this->getConfigOption( 'itemDetailedDate')) {
162
+                            if ($this->getConfigOption('itemDetailedDate')) {
163 163
 
164 164
                                 /**
165 165
                                  * If the itemDetailedDate has been
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
                             $item->setHit(true);
174 174
                         }
175 175
                     } else {
176
-                        $item->expiresAfter(abs((int)$this->getConfig()[ 'defaultTtl' ]));
176
+                        $item->expiresAfter(abs((int) $this->getConfig()['defaultTtl']));
177 177
                     }
178 178
                 }
179 179
             }
@@ -186,9 +186,9 @@  discard block
 block discarded – undo
186 186
          * @param $this ExtendedCacheItemPoolInterface
187 187
          * @param $this ExtendedCacheItemInterface
188 188
          */
189
-        $this->eventManager->dispatch('CacheGetItem', $this, $this->itemInstances[ $key ]);
189
+        $this->eventManager->dispatch('CacheGetItem', $this, $this->itemInstances[$key]);
190 190
 
191
-        return $this->itemInstances[ $key ];
191
+        return $this->itemInstances[$key];
192 192
     }
193 193
 
194 194
     /**
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
     public function setItem(CacheItemInterface $item)
200 200
     {
201 201
         if ($this->getClassNamespace() . '\\Item' === \get_class($item)) {
202
-            $this->itemInstances[ $item->getKey() ] = $item;
202
+            $this->itemInstances[$item->getKey()] = $item;
203 203
 
204 204
             return $this;
205 205
         }
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
     {
217 217
         $collection = [];
218 218
         foreach ($keys as $key) {
219
-            $collection[ $key ] = $this->getItem($key);
219
+            $collection[$key] = $this->getItem($key);
220 220
         }
221 221
 
222 222
         return $collection;
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
             }
304 304
         }
305 305
 
306
-        return (bool)$return;
306
+        return (bool) $return;
307 307
     }
308 308
 
309 309
     /**
@@ -321,9 +321,9 @@  discard block
 block discarded – undo
321 321
          * due to performance issue on huge
322 322
          * loop dispatching operations
323 323
          */
324
-        if (!isset($this->itemInstances[ $item->getKey() ])) {
325
-            $this->itemInstances[ $item->getKey() ] = $item;
326
-        } else if (\spl_object_hash($item) !== \spl_object_hash($this->itemInstances[ $item->getKey() ])) {
324
+        if (!isset($this->itemInstances[$item->getKey()])) {
325
+            $this->itemInstances[$item->getKey()] = $item;
326
+        } else if (\spl_object_hash($item) !== \spl_object_hash($this->itemInstances[$item->getKey()])) {
327 327
             throw new \RuntimeException('Spl object hash mismatches ! You probably tried to save a detached item which has been already retrieved from cache.');
328 328
         }
329 329
 
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
         $this->eventManager->dispatch('CacheSaveItem', $this, $item);
336 336
 
337 337
 
338
-        if ($this->getConfig()[ 'preventCacheSlams' ]) {
338
+        if ($this->getConfig()['preventCacheSlams']) {
339 339
             /**
340 340
              * @var $itemBatch ExtendedCacheItemInterface
341 341
              */
@@ -375,8 +375,8 @@  discard block
 block discarded – undo
375 375
     public function saveDeferred(CacheItemInterface $item)
376 376
     {
377 377
         if (!\array_key_exists($item->getKey(), $this->itemInstances)) {
378
-            $this->itemInstances[ $item->getKey() ] = $item;
379
-        } else if (\spl_object_hash($item) !== \spl_object_hash($this->itemInstances[ $item->getKey() ])) {
378
+            $this->itemInstances[$item->getKey()] = $item;
379
+        } else if (\spl_object_hash($item) !== \spl_object_hash($this->itemInstances[$item->getKey()])) {
380 380
             throw new \RuntimeException('Spl object hash mismatches ! You probably tried to save a detached item which has been already retrieved from cache.');
381 381
         }
382 382
 
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
          */
388 388
         $this->eventManager->dispatch('CacheSaveDeferredItem', $this, $item);
389 389
 
390
-        return $this->deferredList[ $item->getKey() ] = $item;
390
+        return $this->deferredList[$item->getKey()] = $item;
391 391
     }
392 392
 
393 393
     /**
@@ -407,11 +407,11 @@  discard block
 block discarded – undo
407 407
         foreach ($this->deferredList as $key => $item) {
408 408
             $result = $this->save($item);
409 409
             if ($return !== false) {
410
-                unset($this->deferredList[ $key ]);
410
+                unset($this->deferredList[$key]);
411 411
                 $return = $result;
412 412
             }
413 413
         }
414 414
 
415
-        return (bool)$return;
415
+        return (bool) $return;
416 416
     }
417 417
 }
418 418
\ No newline at end of file
Please login to merge, or discard this patch.
lib/Phpfastcache/Core/Pool/DriverBaseTrait.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -93,7 +93,7 @@
 block discarded – undo
93 93
 
94 94
 
95 95
     /**
96
-     * @param $optionName
96
+     * @param string $optionName
97 97
      * @return mixed
98 98
      */
99 99
     public function getConfigOption($optionName)
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,6 @@
 block discarded – undo
20 20
 use Phpfastcache\Exceptions\{
21 21
   phpFastCacheInvalidArgumentException, phpFastCacheDriverCheckException, phpFastCacheLogicException
22 22
 };
23
-use Phpfastcache\Util\ArrayObject;
24 23
 
25 24
 
26 25
 /**
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 use Phpfastcache\Config\ConfigurationOption;
19 19
 use Phpfastcache\Core\Item\ExtendedCacheItemInterface;
20 20
 use Phpfastcache\Exceptions\{
21
-  phpFastCacheInvalidArgumentException, phpFastCacheDriverCheckException, phpFastCacheLogicException
21
+    phpFastCacheInvalidArgumentException, phpFastCacheDriverCheckException, phpFastCacheLogicException
22 22
 };
23 23
 use Phpfastcache\Util\ArrayObject;
24 24
 
@@ -161,9 +161,9 @@  discard block
 block discarded – undo
161 161
     public function driverPreWrap(ExtendedCacheItemInterface $item): array
162 162
     {
163 163
         $wrap = [
164
-          self::DRIVER_DATA_WRAPPER_INDEX => $item->get(),
165
-          self::DRIVER_TAGS_WRAPPER_INDEX => $item->getTags(),
166
-          self::DRIVER_EDATE_WRAPPER_INDEX => $item->getExpirationDate(),
164
+            self::DRIVER_DATA_WRAPPER_INDEX => $item->get(),
165
+            self::DRIVER_TAGS_WRAPPER_INDEX => $item->getTags(),
166
+            self::DRIVER_EDATE_WRAPPER_INDEX => $item->getExpirationDate(),
167 167
         ];
168 168
 
169 169
         if ($this->config->getOption('itemDetailedDate')) {
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  * @author Georges.L (Geolim4)  <[email protected]>
12 12
  *
13 13
  */
14
-declare(strict_types=1);
14
+declare(strict_types = 1);
15 15
 
16 16
 namespace Phpfastcache\Core\Pool;
17 17
 
@@ -167,15 +167,15 @@  discard block
 block discarded – undo
167 167
         ];
168 168
 
169 169
         if ($this->config->getOption('itemDetailedDate')) {
170
-            $wrap[ self::DRIVER_MDATE_WRAPPER_INDEX ] = new \DateTime();
170
+            $wrap[self::DRIVER_MDATE_WRAPPER_INDEX] = new \DateTime();
171 171
             /**
172 172
              * If the creation date exists
173 173
              * reuse it else set a new Date
174 174
              */
175
-            $wrap[ self::DRIVER_CDATE_WRAPPER_INDEX ] = $item->getCreationDate() ?: new \DateTime();
175
+            $wrap[self::DRIVER_CDATE_WRAPPER_INDEX] = $item->getCreationDate() ?: new \DateTime();
176 176
         } else {
177
-            $wrap[ self::DRIVER_MDATE_WRAPPER_INDEX ] = null;
178
-            $wrap[ self::DRIVER_CDATE_WRAPPER_INDEX ] = null;
177
+            $wrap[self::DRIVER_MDATE_WRAPPER_INDEX] = null;
178
+            $wrap[self::DRIVER_CDATE_WRAPPER_INDEX] = null;
179 179
         }
180 180
 
181 181
         return $wrap;
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
      */
188 188
     public function driverUnwrapData(array $wrapper)
189 189
     {
190
-        return $wrapper[ self::DRIVER_DATA_WRAPPER_INDEX ];
190
+        return $wrapper[self::DRIVER_DATA_WRAPPER_INDEX];
191 191
     }
192 192
 
193 193
     /**
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
      */
197 197
     public function driverUnwrapTags(array $wrapper)
198 198
     {
199
-        return $wrapper[ self::DRIVER_TAGS_WRAPPER_INDEX ];
199
+        return $wrapper[self::DRIVER_TAGS_WRAPPER_INDEX];
200 200
     }
201 201
 
202 202
 
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
      */
207 207
     public function driverUnwrapEdate(array $wrapper)
208 208
     {
209
-        return $wrapper[ self::DRIVER_EDATE_WRAPPER_INDEX ];
209
+        return $wrapper[self::DRIVER_EDATE_WRAPPER_INDEX];
210 210
     }
211 211
 
212 212
     /**
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
      */
216 216
     public function driverUnwrapCdate(array $wrapper)
217 217
     {
218
-        return $wrapper[ self::DRIVER_CDATE_WRAPPER_INDEX ];
218
+        return $wrapper[self::DRIVER_CDATE_WRAPPER_INDEX];
219 219
     }
220 220
 
221 221
 
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
      */
226 226
     public function driverUnwrapMdate(array $wrapper)
227 227
     {
228
-        return $wrapper[ self::DRIVER_MDATE_WRAPPER_INDEX ];
228
+        return $wrapper[self::DRIVER_MDATE_WRAPPER_INDEX];
229 229
     }
230 230
 
231 231
     /**
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
              * that has slow performances
283 283
              */
284 284
 
285
-            $tagsItem->set(array_merge((array)$data, [$item->getKey() => $expTimestamp]));
285
+            $tagsItem->set(array_merge((array) $data, [$item->getKey() => $expTimestamp]));
286 286
 
287 287
             /**
288 288
              * Set the expiration date
@@ -304,9 +304,9 @@  discard block
 block discarded – undo
304 304
         $tagsItems = $this->getItems($this->getTagKeys($item->getRemovedTags()));
305 305
 
306 306
         foreach ($tagsItems as $tagsItem) {
307
-            $data = (array)$tagsItem->get();
307
+            $data = (array) $tagsItem->get();
308 308
 
309
-            unset($data[ $item->getKey() ]);
309
+            unset($data[$item->getKey()]);
310 310
             $tagsItem->set($data);
311 311
 
312 312
             /**
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
     public static function getConfigClass(): string
388 388
     {
389 389
         $localConfigClass = substr(static::class, 0, strrpos(static::class, '\\')) . '\Config';
390
-        if(\class_exists($localConfigClass) && is_a($localConfigClass, ConfigurationOption::class, true)){
390
+        if (\class_exists($localConfigClass) && is_a($localConfigClass, ConfigurationOption::class, true)) {
391 391
             return $localConfigClass;
392 392
         }
393 393
         return ConfigurationOption::class;
Please login to merge, or discard this patch.
lib/Phpfastcache/Core/Pool/ExtendedCacheItemPoolTrait.php 3 patches
Doc Comments   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -40,6 +40,7 @@  discard block
 block discarded – undo
40 40
 
41 41
     /**
42 42
      * @inheritdoc
43
+     * @param string $tagName
43 44
      */
44 45
     public function getItemsByTag($tagName)
45 46
     {
@@ -409,7 +410,7 @@  discard block
 block discarded – undo
409 410
 
410 411
     /**
411 412
      * @internal This method de-register an item from $this->itemInstances
412
-     * @param CacheItemInterface|string $item
413
+     * @param CacheItemInterface $item
413 414
      * @throws phpFastCacheInvalidArgumentException
414 415
      */
415 416
     protected function deregisterItem($item)
@@ -455,7 +456,7 @@  discard block
 block discarded – undo
455 456
      * Set the EventManager instance
456 457
      *
457 458
      * @param EventManager $em
458
-     * @return ExtendedCacheItemPoolInterface
459
+     * @return ExtendedCacheItemPoolTrait
459 460
      */
460 461
     public function setEventManager(EventManager $em): ExtendedCacheItemPoolInterface
461 462
     {
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
 use Phpfastcache\Core\Item\ExtendedCacheItemInterface;
19 19
 use Phpfastcache\EventManager;
20 20
 use Phpfastcache\Exceptions\{
21
-  phpFastCacheInvalidArgumentException, phpFastCacheLogicException
21
+    phpFastCacheInvalidArgumentException, phpFastCacheLogicException
22 22
 };
23 23
 use Psr\Cache\CacheItemInterface;
24 24
 
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  * @author Georges.L (Geolim4)  <[email protected]>
12 12
  *
13 13
  */
14
-declare(strict_types=1);
14
+declare(strict_types = 1);
15 15
 
16 16
 namespace Phpfastcache\Core\Pool;
17 17
 
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
      */
33 33
     public function getItemsAsJsonString(array $keys = [], $option = 0, $depth = 512): string
34 34
     {
35
-        $callback = function (CacheItemInterface $item) {
35
+        $callback = function(CacheItemInterface $item) {
36 36
             return $item->get();
37 37
         };
38 38
         return \json_encode(array_map($callback, array_values($this->getItems($keys))), $option, $depth);
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
         if (\is_string($tagName)) {
47 47
             $driverResponse = $this->getItem($this->getTagKey($tagName));
48 48
             if ($driverResponse->isHit()) {
49
-                $items = (array)$driverResponse->get();
49
+                $items = (array) $driverResponse->get();
50 50
 
51 51
                 /**
52 52
                  * getItems() may provides expired item(s)
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
                  *
59 59
                  * #headache
60 60
                  */
61
-                return \array_filter($this->getItems(\array_unique(\array_keys($items))), function (ExtendedCacheItemInterface $item) {
61
+                return \array_filter($this->getItems(\array_unique(\array_keys($items))), function(ExtendedCacheItemInterface $item) {
62 62
                     return $item->isHit();
63 63
                 });
64 64
             }
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 
96 96
         foreach ($items as $key => $item) {
97 97
             if (\array_diff($tagNames, $item->getTags())) {
98
-                unset($items[ $key ]);
98
+                unset($items[$key]);
99 99
             }
100 100
         }
101 101
 
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
      */
109 109
     public function getItemsByTagsAsJsonString(array $tagNames, $option = 0, $depth = 512)
110 110
     {
111
-        $callback = function (CacheItemInterface $item) {
111
+        $callback = function(CacheItemInterface $item) {
112 112
             return $item->get();
113 113
         };
114 114
 
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
      */
380 380
     public function detachItem(CacheItemInterface $item)
381 381
     {
382
-        if (isset($this->itemInstances[ $item->getKey() ])) {
382
+        if (isset($this->itemInstances[$item->getKey()])) {
383 383
             $this->deregisterItem($item);
384 384
         }
385 385
     }
@@ -399,11 +399,11 @@  discard block
 block discarded – undo
399 399
      */
400 400
     public function attachItem(CacheItemInterface $item)
401 401
     {
402
-        if (isset($this->itemInstances[ $item->getKey() ]) && \spl_object_hash($item) !== \spl_object_hash($this->itemInstances[ $item->getKey() ])) {
402
+        if (isset($this->itemInstances[$item->getKey()]) && \spl_object_hash($item) !== \spl_object_hash($this->itemInstances[$item->getKey()])) {
403 403
             throw new phpFastCacheLogicException('The item already exists and cannot be overwritten because the Spl object hash mismatches ! You probably tried to re-attach a detached item which has been already retrieved from cache.');
404 404
         }
405 405
 
406
-        $this->itemInstances[ $item->getKey() ] = $item;
406
+        $this->itemInstances[$item->getKey()] = $item;
407 407
     }
408 408
 
409 409
 
@@ -415,10 +415,10 @@  discard block
 block discarded – undo
415 415
     protected function deregisterItem($item)
416 416
     {
417 417
         if ($item instanceof CacheItemInterface) {
418
-            unset($this->itemInstances[ $item->getKey() ]);
418
+            unset($this->itemInstances[$item->getKey()]);
419 419
 
420 420
         } else if (\is_string($item)) {
421
-            unset($this->itemInstances[ $item ]);
421
+            unset($this->itemInstances[$item]);
422 422
         } else {
423 423
             throw new phpFastCacheInvalidArgumentException('Invalid type for $item variable');
424 424
         }
@@ -445,8 +445,8 @@  discard block
 block discarded – undo
445 445
      */
446 446
     public function isAttached(CacheItemInterface $item)
447 447
     {
448
-        if (isset($this->itemInstances[ $item->getKey() ])) {
449
-            return \spl_object_hash($item) === \spl_object_hash($this->itemInstances[ $item->getKey() ]);
448
+        if (isset($this->itemInstances[$item->getKey()])) {
449
+            return \spl_object_hash($item) === \spl_object_hash($this->itemInstances[$item->getKey()]);
450 450
         }
451 451
         return null;
452 452
     }
@@ -469,8 +469,8 @@  discard block
 block discarded – undo
469 469
      */
470 470
     public function saveMultiple(...$items): bool
471 471
     {
472
-        if (isset($items[ 0 ]) && \is_array($items[ 0 ])) {
473
-            foreach ($items[ 0 ] as $item) {
472
+        if (isset($items[0]) && \is_array($items[0])) {
473
+            foreach ($items[0] as $item) {
474 474
                 $this->save($item);
475 475
             }
476 476
             return true;
Please login to merge, or discard this patch.
lib/Phpfastcache/Core/Pool/IO/IOHelperTrait.php 3 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 
133 133
 
134 134
     /**
135
-     * @param $keyword
135
+     * @param false|string $keyword
136 136
      * @param bool $skip
137 137
      * @return string
138 138
      * @throws phpFastCacheIOException
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
     }
203 203
 
204 204
     /**
205
-     * @param $path
205
+     * @param string $path
206 206
      * @param bool $create
207 207
      * @throws phpFastCacheIOException
208 208
      */
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 
244 244
 
245 245
     /**
246
-     * @param $file
246
+     * @param string $file
247 247
      * @return string
248 248
      * @throws phpFastCacheIOException
249 249
      */
Please login to merge, or discard this patch.
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -192,9 +192,9 @@  discard block
 block discarded – undo
192 192
     protected static function cleanFileName($filename): string
193 193
     {
194 194
         $regex = [
195
-          '/[\?\[\]\/\\\=\<\>\:\;\,\'\"\&\$\#\*\(\)\|\~\`\!\{\}]/',
196
-          '/\.$/',
197
-          '/^\./',
195
+            '/[\?\[\]\/\\\=\<\>\:\;\,\'\"\&\$\#\*\(\)\|\~\`\!\{\}]/',
196
+            '/\.$/',
197
+            '/^\./',
198 198
         ];
199 199
         $replace = ['-', '', ''];
200 200
 
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
             $tmpFilename = Directory::getAbsolutePath(\dirname($file) . '/tmp_' . \md5(
291 291
                 str_shuffle(\uniqid($this->getDriverName(), false))
292 292
                 . str_shuffle(\uniqid($this->getDriverName(), false))
293
-              ));
293
+                ));
294 294
 
295 295
             $f = fopen($tmpFilename, 'w+');
296 296
             flock($f, LOCK_EX);
@@ -332,11 +332,11 @@  discard block
 block discarded – undo
332 332
         }
333 333
 
334 334
         $stat->setData(\implode(', ', \array_keys($this->itemInstances)))
335
-          ->setRawData([
335
+            ->setRawData([
336 336
             'tmp' => $this->tmp,
337
-          ])
338
-          ->setSize(Directory::dirSize($path))
339
-          ->setInfo('Number of files used to build the cache: ' . Directory::getFileCount($path));
337
+            ])
338
+            ->setSize(Directory::dirSize($path))
339
+            ->setInfo('Number of files used to build the cache: ' . Directory::getFileCount($path));
340 340
 
341 341
         return $stat;
342 342
     }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  * @author Georges.L (Geolim4)  <[email protected]>
12 12
  *
13 13
  */
14
-declare(strict_types=1);
14
+declare(strict_types = 1);
15 15
 
16 16
 namespace Phpfastcache\Core\Pool\IO;
17 17
 
@@ -54,8 +54,8 @@  discard block
 block discarded – undo
54 54
         {
55 55
             $securityKey = \array_key_exists('securityKey', $this->config) ? $this->config->getOption('securityKey') : '';
56 56
             if (!$securityKey || $securityKey === 'auto') {
57
-                if (isset($_SERVER[ 'HTTP_HOST' ])) {
58
-                    $securityKey = preg_replace('/^www./', '', \strtolower(\str_replace(':', '_', $_SERVER[ 'HTTP_HOST' ])));
57
+                if (isset($_SERVER['HTTP_HOST'])) {
58
+                    $securityKey = preg_replace('/^www./', '', \strtolower(\str_replace(':', '_', $_SERVER['HTTP_HOST'])));
59 59
                 } else {
60 60
                     $securityKey = ($this->isPHPModule() ? 'web' : 'cli');
61 61
                 }
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
             return $full_path;
99 99
         }
100 100
 
101
-        if (!isset($this->tmp[ $full_path_hash ]) || (!@\file_exists($full_path) || !@\is_writable($full_path))) {
101
+        if (!isset($this->tmp[$full_path_hash]) || (!@\file_exists($full_path) || !@\is_writable($full_path))) {
102 102
             if (!@\file_exists($full_path)) {
103 103
                 @mkdir($full_path, $this->getDefaultChmod(), true);
104 104
             } else if (!@\is_writable($full_path)) {
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
                 throw new phpFastCacheIOException('Path "' . $full_path . '" is not writable, please set a chmod 0777 or any writable permission and make sure to make use of an absolute path !');
124 124
             }
125 125
 
126
-            $this->tmp[ $full_path_hash ] = $full_path;
126
+            $this->tmp[$full_path_hash] = $full_path;
127 127
             $this->htaccessGen($full_path, \array_key_exists('htaccess', $this->config) ? $this->config->getOption('htaccess') : false);
128 128
         }
129 129
 
Please login to merge, or discard this patch.
lib/Phpfastcache/Drivers/Cassandra/Driver.php 3 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,6 @@
 block discarded – undo
22 22
 use Phpfastcache\Exceptions\{
23 23
   phpFastCacheInvalidArgumentException, phpFastCacheLogicException
24 24
 };
25
-use Phpfastcache\Util\ArrayObject;
26 25
 use Psr\Cache\CacheItemInterface;
27 26
 
28 27
 /**
Please login to merge, or discard this patch.
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 use Phpfastcache\Core\Pool\{DriverBaseTrait, ExtendedCacheItemPoolInterface};
21 21
 use Phpfastcache\Entities\DriverStatistic;
22 22
 use Phpfastcache\Exceptions\{
23
-  phpFastCacheInvalidArgumentException, phpFastCacheLogicException
23
+    phpFastCacheInvalidArgumentException, phpFastCacheLogicException
24 24
 };
25 25
 use Phpfastcache\Util\ArrayObject;
26 26
 use Psr\Cache\CacheItemInterface;
@@ -61,8 +61,8 @@  discard block
 block discarded – undo
61 61
         $clientConfig = $this->getConfig();
62 62
 
63 63
         $clusterBuilder = Cassandra::cluster()
64
-          ->withContactPoints($clientConfig[ 'host' ])
65
-          ->withPort($clientConfig[ 'port' ]);
64
+            ->withContactPoints($clientConfig[ 'host' ])
65
+            ->withPort($clientConfig[ 'port' ]);
66 66
 
67 67
         if (!empty($clientConfig[ 'sslEnabled' ])) {
68 68
             if (!empty($clientConfig[ 'sslVerify' ])) {
@@ -90,8 +90,8 @@  discard block
 block discarded – undo
90 90
          */
91 91
 
92 92
         $this->instance->execute(new Cassandra\SimpleStatement(\sprintf(
93
-          "CREATE KEYSPACE IF NOT EXISTS %s WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };",
94
-          self::CASSANDRA_KEY_SPACE
93
+            "CREATE KEYSPACE IF NOT EXISTS %s WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };",
94
+            self::CASSANDRA_KEY_SPACE
95 95
         )));
96 96
         $this->instance->execute(new Cassandra\SimpleStatement(\sprintf('USE %s;', self::CASSANDRA_KEY_SPACE)));
97 97
         $this->instance->execute(new Cassandra\SimpleStatement(\sprintf('
@@ -117,13 +117,13 @@  discard block
 block discarded – undo
117 117
     {
118 118
         try {
119 119
             $options = new Cassandra\ExecutionOptions([
120
-              'arguments' => ['cache_id' => $item->getKey()],
121
-              'page_size' => 1,
120
+                'arguments' => ['cache_id' => $item->getKey()],
121
+                'page_size' => 1,
122 122
             ]);
123 123
             $query =\sprintf(
124
-              'SELECT cache_data FROM %s.%s WHERE cache_id = :cache_id;',
125
-              self::CASSANDRA_KEY_SPACE,
126
-              self::CASSANDRA_TABLE
124
+                'SELECT cache_data FROM %s.%s WHERE cache_id = :cache_id;',
125
+                self::CASSANDRA_KEY_SPACE,
126
+                self::CASSANDRA_TABLE
127 127
             );
128 128
             $results = $this->instance->execute(new Cassandra\SimpleStatement($query), $options);
129 129
 
@@ -151,16 +151,16 @@  discard block
 block discarded – undo
151 151
             try {
152 152
                 $cacheData = $this->encode($this->driverPreWrap($item));
153 153
                 $options = new Cassandra\ExecutionOptions([
154
-                  'arguments' => [
154
+                    'arguments' => [
155 155
                     'cache_uuid' => new Cassandra\Uuid(),
156 156
                     'cache_id' => $item->getKey(),
157 157
                     'cache_data' => $cacheData,
158 158
                     'cache_creation_date' => new Cassandra\Timestamp((new \DateTime())->getTimestamp()),
159 159
                     'cache_expiration_date' => new Cassandra\Timestamp($item->getExpirationDate()->getTimestamp()),
160 160
                     'cache_length' => strlen($cacheData),
161
-                  ],
162
-                  'consistency' => Cassandra::CONSISTENCY_ALL,
163
-                  'serial_consistency' => Cassandra::CONSISTENCY_SERIAL,
161
+                    ],
162
+                    'consistency' => Cassandra::CONSISTENCY_ALL,
163
+                    'serial_consistency' => Cassandra::CONSISTENCY_SERIAL,
164 164
                 ]);
165 165
 
166 166
                 $query =\sprintf('INSERT INTO %s.%s
@@ -203,14 +203,14 @@  discard block
 block discarded – undo
203 203
         if ($item instanceof Item) {
204 204
             try {
205 205
                 $options = new Cassandra\ExecutionOptions([
206
-                  'arguments' => [
206
+                    'arguments' => [
207 207
                     'cache_id' => $item->getKey(),
208
-                  ],
208
+                    ],
209 209
                 ]);
210 210
                 $result = $this->instance->execute(new Cassandra\SimpleStatement(\sprintf(
211
-                  'DELETE FROM %s.%s WHERE cache_id = :cache_id;',
212
-                  self::CASSANDRA_KEY_SPACE,
213
-                  self::CASSANDRA_TABLE
211
+                    'DELETE FROM %s.%s WHERE cache_id = :cache_id;',
212
+                    self::CASSANDRA_KEY_SPACE,
213
+                    self::CASSANDRA_TABLE
214 214
                 )), $options);
215 215
 
216 216
                 /**
@@ -234,8 +234,8 @@  discard block
 block discarded – undo
234 234
     {
235 235
         try {
236 236
             $this->instance->execute(new Cassandra\SimpleStatement(\sprintf(
237
-              'TRUNCATE %s.%s;',
238
-              self::CASSANDRA_KEY_SPACE, self::CASSANDRA_TABLE
237
+                'TRUNCATE %s.%s;',
238
+                self::CASSANDRA_KEY_SPACE, self::CASSANDRA_TABLE
239 239
             )));
240 240
 
241 241
             return true;
@@ -272,15 +272,15 @@  discard block
 block discarded – undo
272 272
     public function getStats(): DriverStatistic
273 273
     {
274 274
         $result = $this->instance->execute(new Cassandra\SimpleStatement(\sprintf(
275
-          'SELECT SUM(cache_length) as cache_size FROM %s.%s',
276
-          self::CASSANDRA_KEY_SPACE,
277
-          self::CASSANDRA_TABLE
275
+            'SELECT SUM(cache_length) as cache_size FROM %s.%s',
276
+            self::CASSANDRA_KEY_SPACE,
277
+            self::CASSANDRA_TABLE
278 278
         )));
279 279
 
280 280
         return (new DriverStatistic())
281
-          ->setSize($result->first()[ 'cache_size' ])
282
-          ->setRawData([])
283
-          ->setData(\implode(', ', \array_keys($this->itemInstances)))
284
-          ->setInfo('The cache size represents only the cache data itself without counting data structures associated to the cache entries.');
281
+            ->setSize($result->first()[ 'cache_size' ])
282
+            ->setRawData([])
283
+            ->setData(\implode(', ', \array_keys($this->itemInstances)))
284
+            ->setInfo('The cache size represents only the cache data itself without counting data structures associated to the cache entries.');
285 285
     }
286 286
 }
287 287
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  * @author Georges.L (Geolim4)  <[email protected]>
12 12
  *
13 13
  */
14
-declare(strict_types=1);
14
+declare(strict_types = 1);
15 15
 
16 16
 namespace Phpfastcache\Drivers\Cassandra;
17 17
 
@@ -61,11 +61,11 @@  discard block
 block discarded – undo
61 61
         $clientConfig = $this->getConfig();
62 62
 
63 63
         $clusterBuilder = Cassandra::cluster()
64
-          ->withContactPoints($clientConfig[ 'host' ])
65
-          ->withPort($clientConfig[ 'port' ]);
64
+          ->withContactPoints($clientConfig['host'])
65
+          ->withPort($clientConfig['port']);
66 66
 
67
-        if (!empty($clientConfig[ 'sslEnabled' ])) {
68
-            if (!empty($clientConfig[ 'sslVerify' ])) {
67
+        if (!empty($clientConfig['sslEnabled'])) {
68
+            if (!empty($clientConfig['sslVerify'])) {
69 69
                 $sslBuilder = Cassandra::ssl()->withVerifyFlags(Cassandra::VERIFY_PEER_CERT);
70 70
             } else {
71 71
                 $sslBuilder = Cassandra::ssl()->withVerifyFlags(Cassandra::VERIFY_NONE);
@@ -74,10 +74,10 @@  discard block
 block discarded – undo
74 74
             $clusterBuilder->withSSL($sslBuilder->build());
75 75
         }
76 76
 
77
-        $clusterBuilder->withConnectTimeout($clientConfig[ 'timeout' ]);
77
+        $clusterBuilder->withConnectTimeout($clientConfig['timeout']);
78 78
 
79
-        if ($clientConfig[ 'username' ]) {
80
-            $clusterBuilder->withCredentials($clientConfig[ 'username' ], $clientConfig[ 'password' ]);
79
+        if ($clientConfig['username']) {
80
+            $clusterBuilder->withCredentials($clientConfig['username'], $clientConfig['password']);
81 81
         }
82 82
 
83 83
         $this->instance = $clusterBuilder->build()->connect();
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
               'arguments' => ['cache_id' => $item->getKey()],
121 121
               'page_size' => 1,
122 122
             ]);
123
-            $query =\sprintf(
123
+            $query = \sprintf(
124 124
               'SELECT cache_data FROM %s.%s WHERE cache_id = :cache_id;',
125 125
               self::CASSANDRA_KEY_SPACE,
126 126
               self::CASSANDRA_TABLE
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
             $results = $this->instance->execute(new Cassandra\SimpleStatement($query), $options);
129 129
 
130 130
             if ($results instanceof Cassandra\Rows && $results->count() === 1) {
131
-                return $this->decode($results->first()[ 'cache_data' ]);
131
+                return $this->decode($results->first()['cache_data']);
132 132
             }
133 133
 
134 134
             return null;
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
                   'serial_consistency' => Cassandra::CONSISTENCY_SERIAL,
164 164
                 ]);
165 165
 
166
-                $query =\sprintf('INSERT INTO %s.%s
166
+                $query = \sprintf('INSERT INTO %s.%s
167 167
                     (
168 168
                       cache_uuid, 
169 169
                       cache_id, 
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
         )));
279 279
 
280 280
         return (new DriverStatistic())
281
-          ->setSize($result->first()[ 'cache_size' ])
281
+          ->setSize($result->first()['cache_size'])
282 282
           ->setRawData([])
283 283
           ->setData(\implode(', ', \array_keys($this->itemInstances)))
284 284
           ->setInfo('The cache size represents only the cache data itself without counting data structures associated to the cache entries.');
Please login to merge, or discard this patch.
lib/Phpfastcache/Drivers/Couchdb/Driver.php 4 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -172,6 +172,7 @@
 block discarded – undo
172 172
     }
173 173
 
174 174
     /**
175
+     * @param string $docId
175 176
      * @return string|null
176 177
      */
177 178
     protected function getLatestDocumentRevision($docId)
Please login to merge, or discard this patch.
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -18,7 +18,6 @@  discard block
 block discarded – undo
18 18
 use Doctrine\CouchDB\{
19 19
   CouchDBClient as CouchdbClient, CouchDBException
20 20
 };
21
-use Phpfastcache\Config\ConfigurationOption;
22 21
 use Phpfastcache\Core\Pool\{
23 22
   DriverBaseTrait, ExtendedCacheItemPoolInterface
24 23
 };
@@ -26,7 +25,6 @@  discard block
 block discarded – undo
26 25
   phpFastCacheDriverException, phpFastCacheInvalidArgumentException, phpFastCacheLogicException
27 26
 };
28 27
 use Phpfastcache\Entities\DriverStatistic;
29
-use Phpfastcache\Util\ArrayObject;
30 28
 use Psr\Cache\CacheItemInterface;
31 29
 
32 30
 /**
Please login to merge, or discard this patch.
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -16,14 +16,14 @@  discard block
 block discarded – undo
16 16
 namespace Phpfastcache\Drivers\Couchdb;
17 17
 
18 18
 use Doctrine\CouchDB\{
19
-  CouchDBClient as CouchdbClient, CouchDBException
19
+    CouchDBClient as CouchdbClient, CouchDBException
20 20
 };
21 21
 use Phpfastcache\Config\ConfigurationOption;
22 22
 use Phpfastcache\Core\Pool\{
23
-  DriverBaseTrait, ExtendedCacheItemPoolInterface
23
+    DriverBaseTrait, ExtendedCacheItemPoolInterface
24 24
 };
25 25
 use Phpfastcache\Exceptions\{
26
-  phpFastCacheDriverException, phpFastCacheInvalidArgumentException, phpFastCacheLogicException
26
+    phpFastCacheDriverException, phpFastCacheInvalidArgumentException, phpFastCacheLogicException
27 27
 };
28 28
 use Phpfastcache\Entities\DriverStatistic;
29 29
 use Phpfastcache\Util\ArrayObject;
@@ -75,9 +75,9 @@  discard block
 block discarded – undo
75 75
         $url .= $clientConfig[ 'path' ];
76 76
 
77 77
         $this->instance = CouchDBClient::create([
78
-          'dbname' => $this->getDatabaseName(),
79
-          'url' => $url,
80
-          'timeout' => $clientConfig[ 'timeout' ],
78
+            'dbname' => $this->getDatabaseName(),
79
+            'url' => $url,
80
+            'timeout' => $clientConfig[ 'timeout' ],
81 81
         ]);
82 82
 
83 83
         $this->createDatabase();
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
         if ($item instanceof Item) {
123 123
             try {
124 124
                 $this->instance->putDocument(['data' => $this->encode($this->driverPreWrap($item))], $item->getEncodedKey(),
125
-                  $this->getLatestDocumentRevision($item->getEncodedKey()));
125
+                    $this->getLatestDocumentRevision($item->getEncodedKey()));
126 126
             } catch (CouchDBException $e) {
127 127
                 throw new phpFastCacheDriverException('Got error while trying to upsert a document: ' . $e->getMessage(), null, $e);
128 128
             }
@@ -179,10 +179,10 @@  discard block
 block discarded – undo
179 179
         $path = '/' . $this->getDatabaseName() . '/' . urlencode($docId);
180 180
 
181 181
         $response = $this->instance->getHttpClient()->request(
182
-          'HEAD',
183
-          $path,
184
-          null,
185
-          false
182
+            'HEAD',
183
+            $path,
184
+            null,
185
+            false
186 186
         );
187 187
         if (!empty($response->headers[ 'etag' ])) {
188 188
             return \trim($response->headers[ 'etag' ], " '\"\t\n\r\0\x0B");
@@ -236,9 +236,9 @@  discard block
 block discarded – undo
236 236
         $info = $this->instance->getDatabaseInfo();
237 237
 
238 238
         return (new DriverStatistic())
239
-          ->setSize($info[ 'sizes' ][ 'active' ])
240
-          ->setRawData($info)
241
-          ->setData(\implode(', ', \array_keys($this->itemInstances)))
242
-          ->setInfo('Couchdb version ' . $this->instance->getVersion() . "\n For more information see RawData.");
239
+            ->setSize($info[ 'sizes' ][ 'active' ])
240
+            ->setRawData($info)
241
+            ->setData(\implode(', ', \array_keys($this->itemInstances)))
242
+            ->setInfo('Couchdb version ' . $this->instance->getVersion() . "\n For more information see RawData.");
243 243
     }
244 244
 }
245 245
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  * @author Georges.L (Geolim4)  <[email protected]>
12 12
  *
13 13
  */
14
-declare(strict_types=1);
14
+declare(strict_types = 1);
15 15
 
16 16
 namespace Phpfastcache\Drivers\Couchdb;
17 17
 
@@ -62,22 +62,22 @@  discard block
 block discarded – undo
62 62
 
63 63
         $clientConfig = $this->getConfig();
64 64
 
65
-        $url = ($clientConfig[ 'ssl' ] ? 'https://' : 'http://');
66
-        if ($clientConfig[ 'username' ]) {
65
+        $url = ($clientConfig['ssl'] ? 'https://' : 'http://');
66
+        if ($clientConfig['username']) {
67 67
             $url .= "{$clientConfig['username']}";
68
-            if ($clientConfig[ 'password' ]) {
68
+            if ($clientConfig['password']) {
69 69
                 $url .= ":{$clientConfig['password']}";
70 70
             }
71 71
             $url .= '@';
72 72
         }
73
-        $url .= $clientConfig[ 'host' ];
73
+        $url .= $clientConfig['host'];
74 74
         $url .= ":{$clientConfig['port']}";
75
-        $url .= $clientConfig[ 'path' ];
75
+        $url .= $clientConfig['path'];
76 76
 
77 77
         $this->instance = CouchDBClient::create([
78 78
           'dbname' => $this->getDatabaseName(),
79 79
           'url' => $url,
80
-          'timeout' => $clientConfig[ 'timeout' ],
80
+          'timeout' => $clientConfig['timeout'],
81 81
         ]);
82 82
 
83 83
         $this->createDatabase();
@@ -98,10 +98,10 @@  discard block
 block discarded – undo
98 98
             throw new phpFastCacheDriverException('Got error while trying to get a document: ' . $e->getMessage(), null, $e);
99 99
         }
100 100
 
101
-        if ($response->status === 404 || empty($response->body[ 'data' ])) {
101
+        if ($response->status === 404 || empty($response->body['data'])) {
102 102
             return null;
103 103
         } else if ($response->status === 200) {
104
-            return $this->decode($response->body[ 'data' ]);
104
+            return $this->decode($response->body['data']);
105 105
         } else {
106 106
             throw new phpFastCacheDriverException('Got unexpected HTTP status: ' . $response->status);
107 107
         }
@@ -184,8 +184,8 @@  discard block
 block discarded – undo
184 184
           null,
185 185
           false
186 186
         );
187
-        if (!empty($response->headers[ 'etag' ])) {
188
-            return \trim($response->headers[ 'etag' ], " '\"\t\n\r\0\x0B");
187
+        if (!empty($response->headers['etag'])) {
188
+            return \trim($response->headers['etag'], " '\"\t\n\r\0\x0B");
189 189
         }
190 190
 
191 191
         return null;
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
         $info = $this->instance->getDatabaseInfo();
237 237
 
238 238
         return (new DriverStatistic())
239
-          ->setSize($info[ 'sizes' ][ 'active' ])
239
+          ->setSize($info['sizes']['active'])
240 240
           ->setRawData($info)
241 241
           ->setData(\implode(', ', \array_keys($this->itemInstances)))
242 242
           ->setInfo('Couchdb version ' . $this->instance->getVersion() . "\n For more information see RawData.");
Please login to merge, or discard this patch.
lib/Phpfastcache/Drivers/Devnull/Driver.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@
 block discarded – undo
42 42
 
43 43
     /**
44 44
      * @param \Psr\Cache\CacheItemInterface $item
45
-     * @return mixed
45
+     * @return boolean
46 46
      * @throws phpFastCacheInvalidArgumentException
47 47
      */
48 48
     protected function driverWrite(CacheItemInterface $item): bool
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 use Phpfastcache\Core\Pool\{DriverBaseTrait, ExtendedCacheItemPoolInterface};
19 19
 use Phpfastcache\Entities\DriverStatistic;
20 20
 use Phpfastcache\Exceptions\{
21
-  phpFastCacheInvalidArgumentException
21
+    phpFastCacheInvalidArgumentException
22 22
 };
23 23
 use Psr\Cache\CacheItemInterface;
24 24
 
@@ -112,9 +112,9 @@  discard block
 block discarded – undo
112 112
     {
113 113
         $stat = new DriverStatistic();
114 114
         $stat->setInfo('[Devnull] A void info string')
115
-          ->setSize(0)
116
-          ->setData(\implode(', ', \array_keys($this->itemInstances)))
117
-          ->setRawData(null);
115
+            ->setSize(0)
116
+            ->setData(\implode(', ', \array_keys($this->itemInstances)))
117
+            ->setRawData(null);
118 118
 
119 119
         return $stat;
120 120
     }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
  * @author Georges.L (Geolim4)  <[email protected]>
12 12
  *
13 13
  */
14
-declare(strict_types=1);
14
+declare(strict_types = 1);
15 15
 
16 16
 namespace Phpfastcache\Drivers\Devnull;
17 17
 
Please login to merge, or discard this patch.