| Conditions | 2 |
| Paths | 2 |
| Total Lines | 15 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 2 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 21 | 2 | public function indexActionPost() : array |
|
| 22 | { |
||
| 23 | 2 | $location = $this->di->request->getPost("location", ""); |
|
|
|
|||
| 24 | 2 | $pastMonth = $this->di->request->getPost("past-month") !== null; |
|
| 25 | 2 | $status = 200; |
|
| 26 | |||
| 27 | try { |
||
| 28 | 2 | $res = $this->di->weather->forecast($location, $pastMonth); |
|
| 29 | 1 | } catch (\Exception $ex) { |
|
| 30 | 1 | $status = 400; |
|
| 31 | 1 | $message = $ex->getMessage(); |
|
| 32 | 1 | $res = [ "status" => $status, "message" => $message ]; |
|
| 33 | } |
||
| 34 | |||
| 35 | 2 | return [ (array) $res, $status ]; |
|
| 36 | } |
||
| 38 |