Total Complexity | 7 |
Total Lines | 58 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
13 | class Curl |
||
14 | { |
||
15 | /** |
||
16 | * Function that uses curl and returns response |
||
17 | * |
||
18 | * @param string $url API URL to use in curl |
||
19 | * |
||
20 | * @return array $res Result in JSON |
||
21 | */ |
||
22 | |||
23 | public function getData(String $url) |
||
24 | { |
||
25 | $ch = curl_init($url); |
||
26 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
||
|
|||
27 | $res = curl_exec($ch); |
||
28 | curl_close($ch); |
||
29 | $res = json_decode($res, true); |
||
30 | |||
31 | return $res; |
||
32 | } |
||
33 | |||
34 | |||
35 | |||
36 | /** |
||
37 | * Function that uses multiple curls and returns response |
||
38 | * |
||
39 | * @param array $urls API URLs to use in curls |
||
40 | * |
||
41 | * @return array $res Result in JSON |
||
42 | */ |
||
43 | public function getMultiData(Array $urls) |
||
71 | } |
||
72 | } |
||
73 |