Completed
Push — master ( f72cfb...4ef12f )
by Tim
21s queued 18s
created

ReducedDerivationControlValue::validateValue()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 7
nc 1
nop 1
dl 0
loc 12
rs 10
c 1
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\XMLSchema\Type;
6
7
use SimpleSAML\XML\Assert\Assert;
8
use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
9
use SimpleSAML\XMLSchema\XML\xs\DerivationControlEnum;
10
11
use function array_column;
12
13
/**
14
 * @package simplesaml/xml-common
15
 */
16
class ReducedDerivationControlValue extends DerivationControlValue
17
{
18
    /**
19
     * Validate the value.
20
     *
21
     * @param string $value The value
22
     * @throws \SimpleSAML\XMLSchema\Exception\SchemaViolationException on failure
23
     * @return void
24
     */
25
    protected function validateValue(string $value): void
26
    {
27
        Assert::oneOf(
28
            $this->sanitizeValue($value),
29
            array_column(
30
                [
31
                    DerivationControlEnum::Extension,
32
                    DerivationControlEnum::Restriction,
33
                ],
34
                'value',
35
            ),
36
            SchemaViolationException::class,
37
        );
38
    }
39
}
40