/**
  * Call upon the adapter to create an response object.
  *
  * @param RequestEvent $event
  *
  * @throws \Exception
  *
  * @return Response
  */
 public function sendRequest(RequestEvent $event)
 {
     switch ($event->getMethod()) {
         case 'GET':
             $response = $this->getHttpClient()->getAdapter()->get($event->getRequest());
             break;
         case 'HEAD':
             $response = $this->getHttpClient()->getAdapter()->head($event->getRequest());
             break;
         case 'POST':
             $response = $this->getHttpClient()->getAdapter()->post($event->getRequest());
             break;
         case 'PUT':
             $response = $this->getHttpClient()->getAdapter()->put($event->getRequest());
             break;
         case 'PATCH':
             $response = $this->getHttpClient()->getAdapter()->patch($event->getRequest());
             break;
         case 'DELETE':
             $response = $this->getHttpClient()->getAdapter()->delete($event->getRequest());
             break;
         default:
             throw new RuntimeException(sprintf('Unkown request method "%s".', $event->getMethod()));
     }
     return $response;
 }
 public function onBeforeSend(RequestEvent $event)
 {
     $event->getRequest()->getHeaders()->set('User-Agent', self::USER_AGENT);
 }