66
77use DOMElement ;
88use SimpleSAML \WSSecurity \Assert \Assert ;
9- use SimpleSAML \XML \Exception \InvalidDOMElementException ;
10- use SimpleSAML \XML \Exception \SchemaViolationException ;
119use SimpleSAML \XML \ExtendableAttributesTrait ;
1210use SimpleSAML \XML \TypedTextContentTrait ;
13- use SimpleSAML \XML \XsNamespace as NS ;
14- use SimpleSAML \XMLSchema \Base64BinaryValue ;
15-
16- use function array_map ;
17- use function explode ;
18- use function implode ;
11+ use SimpleSAML \XMLSchema \Exception \InvalidDOMElementException ;
12+ use SimpleSAML \XMLSchema \Exception \SchemaViolationException ;
13+ use SimpleSAML \XMLSchema \Type \Base64BinaryValue ;
14+ use SimpleSAML \XMLSchema \Type \Helper \AnyURIListValue ;
15+ use SimpleSAML \XMLSchema \XML \Constants \NS ;
1916
2017/**
2118 * A BinarySecertType element
@@ -35,31 +32,16 @@ abstract class AbstractBinarySecretType extends AbstractWstElement
3532 public const XS_ANY_ATTR_NAMESPACE = NS ::OTHER ;
3633
3734
38- /** @var string[]|null */
39- protected ?array $ Type ;
40-
41-
4235 /**
4336 * @param \SimpleSAML\XMLSchema\Type\Base64BinaryValue $content
44- * @param ( \SimpleSAML\WSSecurity\XML\wst_200512\BinarySecretTypeEnum|string)[] |null $Type
37+ * @param \SimpleSAML\XMLSchema\Type\Helper\AnyURIListValue |null $Type
4538 * @param array<\SimpleSAML\XML\Attribute> $namespacedAttributes
4639 */
4740 final public function __construct (
4841 Base64BinaryValue $ content ,
49- ? array $ Type = null ,
42+ protected ? AnyURIListValue $ Type = null ,
5043 array $ namespacedAttributes = [],
5144 ) {
52- if ($ Type !== null ) {
53- $ Type = array_map (
54- function (BinarySecretTypeEnum |string $ v ): string {
55- return ($ v instanceof BinarySecretTypeEnum) ? $ v ->value : $ v ;
56- },
57- $ Type ,
58- );
59- Assert::allValidURI ($ Type , SchemaViolationException::class);
60- $ this ->Type = $ Type ;
61- }
62-
6345 $ this ->setContent ($ content );
6446 $ this ->setAttributesNS ($ namespacedAttributes );
6547 }
@@ -68,9 +50,9 @@ function (BinarySecretTypeEnum|string $v): string {
6850 /**
6951 * Get the Type property.
7052 *
71- * @return string[] |null
53+ * @return \SimpleSAML\XMLSchema\Type\Helper\AnyURIListValue |null
7254 */
73- public function getType (): ?array
55+ public function getType (): ?AnyURIListValue
7456 {
7557 return $ this ->Type ;
7658 }
@@ -82,7 +64,7 @@ public function getType(): ?array
8264 * @param \DOMElement $xml The XML element we should load
8365 * @return static
8466 *
85- * @throws \SimpleSAML\XML \Exception\InvalidDOMElementException
67+ * @throws \SimpleSAML\XMLSchema \Exception\InvalidDOMElementException
8668 * If the qualified name of the supplied element is wrong
8769 */
8870 public static function fromXML (DOMElement $ xml ): static
@@ -92,7 +74,7 @@ public static function fromXML(DOMElement $xml): static
9274
9375 return new static (
9476 Base64BinaryValue::fromString ($ xml ->textContent ),
95- explode ( ' ' , self ::getAttribute ($ xml , 'Type ' ) ),
77+ self ::getAttribute ($ xml , 'Type ' , AnyURIListValue::class ),
9678 self ::getAttributesNSFromXML ($ xml ),
9779 );
9880 }
@@ -110,7 +92,7 @@ public function toXML(?DOMElement $parent = null): DOMElement
11092 $ e ->textContent = $ this ->getContent ()->getValue ();
11193
11294 if ($ this ->getType () !== null ) {
113- $ e ->setAttribute ('Type ' , implode ( ' ' , $ this ->getType ()));
95+ $ e ->setAttribute ('Type ' , $ this ->getType ()-> getValue ( ));
11496 }
11597
11698 foreach ($ this ->getAttributesNS () as $ attr ) {
0 commit comments