ArrayRepository
class ArrayRepository
Traits
Properties
| protected array<string, mixed> | $data | The repository values. |
Methods
Apply the callback if the given "value" is (or resolves to) truthy.
Apply the callback if the given "value" is (or resolves to) falsy.
Create an array repository.
Retrieve all the items.
Retrieve a single item.
Overwrite the entire repository.
Merge in other arrays.
Add an item to the repository.
Remove an item from the repository.
Determine if the repository is empty.
Determine if the repository is not empty.
Details
in
Conditionable at line 23
mixed
when(mixed $value = null, callable|null $callback = null, callable|null $default = null)
Apply the callback if the given "value" is (or resolves to) truthy.
in
Conditionable at line 56
mixed
unless(mixed $value = null, callable|null $callback = null, callable|null $default = null)
Apply the callback if the given "value" is (or resolves to) falsy.
at line 25
__construct(array $data = [])
Create an array repository.
at line 35
array
all()
Retrieve all the items.
at line 43
mixed
get(string $key, mixed $default = null)
Retrieve a single item.
at line 54
ArrayRepository
set(array $data)
Overwrite the entire repository.
at line 67
ArrayRepository
merge(array ...$arrays)
Merge in other arrays.
at line 79
ArrayRepository
add(string $key, mixed $value)
Add an item to the repository.
at line 91
ArrayRepository
remove(string $key)
Remove an item from the repository.
at line 103
bool
isEmpty()
Determine if the repository is empty.
at line 113
bool
isNotEmpty()
Determine if the repository is not empty.