code: public function getConnectionByRole($role)
      {
          if ($role === 'master') {
              return $this->getMaster();
          } elseif ($role === 'slave') {
              return $this->pickSlave();
          } elseif ($role === 'sentinel') {
              return $this->getSentinelConnection();
          }
      }
docs: Returns a connection by its role.
  
  @param string $role Connection role (`master`, `slave` or `sentinel`)
  
  @return NodeConnectionInterface|null