public function closeConnection() { if ($this->connection) { curl_close($this->connection); $this->connection = null; } }