class First extends Mutator (View source)

Retrieve the first element of an array. Optionally, a callback can be provided to filter the array.

If no element is found, null is returned.

Methods

__construct(callable $callback = null)

No description

mixed
__invoke(mixed $value)

Mutate the input value.

from  Mutator
static First
make(callable $callback = null)

No description

mixed
mutate(mixed $value)

Mutate the input value.

Details

__construct(callable $callback = null)

No description

Parameters

callable $callback

A callback to filter the array (optional)

final mixed __invoke(mixed $value)

Mutate the input value.

Parameters

mixed $value

Return Value

mixed

static First make(callable $callback = null)

No description

Parameters

callable $callback

A callback to filter the array (optional)

Return Value

First

mixed mutate(mixed $value)

Mutate the input value.

Parameters

mixed $value

Return Value

mixed