/** * Cancellation callback * @param callable $resolve * @param callable $reject */ private function cancel(callable $resolve, callable $reject) { /* did we finish in the meantime? */ if ($this->response) { $this->complete($resolve, $reject); } else { $this->client->detach($this); $this->client->dequeue($this->request); $reject("Cancelled"); } }