Anemone::all()

Checks if all items in the data pass the test.

Table of Contents
  1. Description
  2. Example

Description

Anemone::all(callable $fn): bool;
Anemone::all(mixed $value): bool;

This is the OOP style of function all(), implemented as a class method. It returns true if, in the data, all items for which the provided function returns true, otherwise it returns false. It does not modify the data.

Example

$anemone = new Anemone([1, 2, 3, 4, 5]);

if ($anemone->all(function ($v) {
    return 4 === $v;
})) {
    // All items in the `$anemone` have a value of `4`
}

For a simple return of value, you can summarize the call as in the example below:

if ($anemone->all(4)) {
    // All items in the `$anemone` have a value of `4`
}

Anemone::all()

Checks if all items in the data pass the test.

Anemone::any()

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

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.