public function sendRequest(RequestInterface $request, array $options = []): ResponseInterface
    {
        $options = $this->validateOptions($options);
        $originalCallback = $options->get('callback');
        $responseToReturn = null;
        $options = $options->add(['callback' => function (RequestInterface $request, ResponseInterface $response = null, ClientException $e = null) use (&$responseToReturn, $originalCallback) {
            $responseToReturn = $response;
            $originalCallback($request, $response, $e);

            if (null !== $e) {
                throw $e;
            }
        }]);

        $this->addToQueue($request, $options);
        $this->flush();

        return $responseToReturn;
    }
public function sendRequest(RequestInterface $request, array $options = []): ResponseInterface
    {
        $options = $this->validateOptions($options);
        $originalCallback = $options->get('callback');
        $responseToReturn = null;
        $options = $options->add(['callback' => function (RequestInterface $request, ResponseInterface $response = null, ClientException $e = null) use (&$responseToReturn, $originalCallback) {
            $responseToReturn = $response;
            $originalCallback($request, $response, $e);

            if (null !== $e) {
                throw $e;
            }
        }]);

        $this->addToQueue($request, $options);
        $this->flush();

        return $responseToReturn;
    }
public function sendRequest ( RequestInterface $ request , array $ options = [ ] ) : ResponseInterface { $ options = $ this -> validateOptions ( $ options ) ; $ originalCallback = $ options -> get ( 'callback' ) ; $ responseToReturn = null ; $ options = $ options -> add ( [ 'callback' => function ( RequestInterface $ request , ResponseInterface $ response = null , ClientException $ e = null ) use ( & $ responseToReturn , $ originalCallback ) { $ responseToReturn = $ response ; $ originalCallback ( $ request , $ response , $ e ) ; if ( null !== $ e ) { throw $ e ; } } ] ) ; $ this -> addToQueue ( $ request , $ options ) ; $ this -> flush ( ) ; return $ responseToReturn ; }
This is a blocking function call.
This is a blocking function call .