Find the union between sets and store in a new set.

@param  string  $output
@param  array  $keys
@param  array  $options
@return int
162196
public function zunionstore($output, $keys, $options = [])
    {
        return $this->command('zUnion', [$output, $keys,
            $options['weights'] ?? null,
            $options['aggregate'] ?? 'sum',
        ]);
    }
1062969
public static function output($data, array $options = [])
    {
        $options = array_merge([
            'trace_offset' => 0,
        ], $options);

        if (!self::$output || !is_string($data)) {
            return;
        }

        if (php_sapi_name() == 'cli') {
            echo str_pad(' DEBUG ', 100, '-', STR_PAD_BOTH);
            echo "\n";
            if (self::$showCalledFrom) {
                echo self::getCalledFrom($options['trace_offset'] + 2);
                echo "\n";
            }
            echo $data;
            echo "\n";
        } else {
            if (self::$showCalledFrom) {
                echo sprintf(self::$style['called_from_format'], self::getCalledFrom($options['trace_offset'] + 2));
            }
            echo sprintf(self::$style['output_format'], $data);
        }
    }
539086
public function addIndex(array $keys, array $options = []) : void
    {
        $this->indexes[] = [
            'keys' => array_map(static function ($value) {
                if ($value === 1 || $value === -1) {
                    return $value;
                }
                if (is_string($value)) {
                    $lower = strtolower($value);
                    if ($lower === 'asc') {
                        return 1;
                    }

                    if ($lower === 'desc') {
                        return -1;
                    }
                }
                return $value;
            }, $keys),
            'options' => $options,
        ];
    }
1119902
public function blpop($keys, $timeout) {
        $keys = (array)$keys;
        return $this->returnCommand(['BLPOP'], $keys, [$keys, $timeout], ResponseParser::PARSE_ASSOC_ARRAY);
    }
6131
public static function selectByIds($ids, array $options = [], array $criteria = [])
    {
        $criteria = static::cleanCriteria($criteria);
        if (empty($criteria)) {
            $criteria['select'] = ['*'];
        }

        if (is_array($ids)) {
            $ids = implode(',', $ids);
        }

        $pk = static::getPrimaryKeyStatic();
        if (!empty($ids)) {
            $idsPhrase = " $pk IN ($ids) ";

            $condition = array_get($criteria, 'condition');

            if (!empty($condition)) {
                $condition .= ' AND ' . $idsPhrase;
            } else {
                $condition = $idsPhrase;
            }

            $criteria['condition'] = $condition;
        }

        $data = static::selectByRequest($criteria, $options);

        $data = static::cleanResult($data, array_get($criteria, 'select'));
        if (!is_array($ids)) {
            $ids = explode(',', $ids);
        }
        if (count($data) != count($ids)) {
            $out = [];
            $continue = array_get_bool($options, ApiOptions::CONTINUES);
            foreach ($ids as $index => $id) {
                $found = false;
                foreach ($data as $record) {
                    if ($id == array_get($record, $pk)) {
                        $out[$index] = $record;
                        $found = true;
                        break;
                    }
                }
                if (!$found) {
                    $out[$index] = new NotFoundException("Record with identifier '$id' not found.");
                    if (!$continue) {
                        break;
                    }
                }
            }

            throw new BatchException($out, 'Batch Error: Not all requested records could be retrieved.');
        }

        return $data;
    }
463775
private function unionAggregate(array $sets, array $weights = null, string $aggregate = 'SUM'): int
    {
        return $this->handle->zUnion($this->name, $sets, $weights, $aggregate);
    }
365476
public function install(array $options = null, OutputInterface $output = null) {
		return $this->call_command('install', $this->prepare_array_input_args($options), $output);
	}
383873
public static function contains( $options = array(), $key )
    {
        $_key = static::_cleanKey( $key );

        //	Check both the raw and cooked keys
        return
            ( is_array( $options ) && ( isset( $options[$key] ) || isset( $options[$_key] ) ) ) ||
            ( is_object( $options ) && ( property_exists( $options, $key ) || property_exists( $options, $_key ) ) );
    }
10111
protected function createIteratorForMultipleInputs(array $iteratables, PsiOptions $options)
    {
        // when we have multiple inputs we need an option to decide on how to deal with colliding keys
        if ($options->isPreserveKeysOfMultipleInputs()) {
            // this iterator return the original keys of each child iterator
            // -> this leads to conflicts OR means we preserve keys
            $iterator = new \AppendIterator();
        } else {
            // this iterator will create numeric keys from 0 .. n
            $iterator = new KeylessAppendIterator();
        }

        foreach ($iteratables as $iteratable) {
            $iterator->append($this->createSingleIterator($iteratable));
        }

        return $iterator;
    }
