| Conditions | 2 |
| Paths | 2 |
| Total Lines | 24 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 14 |
| CRAP Score | 2.0011 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 21 | 1 | public function indexActionPost() : array |
|
| 22 | { |
||
| 23 | 1 | $request = $this->di->get("request"); |
|
| 24 | 1 | $query = $request->getPost("query"); |
|
| 25 | |||
| 26 | 1 | $geo = $this->validator->getGeo($query); |
|
| 27 | |||
| 28 | 1 | if ($geo["city"] !== null) { |
|
| 29 | $query = $geo["city"]; |
||
| 30 | } |
||
| 31 | |||
| 32 | 1 | $forecast = $this->weather->getForecast($query); |
|
| 33 | |||
| 34 | $json = [ |
||
| 35 | 1 | "error" => $forecast["error"], |
|
| 36 | 1 | "country_name" => $geo["country_name"], |
|
| 37 | 1 | "region_name" => $geo["region_name"], |
|
| 38 | 1 | "query" => $query, |
|
| 39 | 1 | "history" => $forecast["history"], |
|
| 40 | 1 | "today" => $forecast["today"], |
|
| 41 | 1 | "forecast" => $forecast["forecast"] |
|
| 42 | ]; |
||
| 43 | |||
| 44 | 1 | return [$json]; |
|
| 45 | } |
||
| 47 |