ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
X509Data.php
Go to the documentation of this file.
1 <?php
2 
3 namespace SAML2\XML\ds;
4 
7 
13 class X509Data
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 }
Add some data
__construct(\DOMElement $xml=null)
Initialize a X509Data.
Definition: X509Data.php:30
$xml
Definition: metadata.php:240
$n
Definition: RandomTest.php:85
Create styles array
The data for the language used.