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; |
10
|
|
|
use SimpleSAML\XMLSchema\Type\NCNameValue; |
11
|
|
|
use SimpleSAML\XMLSchema\XML\Constants\NS; |
12
|
|
|
use SimpleSAML\XMLSchema\XML\Interface\ParticleInterface; |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* Abstract class representing the namedGroup-type. |
16
|
|
|
* |
17
|
|
|
* @package simplesamlphp/xml-common |
18
|
|
|
*/ |
19
|
|
|
abstract class AbstractNamedGroup extends AbstractRealGroup |
20
|
|
|
{ |
21
|
|
|
/** The namespace-attribute for the xs:anyAttribute element */ |
22
|
|
|
public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; |
23
|
|
|
|
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* Group constructor |
27
|
|
|
* |
28
|
|
|
* @param \SimpleSAML\XMLSchema\XML\Interface\ParticleInterface $particle |
29
|
|
|
* @param \SimpleSAML\XMLSchema\Type\NCNameValue|null $name |
30
|
|
|
* @param \SimpleSAML\XMLSchema\XML\Annotation|null $annotation |
31
|
|
|
* @param \SimpleSAML\XMLSchema\Type\IDValue|null $id |
32
|
|
|
* @param array<\SimpleSAML\XML\Attribute> $namespacedAttributes |
33
|
|
|
*/ |
34
|
|
|
public function __construct( |
35
|
|
|
ParticleInterface $particle, |
36
|
|
|
?NCNameValue $name = null, |
37
|
|
|
?Annotation $annotation = null, |
38
|
|
|
?IDValue $id = null, |
39
|
|
|
array $namespacedAttributes = [], |
40
|
|
|
) { |
41
|
|
|
Assert::isInstanceOfAny( |
42
|
|
|
$particle, |
43
|
|
|
[All::class, Choice::class, Sequence::class], |
44
|
|
|
SchemaViolationException::class, |
45
|
|
|
); |
46
|
|
|
|
47
|
|
|
if ($particle instanceof All) { |
48
|
|
|
Assert::null($particle->getMinOccurs(), SchemaViolationException::class); |
49
|
|
|
Assert::null($particle->getMaxOccurs(), SchemaViolationException::class); |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
parent::__construct( |
53
|
|
|
name: $name, |
54
|
|
|
particle: $particle, |
55
|
|
|
annotation: $annotation, |
56
|
|
|
id: $id, |
57
|
|
|
namespacedAttributes: $namespacedAttributes, |
58
|
|
|
); |
59
|
|
|
} |
60
|
|
|
} |
61
|
|
|
|