103 parent::__construct(
$xml);
110 if (
$xml->hasAttribute(
'ID')) {
111 $this->ID =
$xml->getAttribute(
'ID');
113 if (
$xml->hasAttribute(
'validUntil')) {
116 if (
$xml->hasAttribute(
'cacheDuration')) {
117 $this->cacheDuration =
$xml->getAttribute(
'cacheDuration');
120 if (!
$xml->hasAttribute(
'protocolSupportEnumeration')) {
121 throw new \Exception(
'Missing protocolSupportEnumeration attribute on ' .
$xml->localName);
123 $this->protocolSupportEnumeration = preg_split(
'/[\s]+/',
$xml->getAttribute(
'protocolSupportEnumeration'));
125 if (
$xml->hasAttribute(
'errorURL')) {
126 $this->errorURL =
$xml->getAttribute(
'errorURL');
136 if (count($organization) > 1) {
137 throw new \Exception(
'More than one Organization in the entity.');
138 } elseif (!empty($organization)) {
155 assert(is_null($this->ID) || is_string($this->ID));
156 assert(is_null($this->validUntil) || is_int($this->validUntil));
157 assert(is_null($this->cacheDuration) || is_string($this->cacheDuration));
158 assert(is_array($this->protocolSupportEnumeration));
159 assert(is_null($this->errorURL) || is_string($this->errorURL));
165 $e = $parent->ownerDocument->createElementNS(
Constants::NS_MD, $this->elementName);
166 $parent->appendChild($e);
168 if (isset($this->ID)) {
169 $e->setAttribute(
'ID', $this->ID);
172 if (isset($this->validUntil)) {
173 $e->setAttribute(
'validUntil', gmdate(
'Y-m-d\TH:i:s\Z', $this->validUntil));
176 if (isset($this->cacheDuration)) {
177 $e->setAttribute(
'cacheDuration', $this->cacheDuration);
180 $e->setAttribute(
'protocolSupportEnumeration', implode(
' ', $this->protocolSupportEnumeration));
182 if (isset($this->errorURL)) {
183 $e->setAttribute(
'errorURL', $this->errorURL);
192 if (isset($this->Organization)) {
193 $this->Organization->toXML($e);
__construct($elementName, \DOMElement $xml=null)
Initialize a RoleDescriptor.
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.
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.
toXML(\DOMElement $parent)
Add this RoleDescriptor to an EntityDescriptor.
static getList(\DOMElement $parent)
Get a list of Extensions in the given element.
$protocolSupportEnumeration