| Total Complexity | 3 | 
| Total Lines | 34 | 
| Duplicated Lines | 0 % | 
| Changes | 1 | ||
| Bugs | 0 | Features | 0 | 
| 1 | <?php | ||
| 16 | class KeyTypesValue extends SAMLStringValue | ||
| 17 | { | ||
| 18 | /** | ||
| 19 | * Validate the content of the element. | ||
| 20 | * | ||
| 21 | * @param string $content The value to go in the XML textContent | ||
| 22 | * @throws \Exception on failure | ||
| 23 | * @return void | ||
| 24 | */ | ||
| 25 | protected function validateValue(string $content): void | ||
| 26 |     { | ||
| 27 | Assert::oneOf( | ||
| 28 | $this->sanitizeValue($content), | ||
| 29 | array_column(KeyTypesEnum::cases(), 'value'), | ||
| 30 | SchemaViolationException::class, | ||
| 31 | ); | ||
| 32 | } | ||
| 33 | |||
| 34 | |||
| 35 | /** | ||
| 36 | * Convert enum to value type | ||
| 37 | */ | ||
| 38 | public static function fromEnum(KeyTypesEnum $use): static | ||
| 39 |     { | ||
| 40 | return static::fromString($use->value); | ||
| 41 | } | ||
| 42 | |||
| 43 | |||
| 44 | /** | ||
| 45 | * Convert this value type to enum | ||
| 46 | */ | ||
| 47 | public function toEnum(): KeyTypesEnum | ||
| 50 | } | ||
| 51 | } | ||
| 52 |