src/JsonRpc/JsonRpcClient.php
public function getResponseCollection(float $timeout = 0): ResponseCollection
    {
        if ($timeout < $this->timeout) {
            $timeout = $this->timeout;
        }

        $now = microtime(true);
        $responseCollection = new JsonRpcResponseCollection();

        do {
            $message = $this->queue->get(Constants::AMQP_AUTOACK);

            if ($message instanceof Envelope) {
                $responseCollection->addResponse($this->responseFromEnvelope($message));
            } else {
                usleep($this->waitMillis * 1000);
            }
            $time = microtime(true);
        } while (
            $responseCollection->count() < $this->countRequests
            && (0 == $timeout || ($timeout > 0 && (($time - $now) < $timeout)))
        );

        $this->requestIds = [];
        $this->timeout = 0;
        $this->countRequests = 0;

        return $responseCollection;
    }
public function getResponseCollection(float $timeout = 0): ResponseCollection
    {
        if ($timeout < $this->timeout) {
            $timeout = $this->timeout;
        }

        $now = microtime(true);
        $responseCollection = new JsonRpcResponseCollection();

        do {
            $message = $this->queue->get(Constants::AMQP_AUTOACK);

            if ($message instanceof Envelope) {
                $responseCollection->addResponse($this->responseFromEnvelope($message));
            } else {
                usleep($this->waitMillis * 1000);
            }
            $time = microtime(true);
        } while (
            $responseCollection->count() < $this->countRequests
            && (0 == $timeout || ($timeout > 0 && (($time - $now) < $timeout)))
        );

        $this->requestIds = [];
        $this->timeout = 0;
        $this->countRequests = 0;

        return $responseCollection;
    }
public function getResponseCollection ( float $ timeout = 0 ) : ResponseCollection { if ( $ timeout < $ this -> timeout ) { $ timeout = $ this -> timeout ; } $ now = microtime ( true ) ; $ responseCollection = new JsonRpcResponseCollection ( ) ; do { $ message = $ this -> queue -> get ( Constants :: AMQP_AUTOACK ) ; if ( $ message instanceof Envelope ) { $ responseCollection -> addResponse ( $ this -> responseFromEnvelope ( $ message ) ) ; } else { usleep ( $ this -> waitMillis * 1000 ) ; } $ time = microtime ( true ) ; } while ( $ responseCollection -> count ( ) < $ this -> countRequests && ( 0 == $ timeout || ( $ timeout > 0 && ( ( $ time - $ now ) < $ timeout ) ) ) ) ; $ this -> requestIds = [ ] ; $ this -> timeout = 0 ; $ this -> countRequests = 0 ; return $ responseCollection ; }
Get response collection

@param float $timeout in seconds
@return ResponseCollection
Get response collection