-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
185 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?php | ||
namespace YOCLIB\EPP; | ||
|
||
use Wikimedia\IDLeDOM\Document; | ||
use Wikimedia\IDLeDOM\Node; | ||
use YOCLIB\EPP\Elements\EPPExtensionValueElement; | ||
use YOCLIB\EPP\Elements\EPPMessageElement; | ||
use YOCLIB\EPP\Elements\EPPResultElement; | ||
use YOCLIB\EPP\Elements\EPPValueElement; | ||
|
||
class EPPElementHelper{ | ||
|
||
/** | ||
* @param Document $document | ||
* @param string $code | ||
* @param EPPMessageElement $msg | ||
* @param ?EPPValueElement|?EPPExtensionValueElement|null $valueOrExtValue | ||
* @return EPPResultElement | ||
*/ | ||
public static function createEPPResultElement(Document $document,string $code,EPPMessageElement $msg,$valueOrExtValue=null): EPPResultElement{ | ||
/**@var EPPResultElement $resultElement*/ | ||
$resultElement = $document->createElementNS(EPPNamespaces::EPP_1_0,'result'); | ||
$resultElement->setAttribute('code',$code); | ||
|
||
$resultElement->appendChild($msg); | ||
|
||
if($valueOrExtValue){ | ||
$resultElement->appendChild($valueOrExtValue); | ||
} | ||
|
||
return $resultElement; | ||
} | ||
|
||
/** | ||
* @param Document $document | ||
* @param string $lang | ||
* @param string|Node $content | ||
* @return EPPMessageElement | ||
*/ | ||
public static function createEPPMessageElement(Document $document,string $lang,... $content): EPPMessageElement{ | ||
/**@var EPPMessageElement $messageElement*/ | ||
$messageElement = $document->createElementNS(EPPNamespaces::EPP_1_0,'msg'); | ||
if(is_string($content[0] ?? null)){ | ||
$messageElement->textContent = $content; | ||
}else{ | ||
foreach($content AS $node){ | ||
$messageElement->appendChild($node); | ||
} | ||
} | ||
return $messageElement; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
namespace YOCLIB\EPP; | ||
|
||
class EPPNamespaces{ | ||
|
||
public const CONTACT_1_0 = 'urn:ietf:params:xml:ns:contact-1.0'; | ||
|
||
public const DOMAIN_1_0 = 'urn:ietf:params:xml:ns:domain-1.0'; | ||
|
||
public const EPP_1_0 = 'urn:ietf:params:xml:ns:epp-1.0'; | ||
|
||
public const EPPCOM_1_0 = 'urn:ietf:params:xml:ns:eppcom-1.0'; | ||
|
||
public const EPP_ORG_1_0 = 'urn:ietf:params:xml:ns:epp:org-1.0'; | ||
|
||
public const EPP_ORGEXT_1_0 = 'urn:ietf:params:xml:ns:epp:orgext-1.0'; | ||
|
||
public const HOST_1_0 = 'urn:ietf:params:xml:ns:host-1.0'; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.