Skip to content

Commit

Permalink
Add ds:SPKIData element
Browse files Browse the repository at this point in the history
  • Loading branch information
tvdijen committed Dec 3, 2024
1 parent 5bcff09 commit 0ee940f
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/XML/ds/AbstractSPKIDataType.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ abstract class AbstractSPKIDataType extends AbstractDsElement
/**
* Initialize a SPKIData element.
*
* @param array<\SimpleSAML\XMLSecurity\XML\ds\SPKISexp, \SimpleSAML\XML\SerializableElementInterface|null> $tuples
* @param array{array{\SimpleSAML\XMLSecurity\XML\ds\SPKISexp, \SimpleSAML\XML\SerializableElementInterface|null}} $tuples
*/
final public function __construct(
protected array $tuples,
Expand All @@ -32,17 +32,16 @@ final public function __construct(
Assert::allCount($tuples, 2);

foreach ($tuples as $tuple) {
list($spkisExp, $other) = $tuple;
Assert::isInstanceOf($spkisExp, SPKISexp::class, SchemaViolationException::class);
Assert::nullOrIsInstanceOf($other, SerializableElementInterface::class, SchemaViolationException::class);
Assert::isInstanceOf($tuple[0], SPKISexp::class, SchemaViolationException::class);
Assert::nullOrIsInstanceOf($tuple[1], SerializableElementInterface::class, SchemaViolationException::class);
}
}


/**
* Collect the value of the SPKISexp-property
*
* @return array<\SimpleSAML\XMLSecurity\XML\ds\SPKISexp, \SimpleSAML\XML\SerializableElementInterface|null>
* @return array{array{\SimpleSAML\XMLSecurity\XML\ds\SPKISexp, \SimpleSAML\XML\SerializableElementInterface|null}}
*/
public function getTuples(): array
{
Expand Down Expand Up @@ -102,10 +101,8 @@ public function toXML(?DOMElement $parent = null): DOMElement
$e = $this->instantiateParentElement($parent);

foreach ($this->getTuples() as $tuple) {
list($spkisExp, $other) = $tuple;

$spkisExp->toXML($e);
$other?->toXML($e);
$tuple[0]->toXML($e);
$tuple[1]?->toXML($e);
}

return $e;
Expand Down

0 comments on commit 0ee940f

Please sign in to comment.