UserStorageInterface
interface UserStorageInterface implements StorageInterface (View source)
Something all user storages implement. The storage also is used as factory.
Methods
Returns the current element. From Iterator interface.
Fetch the key from the current element. From Iterator interface.
Advances the internal pointer. From Iterator interface.
Resets the internal pointer. From Iterator interface.
Checks if current position is valid. From Iterator interface.
Returns all items.
Returns a copy of itself. This does not make a copy of the stored data.
Determines if a given key exists in the collection.
Returns the item at a given key. If the key does not exist, null is returned.
Sets a key-value pair.
Returns the position of the given value in the storage. Returns null if the given value couldn't be found.
Filters the storage by a given callback, keeping only those items that pass a given truth test. Returns a new Storage instance.
Returns the first element that passes a given truth test.
Returns the last element that passes a given truth test.
Reduces the collection to a single value, passing the result of each iteration into the subsequent iteration.
Sorts the collection. Returns a new Storage instance.
Sorts the collection by key. Returns a new Storage instance.
Sorts the collection using a custom sorting function. Returns a new Storage instance.
Sorts the collection by key using a custom sorting function. Returns a new Storage instance.
Details
at line 20
mixed
current()
Returns the current element. From Iterator interface.
at line 26
mixed
key()
Fetch the key from the current element. From Iterator interface.
at line 32
mixed|false
next()
Advances the internal pointer. From Iterator interface.
at line 38
mixed|false
rewind()
Resets the internal pointer. From Iterator interface.
at line 44
bool
valid()
Checks if current position is valid. From Iterator interface.
at line 50
mixed[]
all()
Returns all items.
in StorageInterface at line 56
int
count()
Returns the total number of items. From Countable interface.
in StorageInterface at line 62
StorageInterface
copy()
Returns a copy of itself. This does not make a copy of the stored data.
at line 73
bool
has(mixed $key)
Determines if a given key exists in the collection.
at line 81
mixed|null
get(mixed $key)
Returns the item at a given key. If the key does not exist, null is returned.
at line 90
$this
set(mixed $key, mixed $value)
Sets a key-value pair.
in StorageInterface at line 94
$this
delete(mixed $key)
Removes an item.
in StorageInterface at line 100
$this
clear()
Clears the Storage.
in StorageInterface at line 107
int|null
indexOf(mixed $value)
Returns the position of the given value in the storage. Returns null if the given value couldn't be found.
in StorageInterface at line 114
StorageInterface
filter(callable $closure)
Filters the storage by a given callback, keeping only those items that pass a given truth test. Returns a new Storage instance.
in StorageInterface at line 121
mixed|null
first(callable|null $closure = null)
Returns the first element that passes a given truth test.
in StorageInterface at line 128
mixed|null
last(callable|null $closure = null)
Returns the last element that passes a given truth test.
in StorageInterface at line 136
mixed|null|void
reduce(callable $closure, mixed|null $carry = null)
Reduces the collection to a single value, passing the result of each iteration into the subsequent iteration.
in StorageInterface at line 143
StorageInterface
sort(bool $descending = false, int $options = \SORT_REGULAR)
Sorts the collection. Returns a new Storage instance.
in StorageInterface at line 151
Collection
sortKey(bool $descending = false, int $options = \SORT_REGULAR)
Sorts the collection by key. Returns a new Storage instance.
in StorageInterface at line 158
Collection
sortCustom(callable $closure)
Sorts the collection using a custom sorting function. Returns a new Storage instance.
in StorageInterface at line 165
Collection
sortCustomKey(callable $closure)
Sorts the collection by key using a custom sorting function. Returns a new Storage instance.
in StorageInterface at line 172
int
max(mixed $key = '')
Return the maximum value of a given key.
in StorageInterface at line 179
int
min(mixed|null $key = null)
Return the minimum value of a given key.
at line 58
User
resolve(User|GuildMember|string|int $user)
Resolves given data to an user.