trait Has (View source)

Methods

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

Assert that the prop is of the expected size.

Has
has(string|int $key, int|Closure|null $length = null, Closure $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 $key)

Marks the property as interacted.

mixed
prop(string $key = null)

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

$this
scope(string $key, Closure $callback)

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

$this
etc()

Disables the interaction check.

$this
first(Closure $callback)

Instantiate a new "scope" on the first element.

Details

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

Assert that the prop is of the expected size.

Parameters

string|int $key
int $length

Return Value

Has

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

Ensure that the given prop exists.

Parameters

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

Return Value

Has

Has hasAll(array|string $key)

Assert that all of the given props exist.

Parameters

array|string $key

Return Value

Has

Has hasAny(array|string $key)

Assert that at least one of the given props exists.

Parameters

array|string $key

Return Value

Has

Has missingAll(array|string $key)

Assert that none of the given props exist.

Parameters

array|string $key

Return Value

Has

Has missing(string $key)

Assert that the given prop does not exist.

Parameters

string $key

Return Value

Has

abstract protected string dotPath(string $key = '')

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

Parameters

string $key

Return Value

string

abstract protected void interactsWith(string $key)

Marks the property as interacted.

Parameters

string $key

Return Value

void

abstract protected mixed prop(string $key = null)

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

Parameters

string $key

Return Value

mixed

abstract protected $this scope(string $key, Closure $callback)

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

Parameters

string $key
Closure $callback

Return Value

$this

abstract $this etc()

Disables the interaction check.

Return Value

$this

abstract $this first(Closure $callback)

Instantiate a new "scope" on the first element.

Parameters

Closure $callback

Return Value

$this