Passed
Pull Request — master (#288)
by Tim
06:15 queued 03:50
created

AffiliateMember::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 1
c 1
b 0
f 1
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\SAML2\XML\md;
6
7
use DOMElement;
8
use SimpleSAML\Assert\Assert;
9
use SimpleSAML\SAML2\Constants as C;
10
use SimpleSAML\XML\XMLStringElementTrait;
11
12
/**
13
 * Class implementing AffiliateMember.
14
 *
15
 * @package simplesamlphp/saml2
16
 */
17
final class AffiliateMember extends AbstractMdElement
18
{
19
    use XMLStringElementTrait;
1 ignored issue
show
introduced by
The trait SimpleSAML\XML\XMLStringElementTrait requires some properties which are not provided by SimpleSAML\SAML2\XML\md\AffiliateMember: $localName, $namespaceURI
Loading history...
20
21
22
    /**
23
     * @param string $content
24
     */
25
    public function __construct(string $content)
26
    {
27
        $this->setContent($content);
28
    }
29
30
31
    /**
32
     * Validate the content of the element.
33
     *
34
     * @param string $content  The value to go in the XML textContent
35
     * @throws \Exception on failure
36
     * @return void
37
     */
38
    protected function validateContent(string $content): void
39
    {
40
        Assert::notEmpty($content, 'Cannot specify an empty string as an affiliation member entityID.');
41
        Assert::maxLength($content, C::ENTITYID_MAX_LENGTH, 'The AffiliateMember cannot be longer than 1024 characters.');
42
    }
43
}
44