public function getConnectionByRole($role)
    {
        if ($role === 'master') {
            return $this->getMaster();
        } elseif ($role === 'slave') {
            return $this->pickSlave();
        } elseif ($role === 'sentinel') {
            return $this->getSentinelConnection();
        }
    }
public function getConnectionByRole($role)
    {
        if ($role === 'master') {
            return $this->getMaster();
        } elseif ($role === 'slave') {
            return $this->pickSlave();
        } elseif ($role === 'sentinel') {
            return $this->getSentinelConnection();
        }
    }
public function getConnectionByRole ( $ role ) { if ( $ role === 'master' ) { return $ this -> getMaster ( ) ; } elseif ( $ role === 'slave' ) { return $ this -> pickSlave ( ) ; } elseif ( $ role === 'sentinel' ) { return $ this -> getSentinelConnection ( ) ; } }
Returns a connection by its role.

@param string $role Connection role (`master`, `slave` or `sentinel`)

@return NodeConnectionInterface|null
Returns a connection by its role .