protected switchServerIfNeeded ( string | null $currentServer, string | null $wantedServer, LdapTools\Operation\LdapOperationInterface $operation ) | ||
$currentServer | string | null | The server we are currently on. |
$wantedServer | string | null | The server we want the connection to be on. |
$operation | LdapTools\Operation\LdapOperationInterface |
protected function switchServerIfNeeded($currentServer, $wantedServer, LdapOperationInterface $operation)
{
if ($operation instanceof AuthenticationOperation || MBString::strtolower($currentServer) == MBString::strtolower($wantedServer)) {
return;
}
if ($this->connection->isBound()) {
$this->connection->close();
}
$this->connection->connect(null, null, false, $wantedServer);
}