Passed
Push — master ( dc3413...763186 )
by Tim
01:51
created

Text::fromXML()   A

Complexity

Conditions 4
Paths 6

Size

Total Lines 22
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

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