Passed
Push — master ( 92085d...93354f )
by Tim
02:29
created

AssertionIDRef::fromXML()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 6
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\SAML2\XML\saml;
6
7
use DOMElement;
8
use SimpleSAML\Assert\Assert;
9
use SimpleSAML\SAML2\XML\StringElementTrait;
10
use SimpleSAML\XML\Exception\InvalidDOMElementException;
11
use SimpleSAML\XML\Exception\SchemaViolationException;
12
use SimpleSAML\XML\SchemaValidatableElementInterface;
13
use SimpleSAML\XML\SchemaValidatableElementTrait;
14
15
/**
16
 * Class representing a saml:AssertionIDRef element.
17
 *
18
 * @package simplesaml/saml2
19
 */
20
final class AssertionIDRef extends AbstractSamlElement implements SchemaValidatableElementInterface
21
{
22
    use SchemaValidatableElementTrait;
23
    use StringElementTrait {
0 ignored issues
show
introduced by
The trait SimpleSAML\SAML2\XML\StringElementTrait requires some properties which are not provided by SimpleSAML\SAML2\XML\saml\AssertionIDRef: $localName, $namespaceURI
Loading history...
24
        StringElementTrait::validateContent as baseValidateContent;
25
    }
26
27
28
    /**
29
     * @param string $content
30
     */
31
    public function __construct(string $content)
32
    {
33
        $this->setContent($content);
34
    }
35
36
37
    /**
38
     * Validate the content of the element.
39
     *
40
     * @param string $content  The value to go in the XML textContent
41
     * @throws \Exception on failure
42
     * @return void
43
     */
44
    protected function validateContent(string $content): void
45
    {
46
        $this->baseValidateContent($content);
47
        Assert::validNCName($content, SchemaViolationException::class);
48
    }
49
}
50