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;
    }
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;
    }
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 ; }
Examines the value yielded from the generator and prepares the next step in interation.

@param mixed $yielded
Examines the value yielded from the generator and prepares the next step in interation .