Completed
Push — V6 ( bd4c71...8eea0b )
by Georges
02:23
created
tests/Memstatic.test.php 3 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -33,20 +33,20 @@
 block discarded – undo
33 33
 $cacheResult = $cacheInstance->getItem($cacheKey)->get();
34 34
 
35 35
 if($cacheResult === $randomStr){
36
-  echo "[PASS] The cache key value match, got expected value '{$cacheResult}'\n";
36
+    echo "[PASS] The cache key value match, got expected value '{$cacheResult}'\n";
37 37
 }else{
38
-  echo "[FAIL] The cache key value match expected value '{$randomStr}', got '{$cacheResult}'\n";
39
-  $status = 1;
38
+    echo "[FAIL] The cache key value match expected value '{$randomStr}', got '{$cacheResult}'\n";
39
+    $status = 1;
40 40
 }
41 41
 echo "Clearing the whole cache to test item cleaning...\n";
42 42
 $cacheInstance->clear();
43 43
 $cacheResult = ($cacheInstance->getItem($cacheKey)->isHit() === false && $cacheInstance->getItem($cacheKey)->get() === null);
44 44
 
45 45
 if($cacheResult === true){
46
-  echo "[PASS] The cache item is null as expected\n";
46
+    echo "[PASS] The cache item is null as expected\n";
47 47
 }else{
48
-  echo "[FAIL] The cache is not null'\n";
49
-  $status = 1;
48
+    echo "[FAIL] The cache is not null'\n";
49
+    $status = 1;
50 50
 }
51 51
 
52 52
 exit($status);
53 53
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -32,9 +32,9 @@  discard block
 block discarded – undo
32 32
 
33 33
 $cacheResult = $cacheInstance->getItem($cacheKey)->get();
34 34
 
