Passed
Push — master ( faa376...c7ca4c )
by Tim
17:29 queued 14:52
created

LangValue   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 31
rs 10
wmc 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\XML\Type;
6
7
use SimpleSAML\XML\Attribute;
8
use SimpleSAML\XML\Constants as C;
9
use SimpleSAML\XMLSchema\Type\Interface\AttributeTypeInterface;
10
use SimpleSAML\XMLSchema\Type\LanguageValue;
11
12
/**
13
 * @package simplesaml/xml-common
14
 */
15
class LangValue extends LanguageValue implements AttributeTypeInterface
16
{
17
    public const string SCHEMA_TYPE = 'xs:language';
0 ignored issues
show
Bug introduced by
A parse error occurred: Syntax error, unexpected T_STRING, expecting '=' on line 17 at column 24
Loading history...
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