ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
SAML2\XML\md\AttributeConsumingService Class Reference
+ Collaboration diagram for SAML2\XML\md\AttributeConsumingService:

Public Member Functions

 __construct (\DOMElement $xml=null)
 Initialize / parse an AttributeConsumingService. More...
 
 toXML (\DOMElement $parent)
 Convert to . More...
 

Data Fields

 $index
 
 $isDefault = null
 
 $ServiceName = array()
 
 $ServiceDescription = array()
 
 $RequestedAttribute = array()
 

Detailed Description

Definition at line 13 of file AttributeConsumingService.php.

Constructor & Destructor Documentation

◆ __construct()

SAML2\XML\md\AttributeConsumingService::__construct ( \DOMElement  $xml = null)

Initialize / parse an AttributeConsumingService.

Parameters
\DOMElement | null$xmlThe XML element we should load.
Exceptions

Definition at line 62 of file AttributeConsumingService.php.

References $xml, SAML2\Utils\extractLocalizedStrings(), SAML2\Constants\NS_MD, SAML2\Utils\parseBoolean(), and SAML2\Utils\xpQuery().

63  {
64  if ($xml === null) {
65  return;
66  }
67 
68  if (!$xml->hasAttribute('index')) {
69  throw new \Exception('Missing index on AttributeConsumingService.');
70  }
71  $this->index = (int) $xml->getAttribute('index');
72 
73  $this->isDefault = Utils::parseBoolean($xml, 'isDefault', null);
74 
75  $this->ServiceName = Utils::extractLocalizedStrings($xml, Constants::NS_MD, 'ServiceName');
76  if (empty($this->ServiceName)) {
77  throw new \Exception('Missing ServiceName in AttributeConsumingService.');
78  }
79 
80  $this->ServiceDescription = Utils::extractLocalizedStrings($xml, Constants::NS_MD, 'ServiceDescription');
81 
82  foreach (Utils::xpQuery($xml, './saml_metadata:RequestedAttribute') as $ra) {
83  $this->RequestedAttribute[] = new RequestedAttribute($ra);
84  }
85  }
static extractLocalizedStrings(\DOMElement $parent, $namespaceURI, $localName)
Extract localized strings from a set of nodes.
Definition: Utils.php:580
$xml
Definition: metadata.php:240
static parseBoolean(\DOMElement $node, $attributeName, $default=null)
Parse a boolean attribute.
Definition: Utils.php:276
const NS_MD
The namespace for the SAML 2 metadata.
Definition: Constants.php:225
static xpQuery(\DOMNode $node, $query)
Do an XPath query on an XML node.
Definition: Utils.php:191
+ Here is the call graph for this function:

Member Function Documentation

◆ toXML()

SAML2\XML\md\AttributeConsumingService::toXML ( \DOMElement  $parent)

Convert to .

Parameters
\DOMElement$parentThe element we should append this AttributeConsumingService to.
Returns

Definition at line 93 of file AttributeConsumingService.php.

References SAML2\Utils\addStrings(), and SAML2\Constants\NS_MD.

94  {
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));
99  assert(is_array($this->RequestedAttribute));
100 
101  $doc = $parent->ownerDocument;
102 
103  $e = $doc->createElementNS(Constants::NS_MD, 'md:AttributeConsumingService');
104  $parent->appendChild($e);
105 
106  $e->setAttribute('index', (string) $this->index);
107 
108  if ($this->isDefault === true) {
109  $e->setAttribute('isDefault', 'true');
110  } elseif ($this->isDefault === false) {
111  $e->setAttribute('isDefault', 'false');
112  }
113 
114  Utils::addStrings($e, Constants::NS_MD, 'md:ServiceName', true, $this->ServiceName);
115  Utils::addStrings($e, Constants::NS_MD, 'md:ServiceDescription', true, $this->ServiceDescription);
116 
117  foreach ($this->RequestedAttribute as $ra) {
118  $ra->toXML($e);
119  }
120 
121  return $e;
122  }
static addStrings(\DOMElement $parent, $namespace, $name, $localized, array $values)
Append string elements.
Definition: Utils.php:659
const NS_MD
The namespace for the SAML 2 metadata.
Definition: Constants.php:225
+ Here is the call graph for this function:

Field Documentation

◆ $index

SAML2\XML\md\AttributeConsumingService::$index

Definition at line 20 of file AttributeConsumingService.php.

◆ $isDefault

SAML2\XML\md\AttributeConsumingService::$isDefault = null

Definition at line 27 of file AttributeConsumingService.php.

◆ $RequestedAttribute

SAML2\XML\md\AttributeConsumingService::$RequestedAttribute = array()

Definition at line 54 of file AttributeConsumingService.php.

◆ $ServiceDescription

SAML2\XML\md\AttributeConsumingService::$ServiceDescription = array()

Definition at line 45 of file AttributeConsumingService.php.

◆ $ServiceName

SAML2\XML\md\AttributeConsumingService::$ServiceName = array()

Definition at line 36 of file AttributeConsumingService.php.


The documentation for this class was generated from the following file: