library/Rediska/Connection/Exec.php
public static function readResponseFromConnection(Rediska_Connection $connection)
    {
        $reply = $connection->readLine();

        if ($reply === null) {
            return $reply;
        }

        $type = substr($reply, 0, 1);
        $data = substr($reply, 1);

        switch ($type) {
            case self::REPLY_STATUS:
                if ($data == 'OK') {
                    return true;
                } else {
                    return $data;
                }
            case self::REPLY_ERROR:
                throw new Rediska_Connection_Exec_Exception($data);
            case self::REPLY_INTEGER:
                if (strpos($data, '.') !== false) {
                    $number = (integer)$data;
                } else {
                    $number = (float)$data;
                }

                return $number;
            case self::REPLY_BULK:
                if ($data == '-1') {
                    return null;
                } else {
                    $length = (integer)$data;

                    return $connection->read($length);
                }
            case self::REPLY_MULTY_BULK:
                $count = (integer)$data;

                $replies = array();
                for ($i = 0; $i < $count; $i++) {
                    $replies[] = self::readResponseFromConnection($connection);
                }

                return $replies;          
            default:
                throw new Rediska_Connection_Exec_Exception("Invalid reply type: '$type'");
        }
    }
public static function readResponseFromConnection(Rediska_Connection $connection)
    {
        $reply = $connection->readLine();

        if ($reply === null) {
            return $reply;
        }

        $type = substr($reply, 0, 1);
        $data = substr($reply, 1);

        switch ($type) {
            case self::REPLY_STATUS:
                if ($data == 'OK') {
                    return true;
                } else {
                    return $data;
                }
            case self::REPLY_ERROR:
                throw new Rediska_Connection_Exec_Exception($data);
            case self::REPLY_INTEGER:
                if (strpos($data, '.') !== false) {
                    $number = (integer)$data;
                } else {
                    $number = (float)$data;
                }

                return $number;
            case self::REPLY_BULK:
                if ($data == '-1') {
                    return null;
                } else {
                    $length = (integer)$data;

                    return $connection->read($length);
                }
            case self::REPLY_MULTY_BULK:
                $count = (integer)$data;

                $replies = array();
                for ($i = 0; $i < $count; $i++) {
                    $replies[] = self::readResponseFromConnection($connection);
                }

                return $replies;          
            default:
                throw new Rediska_Connection_Exec_Exception("Invalid reply type: '$type'");
        }
    }
Read response from connection

@param Rediska_Connection $connection
@return mixed