Passed
Push — master ( f19d08...dabc62 )
by
unknown
02:43
created
src/Collections/Basis/Abstractions/AbstractStorage.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -75,10 +75,10 @@  discard block
 block discarded – undo
75 75
      */
76 76
     public function setCapacity($capacity)
77 77
     {
78
-        if(!is_int($capacity))
78
+        if (!is_int($capacity))
79 79
             throw new InvalidCapacityException();
80 80
 
81
-        if($this->count() > $capacity)
81
+        if ($this->count() > $capacity)
82 82
             throw new InvalidCapacityException();
83 83
 
84 84
         $this->capacity = $capacity;
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
         $storage->clear();
109 109
 
110 110
         $this->each(function($item, $key) use(&$storage, $callback){
111
-            if($callback($item, $key) === true)
111
+            if ($callback($item, $key) === true)
112 112
                 $storage[$key] = $item;
113 113
         });
114 114
 
@@ -124,8 +124,8 @@  discard block
 block discarded – undo
124 124
     public function copyTo(&$array, $override = true)
125 125
     {
126 126
         $this->each(function($item, $key) use(&$array, $override){
127
-            if(!$override && isset($array[$key]))
128
-                return ;
127
+            if (!$override && isset($array[$key]))
128
+                return;
129 129
 
130 130
            $array[$key] = $item;
131 131
         });
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
      */
139 139
     public function clear()
140 140
     {
141
-        if($this->isReadOnly())
141
+        if ($this->isReadOnly())
142 142
             throw new ReadOnlyStorageException();
143 143
 
144 144
         $this->storage = array();
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
      */
247 247
     public function offsetGet($offset)
248 248
     {
249
-        if(!$this->offsetExists($offset))
249
+        if (!$this->offsetExists($offset))
250 250
             throw new InvalidOffsetException();
251 251
 
252 252
         return $this->storage[$offset];
@@ -269,10 +269,10 @@  discard block
 block discarded – undo
269 269
      */
270 270
     public function offsetSet($offset, $value)
271 271
     {
272
-        if($this->isReadOnly())
272
+        if ($this->isReadOnly())
273 273
             throw new ReadOnlyStorageException();
274 274
 
275
-        if($this->count() === $this->getCapacity())
275
+        if ($this->count() === $this->getCapacity())
276 276
             throw new MaxCapacityReachedException();
277 277
 
278 278
         $this->storage[$offset] = $value;
@@ -291,10 +291,10 @@  discard block
 block discarded – undo
291 291
      */
292 292
     public function offsetUnset($offset)
293 293
     {
294
-        if(!$this->offsetExists($offset))
294
+        if (!$this->offsetExists($offset))
295 295
             throw new InvalidOffsetException();
296 296
 
297
-        if($this->isReadOnly())
297
+        if ($this->isReadOnly())
298 298
             throw new ReadOnlyStorageException();
299 299
 
300 300
         unset($this->storage[$offset]);
Please login to merge, or discard this patch.
Braces   +33 added lines, -22 removed lines patch added patch discarded remove patch
@@ -75,11 +75,13 @@  discard block
 block discarded – undo
75 75
      */
76 76
     public function setCapacity($capacity)
77 77
     {
78
-        if(!is_int($capacity))
79
-            throw new InvalidCapacityException();
78
+        if(!is_int($capacity)) {
79
+                    throw new InvalidCapacityException();
80
+        }
80 81
 
81
-        if($this->count() > $capacity)
82
-            throw new InvalidCapacityException();
82
+        if($this->count() > $capacity) {
83
+                    throw new InvalidCapacityException();
84
+        }
83 85
 
84 86
         $this->capacity = $capacity;
85 87
     }
@@ -92,8 +94,9 @@  discard block
 block discarded – undo
92 94
      */
93 95
     public function each(callable $callback)
94 96
     {
95
-        foreach ($this->storage as $key => $item)
96
-            $callback($item, $key);
97
+        foreach ($this->storage as $key => $item) {
98
+                    $callback($item, $key);
99
+        }
97 100
     }
98 101
 
99 102
     /**
@@ -108,8 +111,9 @@  discard block
 block discarded – undo
108 111
         $storage->clear();
109 112
 
110 113
         $this->each(function($item, $key) use(&$storage, $callback){
111
-            if($callback($item, $key) === true)
112
-                $storage[$key] = $item;
114
+            if($callback($item, $key) === true) {
115
+                            $storage[$key] = $item;
116
+            }
113 117
         });
114 118
 
115 119
         return $storage;
@@ -124,8 +128,9 @@  discard block
 block discarded – undo
124 128
     public function copyTo(&$array, $override = true)
125 129
     {
126 130
         $this->each(function($item, $key) use(&$array, $override){
127
-            if(!$override && isset($array[$key]))
128
-                return ;
131
+            if(!$override && isset($array[$key])) {
132
+                            return ;
133
+            }
129 134
 
130 135
            $array[$key] = $item;
131 136
         });
@@ -138,8 +143,9 @@  discard block
 block discarded – undo
138 143
      */
139 144
     public function clear()
140 145
     {
141
-        if($this->isReadOnly())
142
-            throw new ReadOnlyStorageException();
146
+        if($this->isReadOnly()) {
147
+                    throw new ReadOnlyStorageException();
148
+        }
143 149
 
144 150
         $this->storage = array();
145 151
     }
@@ -246,8 +252,9 @@  discard block
 block discarded – undo
246 252
      */
247 253
     public function offsetGet($offset)
248 254
     {
249
-        if(!$this->offsetExists($offset))
250
-            throw new InvalidOffsetException();
255
+        if(!$this->offsetExists($offset)) {
256
+                    throw new InvalidOffsetException();
257
+        }
251 258
 
252 259
         return $this->storage[$offset];
253 260
     }
@@ -269,11 +276,13 @@  discard block
 block discarded – undo
269 276
      */
270 277
     public function offsetSet($offset, $value)
271 278
     {
272
-        if($this->isReadOnly())
273
-            throw new ReadOnlyStorageException();
279
+        if($this->isReadOnly()) {
280
+                    throw new ReadOnlyStorageException();
281
+        }
274 282
 
275
-        if($this->count() === $this->getCapacity())
276
-            throw new MaxCapacityReachedException();
283
+        if($this->count() === $this->getCapacity()) {
284
+                    throw new MaxCapacityReachedException();
285
+        }
277 286
 
278 287
         $this->storage[$offset] = $value;
279 288
     }
@@ -291,11 +300,13 @@  discard block
 block discarded – undo
291 300
      */
292 301
     public function offsetUnset($offset)
293 302
     {
294
-        if(!$this->offsetExists($offset))
295
-            throw new InvalidOffsetException();
303
+        if(!$this->offsetExists($offset)) {
304
+                    throw new InvalidOffsetException();
305
+        }
296 306
 
297
-        if($this->isReadOnly())
298
-            throw new ReadOnlyStorageException();
307
+        if($this->isReadOnly()) {
308
+                    throw new ReadOnlyStorageException();
309
+        }
299 310
 
300 311
         unset($this->storage[$offset]);
301 312
     }
Please login to merge, or discard this patch.