src/Connection/Aggregate/SentinelReplication.php
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;
    }
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;
    }
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 ; }
Returns the connection instance in charge for the given command.

@param CommandInterface $command Command instance.

@return NodeConnectionInterface
Returns the connection instance in charge for the given command .