You are here

function iter_for in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/guzzlehttp/promises/src/functions.php \GuzzleHttp\Promise\iter_for()

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 116

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,
    ]);
  }
}