68 if (!
$xml->hasAttribute(
'index')) {
69 throw new \Exception(
'Missing index on AttributeConsumingService.');
71 $this->index = (int)
$xml->getAttribute(
'index');
76 if (empty($this->ServiceName)) {
77 throw new \Exception(
'Missing ServiceName in AttributeConsumingService.');
95 assert(is_int($this->index));
96 assert(is_null($this->isDefault) || is_bool($this->isDefault));
97 assert(is_array($this->ServiceName));
98 assert(is_array($this->ServiceDescription));
101 $doc = $parent->ownerDocument;
103 $e = $doc->createElementNS(
Constants::NS_MD,
'md:AttributeConsumingService');
104 $parent->appendChild($e);
106 $e->setAttribute(
'index', (
string) $this->index);
108 if ($this->isDefault ===
true) {
109 $e->setAttribute(
'isDefault',
'true');
110 } elseif ($this->isDefault ===
false) {
111 $e->setAttribute(
'isDefault',
'false');
toXML(\DOMElement $parent)
Convert to .
static extractLocalizedStrings(\DOMElement $parent, $namespaceURI, $localName)
Extract localized strings from a set of nodes.
__construct(\DOMElement $xml=null)
Initialize / parse an AttributeConsumingService.
static addStrings(\DOMElement $parent, $namespace, $name, $localized, array $values)
Append string elements.
static parseBoolean(\DOMElement $node, $attributeName, $default=null)
Parse a boolean attribute.
const NS_MD
The namespace for the SAML 2 metadata.
static xpQuery(\DOMNode $node, $query)
Do an XPath query on an XML node.
Create styles array
The data for the language used.