private function sendRequest($url, $data, $type = 'POST')
{
$url = Fixtures::get('url') . '/api/v1/' . $url;
$data = json_encode($data);
$curl = curl_init();
$opts = [CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, CURLOPT_CUSTOMREQUEST => $type, CURLOPT_POST => $type === 'POST' ? 1 : 0, CURLOPT_POSTFIELDS => $data, CURLOPT_HTTPHEADER => ['Content-Type: application/json', 'Content-Length: ' . strlen($data), 'X-Ninja-Token: ' . $this->token]];
curl_setopt_array($curl, $opts);
$response = curl_exec($curl);
curl_close($curl);
//Debug::debug('Response: ' . $response);
return json_decode($response);
}