Completed
Push — master ( b4a32a...a386bd )
by Tim
18s queued 14s
created

LanguageValue   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 3
c 0
b 0
f 0
dl 0
loc 17
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A validateValue() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\XML\Type;
6
7
use SimpleSAML\XML\Assert\Assert;
8
use SimpleSAML\XML\Exception\SchemaViolationException;
9
10
/**
11
 * @package simplesaml/xml-common
12
 */
13
class LanguageValue extends TokenValue
14
{
15
    /** @var string */
16
    public const SCHEMA_TYPE = 'language';
17
18
19
    /**
20
     * Validate the value.
21
     *
22
     * @param string $value
23
     * @throws \SimpleSAML\XML\Exception\SchemaViolationException on failure
24
     * @return void
25
     */
26
    protected function validateValue(string $value): void
27
    {
28
        // Note: value must already be sanitized before validating
29
        Assert::validLanguage($this->sanitizeValue($value), SchemaViolationException::class);
30
    }
31
}
32