@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types = 1); |
|
| 3 | +declare(strict_types=1); |
|
| 4 | 4 | |
| 5 | 5 | namespace Sop\X501\StringPrep; |
| 6 | 6 | |
@@ -43,22 +43,22 @@ |
||
| 43 | 43 | { |
| 44 | 44 | switch ($this->_type) { |
| 45 | 45 | // UTF-8 string as is |
| 46 | - case Element::TYPE_UTF8_STRING: |
|
| 47 | - return $string; |
|
| 48 | - // PrintableString maps directly to UTF-8 |
|
| 49 | - case Element::TYPE_PRINTABLE_STRING: |
|
| 50 | - return $string; |
|
| 51 | - // UCS-2 to UTF-8 |
|
| 52 | - case Element::TYPE_BMP_STRING: |
|
| 53 | - return mb_convert_encoding($string, 'UTF-8', 'UCS-2BE'); |
|
| 54 | - // UCS-4 to UTF-8 |
|
| 55 | - case Element::TYPE_UNIVERSAL_STRING: |
|
| 56 | - return mb_convert_encoding($string, 'UTF-8', 'UCS-4BE'); |
|
| 57 | - // TeletexString mapping is a local matter. |
|
| 58 | - // We take a shortcut here and encode it as a hexstring. |
|
| 59 | - case Element::TYPE_T61_STRING: |
|
| 60 | - $el = new T61String($string); |
|
| 61 | - return '#' . bin2hex($el->toDER()); |
|
| 46 | + case Element::TYPE_UTF8_STRING: |
|
| 47 | + return $string; |
|
| 48 | + // PrintableString maps directly to UTF-8 |
|
| 49 | + case Element::TYPE_PRINTABLE_STRING: |
|
| 50 | + return $string; |
|
| 51 | + // UCS-2 to UTF-8 |
|
| 52 | + case Element::TYPE_BMP_STRING: |
|
| 53 | + return mb_convert_encoding($string, 'UTF-8', 'UCS-2BE'); |
|
| 54 | + // UCS-4 to UTF-8 |
|
| 55 | + case Element::TYPE_UNIVERSAL_STRING: |
|
| 56 | + return mb_convert_encoding($string, 'UTF-8', 'UCS-4BE'); |
|
| 57 | + // TeletexString mapping is a local matter. |
|
| 58 | + // We take a shortcut here and encode it as a hexstring. |
|
| 59 | + case Element::TYPE_T61_STRING: |
|
| 60 | + $el = new T61String($string); |
|
| 61 | + return '#' . bin2hex($el->toDER()); |
|
| 62 | 62 | } |
| 63 | 63 | throw new \LogicException( |
| 64 | 64 | 'Unsupported string type ' . Element::tagToName($this->_type) . '.'); |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types = 1); |
|
| 3 | +declare(strict_types=1); |
|
| 4 | 4 | |
| 5 | 5 | namespace Sop\X501\StringPrep; |
| 6 | 6 | |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types = 1); |
|
| 3 | +declare(strict_types=1); |
|
| 4 | 4 | |
| 5 | 5 | namespace Sop\X501\ASN1; |
| 6 | 6 | |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types = 1); |
|
| 3 | +declare(strict_types=1); |
|
| 4 | 4 | |
| 5 | 5 | namespace Sop\X501\ASN1\AttributeValue; |
| 6 | 6 | |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types = 1); |
|
| 3 | +declare(strict_types=1); |
|
| 4 | 4 | |
| 5 | 5 | namespace Sop\X501\ASN1\AttributeValue\Feature; |
| 6 | 6 | |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types = 1); |
|
| 3 | +declare(strict_types=1); |
|
| 4 | 4 | |
| 5 | 5 | namespace Sop\X501\ASN1\Feature; |
| 6 | 6 | |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types = 1); |
|
| 3 | +declare(strict_types=1); |
|
| 4 | 4 | |
| 5 | 5 | namespace Sop\X501\MatchingRule; |
| 6 | 6 | |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types = 1); |
|
| 3 | +declare(strict_types=1); |
|
| 4 | 4 | |
| 5 | 5 | namespace Sop\X501\DN; |
| 6 | 6 | |
@@ -79,11 +79,11 @@ discard block |
||
| 79 | 79 | $str = preg_replace('/^([ #])/u', '\\\\$1', $str); |
| 80 | 80 | // implementation specific special characters |
| 81 | 81 | $str = preg_replace_callback('/([\pC])/u', |
| 82 | - function ($m) { |
|
| 82 | + function($m) { |
|
| 83 | 83 | $octets = str_split(bin2hex($m[1]), 2); |
| 84 | 84 | return implode('', |
| 85 | 85 | array_map( |
| 86 | - function ($octet) { |
|
| 86 | + function($octet) { |
|
| 87 | 87 | return '\\' . strtoupper($octet); |
| 88 | 88 | }, $octets)); |
| 89 | 89 | }, $str); |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types = 1); |
|
| 3 | +declare(strict_types=1); |
|
| 4 | 4 | |
| 5 | 5 | namespace Sop\X501\MatchingRule; |
| 6 | 6 | |