trait Matching (View source)

Methods

where(string $key, mixed|Closure $expected)

Asserts that the property matches the expected value.

whereNot(string $key, mixed|Closure $expected)

Asserts that the property does not match the expected value.

whereAll(array $bindings)

Asserts that all properties match their expected values.

whereType(string $key, string|array $expected)

Asserts that the property is of the expected type.

whereAllType(array $bindings)

Asserts that all properties are of their expected types.

$this
whereContains(string $key, mixed $expected)

Asserts that the property contains the expected values.

void
ensureSorted(mixed $value)

Ensures that all properties are sorted the same way, recursively.

string
dotPath(string $key = '')

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

$this
has(string $key, null $value = null, Closure|null $scope = null)

Ensure that the given prop exists.

mixed
prop(string|null $key = null)

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

Details

Matching where(string $key, mixed|Closure $expected)

Asserts that the property matches the expected value.

Parameters

string $key
mixed|Closure $expected

Return Value

Matching

Matching whereNot(string $key, mixed|Closure $expected)

Asserts that the property does not match the expected value.

Parameters

string $key
mixed|Closure $expected

Return Value

Matching

Matching whereAll(array $bindings)

Asserts that all properties match their expected values.

Parameters

array $bindings

Return Value

Matching

Matching whereType(string $key, string|array $expected)

Asserts that the property is of the expected type.

Parameters

string $key
string|array $expected

Return Value

Matching

Matching whereAllType(array $bindings)

Asserts that all properties are of their expected types.

Parameters

array $bindings

Return Value

Matching

$this whereContains(string $key, mixed $expected)

Asserts that the property contains the expected values.

Parameters

string $key
mixed $expected

Return Value

$this

protected void ensureSorted(mixed $value)

Ensures that all properties are sorted the same way, recursively.

Parameters

mixed $value

Return Value

void

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

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

Parameters

string $key

Return Value

string

abstract $this has(string $key, null $value = null, Closure|null $scope = null)

Ensure that the given prop exists.

Parameters

string $key
null $value
Closure|null $scope

Return Value

$this

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