MakeJsonController::indexAction()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 6
ccs 5
cts 5
cp 1
crap 1
rs 10
1
<?php
2
namespace Anax\Controller;
3
use Anax\Commons\ContainerInjectableInterface;
4
use Anax\Commons\ContainerInjectableTrait;
5
// use Anax\Route\Exception\ForbiddenException;
6
// use Anax\Route\Exception\NotFoundException;
7
// use Anax\Route\Exception\InternalErrorException;
8
/**
9
 * A sample controller to show how a controller class can be implemented.
10
 */
11
class MakeJsonController implements ContainerInjectableInterface
12
{
13
    use ContainerInjectableTrait;
14
    /**
15
     * This is the index method action, it handles:
16
     * ANY METHOD mountpoint
17
     *
18
     * @return array
19
     */
20 1
    public function indexAction() : array
21
    {
22 1
        $ip = $this->di->request->getGet("ip");
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...
23 1
        $ipvalidator = new \Anax\Model\IpValidation;
24 1
        $json = $ipvalidator->toJson($ip);
25 1
        return [$json];
26
    }
27
}
28