/**
  * @param string $collectorName
  *
  * @return RequestObject
  */
 public function createFromRequest($collectorName)
 {
     $requestObject = new RequestObject();
     $requestObject->setHeaders($this->request->headers->all());
     $requestObject->setPostParameters($this->request->request->all());
     $requestObject->setQueryParameters($this->request->query->all());
     $requestObject->setContent($this->request->getContent());
     $requestObject->setCollector($collectorName);
     $requestObject->setUri($this->request->getUri());
     $requestObject->setMethod($this->request->getMethod());
     return $requestObject;
 }
 /**
  * @test
  */
 public function itShouldTransformARequestForCurl()
 {
     $host = 'http://www.deuzu.com/';
     $postParameters = ['category' => 'tennis', 'enabled' => true];
     $headers = ['Host' => ['deuzu.com'], 'Content-Type' => ['image/jpg']];
     $requestObject = new RequestObject();
     $requestObject->setHeaders($headers);
     $requestObject->setPostParameters($postParameters);
     $requestObject->setUri($host);
     $expectedCurlHeaders = '--header "Host: deuzu.com" --header "Content-Type: image/jpg"';
     $expectedCurlPostParameters = '--data "category=tennis&enabled=1"';
     $expectedCurlRequest = sprintf('curl %s %s %s', $expectedCurlHeaders, $expectedCurlPostParameters, $host);
     $this->assertEquals($expectedCurlRequest, $this->twigExtension->requestToCurl($requestObject));
 }