IpVerifierAPIController::indexAction()   A
last analyzed

Complexity

Conditions 2
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 3
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 5
ccs 3
cts 3
cp 1
crap 2
rs 10
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