YaLinqo\Enumerable::all PHP Method

all() public method

Syntax: all (predicate {(v, k) ==> result})

Determines whether all elements of a sequence satisfy a condition. The enumeration of source is stopped as soon as the result can be determined.

public all ( callable $predicate ) : boolean
$predicate callable {(v, k) ==> result} A function to test each element for a condition.
return boolean true if every element of the source sequence passes the test in the specified predicate, or if the sequence is empty; otherwise, false.
    public function all($predicate)
    {
        $predicate = Utils::createLambda($predicate, 'v,k');
        foreach ($this as $k => $v) {
            if (!$predicate($v, $k)) {
                return false;
            }
        }
        return true;
    }