Text::validateContent()   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\SOAP\XML\env_200305;
6
7
use SimpleSAML\Assert\Assert;
8
use SimpleSAML\XML\LocalizedStringElementTrait;
9
10
/**
11
 * Class representing a env:Text element.
12
 *
13
 * @package simplesaml/xml-soap
14
 */
15
final class Text extends AbstractSoapElement
16
{
17
    use LocalizedStringElementTrait;
18
19
20
    /**
21
     * Initialize a env:Text
22
     *
23
     * @param string $language
24
     * @param string $content
25
     */
26
    public function __construct(string $language, string $content)
27
    {
28
        $this->setContent($content);
29
        $this->setLanguage($language);
30
    }
31
32
33
    /**
34
     * Validate the content of the element.
35
     *
36
     * @param string $content  The value to go in the XML textContent
37
     * @throws \SimpleSAML\Assert\AssertionFailedException on failure
38
     * @return void
39
     */
40
    protected function validateContent(string $content): void
41
    {
42
        Assert::notWhitespaceOnly($content);
43
    }
44
}
45