Completed
Push — master ( fb1380...d10e8c )
by Joni
04:00
created
lib/X501/DN/DNParser.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -65,11 +65,11 @@  discard block
 block discarded – undo
65 65
         $str = preg_replace('/^([ #])/u', '\\\\$1', $str);
66 66
         // implementation specific special characters
67 67
         $str = preg_replace_callback('/([\pC])/u',
68
-            function ($m) {
68
+            function($m) {
69 69
                 $octets = str_split(bin2hex($m[1]), 2);
70 70
                 return implode("",
71 71
                     array_map(
72
-                        function ($octet) {
72
+                        function($octet) {
73 73
                             return '\\' . strtoupper($octet);
74 74
                         }, $octets));
75 75
             }, $str);
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
      * @param int $offset
115 115
      * @return array Array of name-components
116 116
      */
117
-    private function _parseName(int &$offset): array
117
+    private function _parseName(int & $offset): array
118 118
     {
119 119
         $idx = $offset;
120 120
         $names = array();
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
      * @param int $offset
143 143
      * @return array Array of [type, value] tuples
144 144
      */
145
-    private function _parseNameComponent(int &$offset): array
145
+    private function _parseNameComponent(int & $offset): array
146 146
     {
147 147
         $idx = $offset;
148 148
         $tvpairs = array();
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
      * @return array A tuple of [type, value]. Value may be either a string or
170 170
      *         an Element, if it's encoded as hexstring.
171 171
      */
172
-    private function _parseAttrTypeAndValue(int &$offset): array
172
+    private function _parseAttrTypeAndValue(int & $offset): array
173 173
     {
174 174
         $idx = $offset;
175 175
         $type = $this->_parseAttrType($idx);
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
      * @throws \UnexpectedValueException
205 205
      * @return string
206 206
      */
207
-    private function _parseAttrType(int &$offset): string
207
+    private function _parseAttrType(int & $offset): string
208 208
     {
209 209
         $idx = $offset;
210 210
         // dotted OID
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
      * @throws \UnexpectedValueException
228 228
      * @return string
229 229
      */
230
-    private function _parseAttrStringValue(int &$offset): string
230
+    private function _parseAttrStringValue(int & $offset): string
231 231
     {
232 232
         $idx = $offset;
233 233
         if ($idx >= $this->_len) {
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
      * @throws \UnexpectedValueException
250 250
      * @return string
251 251
      */
252
-    private function _parseAttrString(int &$offset): string
252
+    private function _parseAttrString(int & $offset): string
253 253
     {
254 254
         $idx = $offset;
255 255
         $val = "";
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
      * @throws \UnexpectedValueException
295 295
      * @return string
296 296
      */
297
-    private function _parseQuotedAttrString(int &$offset): string
297
+    private function _parseQuotedAttrString(int & $offset): string
298 298
     {
299 299
         $idx = $offset + 1;
300 300
         $val = "";
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
      * @throws \UnexpectedValueException
323 323
      * @return string
324 324
      */
325
-    private function _parseAttrHexValue(int &$offset): string
325
+    private function _parseAttrHexValue(int & $offset): string
326 326
     {
327 327
         $idx = $offset;
328 328
         $hexstr = $this->_regexMatch('/^(?:[0-9a-f]{2})+/i', $idx);
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
      * @throws \UnexpectedValueException
342 342
      * @return string
343 343
      */
344
-    private function _parsePairAfterSlash(int &$offset): string
344
+    private function _parsePairAfterSlash(int & $offset): string
345 345
     {
346 346
         $idx = $offset;
347 347
         if ($idx >= $this->_len) {
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
      * @param int $offset
375 375
      * @return string|null Null if pattern doesn't match
376 376
      */
377
-    private function _regexMatch(string $pattern, int &$offset)
377
+    private function _regexMatch(string $pattern, int & $offset)
378 378
     {
379 379
         $idx = $offset;
380 380
         if (!preg_match($pattern, substr($this->_dn, $idx), $match)) {
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
      *
391 391
      * @param int $offset
392 392
      */
393
-    private function _skipWs(int &$offset)
393
+    private function _skipWs(int & $offset)
394 394
     {
395 395
         $idx = $offset;
396 396
         while ($idx < $this->_len) {
Please login to merge, or discard this patch.
lib/X501/ASN1/Name.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
     public static function fromASN1(Sequence $seq): self
48 48
     {
49 49
         $rdns = array_map(
50
-            function (UnspecifiedType $el) {
50
+            function(UnspecifiedType $el) {
51 51
                 return RDN::fromASN1($el->asSet());
52 52
             }, $seq->elements());
53 53
         return new self(...$rdns);
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
     public function toASN1(): Sequence
91 91
     {
92 92
         $elements = array_map(
93
-            function (RDN $rdn) {
93
+            function(RDN $rdn) {
94 94
                 return $rdn->toASN1();
95 95
             }, $this->_rdns);
96 96
         return new Sequence(...$elements);
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
     public function toString(): string
106 106
     {
107 107
         $parts = array_map(
108
-            function (RDN $rdn) {
108
+            function(RDN $rdn) {
109 109
                 return $rdn->toString();
110 110
             }, array_reverse($this->_rdns));
111 111
         return implode(",", $parts);
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
         $oid = AttributeType::attrNameToOID($name);
194 194
         return array_sum(
195 195
             array_map(
196
-                function (RDN $rdn) use ($oid) {
196
+                function(RDN $rdn) use ($oid) {
197 197
                     return count($rdn->allOf($oid));
198 198
                 }, $this->_rdns));
199 199
     }
Please login to merge, or discard this patch.
lib/X501/ASN1/RDN.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
     public static function fromAttributeValues(AttributeValue ...$values): self
47 47
     {
48 48
         $attribs = array_map(
49
-            function (AttributeValue $value) {
49
+            function(AttributeValue $value) {
50 50
                 return new AttributeTypeAndValue(
51 51
                     new AttributeType($value->oid()), $value);
52 52
             }, $values);
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
     public static function fromASN1(Set $set): self
63 63
     {
64 64
         $attribs = array_map(
65
-            function (UnspecifiedType $el) {
65
+            function(UnspecifiedType $el) {
66 66
                 return AttributeTypeAndValue::fromASN1($el->asSequence());
67 67
             }, $set->elements());
68 68
         return new self(...$attribs);
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
     public function toASN1(): Set
77 77
     {
78 78
         $elements = array_map(
79
-            function (AttributeTypeAndValue $tv) {
79
+            function(AttributeTypeAndValue $tv) {
80 80
                 return $tv->toASN1();
81 81
             }, $this->_attribs);
82 82
         $set = new Set(...$elements);
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
     public function toString(): string
93 93
     {
94 94
         $parts = array_map(
95
-            function (AttributeTypeAndValue $tv) {
95
+            function(AttributeTypeAndValue $tv) {
96 96
                 return $tv->toString();
97 97
             }, $this->_attribs);
98 98
         return implode("+", $parts);
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
     {
148 148
         $oid = AttributeType::attrNameToOID($name);
149 149
         $attribs = array_filter($this->_attribs,
150
-            function (AttributeTypeAndValue $tv) use ($oid) {
150
+            function(AttributeTypeAndValue $tv) use ($oid) {
151 151
                 return $tv->oid() == $oid;
152 152
             });
153 153
         return array_values($attribs);
Please login to merge, or discard this patch.
lib/X501/ASN1/Attribute.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
     {
38 38
         // check that attribute values have correct oid
39 39
         array_walk($values,
40
-            function (AttributeValue $value) use ($type) {
40
+            function(AttributeValue $value) use ($type) {
41 41
                 if ($value->oid() != $type->oid()) {
42 42
                     throw new \LogicException("Attribute OID mismatch.");
43 43
                 }
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
     {
57 57
         $type = AttributeType::fromASN1($seq->at(0)->asObjectIdentifier());
58 58
         $values = array_map(
59
-            function (UnspecifiedType $el) use ($type) {
59
+            function(UnspecifiedType $el) use ($type) {
60 60
                 return AttributeValue::fromASN1ByOID($type->oid(), $el);
61 61
             }, $seq->at(1)
62 62
                 ->asSet()
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
     public function toASN1(): Sequence
114 114
     {
115 115
         $values = array_map(
116
-            function (AttributeValue $value) {
116
+            function(AttributeValue $value) {
117 117
                 return $value->toASN1();
118 118
             }, $this->_values);
119 119
         $valueset = new Set(...$values);
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
         }
143 143
         $oid = $this->oid();
144 144
         $values = array_map(
145
-            function (AttributeValue $value) use ($cls, $oid) {
145
+            function(AttributeValue $value) use ($cls, $oid) {
146 146
                 $value = $cls::fromSelf($value);
147 147
                 if ($value->oid() != $oid) {
148 148
                     throw new \LogicException("Attribute OID mismatch.");
Please login to merge, or discard this patch.