library/Rediska/Command/CompareSortedSets.php
public function parseResponses($responses)
    {
        if ($this->isAtomic()) {
           return $responses[0];
        } else {
            $sets = array();
            $valuesWithScores = array();
            foreach ($this->_keys as $key) {
                $sets[$key] = array();
                $response = current($responses);
                next($responses);
                $isValue = true;
                foreach ($response as $valueOrScore) {
                    if ($isValue) {
                        $value = $valueOrScore;
                        $sets[$key][] = $value;
                        if (!isset($valuesWithScores[$value])) {
                            $valuesWithScores[$value] = array();
                        }
                    } else {
                        $score = $valueOrScore;
                        $valuesWithScores[$value][] = $score * $this->_weights[$key];
                    }
                    $isValue = !$isValue;
                }
            }

            $aggregation = strtolower($this->aggregation);
            
            $pipeline = $this->_rediska->pipeline();

            $count = 0;
            foreach($this->_compareSets($sets) as $value) {
                $scores = $valuesWithScores[$value];
                switch ($aggregation) {
                    case self::SUM:
                        $score = array_sum($scores);
                        break;
                    case self::MIN:
                        $score = min($scores);
                        break;
                    case self::MAX:
                        $score = max($scores);
                        break;
                    default:
                        throw new Rediska_Command_Exception('Unknown aggregation method ' . $this->aggregation);
                }

                $value = $this->_rediska->getSerializer()->unserialize($value);

                $pipeline->addToSortedSet($this->storeKey, $value, $score);

                $count++;
            }

            $pipeline->execute();

            return $count;
        }
    }
public function parseResponses($responses)
    {
        if ($this->isAtomic()) {
           return $responses[0];
        } else {
            $sets = array();
            $valuesWithScores = array();
            foreach ($this->_keys as $key) {
                $sets[$key] = array();
                $response = current($responses);
                next($responses);
                $isValue = true;
                foreach ($response as $valueOrScore) {
                    if ($isValue) {
                        $value = $valueOrScore;
                        $sets[$key][] = $value;
                        if (!isset($valuesWithScores[$value])) {
                            $valuesWithScores[$value] = array();
                        }
                    } else {
                        $score = $valueOrScore;
                        $valuesWithScores[$value][] = $score * $this->_weights[$key];
                    }
                    $isValue = !$isValue;
                }
            }

            $aggregation = strtolower($this->aggregation);
            
            $pipeline = $this->_rediska->pipeline();

            $count = 0;
            foreach($this->_compareSets($sets) as $value) {
                $scores = $valuesWithScores[$value];
                switch ($aggregation) {
                    case self::SUM:
                        $score = array_sum($scores);
                        break;
                    case self::MIN:
                        $score = min($scores);
                        break;
                    case self::MAX:
                        $score = max($scores);
                        break;
                    default:
                        throw new Rediska_Command_Exception('Unknown aggregation method ' . $this->aggregation);
                }

                $value = $this->_rediska->getSerializer()->unserialize($value);

                $pipeline->addToSortedSet($this->storeKey, $value, $score);

                $count++;
            }

            $pipeline->execute();

            return $count;
        }
    }
Parse responses

@param array $responses
@return integer