Skip to content

Commit 182b07d

Browse files
committed
ExCollectionInterface
This includes the newly introduced functions that were added as part of recent enhancements.
1 parent 0652d9c commit 182b07d

File tree

3 files changed

+33
-1
lines changed

3 files changed

+33
-1
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/vendor
2+
composer.lock

src/Collection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* @since 5.0.0 No longer extends Laravel's BaseCollection
1818
* @since 4.0.0
1919
*/
20-
class Collection implements CollectionInterface
20+
class Collection implements ExCollectionInterface
2121
{
2222
/**
2323
* The collection discriminator.

src/ExCollectionInterface.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
/*
4+
* This file is a part of the DiscordPHP project.
5+
*
6+
* Copyright (c) 2015-present David Cole <[email protected]>
7+
*
8+
* This file is subject to the MIT license that is bundled
9+
* with this source code in the LICENSE.md file.
10+
*/
11+
12+
namespace Discord\Helpers;
13+
14+
interface ExCollectionInterface extends CollectionInterface
15+
{
16+
public function find_key(callable $callback);
17+
public function any(callable $callback): bool;
18+
public function all(callable $callback): bool;
19+
public function splice(int $offset, ?int $length, mixed $replacement = []): self;
20+
public function clear(): void;
21+
public function slice(int $offset, ?int $length = null, bool $preserve_keys = false);
22+
public function sort(callable|int|null $callback);
23+
public function diff($items, ?callable $callback = null);
24+
public function intersect($items, ?callable $callback = null);
25+
public function walk(callable $callback, mixed $arg);
26+
public function reduce(callable $callback, $initial = null);
27+
public function unique(int $flags = SORT_STRING);
28+
public function keys(): array;
29+
public function values(): array;
30+
}

0 commit comments

Comments
 (0)