/**
  * Send $event's data to the listener via an HTTP request.
  * Process the data if a custom processor is specified.
  *
  * @return $this
  */
 public function sendRequest()
 {
     $t = microtime(true);
     $client = new Client();
     $request = $client->createRequest($this->listener->method, $this->listener->url, $this->listener->headers, $this->listener->process($this->event));
     try {
         $response = $request->send();
     } catch (ClientErrorResponseException $exc) {
         $this->error = true;
         $this->time = microtime(true) - $t;
         $response = $exc->getResponse();
     } catch (RequestException $exc) {
         $this->error = true;
         $this->status = 0;
         $this->time = microtime(true) - $t;
         $this->body = $exc->getMessage();
         return $this;
     }
     $this->status = $response->getStatusCode();
     $this->headers = $response->getRawHeaders();
     $this->body = $response->getBody(true);
     $this->time = microtime(true) - $t;
     return $this;
 }
 /**
  * @param Listener $listener
  * @return Listener
  */
 public function removeListener(Listener $listener)
 {
     /** @var Link $link */
     foreach ($listener->getLinks() as $link) {
         if ($link->rel == 'self') {
             $self = $link;
             break;
         }
     }
     if (isset($self)) {
         $this->delete($this->baseURL . $self->getUrl());
     }
     return $listener;
 }