function __construct(eppRequest $request, $sudoUser)
{
$this->originalRequest = $request;
parent::__construct();
$ext = $this->createElement('extension');
$extSudo = $this->createElement('ext:sudo');
$ext->appendChild($extSudo);
parent::getEpp()->appendChild($ext);
$clID = $this->createElement('ext:clID');
$clID->nodeValue = $sudoUser;
$extSudo->appendChild($clID);
$command = $request->getElementsByTagName('command');
if ($command->length > 0) {
$extCommand = $this->createElement('ext:command');
$extSudo->appendChild($extCommand);
foreach ($command as $child) {
$node = $this->importNode($child, true);
$extCommand->appendChild($node->firstChild);
break;
}
$extension = $this->createElement('extension');
$extensions = $request->getElementsByTagName('extension');
if ($extensions->length > 0) {
foreach ($extensions as $child) {
$node = $this->importNode($child, true);
$extension->appendChild($node->firstChild);
break;
}
$extCommand->appendChild($extension);
}
} else {
$extCommand = $this->createElement('ext:extCommand');
$extSudo->appendChild($extCommand);
$command = $request->getElementsByTagName('ext:command');
foreach ($command as $child) {
$node = $this->importNode($child, true);
$extCommand->appendChild($node->firstChild);
break;
}
}
}