Skip to content

Commit

Permalink
usort method for Collections
Browse files Browse the repository at this point in the history
  • Loading branch information
valzargaming committed Jan 16, 2025
1 parent f5c84ab commit 787c59f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Discord/Helpers/CollectionInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public function has(...$keys): bool;
public function filter(callable $callback);
public function find(callable $callback);
public function clear(): void;
public function usort(callable $callback): true;
public function map(callable $callback);
public function merge($collection): self;
public function toArray();
Expand Down
5 changes: 5 additions & 0 deletions src/Discord/Helpers/CollectionTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,11 @@ public function clear(): void
$this->items = [];
}

public function usort(callable $callback): true
{
return usort($this->items, $callback);
}

/**
* Runs a callback over the collection and creates a new static.
*
Expand Down

0 comments on commit 787c59f

Please sign in to comment.