Passed
Push — master ( f09ef4...1a8f47 )
by Tim
01:50
created

XMLURIElementTrait   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A validateContent() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\XML;
6
7
use DOMElement;
8
use SimpleSAML\Assert\Assert;
9
use SimpleSAML\XML\Constants;
10
use SimpleSAML\XML\Exception\SchemaViolationException;
11
12
use function str_replace;
13
14
/**
15
 * Trait grouping common functionality for simple elements with xs:anyURI textContent
16
 *
17
 * @package simplesamlphp/xml-common
18
 */
19
trait XMLURIElementTrait
20
{
21
    use XMLStringElementTrait;
22
23
24
    /**
25
     * Validate the content of the element.
26
     *
27
     * @param string $content  The value to go in the XML textContent
28
     * @throws \Exception on failure
29
     * @return void
30
     */
31
    protected function validateContent(string $content): void
32
    {
33
        Assert::validURI($content, SchemaViolationException::class);
34
    }
35
}
36