ValidatedInput
class ValidatedInput implements ValidatedData
Traits
Methods
Get the raw, underlying input array.
Retrieve data from the instance.
Determine if the instance contains any of the given keys.
Apply the callback if the instance contains the given key.
Determine if the instance contains a non-empty value for the given key.
Determine if the instance contains an empty value for the given key.
Determine if the instance contains a non-empty value for any of the given keys.
Apply the callback if the instance contains a non-empty value for the given key.
Apply the callback if the instance contains a valid enum value for the given key.
Determine if the instance is missing a given key.
Apply the callback if the instance is missing the given key.
Determine if the given key is an empty string for "filled".
Retrieve data from the instance as a Stringable instance.
Retrieve data from the instance as a Stringable instance.
Retrieve data as a boolean value.
Retrieve data as an integer value.
Retrieve data as a float value.
Retrieve data clamped between min and max values.
Retrieve data from the instance as a Carbon instance.
Retrieve data from the instance as a CarbonInterval instance.
Retrieve data from the instance as an enum.
Retrieve data from the instance as an array of enums.
Determine if the given enum class is backed.
Normalize enum input to a strict backed value.
Resolve and cache the enum backing type for repeated lookups.
Retrieve data from the instance as an array.
Retrieve data from the instance as a collection.
Get a subset containing the provided keys with values from the instance data.
Get all of the data except for a specified array of items.
Create a new validated input container.
Merge the validated input with the given array of additional data.
Get the keys for all of the input.
Retrieve an input item from the validated inputs.
Retrieve a file from the validated inputs.
Dump the validated inputs items and end the script.
Dump the items.
Get the instance as an array.
Dynamically access input data.
Dynamically set input data.
Determine if an input item is set.
Remove an input item.
Determine if an item exists at an offset.
Get an item at a given offset.
Set the item at a given offset.
Unset the item at a given offset.
Get an iterator for the input.
Details
at line 41
array
all(mixed $keys = null)
Get the raw, underlying input array.
at line 59
protected mixed
data(string|null $key = null, mixed $default = null)
Retrieve data from the instance.
in
InteractsWithData at line 40
bool
exists(array|string $key)
Determine if the data contains a given key.
in
InteractsWithData at line 48
bool
has(array|string $key)
Determine if the data contains a given key.
in
InteractsWithData at line 66
bool
hasAny(array|string $keys)
Determine if the instance contains any of the given keys.
in
InteractsWithData at line 80
mixed
whenHas(string $key, callable $callback, callable|null $default = null)
Apply the callback if the instance contains the given key.
in
InteractsWithData at line 96
bool
filled(array|string $key)
Determine if the instance contains a non-empty value for the given key.
in
InteractsWithData at line 112
bool
isNotFilled(array|string $key)
Determine if the instance contains an empty value for the given key.
in
InteractsWithData at line 128
bool
anyFilled(array|string $keys)
Determine if the instance contains a non-empty value for any of the given keys.
in
InteractsWithData at line 146
mixed
whenFilled(string $key, callable $callback, callable|null $default = null)
Apply the callback if the instance contains a non-empty value for the given key.
in
InteractsWithData at line 168
mixed
whenEnum(string $key, string $enumClass, callable $callback, callable|null $default = null)
Apply the callback if the instance contains a valid enum value for the given key.
in
InteractsWithData at line 188
bool
missing(array|string $key)
Determine if the instance is missing a given key.
in
InteractsWithData at line 198
mixed
whenMissing(string $key, callable $callback, callable|null $default = null)
Apply the callback if the instance is missing the given key.
in
InteractsWithData at line 214
protected bool
isEmptyString(string $key)
Determine if the given key is an empty string for "filled".
in
InteractsWithData at line 224
Stringable
str(string $key, mixed $default = null)
Retrieve data from the instance as a Stringable instance.
in
InteractsWithData at line 232
Stringable
string(string $key, mixed $default = null)
Retrieve data from the instance as a Stringable instance.
in
InteractsWithData at line 242
bool
boolean(string|null $key = null, bool $default = false)
Retrieve data as a boolean value.
Returns true when value is "1", "true", "on", and "yes". Otherwise, returns false.
in
InteractsWithData at line 250
int
integer(string $key, int $default = 0)
Retrieve data as an integer value.
in
InteractsWithData at line 258
float
float(string $key, float $default = 0.0)
Retrieve data as a float value.
in
InteractsWithData at line 266
int|float
clamp(string $key, int|float $min, int|float $max, int|float $default = 0)
Retrieve data clamped between min and max values.
in
InteractsWithData at line 283
CarbonInterface|null
date(string $key, string|null $format = null, UnitEnum|string|null $tz = null)
Retrieve data from the instance as a Carbon instance.
in
InteractsWithData at line 301
CarbonInterval|null
interval(string $key, Unit|string|null $unit = null)
Retrieve data from the instance as a CarbonInterval instance.
in
InteractsWithData at line 327
mixed
enum(string $key, string $enumClass, mixed $default = null)
Retrieve data from the instance as an enum.
in
InteractsWithData at line 350
array
enums(string $key, string $enumClass)
Retrieve data from the instance as an array of enums.
in
InteractsWithData at line 369
protected bool
isBackedEnum(string $enumClass)
Determine if the given enum class is backed.
in
InteractsWithData at line 377
protected int|string|null
normalizeEnumValue(string $enumClass, mixed $value)
Normalize enum input to a strict backed value.
in
InteractsWithData at line 422
protected string|null
enumBackingType(string $enumClass)
Resolve and cache the enum backing type for repeated lookups.
in
InteractsWithData at line 433
array
array(array|string|null $key = null)
Retrieve data from the instance as an array.
in
InteractsWithData at line 441
Collection
collect(array|string|null $key = null)
Retrieve data from the instance as a collection.
in
InteractsWithData at line 451
array
only(mixed $keys)
Get a subset containing the provided keys with values from the instance data.
in
InteractsWithData at line 475
array
except(mixed $keys)
Get all of the data except for a specified array of items.
at line 23
__construct(array $input)
Create a new validated input container.
at line 31
ValidatedInput
merge(array $items)
Merge the validated input with the given array of additional data.
at line 67
array
keys()
Get the keys for all of the input.
at line 75
mixed
input(string|null $key = null, mixed $default = null)
Retrieve an input item from the validated inputs.
at line 87
mixed
file(string $key, mixed $default = null)
Retrieve a file from the validated inputs.
at line 99
void
dd(mixed ...$keys)
Dump the validated inputs items and end the script.
at line 109
ValidatedInput
dump(mixed $keys = [])
Dump the items.
at line 121
array
toArray()
Get the instance as an array.
at line 129
mixed
__get(string $name)
Dynamically access input data.
at line 137
void
__set(string $name, mixed $value)
Dynamically set input data.
at line 145
bool
__isset(string $name)
Determine if an input item is set.
at line 153
void
__unset(string $name)
Remove an input item.
at line 161
bool
offsetExists(mixed $key)
Determine if an item exists at an offset.
at line 169
mixed
offsetGet(mixed $key)
Get an item at a given offset.
at line 177
void
offsetSet(mixed $key, mixed $value)
Set the item at a given offset.
at line 189
void
offsetUnset(mixed $key)
Unset the item at a given offset.
at line 197
Traversable
getIterator()
Get an iterator for the input.