public function __construct($edge, $method, $fields) { $url = self::API_URL . ($edge[0] !== '/' ? '/' : '') . $edge; $options = []; if (!empty($fields)) { if ($method === 'get') { $url .= '?' . http_build_query($fields); } else { $options[CURLOPT_POSTFIELDS] = json_encode($fields, JSON_UNESCAPED_UNICODE); } } $options[CURLOPT_CUSTOMREQUEST] = strtoupper($method); parent::__construct($url, $options); }