Skip to content

Categories

Class  ·  Sharkord\Collections\Categories

Class Categories

An array-accessible, iterable cache of Category objects keyed by category ID (string).

$category = $sharkord->categories->collection()->get(1);
foreach ($sharkord->categories->collection() as $id => $category) {
echo "{$category->name}\n";
}
echo count($sharkord->categories->collection());

Categories constructor.

Parameters

ParameterTypeDescription
$sharkordSharkordReference to the main bot instance.

Retrieves a category by ID.

Parameters

ParameterTypeDescription
$id`intstring`

Returns \Category|null


Parameters

ParameterTypeDescription
$offsetmixed

Returns bool


Parameters

ParameterTypeDescription
$offsetmixed

Returns ?Category


Parameters

ParameterTypeDescription
$offsetmixed
$valuemixed

Throws

  • \LogicException

Parameters

ParameterTypeDescription
$offsetmixed

Throws

  • \LogicException

Returns int


Returns \ArrayIterator<string,\Category>