| @@ 115-122 (lines=8) @@ | ||
| 112 | * |
|
| 113 | * @return string |
|
| 114 | */ |
|
| 115 | public function firstDNS() { |
|
| 116 | $gn = $this->firstOf(GeneralName::TAG_DNS_NAME); |
|
| 117 | if (!$gn instanceof DNSName) { |
|
| 118 | throw new \RuntimeException( |
|
| 119 | DNSName::class . " expected, got " . get_class($gn)); |
|
| 120 | } |
|
| 121 | return $gn->name(); |
|
| 122 | } |
|
| 123 | ||
| 124 | /** |
|
| 125 | * Get value of the first 'directoryName' type. |
|
| @@ 129-136 (lines=8) @@ | ||
| 126 | * |
|
| 127 | * @return Name |
|
| 128 | */ |
|
| 129 | public function firstDN() { |
|
| 130 | $gn = $this->firstOf(GeneralName::TAG_DIRECTORY_NAME); |
|
| 131 | if (!$gn instanceof DirectoryName) { |
|
| 132 | throw new \RuntimeException( |
|
| 133 | DirectoryName::class . " expected, got " . get_class($gn)); |
|
| 134 | } |
|
| 135 | return $gn->dn(); |
|
| 136 | } |
|
| 137 | ||
| 138 | /** |
|
| 139 | * Get value of the first 'uniformResourceIdentifier' type. |
|
| @@ 143-151 (lines=9) @@ | ||
| 140 | * |
|
| 141 | * @return string |
|
| 142 | */ |
|
| 143 | public function firstURI() { |
|
| 144 | $gn = $this->firstOf(GeneralName::TAG_URI); |
|
| 145 | if (!$gn instanceof UniformResourceIdentifier) { |
|
| 146 | throw new \RuntimeException( |
|
| 147 | UniformResourceIdentifier::class . " expected, got " . |
|
| 148 | get_class($gn)); |
|
| 149 | } |
|
| 150 | return $gn->uri(); |
|
| 151 | } |
|
| 152 | ||
| 153 | /** |
|
| 154 | * Generate ASN.1 structure. |
|