35
-if($cacheResult === $randomStr){
35
+if ($cacheResult === $randomStr) {
36 36
   echo "[PASS] The cache key value match, got expected value '{$cacheResult}'\n";
37
-}else{
37
+} else {
38 38
   echo "[FAIL] The cache key value match expected value '{$randomStr}', got '{$cacheResult}'\n";
39 39
   $status = 1;
40 40
 }
@@ -42,9 +42,9 @@  discard block
 block discarded – undo
42 42
 $cacheInstance->clear();
43 43
 $cacheResult = ($cacheInstance->getItem($cacheKey)->isHit() === false && $cacheInstance->getItem($cacheKey)->get() === null);
44 44
 
45
-if($cacheResult === true){
45
+if ($cacheResult === true) {
46 46
   echo "[PASS] The cache item is null as expected\n";
47
-}else{
47
+} else {
48 48
   echo "[FAIL] The cache is not null'\n";
49 49
   $status = 1;
50 50
 }
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 if (!class_exists('phpFastCache\CacheManager')) {
19 19
     echo "[FAIL] Autoload failed to find the CacheManager\n";
20 20
     $status = 255;
21
-}else{
21
+} else{
22 22
     echo "[PASS] Autoload successfully found the CacheManager\n";
23 23
 }
24 24
 
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 if (!interface_exists('Psr\Cache\CacheItemInterface')) {
29 29
     echo "[FAIL] Autoload failed to find the Psr CacheItemInterface\n";
30 30
     $status = 255;
31
-}else{
31
+} else{
32 32
     echo "[PASS] Autoload successfully found the Psr CacheItemInterface\n";
33 33
 }
34 34
 
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Memstatic/Driver.php 2 patches
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -29,9 +29,9 @@  discard block
 block discarded – undo
29 29
 {
30 30
     use DriverBaseTrait;
31 31
 
32
-  /**
33
-   * @var array
34
-   */
32
+    /**
33
+     * @var array
34
+     */
35 35
     protected $staticStack = [];
36 36
 
37 37
     /**
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
     {
86 86
         $key = md5($item->getKey());
87 87
         if(isset($this->staticStack[$key])){
88
-          return $this->staticStack[$key];
88
+            return $this->staticStack[$key];
89 89
         }
90 90
         return null;
91 91
     }
@@ -101,12 +101,12 @@  discard block
 block discarded – undo
101 101
          * Check for Cross-Driver type confusion
102 102
          */
103 103
         if ($item instanceof Item) {
104
-          $key = md5($item->getKey());
105
-          if(isset($this->staticStack[$key])){
106
-              unset($this->staticStack[$key]);
107
-              return true;
108
-          }
109
-          return false;
104
+            $key = md5($item->getKey());
105
+            if(isset($this->staticStack[$key])){
106
+                unset($this->staticStack[$key]);
107
+                return true;
108
+            }
109
+            return false;
110 110
         } else {
111 111
             throw new \InvalidArgumentException('Cross-Driver type confusion detected');
112 112
         }
@@ -117,9 +117,9 @@  discard block
 block discarded – undo
117 117
      */
118 118
     protected function driverClear()
119 119
     {
120
-      unset($this->staticStack);
121
-      $this->staticStack = [];
122
-      return true;
120
+        unset($this->staticStack);
121
+        $this->staticStack = [];
122
+        return true;
123 123
     }
124 124
 
125 125
     /**
@@ -143,9 +143,9 @@  discard block
 block discarded – undo
143 143
     {
144 144
         $stat = new driverStatistic();
145 145
         $stat->setInfo('[Memstatic] A memory static driver')
146
-          ->setSize(mb_strlen(serialize($this->staticStack)))
147
-          ->setData(implode(', ', array_keys($this->itemInstances)))
148
-          ->setRawData($this->staticStack);
146
+            ->setSize(mb_strlen(serialize($this->staticStack)))
147
+            ->setData(implode(', ', array_keys($this->itemInstances)))
148
+            ->setRawData($this->staticStack);
149 149
 
150 150
         return $stat;
151 151
     }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
     protected function driverRead(CacheItemInterface $item)
85 85
     {
86 86
         $key = md5($item->getKey());
87
-        if(isset($this->staticStack[$key])){
87
+        if (isset($this->staticStack[$key])) {
88 88
           return $this->staticStack[$key];
89 89
         }
90 90
         return null;
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
          */
103 103
         if ($item instanceof Item) {
104 104
           $key = md5($item->getKey());
105
-          if(isset($this->staticStack[$key])){
105
+          if (isset($this->staticStack[$key])) {
106 106
               unset($this->staticStack[$key]);
107 107
               return true;
108 108
           }
Please login to merge, or discard this patch.
src/phpFastCache/Core/Pool/ExtendedCacheItemPoolTrait.php 3 patches
Doc Comments   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,6 +46,7 @@  discard block
 block discarded – undo
46 46
 
47 47
     /**
48 48
      * @inheritdoc
49
+     * @param string $tagName
49 50
      */
50 51
     public function getItemsByTag($tagName)
51 52
     {
@@ -416,7 +417,7 @@  discard block
 block discarded – undo
416 417
 
417 418
     /**
418 419
      * @internal This method de-register an item from $this->itemInstances
419
-     * @param CacheItemInterface|string $item
420
+     * @param CacheItemInterface $item
420 421
      * @throws \InvalidArgumentException
421 422
      */
422 423
     protected function deregisterItem($item)
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
      */
39 39
     public function getItemsAsJsonString(array $keys = [], $option = 0, $depth = 512)
40 40
     {
41
-        $callback = function (CacheItemInterface $item) {
41
+        $callback = function(CacheItemInterface $item) {
42 42
             return $item->get();
43 43
         };
44 44
         return json_encode(array_map($callback, array_values($this->getItems($keys))), $option, $depth);
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
         if (is_string($tagName)) {
53 53
             $driverResponse = $this->getItem($this->getTagKey($tagName));
54 54
             if ($driverResponse->isHit()) {
55
-                $items = (array)$driverResponse->get();
55
+                $items = (array) $driverResponse->get();
56 56
 
57 57
                 /**
58 58
                  * getItems() may provides expired item(s)
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
                  *
65 65
                  * #headache
66 66
                  */
67
-                return array_filter($this->getItems(array_unique(array_keys($items))), function (ExtendedCacheItemInterface $item) {
67
+                return array_filter($this->getItems(array_unique(array_keys($items))), function(ExtendedCacheItemInterface $item) {
68 68
                     return $item->isHit();
69 69
                 });
70 70
             } else {
@@ -82,9 +82,9 @@  discard block
 block discarded – undo
82 82
     {
83 83
         $items = [];
84 84
         foreach (array_unique($tagNames) as $tagName) {
85
-            if(is_string($tagName)){
85
+            if (is_string($tagName)) {
86 86
                 $items = array_merge($items, $this->getItemsByTag($tagName));
87
-            }else{
87
+            } else {
88 88
                 throw new InvalidArgumentException('$tagName must be a a string');
89 89
             }
90 90
         }
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 
103 103
         foreach ($items as $key => $item) {
104 104
             if (array_diff($tagNames, $item->getTags())) {
105
-                unset($items[ $key ]);
105
+                unset($items[$key]);
106 106
             }
107 107
         }
108 108
 
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
      */
116 116
     public function getItemsByTagsAsJsonString(array $tagNames, $option = 0, $depth = 512)
117 117
     {
118
-        $callback = function (CacheItemInterface $item) {
118
+        $callback = function(CacheItemInterface $item) {
119 119
             return $item->get();
120 120
         };
121 121
 
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
      */
387 387
     public function detachItem(CacheItemInterface $item)
388 388
     {
389
-        if (isset($this->itemInstances[ $item->getKey() ])) {
389
+        if (isset($this->itemInstances[$item->getKey()])) {
390 390
             $this->deregisterItem($item);
391 391
         }
392 392
     }
@@ -406,10 +406,10 @@  discard block
 block discarded – undo
406 406
      */
407 407
     public function attachItem(CacheItemInterface $item)
408 408
     {
409
-        if (isset($this->itemInstances[ $item->getKey() ]) && spl_object_hash($item) !== spl_object_hash($this->itemInstances[ $item->getKey() ])) {
409
+        if (isset($this->itemInstances[$item->getKey()]) && spl_object_hash($item) !== spl_object_hash($this->itemInstances[$item->getKey()])) {
410 410
             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.');
411 411
         } else {
412
-            $this->itemInstances[ $item->getKey() ] = $item;
412
+            $this->itemInstances[$item->getKey()] = $item;
413 413
         }
414 414
     }
415 415
 
@@ -422,10 +422,10 @@  discard block
 block discarded – undo
422 422
     protected function deregisterItem($item)
423 423
     {
424 424
         if ($item instanceof CacheItemInterface) {
425
-            unset($this->itemInstances[ $item->getKey() ]);
425
+            unset($this->itemInstances[$item->getKey()]);
426 426
 
427 427
         } else if (is_string($item)) {
428
-            unset($this->itemInstances[ $item ]);
428
+            unset($this->itemInstances[$item]);
429 429
         } else {
430 430
             throw new \InvalidArgumentException('Invalid type for $item variable');
431 431
         }
@@ -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
     }
@@ -466,8 +466,8 @@  discard block
 block discarded – undo
466 466
      */
467 467
     public function saveMultiple(...$items)
468 468
     {
469
-        if (isset($items[ 0 ]) && is_array($items[ 0 ])) {
470
-            foreach ($items[ 0 ] as $item) {
469
+        if (isset($items[0]) && is_array($items[0])) {
470
+            foreach ($items[0] as $item) {
471 471
                 $this->save($item);
472 472
             }
473 473
             return true;
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@
 block discarded – undo
84 84
         foreach (array_unique($tagNames) as $tagName) {
85 85
             if(is_string($tagName)){
86 86
                 $items = array_merge($items, $this->getItemsByTag($tagName));
87
-            }else{
87
+            } else{
88 88
                 throw new InvalidArgumentException('$tagName must be a a string');
89 89
             }
90 90
         }
Please login to merge, or discard this patch.
tests/ItemTags.test.php 3 patches
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -28,36 +28,36 @@
 block discarded – undo
28 28
     $item3 = $driverInstance->getItem('tag-test3');
29 29
 
30 30
     $item1->set('item-test_1')
31
-      ->expiresAfter(600)
32
-      ->addTag('tag-test_1')
33
-      ->addTag('tag-test_all')
34
-      ->addTag('tag-test_all2')
35
-      ->addTag('tag-test_all3');
31
+        ->expiresAfter(600)
32
+        ->addTag('tag-test_1')
33
+        ->addTag('tag-test_all')
34
+        ->addTag('tag-test_all2')
35
+        ->addTag('tag-test_all3');
36 36
 
37 37
     $item2->set('item-test_2')
38
-      ->expiresAfter(600)
39
-      ->addTag('tag-test_1')
40
-      ->addTag('tag-test_2')
41
-      ->addTag('tag-test_all')
42
-      ->addTag('tag-test_all2')
43
-      ->addTag('tag-test_all3');
38
+        ->expiresAfter(600)
39
+        ->addTag('tag-test_1')
40
+        ->addTag('tag-test_2')
41
+        ->addTag('tag-test_all')
42
+        ->addTag('tag-test_all2')
43
+        ->addTag('tag-test_all3');
44 44
 
45 45
     $item3->set('item-test_3')
46
-      ->expiresAfter(600)
47
-      ->addTag('tag-test_1')
48
-      ->addTag('tag-test_2')
49
-      ->addTag('tag-test_3')
50
-      ->addTag('tag-test_all')
51
-      ->addTag('tag-test_all2')
52
-      ->addTag('tag-test_all3')
53
-      ->addTag('tag-test_all4');
46
+        ->expiresAfter(600)
47
+        ->addTag('tag-test_1')
48
+        ->addTag('tag-test_2')
49
+        ->addTag('tag-test_3')
50
+        ->addTag('tag-test_all')
51
+        ->addTag('tag-test_all2')
52
+        ->addTag('tag-test_all3')
53
+        ->addTag('tag-test_all4');
54 54
 
55 55
     $driverInstance->saveMultiple($item1, $item2, $item3);
56 56
 
57 57
     return [
58
-      'item1' => $item1,
59
-      'item2' => $item2,
60
-      'item3' => $item3
58
+        'item1' => $item1,
59
+        'item2' => $item2,
60
+        'item3' => $item3
61 61
     ];
62 62
 };
63 63
 
Please login to merge, or discard this patch.
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 require_once __DIR__ . '/../src/autoload.php';
12 12
 echo '[PhpFastCache API v' . Api::getVersion() . "]\n\n";
13 13
 
14
-$defaultDriver = (!empty($argv[ 1 ]) ? ucfirst($argv[ 1 ]) : 'Files');
14
+$defaultDriver = (!empty($argv[1]) ? ucfirst($argv[1]) : 'Files');
15 15
 $status = 0;
16 16
 echo "Testing items tags feature\n";
17 17
 
@@ -69,14 +69,14 @@  discard block
 block discarded – undo
69 69
 echo "\n#1 Testing getter: getItemsByTag() // Expecting 3 results\n";
70 70
 
71 71
 $tagsItems = $driverInstance->getItemsByTag('tag-test_all');
72
-if(is_array($tagsItems))
72
+if (is_array($tagsItems))
73 73
 {
74
-    if(count($tagsItems) === 3)
74
+    if (count($tagsItems) === 3)
75 75
     {
76
-        foreach($tagsItems as $tagsItem)
76
+        foreach ($tagsItems as $tagsItem)
77 77
         {
78
-            if(!in_array($tagsItem->getKey(), ['tag-test1', 'tag-test2', 'tag-test3'])){
79
-                echo '[FAIL] STEP#1 // Got unexpected tagged item key:' . $tagsItem->getKey()  .  "\n";
78
+            if (!in_array($tagsItem->getKey(), ['tag-test1', 'tag-test2', 'tag-test3'])) {
79
+                echo '[FAIL] STEP#1 // Got unexpected tagged item key:' . $tagsItem->getKey() . "\n";
80 80
                 $status = 1;
81 81
                 goto itemTagTest2;
82 82
             }
@@ -85,14 +85,14 @@  discard block
 block discarded – undo
85 85
     }
86 86
     else
87 87
     {
88
-        echo '[FAIL] STEP#1 //Got wrong count of item:' . count($tagsItems) .  "\n";
88
+        echo '[FAIL] STEP#1 //Got wrong count of item:' . count($tagsItems) . "\n";
89 89
         $status = 1;
90 90
         goto itemTagTest2;
91 91
     }
92 92
 }
93 93
 else
94 94
 {
95
-    echo '[FAIL] STEP#1 // Expected $tagsItems to be an array, got: ' . gettype($tagsItems) .  "\n";
95
+    echo '[FAIL] STEP#1 // Expected $tagsItems to be an array, got: ' . gettype($tagsItems) . "\n";
96 96
     $status = 1;
97 97
     goto itemTagTest2;
98 98
 }
@@ -107,14 +107,14 @@  discard block
 block discarded – undo
107 107
 
108 108
 $tagsItems = $driverInstance->getItemsByTagsAll(['tag-test_all', 'tag-test_all2', 'tag-test_all3']);
109 109
 
110
-if(is_array($tagsItems))
110
+if (is_array($tagsItems))
111 111
 {
112
-    if(count($tagsItems) === 3)
112
+    if (count($tagsItems) === 3)
113 113
     {
114
-        foreach($tagsItems as $tagsItem)
114
+        foreach ($tagsItems as $tagsItem)
115 115
         {
116
-            if(!in_array($tagsItem->getKey(), ['tag-test1', 'tag-test2', 'tag-test3'])){
117
-                echo '[FAIL] STEP#2 // Got unexpected tagged item key:' . $tagsItem->getKey()  .  "\n";
116
+            if (!in_array($tagsItem->getKey(), ['tag-test1', 'tag-test2', 'tag-test3'])) {
117
+                echo '[FAIL] STEP#2 // Got unexpected tagged item key:' . $tagsItem->getKey() . "\n";
118 118
                 $status = 1;
119 119
                 goto itemTagTest3;
120 120
             }
@@ -123,14 +123,14 @@  discard block
 block discarded – undo
123 123
     }
124 124
     else
125 125
     {
126
-        echo '[FAIL] STEP#2 // Got wrong count of item:' . count($tagsItems) .  "\n";
126
+        echo '[FAIL] STEP#2 // Got wrong count of item:' . count($tagsItems) . "\n";
127 127
         $status = 1;
128 128
         goto itemTagTest3;
129 129
     }
130 130
 }
131 131
 else
132 132
 {
133
-    echo '[FAIL] STEP#2 // Expected $tagsItems to be an array, got: ' . gettype($tagsItems) .  "\n";
133
+    echo '[FAIL] STEP#2 // Expected $tagsItems to be an array, got: ' . gettype($tagsItems) . "\n";
134 134
     $status = 1;
135 135
     goto itemTagTest3;
136 136
 }
@@ -145,14 +145,14 @@  discard block
 block discarded – undo
145 145
 
146 146
 $tagsItems = $driverInstance->getItemsByTagsAll(['tag-test_all', 'tag-test_all2', 'tag-test_all3', 'tag-test_all4']);
147 147
 
148
-if(is_array($tagsItems))
148
+if (is_array($tagsItems))
149 149
 {
150
-    if(count($tagsItems) === 1)
150
+    if (count($tagsItems) === 1)
151 151
     {
152
-        if(isset($tagsItems['tag-test3']))
152
+        if (isset($tagsItems['tag-test3']))
153 153
         {
154
-            if($tagsItems['tag-test3']->getKey() !== 'tag-test3'){
155
-                echo '[FAIL] STEP#3 // Got unexpected tagged item key:' . $tagsItems['tag-test3']->getKey()  .  "\n";
154
+            if ($tagsItems['tag-test3']->getKey() !== 'tag-test3') {
155
+                echo '[FAIL] STEP#3 // Got unexpected tagged item key:' . $tagsItems['tag-test3']->getKey() . "\n";
156 156
                 $status = 1;
157 157
                 goto itemTagTest4;
158 158
             }
@@ -160,21 +160,21 @@  discard block
 block discarded – undo
160 160
         }
161 161
         else
162 162
         {
163
-            echo '[FAIL] STEP#3 // Got wrong array key, expected "tag-test3", got "' . key($tagsItems) .  "\"\n";
163
+            echo '[FAIL] STEP#3 // Got wrong array key, expected "tag-test3", got "' . key($tagsItems) . "\"\n";
164 164
             $status = 1;
165 165
             goto itemTagTest4;
166 166
         }
167 167
     }
168 168
     else
169 169
     {
170
-        echo '[FAIL] STEP#3 // Got wrong count of item:' . count($tagsItems) .  "\n";
170
+        echo '[FAIL] STEP#3 // Got wrong count of item:' . count($tagsItems) . "\n";
171 171
         $status = 1;
172 172
         goto itemTagTest4;
173 173
     }
174 174
 }
175 175
 else
176 176
 {
177
-    echo '[FAIL] STEP#3 // Expected $tagsItems to be an array, got: ' . gettype($tagsItems) .  "\n";
177
+    echo '[FAIL] STEP#3 // Expected $tagsItems to be an array, got: ' . gettype($tagsItems) . "\n";
178 178
     $status = 1;
179 179
     goto itemTagTest4;
180 180
 }
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 $createItemsCallback();
189 189
 $driverInstance->deleteItemsByTag('tag-test_all');
190 190
 
191
-if(count($driverInstance->getItemsByTag('tag-test_all')) > 0)
191
+if (count($driverInstance->getItemsByTag('tag-test_all')) > 0)
192 192
 {
193 193
     echo "[FAIL] STEP#4 // Getter getItemsByTag() found item(s), possible memory leak \n";
194 194
     $status = 1;
@@ -199,9 +199,9 @@  discard block
 block discarded – undo
199 199
 }
200 200
 
201 201
 $i = 0;
202
-while(++$i <= 3)
202
+while (++$i <= 3)
203 203
 {
204
-    if($driverInstance->getItem("tag-test{$i}")->isHit())
204
+    if ($driverInstance->getItem("tag-test{$i}")->isHit())
205 205
     {
206 206
         echo "[FAIL] STEP#4 // Item 'tag-test{$i}' should've been deleted and is still in cache storage \n";
207 207
         $status = 1;
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 
223 223
 $driverInstance->deleteItemsByTagsAll(['tag-test_all', 'tag-test_all2', 'tag-test_all3']);
224 224
 
225
-if(count($driverInstance->getItemsByTag('tag-test_all')) > 0)
225
+if (count($driverInstance->getItemsByTag('tag-test_all')) > 0)
226 226
 {
227 227
     echo "[FAIL] STEP#5 // Getter getItemsByTag() found item(s), possible memory leak \n";
228 228
     $status = 1;
@@ -233,9 +233,9 @@  discard block
 block discarded – undo
233 233
 }
234 234
 
235 235
 $i = 0;
236
-while(++$i <= 3)
236
+while (++$i <= 3)
237 237
 {
238
-    if($driverInstance->getItem("tag-test{$i}")->isHit())
238
+    if ($driverInstance->getItem("tag-test{$i}")->isHit())
239 239
     {
240 240
         echo "[FAIL] STEP#5 // Item 'tag-test{$i}' should've been deleted and is still in cache storage \n";
241 241
         $status = 1;
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
  */
260 260
 $driverInstance->deleteItemsByTagsAll(['tag-test_all', 'tag-test_all2', 'tag-test_all3', 'tag-test_all4']);
261 261
 
262
-if($driverInstance->getItem('item-test_3')->isHit())
262
+if ($driverInstance->getItem('item-test_3')->isHit())
263 263
 {
264 264
     echo "[FAIL] STEP#6 // Getter getItem() found item 'item-test_3', possible memory leak \n";
265 265
     $status = 1;
@@ -279,9 +279,9 @@  discard block
 block discarded – undo
279 279
 $appendStr = '$*#*$';
280 280
 $driverInstance->appendItemsByTagsAll(['tag-test_all', 'tag-test_all2', 'tag-test_all3'], $appendStr);
281 281
 
282
-foreach($driverInstance->getItems(['tag-test1', 'tag-test2', 'tag-test3']) as $item)
282
+foreach ($driverInstance->getItems(['tag-test1', 'tag-test2', 'tag-test3']) as $item)
283 283
 {
284
-    if(strpos($item->get(), $appendStr) === false)
284
+    if (strpos($item->get(), $appendStr) === false)
285 285
     {
286 286
         echo "[FAIL] STEP#7 // Item '{$item->getKey()}' does not have the string part '{$appendStr}' in it's value \n";
287 287
         $status = 1;
@@ -302,9 +302,9 @@  discard block
 block discarded – undo
302 302
 $prependStr = '&+_+&';
303 303
 $driverInstance->prependItemsByTagsAll(['tag-test_all', 'tag-test_all2', 'tag-test_all3'], $prependStr);
304 304
 
305
-foreach($driverInstance->getItems(['tag-test1', 'tag-test2', 'tag-test3']) as $item)
305
+foreach ($driverInstance->getItems(['tag-test1', 'tag-test2', 'tag-test3']) as $item)
306 306
 {
307
-    if(strpos($item->get(), $prependStr) === false)
307
+    if (strpos($item->get(), $prependStr) === false)
308 308
     {
309 309
         echo "[FAIL] STEP#7 // Item '{$item->getKey()}' does not have the string part '{$prependStr}' in it's value \n";
310 310
         $status = 1;
Please login to merge, or discard this patch.
Braces   +14 added lines, -28 removed lines patch added patch discarded remove patch
@@ -82,15 +82,13 @@  discard block
 block discarded – undo
82 82
             }
83 83
         }
84 84
         echo "[PASS] STEP#1 // Successfully retrieved 3 tagged item keys\n";
85
-    }
86
-    else
85
+    } else
87 86
     {
88 87
         echo '[FAIL] STEP#1 //Got wrong count of item:' . count($tagsItems) .  "\n";
89 88
         $status = 1;
90 89
         goto itemTagTest2;
91 90
     }
92
-}
93
-else
91
+} else
94 92
 {
95 93
     echo '[FAIL] STEP#1 // Expected $tagsItems to be an array, got: ' . gettype($tagsItems) .  "\n";
96 94
     $status = 1;
@@ -120,15 +118,13 @@  discard block
 block discarded – undo
120 118
             }
121 119
         }
122 120
         echo "[PASS] STEP#2 // Successfully retrieved 3 tagged item key\n";
123
-    }
124
-    else
121
+    } else
125 122
     {
126 123
         echo '[FAIL] STEP#2 // Got wrong count of item:' . count($tagsItems) .  "\n";
127 124
         $status = 1;
128 125
         goto itemTagTest3;
129 126
     }
130
-}
131
-else
127
+} else
132 128
 {
133 129
     echo '[FAIL] STEP#2 // Expected $tagsItems to be an array, got: ' . gettype($tagsItems) .  "\n";
134 130
     $status = 1;
@@ -157,22 +153,19 @@  discard block
 block discarded – undo
157 153
                 goto itemTagTest4;
158 154
             }
159 155
             echo "[PASS] STEP#3 // Successfully retrieved 1 tagged item keys\n";
160
-        }
161
-        else
156
+        } else
162 157
         {
163 158
             echo '[FAIL] STEP#3 // Got wrong array key, expected "tag-test3", got "' . key($tagsItems) .  "\"\n";
164 159
             $status = 1;
165 160
             goto itemTagTest4;
166 161
         }
167
-    }
168
-    else
162
+    } else
169 163
     {
170 164
         echo '[FAIL] STEP#3 // Got wrong count of item:' . count($tagsItems) .  "\n";
171 165
         $status = 1;
172 166
         goto itemTagTest4;
173 167
     }
174
-}
175
-else
168
+} else
176 169
 {
177 170
     echo '[FAIL] STEP#3 // Expected $tagsItems to be an array, got: ' . gettype($tagsItems) .  "\n";
178 171
     $status = 1;
@@ -192,8 +185,7 @@  discard block
 block discarded – undo
192 185
 {
193 186
     echo "[FAIL] STEP#4 // Getter getItemsByTag() found item(s), possible memory leak \n";
194 187
     $status = 1;
195
-}
196
-else
188
+} else
197 189
 {
198 190
     echo "[PASS] STEP#4 // Getter getItemsByTag() found no item \n";
199 191
 }
@@ -205,8 +197,7 @@  discard block
 block discarded – undo
205 197
     {
206 198
         echo "[FAIL] STEP#4 // Item 'tag-test{$i}' should've been deleted and is still in cache storage \n";
207 199
         $status = 1;
208
-    }
209
-    else
200
+    } else
210 201
     {
211 202
         echo "[PASS] STEP#4 // Item 'tag-test{$i}' have been deleted and is no longer in cache storage \n";
212 203
     }
@@ -226,8 +217,7 @@  discard block
 block discarded – undo
226 217
 {
227 218
     echo "[FAIL] STEP#5 // Getter getItemsByTag() found item(s), possible memory leak \n";
228 219
     $status = 1;
229
-}
230
-else
220
+} else
231 221
 {
232 222
     echo "[PASS] STEP#5 // Getter getItemsByTag() found no item \n";
233 223
 }
@@ -239,8 +229,7 @@  discard block
 block discarded – undo
239 229
     {
240 230
         echo "[FAIL] STEP#5 // Item 'tag-test{$i}' should've been deleted and is still in cache storage \n";
241 231
         $status = 1;
242
-    }
243
-    else
232
+    } else
244 233
     {
245 234
         echo "[PASS] STEP#5 // Item 'tag-test{$i}' have been deleted and is no longer in cache storage \n";
246 235
     }
@@ -263,8 +252,7 @@  discard block
 block discarded – undo
263 252
 {
264 253
     echo "[FAIL] STEP#6 // Getter getItem() found item 'item-test_3', possible memory leak \n";
265 254
     $status = 1;
266
-}
267
-else
255
+} else
268 256
 {
269 257
     echo "[PASS] STEP#6 // Getter getItem() did not found item 'item-test_3' \n";
270 258
 }
@@ -285,8 +273,7 @@  discard block
 block discarded – undo
285 273
     {
286 274
         echo "[FAIL] STEP#7 // Item '{$item->getKey()}' does not have the string part '{$appendStr}' in it's value \n";
287 275
         $status = 1;
288
-    }
289
-    else
276
+    } else
290 277
     {
291 278
         echo "[PASS] STEP#7 // Item 'tag-test{$item->getKey()}' does have the string part '{$appendStr}' in it's value \n";
292 279
     }
@@ -308,8 +295,7 @@  discard block
 block discarded – undo
308 295
     {
309 296
         echo "[FAIL] STEP#7 // Item '{$item->getKey()}' does not have the string part '{$prependStr}' in it's value \n";
310 297
         $status = 1;
311
-    }
312
-    else
298
+    } else
313 299
     {
314 300
         echo "[PASS] STEP#7 // Item 'tag-test{$item->getKey()}' does have the string part '{$prependStr}' in it's value \n";
315 301
     }
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Cookie/Driver.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
             $keyword = self::PREFIX . $item->getKey();
81 81
             $v = json_encode($this->driverPreWrap($item));
82 82
 
83
-            if (isset($this->config[ 'limited_memory_each_object' ]) && strlen($v) > $this->config[ 'limited_memory_each_object' ]) {
83
+            if (isset($this->config['limited_memory_each_object']) && strlen($v) > $this->config['limited_memory_each_object']) {
84 84
                 return false;
85 85
             }
86 86
 
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
         // return null if no caching
102 102
         // return value if in caching
103 103
         $keyword = self::PREFIX . $item->getKey();
104
-        $x = isset($_COOKIE[ $keyword ]) ? json_decode($_COOKIE[ $keyword ], true) : false;
104
+        $x = isset($_COOKIE[$keyword]) ? json_decode($_COOKIE[$keyword], true) : false;
105 105
 
106 106
         if ($x == false) {
107 107
             return null;
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
     {
123 123
         $this->driverConnect();
124 124
         $keyword = self::PREFIX . $key;
125
-        $x = isset($_COOKIE[ $keyword ]) ? $this->decode(json_decode($_COOKIE[ $keyword ])->t) : false;
125
+        $x = isset($_COOKIE[$keyword]) ? $this->decode(json_decode($_COOKIE[$keyword])->t) : false;
126 126
 
127 127
         return $x ? $x - time() : $x;
128 128
     }
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
         if ($item instanceof Item) {
141 141
             $this->driverConnect();
142 142
             $keyword = self::PREFIX . $item->getKey();
143
-            $_COOKIE[ $keyword ] = null;
143
+            $_COOKIE[$keyword] = null;
144 144
 
145 145
             return @setcookie($keyword, null, -10);
146 146
         } else {
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
         $this->driverConnect();
158 158
         foreach ($_COOKIE as $keyword => $value) {
159 159
             if (strpos($keyword, self::PREFIX) !== false) {
160
-                $_COOKIE[ $keyword ] = null;
160
+                $_COOKIE[$keyword] = null;
161 161
                 $result = @setcookie($keyword, null, -10);
162 162
                 if ($return !== false) {
163 163
                     $return = $result;
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Predis/Driver.php 2 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -125,10 +125,10 @@  discard block
 block discarded – undo
125 125
         $config = isset($this->config[ 'redis' ]) ? $this->config[ 'redis' ] : [];
126 126
 
127 127
         $this->instance = new PredisClient(array_merge([
128
-          'host' => '127.0.0.1',
129
-          'port' => '6379',
130
-          'password' => '',
131
-          'database' => '',
128
+            'host' => '127.0.0.1',
129
+            'port' => '6379',
130
+            'password' => '',
131
+            'database' => '',
132 132
         ], $config));
133 133
 
134 134
         return true;
@@ -151,9 +151,9 @@  discard block
 block discarded – undo
151 151
         $date = (isset($info['Server'][ 'uptime_in_seconds' ]) ? (new \DateTime())->setTimestamp(time() - $info['Server'][ 'uptime_in_seconds' ]) : 'unknown date');
152 152
 
153 153
         return (new driverStatistic())
154
-          ->setData(implode(', ', array_keys($this->itemInstances)))
155
-          ->setRawData($this->instance->info())
156
-          ->setSize($size)
157
-          ->setInfo(sprintf("The Redis daemon v%s is up since %s.\n For more information see RawData. \n Driver size includes the memory allocation size.", $version, $date->format(DATE_RFC2822)));
154
+            ->setData(implode(', ', array_keys($this->itemInstances)))
155
+            ->setRawData($this->instance->info())
156
+            ->setSize($size)
157
+            ->setInfo(sprintf("The Redis daemon v%s is up since %s.\n For more information see RawData. \n Driver size includes the memory allocation size.", $version, $date->format(DATE_RFC2822)));
158 158
     }
159 159
 }
160 160
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
      */
123 123
     protected function driverConnect()
124 124
     {
125
-        $config = isset($this->config[ 'redis' ]) ? $this->config[ 'redis' ] : [];
125
+        $config = isset($this->config['redis']) ? $this->config['redis'] : [];
126 126
 
127 127
         $this->instance = new PredisClient(array_merge([
128 128
           'host' => '127.0.0.1',
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
         $info = $this->instance->info();
149 149
         $size = (isset($info['Memory']['used_memory']) ? $info['Memory']['used_memory'] : 0);
150 150
         $version = (isset($info['Server']['redis_version']) ? $info['Server']['redis_version'] : 0);
151
-        $date = (isset($info['Server'][ 'uptime_in_seconds' ]) ? (new \DateTime())->setTimestamp(time() - $info['Server'][ 'uptime_in_seconds' ]) : 'unknown date');
151
+        $date = (isset($info['Server']['uptime_in_seconds']) ? (new \DateTime())->setTimestamp(time() - $info['Server']['uptime_in_seconds']) : 'unknown date');
152 152
 
153 153
         return (new driverStatistic())
154 154
           ->setData(implode(', ', array_keys($this->itemInstances)))
Please login to merge, or discard this patch.