Predis\Cluster\ClusterStrategy::getKeyFromGeoradiusCommands PHP Метод

getKeyFromGeoradiusCommands() защищенный Метод

Extracts the key from GEORADIUS and GEORADIUSBYMEMBER commands.
protected getKeyFromGeoradiusCommands ( Predis\Command\CommandInterface $command ) : string | null
$command Predis\Command\CommandInterface Command instance.
Результат string | null
    protected function getKeyFromGeoradiusCommands(CommandInterface $command)
    {
        $arguments = $command->getArguments();
        $argc = count($arguments);
        $startIndex = $command->getId() === 'GEORADIUS' ? 5 : 4;
        if ($argc > $startIndex) {
            $keys = array($arguments[0]);
            for ($i = $startIndex; $i < $argc; ++$i) {
                $argument = strtoupper($arguments[$i]);
                if ($argument === 'STORE' || $argument === 'STOREDIST') {
                    $keys[] = $arguments[++$i];
                }
            }
            if ($this->checkSameSlotForKeys($keys)) {
                return $arguments[0];
            } else {
                return;
            }
        }
        return $arguments[0];
    }