public function onFinish() { if (isset($this->client)) { $this->client->finish(); } unset($this->client); }