IpValidate   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 5
dl 0
loc 18
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A validate() 0 6 2
1
<?php
2
3
namespace KW\Models;
4
5
use Anax\Commons\ContainerInjectableInterface;
6
use Anax\Commons\ContainerInjectableTrait;
7
8
/**
9
 * Verfies wether an ip address is valid or not
10
 *
11
 */
12
13
class IpValidate implements ContainerInjectableInterface
14
{
15
    use ContainerInjectableTrait;
16
17
18
    /**
19
     * Verify an ip-adress is valid
20
     *
21
     * @param string $ipnumber to verify
22
     *
23
     * @return boolean
24
     */
25 5
    public function validate(string $ipnumber)
26
    {
27 5
        if (!filter_var($ipnumber, FILTER_VALIDATE_IP)) {
28 2
            return false;
29
        }
30 3
        return true;
31
    }
32
}
33