Invites
Class · Sharkord\Collections\Invites
Class Invites
An array-accessible, iterable cache of Invite objects keyed by invite ID.
Examples
Section titled “Examples”$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";Methods
Section titled “Methods”__construct()
Section titled “__construct()”Invites constructor.
Parameters
| Parameter | Type | Description |
|---|---|---|
$sharkord | Sharkord | Reference to the main bot instance. |
Retrieves an invite by ID.
Parameters
| Parameter | Type | Description |
|---|---|---|
$id | int | The 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>
offsetExists()
Section titled “offsetExists()”Parameters
| Parameter | Type | Description |
|---|---|---|
$offset | mixed |
Returns bool
offsetGet()
Section titled “offsetGet()”Parameters
| Parameter | Type | Description |
|---|---|---|
$offset | mixed |
Returns ?Invite
offsetSet()
Section titled “offsetSet()”Parameters
| Parameter | Type | Description |
|---|---|---|
$offset | mixed | |
$value | mixed |
Throws
\LogicException
offsetUnset()
Section titled “offsetUnset()”Parameters
| Parameter | Type | Description |
|---|---|---|
$offset | mixed |
Throws
\LogicException
count()
Section titled “count()”Returns int
getIterator()
Section titled “getIterator()”Returns \ArrayIterator<int,\Invite>