public function disconnect() : self
{
if (is_resource($this->connection)) {
try {
$this->reset();
$this->writeData('QUIT');
fclose($this->connection);
$this->connection = null;
} catch (\Exception $e) {
// Disconnecting; ignore possible exceptions
}
}
return $this;
}