IPv4   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 19
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A parse() 0 3 1
A getLong() 0 3 1
1
<?php
2
3
namespace devtoolboxuk\internetaddress;
4
5
class IPv4 extends IP
6
{
7
    const version = 'IPv4';
8
    const length = 32;
9
    const octets = 4;
10
11
    public function __construct($ip)
12
    {
13
        parent::__construct($ip);
14
    }
15
16
    public static function parse($ipAddress)
17
    {
18
        return new self(long2ip($ipAddress));
19
    }
20
21
    public static function getLong($ip_addr)
22
    {
23
        return sprintf('%u', ip2long(inet_ntop($ip_addr)));
24
    }
25
26
}