IpLocatorController::indexAction()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 1
dl 0
loc 7
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace H4MSK1\IpLocator;
4
5
use Anax\Commons\ContainerInjectableInterface;
6
use Anax\Commons\ContainerInjectableTrait;
7
8
class IpLocatorController implements ContainerInjectableInterface
9
{
10
    use ContainerInjectableTrait;
11
12
    public function indexAction($result = null)
13
    {
14
        $page = $this->di->get('page');
15
        $page->add('anax/iplocator/index', compact('result'));
16
17
        return $page->render([
18
            'title' => 'IP Locator',
19
        ]);
20
    }
21
22
    public function indexActionPost()
23
    {
24
        $request = $this->di->get('request');
25
        $result = (new IpLocator($request->getPost('ip')))->locateIp();
26
27
        return $this->indexAction($result);
28
    }
29
}
30