@@ -31,6 +31,7 @@ discard block |
||
31 | 31 | * |
32 | 32 | * @param AttributeType $type Attribute type |
33 | 33 | * @param AttributeValue ...$values Attribute values |
34 | + * @param AttributeValue[] $values |
|
34 | 35 | */ |
35 | 36 | public function __construct(AttributeType $type, AttributeValue ...$values) { |
36 | 37 | // check that attribute values have correct oid |
@@ -64,6 +65,7 @@ discard block |
||
64 | 65 | * Convenience method to initialize from attribute values. |
65 | 66 | * |
66 | 67 | * @param AttributeValue ...$values One or more values |
68 | + * @param AttributeValue[] $values |
|
67 | 69 | * @throws \LogicException |
68 | 70 | * @return self |
69 | 71 | */ |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | public function __construct(AttributeType $type, AttributeValue ...$values) { |
36 | 36 | // check that attribute values have correct oid |
37 | 37 | array_walk($values, |
38 | - function (AttributeValue $value) use ($type) { |
|
38 | + function(AttributeValue $value) use ($type) { |
|
39 | 39 | if ($value->oid() != $type->oid()) { |
40 | 40 | throw new \LogicException("Attribute OID mismatch."); |
41 | 41 | } |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | $type = AttributeType::fromASN1( |
55 | 55 | $seq->at(0, Element::TYPE_OBJECT_IDENTIFIER)); |
56 | 56 | $values = array_map( |
57 | - function (Element $el) use ($type) { |
|
57 | + function(Element $el) use ($type) { |
|
58 | 58 | return AttributeValue::fromASN1ByOID($type->oid(), $el); |
59 | 59 | }, $seq->at(1, Element::TYPE_SET)->elements()); |
60 | 60 | return new self($type, ...$values); |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | */ |
106 | 106 | public function toASN1() { |
107 | 107 | $values = array_map( |
108 | - function (AttributeValue $value) { |
|
108 | + function(AttributeValue $value) { |
|
109 | 109 | return $value->toASN1(); |
110 | 110 | }, $this->_values); |
111 | 111 | $valueset = new Set(...$values); |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | } |
134 | 134 | $oid = $this->oid(); |
135 | 135 | $values = array_map( |
136 | - function (AttributeValue $value) use ($cls, $oid) { |
|
136 | + function(AttributeValue $value) use ($cls, $oid) { |
|
137 | 137 | $value = $cls::fromSelf($value); |
138 | 138 | if ($value->oid() != $oid) { |
139 | 139 | throw new \LogicException("Attribute OID mismatch."); |
@@ -30,6 +30,7 @@ |
||
30 | 30 | * Constructor |
31 | 31 | * |
32 | 32 | * @param RDN ...$rdns RDN components |
33 | + * @param RDN[] $rdns |
|
33 | 34 | */ |
34 | 35 | public function __construct(RDN ...$rdns) { |
35 | 36 | $this->_rdns = $rdns; |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public static function fromASN1(Sequence $seq) { |
45 | 45 | $rdns = array_map( |
46 | - function (Element $el) { |
|
46 | + function(Element $el) { |
|
47 | 47 | return RDN::fromASN1($el->expectType(Element::TYPE_SET)); |
48 | 48 | }, $seq->elements()); |
49 | 49 | return new self(...$rdns); |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | */ |
84 | 84 | public function toASN1() { |
85 | 85 | $elements = array_map( |
86 | - function (RDN $rdn) { |
|
86 | + function(RDN $rdn) { |
|
87 | 87 | return $rdn->toASN1(); |
88 | 88 | }, $this->_rdns); |
89 | 89 | return new Sequence(...$elements); |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | */ |
98 | 98 | public function toString() { |
99 | 99 | $parts = array_map( |
100 | - function (RDN $rdn) { |
|
100 | + function(RDN $rdn) { |
|
101 | 101 | return $rdn->toString(); |
102 | 102 | }, array_reverse($this->_rdns)); |
103 | 103 | return implode(",", $parts); |
@@ -26,6 +26,7 @@ discard block |
||
26 | 26 | * Constructor |
27 | 27 | * |
28 | 28 | * @param AttributeTypeAndValue ...$attribs One or more attributes |
29 | + * @param AttributeTypeAndValue[] $attribs |
|
29 | 30 | */ |
30 | 31 | public function __construct(AttributeTypeAndValue ...$attribs) { |
31 | 32 | if (!count($attribs)) { |
@@ -39,6 +40,7 @@ discard block |
||
39 | 40 | * Convenience method to initialize RDN from AttributeValue objects. |
40 | 41 | * |
41 | 42 | * @param AttributeValue ...$values One or more attributes |
43 | + * @param AttributeValue[] $values |
|
42 | 44 | * @return self |
43 | 45 | */ |
44 | 46 | public static function fromAttributeValues(AttributeValue ...$values) { |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public static function fromAttributeValues(AttributeValue ...$values) { |
45 | 45 | $attribs = array_map( |
46 | - function (AttributeValue $value) { |
|
46 | + function(AttributeValue $value) { |
|
47 | 47 | return new AttributeTypeAndValue( |
48 | 48 | new AttributeType($value->oid()), $value); |
49 | 49 | }, $values); |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | */ |
59 | 59 | public static function fromASN1(Set $set) { |
60 | 60 | $attribs = array_map( |
61 | - function (Element $el) { |
|
61 | + function(Element $el) { |
|
62 | 62 | return AttributeTypeAndValue::fromASN1( |
63 | 63 | $el->expectType(Element::TYPE_SEQUENCE)); |
64 | 64 | }, $set->elements()); |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | */ |
73 | 73 | public function toASN1() { |
74 | 74 | $elements = array_map( |
75 | - function (AttributeTypeAndValue $tv) { |
|
75 | + function(AttributeTypeAndValue $tv) { |
|
76 | 76 | return $tv->toASN1(); |
77 | 77 | }, $this->_attribs); |
78 | 78 | $set = new Set(...$elements); |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | */ |
88 | 88 | public function toString() { |
89 | 89 | $parts = array_map( |
90 | - function (AttributeTypeAndValue $tv) { |
|
90 | + function(AttributeTypeAndValue $tv) { |
|
91 | 91 | return $tv->toString(); |
92 | 92 | }, $this->_attribs); |
93 | 93 | return implode("+", $parts); |
@@ -327,7 +327,7 @@ |
||
327 | 327 | * |
328 | 328 | * @param string $pattern |
329 | 329 | * @param int $offset |
330 | - * @return string|null Null if pattern doesn't match |
|
330 | + * @return string Null if pattern doesn't match |
|
331 | 331 | */ |
332 | 332 | private function _regexMatch($pattern, &$offset) { |
333 | 333 | $idx = $offset; |
@@ -62,11 +62,11 @@ |
||
62 | 62 | $str = preg_replace('/^([ #])/u', '\\\\$1', $str); |
63 | 63 | // implementation specific special characters |
64 | 64 | $str = preg_replace_callback('/([\pC])/u', |
65 | - function ($m) { |
|
65 | + function($m) { |
|
66 | 66 | $octets = str_split(bin2hex($m[1]), 2); |
67 | 67 | return implode("", |
68 | 68 | array_map( |
69 | - function ($octet) { |
|
69 | + function($octet) { |
|
70 | 70 | return '\\' . strtoupper($octet); |
71 | 71 | }, $octets)); |
72 | 72 | }, $str); |