| Total Complexity | 3 |
| Total Lines | 39 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 17 | class AuthnContextComparisonTypeValue extends StringValue |
||
| 18 | { |
||
| 19 | public const string SCHEMA_TYPE = 'authnContextComparisonType'; |
||
|
|
|||
| 20 | |||
| 21 | |||
| 22 | /** |
||
| 23 | * Validate the value. |
||
| 24 | * |
||
| 25 | * @throws \Exception on failure |
||
| 26 | */ |
||
| 27 | protected function validateValue(string $value): void |
||
| 28 | { |
||
| 29 | Assert::oneOf( |
||
| 30 | $this->sanitizeValue($value), |
||
| 31 | array_column(AuthnContextComparisonTypeEnum::cases(), 'value'), |
||
| 32 | SchemaViolationException::class, |
||
| 33 | ); |
||
| 34 | } |
||
| 35 | |||
| 36 | |||
| 37 | /** |
||
| 38 | * @param \SimpleSAML\SAML2\XML\samlp\AuthnContextComparisonTypeEnum $value |
||
| 39 | */ |
||
| 40 | public static function fromEnum(AuthnContextComparisonTypeEnum $value): static |
||
| 41 | { |
||
| 42 | return new static($value->value); |
||
| 43 | } |
||
| 44 | |||
| 45 | |||
| 46 | /** |
||
| 47 | * @return \SimpleSAML\SAML2\XML\samlp\AuthnContextComparisonTypeEnum $value |
||
| 48 | */ |
||
| 49 | public function toEnum(): AuthnContextComparisonTypeEnum |
||
| 50 | { |
||
| 51 | return AuthnContextComparisonTypeEnum::from($this->getValue()); |
||
| 52 | } |
||
| 53 | } |
||
| 54 |