Passed
Push — master ( c726f3...c686fd )
by Tim
10:07
created

Text   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 28
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 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\SOAP12\XML\env;
6
7
use DOMAttr;
8
use DOMElement;
9
use DOMNameSpaceNode;
10
use SimpleSAML\Assert\Assert;
11
use SimpleSAML\XML\Constants as C;
12
use SimpleSAML\XML\Exception\InvalidDOMElementException;
13
use SimpleSAML\XML\LocalizedStringElementTrait;
14
15
/**
16
 * Class representing a env:Text element.
17
 *
18
 * @package simplesaml/xml-soap
19
 */
20
final class Text extends AbstractSoapElement
21
{
22
    use LocalizedStringElementTrait;
1 ignored issue
show
introduced by
The trait SimpleSAML\XML\LocalizedStringElementTrait requires some properties which are not provided by SimpleSAML\SOAP12\XML\env\Text: $localName, $namespaceURI
Loading history...
23
24
25
    /**
26
     * Initialize a env:Text
27
     *
28
     * @param string $language
29
     * @param string $content
30
     */
31
    public function __construct(string $language, string $content)
32
    {
33
        $this->setContent($content);
34
        $this->setLanguage($language);
35
    }
36
37
38
    /**
39
     * Validate the content of the element.
40
     *
41
     * @param string $content  The value to go in the XML textContent
42
     * @throws \SimpleSAML\Assert\AssertionFailedException on failure
43
     * @return void
44
     */
45
    protected function validateContent(string $content): void
46
    {
47
        Assert::notWhitespaceOnly($content);
48
    }
49
}
50