fix some more checkstyle issues

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2018-12-24 13:21:35 +01:00
parent 35c631946d
commit 30f5902b88
16 changed files with 74 additions and 61 deletions

View File

@@ -98,20 +98,25 @@ class IdnaWrapper
$strlen = strlen($string);
for ($i = 0; $i < $strlen; $i ++) {
$ord = ord($string[$i]);
if ($ord < 0x80)
if ($ord < 0x80) {
continue; // 0bbbbbbb
elseif (($ord & 0xE0) === 0xC0 && $ord > 0xC1)
} elseif (($ord & 0xE0) === 0xC0 && $ord > 0xC1) {
$n = 1; // 110bbbbb (exkl C0-C1)
elseif (($ord & 0xF0) === 0xE0)
} elseif (($ord & 0xF0) === 0xE0) {
$n = 2; // 1110bbbb
elseif (($ord & 0xF8) === 0xF0 && $ord < 0xF5)
} elseif (($ord & 0xF8) === 0xF0 && $ord < 0xF5) {
$n = 3; // 11110bbb (exkl F5-FF)
else
return false; // ungültiges UTF-8-Zeichen
for ($c = 0; $c < $n; $c ++) // $n Folgebytes? // 10bbbbbb
if (++ $i === $strlen || (ord($string[$i]) & 0xC0) !== 0x80)
} else {
// ungültiges UTF-8-Zeichen
return false;
}
// $n Folgebytes? // 10bbbbbb
for ($c = 0; $c < $n; $c ++) {
if (++ $i === $strlen || (ord($string[$i]) & 0xC0) !== 0x80) {
// ungültiges UTF-8-Zeichen
return false;
}
}
}
// kein ungültiges UTF-8-Zeichen gefunden
return true;