79 parent::__construct(
$xml);
85 if (!
$xml->hasAttribute(
'affiliationOwnerID')) {
86 throw new \Exception(
'Missing affiliationOwnerID on AffiliationDescriptor.');
88 $this->affiliationOwnerID =
$xml->getAttribute(
'affiliationOwnerID');
90 if (
$xml->hasAttribute(
'ID')) {
91 $this->ID =
$xml->getAttribute(
'ID');
94 if (
$xml->hasAttribute(
'validUntil')) {
98 if (
$xml->hasAttribute(
'cacheDuration')) {
99 $this->cacheDuration =
$xml->getAttribute(
'cacheDuration');
105 if (empty($this->AffiliateMember)) {
106 throw new \Exception(
'Missing AffiliateMember in AffiliationDescriptor.');
122 assert(is_string($this->affiliationOwnerID));
123 assert(is_null($this->ID) || is_string($this->ID));
124 assert(is_null($this->validUntil) || is_int($this->validUntil));
125 assert(is_null($this->cacheDuration) || is_string($this->cacheDuration));
127 assert(is_array($this->AffiliateMember));
128 assert(!empty($this->AffiliateMember));
131 $e = $parent->ownerDocument->createElementNS(
Constants::NS_MD,
'md:AffiliationDescriptor');
132 $parent->appendChild($e);
134 $e->setAttribute(
'affiliationOwnerID', $this->affiliationOwnerID);
136 if (isset($this->ID)) {
137 $e->setAttribute(
'ID', $this->ID);
140 if (isset($this->validUntil)) {
141 $e->setAttribute(
'validUntil', gmdate(
'Y-m-d\TH:i:s\Z', $this->validUntil));
144 if (isset($this->cacheDuration)) {
145 $e->setAttribute(
'cacheDuration', $this->cacheDuration);
__construct(\DOMElement $xml=null)
Initialize a AffiliationDescriptor.
static extractStrings(\DOMElement $parent, $namespaceURI, $localName)
Extract strings from a set of nodes.
static addStrings(\DOMElement $parent, $namespace, $name, $localized, array $values)
Append string elements.
toXML(\DOMElement $parent)
Add this AffiliationDescriptor to an EntityDescriptor.
const NS_MD
The namespace for the SAML 2 metadata.
static xpQuery(\DOMNode $node, $query)
Do an XPath query on an XML node.
signElement(\DOMElement $root, \DOMElement $insertBefore=null)
Sign the given XML element.
static xsDateTimeToTimestamp($time)
This function converts a SAML2 timestamp on the form yyyy-mm-ddThh:mm:ss(.s+)?Z to a UNIX timestamp...
static addList(\DOMElement $parent, array $extensions)
Add a list of Extensions to the given element.
static getList(\DOMElement $parent)
Get a list of Extensions in the given element.