AssertionIDRef::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
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 SimpleSAML\SAML2\Assert\Assert;
8
use SimpleSAML\SAML2\XML\StringElementTrait;
9
use SimpleSAML\XML\Exception\SchemaViolationException;
10
use SimpleSAML\XML\SchemaValidatableElementInterface;
11
use SimpleSAML\XML\SchemaValidatableElementTrait;
12
13
/**
14
 * Class representing a saml:AssertionIDRef element.
15
 *
16
 * @package simplesaml/saml2
17
 */
18
final class AssertionIDRef extends AbstractSamlElement implements SchemaValidatableElementInterface
19
{
20
    use SchemaValidatableElementTrait;
21
    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...
22
        StringElementTrait::validateContent as baseValidateContent;
23
    }
24
25
26
    /**
27
     * @param string $content
28
     */
29
    public function __construct(string $content)
30
    {
31
        $this->setContent($content);
32
    }
33
34
35
    /**
36
     * Validate the content of the element.
37
     *
38
     * @param string $content  The value to go in the XML textContent
39
     * @throws \Exception on failure
40
     * @return void
41
     */
42
    protected function validateContent(string $content): void
43
    {
44
        $this->baseValidateContent($content);
45
        Assert::validNCName($content, SchemaViolationException::class);
46
    }
47
}
48