ArrayBodyRepository
abstract class ArrayBodyRepository implements BodyRepository, MergeableBody
Traits
Properties
| protected array<array-key, mixed> | $data | The repository data. |
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 body repository.
Set the repository value.
Merge arrays into the repository.
Add an element to the repository.
Get the raw data in the repository.
Get a value from 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 28
__construct(array $value = [])
Create an array body repository.
at line 39
BodyRepository
set(mixed $value)
Set the repository value.
at line 56
MergeableBody
merge(array ...$arrays)
Merge arrays into the repository.
at line 69
ArrayBodyRepository
add(string|int|null $key = null, mixed $value = null)
Add an element to the repository.
at line 83
mixed
all()
Get the raw data in the repository.
at line 96
mixed
get(string|int|null $key = null, mixed $default = null)
Get a value from the repository.
Alias of all().
at line 111
ArrayBodyRepository
remove(string|int $key)
Remove an item from the repository.
at line 123
bool
isEmpty()
Determine if the repository is empty.
at line 133
bool
isNotEmpty()
Determine if the repository is not empty.