Conditions | 4 |
Paths | 4 |
Total Lines | 15 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 11 |
CRAP Score | 4.0092 |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
24 | 1 | public function weatherActionPost() : array |
|
25 | { |
||
26 | 1 | $request = $this->di->get("request"); |
|
27 | 1 | $geoipService = $this->di->get("location"); |
|
28 | 1 | $weatherService = $this->di->get("weather"); |
|
29 | 1 | $ipAdress = $request->getPost("ipCheck"); |
|
30 | 1 | $res = $geoipService->curlIpApi($ipAdress); |
|
31 | |||
32 | 1 | if (isset($res["Message"])) { |
|
33 | return [$res]; |
||
34 | } |
||
35 | 1 | if (in_array("Prognos", $request->getPost())) { |
|
36 | 1 | return [$weatherService->curlWeatherApi($res[0]["Longitude"], $res[0]["Latitude"])]; |
|
37 | 1 | } elseif ((in_array("Äldre data", $request->getPost()))) { |
|
38 | 1 | return [$weatherService->curlOldWeatherApi($res[0]["Longitude"], $res[0]["Latitude"])]; |
|
39 | } |
||
42 |
For hinted functions/methods where all return statements with the correct type are only reachable via conditions, ?null? gets implicitly returned which may be incompatible with the hinted type. Let?s take a look at an example: