Conditions | 3 |
Paths | 3 |
Total Lines | 18 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Tests | 14 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
22 | 3 | public function weather($longitude, $latitude, $type) |
|
23 | { |
||
24 | 3 | if ($type=="future") { |
|
25 | 1 | $url = ($this->baseUrl . $this->darkSkyKey . "/" . $latitude . "," . $longitude . $this->apiSettings); |
|
26 | 1 | $cURL = new CURL; |
|
27 | 1 | $result = $cURL->req($url); |
|
28 | 1 | $result = json_decode($result); |
|
29 | 1 | if ($result == null) { |
|
30 | 1 | $result["error"] = "något blev fel"; |
|
31 | 1 | $result["daily"]["data"][0] = "no info"; |
|
32 | 1 | $result = json_decode(json_encode($result)); |
|
33 | } |
||
34 | 1 | return $result; |
|
35 | } else { |
||
36 | 2 | $multi = new MultiCURL($this->di); |
|
37 | |||
38 | 2 | $result = $multi->multicurla($longitude, $latitude); |
|
39 | 2 | return $result; |
|
40 | } |
||
43 |