connection = new mysqli($credentials->getHostname(), $credentials->getUser(), $credentials->getPassword()); if ($this->connection->connect_error) { throw new Exception("Connection failed: " . $this->connection->connect_error); } } public function getConnection(): mysqli { return $this->connection; } }