Completed
Push — v5.1 ( 1e2251...5d1cda )
by Georges
03:25
created
src/phpFastCache/Core/Item/ItemExtendedTrait.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -67,9 +67,9 @@  discard block
 block discarded – undo
67 67
      */
68 68
     public function getCreationDate()
69 69
     {
70
-        if($this->driver->getConfig()['itemDetailedDate']){
70
+        if ($this->driver->getConfig()['itemDetailedDate']) {
71 71
             return $this->creationDate;
72
-        }else{
72
+        } else {
73 73
             throw new \LogicException('Cannot access to the creation date when the "itemDetailedDate" configuration is disabled.');
74 74
         }
75 75
     }
@@ -81,10 +81,10 @@  discard block
 block discarded – undo
81 81
      */
82 82
     public function setCreationDate(\DateTimeInterface $date)
83 83
     {
84
-        if($this->driver->getConfig()['itemDetailedDate']){
84
+        if ($this->driver->getConfig()['itemDetailedDate']) {
85 85
             $this->creationDate = $date;
86 86
             return $this;
87
-        }else{
87
+        } else {
88 88
             throw new \LogicException('Cannot access to the creation date when the "itemDetailedDate" configuration is disabled.');
89 89
         }
90 90
     }
@@ -95,9 +95,9 @@  discard block
 block discarded – undo
95 95
      */
96 96
     public function getModificationDate()
97 97
     {
98
-        if($this->driver->getConfig()['itemDetailedDate']){
98
+        if ($this->driver->getConfig()['itemDetailedDate']) {
99 99
             return $this->modificationDate;
100
-        }else{
100
+        } else {
101 101
             throw new \LogicException('Cannot access to the modification date when the "itemDetailedDate" configuration is disabled.');
102 102
         }
103 103
     }
@@ -109,10 +109,10 @@  discard block
 block discarded – undo
109 109
      */
110 110
     public function setModificationDate(\DateTimeInterface $date)
111 111
     {
112
-        if($this->driver->getConfig()['itemDetailedDate']){
112
+        if ($this->driver->getConfig()['itemDetailedDate']) {
113 113
             $this->modificationDate = $date;
114 114
             return $this;
115
-        }else{
115
+        } else {
116 116
             throw new \LogicException('Cannot access to the creation date when the "itemDetailedDate" configuration is disabled.');
117 117
         }
118 118
     }
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
     public function removeTag($tagName)
280 280
     {
281 281
         if (($key = array_search($tagName, $this->tags)) !== false) {
282
-            unset($this->tags[ $key ]);
282
+            unset($this->tags[$key]);
283 283
             $this->removedTags[] = $tagName;
284 284
         }
285 285
 
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
     final public function __debugInfo()
346 346
     {
347 347
         $info = get_object_vars($this);
348
-        $info[ 'driver' ] = 'object(' . get_class($info[ 'driver' ]) . ')';
348
+        $info['driver'] = 'object(' . get_class($info['driver']) . ')';
349 349
 
350 350
         return (array) $info;
351 351
     }
Please login to merge, or discard this patch.
Braces   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
     {
70 70
         if($this->driver->getConfig()['itemDetailedDate']){
71 71
             return $this->creationDate;
72
-        }else{
72
+        } else{
73 73
             throw new \LogicException('Cannot access to the creation date when the "itemDetailedDate" configuration is disabled.');
74 74
         }
75 75
     }
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
         if($this->driver->getConfig()['itemDetailedDate']){
85 85
             $this->creationDate = $date;
86 86
             return $this;
87
-        }else{
87
+        } else{
88 88
             throw new \LogicException('Cannot access to the creation date when the "itemDetailedDate" configuration is disabled.');
89 89
         }
90 90
     }
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
     {
98 98
         if($this->driver->getConfig()['itemDetailedDate']){
99 99
             return $this->modificationDate;
100
-        }else{
100
+        } else{
101 101
             throw new \LogicException('Cannot access to the modification date when the "itemDetailedDate" configuration is disabled.');
102 102
         }
103 103
     }
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
         if($this->driver->getConfig()['itemDetailedDate']){
113 113
             $this->modificationDate = $date;
114 114
             return $this;
115
-        }else{
115
+        } else{
116 116
             throw new \LogicException('Cannot access to the creation date when the "itemDetailedDate" configuration is disabled.');
117 117
         }
118 118
     }
Please login to merge, or discard this patch.
src/phpFastCache/Util/MemcacheDriverCollisionDetectorTrait.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@
 block discarded – undo
27 27
                 return true;
28 28
             } else if (constant($CONSTANT_NAME) !== $driverName) {
29 29
                 trigger_error('Memcache collision detected, you used both Memcache and Memcached driver in your script, this may leads to unexpected behaviours',
30
-                  E_USER_WARNING);
30
+                    E_USER_WARNING);
31 31
 
32 32
                 return false;
33 33
             }
Please login to merge, or discard this patch.
tests/AbstractProxy.test.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,10 +42,10 @@
 block discarded – undo
42 42
 if (!is_object($driverInstance->getItem('test'))) {
43 43
     echo '[FAIL] $driverInstance->getItem() returned an invalid var type:' . gettype($driverInstance) . "\n";
44 44
     $status = 1;
45
-}else if(!($driverInstance->getItem('test') instanceof ExtendedCacheItemInterface)){
45
+} else if (!($driverInstance->getItem('test') instanceof ExtendedCacheItemInterface)) {
46 46
     echo '[FAIL] $driverInstance->getItem() returned an invalid class that does not implements ExtendedCacheItemInterface: ' . get_class($driverInstance) . "\n";
47 47
     $status = 1;
48
-}else{
48
+} else {
49 49
     echo '[PASS] $driverInstance->getItem() returned a valid class that implements ExtendedCacheItemInterface: ' . get_class($driverInstance) . "\n";
50 50
 }
51 51
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,10 +42,10 @@
 block discarded – undo
42 42
 if (!is_object($driverInstance->getItem('test'))) {
43 43
     echo '[FAIL] $driverInstance->getItem() returned an invalid var type:' . gettype($driverInstance) . "\n";
44 44
     $status = 1;
45
-}else if(!($driverInstance->getItem('test') instanceof ExtendedCacheItemInterface)){
45
+} else if(!($driverInstance->getItem('test') instanceof ExtendedCacheItemInterface)){
46 46
     echo '[FAIL] $driverInstance->getItem() returned an invalid class that does not implements ExtendedCacheItemInterface: ' . get_class($driverInstance) . "\n";
47 47
     $status = 1;
48
-}else{
48
+} else{
49 49
     echo '[PASS] $driverInstance->getItem() returned a valid class that implements ExtendedCacheItemInterface: ' . get_class($driverInstance) . "\n";
50 50
 }
51 51
 
Please login to merge, or discard this patch.
src/phpFastCache/Entities/driverStatistic.php 1 patch
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
     }
