| Total Complexity | 3 |
| Total Lines | 31 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 15 | class LangValue extends LanguageValue implements AttributeTypeInterface |
||
| 16 | { |
||
| 17 | public const string SCHEMA_TYPE = 'xs:language'; |
||
|
|
|||
| 18 | |||
| 19 | |||
| 20 | /** |
||
| 21 | * Validate the value. |
||
| 22 | * |
||
| 23 | * @param string $value |
||
| 24 | * @throws \SimpleSAML\XMLSchema\Exception\SchemaViolationException on failure |
||
| 25 | * @return void |
||
| 26 | */ |
||
| 27 | protected function validateValue(string $value): void |
||
| 28 | { |
||
| 29 | $sanitized = $this->sanitizeValue($value); |
||
| 30 | |||
| 31 | if ($sanitized !== '') { |
||
| 32 | parent::validateValue($sanitized); |
||
| 33 | } |
||
| 34 | } |
||
| 35 | |||
| 36 | |||
| 37 | /** |
||
| 38 | * Convert this value to an attribute |
||
| 39 | * |
||
| 40 | * @return \SimpleSAML\XML\Attribute |
||
| 41 | */ |
||
| 42 | public function toAttribute(): Attribute |
||
| 43 | { |
||
| 44 | return new Attribute(C::NS_XML, 'xml', 'lang', $this); |
||
| 45 | } |
||
| 46 | } |
||
| 47 |