trait Has

Methods

Has
count(string|int $key, int|null $length = null)

Assert that the prop is of the expected size.

Has
countBetween(int|string $min, int|string $max)

Assert that the prop size is between a given minimum and maximum.

Has
has(string|int $key, int|Closure|null $length = null, Closure|null $callback = null)

Ensure that the given prop exists.

Has
hasAll(array|string $key)

Assert that all of the given props exist.

Has
hasAny(array|string $key)

Assert that at least one of the given props exists.

Has
missingAll(array|string $key)

Assert that none of the given props exist.

Has
missing(string $key)

Assert that the given prop does not exist.

string
dotPath(string $key = '')

Compose the absolute "dot" path to the given key.

void
interactsWith(string|int $key)

Mark the property as interacted.

mixed
prop(string|null $key = null)

Retrieve a prop within the current scope using "dot" notation.

Has
scope(string|int $key, Closure $callback)

Instantiate a new "scope" at the path of the given key.

Has
etc()

Disable the interaction check.

Has
first(Closure $callback)

Instantiate a new "scope" on the first element.

Details

at line 16
Has count(string|int $key, int|null $length = null)

Assert that the prop is of the expected size.

Parameters

string|int $key
int|null $length

Return Value

Has

at line 44
Has countBetween(int|string $min, int|string $max)

Assert that the prop size is between a given minimum and maximum.

Parameters

int|string $min
int|string $max

Return Value

Has

at line 72
Has has(string|int $key, int|Closure|null $length = null, Closure|null $callback = null)

Ensure that the given prop exists.

Parameters

string|int $key
int|Closure|null $length
Closure|null $callback

Return Value

Has

at line 114
Has hasAll(array|string $key)

Assert that all of the given props exist.

Parameters

array|string $key

Return Value

Has

at line 132
Has hasAny(array|string $key)

Assert that at least one of the given props exists.

Parameters

array|string $key

Return Value

Has

at line 151
Has missingAll(array|string $key)

Assert that none of the given props exist.

Parameters

array|string $key

Return Value

Has

at line 165
Has missing(string $key)

Assert that the given prop does not exist.

Parameters

string $key

Return Value

Has

at line 178
abstract protected string dotPath(string $key = '')

Compose the absolute "dot" path to the given key.

Parameters

string $key

Return Value

string

at line 183
abstract protected void interactsWith(string|int $key)

Mark the property as interacted.

Parameters

string|int $key

Return Value

void

at line 188
abstract protected mixed prop(string|null $key = null)

Retrieve a prop within the current scope using "dot" notation.

Parameters

string|null $key

Return Value

mixed

at line 193
abstract protected Has scope(string|int $key, Closure $callback)

Instantiate a new "scope" at the path of the given key.

Parameters

string|int $key
Closure $callback

Return Value

Has

at line 198
abstract Has etc()

Disable the interaction check.

Return Value

Has

at line 203
abstract Has first(Closure $callback)

Instantiate a new "scope" on the first element.

Parameters

Closure $callback

Return Value

Has