Completed
Push — V6 ( 143ccf...e26840 )
by Georges
02:18
created
src/phpFastCache/Core/Pool/DriverBaseTrait.php 2 patches
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
         if (is_array($config_name)) {
53 53
             $this->config = array_merge($this->config, $config_name);
54 54
         } else {
55
-            $this->config[ $config_name ] = $value;
55
+            $this->config[$config_name] = $value;
56 56
         }
57 57
     }
58 58
 
@@ -70,9 +70,9 @@  discard block
 block discarded – undo
70 70
      */
71 71
     public function getConfigOption($optionName)
72 72
     {
73
-        if(isset($this->config[$optionName])){
73
+        if (isset($this->config[$optionName])) {
74 74
             return $this->config[$optionName];
75
-        }else{
75
+        } else {
76 76
             return null;
77 77
         }
78 78
     }
@@ -142,16 +142,16 @@  discard block
 block discarded – undo
142 142
           self::DRIVER_EDATE_WRAPPER_INDEX => $item->getExpirationDate(),
143 143
         ];
144 144
 
145
-        if($this->config['itemDetailedDate']){
146
-            $wrap[ self::DRIVER_MDATE_WRAPPER_INDEX ] = new \DateTime();
145
+        if ($this->config['itemDetailedDate']) {
146
+            $wrap[self::DRIVER_MDATE_WRAPPER_INDEX] = new \DateTime();
147 147
             /**
148 148
              * If the creation date exists
149 149
              * reuse it else set a new Date
150 150
              */
151
-            $wrap[ self::DRIVER_CDATE_WRAPPER_INDEX ] = $item->getCreationDate() ?: new \DateTime();
152
-        }else{
153
-            $wrap[ self::DRIVER_MDATE_WRAPPER_INDEX ] = null;
154
-            $wrap[ self::DRIVER_CDATE_WRAPPER_INDEX ] = null;
151
+            $wrap[self::DRIVER_CDATE_WRAPPER_INDEX] = $item->getCreationDate() ?: new \DateTime();
152
+        } else {
153
+            $wrap[self::DRIVER_MDATE_WRAPPER_INDEX] = null;
154
+            $wrap[self::DRIVER_CDATE_WRAPPER_INDEX] = null;
155 155
         }
156 156
 
157 157
         return $wrap;
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
      */
164 164
     public function driverUnwrapData(array $wrapper)
165 165
     {
166
-        return $wrapper[ self::DRIVER_DATA_WRAPPER_INDEX ];
166
+        return $wrapper[self::DRIVER_DATA_WRAPPER_INDEX];
167 167
     }
168 168
 
169 169
     /**
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
      */
173 173
     public function driverUnwrapTags(array $wrapper)
174 174
     {
175
-        return $wrapper[ self::DRIVER_TAGS_WRAPPER_INDEX ];
175
+        return $wrapper[self::DRIVER_TAGS_WRAPPER_INDEX];
176 176
     }
177 177
 
178 178
 
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
      */
183 183
     public function driverUnwrapEdate(array $wrapper)
184 184
     {
185
-        return $wrapper[ self::DRIVER_EDATE_WRAPPER_INDEX ];
185
+        return $wrapper[self::DRIVER_EDATE_WRAPPER_INDEX];
186 186
     }
187 187
 
188 188
     /**
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
      */
192 192
     public function driverUnwrapCdate(array $wrapper)
193 193
     {
194
-        return $wrapper[ self::DRIVER_CDATE_WRAPPER_INDEX ];
194
+        return $wrapper[self::DRIVER_CDATE_WRAPPER_INDEX];
195 195
     }
196 196
 
197 197
 
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
      */
202 202
     public function driverUnwrapMdate(array $wrapper)
203 203
     {
204
-        return $wrapper[ self::DRIVER_MDATE_WRAPPER_INDEX ];
204
+        return $wrapper[self::DRIVER_MDATE_WRAPPER_INDEX];
205 205
     }
206 206
 
207 207
     /**
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
          * on tags item, it can leads
227 227
          * to an infinite recursive calls
228 228
          */
229
-        if(strpos($item->getKey(), self::DRIVER_TAGS_KEY_PREFIX ) === 0){
229
+        if (strpos($item->getKey(), self::DRIVER_TAGS_KEY_PREFIX) === 0) {
230 230
             throw new \LogicException('Trying to set tag(s) to an Tag item index: ' . $item->getKey());
231 231
         }
232 232
 
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
         foreach ($tagsItems as $tagsItem) {
270 270
             $data = (array) $tagsItem->get();
271 271
 
272
-            unset($data[ $item->getKey() ]);
272
+            unset($data[$item->getKey()]);
273 273
             $tagsItem->set($data);
274 274
 
275 275
             /**
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
     {
73 73
         if(isset($this->config[$optionName])){
74 74
             return $this->config[$optionName];
75
-        }else{
75
+        } else{
76 76
             return null;
77 77
         }
78 78
     }
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
              * reuse it else set a new Date
150 150
              */
151 151
             $wrap[ self::DRIVER_CDATE_WRAPPER_INDEX ] = $item->getCreationDate() ?: new \DateTime();
152
-        }else{
152
+        } else{
153 153
             $wrap[ self::DRIVER_MDATE_WRAPPER_INDEX ] = null;
154 154
             $wrap[ self::DRIVER_CDATE_WRAPPER_INDEX ] = null;
155 155
         }
Please login to merge, or discard this patch.
src/phpFastCache/Core/Item/ItemExtendedTrait.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -48,9 +48,9 @@  discard block
 block discarded – undo
48 48
     {
49 49
         $keyHashFunction = $this->driver->getConfigOption('defaultKeyHashFunction');
50 50
 
51
-        if($keyHashFunction){
51
+        if ($keyHashFunction) {
52 52
             return $keyHashFunction($this->getKey());
53
-        }else{
53
+        } else {
54 54
             return md5($this->getKey());
55 55
         }
56 56
     }
@@ -94,9 +94,9 @@  discard block
 block discarded – undo
94 94
      */
95 95
     public function getCreationDate()
96 96
     {
97
-        if($this->driver->getConfig()['itemDetailedDate']){
97
+        if ($this->driver->getConfig()['itemDetailedDate']) {
98 98
             return $this->creationDate;
99
-        }else{
99
+        } else {
100 100
             throw new \LogicException('Cannot access to the creation date when the "itemDetailedDate" configuration is disabled.');
101 101
         }
102 102
     }
@@ -108,10 +108,10 @@  discard block
 block discarded – undo
108 108
      */
109 109
     public function setCreationDate(\DateTimeInterface $date)
110 110
     {
111
-        if($this->driver->getConfig()['itemDetailedDate']){
111
+        if ($this->driver->getConfig()['itemDetailedDate']) {
112 112
             $this->creationDate = $date;
113 113
             return $this;
114
-        }else{
114
+        } else {
115 115
             throw new \LogicException('Cannot access to the creation date when the "itemDetailedDate" configuration is disabled.');
116 116
         }
117 117
     }
@@ -122,9 +122,9 @@  discard block
 block discarded – undo
122 122
      */
123 123
     public function getModificationDate()
124 124
     {
125
-        if($this->driver->getConfig()['itemDetailedDate']){
125
+        if ($this->driver->getConfig()['itemDetailedDate']) {
126 126
             return $this->modificationDate;
127
-        }else{
127
+        } else {
128 128
             throw new \LogicException('Cannot access to the modification date when the "itemDetailedDate" configuration is disabled.');
129 129
         }
130 130
     }
@@ -136,10 +136,10 @@  discard block
 block discarded – undo
136 136
      */
137 137
     public function setModificationDate(\DateTimeInterface $date)
138 138
     {
139
-        if($this->driver->getConfig()['itemDetailedDate']){
139
+        if ($this->driver->getConfig()['itemDetailedDate']) {
140 140
             $this->modificationDate = $date;
141 141
             return $this;
142
-        }else{
142
+        } else {
143 143
             throw new \LogicException('Cannot access to the modification date when the "itemDetailedDate" configuration is disabled.');
144 144
         }
145 145
     }
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
     public function removeTag($tagName)
307 307
     {
308 308
         if (($key = array_search($tagName, $this->tags)) !== false) {
309
-            unset($this->tags[ $key ]);
309
+            unset($this->tags[$key]);
310 310
             $this->removedTags[] = $tagName;
311 311
         }
312 312
 
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
     final public function __debugInfo()
383 383
     {
384 384
         $info = get_object_vars($this);
385
-        $info[ 'driver' ] = 'object(' . get_class($info[ 'driver' ]) . ')';
385
+        $info['driver'] = 'object(' . get_class($info['driver']) . ')';
386 386
 
387 387
         return (array) $info;
388 388
     }
Please login to merge, or discard this patch.
Braces   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 
51 51
         if($keyHashFunction){
52 52
             return $keyHashFunction($this->getKey());
53
-        }else{
53
+        } else{
54 54
             return md5($this->getKey());
55 55
         }
56 56
     }
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
     {
97 97
         if($this->driver->getConfig()['itemDetailedDate']){
98 98
             return $this->creationDate;
99
-        }else{
99
+        } else{
100 100
             throw new \LogicException('Cannot access to the creation date when the "itemDetailedDate" configuration is disabled.');
101 101
         }
102 102
     }
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
         if($this->driver->getConfig()['itemDetailedDate']){
112 112
             $this->creationDate = $date;
113 113
             return $this;
114
-        }else{
114
+        } else{
115 115
             throw new \LogicException('Cannot access to the creation date when the "itemDetailedDate" configuration is disabled.');
116 116
         }
117 117
     }
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
     {
125 125
         if($this->driver->getConfig()['itemDetailedDate']){
126 126
             return $this->modificationDate;
127
-        }else{
127
+        } else{
128 128
             throw new \LogicException('Cannot access to the modification date when the "itemDetailedDate" configuration is disabled.');
129 129
         }
130 130
     }
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
         if($this->driver->getConfig()['itemDetailedDate']){
140 140
             $this->modificationDate = $date;
141 141
             return $this;
142
-        }else{
142
+        } else{
143 143
             throw new \LogicException('Cannot access to the modification date when the "itemDetailedDate" configuration is disabled.');
144 144
         }
145 145
     }
Please login to merge, or discard this patch.
src/phpFastCache/CacheManager.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -169,32 +169,32 @@  discard block
 block discarded – undo
169 169
         }
170 170
 
171 171
         $instance = crc32($driver . serialize($config));
172
-        if (!isset(self::$instances[ $instance ])) {
172
+        if (!isset(self::$instances[$instance])) {
173 173
             $badPracticeOmeter[$driver] = 1;
174
-            if(!$config['ignoreSymfonyNotice'] && interface_exists('Symfony\Component\HttpKernel\KernelInterface') && !class_exists('phpFastCache\Bundle\phpFastCacheBundle')){
174
+            if (!$config['ignoreSymfonyNotice'] && interface_exists('Symfony\Component\HttpKernel\KernelInterface') && !class_exists('phpFastCache\Bundle\phpFastCacheBundle')) {
175 175
                 trigger_error('A Symfony Bundle to make the PhpFastCache integration more easier is now available here: https://github.com/PHPSocialNetwork/phpfastcache-bundle', E_USER_NOTICE);
176 176
             }
177 177
             $class = self::getNamespacePath() . $driver . '\Driver';
178
-            try{
179
-                self::$instances[ $instance ] = new $class($config);
180
-                self::$instances[ $instance ]->setEventManager(EventManager::getInstance());
181
-            }catch(phpFastCacheDriverCheckException $e){
178
+            try {
179
+                self::$instances[$instance] = new $class($config);
180
+                self::$instances[$instance]->setEventManager(EventManager::getInstance());
181
+            } catch (phpFastCacheDriverCheckException $e) {
182 182
                 $fallback = self::standardizeDriverName($config['fallback']);
183
-                if($fallback && $fallback !== $driver){
183
+                if ($fallback && $fallback !== $driver) {
184 184
                     $class = self::getNamespacePath() . $fallback . '\Driver';
185
-                    self::$instances[ $instance ] = new $class($config);
186
-                    self::$instances[ $instance ]->setEventManager(EventManager::getInstance());
185
+                    self::$instances[$instance] = new $class($config);
186
+                    self::$instances[$instance]->setEventManager(EventManager::getInstance());
187 187
                     trigger_error(sprintf('The "%s" driver is unavailable at the moment, the fallback driver "%s" has been used instead.', $driver, $fallback), E_USER_WARNING);
188
-                }else{
188
+                } else {
189 189
                     throw new phpFastCacheDriverCheckException($e->getMessage(), $e->getCode(), $e);
190 190
                 }
191 191
             }
192
-        } else if(++$badPracticeOmeter[$driver] >= 5){
192
+        } else if (++$badPracticeOmeter[$driver] >= 5) {
193 193
             trigger_error('[' . $driver . '] Calling many times CacheManager::getInstance() for already instanced drivers is a bad practice and have a significant impact on performances.
194 194
            See https://github.com/PHPSocialNetwork/phpfastcache/wiki/[V5]-Why-calling-getInstance%28%29-each-time-is-a-bad-practice-%3F');
195 195
         }
196 196
 
197
-        return self::$instances[ $instance ];
197
+        return self::$instances[$instance];
198 198
     }
199 199
 
200 200
     /**
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
      */
256 256
     public static function __callStatic($name, $arguments)
257 257
     {
258
-        $options = (array_key_exists(0, $arguments) && is_array($arguments) ? $arguments[ 0 ] : []);
258
+        $options = (array_key_exists(0, $arguments) && is_array($arguments) ? $arguments[0] : []);
259 259
 
260 260
         return self::getInstance($name, $options);
261 261
     }
@@ -296,9 +296,9 @@  discard block
 block discarded – undo
296 296
     {
297 297
         if (is_array($name)) {
298 298
             self::$config = array_merge(self::$config, $name);
299
-        } else if (is_string($name)){
300
-            self::$config[ $name ] = $value;
301
-        }else{
299
+        } else if (is_string($name)) {
300
+            self::$config[$name] = $value;
301
+        } else {
302 302
             throw new phpFastCacheInvalidArgumentException('Invalid variable type: $name');
303 303
         }
304 304
     }
@@ -367,70 +367,70 @@  discard block
 block discarded – undo
367 367
     protected static function validateConfig(array $config)
368 368
     {
369 369
         foreach ($config as $configName => $configValue) {
370
-            switch($configName)
370
+            switch ($configName)
371 371
             {
372 372
                 case 'itemDetailedDate':
373
-                    if(!is_bool($configValue)){
373
+                    if (!is_bool($configValue)) {
374 374
                         throw new phpFastCacheInvalidConfigurationException("{$configName} must be a boolean");
375 375
                     }
376 376
                     break;
377 377
                 case 'autoTmpFallback':
378
-                    if(!is_bool($configValue)){
378
+                    if (!is_bool($configValue)) {
379 379
                         throw new phpFastCacheInvalidConfigurationException("{$configName} must be a boolean");
380 380
                     }
381 381
                     break;
382 382
                 case 'secureFileManipulation':
383
-                    if(!is_bool($configValue)){
383
+                    if (!is_bool($configValue)) {
384 384
                         throw new phpFastCacheInvalidConfigurationException("{$configName} must be a boolean");
385 385
                     }
386 386
                     break;
387 387
                 case 'ignoreSymfonyNotice':
388
-                    if(!is_bool($configValue)){
388
+                    if (!is_bool($configValue)) {
389 389
                         throw new phpFastCacheInvalidConfigurationException("{$configName} must be a boolean");
390 390
                     }
391 391
                     break;
392 392
                 case 'defaultTtl':
393
-                    if(!is_numeric($configValue)){
393
+                    if (!is_numeric($configValue)) {
394 394
                         throw new phpFastCacheInvalidConfigurationException("{$configName} must be numeric");
395 395
                     }
396 396
                     break;
397 397
                 case 'defaultKeyHashFunction':
398
-                    if(!is_string($configValue) && !function_exists($configValue)){
398
+                    if (!is_string($configValue) && !function_exists($configValue)) {
399 399
                         throw new phpFastCacheInvalidConfigurationException("{$configName} must be a valid function name string");
400 400
                     }
401 401
                     break;
402 402
                 case 'securityKey':
403
-                    if(!is_string($configValue)){
403
+                    if (!is_string($configValue)) {
404 404
                         throw new phpFastCacheInvalidConfigurationException("{$configName} must be a string");
405 405
                     }
406 406
                     break;
407 407
                 case 'htaccess':
408
-                    if(!is_bool($configValue)){
408
+                    if (!is_bool($configValue)) {
409 409
                         throw new phpFastCacheInvalidConfigurationException("{$configName} must be a boolean");
410 410
                     }
411 411
                     break;
412 412
                 case 'default_chmod':
413
-                    if(!is_int($configValue)){
413
+                    if (!is_int($configValue)) {
414 414
                         throw new phpFastCacheInvalidConfigurationException("{$configName} must be an integer");
415 415
                     }
416 416
                     break;
417 417
                 case 'path':
418
-                    if(!is_string($configValue)){
418
+                    if (!is_string($configValue)) {
419 419
                         throw new phpFastCacheInvalidConfigurationException("{$configName} must be a string");
420 420
                     }
421 421
                     break;
422 422
                 case 'fallback':
423
-                    if(!is_bool($configValue)){
423
+                    if (!is_bool($configValue)) {
424 424
                         throw new phpFastCacheInvalidConfigurationException("{$configName} must be a boolean");
425 425
                     }
426 426
                     break;
427 427
                 case 'limited_memory_each_object':
428
-                    if(!is_int($configValue)){
428
+                    if (!is_int($configValue)) {
429 429
                         throw new phpFastCacheInvalidConfigurationException("{$configName} must be an integer");
430 430
                     }
431 431
                     break;
432 432
                 case 'compress_data':
433
-                    if(!is_bool($configValue)){
433
+                    if (!is_bool($configValue)) {
434 434
                         throw new phpFastCacheInvalidConfigurationException("{$configName} must be a boolean");
435 435
                     }
436 436
                     break;
Please login to merge, or discard this patch.