SandraJinnevall /
ramverk1-module
| 1 | <?php |
||
| 2 | |||
| 3 | namespace Anax\Ip3; |
||
| 4 | |||
| 5 | use Anax\Commons\ContainerInjectableInterface; |
||
| 6 | use Anax\Commons\ContainerInjectableTrait; |
||
| 7 | |||
| 8 | class CheckjsonController3 implements ContainerInjectableInterface |
||
| 9 | { |
||
| 10 | use ContainerInjectableTrait; |
||
| 11 | |||
| 12 | 1 | public function initialize() |
|
| 13 | { |
||
| 14 | 1 | $this->IpController = new Validera3(); |
|
|
0 ignored issues
–
show
Bug
Best Practice
introduced
by
Loading history...
|
|||
| 15 | 1 | } |
|
| 16 | |||
| 17 | 1 | public function indexAction() : array |
|
| 18 | { |
||
| 19 | 1 | $ipController = new Validera3(); |
|
|
0 ignored issues
–
show
|
|||
| 20 | 1 | $ipadress = $this->di->request->getGet("ipjson"); |
|
|
0 ignored issues
–
show
|
|||
| 21 | 1 | $weather = $this->di->get("validera3"); |
|
| 22 | |||
| 23 | $json = [ |
||
| 24 | 1 | "Stad" => $ipadress, |
|
| 25 | 1 | "validerbar" => $weather->check($ipadress), |
|
| 26 | 1 | "weatherForecast" => $weather->getWeather($ipadress)["weatherForecast"], |
|
| 27 | 1 | "weatherHistory" => $weather->getWeather($ipadress)["weatherHistory"], |
|
| 28 | ]; |
||
| 29 | |||
| 30 | 1 | return [$json]; |
|
| 31 | } |
||
| 32 | } |
||
| 33 |