public function send($asArray = true)
{
$options = array();
// query
if (!empty($this->query)) {
$options['query'] = $this->query;
}
// body
if (!empty($this->body)) {
$options['body'] = $this->body;
}
// ssl cert
if ($this->sslCert && $this->sslKey) {
$options['cert'] = $this->sslCert;
$options['ssl_key'] = $this->sslKey;
}
$response = (new Client())->request($this->method, $this->uri, $options);
$contents = $response->getBody()->getContents();
if (!$asArray) {
return $contents;
}
$array = Serializer::parse($contents);
return new ArrayCollection($array);
}