simplesamlphp /
xml-common
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | namespace SimpleSAML\XMLSchema\XML; |
||
| 6 | |||
| 7 | use DOMElement; |
||
| 8 | use SimpleSAML\XML\Assert\Assert; |
||
| 9 | use SimpleSAML\XML\Constants as C; |
||
|
0 ignored issues
–
show
|
|||
| 10 | use SimpleSAML\XMLSchema\Type\IDValue; |
||
|
0 ignored issues
–
show
The type
SimpleSAML\XMLSchema\Type\IDValue was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 11 | use SimpleSAML\XMLSchema\Type\NCNameValue; |
||
|
0 ignored issues
–
show
The type
SimpleSAML\XMLSchema\Type\NCNameValue was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 12 | use SimpleSAML\XMLSchema\Type\QNameValue; |
||
|
0 ignored issues
–
show
The type
SimpleSAML\XMLSchema\Type\QNameValue was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 13 | use SimpleSAML\XMLSchema\Type\Schema\MaxOccursValue; |
||
|
0 ignored issues
–
show
The type
SimpleSAML\XMLSchema\Type\Schema\MaxOccursValue was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 14 | use SimpleSAML\XMLSchema\Type\Schema\MinOccursValue; |
||
|
0 ignored issues
–
show
The type
SimpleSAML\XMLSchema\Type\Schema\MinOccursValue was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 15 | use SimpleSAML\XMLSchema\XML\Trait\DefRefTrait; |
||
| 16 | use SimpleSAML\XMLSchema\XML\Trait\OccursTrait; |
||
| 17 | |||
| 18 | use function strval; |
||
| 19 | |||
| 20 | /** |
||
| 21 | * Abstract class representing the group-type. |
||
| 22 | * |
||
| 23 | * @package simplesamlphp/xml-common |
||
| 24 | */ |
||
| 25 | abstract class AbstractGroup extends AbstractAnnotated |
||
| 26 | { |
||
| 27 | use DefRefTrait; |
||
| 28 | use OccursTrait; |
||
| 29 | |||
| 30 | |||
| 31 | /** |
||
| 32 | * Group constructor |
||
| 33 | * |
||
| 34 | * @param \SimpleSAML\XMLSchema\Type\NCNameValue|null $name |
||
| 35 | * @param \SimpleSAML\XMLSchema\Type\QNameValue|null $reference |
||
| 36 | * @param \SimpleSAML\XMLSchema\Type\Schema\MinOccursValue|null $minOccurs |
||
| 37 | * @param \SimpleSAML\XMLSchema\Type\Schema\MaxOccursValue|null $maxOccurs |
||
| 38 | * @param array<\SimpleSAML\XMLSchema\XML\Interface\ParticleInterface> $particles |
||
| 39 | * @param \SimpleSAML\XMLSchema\XML\Annotation|null $annotation |
||
| 40 | * @param \SimpleSAML\XMLSchema\Type\IDValue|null $id |
||
| 41 | * @param array<\SimpleSAML\XML\Attribute> $namespacedAttributes |
||
| 42 | */ |
||
| 43 | public function __construct( |
||
| 44 | ?NCNameValue $name = null, |
||
| 45 | ?QNameValue $reference = null, |
||
| 46 | ?MinOccursValue $minOccurs = null, |
||
| 47 | ?MaxOccursValue $maxOccurs = null, |
||
| 48 | protected array $particles = [], |
||
| 49 | ?Annotation $annotation = null, |
||
|
0 ignored issues
–
show
The type
SimpleSAML\XMLSchema\XML\Annotation was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 50 | ?IDValue $id = null, |
||
| 51 | array $namespacedAttributes = [], |
||
| 52 | ) { |
||
| 53 | Assert::maxCount($particles, C::UNBOUNDED_LIMIT); |
||
| 54 | |||
| 55 | parent::__construct($annotation, $id, $namespacedAttributes); |
||
| 56 | |||
| 57 | $this->setName($name); |
||
| 58 | $this->setReference($reference); |
||
| 59 | $this->setMinOccurs($minOccurs); |
||
| 60 | $this->setMaxOccurs($maxOccurs); |
||
| 61 | } |
||
| 62 | |||
| 63 | |||
| 64 | /** |
||
| 65 | * Collect the value of the particles-property |
||
| 66 | * |
||
| 67 | * @return array<\SimpleSAML\XMLSchema\XML\Interface\ParticleInterface> |
||
| 68 | */ |
||
| 69 | public function getParticles(): array |
||
| 70 | { |
||
| 71 | return $this->particles; |
||
| 72 | } |
||
| 73 | |||
| 74 | |||
| 75 | /** |
||
| 76 | * Test if an object, at the state it's in, would produce an empty XML-element |
||
| 77 | * |
||
| 78 | * @return bool |
||
| 79 | */ |
||
| 80 | public function isEmptyElement(): bool |
||
| 81 | { |
||
| 82 | return parent::isEmptyElement() && |
||
| 83 | empty($this->getParticles()) && |
||
| 84 | empty($this->getName()) && |
||
| 85 | empty($this->getReference()) && |
||
| 86 | empty($this->getMinOccurs()) && |
||
| 87 | empty($this->getMaxOccurs()); |
||
| 88 | } |
||
| 89 | |||
| 90 | |||
| 91 | /** |
||
| 92 | * Add this Group to an XML element. |
||
| 93 | * |
||
| 94 | * @param \DOMElement|null $parent The element we should append this Group to. |
||
| 95 | * @return \DOMElement |
||
| 96 | */ |
||
| 97 | public function toXML(?DOMElement $parent = null): DOMElement |
||
| 98 | { |
||
| 99 | $e = parent::toXML($parent); |
||
| 100 | |||
| 101 | if ($this->getName() !== null) { |
||
| 102 | $e->setAttribute('name', strval($this->getName())); |
||
| 103 | } |
||
| 104 | |||
| 105 | if ($this->getReference() !== null) { |
||
| 106 | $e->setAttribute('ref', strval($this->getReference())); |
||
| 107 | } |
||
| 108 | |||
| 109 | if ($this->getMinOccurs() !== null) { |
||
| 110 | $e->setAttribute('minOccurs', strval($this->getMinOccurs())); |
||
| 111 | } |
||
| 112 | |||
| 113 | if ($this->getMaxOccurs() !== null) { |
||
| 114 | $e->setAttribute('maxOccurs', strval($this->getMaxOccurs())); |
||
| 115 | } |
||
| 116 | |||
| 117 | foreach ($this->getParticles() as $particle) { |
||
| 118 | $particle->toXML($e); |
||
| 119 | } |
||
| 120 | |||
| 121 | return $e; |
||
| 122 | } |
||
| 123 | } |
||
| 124 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths