You are here

public function Coroutine::__construct in Auth0 Single Sign On 8.2

File

vendor/guzzlehttp/promises/src/Coroutine.php, line 60

Class

Coroutine
Creates a promise that is resolved using a generator that yields values or promises (somewhat similar to C#'s async keyword).

Namespace

GuzzleHttp\Promise

Code

public function __construct(callable $generatorFn) {
  $this->generator = $generatorFn();
  $this->result = new Promise(function () {
    while (isset($this->currentPromise)) {
      $this->currentPromise
        ->wait();
    }
  });
  $this
    ->nextCoroutine($this->generator
    ->current());
}