UserInfoService   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 15
ccs 4
cts 4
cp 1
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A getUserIP() 0 6 1
1
<?php
2
3
namespace Lii\Service;
4
5
use Anax\Commons\ContainerInjectableInterface;
6
use Anax\Commons\ContainerInjectableTrait;
7
8
/**
9
 * A service class that is injected with di.
10
 */
11
class UserInfoService implements ContainerInjectableInterface
12
{
13
    use ContainerInjectableTrait;
14
15
//     public function useService() : string
16
//     {
17
//         return "DI contains " . count($this->di->getServices()) . " services.";
18
//     }
19
20 2
    public function getUserIP() : string
21
    {
22 2
        $request = $this->di->get("request");
23 2
        $userIP = $request->getServer("HTTP_X_FORWARDED_FOR", "x.x.x.x");
24
25 2
        return $userIP;
26
    }
27
}
28