Passed
Push — master ( c6a4f9...858274 )
by Tim
02:18
created

AuthnContextClassRef   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 24
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A validateContent() 0 3 1
A __construct() 0 3 1
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\Constants;
10
use SimpleSAML\XML\DOMDocumentFactory;
11
use SimpleSAML\XML\Exception\InvalidDOMElementException;
12
use SimpleSAML\XML\Exception\SchemaViolationException;
13
use SimpleSAML\XML\XMLStringElementTrait;
14
15
/**
16
 * Class representing SAML2 AuthnContextClassRef
17
 *
18
 * @package simplesamlphp/saml2
19
 */
20
final class AuthnContextClassRef extends AbstractSamlElement
21
{
22
    use XMLStringElementTrait;
0 ignored issues
show
introduced by
The trait SimpleSAML\XML\XMLStringElementTrait requires some properties which are not provided by SimpleSAML\SAML2\XML\saml\AuthnContextClassRef: $localName, $namespaceURI
Loading history...
23
24
25
    /**
26
     * @param string $content
27
     */
28
    public function __construct(string $content)
29
    {
30
        $this->setContent($content);
31
    }
32
33
34
    /**
35
     * Validate the content of the element.
36
     *
37
     * @param string $content  The value to go in the XML textContent
38
     * @throws \Exception on failure
39
     * @return void
40
     */
41
    protected function validateContent(string $content): void
42
    {
43
        Assert::validURI($content, SchemaViolationException::class); // Covers the empty string
44
    }
45
}
46