@@ -73,8 +73,7 @@ discard block |
||
73 | 73 | * Create new instance |
74 | 74 | * @param array<mixed, mixed> $data |
75 | 75 | */ |
76 | - public function __construct(array $data = []) |
|
77 | - { |
|
76 | + public function __construct(array $data = []) { |
|
78 | 77 | foreach ($data as $value) { |
79 | 78 | $this->validateEntry($value); |
80 | 79 | } |
@@ -180,8 +179,7 @@ discard block |
||
180 | 179 | * @return mixed |
181 | 180 | * @throws OutOfRangeException |
182 | 181 | */ |
183 | - public function get(int $offset) |
|
184 | - { |
|
182 | + public function get(int $offset) { |
|
185 | 183 | if ($this->isEmpty()) { |
186 | 184 | throw new OutOfRangeException('The collection is empty'); |
187 | 185 | } |
@@ -268,8 +266,7 @@ discard block |
||
268 | 266 | * Return a random element of the collection |
269 | 267 | * @return mixed |
270 | 268 | */ |
271 | - public function rand() |
|
272 | - { |
|
269 | + public function rand() { |
|
273 | 270 | if ($this->isEmpty()) { |
274 | 271 | throw new InvalidOperationException('The collection is empty'); |
275 | 272 | } |
@@ -216,9 +216,9 @@ discard block |
||
216 | 216 | : null; |
217 | 217 | } |
218 | 218 | |
219 | - /** |
|
220 | - * {@inheritedoc} |
|
221 | - */ |
|
219 | + /** |
|
220 | + * {@inheritedoc} |
|
221 | + */ |
|
222 | 222 | public function equals(BaseCollection $collection): bool |
223 | 223 | { |
224 | 224 | if (!$collection instanceof self) { |
@@ -243,9 +243,9 @@ discard block |
||
243 | 243 | $this->initializePairs($data); |
244 | 244 | } |
245 | 245 | |
246 | - /** |
|
247 | - * {@inheritedoc} |
|
248 | - */ |
|
246 | + /** |
|
247 | + * {@inheritedoc} |
|
248 | + */ |
|
249 | 249 | public function get($key) |
250 | 250 | { |
251 | 251 | return $this->data->offsetExists($key) |
@@ -253,10 +253,10 @@ discard block |
||
253 | 253 | : null; |
254 | 254 | } |
255 | 255 | |
256 | - /** |
|
257 | - * {@inheritedoc} |
|
258 | - * @param HashMap<T> $collection |
|
259 | - */ |
|
256 | + /** |
|
257 | + * {@inheritedoc} |
|
258 | + * @param HashMap<T> $collection |
|
259 | + */ |
|
260 | 260 | public function merge(BaseCollection $collection): BaseCollection |
261 | 261 | { |
262 | 262 | TypeCheck::isEqual( |
@@ -284,9 +284,9 @@ discard block |
||
284 | 284 | ); |
285 | 285 | } |
286 | 286 | |
287 | - /** |
|
288 | - * {@inheritedoc} |
|
289 | - */ |
|
287 | + /** |
|
288 | + * {@inheritedoc} |
|
289 | + */ |
|
290 | 290 | public function remove($key): void |
291 | 291 | { |
292 | 292 | if ($this->isEmpty()) { |
@@ -303,9 +303,9 @@ discard block |
||
303 | 303 | $this->data->offsetUnset($key); |
304 | 304 | } |
305 | 305 | |
306 | - /** |
|
307 | - * {@inheritedoc} |
|
308 | - */ |
|
306 | + /** |
|
307 | + * {@inheritedoc} |
|
308 | + */ |
|
309 | 309 | public function slice(int $offset, ?int $length = null): ?BaseCollection |
310 | 310 | { |
311 | 311 | $newData = array_slice($this->all(), $offset, $length, true); |
@@ -319,9 +319,9 @@ discard block |
||
319 | 319 | : null; |
320 | 320 | } |
321 | 321 | |
322 | - /** |
|
323 | - * {@inheritedoc} |
|
324 | - */ |
|
322 | + /** |
|
323 | + * {@inheritedoc} |
|
324 | + */ |
|
325 | 325 | public function sort(callable $callback): ?BaseCollection |
326 | 326 | { |
327 | 327 | $data = $this->all(); |
@@ -335,9 +335,9 @@ discard block |
||
335 | 335 | : null; |
336 | 336 | } |
337 | 337 | |
338 | - /** |
|
339 | - * {@inheritedoc} |
|
340 | - */ |
|
338 | + /** |
|
339 | + * {@inheritedoc} |
|
340 | + */ |
|
341 | 341 | public function update($key, $value): bool |
342 | 342 | { |
343 | 343 | $this->validateEntry($key, $value); |
@@ -52,15 +52,13 @@ |
||
52 | 52 | * @template Object |
53 | 53 | * @extends TypedCollection<Object> |
54 | 54 | */ |
55 | -class ObjectCollection extends TypedCollection |
|
56 | -{ |
|
55 | +class ObjectCollection extends TypedCollection { |
|
57 | 56 | |
58 | 57 | /** |
59 | 58 | * Create new instance |
60 | 59 | * @param array<mixed, mixed> $data |
61 | 60 | */ |
62 | - public function __construct(array $data = []) |
|
63 | - { |
|
61 | + public function __construct(array $data = []) { |
|
64 | 62 | parent::__construct('object', $data); |
65 | 63 | } |
66 | 64 | } |
@@ -55,16 +55,14 @@ |
||
55 | 55 | * @template T |
56 | 56 | * @extends Collection<T> |
57 | 57 | */ |
58 | -class TypedCollection extends Collection |
|
59 | -{ |
|
58 | +class TypedCollection extends Collection { |
|
60 | 59 | |
61 | 60 | /** |
62 | 61 | * Create new instance |
63 | 62 | * @param string $type |
64 | 63 | * @param array<mixed, mixed> $data |
65 | 64 | */ |
66 | - public function __construct(string $type, array $data = []) |
|
67 | - { |
|
65 | + public function __construct(string $type, array $data = []) { |
|
68 | 66 | $this->type = $type; |
69 | 67 | parent::__construct($data); |
70 | 68 | } |