public function __construct($ip, $safeMode = TRUE) { parent::__construct($ip, $safeMode); if ($this->getIpCountPart() != 8) { throw new IllegalArgumentException(); } }
public function __construct($ip, $safeMode = TRUE) { parent::__construct($ip, $safeMode); if ($this->getIpCountPart() == 4) { $this->IPv = new IPv4($ip, $safeMode); } else { if ($this->getIpCountPart() == 8) { $this->IPv = new IPv6($ip, $safeMode); } else { throw new IllegalArgumentException(); } } }