Icicle\Coroutine\Coroutine::next PHP Method

next() private method

Examines the value yielded from the generator and prepares the next step in interation.
private next ( mixed $yielded )
$yielded mixed
    private function next($yielded)
    {
        if (!$this->generator->valid()) {
            $result = $this->generator->getReturn();
            if ($result instanceof Awaitable) {
                $this->reject(new AwaitableReturnedError($result));
                return;
            }
            if ($result instanceof Generator) {
                $this->reject(new GeneratorReturnedError($result));
                return;
            }
            $this->resolve($result);
            return;
        }
        $this->busy = true;
        if ($yielded instanceof Generator) {
            $yielded = new self($yielded);
        }
        $this->current = $yielded;
        if ($yielded instanceof Awaitable) {
            $yielded->done($this->send, $this->capture);
        } else {
            Loop\queue($this->send, $yielded);
        }
        $this->busy = false;
    }