Issues (12)

src/Controller/IpVerifierAPIController.php (1 issue)

Labels
Severity
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
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