Conditions | 3 |
Paths | 2 |
Total Lines | 17 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
47 | public static function long2ip(string $long, bool $forceIPv6 = false): string |
||
48 | { |
||
49 | /** |
||
50 | * @var \GMP $long |
||
51 | */ |
||
52 | if ($forceIPv6 || \gmp_cmp($long, static::IPv4_INT_MAX) > 0) { |
||
53 | return (string)\inet_ntop( |
||
54 | \str_pad( |
||
55 | \gmp_export($long), |
||
56 | 16, |
||
57 | "\0", |
||
58 | \STR_PAD_LEFT |
||
59 | ) |
||
60 | ); |
||
61 | } |
||
62 | |||
63 | return \long2ip($long); |
||
64 | } |
||
67 |