| Total Complexity | 3 |
| Total Lines | 30 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 18 | class BlockSetValue extends NMTokenValue |
||
| 19 | { |
||
| 20 | public const string SCHEMA_TYPE = 'blockSet'; |
||
|
|
|||
| 21 | |||
| 22 | |||
| 23 | /** |
||
| 24 | * Validate the value. |
||
| 25 | * |
||
| 26 | * @param string $value The value |
||
| 27 | * @throws \Exception on failure |
||
| 28 | */ |
||
| 29 | protected function validateValue(string $value): void |
||
| 30 | { |
||
| 31 | $sanitized = $this->sanitizeValue($value); |
||
| 32 | |||
| 33 | if ($sanitized !== '#all' && $sanitized !== '') { |
||
| 34 | $list = explode(' ', $sanitized, C::UNBOUNDED_LIMIT); |
||
| 35 | |||
| 36 | // After filtering the allowed values, there should be nothing left |
||
| 37 | $filtered = array_diff( |
||
| 38 | $list, |
||
| 39 | [ |
||
| 40 | DerivationControlEnum::Extension->value, |
||
| 41 | DerivationControlEnum::Restriction->value, |
||
| 42 | DerivationControlEnum::Substitution->value, |
||
| 43 | ], |
||
| 44 | ); |
||
| 45 | Assert::isEmpty($filtered, SchemaViolationException::class); |
||
| 46 | } |
||
| 47 | } |
||
| 48 | } |
||
| 49 |