IpVerifierAPIController   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 9
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 9
ccs 3
cts 3
cp 1
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A indexAction() 0 5 2
1
<?php
2
3
namespace Linder\Controller;
4
5
use Anax\Commons\ContainerInjectableInterface;
6
use Anax\Commons\ContainerInjectableTrait;
7
use Linder\Model\IpVerifier;
8
9
/**
10
 * A controller that handles a get request
11
 * uses a model and returns a Json.
12
 * @return Array
13
 */
14
class IpVerifierAPIController implements ContainerInjectableInterface
15
{
16
    use ContainerInjectableTrait;
17
18 1
    public function indexAction() : array
19
    {
20 1
        $ip = $this->di->request->getGet("ip") ?: $this->di->request->getServer("REMOTE_ADDR");
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
        return [
22 1
            $this->di->get("ipverifier")->getJson($ip)
23
        ];
24
    }
25
}
26