public function __construct($domainname, $registrant = null, $contacts = null, $hosts = null, $period = 0, $authorisationCode = null)
{
if (strlen($domainname)) {
$this->setDomainname($domainname);
} else {
throw new eppException('Domain name not set');
}
$this->setPeriod($period);
if ($registrant instanceof eppContact) {
throw new eppException('Registrant must be Metaregistrar\\EPP\\eppContactHandle or string on eppDomain creation');
}
if ($registrant instanceof eppContactHandle) {
$this->setRegistrant($registrant->getContactHandle());
} else {
if ($registrant) {
if (strlen($registrant)) {
$this->setRegistrant($registrant);
} else {
throw new eppException('Registrant must be Metaregistrar\\EPP\\eppContactHandle or string on eppDomain creation');
}
}
}
if ($authorisationCode) {
$this->setAuthorisationCode($authorisationCode);
}
if ($hosts) {
if (is_array($hosts)) {
foreach ($hosts as $host) {
$this->addHost($host);
}
} else {
$this->addHost($hosts);
}
}
if ($contacts) {
if (is_array($contacts)) {
foreach ($contacts as $contact) {
$this->addContact($contact);
}
} else {
if (strlen($contacts)) {
$this->addContact($contacts);
}
}
}
}