943429
public function delete($key, $options = array()) {
        $return= false;
        if ($cache = $this->getCacheProvider($this->getOption(xPDO::OPT_CACHE_KEY, $options), $options)) {
            $return= $cache->delete($key, $options);
        }
        return $return;
    }
1367239
public function sortKeys( int $options = SORT_REGULAR, bool $desc = false )
	{
		$items = $this->items;
		$desc ? krsort($items, $options) : ksort($items, $options);
		return new static($items);
	}
1283593
public static function getStats($key, $options = [])
    {
        // Merge options with default options
        $options = array_merge([
            // Show nested (boolean)
            'nested'         => true,
            // Prefix for nested items (string)
            'nested_prefix'  => '|-- ',
            // Max key length (int)
            'max_key_length' => 100,
        ], $options);

        // If item does not exist
        if (!isset(self::$collection[$key])) {
            return 'Unknow item in with key: ' . $key;
        }

        // Get item
        $item = self::$collection[$key];

        // Get item result
        $itemResult          = 'N/A';
        $itemResultFormatted = 'N/A';
        if (isset($item['start']) && isset($item['stop'])) {
            $itemResult          = (($item['stop'] - $item['start']) * 1000);
            $itemResultFormatted = self::formatMiliseconds($itemResult, 4, self::$forceDisplayUnit);
        }

        // Variable for output
        $output = '';

        // Prep key for output
        $outputName = '';
        $outputName .= ($options['nested'] ? str_repeat($options['nested_prefix'], $item['level']) : '');
        $outputName .= $item['key'];
        if (mb_strlen($outputName) > $options['max_key_length']) {
            $outputName = '~' . mb_substr($item['key'], -($options['max_key_length'] - 1));
        }

        // Add item stats
        $output .= str_pad($outputName, ($options['max_key_length'] + (strlen($outputName) - mb_strlen($outputName))), ' ');
        $output .= ' | ';
        $output .= str_pad($itemResultFormatted, 20, ' ', ($itemResult == 'N/A' ? STR_PAD_RIGHT : STR_PAD_LEFT));

        if (php_sapi_name() != 'cli' && is_array(self::$colorThreshold) && count(self::$colorThreshold)) {
            krsort(self::$colorThreshold);
            foreach (self::$colorThreshold as $value => $color) {
                if (is_numeric($itemResult) && $itemResult >= $value) {
                    $output = '<span style="color: ' . $color . ';">' . $output . '</span>';
                }
            }
        }

        return $output;
    }
139830
public function update(string $from, $wheres, array $values, array $options = [])
    {
        list($where, $bindings) = DBHelper::handleConditions($wheres, $this);

        $options['update'] = $this->qn($from);
        $options['where'] = $where;

        $statement = $this->compileUpdate($values, $bindings, $options);

        if (isset($options['returnSql'])) {
            return [$statement, $bindings];
        }

        return $this->fetchAffected($statement, $bindings);
    }
347423
protected function prepareResult(&$data, array $options)
    {
        if (!empty($options['unserialize']) && !empty($data)) {
            foreach ((array) $options['unserialize'] as $field) {
                $data[$field] = empty($data[$field]) ? array() : unserialize($data[$field]);
            }
        }
    }
1311492
public static function show($key = null, $options = [])
    {
        $output = self::getStats($key, $options);

        if (!empty($output)) {
            self::output($output);
        }
    }
568767
private function checkRequired(array $options, array $keys)
    {
        $missing = array_keys(array_diff_key(array_flip($keys), $options));

        if (!empty($missing)) {
            throw CommandException::missingOptions($missing);
        }
    }
135472
protected function doEncode(array $input, array $keys = []) {
    $output = [];

    foreach ($input as $key => $value) {
      $keys[] = $key;

      if (is_array($value)) {
        if ($this->isAssociative($value)) {
          $output = array_merge($output, $this->doEncode($value, $keys));
        }
        else {
          foreach ($value as $j) {
            $output[] = $this->keysToString($keys) . '[] = ' . $j;
          }
        }
      }
      else {
        $output[] = $this->keysToString($keys) . ' = ' . $value;
      }

      array_pop($keys);
    }

    return $output;
  }