IPv4::getLong()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
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
}