| Total Complexity | 2 |
| Total Lines | 35 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 21 | final class RequesterID extends AbstractSamlpElement implements SchemaValidatableElementInterface |
||
| 22 | { |
||
| 23 | use SchemaValidatableElementTrait; |
||
| 24 | use TypedTextContentTrait; |
||
| 25 | |||
| 26 | |||
| 27 | public const string TEXTCONTENT_TYPE = EntityIDValue::class; |
||
|
|
|||
| 28 | |||
| 29 | |||
| 30 | /** |
||
| 31 | * Create a class from an array |
||
| 32 | * |
||
| 33 | * @param array<string> $data |
||
| 34 | */ |
||
| 35 | public static function fromArray(array $data): static |
||
| 36 | { |
||
| 37 | Assert::allString($data, ArrayValidationException::class); |
||
| 38 | |||
| 39 | $index = array_key_first($data); |
||
| 40 | return new static( |
||
| 41 | EntityIDValue::fromString($data[$index]), |
||
| 42 | ); |
||
| 43 | } |
||
| 44 | |||
| 45 | |||
| 46 | /** |
||
| 47 | * Create an array from this class |
||
| 48 | * |
||
| 49 | * @return array<string> |
||
| 50 | */ |
||
| 51 | public function toArray(): array |
||
| 52 | { |
||
| 53 | return [$this->getContent()->getValue()]; |
||
| 54 | } |
||
| 55 | } |
||
| 56 |