Skip to content

Roles

Class  ·  Sharkord\Collections\Roles

Class Roles

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

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

Roles constructor.

Parameters

ParameterTypeDescription
$sharkordSharkordReference to the main bot instance.

Retrieves a role by ID.

Parameters

ParameterTypeDescription
$id`intstring`

Returns \Role|null


Parameters

ParameterTypeDescription
$offsetmixed

Returns bool


Parameters

ParameterTypeDescription
$offsetmixed

Returns ?Role


Parameters

ParameterTypeDescription
$offsetmixed
$valuemixed

Throws

  • \LogicException

Parameters

ParameterTypeDescription
$offsetmixed

Throws

  • \LogicException

Returns int


Returns \ArrayIterator<string,\Role>