Definition at line 11 of file Keywords.php.
◆ __construct()
SAML2\XML\mdui\Keywords::__construct |
( |
\DOMElement |
$xml = null | ) |
|
Initialize a Keywords.
- Parameters
-
\DOMElement | null | $xml | The XML element we should load. |
- Exceptions
-
Definition at line 35 of file Keywords.php.
References $xml, and array.
41 if (!
$xml->hasAttribute(
'xml:lang')) {
42 throw new \Exception(
'Missing lang on Keywords.');
44 if (!is_string(
$xml->textContent) || !strlen(
$xml->textContent)) {
45 throw new \Exception(
'Missing value for Keywords.');
47 $this->Keywords =
array();
48 foreach (explode(
' ',
$xml->textContent) as $keyword) {
49 $this->Keywords[] = str_replace(
'+',
' ', $keyword);
51 $this->lang =
$xml->getAttribute(
'xml:lang');
Create styles array
The data for the language used.
◆ toXML()
SAML2\XML\mdui\Keywords::toXML |
( |
\DOMElement |
$parent | ) |
|
Convert this Keywords to XML.
- Parameters
-
\DOMElement | $parent | The element we should append this Keywords to. |
- Returns
- Exceptions
-
Definition at line 61 of file Keywords.php.
References SAML2\XML\mdui\Common\NS.
63 assert(is_string($this->lang));
64 assert(is_array($this->Keywords));
66 $doc = $parent->ownerDocument;
68 $e = $doc->createElementNS(
Common::NS,
'mdui:Keywords');
69 $e->setAttribute(
'xml:lang', $this->lang);
71 foreach ($this->Keywords as $keyword) {
72 if (strpos($keyword,
"+") !==
false) {
73 throw new \Exception(
'Keywords may not contain a "+" character.');
75 $value .= str_replace(
' ',
'+', $keyword) .
' ';
77 $value = rtrim($value);
78 $e->appendChild($doc->createTextNode($value));
79 $parent->appendChild($e);
◆ $Keywords
SAML2\XML\mdui\Keywords::$Keywords |
◆ $lang
SAML2\XML\mdui\Keywords::$lang |
The documentation for this class was generated from the following file:
- libs/composer/vendor/simplesamlphp/saml2/src/SAML2/XML/mdui/Keywords.php