Conditions | 2 |
Paths | 2 |
Total Lines | 23 |
Code Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Tests | 14 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
12 | 2 | public function indexActionGet() : array |
|
13 | { |
||
14 | 2 | $this->api = require ANAX_INSTALL_PATH . "/config/keys.php"; |
|
|
|||
15 | 2 | $address = $this->di->get("request")->getGet("address"); |
|
16 | 2 | $curl = $this->di->get("curl"); |
|
17 | 2 | $curl->getIpData($address, $this->api["ip_key"]); |
|
18 | 2 | $curl->getWeatherData($this->api["weather_key"]); |
|
19 | 2 | $resOne = $curl->weatherData; |
|
20 | 2 | $resTwo = $curl->ipData; |
|
21 | |||
22 | 2 | if (sizeOf($resOne) == 2) { |
|
23 | $json = [ |
||
24 | 1 | "error" => $resOne["error"], |
|
25 | ]; |
||
26 | |||
27 | 1 | return [$json]; |
|
28 | } else { |
||
29 | $json = [ |
||
30 | 1 | "ip_data" => $resTwo, |
|
31 | 1 | "daily_weather" => $resOne["daily"]["data"], |
|
32 | ]; |
||
33 | |||
34 | 1 | return [$json]; |
|
35 | } |
||
38 |