Anemone::has()

Checks for the existence of a key recursively.

Table of Contents
  1. Description
  2. Example

Description

Anemone::has(?string $key = null): bool;

Checks for the existence of a key recursively using dot notation syntax. This is the OOP style of function has(), implemented as a class method. If the key does exist and it contains falsy value, this method would still return true.

Example

$anemone = new Anemone([
    'foo' => 1,
    'bar' => [
        'baz' => false,
        'qux' => null
    ]
]);

$foo = $anemone->has('foo'); // Returns `true`
$baz = $anemone->has('bar.baz'); // Returns `true`
$wut = $anemone->has('bar.wut'); // Returns `false`

$all = $anemone->has(); // Returns `true` (not to be used like this, but, okay…)

Anemone::any()

Checks if at least one item in the data passes the test.

Anemone::has()

Checks for the existence of a key recursively.

Anemone::is()

Filters the data so that only items that pass the test are left.

Anemone::not()

Filters the data so that only items that do not pass the test are left.

Anemone::pluck()

Returns a new data set contains values from the key on every item.