Predis\Command\Processor\KeyPrefixProcessor::sort PHP Метод

sort() публичный статический Метод

Applies the specified prefix to the keys of a SORT command.
public static sort ( Predis\Command\CommandInterface $command, string $prefix )
$command Predis\Command\CommandInterface Command instance.
$prefix string Prefix string.
    public static function sort(CommandInterface $command, $prefix)
    {
        if ($arguments = $command->getArguments()) {
            $arguments[0] = "{$prefix}{$arguments[0]}";
            if (($count = count($arguments)) > 1) {
                for ($i = 1; $i < $count; ++$i) {
                    switch (strtoupper($arguments[$i])) {
                        case 'BY':
                        case 'STORE':
                            $arguments[$i] = "{$prefix}{$arguments[++$i]}";
                            break;
                        case 'GET':
                            $value = $arguments[++$i];
                            if ($value !== '#') {
                                $arguments[$i] = "{$prefix}{$value}";
                            }
                            break;
                        case 'LIMIT':
                            $i += 2;
                            break;
                    }
                }
            }
            $command->setRawArguments($arguments);
        }
    }