44
55namespace SimpleSAML \SAML11 \XML \saml ;
66
7- use DOMElement ;
8- use SimpleSAML \Assert \Assert ;
9- use SimpleSAML \XML \Exception \InvalidDOMElementException ;
10- use SimpleSAML \XML \Exception \SchemaViolationException ;
7+ use SimpleSAML \SAML11 \XML \URIElementTrait ;
118use SimpleSAML \XML \SchemaValidatableElementInterface ;
129use SimpleSAML \XML \SchemaValidatableElementTrait ;
13- use SimpleSAML \XML \StringElementTrait ;
1410
1511/**
1612 * Class representing a saml:ConfirmationMethod element.
2016final class ConfirmationMethod extends AbstractSamlElement implements SchemaValidatableElementInterface
2117{
2218 use SchemaValidatableElementTrait;
23- use StringElementTrait ;
19+ use URIElementTrait ;
2420
2521
2622 /**
@@ -30,50 +26,4 @@ public function __construct(string $content)
3026 {
3127 $ this ->setContent ($ content );
3228 }
33-
34-
35- /**
36- * Validate the content of the element.
37- *
38- * @param string $content The value to go in the XML textContent
39- * @throws \Exception on failure
40- * @return void
41- */
42- protected function validateContent (string $ content ): void
43- {
44- Assert::validNCName ($ content , SchemaViolationException::class); // Covers the empty string
45- }
46-
47-
48- /**
49- * Convert XML into an ConfirmationMethod
50- *
51- * @param \DOMElement $xml The XML element we should load
52- * @return static
53- *
54- * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException
55- * If the qualified name of the supplied element is wrong
56- */
57- public static function fromXML (DOMElement $ xml ): static
58- {
59- Assert::same ($ xml ->localName , static ::getLocalName (), InvalidDOMElementException::class);
60- Assert::same ($ xml ->namespaceURI , static ::NS , InvalidDOMElementException::class);
61-
62- return new static ($ xml ->textContent );
63- }
64-
65-
66- /**
67- * Convert this ConfirmationMethod to XML.
68- *
69- * @param \DOMElement $parent The element we are converting to XML.
70- * @return \DOMElement The XML element after adding the data corresponding to this ConfirmationMethod.
71- */
72- public function toXML (?DOMElement $ parent = null ): DOMElement
73- {
74- $ element = $ this ->instantiateParentElement ($ parent );
75- $ element ->textContent = $ this ->getContent ();
76-
77- return $ element ;
78- }
7929}
0 commit comments