/** * Create/parse a mdrpi:RegistrationInfo element. * * @param \DOMElement|null $xml The XML element we should load. * @throws \Exception */ public function __construct(\DOMElement $xml = null) { if ($xml === null) { return; } if (!$xml->hasAttribute('registrationAuthority')) { throw new \Exception('Missing required attribute "registrationAuthority" in mdrpi:RegistrationInfo element.'); } $this->registrationAuthority = $xml->getAttribute('registrationAuthority'); if ($xml->hasAttribute('registrationInstant')) { $this->registrationInstant = Utils::xsDateTimeToTimestamp($xml->getAttribute('registrationInstant')); } $this->RegistrationPolicy = Utils::extractLocalizedStrings($xml, Common::NS_MDRPI, 'RegistrationPolicy'); }
/** * Create/parse a mdrpi:PublicationInfo element. * * @param \DOMElement|null $xml The XML element we should load. * @throws \Exception */ public function __construct(\DOMElement $xml = null) { if ($xml === null) { return; } if (!$xml->hasAttribute('publisher')) { throw new \Exception('Missing required attribute "publisher" in mdrpi:PublicationInfo element.'); } $this->publisher = $xml->getAttribute('publisher'); if ($xml->hasAttribute('creationInstant')) { $this->creationInstant = Utils::xsDateTimeToTimestamp($xml->getAttribute('creationInstant')); } if ($xml->hasAttribute('publicationId')) { $this->publicationId = $xml->getAttribute('publicationId'); } $this->UsagePolicy = Utils::extractLocalizedStrings($xml, Common::NS_MDRPI, 'UsagePolicy'); }
/** * Initialize / parse an AttributeConsumingService. * * @param \DOMElement|null $xml The XML element we should load. * @throws \Exception */ public function __construct(\DOMElement $xml = null) { if ($xml === null) { return; } if (!$xml->hasAttribute('index')) { throw new \Exception('Missing index on AttributeConsumingService.'); } $this->index = (int) $xml->getAttribute('index'); $this->isDefault = Utils::parseBoolean($xml, 'isDefault', null); $this->ServiceName = Utils::extractLocalizedStrings($xml, Constants::NS_MD, 'ServiceName'); if (empty($this->ServiceName)) { throw new \Exception('Missing ServiceName in AttributeConsumingService.'); } $this->ServiceDescription = Utils::extractLocalizedStrings($xml, Constants::NS_MD, 'ServiceDescription'); foreach (Utils::xpQuery($xml, './saml_metadata:RequestedAttribute') as $ra) { $this->RequestedAttribute[] = new RequestedAttribute($ra); } }
/** * Initialize an Organization element. * * @param \DOMElement|null $xml The XML element we should load. */ public function __construct(\DOMElement $xml = null) { if ($xml === null) { return; } $this->Extensions = Extensions::getList($xml); $this->OrganizationName = Utils::extractLocalizedStrings($xml, Constants::NS_MD, 'OrganizationName'); if (empty($this->OrganizationName)) { $this->OrganizationName = array('invalid' => ''); } $this->OrganizationDisplayName = Utils::extractLocalizedStrings($xml, Constants::NS_MD, 'OrganizationDisplayName'); if (empty($this->OrganizationDisplayName)) { $this->OrganizationDisplayName = array('invalid' => ''); } $this->OrganizationURL = Utils::extractLocalizedStrings($xml, Constants::NS_MD, 'OrganizationURL'); if (empty($this->OrganizationURL)) { $this->OrganizationURL = array('invalid' => ''); } }
/** * Create a UIInfo element. * * @param \DOMElement|null $xml The XML element we should load. */ public function __construct(\DOMElement $xml = null) { if ($xml === null) { return; } $this->DisplayName = Utils::extractLocalizedStrings($xml, self::NS, 'DisplayName'); $this->Description = Utils::extractLocalizedStrings($xml, self::NS, 'Description'); $this->InformationURL = Utils::extractLocalizedStrings($xml, self::NS, 'InformationURL'); $this->PrivacyStatementURL = Utils::extractLocalizedStrings($xml, self::NS, 'PrivacyStatementURL'); foreach (Utils::xpQuery($xml, './*') as $node) { if ($node->namespaceURI === self::NS) { switch ($node->localName) { case 'Keywords': $this->Keywords[] = new Keywords($node); break; case 'Logo': $this->Logo[] = new Logo($node); break; } } else { $this->children[] = new Chunk($node); } } }