| Total Complexity | 2 |
| Total Lines | 29 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 15 | class IDRefsValue extends TokenValue implements ListTypeInterface |
||
| 16 | { |
||
| 17 | public const string SCHEMA_TYPE = 'IDREFS'; |
||
|
|
|||
| 18 | |||
| 19 | |||
| 20 | /** |
||
| 21 | * Validate the value. |
||
| 22 | * |
||
| 23 | * @param string $value |
||
| 24 | * @throws \SimpleSAML\XMLSchema\Exception\SchemaViolationException on failure |
||
| 25 | */ |
||
| 26 | protected function validateValue(string $value): void |
||
| 27 | { |
||
| 28 | // Note: value must already be sanitized before validating |
||
| 29 | Assert::validIDRefs($this->sanitizeValue($value), SchemaViolationException::class); |
||
| 30 | } |
||
| 31 | |||
| 32 | |||
| 33 | /** |
||
| 34 | * Convert this xs:IDREFS to an array of xs:IDREF items |
||
| 35 | * |
||
| 36 | * @return array<\SimpleSAML\XMLSchema\Type\IDRefValue> |
||
| 37 | */ |
||
| 38 | public function toArray(): array |
||
| 39 | { |
||
| 40 | $tokens = explode(' ', $this->getValue(), C::UNBOUNDED_LIMIT); |
||
| 41 | return array_map([IDRefValue::class, 'fromString'], $tokens); |
||
| 42 | } |
||
| 43 | } |
||
| 44 |