DoubleValue::sanitizeValue()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 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 DoubleValue extends AbstractValueType
14
{
15
    /** @var string */
16
    public const SCHEMA_TYPE = 'double';
17
18
19
    /**
20
     * Sanitize the value.
21
     *
22
     * @param string $value  The unsanitized value
23
     * @return string
24
     */
25
    protected function sanitizeValue(string $value): string
26
    {
27
        return static::collapseWhitespace(static::normalizeWhitespace($value));
28
    }
29
30
31
    /**
32
     * Validate the value.
33
     *
34
     * @param string $value
35
     * @throws \SimpleSAML\XML\Exception\SchemaViolationException on failure
36
     * @return void
37
     */
38
    protected function validateValue(string $value): void
39
    {
40
        Assert::validDouble($this->sanitizeValue($value), SchemaViolationException::class);
41
    }
42
}
43