YaLinqo\Enumerable::call PHP Method

call() public method

Syntax: process (action {(v, k) ==> void})

Process method does not start enumeration itself. To force enumeration, you can use {@link each} method.

Original LINQ method name: do.

public call ( callable $action ) : Enumerable
$action callable {(v, k) ==> void} The action to invoke for each element in the sequence.
return Enumerable The source sequence with the side-effecting behavior applied.
    public function call($action)
    {
        $action = Utils::createLambda($action, 'v,k');
        return new self(function () use($action) {
            foreach ($this as $k => $v) {
                $action($v, $k);
                (yield $k => $v);
            }
        });
    }