You are here

function iter_for in Lockr 7.3

Returns an iterator for the given value.

Parameters

mixed $value:

Return value

\Iterator

1 call to iter_for()
EachPromise::__construct in vendor/guzzlehttp/promises/src/EachPromise.php
Configuration hash can include the following key value pairs:

File

vendor/guzzlehttp/promises/src/functions.php, line 122

Namespace

GuzzleHttp\Promise

Code

function iter_for($value) {
  if ($value instanceof \Iterator) {
    return $value;
  }
  elseif (is_array($value)) {
    return new \ArrayIterator($value);
  }
  else {
    return new \ArrayIterator([
      $value,
    ]);
  }
}