@@ -16,59 +16,59 @@ |
||
| 16 | 16 | */ |
| 17 | 17 | class RFC822Name extends GeneralName |
| 18 | 18 | { |
| 19 | - /** |
|
| 20 | - * Email. |
|
| 21 | - * |
|
| 22 | - * @var string $_email |
|
| 23 | - */ |
|
| 24 | - protected $_email; |
|
| 19 | + /** |
|
| 20 | + * Email. |
|
| 21 | + * |
|
| 22 | + * @var string $_email |
|
| 23 | + */ |
|
| 24 | + protected $_email; |
|
| 25 | 25 | |
| 26 | - /** |
|
| 27 | - * Constructor. |
|
| 28 | - * |
|
| 29 | - * @param string $email |
|
| 30 | - */ |
|
| 31 | - public function __construct(string $email) |
|
| 32 | - { |
|
| 33 | - $this->_tag = self::TAG_RFC822_NAME; |
|
| 34 | - $this->_email = $email; |
|
| 35 | - } |
|
| 26 | + /** |
|
| 27 | + * Constructor. |
|
| 28 | + * |
|
| 29 | + * @param string $email |
|
| 30 | + */ |
|
| 31 | + public function __construct(string $email) |
|
| 32 | + { |
|
| 33 | + $this->_tag = self::TAG_RFC822_NAME; |
|
| 34 | + $this->_email = $email; |
|
| 35 | + } |
|
| 36 | 36 | |
| 37 | - /** |
|
| 38 | - * |
|
| 39 | - * @param UnspecifiedType $el |
|
| 40 | - * @return self |
|
| 41 | - */ |
|
| 42 | - public static function fromChosenASN1(UnspecifiedType $el): self |
|
| 43 | - { |
|
| 44 | - return new self($el->asIA5String()->string()); |
|
| 45 | - } |
|
| 37 | + /** |
|
| 38 | + * |
|
| 39 | + * @param UnspecifiedType $el |
|
| 40 | + * @return self |
|
| 41 | + */ |
|
| 42 | + public static function fromChosenASN1(UnspecifiedType $el): self |
|
| 43 | + { |
|
| 44 | + return new self($el->asIA5String()->string()); |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | - /** |
|
| 48 | - * |
|
| 49 | - * {@inheritdoc} |
|
| 50 | - */ |
|
| 51 | - public function string(): string |
|
| 52 | - { |
|
| 53 | - return $this->_email; |
|
| 54 | - } |
|
| 47 | + /** |
|
| 48 | + * |
|
| 49 | + * {@inheritdoc} |
|
| 50 | + */ |
|
| 51 | + public function string(): string |
|
| 52 | + { |
|
| 53 | + return $this->_email; |
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | - /** |
|
| 57 | - * Get email. |
|
| 58 | - * |
|
| 59 | - * @return string |
|
| 60 | - */ |
|
| 61 | - public function email(): string |
|
| 62 | - { |
|
| 63 | - return $this->_email; |
|
| 64 | - } |
|
| 56 | + /** |
|
| 57 | + * Get email. |
|
| 58 | + * |
|
| 59 | + * @return string |
|
| 60 | + */ |
|
| 61 | + public function email(): string |
|
| 62 | + { |
|
| 63 | + return $this->_email; |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | - /** |
|
| 67 | - * |
|
| 68 | - * {@inheritdoc} |
|
| 69 | - */ |
|
| 70 | - protected function _choiceASN1(): TaggedType |
|
| 71 | - { |
|
| 72 | - return new ImplicitlyTaggedType($this->_tag, new IA5String($this->_email)); |
|
| 73 | - } |
|
| 66 | + /** |
|
| 67 | + * |
|
| 68 | + * {@inheritdoc} |
|
| 69 | + */ |
|
| 70 | + protected function _choiceASN1(): TaggedType |
|
| 71 | + { |
|
| 72 | + return new ImplicitlyTaggedType($this->_tag, new IA5String($this->_email)); |
|
| 73 | + } |
|
| 74 | 74 | } |
@@ -18,47 +18,47 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | class EDIPartyName extends GeneralName |
| 20 | 20 | { |
| 21 | - /** |
|
| 22 | - * |
|
| 23 | - * @var \ASN1\Element |
|
| 24 | - */ |
|
| 25 | - protected $_element; |
|
| 21 | + /** |
|
| 22 | + * |
|
| 23 | + * @var \ASN1\Element |
|
| 24 | + */ |
|
| 25 | + protected $_element; |
|
| 26 | 26 | |
| 27 | - /** |
|
| 28 | - * Constructor. |
|
| 29 | - */ |
|
| 30 | - protected function __construct() |
|
| 31 | - { |
|
| 32 | - $this->_tag = self::TAG_EDI_PARTY_NAME; |
|
| 33 | - } |
|
| 27 | + /** |
|
| 28 | + * Constructor. |
|
| 29 | + */ |
|
| 30 | + protected function __construct() |
|
| 31 | + { |
|
| 32 | + $this->_tag = self::TAG_EDI_PARTY_NAME; |
|
| 33 | + } |
|
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * |
|
| 37 | - * @param UnspecifiedType $el |
|
| 38 | - * @return self |
|
| 39 | - */ |
|
| 40 | - public static function fromChosenASN1(UnspecifiedType $el): self |
|
| 41 | - { |
|
| 42 | - $obj = new self(); |
|
| 43 | - $obj->_element = $el->asSequence(); |
|
| 44 | - return $obj; |
|
| 45 | - } |
|
| 35 | + /** |
|
| 36 | + * |
|
| 37 | + * @param UnspecifiedType $el |
|
| 38 | + * @return self |
|
| 39 | + */ |
|
| 40 | + public static function fromChosenASN1(UnspecifiedType $el): self |
|
| 41 | + { |
|
| 42 | + $obj = new self(); |
|
| 43 | + $obj->_element = $el->asSequence(); |
|
| 44 | + return $obj; |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | - /** |
|
| 48 | - * |
|
| 49 | - * {@inheritdoc} |
|
| 50 | - */ |
|
| 51 | - public function string(): string |
|
| 52 | - { |
|
| 53 | - return bin2hex($this->_element->toDER()); |
|
| 54 | - } |
|
| 47 | + /** |
|
| 48 | + * |
|
| 49 | + * {@inheritdoc} |
|
| 50 | + */ |
|
| 51 | + public function string(): string |
|
| 52 | + { |
|
| 53 | + return bin2hex($this->_element->toDER()); |
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | - /** |
|
| 57 | - * |
|
| 58 | - * {@inheritdoc} |
|
| 59 | - */ |
|
| 60 | - protected function _choiceASN1(): TaggedType |
|
| 61 | - { |
|
| 62 | - return new ImplicitlyTaggedType($this->_tag, $this->_element); |
|
| 63 | - } |
|
| 56 | + /** |
|
| 57 | + * |
|
| 58 | + * {@inheritdoc} |
|
| 59 | + */ |
|
| 60 | + protected function _choiceASN1(): TaggedType |
|
| 61 | + { |
|
| 62 | + return new ImplicitlyTaggedType($this->_tag, $this->_element); |
|
| 63 | + } |
|
| 64 | 64 | } |
@@ -18,183 +18,183 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | class GeneralNames implements \Countable, \IteratorAggregate |
| 20 | 20 | { |
| 21 | - /** |
|
| 22 | - * GeneralName objects. |
|
| 23 | - * |
|
| 24 | - * @var GeneralName[] $_names |
|
| 25 | - */ |
|
| 26 | - protected $_names; |
|
| 21 | + /** |
|
| 22 | + * GeneralName objects. |
|
| 23 | + * |
|
| 24 | + * @var GeneralName[] $_names |
|
| 25 | + */ |
|
| 26 | + protected $_names; |
|
| 27 | 27 | |
| 28 | - /** |
|
| 29 | - * Constructor. |
|
| 30 | - * |
|
| 31 | - * @param GeneralName ...$names One or more GeneralName objects |
|
| 32 | - */ |
|
| 33 | - public function __construct(GeneralName ...$names) |
|
| 34 | - { |
|
| 35 | - $this->_names = $names; |
|
| 36 | - } |
|
| 28 | + /** |
|
| 29 | + * Constructor. |
|
| 30 | + * |
|
| 31 | + * @param GeneralName ...$names One or more GeneralName objects |
|
| 32 | + */ |
|
| 33 | + public function __construct(GeneralName ...$names) |
|
| 34 | + { |
|
| 35 | + $this->_names = $names; |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * Initialize from ASN.1. |
|
| 40 | - * |
|
| 41 | - * @param Sequence $seq |
|
| 42 | - * @throws \UnexpectedValueException |
|
| 43 | - * @return self |
|
| 44 | - */ |
|
| 45 | - public static function fromASN1(Sequence $seq): self |
|
| 46 | - { |
|
| 47 | - if (!count($seq)) { |
|
| 48 | - throw new \UnexpectedValueException( |
|
| 49 | - "GeneralNames must have at least one GeneralName."); |
|
| 50 | - } |
|
| 51 | - $names = array_map( |
|
| 52 | - function (UnspecifiedType $el) { |
|
| 53 | - return GeneralName::fromASN1($el->asTagged()); |
|
| 54 | - }, $seq->elements()); |
|
| 55 | - return new self(...$names); |
|
| 56 | - } |
|
| 38 | + /** |
|
| 39 | + * Initialize from ASN.1. |
|
| 40 | + * |
|
| 41 | + * @param Sequence $seq |
|
| 42 | + * @throws \UnexpectedValueException |
|
| 43 | + * @return self |
|
| 44 | + */ |
|
| 45 | + public static function fromASN1(Sequence $seq): self |
|
| 46 | + { |
|
| 47 | + if (!count($seq)) { |
|
| 48 | + throw new \UnexpectedValueException( |
|
| 49 | + "GeneralNames must have at least one GeneralName."); |
|
| 50 | + } |
|
| 51 | + $names = array_map( |
|
| 52 | + function (UnspecifiedType $el) { |
|
| 53 | + return GeneralName::fromASN1($el->asTagged()); |
|
| 54 | + }, $seq->elements()); |
|
| 55 | + return new self(...$names); |
|
| 56 | + } |
|
| 57 | 57 | |
| 58 | - /** |
|
| 59 | - * Find first GeneralName by given tag. |
|
| 60 | - * |
|
| 61 | - * @param int $tag |
|
| 62 | - * @return GeneralName|null |
|
| 63 | - */ |
|
| 64 | - protected function _findFirst(int $tag) |
|
| 65 | - { |
|
| 66 | - foreach ($this->_names as $name) { |
|
| 67 | - if ($name->tag() == $tag) { |
|
| 68 | - return $name; |
|
| 69 | - } |
|
| 70 | - } |
|
| 71 | - return null; |
|
| 72 | - } |
|
| 58 | + /** |
|
| 59 | + * Find first GeneralName by given tag. |
|
| 60 | + * |
|
| 61 | + * @param int $tag |
|
| 62 | + * @return GeneralName|null |
|
| 63 | + */ |
|
| 64 | + protected function _findFirst(int $tag) |
|
| 65 | + { |
|
| 66 | + foreach ($this->_names as $name) { |
|
| 67 | + if ($name->tag() == $tag) { |
|
| 68 | + return $name; |
|
| 69 | + } |
|
| 70 | + } |
|
| 71 | + return null; |
|
| 72 | + } |
|
| 73 | 73 | |
| 74 | - /** |
|
| 75 | - * Check whether GeneralNames contains a GeneralName of given type. |
|
| 76 | - * |
|
| 77 | - * @param int $tag One of <code>GeneralName::TAG_*</code> enumerations |
|
| 78 | - * @return bool |
|
| 79 | - */ |
|
| 80 | - public function has(int $tag): bool |
|
| 81 | - { |
|
| 82 | - return null !== $this->_findFirst($tag); |
|
| 83 | - } |
|
| 74 | + /** |
|
| 75 | + * Check whether GeneralNames contains a GeneralName of given type. |
|
| 76 | + * |
|
| 77 | + * @param int $tag One of <code>GeneralName::TAG_*</code> enumerations |
|
| 78 | + * @return bool |
|
| 79 | + */ |
|
| 80 | + public function has(int $tag): bool |
|
| 81 | + { |
|
| 82 | + return null !== $this->_findFirst($tag); |
|
| 83 | + } |
|
| 84 | 84 | |
| 85 | - /** |
|
| 86 | - * Get first GeneralName of given type. |
|
| 87 | - * |
|
| 88 | - * @param int $tag One of <code>GeneralName::TAG_*</code> enumerations |
|
| 89 | - * @throws \OutOfBoundsException |
|
| 90 | - * @return GeneralName |
|
| 91 | - */ |
|
| 92 | - public function firstOf(int $tag): GeneralName |
|
| 93 | - { |
|
| 94 | - $name = $this->_findFirst($tag); |
|
| 95 | - if (!$name) { |
|
| 96 | - throw new \UnexpectedValueException("No GeneralName by tag $tag."); |
|
| 97 | - } |
|
| 98 | - return $name; |
|
| 99 | - } |
|
| 85 | + /** |
|
| 86 | + * Get first GeneralName of given type. |
|
| 87 | + * |
|
| 88 | + * @param int $tag One of <code>GeneralName::TAG_*</code> enumerations |
|
| 89 | + * @throws \OutOfBoundsException |
|
| 90 | + * @return GeneralName |
|
| 91 | + */ |
|
| 92 | + public function firstOf(int $tag): GeneralName |
|
| 93 | + { |
|
| 94 | + $name = $this->_findFirst($tag); |
|
| 95 | + if (!$name) { |
|
| 96 | + throw new \UnexpectedValueException("No GeneralName by tag $tag."); |
|
| 97 | + } |
|
| 98 | + return $name; |
|
| 99 | + } |
|
| 100 | 100 | |
| 101 | - /** |
|
| 102 | - * Get all GeneralName objects of given type. |
|
| 103 | - * |
|
| 104 | - * @param int $tag One of <code>GeneralName::TAG_*</code> enumerations |
|
| 105 | - * @return GeneralName[] |
|
| 106 | - */ |
|
| 107 | - public function allOf(int $tag): array |
|
| 108 | - { |
|
| 109 | - $names = array_filter($this->_names, |
|
| 110 | - function (GeneralName $name) use ($tag) { |
|
| 111 | - return $name->tag() == $tag; |
|
| 112 | - }); |
|
| 113 | - return array_values($names); |
|
| 114 | - } |
|
| 101 | + /** |
|
| 102 | + * Get all GeneralName objects of given type. |
|
| 103 | + * |
|
| 104 | + * @param int $tag One of <code>GeneralName::TAG_*</code> enumerations |
|
| 105 | + * @return GeneralName[] |
|
| 106 | + */ |
|
| 107 | + public function allOf(int $tag): array |
|
| 108 | + { |
|
| 109 | + $names = array_filter($this->_names, |
|
| 110 | + function (GeneralName $name) use ($tag) { |
|
| 111 | + return $name->tag() == $tag; |
|
| 112 | + }); |
|
| 113 | + return array_values($names); |
|
| 114 | + } |
|
| 115 | 115 | |
| 116 | - /** |
|
| 117 | - * Get value of the first 'dNSName' type. |
|
| 118 | - * |
|
| 119 | - * @return string |
|
| 120 | - */ |
|
| 121 | - public function firstDNS(): string |
|
| 122 | - { |
|
| 123 | - $gn = $this->firstOf(GeneralName::TAG_DNS_NAME); |
|
| 124 | - if (!$gn instanceof DNSName) { |
|
| 125 | - throw new \RuntimeException( |
|
| 126 | - DNSName::class . " expected, got " . get_class($gn)); |
|
| 127 | - } |
|
| 128 | - return $gn->name(); |
|
| 129 | - } |
|
| 116 | + /** |
|
| 117 | + * Get value of the first 'dNSName' type. |
|
| 118 | + * |
|
| 119 | + * @return string |
|
| 120 | + */ |
|
| 121 | + public function firstDNS(): string |
|
| 122 | + { |
|
| 123 | + $gn = $this->firstOf(GeneralName::TAG_DNS_NAME); |
|
| 124 | + if (!$gn instanceof DNSName) { |
|
| 125 | + throw new \RuntimeException( |
|
| 126 | + DNSName::class . " expected, got " . get_class($gn)); |
|
| 127 | + } |
|
| 128 | + return $gn->name(); |
|
| 129 | + } |
|
| 130 | 130 | |
| 131 | - /** |
|
| 132 | - * Get value of the first 'directoryName' type. |
|
| 133 | - * |
|
| 134 | - * @return Name |
|
| 135 | - */ |
|
| 136 | - public function firstDN(): Name |
|
| 137 | - { |
|
| 138 | - $gn = $this->firstOf(GeneralName::TAG_DIRECTORY_NAME); |
|
| 139 | - if (!$gn instanceof DirectoryName) { |
|
| 140 | - throw new \RuntimeException( |
|
| 141 | - DirectoryName::class . " expected, got " . get_class($gn)); |
|
| 142 | - } |
|
| 143 | - return $gn->dn(); |
|
| 144 | - } |
|
| 131 | + /** |
|
| 132 | + * Get value of the first 'directoryName' type. |
|
| 133 | + * |
|
| 134 | + * @return Name |
|
| 135 | + */ |
|
| 136 | + public function firstDN(): Name |
|
| 137 | + { |
|
| 138 | + $gn = $this->firstOf(GeneralName::TAG_DIRECTORY_NAME); |
|
| 139 | + if (!$gn instanceof DirectoryName) { |
|
| 140 | + throw new \RuntimeException( |
|
| 141 | + DirectoryName::class . " expected, got " . get_class($gn)); |
|
| 142 | + } |
|
| 143 | + return $gn->dn(); |
|
| 144 | + } |
|
| 145 | 145 | |
| 146 | - /** |
|
| 147 | - * Get value of the first 'uniformResourceIdentifier' type. |
|
| 148 | - * |
|
| 149 | - * @return string |
|
| 150 | - */ |
|
| 151 | - public function firstURI(): string |
|
| 152 | - { |
|
| 153 | - $gn = $this->firstOf(GeneralName::TAG_URI); |
|
| 154 | - if (!$gn instanceof UniformResourceIdentifier) { |
|
| 155 | - throw new \RuntimeException( |
|
| 156 | - UniformResourceIdentifier::class . " expected, got " . |
|
| 157 | - get_class($gn)); |
|
| 158 | - } |
|
| 159 | - return $gn->uri(); |
|
| 160 | - } |
|
| 146 | + /** |
|
| 147 | + * Get value of the first 'uniformResourceIdentifier' type. |
|
| 148 | + * |
|
| 149 | + * @return string |
|
| 150 | + */ |
|
| 151 | + public function firstURI(): string |
|
| 152 | + { |
|
| 153 | + $gn = $this->firstOf(GeneralName::TAG_URI); |
|
| 154 | + if (!$gn instanceof UniformResourceIdentifier) { |
|
| 155 | + throw new \RuntimeException( |
|
| 156 | + UniformResourceIdentifier::class . " expected, got " . |
|
| 157 | + get_class($gn)); |
|
| 158 | + } |
|
| 159 | + return $gn->uri(); |
|
| 160 | + } |
|
| 161 | 161 | |
| 162 | - /** |
|
| 163 | - * Generate ASN.1 structure. |
|
| 164 | - * |
|
| 165 | - * @return Sequence |
|
| 166 | - */ |
|
| 167 | - public function toASN1(): Sequence |
|
| 168 | - { |
|
| 169 | - if (!count($this->_names)) { |
|
| 170 | - throw new \LogicException( |
|
| 171 | - "GeneralNames must have at least one GeneralName."); |
|
| 172 | - } |
|
| 173 | - $elements = array_map( |
|
| 174 | - function (GeneralName $name) { |
|
| 175 | - return $name->toASN1(); |
|
| 176 | - }, $this->_names); |
|
| 177 | - return new Sequence(...$elements); |
|
| 178 | - } |
|
| 162 | + /** |
|
| 163 | + * Generate ASN.1 structure. |
|
| 164 | + * |
|
| 165 | + * @return Sequence |
|
| 166 | + */ |
|
| 167 | + public function toASN1(): Sequence |
|
| 168 | + { |
|
| 169 | + if (!count($this->_names)) { |
|
| 170 | + throw new \LogicException( |
|
| 171 | + "GeneralNames must have at least one GeneralName."); |
|
| 172 | + } |
|
| 173 | + $elements = array_map( |
|
| 174 | + function (GeneralName $name) { |
|
| 175 | + return $name->toASN1(); |
|
| 176 | + }, $this->_names); |
|
| 177 | + return new Sequence(...$elements); |
|
| 178 | + } |
|
| 179 | 179 | |
| 180 | - /** |
|
| 181 | - * |
|
| 182 | - * @see \Countable::count() |
|
| 183 | - * @return int |
|
| 184 | - */ |
|
| 185 | - public function count(): int |
|
| 186 | - { |
|
| 187 | - return count($this->_names); |
|
| 188 | - } |
|
| 180 | + /** |
|
| 181 | + * |
|
| 182 | + * @see \Countable::count() |
|
| 183 | + * @return int |
|
| 184 | + */ |
|
| 185 | + public function count(): int |
|
| 186 | + { |
|
| 187 | + return count($this->_names); |
|
| 188 | + } |
|
| 189 | 189 | |
| 190 | - /** |
|
| 191 | - * Get iterator for GeneralName objects. |
|
| 192 | - * |
|
| 193 | - * @see \IteratorAggregate::getIterator() |
|
| 194 | - * @return \ArrayIterator |
|
| 195 | - */ |
|
| 196 | - public function getIterator(): \ArrayIterator |
|
| 197 | - { |
|
| 198 | - return new \ArrayIterator($this->_names); |
|
| 199 | - } |
|
| 190 | + /** |
|
| 191 | + * Get iterator for GeneralName objects. |
|
| 192 | + * |
|
| 193 | + * @see \IteratorAggregate::getIterator() |
|
| 194 | + * @return \ArrayIterator |
|
| 195 | + */ |
|
| 196 | + public function getIterator(): \ArrayIterator |
|
| 197 | + { |
|
| 198 | + return new \ArrayIterator($this->_names); |
|
| 199 | + } |
|
| 200 | 200 | } |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | "GeneralNames must have at least one GeneralName."); |
| 50 | 50 | } |
| 51 | 51 | $names = array_map( |
| 52 | - function (UnspecifiedType $el) { |
|
| 52 | + function(UnspecifiedType $el) { |
|
| 53 | 53 | return GeneralName::fromASN1($el->asTagged()); |
| 54 | 54 | }, $seq->elements()); |
| 55 | 55 | return new self(...$names); |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | public function allOf(int $tag): array |
| 108 | 108 | { |
| 109 | 109 | $names = array_filter($this->_names, |
| 110 | - function (GeneralName $name) use ($tag) { |
|
| 110 | + function(GeneralName $name) use ($tag) { |
|
| 111 | 111 | return $name->tag() == $tag; |
| 112 | 112 | }); |
| 113 | 113 | return array_values($names); |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | "GeneralNames must have at least one GeneralName."); |
| 172 | 172 | } |
| 173 | 173 | $elements = array_map( |
| 174 | - function (GeneralName $name) { |
|
| 174 | + function(GeneralName $name) { |
|
| 175 | 175 | return $name->toASN1(); |
| 176 | 176 | }, $this->_names); |
| 177 | 177 | return new Sequence(...$elements); |
@@ -19,87 +19,87 @@ |
||
| 19 | 19 | */ |
| 20 | 20 | class OtherName extends GeneralName |
| 21 | 21 | { |
| 22 | - /** |
|
| 23 | - * Type OID. |
|
| 24 | - * |
|
| 25 | - * @var string $_type |
|
| 26 | - */ |
|
| 27 | - protected $_type; |
|
| 22 | + /** |
|
| 23 | + * Type OID. |
|
| 24 | + * |
|
| 25 | + * @var string $_type |
|
| 26 | + */ |
|
| 27 | + protected $_type; |
|
| 28 | 28 | |
| 29 | - /** |
|
| 30 | - * Value. |
|
| 31 | - * |
|
| 32 | - * @var Element $_element |
|
| 33 | - */ |
|
| 34 | - protected $_element; |
|
| 29 | + /** |
|
| 30 | + * Value. |
|
| 31 | + * |
|
| 32 | + * @var Element $_element |
|
| 33 | + */ |
|
| 34 | + protected $_element; |
|
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * Constructor. |
|
| 38 | - * |
|
| 39 | - * @param string $type_id OID |
|
| 40 | - * @param Element $el |
|
| 41 | - */ |
|
| 42 | - public function __construct(string $type_id, Element $el) |
|
| 43 | - { |
|
| 44 | - $this->_tag = self::TAG_OTHER_NAME; |
|
| 45 | - $this->_type = $type_id; |
|
| 46 | - $this->_element = $el; |
|
| 47 | - } |
|
| 36 | + /** |
|
| 37 | + * Constructor. |
|
| 38 | + * |
|
| 39 | + * @param string $type_id OID |
|
| 40 | + * @param Element $el |
|
| 41 | + */ |
|
| 42 | + public function __construct(string $type_id, Element $el) |
|
| 43 | + { |
|
| 44 | + $this->_tag = self::TAG_OTHER_NAME; |
|
| 45 | + $this->_type = $type_id; |
|
| 46 | + $this->_element = $el; |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | - /** |
|
| 50 | - * |
|
| 51 | - * @param UnspecifiedType $el |
|
| 52 | - * @return self |
|
| 53 | - */ |
|
| 54 | - public static function fromChosenASN1(UnspecifiedType $el): self |
|
| 55 | - { |
|
| 56 | - $seq = $el->asSequence(); |
|
| 57 | - $type_id = $seq->at(0) |
|
| 58 | - ->asObjectIdentifier() |
|
| 59 | - ->oid(); |
|
| 60 | - $value = $seq->getTagged(0) |
|
| 61 | - ->asExplicit() |
|
| 62 | - ->asElement(); |
|
| 63 | - return new self($type_id, $value); |
|
| 64 | - } |
|
| 49 | + /** |
|
| 50 | + * |
|
| 51 | + * @param UnspecifiedType $el |
|
| 52 | + * @return self |
|
| 53 | + */ |
|
| 54 | + public static function fromChosenASN1(UnspecifiedType $el): self |
|
| 55 | + { |
|
| 56 | + $seq = $el->asSequence(); |
|
| 57 | + $type_id = $seq->at(0) |
|
| 58 | + ->asObjectIdentifier() |
|
| 59 | + ->oid(); |
|
| 60 | + $value = $seq->getTagged(0) |
|
| 61 | + ->asExplicit() |
|
| 62 | + ->asElement(); |
|
| 63 | + return new self($type_id, $value); |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | - /** |
|
| 67 | - * |
|
| 68 | - * {@inheritdoc} |
|
| 69 | - */ |
|
| 70 | - public function string(): string |
|
| 71 | - { |
|
| 72 | - return $this->_type . "/#" . bin2hex($this->_element->toDER()); |
|
| 73 | - } |
|
| 66 | + /** |
|
| 67 | + * |
|
| 68 | + * {@inheritdoc} |
|
| 69 | + */ |
|
| 70 | + public function string(): string |
|
| 71 | + { |
|
| 72 | + return $this->_type . "/#" . bin2hex($this->_element->toDER()); |
|
| 73 | + } |
|
| 74 | 74 | |
| 75 | - /** |
|
| 76 | - * Get type OID. |
|
| 77 | - * |
|
| 78 | - * @return string |
|
| 79 | - */ |
|
| 80 | - public function type(): string |
|
| 81 | - { |
|
| 82 | - return $this->_type; |
|
| 83 | - } |
|
| 75 | + /** |
|
| 76 | + * Get type OID. |
|
| 77 | + * |
|
| 78 | + * @return string |
|
| 79 | + */ |
|
| 80 | + public function type(): string |
|
| 81 | + { |
|
| 82 | + return $this->_type; |
|
| 83 | + } |
|
| 84 | 84 | |
| 85 | - /** |
|
| 86 | - * Get value element. |
|
| 87 | - * |
|
| 88 | - * @return Element |
|
| 89 | - */ |
|
| 90 | - public function value(): Element |
|
| 91 | - { |
|
| 92 | - return $this->_element; |
|
| 93 | - } |
|
| 85 | + /** |
|
| 86 | + * Get value element. |
|
| 87 | + * |
|
| 88 | + * @return Element |
|
| 89 | + */ |
|
| 90 | + public function value(): Element |
|
| 91 | + { |
|
| 92 | + return $this->_element; |
|
| 93 | + } |
|
| 94 | 94 | |
| 95 | - /** |
|
| 96 | - * |
|
| 97 | - * {@inheritdoc} |
|
| 98 | - */ |
|
| 99 | - protected function _choiceASN1(): TaggedType |
|
| 100 | - { |
|
| 101 | - return new ImplicitlyTaggedType($this->_tag, |
|
| 102 | - new Sequence(new ObjectIdentifier($this->_type), |
|
| 103 | - new ExplicitlyTaggedType(0, $this->_element))); |
|
| 104 | - } |
|
| 95 | + /** |
|
| 96 | + * |
|
| 97 | + * {@inheritdoc} |
|
| 98 | + */ |
|
| 99 | + protected function _choiceASN1(): TaggedType |
|
| 100 | + { |
|
| 101 | + return new ImplicitlyTaggedType($this->_tag, |
|
| 102 | + new Sequence(new ObjectIdentifier($this->_type), |
|
| 103 | + new ExplicitlyTaggedType(0, $this->_element))); |
|
| 104 | + } |
|
| 105 | 105 | } |
@@ -17,59 +17,59 @@ |
||
| 17 | 17 | */ |
| 18 | 18 | class UniformResourceIdentifier extends GeneralName |
| 19 | 19 | { |
| 20 | - /** |
|
| 21 | - * URI. |
|
| 22 | - * |
|
| 23 | - * @var string $_uri |
|
| 24 | - */ |
|
| 25 | - protected $_uri; |
|
| 20 | + /** |
|
| 21 | + * URI. |
|
| 22 | + * |
|
| 23 | + * @var string $_uri |
|
| 24 | + */ |
|
| 25 | + protected $_uri; |
|
| 26 | 26 | |
| 27 | - /** |
|
| 28 | - * Constructor. |
|
| 29 | - * |
|
| 30 | - * @param string $uri |
|
| 31 | - */ |
|
| 32 | - public function __construct(string $uri) |
|
| 33 | - { |
|
| 34 | - $this->_tag = self::TAG_URI; |
|
| 35 | - $this->_uri = $uri; |
|
| 36 | - } |
|
| 27 | + /** |
|
| 28 | + * Constructor. |
|
| 29 | + * |
|
| 30 | + * @param string $uri |
|
| 31 | + */ |
|
| 32 | + public function __construct(string $uri) |
|
| 33 | + { |
|
| 34 | + $this->_tag = self::TAG_URI; |
|
| 35 | + $this->_uri = $uri; |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * |
|
| 40 | - * @param UnspecifiedType $el |
|
| 41 | - * @return self |
|
| 42 | - */ |
|
| 43 | - public static function fromChosenASN1(UnspecifiedType $el): self |
|
| 44 | - { |
|
| 45 | - return new self($el->asIA5String()->string()); |
|
| 46 | - } |
|
| 38 | + /** |
|
| 39 | + * |
|
| 40 | + * @param UnspecifiedType $el |
|
| 41 | + * @return self |
|
| 42 | + */ |
|
| 43 | + public static function fromChosenASN1(UnspecifiedType $el): self |
|
| 44 | + { |
|
| 45 | + return new self($el->asIA5String()->string()); |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | - /** |
|
| 49 | - * |
|
| 50 | - * {@inheritdoc} |
|
| 51 | - */ |
|
| 52 | - public function string(): string |
|
| 53 | - { |
|
| 54 | - return $this->_uri; |
|
| 55 | - } |
|
| 48 | + /** |
|
| 49 | + * |
|
| 50 | + * {@inheritdoc} |
|
| 51 | + */ |
|
| 52 | + public function string(): string |
|
| 53 | + { |
|
| 54 | + return $this->_uri; |
|
| 55 | + } |
|
| 56 | 56 | |
| 57 | - /** |
|
| 58 | - * Get URI. |
|
| 59 | - * |
|
| 60 | - * @return string |
|
| 61 | - */ |
|
| 62 | - public function uri(): string |
|
| 63 | - { |
|
| 64 | - return $this->_uri; |
|
| 65 | - } |
|
| 57 | + /** |
|
| 58 | + * Get URI. |
|
| 59 | + * |
|
| 60 | + * @return string |
|
| 61 | + */ |
|
| 62 | + public function uri(): string |
|
| 63 | + { |
|
| 64 | + return $this->_uri; |
|
| 65 | + } |
|
| 66 | 66 | |
| 67 | - /** |
|
| 68 | - * |
|
| 69 | - * {@inheritdoc} |
|
| 70 | - */ |
|
| 71 | - protected function _choiceASN1(): TaggedType |
|
| 72 | - { |
|
| 73 | - return new ImplicitlyTaggedType($this->_tag, new IA5String($this->_uri)); |
|
| 74 | - } |
|
| 67 | + /** |
|
| 68 | + * |
|
| 69 | + * {@inheritdoc} |
|
| 70 | + */ |
|
| 71 | + protected function _choiceASN1(): TaggedType |
|
| 72 | + { |
|
| 73 | + return new ImplicitlyTaggedType($this->_tag, new IA5String($this->_uri)); |
|
| 74 | + } |
|
| 75 | 75 | } |
@@ -16,60 +16,60 @@ |
||
| 16 | 16 | */ |
| 17 | 17 | class RegisteredID extends GeneralName |
| 18 | 18 | { |
| 19 | - /** |
|
| 20 | - * Object identifier. |
|
| 21 | - * |
|
| 22 | - * @var string $_oid |
|
| 23 | - */ |
|
| 24 | - protected $_oid; |
|
| 19 | + /** |
|
| 20 | + * Object identifier. |
|
| 21 | + * |
|
| 22 | + * @var string $_oid |
|
| 23 | + */ |
|
| 24 | + protected $_oid; |
|
| 25 | 25 | |
| 26 | - /** |
|
| 27 | - * Constructor. |
|
| 28 | - * |
|
| 29 | - * @param string $oid OID in dotted format |
|
| 30 | - */ |
|
| 31 | - public function __construct(string $oid) |
|
| 32 | - { |
|
| 33 | - $this->_tag = self::TAG_REGISTERED_ID; |
|
| 34 | - $this->_oid = $oid; |
|
| 35 | - } |
|
| 26 | + /** |
|
| 27 | + * Constructor. |
|
| 28 | + * |
|
| 29 | + * @param string $oid OID in dotted format |
|
| 30 | + */ |
|
| 31 | + public function __construct(string $oid) |
|
| 32 | + { |
|
| 33 | + $this->_tag = self::TAG_REGISTERED_ID; |
|
| 34 | + $this->_oid = $oid; |
|
| 35 | + } |
|
| 36 | 36 | |
| 37 | - /** |
|
| 38 | - * |
|
| 39 | - * @param UnspecifiedType $el |
|
| 40 | - * @return self |
|
| 41 | - */ |
|
| 42 | - public static function fromChosenASN1(UnspecifiedType $el): self |
|
| 43 | - { |
|
| 44 | - return new self($el->asObjectIdentifier()->oid()); |
|
| 45 | - } |
|
| 37 | + /** |
|
| 38 | + * |
|
| 39 | + * @param UnspecifiedType $el |
|
| 40 | + * @return self |
|
| 41 | + */ |
|
| 42 | + public static function fromChosenASN1(UnspecifiedType $el): self |
|
| 43 | + { |
|
| 44 | + return new self($el->asObjectIdentifier()->oid()); |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | - /** |
|
| 48 | - * |
|
| 49 | - * {@inheritdoc} |
|
| 50 | - */ |
|
| 51 | - public function string(): string |
|
| 52 | - { |
|
| 53 | - return $this->_oid; |
|
| 54 | - } |
|
| 47 | + /** |
|
| 48 | + * |
|
| 49 | + * {@inheritdoc} |
|
| 50 | + */ |
|
| 51 | + public function string(): string |
|
| 52 | + { |
|
| 53 | + return $this->_oid; |
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | - /** |
|
| 57 | - * Get object identifier in dotted format. |
|
| 58 | - * |
|
| 59 | - * @return string OID |
|
| 60 | - */ |
|
| 61 | - public function oid(): string |
|
| 62 | - { |
|
| 63 | - return $this->_oid; |
|
| 64 | - } |
|
| 56 | + /** |
|
| 57 | + * Get object identifier in dotted format. |
|
| 58 | + * |
|
| 59 | + * @return string OID |
|
| 60 | + */ |
|
| 61 | + public function oid(): string |
|
| 62 | + { |
|
| 63 | + return $this->_oid; |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | - /** |
|
| 67 | - * |
|
| 68 | - * {@inheritdoc} |
|
| 69 | - */ |
|
| 70 | - protected function _choiceASN1(): TaggedType |
|
| 71 | - { |
|
| 72 | - return new ImplicitlyTaggedType($this->_tag, |
|
| 73 | - new ObjectIdentifier($this->_oid)); |
|
| 74 | - } |
|
| 66 | + /** |
|
| 67 | + * |
|
| 68 | + * {@inheritdoc} |
|
| 69 | + */ |
|
| 70 | + protected function _choiceASN1(): TaggedType |
|
| 71 | + { |
|
| 72 | + return new ImplicitlyTaggedType($this->_tag, |
|
| 73 | + new ObjectIdentifier($this->_oid)); |
|
| 74 | + } |
|
| 75 | 75 | } |
@@ -16,72 +16,72 @@ |
||
| 16 | 16 | */ |
| 17 | 17 | class DirectoryName extends GeneralName |
| 18 | 18 | { |
| 19 | - /** |
|
| 20 | - * Directory name. |
|
| 21 | - * |
|
| 22 | - * @var Name $_dn |
|
| 23 | - */ |
|
| 24 | - protected $_dn; |
|
| 19 | + /** |
|
| 20 | + * Directory name. |
|
| 21 | + * |
|
| 22 | + * @var Name $_dn |
|
| 23 | + */ |
|
| 24 | + protected $_dn; |
|
| 25 | 25 | |
| 26 | - /** |
|
| 27 | - * Constructor. |
|
| 28 | - * |
|
| 29 | - * @param Name $dn |
|
| 30 | - */ |
|
| 31 | - public function __construct(Name $dn) |
|
| 32 | - { |
|
| 33 | - $this->_tag = self::TAG_DIRECTORY_NAME; |
|
| 34 | - $this->_dn = $dn; |
|
| 35 | - } |
|
| 26 | + /** |
|
| 27 | + * Constructor. |
|
| 28 | + * |
|
| 29 | + * @param Name $dn |
|
| 30 | + */ |
|
| 31 | + public function __construct(Name $dn) |
|
| 32 | + { |
|
| 33 | + $this->_tag = self::TAG_DIRECTORY_NAME; |
|
| 34 | + $this->_dn = $dn; |
|
| 35 | + } |
|
| 36 | 36 | |
| 37 | - /** |
|
| 38 | - * |
|
| 39 | - * @param UnspecifiedType $el |
|
| 40 | - * @return self |
|
| 41 | - */ |
|
| 42 | - public static function fromChosenASN1(UnspecifiedType $el): self |
|
| 43 | - { |
|
| 44 | - return new self(Name::fromASN1($el->asSequence())); |
|
| 45 | - } |
|
| 37 | + /** |
|
| 38 | + * |
|
| 39 | + * @param UnspecifiedType $el |
|
| 40 | + * @return self |
|
| 41 | + */ |
|
| 42 | + public static function fromChosenASN1(UnspecifiedType $el): self |
|
| 43 | + { |
|
| 44 | + return new self(Name::fromASN1($el->asSequence())); |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | - /** |
|
| 48 | - * Initialize from distinguished name string. |
|
| 49 | - * |
|
| 50 | - * @param string $str |
|
| 51 | - * @return self |
|
| 52 | - */ |
|
| 53 | - public static function fromDNString(string $str): self |
|
| 54 | - { |
|
| 55 | - return new self(Name::fromString($str)); |
|
| 56 | - } |
|
| 47 | + /** |
|
| 48 | + * Initialize from distinguished name string. |
|
| 49 | + * |
|
| 50 | + * @param string $str |
|
| 51 | + * @return self |
|
| 52 | + */ |
|
| 53 | + public static function fromDNString(string $str): self |
|
| 54 | + { |
|
| 55 | + return new self(Name::fromString($str)); |
|
| 56 | + } |
|
| 57 | 57 | |
| 58 | - /** |
|
| 59 | - * |
|
| 60 | - * {@inheritdoc} |
|
| 61 | - */ |
|
| 62 | - public function string(): string |
|
| 63 | - { |
|
| 64 | - return $this->_dn->toString(); |
|
| 65 | - } |
|
| 58 | + /** |
|
| 59 | + * |
|
| 60 | + * {@inheritdoc} |
|
| 61 | + */ |
|
| 62 | + public function string(): string |
|
| 63 | + { |
|
| 64 | + return $this->_dn->toString(); |
|
| 65 | + } |
|
| 66 | 66 | |
| 67 | - /** |
|
| 68 | - * Get directory name. |
|
| 69 | - * |
|
| 70 | - * @return Name |
|
| 71 | - */ |
|
| 72 | - public function dn(): Name |
|
| 73 | - { |
|
| 74 | - return $this->_dn; |
|
| 75 | - } |
|
| 67 | + /** |
|
| 68 | + * Get directory name. |
|
| 69 | + * |
|
| 70 | + * @return Name |
|
| 71 | + */ |
|
| 72 | + public function dn(): Name |
|
| 73 | + { |
|
| 74 | + return $this->_dn; |
|
| 75 | + } |
|
| 76 | 76 | |
| 77 | - /** |
|
| 78 | - * |
|
| 79 | - * {@inheritdoc} |
|
| 80 | - */ |
|
| 81 | - protected function _choiceASN1(): TaggedType |
|
| 82 | - { |
|
| 83 | - // Name type is itself a CHOICE, so explicit tagging must be |
|
| 84 | - // employed to avoid ambiguities |
|
| 85 | - return new ExplicitlyTaggedType($this->_tag, $this->_dn->toASN1()); |
|
| 86 | - } |
|
| 77 | + /** |
|
| 78 | + * |
|
| 79 | + * {@inheritdoc} |
|
| 80 | + */ |
|
| 81 | + protected function _choiceASN1(): TaggedType |
|
| 82 | + { |
|
| 83 | + // Name type is itself a CHOICE, so explicit tagging must be |
|
| 84 | + // employed to avoid ambiguities |
|
| 85 | + return new ExplicitlyTaggedType($this->_tag, $this->_dn->toASN1()); |
|
| 86 | + } |
|
| 87 | 87 | } |
@@ -16,59 +16,59 @@ |
||
| 16 | 16 | */ |
| 17 | 17 | class DNSName extends GeneralName |
| 18 | 18 | { |
| 19 | - /** |
|
| 20 | - * DNS name. |
|
| 21 | - * |
|
| 22 | - * @var string |
|
| 23 | - */ |
|
| 24 | - protected $_name; |
|
| 19 | + /** |
|
| 20 | + * DNS name. |
|
| 21 | + * |
|
| 22 | + * @var string |
|
| 23 | + */ |
|
| 24 | + protected $_name; |
|
| 25 | 25 | |
| 26 | - /** |
|
| 27 | - * Constructor. |
|
| 28 | - * |
|
| 29 | - * @param string $name Domain name |
|
| 30 | - */ |
|
| 31 | - public function __construct(string $name) |
|
| 32 | - { |
|
| 33 | - $this->_tag = self::TAG_DNS_NAME; |
|
| 34 | - $this->_name = $name; |
|
| 35 | - } |
|
| 26 | + /** |
|
| 27 | + * Constructor. |
|
| 28 | + * |
|
| 29 | + * @param string $name Domain name |
|
| 30 | + */ |
|
| 31 | + public function __construct(string $name) |
|
| 32 | + { |
|
| 33 | + $this->_tag = self::TAG_DNS_NAME; |
|
| 34 | + $this->_name = $name; |
|
| 35 | + } |
|
| 36 | 36 | |
| 37 | - /** |
|
| 38 | - * |
|
| 39 | - * @param UnspecifiedType $el |
|
| 40 | - * @return self |
|
| 41 | - */ |
|
| 42 | - public static function fromChosenASN1(UnspecifiedType $el): self |
|
| 43 | - { |
|
| 44 | - return new self($el->asIA5String()->string()); |
|
| 45 | - } |
|
| 37 | + /** |
|
| 38 | + * |
|
| 39 | + * @param UnspecifiedType $el |
|
| 40 | + * @return self |
|
| 41 | + */ |
|
| 42 | + public static function fromChosenASN1(UnspecifiedType $el): self |
|
| 43 | + { |
|
| 44 | + return new self($el->asIA5String()->string()); |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | - /** |
|
| 48 | - * |
|
| 49 | - * {@inheritdoc} |
|
| 50 | - */ |
|
| 51 | - public function string(): string |
|
| 52 | - { |
|
| 53 | - return $this->_name; |
|
| 54 | - } |
|
| 47 | + /** |
|
| 48 | + * |
|
| 49 | + * {@inheritdoc} |
|
| 50 | + */ |
|
| 51 | + public function string(): string |
|
| 52 | + { |
|
| 53 | + return $this->_name; |
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | - /** |
|
| 57 | - * Get DNS name. |
|
| 58 | - * |
|
| 59 | - * @return string |
|
| 60 | - */ |
|
| 61 | - public function name(): string |
|
| 62 | - { |
|
| 63 | - return $this->_name; |
|
| 64 | - } |
|
| 56 | + /** |
|
| 57 | + * Get DNS name. |
|
| 58 | + * |
|
| 59 | + * @return string |
|
| 60 | + */ |
|
| 61 | + public function name(): string |
|
| 62 | + { |
|
| 63 | + return $this->_name; |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | - /** |
|
| 67 | - * |
|
| 68 | - * {@inheritdoc} |
|
| 69 | - */ |
|
| 70 | - protected function _choiceASN1(): TaggedType |
|
| 71 | - { |
|
| 72 | - return new ImplicitlyTaggedType($this->_tag, new IA5String($this->_name)); |
|
| 73 | - } |
|
| 66 | + /** |
|
| 67 | + * |
|
| 68 | + * {@inheritdoc} |
|
| 69 | + */ |
|
| 70 | + protected function _choiceASN1(): TaggedType |
|
| 71 | + { |
|
| 72 | + return new ImplicitlyTaggedType($this->_tag, new IA5String($this->_name)); |
|
| 73 | + } |
|
| 74 | 74 | } |
@@ -18,47 +18,47 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | class X400Address extends GeneralName |
| 20 | 20 | { |
| 21 | - /** |
|
| 22 | - * |
|
| 23 | - * @var \ASN1\Element |
|
| 24 | - */ |
|
| 25 | - protected $_element; |
|
| 21 | + /** |
|
| 22 | + * |
|
| 23 | + * @var \ASN1\Element |
|
| 24 | + */ |
|
| 25 | + protected $_element; |
|
| 26 | 26 | |
| 27 | - /** |
|
| 28 | - * Constructor. |
|
| 29 | - */ |
|
| 30 | - protected function __construct() |
|
| 31 | - { |
|
| 32 | - $this->_tag = self::TAG_X400_ADDRESS; |
|
| 33 | - } |
|
| 27 | + /** |
|
| 28 | + * Constructor. |
|
| 29 | + */ |
|
| 30 | + protected function __construct() |
|
| 31 | + { |
|
| 32 | + $this->_tag = self::TAG_X400_ADDRESS; |
|
| 33 | + } |
|
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * |
|
| 37 | - * @param UnspecifiedType $el |
|
| 38 | - * @return self |
|
| 39 | - */ |
|
| 40 | - public static function fromChosenASN1(UnspecifiedType $el): self |
|
| 41 | - { |
|
| 42 | - $obj = new self(); |
|
| 43 | - $obj->_element = $el->asSequence(); |
|
| 44 | - return $obj; |
|
| 45 | - } |
|
| 35 | + /** |
|
| 36 | + * |
|
| 37 | + * @param UnspecifiedType $el |
|
| 38 | + * @return self |
|
| 39 | + */ |
|
| 40 | + public static function fromChosenASN1(UnspecifiedType $el): self |
|
| 41 | + { |
|
| 42 | + $obj = new self(); |
|
| 43 | + $obj->_element = $el->asSequence(); |
|
| 44 | + return $obj; |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | - /** |
|
| 48 | - * |
|
| 49 | - * {@inheritdoc} |
|
| 50 | - */ |
|
| 51 | - public function string(): string |
|
| 52 | - { |
|
| 53 | - return bin2hex($this->_element->toDER()); |
|
| 54 | - } |
|
| 47 | + /** |
|
| 48 | + * |
|
| 49 | + * {@inheritdoc} |
|
| 50 | + */ |
|
| 51 | + public function string(): string |
|
| 52 | + { |
|
| 53 | + return bin2hex($this->_element->toDER()); |
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | - /** |
|
| 57 | - * |
|
| 58 | - * {@inheritdoc} |
|
| 59 | - */ |
|
| 60 | - protected function _choiceASN1(): TaggedType |
|
| 61 | - { |
|
| 62 | - return new ImplicitlyTaggedType($this->_tag, $this->_element); |
|
| 63 | - } |
|
| 56 | + /** |
|
| 57 | + * |
|
| 58 | + * {@inheritdoc} |
|
| 59 | + */ |
|
| 60 | + protected function _choiceASN1(): TaggedType |
|
| 61 | + { |
|
| 62 | + return new ImplicitlyTaggedType($this->_tag, $this->_element); |
|
| 63 | + } |
|
| 64 | 64 | } |