Conditions | 1 |
Paths | 1 |
Total Lines | 13 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 1 |
Changes | 0 |
1 | <?php |
||
30 | 3 | public function getWeatherData($weatherKey) |
|
31 | { |
||
32 | 3 | $curl = curl_init('https://api.darksky.net/forecast/' . $weatherKey . '/' . $this->ipData["latitude"] . "," . $this->ipData["longitude"]); |
|
33 | 3 | curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); |
|
34 | |||
35 | // Store the data: |
||
36 | 3 | $json = curl_exec($curl); |
|
37 | 3 | curl_close($curl); |
|
38 | |||
39 | // Decode JSON response: |
||
40 | 3 | $this->weatherData = json_decode($json, true); |
|
41 | |||
42 | 3 | return $this->weatherData; |
|
43 | } |
||
45 |