Passed
Branch feature/php8.3 (4d3b0a)
by Tim
17:15
created

MonthValue   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 28
rs 10
c 0
b 0
f 0
wmc 2
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\Type\Interface\AbstractAnySimpleType;
10
11
/**
12
 * @package simplesaml/xml-common
13
 */
14
class MonthValue extends AbstractAnySimpleType
15
{
16
    public const string SCHEMA_TYPE = 'gMonth';
0 ignored issues
show
Bug introduced by
A parse error occurred: Syntax error, unexpected T_STRING, expecting '=' on line 16 at column 24
Loading history...
17
18
19
    /**
20
     * Sanitize the value.
21
     *
22
     * @param string $value  The unsanitized value
23
     */
24
    protected function sanitizeValue(string $value): string
25
    {
26
        return static::collapseWhitespace(static::normalizeWhitespace($value));
27
    }
28
29
30
    /**
31
     * Validate the value.
32
     *
33
     * @param string $value
34
     * @throws \SimpleSAML\XMLSchema\Exception\SchemaViolationException on failure
35
     */
36
    protected function validateValue(string $value): void
37
    {
38
        Assert::validMonth($this->sanitizeValue($value), SchemaViolationException::class);
39
    }
40
}
41