<?php
 declare(strict_types=1); namespace SpomkyLabs\Pki\X501\ASN1\Collection; use SpomkyLabs\Pki\ASN1\Type\Constructed\Set; use SpomkyLabs\Pki\X501\ASN1\Attribute; use SpomkyLabs\Pki\X501\ASN1\AttributeValue\AttributeValue; class SetOfAttributes extends AttributeCollection { public static function fromASN1(Set $set): static { return static::_fromASN1Structure($set); } public static function fromAttributeValues(AttributeValue ...$values): static { return static::create(...array_map(static fn (AttributeValue $value) => $value->toAttribute(), $values)); } public function toASN1(): Set { $set = Set::create(...array_map(static fn (Attribute $attr) => $attr->toASN1(), $this->_attributes)); return $set->sortedSetOf(); } } 