Skip to content

Commit

Permalink
Merge ac91b5b into c87337a
Browse files Browse the repository at this point in the history
  • Loading branch information
johnny-bit committed Oct 29, 2019
2 parents c87337a + ac91b5b commit b80b1e6
Show file tree
Hide file tree
Showing 19 changed files with 23 additions and 93 deletions.
8 changes: 8 additions & 0 deletions src/AfriCC/EPP/AbstractFrame.php
Expand Up @@ -341,4 +341,12 @@ public function getExtensionName()
{
return strtolower($this->className(get_class($this)));
}

public function getExtensionNamespace()
{
if(!isset($this->extension_xmlns) && ($this instanceof ExtensionInterface)){
throw new Exception(sprintf('Extension %s has no defined namespace', get_class($this)));
}
return $this->extension_xmlns;
}
}
16 changes: 13 additions & 3 deletions src/AfriCC/EPP/Client.php
Expand Up @@ -99,7 +99,7 @@ function ($var) {
*
* @param resource|null $context SSL context or null in case of tcp connection
*
* @throws Exception
* @throws Exception on socket errors
*/
private function setupSocket($context = null)
{
Expand All @@ -112,7 +112,10 @@ private function setupSocket($context = null)
$this->socket = @stream_socket_client($target, $errno, $errstr, $this->connect_timeout, STREAM_CLIENT_CONNECT, $context);

if ($this->socket === false) {
throw new Exception($errstr, $errno);
// Socket initialization may fail, before system call connect()
// so the $errno is 0 and $errstr isn't populated .
// see https://www.php.net/manual/en/function.stream-socket-client.php#refsect1-function.stream-socket-client-errors
throw new Exception(sprintf('problem initializing socket: %s code: [%d]',$errstr, $errno), $errno);
}

// set stream time out
Expand Down Expand Up @@ -163,7 +166,14 @@ public function close()

public function getFrame()
{
$header = $this->recv(4);
$hard_time_limit = time() + $this->timeout + 2;
do {
$header = $this->recv(4);
} while (empty($header) && (time() < $hard_time_limit));

if (time() >= $hard_time_limit) {
throw new Exception('Timeout while reading header from EPP Server');
}

// Unpack first 4 bytes which is our length
$unpacked = unpack('N', $header);
Expand Down
5 changes: 0 additions & 5 deletions src/AfriCC/EPP/Extension/COZA/Info/CozaContact.php
Expand Up @@ -30,9 +30,4 @@ public function requestDomainListing()
{
$this->set('//epp:epp/epp:command/epp:extension/cozacontact:info/cozacontact:domainListing', 'true');
}

public function getExtensionNamespace()
{
return $this->extension_xmlns;
}
}
5 changes: 0 additions & 5 deletions src/AfriCC/EPP/Extension/COZA/Update/CozaContact.php
Expand Up @@ -25,9 +25,4 @@ public function cancelPendingAction()
{
$this->set('//epp:epp/epp:command/epp:extension/cozacontact:update[@cancelPendingAction=\'PendingUpdate\']');
}

public function getExtensionNamespace()
{
return $this->extension_xmlns;
}
}
5 changes: 0 additions & 5 deletions src/AfriCC/EPP/Extension/NASK/Create/Contact.php
Expand Up @@ -10,11 +10,6 @@ class Contact extends ContactCreate implements ExtensionInterface
protected $extension = 'extcon';
protected $extension_xmlns = 'http://www.dns.pl/nask-epp-schema/extcon-2.0';

public function getExtensionNamespace()
{
return $this->extension_xmlns;
}

/**
* Set entity type of contact
*
Expand Down
6 changes: 0 additions & 6 deletions src/AfriCC/EPP/Extension/NASK/Create/Domain.php
Expand Up @@ -9,14 +9,8 @@
class Domain extends DomainCreate implements ExtensionInterface
{
protected $extension = 'extdom';

protected $extension_xmlns = 'http://www.dns.pl/nask-epp-schema/extdom-2.0';

public function getExtensionNamespace()
{
return $this->extension_xmlns;
}

public function setBook()
{
$this->set('//epp:epp/epp:command/epp:extension/extdom:create/extdom:book');
Expand Down
5 changes: 0 additions & 5 deletions src/AfriCC/EPP/Extension/NASK/Info/Contact.php
Expand Up @@ -10,11 +10,6 @@ class Contact extends ContactInfo implements ExtensionInterface
protected $extension = 'extcon';
protected $extension_xmlns = 'http://www.dns.pl/nask-epp-schema/extcon-2.0';

public function getExtensionNamespace()
{
return $this->extension_xmlns;
}

/**
* Set contact authinfo
*
Expand Down
6 changes: 0 additions & 6 deletions src/AfriCC/EPP/Extension/NASK/Renew/Domain.php
Expand Up @@ -8,14 +8,8 @@
class Domain extends DomainRenew implements ExtensionInterface
{
protected $extension = 'extdom';

protected $extension_xmlns = 'http://www.dns.pl/nask-epp-schema/extdom-2.0';

public function getExtensionNamespace()
{
return $this->extension_xmlns;
}

public function setReactivate()
{
$this->set('//epp:epp/epp:command/epp:extension/extdom:renew/extdom:reactivate');
Expand Down
5 changes: 0 additions & 5 deletions src/AfriCC/EPP/Extension/NASK/Report.php
Expand Up @@ -13,11 +13,6 @@ class Report extends Extension implements ExtensionInterface
protected $extension = 'extreport';
protected $extension_xmlns = 'http://www.dns.pl/nask-epp-schema/extreport-2.0';

public function getExtensionNamespace()
{
return $this->extension_xmlns;
}

public function setOffset($offset)
{
$this->set('extreport:offset', $offset);
Expand Down
5 changes: 0 additions & 5 deletions src/AfriCC/EPP/Extension/NASK/Transfer/Domain.php
Expand Up @@ -10,11 +10,6 @@ class Domain extends DomainTransfer implements Extension
protected $extension = 'extdom';
protected $extension_xmlns = 'http://www.dns.pl/nask-epp-schema/extdom-2.0';

public function getExtensionNamespace()
{
return $this->extension_xmlns;
}

/**
* Add resend confirmation request
*
Expand Down
5 changes: 0 additions & 5 deletions src/AfriCC/EPP/Extension/NASK/Update/Contact.php
Expand Up @@ -10,11 +10,6 @@ class Contact extends ContactUpdate implements ExtensionInterface
protected $extension = 'extcon';
protected $extension_xmlns = 'http://www.dns.pl/nask-epp-schema/extcon-2.0';

public function getExtensionNamespace()
{
return $this->extension_xmlns;
}

/**
* Set entity type of contact
*
Expand Down
6 changes: 0 additions & 6 deletions src/AfriCC/EPP/Extension/NASK/Update/Domain.php
Expand Up @@ -9,14 +9,8 @@
class Domain extends DomainUpdate implements ExtensionInterface
{
protected $extension = 'extdom';

protected $extension_xmlns = 'http://www.dns.pl/nask-epp-schema/extdom-2.0';

public function getExtensionNamespace()
{
return $this->extension_xmlns;
}

public function addNs($host, $remove = false)
{
if (!Validator::isHostname($host)) {
Expand Down
5 changes: 0 additions & 5 deletions src/AfriCC/EPP/Extension/NICMX/Info/Rar.php
Expand Up @@ -27,9 +27,4 @@ public function __construct()

$this->set();
}

public function getExtensionNamespace()
{
return $this->extension_xmlns;
}
}
5 changes: 0 additions & 5 deletions src/AfriCC/EPP/Extension/NICMX/Restore/Domain.php
Expand Up @@ -26,9 +26,4 @@ public function setDomain($domain)
{
$this->set('//epp:epp/epp:command/epp:renew/nicmx-domrst:restore/nicmx-domrst:name', $domain);
}

public function getExtensionNamespace()
{
return $this->extension_xmlns;
}
}
5 changes: 0 additions & 5 deletions src/AfriCC/EPP/Extension/NicIT/Create/Contact.php
Expand Up @@ -31,11 +31,6 @@ class Contact extends ContactCreate implements Extension
7, // Foreigners who match 2-6
];

public function getExtensionNamespace()
{
return $this->extension_xmlns;
}

public function setConsentForPublishing($consent = false)
{
$this->set('//epp:epp/epp:command/epp:extension/extcon:create/extcon:consentForPublishing', $consent ? 'true' : 'false');
Expand Down
5 changes: 0 additions & 5 deletions src/AfriCC/EPP/Extension/NicIT/Info/Domain.php
Expand Up @@ -20,11 +20,6 @@ class Domain extends DomainInfo implements Extension
protected $extension = 'extdom';
protected $extension_xmlns = 'http://www.nic.it/ITNIC-EPP/extdom-2.0';

public function getExtensionNamespace()
{
return $this->extension_xmlns;
}

public function setInfContacts($op = null)
{
if (!is_null($op)) {
Expand Down
9 changes: 2 additions & 7 deletions src/AfriCC/EPP/Extension/NicIT/Transfer/Domain.php
Expand Up @@ -19,18 +19,13 @@ class Domain extends DomainTransfer implements Extension
protected $extension = 'extdom';
protected $extension_xmlns = 'http://www.nic.it/ITNIC-EPP/extdom-2.0';

public function getExtensionNamespace()
{
return $this->extension_xmlns;
}

public function setNewRegistrant($registrant)
{
$node = $this->set('//epp:epp/epp:command/epp:extension/extdom:trade/extdom:transferTrade/extdom:newRegistrant', $registrant);
$this->set('//epp:epp/epp:command/epp:extension/extdom:trade/extdom:transferTrade/extdom:newRegistrant', $registrant);
}

public function setNewAuthInfo($pw)
{
$node = $this->set('//epp:epp/epp:command/epp:extension/extdom:trade/extdom:transferTrade/extdom:newAuthInfo/extdom:pw', $pw);
$this->set('//epp:epp/epp:command/epp:extension/extdom:trade/extdom:transferTrade/extdom:newAuthInfo/extdom:pw', $pw);
}
}
5 changes: 0 additions & 5 deletions src/AfriCC/EPP/Extension/Nominet/Release/Domain.php
Expand Up @@ -37,9 +37,4 @@ public function setRegistrarTag($tag)
{
$this->set('//epp:epp/epp:command/epp:update/r:release/r:registrarTag', $tag);
}

public function getExtensionNamespace()
{
return $this->extension_xmlns;
}
}
5 changes: 0 additions & 5 deletions src/AfriCC/EPP/Extension/Rgp/Update/Domain.php
Expand Up @@ -84,9 +84,4 @@ public function setOther($other)
{
$this->set('//epp:epp/epp:command/epp:extension/rgp:update/rgp:restore[@op=\'report\']/rgp:report/rgp:other', $other);
}

public function getExtensionNamespace()
{
return $this->extension_xmlns;
}
}

0 comments on commit b80b1e6

Please sign in to comment.