ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
X509Data.php
Go to the documentation of this file.
1<?php
2
3namespace SAML2\XML\ds;
4
7
14{
23 public $data = array();
24
30 public function __construct(\DOMElement $xml = null)
31 {
32 if ($xml === null) {
33 return;
34 }
35
36 for ($n = $xml->firstChild; $n !== null; $n = $n->nextSibling) {
37 if (!($n instanceof \DOMElement)) {
38 continue;
39 }
40
41 if ($n->namespaceURI !== XMLSecurityDSig::XMLDSIGNS) {
42 $this->data[] = new Chunk($n);
43 continue;
44 }
45 switch ($n->localName) {
46 case 'X509Certificate':
47 $this->data[] = new X509Certificate($n);
48 break;
49 default:
50 $this->data[] = new Chunk($n);
51 break;
52 }
53 }
54 }
55
62 public function toXML(\DOMElement $parent)
63 {
64 assert(is_array($this->data));
65
66 $doc = $parent->ownerDocument;
67
68 $e = $doc->createElementNS(XMLSecurityDSig::XMLDSIGNS, 'ds:X509Data');
69 $parent->appendChild($e);
70
72 foreach ($this->data as $n) {
73 $n->toXML($e);
74 }
75
76 return $e;
77 }
78}
$n
Definition: RandomTest.php:85
An exception for terminatinating execution or to throw for unit testing.
__construct(\DOMElement $xml=null)
Initialize a X509Data.
Definition: X509Data.php:30
$this data['403_header']