Skip to content

Commit 13465aa

Browse files
author
Igor Melnikov
committed
MAGETWO-57836: Make \Magento\Framework\Escaper::escapeJs() generate valid Json string
Code style fixes
1 parent 9dd2248 commit 13465aa

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

lib/internal/Magento/Framework/Test/Unit/EscaperTest.php

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ protected function setUp()
3939
}
4040

4141
/**
42-
* Convert a Unicode Codepoint to a literal UTF-8 character.
42+
* Convert a unicode codepoint to a literal UTF-8 character
4343
*
4444
* @param int $codepoint Unicode codepoint in hex notation
4545
* @return string UTF-8 literal string
@@ -51,26 +51,27 @@ protected function codepointToUtf8($codepoint)
5151
}
5252
if ($codepoint < 0x800) {
5353
return chr($codepoint >> 6 & 0x3f | 0xc0)
54-
. chr($codepoint & 0x3f | 0x80);
54+
. chr($codepoint & 0x3f | 0x80);
5555
}
5656
if ($codepoint < 0x10000) {
5757
return chr($codepoint >> 12 & 0x0f | 0xe0)
58-
. chr($codepoint >> 6 & 0x3f | 0x80)
59-
. chr($codepoint & 0x3f | 0x80);
58+
. chr($codepoint >> 6 & 0x3f | 0x80)
59+
. chr($codepoint & 0x3f | 0x80);
6060
}
6161
if ($codepoint < 0x110000) {
6262
return chr($codepoint >> 18 & 0x07 | 0xf0)
63-
. chr($codepoint >> 12 & 0x3f | 0x80)
64-
. chr($codepoint >> 6 & 0x3f | 0x80)
65-
. chr($codepoint & 0x3f | 0x80);
63+
. chr($codepoint >> 12 & 0x3f | 0x80)
64+
. chr($codepoint >> 6 & 0x3f | 0x80)
65+
. chr($codepoint & 0x3f | 0x80);
6666
}
67-
throw new \Exception('Codepoint requested outside of Unicode range');
67+
throw new \Exception('Codepoint requested outside of unicode range');
6868
}
6969

7070
public function testEscapeJsEscapesOwaspRecommendedRanges()
7171
{
72-
$immune = [',', '.', '_']; // Exceptions to escaping ranges
73-
for ($chr=0; $chr < 0xFF; $chr++) {
72+
// Exceptions to escaping ranges
73+
$immune = [',', '.', '_'];
74+
for ($chr = 0; $chr < 0xFF; $chr++) {
7475
if ($chr >= 0x30 && $chr <= 0x39
7576
|| $chr >= 0x41 && $chr <= 0x5A
7677
|| $chr >= 0x61 && $chr <= 0x7A

0 commit comments

Comments
 (0)