Debian Codegraph @

lib/3rdParty/composer/spomky-labs/pki-framework/src/X501/ASN1/Collection/SequenceOfAttributes.php

raw symbols SCIP
1 <?php
2
3 declare(strict_types=1);
4
5 namespace SpomkyLabs\Pki\X501\ASN1\Collection;
6
7 use SpomkyLabs\Pki\ASN1\Type\Constructed\Sequence;
8 use SpomkyLabs\Pki\X501\ASN1\Attribute;
9 use SpomkyLabs\Pki\X501\ASN1\AttributeValue\AttributeValue;
10
11 /**
12 * Implements *Attributes* ASN.1 type as a *SEQUENCE OF Attribute*.
13 *
14 * Used in *AttributeCertificateInfo*.
15 *
16 * @see https://tools.ietf.org/html/rfc5755#section-4.1
17 * @see https://tools.ietf.org/html/rfc5755#section-4.2.7
18 */
19 class SequenceOfAttributes extends AttributeCollection
20 {
21 /**
22 * Initialize from ASN.1.
23 */
24 public static function fromASN1(Sequence $seq): self
25 {
26 return static::_fromASN1Structure($seq);
27 }
28
29 /**
30 * Initialize from attribute values.
31 *
32 * @param AttributeValue ...$values List of attribute values
33 */
34 public static function fromAttributeValues(AttributeValue ...$values): static
35 {
36 return static::create(...array_map(static fn (AttributeValue $value) => $value->toAttribute(), $values));
37 }
38
39 /**
40 * Generate ASN.1 structure.
41 */
42 public function toASN1(): Sequence
43 {
44 return Sequence::create(...array_map(static fn (Attribute $attr) => $attr->toASN1(), $this->_attributes));
45 }
46 }