IpLocatorController   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 20
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A indexAction() 0 7 1
A indexActionPost() 0 6 1
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