@@ -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 | /** |
@@ -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 | } |
@@ -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 | } |