IpDefault::getDefaultIp()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 6
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 8
ccs 6
cts 6
cp 1
crap 2
rs 10
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