CurrentIp   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Test Coverage

Coverage 71.43%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 8
dl 0
loc 17
c 1
b 0
f 1
ccs 5
cts 7
cp 0.7143
rs 10
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A findIp() 0 12 3
1
<?php
2
3
namespace Anax\Models;
4
5
class CurrentIp
6
{
7
    /**
8
     * class to find current users ip address if available
9
     */
10 2
    public function findIp()
11
    {
12 2
        if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
13
            $userIP = [$_SERVER['HTTP_X_FORWARDED_FOR']];
14 2
        } elseif (isset($_SERVER['REMOTE_ADDR'])) {
15
            $userIP = [$_SERVER['REMOTE_ADDR']];
16
        } else {
17
            // only for testing
18 2
            $userIP = ["127.0.0.1"];
19
        }
20
21 2
        return $userIP;
22
    }
23
}
24