/** * @param $ipaddress (default '') **/ function __construct($ipaddress = '') { // First, be sure that the parent is correctly initialised parent::__construct(); // If $ipaddress if empty, then, empty address ! if ($ipaddress != '') { // If $ipaddress if an IPAddress, then just clone it if ($ipaddress instanceof IPAddress) { $this->version = $ipaddress->version; $this->textual = $ipaddress->textual; $this->binary = $ipaddress->binary; $this->fields = $ipaddress->fields; } else { // Else, check a binary then a string if (!$this->setAddressFromBinary($ipaddress)) { $this->setAddressFromString($ipaddress); } } } }