Completed
Push — master ( f72cfb...4ef12f )
by Tim
21s queued 18s
created

AbstractRealGroup   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Importance

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