ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
SigningMethod.php
Go to the documentation of this file.
1 <?php
2 
3 namespace SAML2\XML\alg;
4 
13 {
19  public $Algorithm;
20 
21 
28  public $MinKeySize;
29 
30 
37  public $MaxKeySize;
38 
39 
47  public function __construct(\DOMElement $xml = null)
48  {
49  if ($xml === null) {
50  return;
51  }
52 
53  if (!$xml->hasAttribute('Algorithm')) {
54  throw new \Exception('Missing required attribute "Algorithm" in alg:SigningMethod element.');
55  }
56  $this->Algorithm = $xml->getAttribute('Algorithm');
57 
58  if ($xml->hasAttribute('MinKeySize')) {
59  $this->MinKeySize = intval($xml->getAttribute('MinKeySize'));
60  }
61 
62  if ($xml->hasAttribute('MaxKeySize')) {
63  $this->MaxKeySize = intval($xml->getAttribute('MaxKeySize'));
64  }
65  }
66 
67 
74  public function toXML(\DOMElement $parent)
75  {
76  assert(is_string($this->Algorithm));
77  assert(is_int($this->MinKeySize) || is_null($this->MinKeySize));
78  assert(is_int($this->MaxKeySize) || is_null($this->MaxKeySize));
79 
80  $doc = $parent->ownerDocument;
81  $e = $doc->createElementNS(Common::NS, 'alg:SigningMethod');
82  $parent->appendChild($e);
83  $e->setAttribute('Algorithm', $this->Algorithm);
84 
85  if ($this->MinKeySize !== null) {
86  $e->setAttribute('MinKeySize', $this->MinKeySize);
87  }
88 
89  if ($this->MaxKeySize !== null) {
90  $e->setAttribute('MaxKeySize', $this->MaxKeySize);
91  }
92 
93  return $e;
94  }
95 }
__construct(\DOMElement $xml=null)
Create/parse an alg:SigningMethod element.
toXML(\DOMElement $parent)
Convert this element to XML.
$xml
Definition: metadata.php:240