-
Notifications
You must be signed in to change notification settings - Fork 164
/
Copy pathficoraEppUpdateDomainRequest.php
71 lines (63 loc) · 3.35 KB
/
ficoraEppUpdateDomainRequest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<?php
namespace Metaregistrar\EPP;
class ficoraEppUpdateDomainRequest extends eppUpdateDomainRequest {
// Note: default value for $namespacesinroot differs from parent
public function __construct($objectname, ?ficoraEppDomain $addinfo = null, ?ficoraEppDomain $removeinfo = null, ?ficoraEppDomain $updateinfo = null, $forcehostattr=false, $namespacesinroot=false)
{
parent::__construct($objectname, $addinfo, $removeinfo, $updateinfo, $forcehostattr, $namespacesinroot);
}
/**
* @param \domElement $element
* @param eppDomain $domain
* @throws eppException
*/
protected function addDomainChanges($element, eppDomain $domain) {
// can't change function argument class due to strict standards warning
if (!$domain instanceof ficoraEppDomain) {
throw new eppException('Domains passed to ficoraEppUpdateDomainRequest must be instances of ficoraEppDomain');
}
if ($domain->getRegistrant()) {
$element->appendChild($this->createElement('domain:registrant', $domain->getRegistrant()));
}
$hosts = $domain->getHosts();
if (is_array($hosts) && (count($hosts))) {
$nameservers = $this->createElement('domain:ns');
foreach ($hosts as $host) {
/* @var eppHost $host */
if (($this->getForcehostattr()) || (is_array($host->getIpAddresses()))) {
$nameservers->appendChild($this->addDomainHostAttr($host));
} else {
$nameservers->appendChild($this->addDomainHostObj($host));
}
}
$element->appendChild($nameservers);
}
$contacts = $domain->getContacts();
if (is_array($contacts)) {
foreach ($contacts as $contact) {
/* @var eppContactHandle $contact */
$this->addDomainContact($element, $contact->getContactHandle(), $contact->getContactType());
}
}
// Changing status is not supported for *.fi domains, verified from registry
$statuses = $domain->getStatuses();
if (is_array($statuses) && count($statuses)) {
throw new eppException('Changing statuses is not supported for *.fi domains.');
}
// authinfo might contain domain:pw (provider transfer key) and/or domain:pwregistranttransfer (registrant transfer key)
// registrant transfer key must be present on registrant change, empty one is valid if registry number doesn't change
if (strlen($domain->getAuthorisationCode()) || $domain->getRegistrant() || $domain->getRegistrantTransferCode()) {
$authinfo = $this->createElement('domain:authInfo');
if (strlen($domain->getAuthorisationCode())) {
$pw = $this->createElement('domain:pw');
$pw->appendChild($this->createCDATASection($domain->getAuthorisationCode()));
$authinfo->appendChild($pw);
}
if ($domain->getRegistrant() || $domain->getRegistrantTransferCode()) {
$registrantPassword = $this->createElement('domain:pwregistranttransfer', $domain->getRegistrantTransferCode());
$authinfo->appendChild($registrantPassword);
}
$element->appendChild($authinfo);
}
}
}