@@ -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 | } |
@@ -56,8 +56,9 @@ discard block |
||
56 | 56 | if(!is_bool($offset) |
57 | 57 | && !is_int($offset) |
58 | 58 | && !is_float($offset) |
59 | - && !is_string($offset)) |
|
60 | - throw new InvalidOffsetTypeException(); |
|
59 | + && !is_string($offset)) { |
|
60 | + throw new InvalidOffsetTypeException(); |
|
61 | + } |
|
61 | 62 | } |
62 | 63 | |
63 | 64 | /** |
@@ -90,11 +91,13 @@ discard block |
||
90 | 91 | */ |
91 | 92 | public function setCapacity($capacity) |
92 | 93 | { |
93 | - if(!is_int($capacity)) |
|
94 | - throw new InvalidCapacityException(); |
|
94 | + if(!is_int($capacity)) { |
|
95 | + throw new InvalidCapacityException(); |
|
96 | + } |
|
95 | 97 | |
96 | - if($this->count() > $capacity) |
|
97 | - throw new InvalidCapacityException(); |
|
98 | + if($this->count() > $capacity) { |
|
99 | + throw new InvalidCapacityException(); |
|
100 | + } |
|
98 | 101 | |
99 | 102 | $this->capacity = $capacity; |
100 | 103 | } |
@@ -107,8 +110,9 @@ discard block |
||
107 | 110 | */ |
108 | 111 | public function each(callable $callback) |
109 | 112 | { |
110 | - foreach ($this->storage as $key => $item) |
|
111 | - $callback($item, $key); |
|
113 | + foreach ($this->storage as $key => $item) { |
|
114 | + $callback($item, $key); |
|
115 | + } |
|
112 | 116 | } |
113 | 117 | |
114 | 118 | /** |
@@ -123,8 +127,9 @@ discard block |
||
123 | 127 | $storage->clear(); |
124 | 128 | |
125 | 129 | $this->each(function($item, $key) use(&$storage, $callback){ |
126 | - if($callback($item, $key) === true) |
|
127 | - $storage[$key] = $item; |
|
130 | + if($callback($item, $key) === true) { |
|
131 | + $storage[$key] = $item; |
|
132 | + } |
|
128 | 133 | }); |
129 | 134 | |
130 | 135 | return $storage; |
@@ -139,8 +144,9 @@ discard block |
||
139 | 144 | public function copyTo(&$array, $override = true) |
140 | 145 | { |
141 | 146 | $this->each(function($item, $key) use(&$array, $override){ |
142 | - if(!$override && isset($array[$key])) |
|
143 | - return ; |
|
147 | + if(!$override && isset($array[$key])) { |
|
148 | + return ; |
|
149 | + } |
|
144 | 150 | |
145 | 151 | $array[$key] = $item; |
146 | 152 | }); |
@@ -153,8 +159,9 @@ discard block |
||
153 | 159 | */ |
154 | 160 | public function clear() |
155 | 161 | { |
156 | - if($this->isReadOnly()) |
|
157 | - throw new ReadOnlyStorageException(); |
|
162 | + if($this->isReadOnly()) { |
|
163 | + throw new ReadOnlyStorageException(); |
|
164 | + } |
|
158 | 165 | |
159 | 166 | $this->storage = array(); |
160 | 167 | } |
@@ -261,8 +268,9 @@ discard block |
||
261 | 268 | */ |
262 | 269 | public function offsetGet($offset) |
263 | 270 | { |
264 | - if(!$this->offsetExists($offset)) |
|
265 | - throw new InvalidOffsetException(); |
|
271 | + if(!$this->offsetExists($offset)) { |
|
272 | + throw new InvalidOffsetException(); |
|
273 | + } |
|
266 | 274 | |
267 | 275 | return $this->storage[$offset]; |
268 | 276 | } |
@@ -284,11 +292,13 @@ discard block |
||
284 | 292 | */ |
285 | 293 | public function offsetSet($offset, $value) |
286 | 294 | { |
287 | - if($this->isReadOnly()) |
|
288 | - throw new ReadOnlyStorageException(); |
|
295 | + if($this->isReadOnly()) { |
|
296 | + throw new ReadOnlyStorageException(); |
|
297 | + } |
|
289 | 298 | |
290 | - if($this->count() === $this->getCapacity()) |
|
291 | - throw new MaxCapacityReachedException(); |
|
299 | + if($this->count() === $this->getCapacity()) { |
|
300 | + throw new MaxCapacityReachedException(); |
|
301 | + } |
|
292 | 302 | |
293 | 303 | $this->validateOffsetType($offset); |
294 | 304 | $this->storage[$offset] = $value; |
@@ -307,11 +317,13 @@ discard block |
||
307 | 317 | */ |
308 | 318 | public function offsetUnset($offset) |
309 | 319 | { |
310 | - if(!$this->offsetExists($offset)) |
|
311 | - throw new InvalidOffsetException(); |
|
320 | + if(!$this->offsetExists($offset)) { |
|
321 | + throw new InvalidOffsetException(); |
|
322 | + } |
|
312 | 323 | |
313 | - if($this->isReadOnly()) |
|
314 | - throw new ReadOnlyStorageException(); |
|
324 | + if($this->isReadOnly()) { |
|
325 | + throw new ReadOnlyStorageException(); |
|
326 | + } |
|
315 | 327 | |
316 | 328 | $this->validateOffsetType($offset); |
317 | 329 | unset($this->storage[$offset]); |