@@ -37,6 +37,7 @@ |
||
37 | 37 | * Constructor |
38 | 38 | * |
39 | 39 | * @param IetfAttrValue ...$values |
40 | + * @param IetfAttrValue[] $values |
|
40 | 41 | */ |
41 | 42 | public function __construct(IetfAttrValue ...$values) { |
42 | 43 | $this->_policyAuthority = null; |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | } |
55 | 55 | $seq = $el->at($idx, Element::TYPE_SEQUENCE); |
56 | 56 | $values = array_map( |
57 | - function (Element $el) { |
|
57 | + function(Element $el) { |
|
58 | 58 | return IetfAttrValue::fromASN1($el); |
59 | 59 | }, $seq->elements()); |
60 | 60 | $obj = new static(...$values); |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | $this->_policyAuthority->toASN1()); |
131 | 131 | } |
132 | 132 | $values = array_map( |
133 | - function (IetfAttrValue $val) { |
|
133 | + function(IetfAttrValue $val) { |
|
134 | 134 | return $val->toASN1(); |
135 | 135 | }, $this->_values); |
136 | 136 | $elements[] = new Sequence(...$values); |
@@ -48,6 +48,7 @@ discard block |
||
48 | 48 | * Constructor |
49 | 49 | * |
50 | 50 | * @param Attribute ...$attribs |
51 | + * @param Attribute[] $attribs |
|
51 | 52 | */ |
52 | 53 | public function __construct(Attribute ...$attribs) { |
53 | 54 | $this->_attributes = $attribs; |
@@ -57,6 +58,7 @@ discard block |
||
57 | 58 | * Initialize from attribute values. |
58 | 59 | * |
59 | 60 | * @param AttributeValue ...$values |
61 | + * @param AttributeValue[] $values |
|
60 | 62 | * @return self |
61 | 63 | */ |
62 | 64 | public static function fromAttributeValues(AttributeValue ...$values) { |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | */ |
62 | 62 | public static function fromAttributeValues(AttributeValue ...$values) { |
63 | 63 | $attribs = array_map( |
64 | - function (AttributeValue $value) { |
|
64 | + function(AttributeValue $value) { |
|
65 | 65 | return $value->toAttribute(); |
66 | 66 | }, $values); |
67 | 67 | return new self(...$attribs); |
@@ -75,13 +75,13 @@ discard block |
||
75 | 75 | */ |
76 | 76 | public static function fromASN1(Sequence $seq) { |
77 | 77 | $attribs = array_map( |
78 | - function (Element $el) { |
|
78 | + function(Element $el) { |
|
79 | 79 | return Attribute::fromASN1( |
80 | 80 | $el->expectType(Element::TYPE_SEQUENCE)); |
81 | 81 | }, $seq->elements()); |
82 | 82 | // cast attributes |
83 | 83 | $attribs = array_map( |
84 | - function (Attribute $attr) { |
|
84 | + function(Attribute $attr) { |
|
85 | 85 | $oid = $attr->oid(); |
86 | 86 | if (array_key_exists($oid, self::MAP_OID_TO_CLASS)) { |
87 | 87 | $cls = self::MAP_OID_TO_CLASS[$oid]; |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | */ |
190 | 190 | public function toASN1() { |
191 | 191 | $elements = array_map( |
192 | - function (Attribute $attr) { |
|
192 | + function(Attribute $attr) { |
|
193 | 193 | return $attr->toASN1(); |
194 | 194 | }, array_values($this->_attributes)); |
195 | 195 | return new Sequence(...$elements); |
@@ -27,6 +27,7 @@ |
||
27 | 27 | * |
28 | 28 | * @param bool $critical |
29 | 29 | * @param PolicyInformation ...$policies |
30 | + * @param PolicyInformation[] $policies |
|
30 | 31 | */ |
31 | 32 | public function __construct($critical, PolicyInformation ...$policies) { |
32 | 33 | parent::__construct(Extension::OID_CERTIFICATE_POLICIES, $critical); |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | |
39 | 39 | protected static function _fromDER($data, $critical) { |
40 | 40 | $policies = array_map( |
41 | - function (Element $el) { |
|
41 | + function(Element $el) { |
|
42 | 42 | return PolicyInformation::fromASN1( |
43 | 43 | $el->expectType(Element::TYPE_SEQUENCE)); |
44 | 44 | }, Sequence::fromDER($data)->elements()); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | throw new \LogicException("No policies."); |
80 | 80 | } |
81 | 81 | $elements = array_map( |
82 | - function (PolicyInformation $pi) { |
|
82 | + function(PolicyInformation $pi) { |
|
83 | 83 | return $pi->toASN1(); |
84 | 84 | }, array_values($this->_policies)); |
85 | 85 | return new Sequence(...$elements); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | * Generate ASN.1 element. |
80 | 80 | * |
81 | 81 | * @throws \UnexpectedValueException |
82 | - * @return StringType |
|
82 | + * @return Element[] |
|
83 | 83 | */ |
84 | 84 | public function toASN1() { |
85 | 85 | switch ($this->_tag) { |
@@ -97,6 +97,9 @@ discard block |
||
97 | 97 | } |
98 | 98 | } |
99 | 99 | |
100 | + /** |
|
101 | + * @param string $str |
|
102 | + */ |
|
100 | 103 | protected static function _determineType($str) { |
101 | 104 | // @todo Support other types |
102 | 105 | return Element::TYPE_UTF8_STRING; |
@@ -34,6 +34,7 @@ |
||
34 | 34 | * |
35 | 35 | * @param DisplayText $organization |
36 | 36 | * @param int ...$numbers |
37 | + * @param integer[] $numbers |
|
37 | 38 | */ |
38 | 39 | public function __construct(DisplayText $organization, ...$numbers) { |
39 | 40 | $this->_organization = $organization; |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | public static function fromASN1(Sequence $seq) { |
50 | 50 | $org = DisplayText::fromASN1($seq->at(0, Element::TYPE_STRING)); |
51 | 51 | $numbers = array_map( |
52 | - function (Element $el) { |
|
52 | + function(Element $el) { |
|
53 | 53 | return $el->expectType(Element::TYPE_INTEGER)->number(); |
54 | 54 | }, $seq->at(1, Element::TYPE_SEQUENCE)->elements()); |
55 | 55 | return new self($org, ...$numbers); |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | public function toASN1() { |
82 | 82 | $org = $this->_organization->toASN1(); |
83 | 83 | $nums = array_map( |
84 | - function ($number) { |
|
84 | + function($number) { |
|
85 | 85 | return new Integer($number); |
86 | 86 | }, $this->_numbers); |
87 | 87 | return new Sequence($org, new Sequence(...$nums)); |
@@ -41,6 +41,7 @@ |
||
41 | 41 | * |
42 | 42 | * @param string $oid |
43 | 43 | * @param PolicyQualifierInfo ...$qualifiers |
44 | + * @param PolicyQualifierInfo[] $qualifiers |
|
44 | 45 | */ |
45 | 46 | public function __construct($oid, PolicyQualifierInfo ...$qualifiers) { |
46 | 47 | $this->_oid = $oid; |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | $qualifiers = array(); |
62 | 62 | if (count($seq) > 1) { |
63 | 63 | $qualifiers = array_map( |
64 | - function (Element $el) { |
|
64 | + function(Element $el) { |
|
65 | 65 | return PolicyQualifierInfo::fromASN1( |
66 | 66 | $el->expectType(Element::TYPE_SEQUENCE)); |
67 | 67 | }, $seq->at(1, Element::TYPE_SEQUENCE)->elements()); |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | $elements = array(new ObjectIdentifier($this->_oid)); |
156 | 156 | if (count($this->_qualifiers)) { |
157 | 157 | $qualifiers = array_map( |
158 | - function (PolicyQualifierInfo $pqi) { |
|
158 | + function(PolicyQualifierInfo $pqi) { |
|
159 | 159 | return $pqi->toASN1(); |
160 | 160 | }, array_values($this->_qualifiers)); |
161 | 161 | $elements[] = new Sequence(...$qualifiers); |
@@ -27,6 +27,7 @@ |
||
27 | 27 | * |
28 | 28 | * @param bool $critical |
29 | 29 | * @param DistributionPoint ...$distribution_points |
30 | + * @param DistributionPoint[] $distribution_points |
|
30 | 31 | */ |
31 | 32 | public function __construct($critical, |
32 | 33 | DistributionPoint ...$distribution_points) { |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | |
37 | 37 | protected static function _fromDER($data, $critical) { |
38 | 38 | $dps = array_map( |
39 | - function (Element $el) { |
|
39 | + function(Element $el) { |
|
40 | 40 | return DistributionPoint::fromASN1( |
41 | 41 | $el->expectType(Element::TYPE_SEQUENCE)); |
42 | 42 | }, Sequence::fromDER($data)->elements()); |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | throw new \LogicException("No distribution points."); |
55 | 55 | } |
56 | 56 | $elements = array_map( |
57 | - function (DistributionPoint $dp) { |
|
57 | + function(DistributionPoint $dp) { |
|
58 | 58 | return $dp->toASN1(); |
59 | 59 | }, $this->_distributionPoints); |
60 | 60 | return new Sequence(...$elements); |
@@ -57,6 +57,7 @@ discard block |
||
57 | 57 | * |
58 | 58 | * @param bool $critical |
59 | 59 | * @param string ...$purposes |
60 | + * @param string[] $purposes |
|
60 | 61 | */ |
61 | 62 | public function __construct($critical, ...$purposes) { |
62 | 63 | parent::__construct(self::OID_EXT_KEY_USAGE, $critical); |
@@ -77,6 +78,7 @@ discard block |
||
77 | 78 | * If multiple purposes are checked, all must be present. |
78 | 79 | * |
79 | 80 | * @param string ...$oids |
81 | + * @param string[] $oids |
|
80 | 82 | * @return bool |
81 | 83 | */ |
82 | 84 | public function has(...$oids) { |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | |
66 | 66 | protected static function _fromDER($data, $critical) { |
67 | 67 | $purposes = array_map( |
68 | - function (Element $el) { |
|
68 | + function(Element $el) { |
|
69 | 69 | return $el->expectType(Element::TYPE_OBJECT_IDENTIFIER)->oid(); |
70 | 70 | }, Sequence::fromDER($data)->elements()); |
71 | 71 | return new self($critical, ...$purposes); |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | |
100 | 100 | protected function _valueASN1() { |
101 | 101 | $elements = array_map( |
102 | - function ($oid) { |
|
102 | + function($oid) { |
|
103 | 103 | return new ObjectIdentifier($oid); |
104 | 104 | }, $this->_purposes); |
105 | 105 | return new Sequence(...$elements); |
@@ -25,6 +25,7 @@ |
||
25 | 25 | * Constructor |
26 | 26 | * |
27 | 27 | * @param GeneralSubtree ...$subtrees |
28 | + * @param GeneralSubtree[] $subtrees |
|
28 | 29 | */ |
29 | 30 | public function __construct(GeneralSubtree ...$subtrees) { |
30 | 31 | $this->_subtrees = $subtrees; |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | */ |
39 | 39 | public static function fromASN1(Sequence $seq) { |
40 | 40 | $subtrees = array_map( |
41 | - function (Element $el) { |
|
41 | + function(Element $el) { |
|
42 | 42 | return GeneralSubtree::fromASN1( |
43 | 43 | $el->expectType(Element::TYPE_SEQUENCE)); |
44 | 44 | }, $seq->elements()); |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | throw new \LogicException("No subtrees."); |
69 | 69 | } |
70 | 70 | $elements = array_map( |
71 | - function (GeneralSubtree $gs) { |
|
71 | + function(GeneralSubtree $gs) { |
|
72 | 72 | return $gs->toASN1(); |
73 | 73 | }, $this->_subtrees); |
74 | 74 | return new Sequence(...$elements); |