1 | <?php |
||
17 | class PolicyMappingsExtension extends Extension implements |
||
18 | \Countable, |
||
19 | \IteratorAggregate |
||
20 | { |
||
21 | /** |
||
22 | * Policy mappings. |
||
23 | * |
||
24 | * @var PolicyMapping[] $_mappings |
||
25 | */ |
||
26 | protected $_mappings; |
||
27 | |||
28 | /** |
||
29 | * Constructor. |
||
30 | * |
||
31 | * @param bool $critical |
||
32 | * @param PolicyMapping ...$mappings One or more PolicyMapping objects |
||
33 | */ |
||
34 | 5 | public function __construct(bool $critical, PolicyMapping ...$mappings) |
|
39 | |||
40 | /** |
||
41 | * |
||
42 | * {@inheritdoc} |
||
43 | * @return self |
||
44 | */ |
||
45 | 2 | protected static function _fromDER(string $data, bool $critical): self |
|
57 | |||
58 | /** |
||
59 | * |
||
60 | * {@inheritdoc} |
||
61 | * @return Sequence |
||
62 | */ |
||
63 | 6 | protected function _valueASN1(): Sequence |
|
74 | |||
75 | /** |
||
76 | * Get all mappings. |
||
77 | * |
||
78 | * @return PolicyMapping[] |
||
79 | */ |
||
80 | 2 | public function mappings(): array |
|
84 | |||
85 | /** |
||
86 | * Get mappings flattened into a single array of arrays of subject domains |
||
87 | * keyed by issuer domain. |
||
88 | * |
||
89 | * Eg. if policy mappings contains multiple mappings with the same issuer |
||
90 | * domain policy, their corresponding subject domain policies are placed |
||
91 | * under the same key. |
||
92 | * |
||
93 | * @return (string[])[] |
||
94 | */ |
||
95 | 2 | public function flattenedMappings(): array |
|
107 | |||
108 | /** |
||
109 | * Get all subject domain policy OIDs that are mapped to given issuer |
||
110 | * domain policy OID. |
||
111 | * |
||
112 | * @param string $oid Issuer domain policy |
||
113 | * @return string[] List of OIDs in dotted format |
||
114 | */ |
||
115 | 1 | public function issuerMappings(string $oid): array |
|
125 | |||
126 | /** |
||
127 | * Get all mapped issuer domain policy OIDs. |
||
128 | * |
||
129 | * @return string[] |
||
130 | */ |
||
131 | 1 | public function issuerDomainPolicies(): array |
|
139 | |||
140 | /** |
||
141 | * Check whether policy mappings have anyPolicy mapped. |
||
142 | * |
||
143 | * RFC 5280 section 4.2.1.5 states that "Policies MUST NOT be mapped either |
||
144 | * to or from the special value anyPolicy". |
||
145 | * |
||
146 | * @return bool |
||
147 | */ |
||
148 | 7 | public function hasAnyPolicyMapping(): bool |
|
162 | |||
163 | /** |
||
164 | * Get the number of mappings. |
||
165 | * |
||
166 | * @see \Countable::count() |
||
167 | * @return int |
||
168 | */ |
||
169 | 1 | public function count(): int |
|
173 | |||
174 | /** |
||
175 | * Get iterator for policy mappings. |
||
176 | * |
||
177 | * @see \IteratorAggregate::getIterator() |
||
178 | * @return \ArrayIterator |
||
179 | */ |
||
180 | 1 | public function getIterator(): \ArrayIterator |
|
184 | } |
||
185 |