Skip to content

Invites

Class  ·  Sharkord\Collections\Invites

Class Invites

An array-accessible, iterable cache of Invite objects keyed by invite ID.

$invites = $sharkord->invites->collection();
foreach ($invites as $id => $invite) {
echo "{$invite->code} — {$invite->uses} uses\n";
}
$invite = $invites->get(5);
echo count($invites) . " active invites\n";

Invites constructor.

Parameters

ParameterTypeDescription
$sharkordSharkordReference to the main bot instance.

Retrieves an invite by ID.

Parameters

ParameterTypeDescription
$idintThe invite ID.

Returns \Invite|null — The cached Invite model, or null if not found.


Returns all cached invites as an array.

Returns array<int,\Invite>


Parameters

ParameterTypeDescription
$offsetmixed

Returns bool


Parameters

ParameterTypeDescription
$offsetmixed

Returns ?Invite


Parameters

ParameterTypeDescription
$offsetmixed
$valuemixed

Throws

  • \LogicException

Parameters

ParameterTypeDescription
$offsetmixed

Throws

  • \LogicException

Returns int


Returns \ArrayIterator<int,\Invite>