Completed
Pull Request — final (#342)
by Georges
02:43
created
src/phpFastCache/Core/StandardPsr6StructureTrait.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
                 $driverArray = $this->driverRead($item);
58 58
 
59 59
                 if ($driverArray) {
60
-                    if(!is_array($driverArray)){
60
+                    if (!is_array($driverArray)) {
61 61
                         throw new phpFastCacheCoreException(sprintf('The driverRead method returned an unexpected variable type: %s', gettype($driverArray)));
62 62
                     }
63 63
                     $item->set($this->driverUnwrapData($driverArray));
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
                         $item->setHit(true);
78 78
                     }
79 79
                 } else {
80
-                    $item->expiresAfter(abs((int) $this->getConfig()[ 'defaultTtl' ]));
80
+                    $item->expiresAfter(abs((int) $this->getConfig()['defaultTtl']));
81 81
                 }
82 82
 
83 83
             }
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
             throw new \InvalidArgumentException(sprintf('$key must be a string, got type "%s" instead.', gettype($key)));
86 86
         }
87 87
 
88
-        return $this->itemInstances[ $key ];
88
+        return $this->itemInstances[$key];
89 89
     }
90 90
 
91 91
     /**
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
     public function setItem(CacheItemInterface $item)
97 97
     {
98 98
         if ($this->getClassNamespace() . '\\Item' === get_class($item)) {
99
-            $this->itemInstances[ $item->getKey() ] = $item;
99
+            $this->itemInstances[$item->getKey()] = $item;
100 100
 
101 101
             return $this;
102 102
         } else {
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
     {
114 114
         $collection = [];
115 115
         foreach ($keys as $key) {
116
-            $collection[ $key ] = $this->getItem($key);
116
+            $collection[$key] = $this->getItem($key);
117 117
         }
118 118
 
119 119
         return $collection;
@@ -195,8 +195,8 @@  discard block
 block discarded – undo
195 195
          * @var ExtendedCacheItemInterface $item
196 196
          */
197 197
         if (!array_key_exists($item->getKey(), $this->itemInstances)) {
198
-            $this->itemInstances[ $item->getKey() ] = $item;
199
-        } else if(spl_object_hash($item) !== spl_object_hash($this->itemInstances[ $item->getKey() ])){
198
+            $this->itemInstances[$item->getKey()] = $item;
199
+        } else if (spl_object_hash($item) !== spl_object_hash($this->itemInstances[$item->getKey()])) {
200 200
             throw new \RuntimeException('Spl object hash mismatches ! You probably tried to save a detached item which has been already retrieved from cache.');
201 201
         }
202 202
 
@@ -219,12 +219,12 @@  discard block
 block discarded – undo
219 219
     public function saveDeferred(CacheItemInterface $item)
220 220
     {
221 221
         if (!array_key_exists($item->getKey(), $this->itemInstances)) {
222
-            $this->itemInstances[ $item->getKey() ] = $item;
223
-        }else if(spl_object_hash($item) !== spl_object_hash($this->itemInstances[ $item->getKey() ])){
222
+            $this->itemInstances[$item->getKey()] = $item;
223
+        } else if (spl_object_hash($item) !== spl_object_hash($this->itemInstances[$item->getKey()])) {
224 224
             throw new \RuntimeException('Spl object hash mismatches ! You probably tried to save a detached item which has been already retrieved from cache.');
225 225
         }
226 226
 
227
-        return $this->deferredList[ $item->getKey() ] = $item;
227
+        return $this->deferredList[$item->getKey()] = $item;
228 228
     }
229 229
 
230 230
     /**
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
         foreach ($this->deferredList as $key => $item) {
238 238
             $result = $this->save($item);
239 239
             if ($return !== false) {
240
-                unset($this->deferredList[ $key ]);
240
+                unset($this->deferredList[$key]);
241 241
                 $return = $result;
242 242
             }
243 243
         }
Please login to merge, or discard this patch.