From d720594b5c73adbe51ed06f5f76aaf7f11fe8a1f Mon Sep 17 00:00:00 2001 From: Ewout de Graaf Date: Mon, 18 Nov 2019 13:42:24 +0100 Subject: [PATCH] Better docblocks for typecasting of variables --- Examples/modifydomain.php | 2 +- .../eppResponses/eppCreateContactResponse.php | 2 +- .../eppResponses/eppCreateDomainResponse.php | 3 +- .../eppResponses/eppInfoDomainResponse.php | 13 ++++----- .../EPP/eppResponses/eppInfoHostResponse.php | 28 +++++++++---------- .../EPP/eppResponses/eppPollResponse.php | 3 +- .../EPP/eppResponses/eppRenewResponse.php | 6 ++++ Protocols/EPP/eppResponses/eppResponse.php | 5 +++- .../EPP/eppResponses/eppTransferResponse.php | 28 +++++++++++++++++-- 9 files changed, 60 insertions(+), 30 deletions(-) diff --git a/Examples/modifydomain.php b/Examples/modifydomain.php index 4ace1146..21b066fb 100644 --- a/Examples/modifydomain.php +++ b/Examples/modifydomain.php @@ -67,7 +67,7 @@ function modifydomain($conn, $domainname, $registrant = null, $admincontact = nu $del = new eppDomain($domainname); } foreach ($oldns as $ns) { - $del->addHost($ns); + $del->addHost(new eppHost($ns->getHostname())); } } } diff --git a/Protocols/EPP/eppResponses/eppCreateContactResponse.php b/Protocols/EPP/eppResponses/eppCreateContactResponse.php index d36ef020..2b89df35 100644 --- a/Protocols/EPP/eppResponses/eppCreateContactResponse.php +++ b/Protocols/EPP/eppResponses/eppCreateContactResponse.php @@ -32,7 +32,7 @@ public function getContactCreateDate() { /** * - * @return eppContactHandle contacthandle + * @return null|eppContactHandle */ public function getContactHandle() { if ($handle = $this->queryPath('/epp:epp/epp:response/epp:resData/contact:creData/contact:id')) { diff --git a/Protocols/EPP/eppResponses/eppCreateDomainResponse.php b/Protocols/EPP/eppResponses/eppCreateDomainResponse.php index 31775823..4a8cef72 100644 --- a/Protocols/EPP/eppResponses/eppCreateDomainResponse.php +++ b/Protocols/EPP/eppResponses/eppCreateDomainResponse.php @@ -28,8 +28,7 @@ public function getDomainName() { } public function getDomain() { - $return = new eppDomain($this->getDomainName()); - return $return; + return new eppDomain($this->getDomainName()); } } \ No newline at end of file diff --git a/Protocols/EPP/eppResponses/eppInfoDomainResponse.php b/Protocols/EPP/eppResponses/eppInfoDomainResponse.php index 1635aeb0..eddefe1d 100755 --- a/Protocols/EPP/eppResponses/eppInfoDomainResponse.php +++ b/Protocols/EPP/eppResponses/eppInfoDomainResponse.php @@ -41,7 +41,7 @@ public function getDomainId() { /** * Receive an array of statuses * - * @return string status + * @return null|string[] */ public function getDomainStatuses() { $statuses = null; @@ -93,7 +93,7 @@ public function getDomainContact($contacttype) { /** * Get the contacts associated with the domain name as eppContactHandle objects * - * @return array eppContactHandles + * @return null|eppContactHandle[] */ public function getDomainContacts() { $xpath = $this->xPath(); @@ -191,7 +191,7 @@ public function getDomainUpdateClientId() { * This function returns the associated nameservers from a domain object * Please do not confuse this with getDomainHosts(), which is used for subordinate host objects * - * @return array of strings + * @return null|eppHost[] */ public function getDomainNameservers() { $xpath = $this->xPath(); @@ -214,9 +214,8 @@ public function getDomainNameservers() { } } return $ns; - } else { - return null; } + return null; } /** @@ -251,14 +250,14 @@ public function getDomainAuthInfo() { * OBSOLETE, DO NOT USE THIS FUNCTION * If you need DNSSEC KeyData or DSData, see the extension SecDNS-1.1 * ALL DNSSEC FUNCTIONS ARE IN THERE - * @return array|null + * @return null|eppSecdns[] */ public function getKeydata() { // Check if dnssec is enabled on this interface if ($this->findNamespace('secDNS')) { $xpath = $this->xPath(); $result = $xpath->query('/epp:epp/epp:response/epp:extension/secDNS:infData/*'); - $keys = array(); + $keys = []; if ($result->length > 0) { foreach ($result as $keydata) { /* @var $keydata \DOMElement */ diff --git a/Protocols/EPP/eppResponses/eppInfoHostResponse.php b/Protocols/EPP/eppResponses/eppInfoHostResponse.php index fb9a9b59..fa6f7ff5 100644 --- a/Protocols/EPP/eppResponses/eppInfoHostResponse.php +++ b/Protocols/EPP/eppResponses/eppInfoHostResponse.php @@ -16,16 +16,16 @@ public function getHost() { } /** - * - * @return string hostname + * Get the hostname from the server response + * @return string */ public function getHostName() { return $this->queryPath('/epp:epp/epp:response/epp:resData/host:infData/host:name'); } /** - * - * @return array of host addresses + * Get Host IP addresses from the server response + * @return array */ public function getHostAddresses() { $ip = null; @@ -39,8 +39,8 @@ public function getHostAddresses() { } /** - * - * @return string status + * Get an array of statuses from the server response + * @return null|string[] */ public function getHostStatuses() { $stat = null; @@ -53,8 +53,8 @@ public function getHostStatuses() { } /** - * - * @return string statuses + * Get statuses as comma-separated values from the server response + * @return string */ public function getHostStatusCSV() { return parent::arrayToCSV($this->getHostStatuses()); @@ -62,7 +62,7 @@ public function getHostStatusCSV() { /** * - * @return string roid + * @return string */ public function getHostRoid() { return $this->queryPath('/epp:epp/epp:response/epp:resData/host:infData/host:roid'); @@ -70,7 +70,7 @@ public function getHostRoid() { /** * - * @return string create_date + * @return string */ public function getHostCreateDate() { return $this->queryPath('/epp:epp/epp:response/epp:resData/host:infData/host:crDate'); @@ -78,7 +78,7 @@ public function getHostCreateDate() { /** * - * @return string update_date + * @return string */ public function getHostUpdateDate() { return $this->queryPath('/epp:epp/epp:response/epp:resData/host:infData/host:upDate'); @@ -86,7 +86,7 @@ public function getHostUpdateDate() { /** * - * @return string client id + * @return string */ public function getHostClientId() { return $this->queryPath('/epp:epp/epp:response/epp:resData/host:infData/host:clID'); @@ -94,7 +94,7 @@ public function getHostClientId() { /** * - * @return string client id + * @return string */ public function getHostCreateClientId() { return $this->queryPath('/epp:epp/epp:response/epp:resData/host:infData/host:crID'); @@ -102,7 +102,7 @@ public function getHostCreateClientId() { /** * - * @return string client id + * @return string */ public function getHostUpdateClientId() { return $this->queryPath('/epp:epp/epp:response/epp:resData/host:infData/host:upID'); diff --git a/Protocols/EPP/eppResponses/eppPollResponse.php b/Protocols/EPP/eppResponses/eppPollResponse.php index fd568046..653ed224 100644 --- a/Protocols/EPP/eppResponses/eppPollResponse.php +++ b/Protocols/EPP/eppResponses/eppPollResponse.php @@ -94,6 +94,7 @@ public function getMessageCount() { * TYPE_CREATE * TYPE_UPDATE * TYPE_DELETE + * @return string */ public function getMessageType() { if ($this->messageType) { @@ -139,7 +140,7 @@ public function getDomainName() { /** * If present, retrieve the current status of the domain name in question - * @return string|null + * @return null|string */ public function getDomainStatus() { $this->messageType = $this->getMessageType(); diff --git a/Protocols/EPP/eppResponses/eppRenewResponse.php b/Protocols/EPP/eppResponses/eppRenewResponse.php index e83c0f32..79246cd4 100644 --- a/Protocols/EPP/eppResponses/eppRenewResponse.php +++ b/Protocols/EPP/eppResponses/eppRenewResponse.php @@ -14,10 +14,16 @@ function __destruct() { # DOMAIN RENEW RESPONSES # + /** + * @return null|string + */ public function getDomainName() { return $this->queryPath('/epp:epp/epp:response/epp:resData/domain:renData/domain:name'); } + /** + * @return null|string + */ public function getDomainExpirationDate() { return $this->queryPath('/epp:epp/epp:response/epp:resData/domain:renData/domain:exDate'); } diff --git a/Protocols/EPP/eppResponses/eppResponse.php b/Protocols/EPP/eppResponses/eppResponse.php index e800c729..0813708a 100644 --- a/Protocols/EPP/eppResponses/eppResponse.php +++ b/Protocols/EPP/eppResponses/eppResponse.php @@ -212,7 +212,7 @@ public function getProblemtype() { /** * - * @return string|null + * @return null|string */ public function getResultCode() { $result = $this->queryPath('/epp:epp/epp:response/epp:result/@code'); @@ -390,6 +390,9 @@ public function queryPath($path, $object = null) { } } + /** + * @param $exceptionhandler + */ public function addException($exceptionhandler) { $this->exceptions[] = $exceptionhandler; } diff --git a/Protocols/EPP/eppResponses/eppTransferResponse.php b/Protocols/EPP/eppResponses/eppTransferResponse.php index 5850d452..de711162 100644 --- a/Protocols/EPP/eppResponses/eppTransferResponse.php +++ b/Protocols/EPP/eppResponses/eppTransferResponse.php @@ -14,36 +14,58 @@ function __destruct() { # DOMAIN TRANSFER RESPONSES # + /** + * @return null|string + */ public function getDomainName() { return $this->queryPath('/epp:epp/epp:response/epp:resData/domain:trnData/domain:name'); } + /** + * @return eppDomain + */ public function getDomain() { - $return = new eppDomain($this->getDomainName()); - return $return; - + return new eppDomain($this->getDomainName()); } + /** + * @return null|string + */ public function getTransferStatus() { return $this->queryPath('/epp:epp/epp:response/epp:resData/domain:trnData/domain:trStatus'); } + /** + * @return null|string + */ public function getTransferRequestClientId() { return $this->queryPath('/epp:epp/epp:response/epp:resData/domain:trnData/domain:reID'); } + /** + * @return null|string + */ public function getTransferRequestDate() { return $this->queryPath('/epp:epp/epp:response/epp:resData/domain:trnData/domain:reDate'); } + /** + * @return null|string + */ public function getTransferExpirationDate() { return $this->queryPath('/epp:epp/epp:response/epp:resData/domain:trnData/domain:exDate'); } + /** + * @return null|string + */ public function getTransferActionDate() { return $this->queryPath('/epp:epp/epp:response/epp:resData/domain:trnData/domain:acDate'); } + /** + * @return null|string + */ public function getTransferActionClientId() { return $this->queryPath('/epp:epp/epp:response/epp:resData/domain:trnData/domain:acID'); }