CheckjsonController3::indexAction()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
nc 1
nop 0
dl 0
loc 14
c 1
b 0
f 0
cc 1
ccs 9
cts 9
cp 1
crap 1
rs 9.9666
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
Unused Code introduced by
The assignment to $ipController is dead and can be removed.
Loading history...
20 1
        $ipadress = $this->di->request->getGet("ipjson");
0 ignored issues
show
Bug introduced by
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