protected function resolve($value = null)
    {
        if (null !== $this->result) {
            return;
        }

        if ($value instanceof self) {
            $value = $value->unwrap();
            if ($this === $value) {
                $value = new Internal\RejectedAwaitable(
                    new CircularResolutionError('Circular reference in awaitable resolution chain.')
                );
            }
        } elseif (!$value instanceof Awaitable) {
            $value = new Internal\FulfilledAwaitable($value);
        }

        $this->result = $value;
        $this->result->done($this->onFulfilled, $this->onRejected ?: new DoneQueue());

        $this->onFulfilled = null;
        $this->onRejected = null;
        $this->onCancelled = null;
    }
protected function resolve($value = null)
    {
        if (null !== $this->result) {
            return;
        }

        if ($value instanceof self) {
            $value = $value->unwrap();
            if ($this === $value) {
                $value = new Internal\RejectedAwaitable(
                    new CircularResolutionError('Circular reference in awaitable resolution chain.')
                );
            }
        } elseif (!$value instanceof Awaitable) {
            $value = new Internal\FulfilledAwaitable($value);
        }

        $this->result = $value;
        $this->result->done($this->onFulfilled, $this->onRejected ?: new DoneQueue());

        $this->onFulfilled = null;
        $this->onRejected = null;
        $this->onCancelled = null;
    }
protected function resolve ( $ value = null ) { if ( null !== $ this -> result ) { return ; } if ( $ value instanceof self ) { $ value = $ value -> unwrap ( ) ; if ( $ this === $ value ) { $ value = new Internal \ RejectedAwaitable ( new CircularResolutionError ( 'Circular reference in awaitable resolution chain.' ) ) ; } } elseif ( ! $ value instanceof Awaitable ) { $ value = new Internal \ FulfilledAwaitable ( $ value ) ; } $ this -> result = $ value ; $ this -> result -> done ( $ this -> onFulfilled , $ this -> onRejected ? : new DoneQueue ( ) ) ; $ this -> onFulfilled = null ; $ this -> onRejected = null ; $ this -> onCancelled = null ; }
Resolves the awaitable with the given awaitable or value. If another awaitable, this awaitable takes on the state
of that awaitable. If a value, the awaitable will be fulfilled with that value.

@param mixed $value An awaitable can be resolved with anything other than itself.
Resolves the awaitable with the given awaitable or value . If another awaitable this awaitable takes on the state of that awaitable . If a value the awaitable will be fulfilled with that value .