Passed
Push — master ( 8413b2...00f101 )
by Tim
02:19
created

AbstractAllNNIValue::validateValue()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 3
nc 2
nop 1
dl 0
loc 5
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\XMLSchema\Type\Schema;
6
7
use SimpleSAML\XML\Assert\Assert;
8
use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
9
use SimpleSAML\XMLSchema\Type\NonNegativeIntegerValue;
10
11
/**
12
 * @package simplesaml/xml-common
13
 */
14
abstract class AbstractAllNNIValue extends NonNegativeIntegerValue
15
{
16
    /**
17
     * Validate the value.
18
     *
19
     * @param string $value The value
20
     * @throws \Exception on failure
21
     * @return void
22
     */
23
    protected function validateValue(string $value): void
24
    {
25
        $sanitized = $this->sanitizeValue($value);
26
        if ($sanitized !== 'unbounded') {
27
            Assert::validNonNegativeInteger($sanitized, SchemaViolationException::class);
28
        }
29
    }
30
}
31