Passed
Pull Request — master (#55)
by Tim
02:00
created

NMTokenValue   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 1
c 1
b 0
f 0
dl 0
loc 13
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A validateContent() 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
use function preg_replace;
11
use function trim;
12
13
/**
14
 * @package simplesaml/xml-common
15
 */
16
class NMTokenValue extends TokenValue
17
{
18
    /**
19
     * Validate the content.
20
     *
21
     * @param string $content
22
     * @throws \SimpleSAML\XML\Exception\SchemaViolationException on failure
23
     * @return void
24
     */
25
    protected function validateContent(string $content): void
26
    {
27
        // Note: content must already be sanitized before validating
28
        Assert::validNMToken($this->sanitizeContent($content), SchemaViolationException::class);
29
    }
30
}
31