Issues (17)

src/Ip3/CheckjsonController3.php (3 issues)

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
The property IpController does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
15 1
    }
16
17 1
    public function indexAction() : array
18
    {
19 1
        $ipController = new Validera3();
0 ignored issues
show
The assignment to $ipController is dead and can be removed.
Loading history...
20 1
        $ipadress = $this->di->request->getGet("ipjson");
0 ignored issues
show
Accessing request on the interface Psr\Container\ContainerInterface suggest that you code against a concrete implementation. How about adding an instanceof check?
Loading history...
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