@@ -186,6 +186,7 @@ public static function baseUrl($url)
186186
187187 /**
188188 * Base method for network requests
189+ * @throws \Exception
189190 */
190191 public static function request ($ options )
191192 {
@@ -196,6 +197,7 @@ public static function request($options)
196197
197198 /**
198199 * Make a get request
200+ * @throws \Exception
199201 */
200202 public static function get ($ url , $ config = [])
201203 {
@@ -204,6 +206,7 @@ public static function get($url, $config = [])
204206
205207 /**
206208 * Make a post request
209+ * @throws \Exception
207210 */
208211 public static function post ($ url , $ data , $ config = [])
209212 {
@@ -212,6 +215,7 @@ public static function post($url, $data, $config = [])
212215
213216 /**
214217 * Make a put request
218+ * @throws \Exception
215219 */
216220 public static function put ($ url , $ data , $ config = [])
217221 {
@@ -220,6 +224,7 @@ public static function put($url, $data, $config = [])
220224
221225 /**
222226 * Make a patch request
227+ * @throws \Exception
223228 */
224229 public static function patch ($ url , $ data , $ config = [])
225230 {
@@ -228,6 +233,7 @@ public static function patch($url, $data, $config = [])
228233
229234 /**
230235 * Make a delete request
236+ * @throws \Exception
231237 */
232238 public static function delete ($ url , $ config = [])
233239 {
@@ -236,12 +242,16 @@ public static function delete($url, $config = [])
236242
237243 /**
238244 * Make an options request
245+ * @throws \Exception
239246 */
240247 public static function options ($ url , $ config = [])
241248 {
242249 return static ::request (array_merge ($ config , ["url " => $ url , "method " => static ::OPTIONS ]));
243250 }
244251
252+ /**
253+ * @throws \Exception
254+ */
245255 private static function call ($ request )
246256 {
247257 static ::$ handler = curl_init ();
@@ -372,7 +382,7 @@ private static function call($request)
372382 *
373383 * @author Mashape (https://www.mashape.com)
374384 */
375- private static function parseHeaders ($ raw_headers )
385+ private static function parseHeaders (string $ raw_headers ): array
376386 {
377387 if (function_exists ('http_parse_headers ' )) {
378388 return \http_parse_headers ($ raw_headers );
@@ -419,20 +429,16 @@ public static function getInfo($opt = false)
419429 /**
420430 * This function is useful for serializing multidimensional arrays, and avoid getting
421431 * the 'Array to string conversion' notice
422- * @param array|object $data array to flatten.
432+ * @param array $data array to flatten.
423433 * @param bool|string $parent parent key or false if no parent
424434 * @return array
425435 *
426436 * @author Mashape (https://www.mashape.com)
427437 */
428- public static function buildHTTPCurlQuery ($ data , $ parent = false )
438+ public static function buildHTTPCurlQuery (array $ data , $ parent = false ): array
429439 {
430440 $ result = array ();
431441
432- if (is_object ($ data )) {
433- $ data = get_object_vars ($ data );
434- }
435-
436442 foreach ($ data as $ key => $ value ) {
437443 if ($ parent ) {
438444 $ new_key = sprintf ('%s[%s] ' , $ parent , $ key );
@@ -453,8 +459,9 @@ public static function buildHTTPCurlQuery($data, $parent = false)
453459
454460/**
455461 * Shortcut method for making network requests.
456- *
462+ *
457463 * @param array|string $options The url or request to hit.
464+ * @throws \Exception
458465 */
459466function fetch ($ options , $ params = [])
460467{
0 commit comments