22use InvalidArgumentException;
38 private $loadBalancer;
61 if ( !is_string( $domain ) && $domain !==
false ) {
62 throw new InvalidArgumentException(
'$dbName must be a string, or false.' );
65 $this->loadBalancer = $loadBalancer;
66 $this->domain = $domain;
67 $this->groups = $groups;
76 private function getConnection( $i, ?array $groups =
null,
int $flags = 0 ) {
77 $groups ??= $this->groups;
78 return $this->loadBalancer->getConnection( $i, $groups, $this->domain, $flags );
90 return $this->getConnection(
DB_PRIMARY,
null, $flags );
103 $groups ??= $this->groups;
104 return $this->getConnection(
DB_REPLICA, $groups, $flags );