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

switchTo() публичный Метод

public switchTo ( $connection )
    public function switchTo($connection)
    {
        if (!$connection instanceof NodeConnectionInterface) {
            $connection = $this->getConnectionById($connection);
        }
        if ($connection && $connection === $this->current) {
            return;
        }
        if ($connection !== $this->master && !in_array($connection, $this->slaves, true)) {
            throw new \InvalidArgumentException('Invalid connection or connection not found.');
        }
        $connection->connect();
        if ($this->current) {
            $this->current->disconnect();
        }
        $this->current = $connection;
    }