Conditions | 3 |
Paths | 4 |
Total Lines | 16 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 12 |
CRAP Score | 3 |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
63 | 2 | public function getWeatherPast(String $latlon) : array |
|
64 | { |
||
65 | 2 | $curr = time(); |
|
66 | 2 | $urls = []; |
|
67 | 2 | for ($i = 0; $i < 30; $i++) { |
|
68 | // take away a day from current time |
||
69 | 2 | $curr -= 86400; |
|
70 | 2 | $urls[] = $this->config["url"] . $latlon . "," . $curr . $this->config["multi"]; |
|
71 | } |
||
72 | 2 | $res = $this->curl->multi($urls); |
|
73 | 2 | $size = count($res); |
|
74 | 2 | for ($i = 0; $i < $size; $i++) { |
|
75 | 2 | $time = $res[$i]["daily"]["data"][0]["time"]; |
|
76 | 2 | $res[$i]["daily"]["data"][0]["date"] = date("Y-m-d", $time); |
|
77 | } |
||
78 | 2 | return $res; |
|
79 | } |
||
81 |