public function wait($unwrap = true)
    {
        $this->runner->wait($this->core);

        if ($unwrap) {
            if ($this->core->getState() === self::REJECTED) {
                throw $this->core->getException();
            }

            return $this->core->getResponse();
        }

        return null;
    }
public function wait($unwrap = true)
    {
        $this->runner->wait($this->core);

        if ($unwrap) {
            if ($this->core->getState() === self::REJECTED) {
                throw $this->core->getException();
            }

            return $this->core->getResponse();
        }

        return null;
    }
public function wait ( $ unwrap = true ) { $ this -> runner -> wait ( $ this -> core ) ; if ( $ unwrap ) { if ( $ this -> core -> getState ( ) === self :: REJECTED ) { throw $ this -> core -> getException ( ) ; } return $ this -> core -> getResponse ( ) ; } return null ; }
Wait for the promise to be fulfilled or rejected.

When this method returns, the request has been resolved and the appropriate callable has terminated.

When called with the unwrap option

@param bool $unwrap Whether to return resolved value / throw reason or not

@return \Psr\Http\Message\ResponseInterface|null Resolved value, null if $unwrap is set to false

@throws \Http\Client\Exception The rejection reason
Wait for the promise to be fulfilled or rejected .