Completed
Push — V6 ( 6bfaa5...2f3d58 )
by Georges
03:19
created
src/phpFastCache/Helper/TestHelper.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
      */
96 96
     public function printNewLine($count = 1)
97 97
     {
98
-        for($i = 0; $i < $count; $i++){
98
+        for ($i = 0; $i < $count; $i++) {
99 99
             print PHP_EOL;
100 100
         }
101 101
 
@@ -109,9 +109,9 @@  discard block
 block discarded – undo
109 109
      */
110 110
     public function printText($string, $strtoupper = false)
111 111
     {
112
-        if(!$strtoupper){
112
+        if (!$strtoupper) {
113 113
             print trim($string) . PHP_EOL;
114
-        }else{
114
+        } else {
115 115
             print strtoupper(trim($string) . PHP_EOL);
116 116
         }
117 117
 
@@ -123,8 +123,8 @@  discard block
 block discarded – undo
123 123
      */
124 124
     public function runAsyncProcess($cmd)
125 125
     {
126
-        if (substr(php_uname(), 0, 7) === 'Windows'){
127
-            pclose(popen('start /B '. $cmd, 'r'));
126
+        if (substr(php_uname(), 0, 7) === 'Windows') {
127
+            pclose(popen('start /B ' . $cmd, 'r'));
128 128
         }
129 129
         else {
130 130
             exec($cmd . ' > /dev/null &');
Please login to merge, or discard this patch.
Braces   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
     {
112 112
         if(!$strtoupper){
113 113
             print trim($string) . PHP_EOL;
114
-        }else{
114
+        } else{
115 115
             print strtoupper(trim($string) . PHP_EOL);
116 116
         }
117 117
 
@@ -125,8 +125,7 @@  discard block
 block discarded – undo
125 125
     {
126 126
         if (substr(php_uname(), 0, 7) === 'Windows'){
127 127
             pclose(popen('start /B '. $cmd, 'r'));
128
-        }
129
-        else {
128
+        } else {
130 129
             exec($cmd . ' > /dev/null &');
131 130
         }
132 131
     }
Please login to merge, or discard this patch.
src/phpFastCache/Core/Pool/CacheItemPoolTrait.php 3 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -148,9 +148,9 @@
 block discarded – undo
148 148
                              * Reset the Item
149 149
                              */
150 150
                             $item->set(null)
151
-                              ->expiresAfter(abs((int) $this->getConfig()[ 'defaultTtl' ]))
152
-                              ->setHit(false)
153
-                              ->setTags([]);
151
+                                ->expiresAfter(abs((int) $this->getConfig()[ 'defaultTtl' ]))
152
+                                ->setHit(false)
153
+                                ->setTags([]);
154 154
                             if($this->config['itemDetailedDate']){
155 155
 
156 156
                                 /**
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
     public function getItem($key)
63 63
     {
64 64
         if (is_string($key)) {
65
-            if (preg_match('~([' . preg_quote(self::$unsupportedKeyChars, '~') . ']+)~', $key, $matches)){
65
+            if (preg_match('~([' . preg_quote(self::$unsupportedKeyChars, '~') . ']+)~', $key, $matches)) {
66 66
                 throw new phpFastCacheInvalidArgumentException('Unsupported key character detected: "' . $matches[1] . '". Please check: https://github.com/PHPSocialNetwork/phpfastcache/wiki/%5BV6%5D-Unsupported-characters-in-key-identifiers');
67 67
             }
68 68
             if (!array_key_exists($key, $this->itemInstances)) {
@@ -81,14 +81,14 @@  discard block
 block discarded – undo
81 81
                     $driverArray = $this->driverRead($item);
82 82
 
83 83
                     if ($driverArray) {
84
-                        if(!is_array($driverArray)){
84
+                        if (!is_array($driverArray)) {
85 85
                             throw new phpFastCacheCoreException(sprintf('The driverRead method returned an unexpected variable type: %s', gettype($driverArray)));
86 86
                         }
87 87
                         $driverData = $this->driverUnwrapData($driverArray);
88 88
 
89
-                        if($this->getConfig()[ 'preventCacheSlams' ]){
90
-                            while($driverData instanceof ItemBatch) {
91
-                                if($driverData->getItemDate()->getTimestamp() + $this->getConfig()[ 'cacheSlamsTimeout' ] < time()){
89
+                        if ($this->getConfig()['preventCacheSlams']) {
90
+                            while ($driverData instanceof ItemBatch) {
91
+                                if ($driverData->getItemDate()->getTimestamp() + $this->getConfig()['cacheSlamsTimeout'] < time()) {
92 92
                                     /**
93 93
                                      * The timeout has been reached
94 94
                                      * Consider that the batch has
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
                         $item->set($driverData);
121 121
                         $item->expiresAt($this->driverUnwrapEdate($driverArray));
122 122
 
123
-                        if($this->config['itemDetailedDate']){
123
+                        if ($this->config['itemDetailedDate']) {
124 124
 
125 125
                             /**
126 126
                              * If the itemDetailedDate has been
@@ -148,10 +148,10 @@  discard block
 block discarded – undo
148 148
                              * Reset the Item
149 149
                              */
150 150
                             $item->set(null)
151
-                              ->expiresAfter(abs((int) $this->getConfig()[ 'defaultTtl' ]))
151
+                              ->expiresAfter(abs((int) $this->getConfig()['defaultTtl']))
152 152
                               ->setHit(false)
153 153
                               ->setTags([]);
154
-                            if($this->config['itemDetailedDate']){
154
+                            if ($this->config['itemDetailedDate']) {
155 155
 
156 156
                                 /**
157 157
                                  * If the itemDetailedDate has been
@@ -164,8 +164,8 @@  discard block
 block discarded – undo
164 164
                         } else {
165 165
                             $item->setHit(true);
166 166
                         }
167
-                    }else{
168
-                        $item->expiresAfter(abs((int) $this->getConfig()[ 'defaultTtl' ]));
167
+                    } else {
168
+                        $item->expiresAfter(abs((int) $this->getConfig()['defaultTtl']));
169 169
                     }
170 170
                 }
171 171
             }
@@ -178,9 +178,9 @@  discard block
 block discarded – undo
178 178
          * @param $this ExtendedCacheItemPoolInterface
179 179
          * @param $this ExtendedCacheItemInterface
180 180
          */
181
-        $this->eventManager->dispatch('CacheGetItem', $this, $this->itemInstances[ $key ]);
181
+        $this->eventManager->dispatch('CacheGetItem', $this, $this->itemInstances[$key]);
182 182
 
183
-        return $this->itemInstances[ $key ];
183
+        return $this->itemInstances[$key];
184 184
     }
185 185
 
186 186
     /**
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
     public function setItem(CacheItemInterface $item)
192 192
     {
193 193
         if ($this->getClassNamespace() . '\\Item' === get_class($item)) {
194
-            $this->itemInstances[ $item->getKey() ] = $item;
194
+            $this->itemInstances[$item->getKey()] = $item;
195 195
 
196 196
             return $this;
197 197
         } else {
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
     {
209 209
         $collection = [];
210 210
         foreach ($keys as $key) {
211
-            $collection[ $key ] = $this->getItem($key);
211
+            $collection[$key] = $this->getItem($key);
212 212
         }
213 213
 
214 214
         return $collection;
@@ -305,8 +305,8 @@  discard block
 block discarded – undo
305 305
          * @var ExtendedCacheItemInterface $item
306 306
          */
307 307
         if (!array_key_exists($item->getKey(), $this->itemInstances)) {
308
-            $this->itemInstances[ $item->getKey() ] = $item;
309
-        } else if(spl_object_hash($item) !== spl_object_hash($this->itemInstances[ $item->getKey() ])){
308
+            $this->itemInstances[$item->getKey()] = $item;
309
+        } else if (spl_object_hash($item) !== spl_object_hash($this->itemInstances[$item->getKey()])) {
310 310
             throw new \RuntimeException('Spl object hash mismatches ! You probably tried to save a detached item which has been already retrieved from cache.');
311 311
         }
312 312
 
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
         $this->eventManager->dispatch('CacheSaveItem', $this, $item);
319 319
 
320 320
 
321
-        if($this->getConfig()[ 'preventCacheSlams' ]){
321
+        if ($this->getConfig()['preventCacheSlams']) {
322 322
             /**
323 323
              * @var $itemBatch ExtendedCacheItemInterface
324 324
              */
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
             $itemBatch = $class->newInstanceArgs([$this, $item->getKey()]);
327 327
             $itemBatch->setEventManager($this->eventManager)
328 328
                         ->set(new ItemBatch($item->getKey(), new \DateTime()))
329
-                        ->expiresAfter($this->getConfig()[ 'cacheSlamsTimeout' ]);
329
+                        ->expiresAfter($this->getConfig()['cacheSlamsTimeout']);
330 330
 
331 331
             /**
332 332
              * To avoid SPL mismatches
@@ -358,8 +358,8 @@  discard block
 block discarded – undo
358 358
     public function saveDeferred(CacheItemInterface $item)
359 359
     {
360 360
         if (!array_key_exists($item->getKey(), $this->itemInstances)) {
361
-            $this->itemInstances[ $item->getKey() ] = $item;
362
-        }else if(spl_object_hash($item) !== spl_object_hash($this->itemInstances[ $item->getKey() ])){
361
+            $this->itemInstances[$item->getKey()] = $item;
362
+        } else if (spl_object_hash($item) !== spl_object_hash($this->itemInstances[$item->getKey()])) {
363 363
             throw new \RuntimeException('Spl object hash mismatches ! You probably tried to save a detached item which has been already retrieved from cache.');
364 364
         }
365 365
 
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
          */
371 371
         $this->eventManager->dispatch('CacheSaveDeferredItem', $this, $item);
372 372
 
373
-        return $this->deferredList[ $item->getKey() ] = $item;
373
+        return $this->deferredList[$item->getKey()] = $item;
374 374
     }
375 375
 
376 376
     /**
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
         foreach ($this->deferredList as $key => $item) {
391 391
             $result = $this->save($item);
392 392
             if ($return !== false) {
393
-                unset($this->deferredList[ $key ]);
393
+                unset($this->deferredList[$key]);
394 394
                 $return = $result;
395 395
             }
396 396
         }
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
                         } else {
165 165
                             $item->setHit(true);
166 166
                         }
167
-                    }else{
167
+                    } else{
168 168
                         $item->expiresAfter(abs((int) $this->getConfig()[ 'defaultTtl' ]));
169 169
                     }
170 170
                 }
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
     {
360 360
         if (!array_key_exists($item->getKey(), $this->itemInstances)) {
361 361
             $this->itemInstances[ $item->getKey() ] = $item;
362
-        }else if(spl_object_hash($item) !== spl_object_hash($this->itemInstances[ $item->getKey() ])){
362
+        } else if(spl_object_hash($item) !== spl_object_hash($this->itemInstances[ $item->getKey() ])){
363 363
             throw new \RuntimeException('Spl object hash mismatches ! You probably tried to save a detached item which has been already retrieved from cache.');
364 364
         }
365 365
 
Please login to merge, or discard this patch.
src/phpFastCache/CacheManager.php 1 patch
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -62,95 +62,95 @@  discard block
 block discarded – undo
62 62
         /**
63 63
          * Specify if the item must provide detailed creation/modification dates
64 64
          */
65
-      'itemDetailedDate' => false,
65
+        'itemDetailedDate' => false,
66 66
 
67 67
         /**
68 68
          * Automatically attempt to fallback to temporary directory
69 69
          * if the cache fails to write on the specified directory
70 70
          */
71
-      'autoTmpFallback' => false,
71
+        'autoTmpFallback' => false,
72 72
 
73 73
         /**
74 74
          * Provide a secure file manipulation mechanism
75 75
          * on intensive usage the performance can be affected.
76 76
          */
77
-      'secureFileManipulation' => false,
77
+        'secureFileManipulation' => false,
78 78
 
79 79
         /**
80 80
          * Ignore Symfony notice for Symfony project which
81 81
          * do not makes use of PhpFastCache's Symfony Bundle
82 82
          */
83
-      'ignoreSymfonyNotice' => false,
83
+        'ignoreSymfonyNotice' => false,
84 84
 
85 85
         /**
86 86
          * Default time-to-live in second
87 87
          */
88
-      'defaultTtl' => 900,
88
+        'defaultTtl' => 900,
89 89
 
90 90
         /**
91 91
          * Default key hash function
92 92
          * (md5 by default)
93 93
          */
94
-      'defaultKeyHashFunction' => '',
94
+        'defaultKeyHashFunction' => '',
95 95
 
96 96
         /**
97 97
          * The securityKey that will be used
98 98
          * to create sub-directory
99 99
          * (Files-based drivers only)
100 100
          */
101
-      'securityKey' => 'auto',
101
+        'securityKey' => 'auto',
102 102
 
103 103
         /**
104 104
          * Auto-generate .htaccess if it's missing
105 105
          * (Files-based drivers only)
106 106
          */
107
-      'htaccess' => true,
107
+        'htaccess' => true,
108 108
 
109 109
         /**
110 110
          * Default files chmod
111 111
          * 0777 recommended
112 112
          * (Files-based drivers only)
113 113
          */
114
-      'default_chmod' => 0777,
114
+        'default_chmod' => 0777,
115 115
 
116 116
         /**
117 117
          * The path where we will writecache files
118 118
          * default value if empty: sys_get_temp_dir()
119 119
          * (Files-based drivers only)
120 120
          */
121
-      'path' => '',
121
+        'path' => '',
122 122
 
123 123
         /**
124 124
          * Driver fallback in case of failure.
125 125
          * Caution, in case of failure an E_WARNING
126 126
          * error will always be raised
127 127
          */
128
-      'fallback' => false,
128
+        'fallback' => false,
129 129
 
130 130
         /**
131 131
          * Maximum size (bytes) of object store in memory
132 132
          * (Memcache(d) drivers only)
133 133
          */
134
-      'limited_memory_each_object' => 4096,
134
+        'limited_memory_each_object' => 4096,
135 135
 
136 136
         /**
137 137
          * Compress stored data, if the backend supports it
138 138
          * (Memcache(d) drivers only)
139 139
          */
140
-      'compress_data' => false,
140
+        'compress_data' => false,
141 141
 
142 142
         /**
143 143
          * Prevent cache slams when
144 144
          * making use of heavy cache
145 145
          * items
146 146
          */
147
-      'preventCacheSlams' => false,
147
+        'preventCacheSlams' => false,
148 148
 
149 149
         /**
150 150
          * Cache slams timeout
151 151
          * in seconds
152 152
          */
153
-      'cacheSlamsTimeout' => 15,
153
+        'cacheSlamsTimeout' => 15,
154 154
 
155 155
     ];
156 156
 
@@ -333,24 +333,24 @@  discard block
 block discarded – undo
333 333
     public static function getStaticSystemDrivers()
334 334
     {
335 335
         return [
336
-          'Apc',
337
-          'Apcu',
338
-          'Cassandra',
339
-          'Couchbase',
340
-          'Couchdb',
341
-          'Devnull',
342
-          'Files',
343
-          'Leveldb',
344
-          'Memcache',
345
-          'Memcached',
346
-          'Memstatic',
347
-          'Mongodb',
348
-          'Predis',
349
-          'Redis',
350
-          'Ssdb',
351
-          'Sqlite',
352
-          'Wincache',
353
-          'Xcache',
336
+            'Apc',
337
+            'Apcu',
338
+            'Cassandra',
339
+            'Couchbase',
340
+            'Couchdb',
341
+            'Devnull',
342
+            'Files',
343
+            'Leveldb',
344
+            'Memcache',
345
+            'Memcached',
346
+            'Memstatic',
347
+            'Mongodb',
348
+            'Predis',
349
+            'Redis',
350
+            'Ssdb',
351
+            'Sqlite',
352
+            'Wincache',
353
+            'Xcache',
354 354
         ];
355 355
     }
356 356
 
@@ -360,9 +360,9 @@  discard block
 block discarded – undo
360 360
     public static function getStaticAllDrivers()
361 361
     {
362 362
         return array_merge(self::getStaticSystemDrivers(), [
363
-          'Devtrue',
364
-          'Devfalse',
365
-          'Cookie',
363
+            'Devtrue',
364
+            'Devfalse',
365
+            'Cookie',
366 366
         ]);
367 367
     }
368 368
 
Please login to merge, or discard this patch.
src/phpFastCache/Entities/ItemBatch.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -39,10 +39,10 @@
 block discarded – undo
39 39
      */
40 40
     public function __construct($itemKey, \DateTime $itemDate)
41 41
     {
42
-        if(is_string($itemKey)){
42
+        if (is_string($itemKey)) {
43 43
             $this->itemKey = $itemKey;
44 44
             $this->itemDate = $itemDate;
45
-        }else{
45
+        } else {
46 46
             throw new phpFastCacheInvalidArgumentException(sprintf('$itemKey must be a string, got "%s" instead', gettype($itemKey)));
47 47
         }
48 48
     }
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@
 block discarded – undo
42 42
         if(is_string($itemKey)){
43 43
             $this->itemKey = $itemKey;
44 44
             $this->itemDate = $itemDate;
45
-        }else{
45
+        } else{
46 46
             throw new phpFastCacheInvalidArgumentException(sprintf('$itemKey must be a string, got "%s" instead', gettype($itemKey)));
47 47
         }
48 48
     }
Please login to merge, or discard this patch.