|
4 | 4 |
|
5 | 5 | namespace SimpleSAML\WSSecurity\XML\wst_200502; |
6 | 6 |
|
7 | | -use DOMElement; |
8 | | -use SimpleSAML\WSSecurity\Assert\Assert; |
9 | 7 | use SimpleSAML\XML\TypedTextContentTrait; |
10 | | -use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; |
11 | | -use SimpleSAML\XMLSchema\Exception\SchemaViolationException; |
12 | | -use SimpleSAML\XMLSchema\Type\StringValue; |
13 | | - |
14 | | -use function array_map; |
15 | | -use function explode; |
16 | | -use function implode; |
| 8 | +use SimpleSAML\XMLSchema\Type\AnyURIValue; |
17 | 9 |
|
18 | 10 | /** |
19 | 11 | * A ComputedKeyOpenEnum element |
20 | 12 | * |
21 | 13 | * @package simplesamlphp/ws-security |
22 | | - * |
23 | | - * @phpstan-consistent-constructor |
24 | 14 | */ |
25 | 15 | abstract class AbstractComputedKeyOpenEnum extends AbstractWstElement |
26 | 16 | { |
27 | 17 | use TypedTextContentTrait; |
28 | 18 |
|
29 | 19 |
|
30 | 20 | /** @var string */ |
31 | | - public const TEXTCONTENT_TYPE = StringValue::class; |
32 | | - |
33 | | - |
34 | | - /** |
35 | | - * @param (\SimpleSAML\WSSecurity\XML\wst_200502\ComputedKeyEnum|string)[] $values |
36 | | - */ |
37 | | - public function __construct(array $values) |
38 | | - { |
39 | | - $values = array_map( |
40 | | - function (ComputedKeyEnum|string $v): string { |
41 | | - return ($v instanceof ComputedKeyEnum) ? $v->value : $v; |
42 | | - }, |
43 | | - $values, |
44 | | - ); |
45 | | - Assert::allValidURI($values, SchemaViolationException::class); |
46 | | - |
47 | | - $this->setContent(StringValue::fromString(implode(' ', $values))); |
48 | | - } |
49 | | - |
50 | | - |
51 | | - /** |
52 | | - * Convert XML into a class instance |
53 | | - * |
54 | | - * @param \DOMElement $xml The XML element we should load |
55 | | - * @return static |
56 | | - * |
57 | | - * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException |
58 | | - * If the qualified name of the supplied element is wrong |
59 | | - */ |
60 | | - public static function fromXML(DOMElement $xml): static |
61 | | - { |
62 | | - Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class); |
63 | | - Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); |
64 | | - |
65 | | - return new static(explode(' ', $xml->textContent)); |
66 | | - } |
| 21 | + public const TEXTCONTENT_TYPE = AnyURIValue::class; |
67 | 22 | } |
0 commit comments