IpDefault   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A getDefaultIp() 0 8 2
1
<?php
2
namespace Lioo19\Models;
3
4
/**
5
 * Class for checking IP-adress to ip4 and ip6 standard.
6
 * Class only contain methods for checking
7
 *
8
 */
9
class IpDefault
10
{
11
    /**
12
     * defaultIp from users adress
13
     *
14
     * @return string $ipdefault
15
     */
16 5
    public function getDefaultIp($request) : string
17
    {
18 5
        $key = "REMOTE_ADDR";
19 5
        $data = $request->getServer($key);
20 5
        if ($data) {
21 1
            return $data;
22
        } else {
23 4
            return "";
24
        }
25
    }
26
}
27