@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | */ |
| 60 | 60 | public function offsetSet($offset, $value) |
| 61 | 61 | { |
| 62 | - if($this->offsetExists($offset) && !$this->isOverrideAllowed()) |
|
| 62 | + if ($this->offsetExists($offset) && !$this->isOverrideAllowed()) |
|
| 63 | 63 | throw new OverrideOperationException(); |
| 64 | 64 | |
| 65 | 65 | |
@@ -75,11 +75,11 @@ discard block |
||
| 75 | 75 | { |
| 76 | 76 | $keys = []; |
| 77 | 77 | |
| 78 | - foreach ($this->storage as $key => $item){ |
|
| 78 | + foreach ($this->storage as $key => $item) { |
|
| 79 | 79 | $keys[] = $key; |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - if(isset($keys[$this->current])) |
|
| 82 | + if (isset($keys[$this->current])) |
|
| 83 | 83 | return $keys[$this->current]; |
| 84 | 84 | } |
| 85 | 85 | |
@@ -59,8 +59,9 @@ discard block |
||
| 59 | 59 | */ |
| 60 | 60 | public function offsetSet($offset, $value) |
| 61 | 61 | { |
| 62 | - if($this->offsetExists($offset) && !$this->isOverrideAllowed()) |
|
| 63 | - throw new OverrideOperationException(); |
|
| 62 | + if($this->offsetExists($offset) && !$this->isOverrideAllowed()) { |
|
| 63 | + throw new OverrideOperationException(); |
|
| 64 | + } |
|
| 64 | 65 | |
| 65 | 66 | |
| 66 | 67 | parent::offsetSet($offset, $value); |
@@ -79,8 +80,9 @@ discard block |
||
| 79 | 80 | $keys[] = $key; |
| 80 | 81 | } |
| 81 | 82 | |
| 82 | - if(isset($keys[$this->current])) |
|
| 83 | - return $keys[$this->current]; |
|
| 83 | + if(isset($keys[$this->current])) { |
|
| 84 | + return $keys[$this->current]; |
|
| 85 | + } |
|
| 84 | 86 | } |
| 85 | 87 | |
| 86 | 88 | /** |
@@ -127,7 +127,7 @@ |
||
| 127 | 127 | if(!$override && isset($array[$key])) |
| 128 | 128 | return ; |
| 129 | 129 | |
| 130 | - $array[$key] = $item; |
|
| 130 | + $array[$key] = $item; |
|
| 131 | 131 | }); |
| 132 | 132 | } |
| 133 | 133 | |
@@ -75,10 +75,10 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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]); |
@@ -75,11 +75,13 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | } |
@@ -40,7 +40,7 @@ |
||
| 40 | 40 | */ |
| 41 | 41 | public function offsetSet($offset, $value) |
| 42 | 42 | { |
| 43 | - if(!is_int($offset)) |
|
| 43 | + if (!is_int($offset)) |
|
| 44 | 44 | throw new InvalidOffsetTypeException("Apenas inteiros são permitidos"); |
| 45 | 45 | |
| 46 | 46 | parent::offsetSet($offset, $value); |
@@ -40,8 +40,9 @@ |
||
| 40 | 40 | */ |
| 41 | 41 | public function offsetSet($offset, $value) |
| 42 | 42 | { |
| 43 | - if(!is_int($offset)) |
|
| 44 | - throw new InvalidOffsetTypeException("Apenas inteiros são permitidos"); |
|
| 43 | + if(!is_int($offset)) { |
|
| 44 | + throw new InvalidOffsetTypeException("Apenas inteiros são permitidos"); |
|
| 45 | + } |
|
| 45 | 46 | |
| 46 | 47 | parent::offsetSet($offset, $value); |
| 47 | 48 | } |