Passed
Push — master ( 2d22c8...e7e0b8 )
by Tim
02:07
created

NameIDFormat::fromXML()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 3
c 1
b 0
f 1
nc 1
nop 1
dl 0
loc 6
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\SAML2\XML\md;
6
7
use DOMElement;
8
use SimpleSAML\Assert\Assert;
9
use SimpleSAML\XML\Exception\InvalidDOMElementException;
10
use SimpleSAML\XML\Exception\SchemaViolationException;
11
use SimpleSAML\XML\StringElementTrait;
12
13
/**
14
 * Class representing a md:NameIDFormat element.
15
 *
16
 * @package simplesaml/saml2
17
 */
18
final class NameIDFormat extends AbstractMdElement
19
{
20
    use StringElementTrait;
21
22
23
    /**
24
     * @param string $content
25
     */
26
    public function __construct(string $content)
27
    {
28
        $this->setContent($content);
29
    }
30
31
32
    /**
33
     * Validate the content of the element.
34
     *
35
     * @param string $content  The value to go in the XML textContent
36
     * @throws \Exception on failure
37
     * @return void
38
     */
39
    protected function validateContent(string $content): void
40
    {
41
        Assert::validURI($content, SchemaViolationException::class); // Covers the empty string
42
    }
43
}
44