53 53
 
54 54
     /**
55
-     * @return int|bool Return size in octet or false if no information available
55
+     * @return string Return size in octet or false if no information available
56 56
      */
57 57
     public function getSize()
58 58
     {
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
     }
61 61
 
62 62
     /**
63
-     * @return mixed
63
+     * @return string
64 64
      */
65 65
     public function getData()
66 66
     {
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
     }
69 69
 
70 70
     /**
71
-     * @param $info
71
+     * @param string $info
72 72
      * @return $this
73 73
      */
74 74
     public function setInfo($info)
Please login to merge, or discard this patch.
src/phpFastCache/Core/Pool/ExtendedCacheItemPoolTrait.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -334,7 +334,7 @@
 block discarded – undo
334 334
 
335 335
     /**
336 336
      * @internal This method de-register an item from $this->itemInstances
337
-     * @param CacheItemInterface|string $item
337
+     * @param CacheItemInterface $item
338 338
      * @throws \InvalidArgumentException
339 339
      */
340 340
     protected function deregisterItem($item)
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
      */
48 48
     public function getItemsAsJsonString(array $keys = [], $option = 0, $depth = 512)
49 49
     {
50
-        $callback = function(CacheItemInterface $item){
50
+        $callback = function(CacheItemInterface $item) {
51 51
             return $item->get();
52 52
         };
53 53
         return json_encode(array_map($callback, array_values($this->getItems($keys))), $option, $depth);
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
                  *
76 76
                  * #headache
77 77
                  */
78
-                return array_filter($this->getItems(array_unique(array_keys($items))), function(ExtendedCacheItemInterface $item){
78
+                return array_filter($this->getItems(array_unique(array_keys($items))), function(ExtendedCacheItemInterface $item) {
79 79
                     return $item->isHit();
80 80
                 });
81 81
             } else {
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
      */
118 118
     public function getItemsByTagsAsJsonString(array $tagNames, $option = 0, $depth = 512)
119 119
     {
120
-        $callback = function(CacheItemInterface $item){
120
+        $callback = function(CacheItemInterface $item) {
121 121
             return $item->get();
122 122
         };
123 123
 
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
      */
303 303
     public function detachItem(CacheItemInterface $item)
304 304
     {
305
-        if(isset($this->itemInstances[$item->getKey()])){
305
+        if (isset($this->itemInstances[$item->getKey()])) {
306 306
             $this->deregisterItem($item);
307 307
         }
308 308
     }
@@ -324,9 +324,9 @@  discard block
 block discarded – undo
324 324
      */
325 325
     public function attachItem(CacheItemInterface $item)
326 326
     {
327
-        if(isset($this->itemInstances[$item->getKey()]) && spl_object_hash($item) !== spl_object_hash($this->itemInstances[ $item->getKey() ])){
327
+        if (isset($this->itemInstances[$item->getKey()]) && spl_object_hash($item) !== spl_object_hash($this->itemInstances[$item->getKey()])) {
328 328
             throw new \LogicException('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.');
329
-        }else{
329
+        } else {
330 330
             $this->itemInstances[$item->getKey()] = $item;
331 331
         }
332 332
     }
@@ -339,15 +339,15 @@  discard block
 block discarded – undo
339 339
      */
340 340
     protected function deregisterItem($item)
341 341
     {
342
-        if($item instanceof CacheItemInterface){
343
-            unset($this->itemInstances[ $item->getKey() ]);
342
+        if ($item instanceof CacheItemInterface) {
343
+            unset($this->itemInstances[$item->getKey()]);
344 344
 
345
-        }else if(is_string($item)){
346
-            unset($this->itemInstances[ $item ]);
347
-        }else{
345
+        } else if (is_string($item)) {
346
+            unset($this->itemInstances[$item]);
347
+        } else {
348 348
             throw new \InvalidArgumentException('Invalid type for $item variable');
349 349
         }
350
-        if(gc_enabled()){
350
+        if (gc_enabled()) {
351 351
             gc_collect_cycles();
352 352
         }
353 353
     }
@@ -363,8 +363,8 @@  discard block
 block discarded – undo
363 363
      */
364 364
     public function isAttached(CacheItemInterface $item)
365 365
     {
366
-        if(isset($this->itemInstances[$item->getKey()])){
367
-            return spl_object_hash($item) === spl_object_hash($this->itemInstances[ $item->getKey() ]);
366
+        if (isset($this->itemInstances[$item->getKey()])) {
367
+            return spl_object_hash($item) === spl_object_hash($this->itemInstances[$item->getKey()]);
368 368
         }
369 369
         return null;
370 370
     }
Please login to merge, or discard this patch.
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
     {
327 327
         if(isset($this->itemInstances[$item->getKey()]) && spl_object_hash($item) !== spl_object_hash($this->itemInstances[ $item->getKey() ])){
328 328
             throw new \LogicException('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.');
329
-        }else{
329
+        } else{
330 330
             $this->itemInstances[$item->getKey()] = $item;
331 331
         }
332 332
     }
@@ -342,9 +342,9 @@  discard block
 block discarded – undo
342 342
         if($item instanceof CacheItemInterface){
343 343
             unset($this->itemInstances[ $item->getKey() ]);
344 344
 
345
-        }else if(is_string($item)){
345
+        } else if(is_string($item)){
346 346
             unset($this->itemInstances[ $item ]);
347
-        }else{
347
+        } else{
348 348
             throw new \InvalidArgumentException('Invalid type for $item variable');
349 349
         }
350 350
         if(gc_enabled()){
Please login to merge, or discard this patch.
tests/AttachingDetachingMethods.test.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -24,17 +24,17 @@  discard block
 block discarded – undo
24 24
 if (!is_object($driverInstance)) {
25 25
     echo '[FAIL] CacheManager::getInstance() returned an invalid variable type:' . gettype($driverInstance) . "\n";
26 26
     $status = 1;
27
-}else if(!($driverInstance instanceof CacheItemPoolInterface)){
27
+} else if (!($driverInstance instanceof CacheItemPoolInterface)) {
28 28
     echo '[FAIL] CacheManager::getInstance() returned an invalid class:' . get_class($driverInstance) . "\n";
29 29
     $status = 1;
30
-}else{
30
+} else {
31 31
     $key = 'test_attaching_detaching';
32 32
 
33 33
     $itemDetached = $driverInstance->getItem($key);
34 34
     $driverInstance->detachItem($itemDetached);
35 35
     $itemAttached = $driverInstance->getItem($key);
36 36
 
37
-    if(!$driverInstance->isAttached($itemDetached))
37
+    if (!$driverInstance->isAttached($itemDetached))
38 38
     {
39 39
         echo '[PASS] ExtendedCacheItemPoolInterface::isAttached() identified $itemDetached as being detached.' . "\n";
40 40
     }
@@ -44,11 +44,11 @@  discard block
 block discarded – undo
44 44
         $status = 1;
45 45
     }
46 46
 
47
-    try{
47
+    try {
48 48
         $driverInstance->attachItem($itemDetached);
49 49
         echo '[FAIL] ExtendedCacheItemPoolInterface::attachItem() attached $itemDetached without trowing an error.' . "\n";
50 50
         $status = 1;
51
-    }catch(\LogicException $e){
51
+    } catch (\LogicException $e) {
52 52
         echo '[PASS] ExtendedCacheItemPoolInterface::attachItem() failed to attach $itemDetached by trowing a LogicException exception.' . "\n";
53 53
     }
54 54
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -5 removed lines patch added patch discarded remove patch
@@ -24,10 +24,10 @@  discard block
 block discarded – undo
24 24
 if (!is_object($driverInstance)) {
25 25
     echo '[FAIL] CacheManager::getInstance() returned an invalid variable type:' . gettype($driverInstance) . "\n";
26 26
     $status = 1;
27
-}else if(!($driverInstance instanceof CacheItemPoolInterface)){
27
+} else if(!($driverInstance instanceof CacheItemPoolInterface)){
28 28
     echo '[FAIL] CacheManager::getInstance() returned an invalid class:' . get_class($driverInstance) . "\n";
29 29
     $status = 1;
30
-}else{
30
+} else{
31 31
     $key = 'test_attaching_detaching';
32 32
 
33 33
     $itemDetached = $driverInstance->getItem($key);
@@ -37,8 +37,7 @@  discard block
 block discarded – undo
37 37
     if(!$driverInstance->isAttached($itemDetached))
38 38
     {
39 39
         echo '[PASS] ExtendedCacheItemPoolInterface::isAttached() identified $itemDetached as being detached.' . "\n";
40
-    }
41
-    else
40
+    } else
42 41
     {
43 42
         echo '[FAIL] ExtendedCacheItemPoolInterface::isAttached() failed to identify $itemDetached as to be detached.' . "\n";
44 43
         $status = 1;
@@ -48,7 +47,7 @@  discard block
 block discarded – undo
48 47
         $driverInstance->attachItem($itemDetached);
49 48
         echo '[FAIL] ExtendedCacheItemPoolInterface::attachItem() attached $itemDetached without trowing an error.' . "\n";
50 49
         $status = 1;
51
-    }catch(\LogicException $e){
50
+    } catch(\LogicException $e){
52 51
         echo '[PASS] ExtendedCacheItemPoolInterface::attachItem() failed to attach $itemDetached by trowing a LogicException exception.' . "\n";
53 52
     }
54 53
 
Please login to merge, or discard this patch.