Skip to content

Commit

Permalink
keys() and values()
Browse files Browse the repository at this point in the history
  • Loading branch information
valzargaming committed Jan 17, 2025
1 parent 9ddea44 commit 093e955
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Discord/Helpers/CollectionInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ public function sort(callable|int|null $callback);
public function map(callable $callback);
public function merge($collection): self;
public function toArray();
public function keys(): array;
public function values(): array;
public function offsetExists($offset): bool;
#[\ReturnTypeWillChange]
public function offsetGet($offset);
Expand Down
10 changes: 10 additions & 0 deletions src/Discord/Helpers/CollectionTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,16 @@ public function keys(): array
return array_keys($this->items);
}

/**
* Get the values of the items.
*
* @return array
*/
public function values(): array
{
return array_values($this->items);
}

/**
* If the collection has an offset.
*
Expand Down
1 change: 1 addition & 0 deletions src/Discord/Repository/AbstractRepositoryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public function find(callable $callback);
public function clear(): void;
public function toArray(): array;
public function keys(): array;
public function values(): array;
public function offsetExists($offset): bool;
#[\ReturnTypeWillChange]
public function offsetGet($offset);
Expand Down
10 changes: 10 additions & 0 deletions src/Discord/Repository/AbstractRepositoryTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,16 @@ public function keys(): array
return array_keys($this->items);
}

/**
* Get the values of the items.
*
* @return array
*/
public function values(): array
{
return array_values($this->items);
}

/**
* If the repository has an offset.
*
Expand Down

0 comments on commit 093e955

Please sign in to comment.