1 | <?php |
||
16 | abstract class GeneralName |
||
17 | { |
||
18 | // GeneralName CHOICE tags |
||
19 | const TAG_OTHER_NAME = 0; |
||
20 | const TAG_RFC822_NAME = 1; |
||
21 | const TAG_DNS_NAME = 2; |
||
22 | const TAG_X400_ADDRESS = 3; |
||
23 | const TAG_DIRECTORY_NAME = 4; |
||
24 | const TAG_EDI_PARTY_NAME = 5; |
||
25 | const TAG_URI = 6; |
||
26 | const TAG_IP_ADDRESS = 7; |
||
27 | const TAG_REGISTERED_ID = 8; |
||
28 | |||
29 | /** |
||
30 | * Chosen tag. |
||
31 | * |
||
32 | * @var int $_tag |
||
33 | */ |
||
34 | protected $_tag; |
||
35 | |||
36 | /** |
||
37 | * Get string value of the type. |
||
38 | * |
||
39 | * @return string |
||
40 | */ |
||
41 | abstract public function string(): string; |
||
42 | |||
43 | /** |
||
44 | * Get ASN.1 value in GeneralName CHOICE context. |
||
45 | * |
||
46 | * @return TaggedType |
||
47 | */ |
||
48 | abstract protected function _choiceASN1(): TaggedType; |
||
49 | |||
50 | /** |
||
51 | * Initialize concrete object from the chosen ASN.1 element. |
||
52 | * |
||
53 | * @param UnspecifiedType $el |
||
54 | * @return self |
||
55 | */ |
||
56 | 1 | public static function fromChosenASN1(UnspecifiedType $el) |
|
61 | |||
62 | /** |
||
63 | * Initialize from ASN.1. |
||
64 | * |
||
65 | * @param TaggedType $el |
||
66 | * @throws \UnexpectedValueException |
||
67 | * @return self |
||
68 | */ |
||
69 | 67 | public static function fromASN1(TaggedType $el): self |
|
114 | |||
115 | /** |
||
116 | * Get type tag. |
||
117 | * |
||
118 | * @return int |
||
119 | */ |
||
120 | 58 | public function tag(): int |
|
124 | |||
125 | /** |
||
126 | * Generate ASN.1 element. |
||
127 | * |
||
128 | * @return Element |
||
129 | */ |
||
130 | 89 | public function toASN1(): Element |
|
134 | |||
135 | /** |
||
136 | * Check whether GeneralName is equal to other. |
||
137 | * |
||
138 | * @param GeneralName $other GeneralName to compare to |
||
139 | * @return boolean True if names are equal |
||
140 | */ |
||
141 | 3 | public function equals(GeneralName $other): bool |
|
151 | |||
152 | /** |
||
153 | * Get general name as a string. |
||
154 | * |
||
155 | * @return string |
||
156 | */ |
||
157 | 8 | public function __toString() |
|
161 | } |
||
162 |