Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F95666207
PhutilIPAddress.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, Dec 18, 04:35
Size
933 B
Mime Type
text/x-php
Expires
Fri, Dec 20, 04:35 (2 d)
Engine
blob
Format
Raw Data
Handle
23038249
Attached To
rPHU libphutil
PhutilIPAddress.php
View Options
<?php
/**
* Represent and manipulate IPv4 and IPv6 addresses.
*/
abstract
class
PhutilIPAddress
extends
Phobject
{
private
function
__construct
()
{
// <private>
}
abstract
public
function
toBits
();
abstract
public
function
getAddress
();
public
static
function
newAddress
(
$in
)
{
if
(
$in
instanceof
PhutilIPAddress
)
{
return
clone
$in
;
}
try
{
return
PhutilIPv4Address
::
newFromString
(
$in
);
}
catch
(
Exception
$ex
)
{
// Continue, trying the address as IPv6 instead.
}
try
{
return
PhutilIPv6Address
::
newFromString
(
$in
);
}
catch
(
Exception
$ex
)
{
// Continue, throwing a more tailored exception below.
}
throw
new
Exception
(
pht
(
'IP address "%s" is not properly formatted. Expected an IPv4 address '
.
'like "%s", or an IPv6 address like "%s".'
,
$in
,
'23.45.67.89'
,
'2345:6789:0123:abcd::'
));
}
}
Event Timeline
Log In to Comment