Predis\Connection\Aggregate\SentinelReplication::getConnectionInternal PHP Метод

getConnectionInternal() приватный Метод

Returns the connection instance in charge for the given command.
private getConnectionInternal ( Predis\Command\CommandInterface $command ) : Predis\Connection\NodeConnectionInterface
$command Predis\Command\CommandInterface Command instance.
Результат Predis\Connection\NodeConnectionInterface
    private function getConnectionInternal(CommandInterface $command)
    {
        if (!$this->current) {
            if ($this->strategy->isReadOperation($command) && ($slave = $this->pickSlave())) {
                $this->current = $slave;
            } else {
                $this->current = $this->getMaster();
            }
            return $this->current;
        }
        if ($this->current === $this->master) {
            return $this->current;
        }
        if (!$this->strategy->isReadOperation($command)) {
            $this->current = $this->getMaster();
        }
        return $this->current;
    }