Predis\Pipeline\Pipeline::executePipeline PHP Method

executePipeline() protected method

Implements the logic to flush the queued commands and read the responses from the current connection.
protected executePipeline ( Predis\Connection\ConnectionInterface $connection, SplQueue $commands ) : array
$connection Predis\Connection\ConnectionInterface Current connection instance.
$commands SplQueue Queued commands.
return array
    protected function executePipeline(ConnectionInterface $connection, \SplQueue $commands)
    {
        foreach ($commands as $command) {
            $connection->writeRequest($command);
        }
        $responses = array();
        $exceptions = $this->throwServerExceptions();
        while (!$commands->isEmpty()) {
            $command = $commands->dequeue();
            $response = $connection->readResponse($command);
            if (!$response instanceof ResponseInterface) {
                $responses[] = $command->parseResponse($response);
            } elseif ($response instanceof ErrorResponseInterface && $exceptions) {
                $this->exception($connection, $response);
            } else {
                $responses[] = $response;
            }
        }
        return $responses;
    }