Passed
Push — master ( 8413b2...00f101 )
by Tim
02:19
created

AbstractRealGroup   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 14
dl 0
loc 43
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 25 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\XMLSchema\XML;
6
7
use SimpleSAML\XML\Assert\Assert;
8
use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
9
use SimpleSAML\XMLSchema\Type\{IDValue, NCNameValue, QNameValue};
10
use SimpleSAML\XMLSchema\Type\Schema\{MinOccursValue, MaxOccursValue};
11
use SimpleSAML\XMLSchema\XML\Enumeration\NamespaceEnum;
12
use SimpleSAML\XMLSchema\XML\Interface\ParticleInterface;
13
14
use function is_null;
15
16
/**
17
 * Abstract class representing the realGroup-type.
18
 *
19
 * @package simplesamlphp/xml-common
20
 */
21
abstract class AbstractRealGroup extends AbstractGroup
22
{
23
    /** The namespace-attribute for the xs:anyAttribute element */
24
    public const XS_ANY_ATTR_NAMESPACE = NamespaceEnum::Other;
25
26
27
    /**
28
     * Group constructor
29
     *
30
     * @param \SimpleSAML\XMLSchema\XML\Interface\ParticleInterface|null $particle
31
     * @param \SimpleSAML\XMLSchema\Type\NCNameValue|null $name
32
     * @param \SimpleSAML\XMLSchema\Type\QNameValue|null $reference
33
     * @param \SimpleSAML\XMLSchema\Type\Schema\MinOccursValue|null $minOccurs
34
     * @param \SimpleSAML\XMLSchema\Type\Schema\MaxOccursValue|null $maxOccurs
35
     * @param \SimpleSAML\XMLSchema\XML\Annotation|null $annotation
36
     * @param \SimpleSAML\XMLSchema\Type\IDValue|null $id
37
     * @param array<\SimpleSAML\XML\Attribute> $namespacedAttributes
38
     */
39
    public function __construct(
40
        ?ParticleInterface $particle = null,
41
        ?NCNameValue $name = null,
42
        ?QNameValue $reference = null,
43
        ?MinOccursValue $minOccurs = null,
44
        ?MaxOccursValue $maxOccurs = null,
45
        ?Annotation $annotation = null,
46
        ?IDValue $id = null,
47
        array $namespacedAttributes = [],
48
    ) {
49
        Assert::nullOrIsInstanceOf(
50
            $particle,
51
            ParticleInterface::class,
52
            SchemaViolationException::class,
53
        );
54
55
        parent::__construct(
56
            $name,
57
            $reference,
58
            $minOccurs,
59
            $maxOccurs,
60
            is_null($particle) ? [] : [$particle],
61
            $annotation,
62
            $id,
63
            $namespacedAttributes,
64
        );
65
    }
66
}
67