Skip to content

Commit

Permalink
fix curly braces
Browse files Browse the repository at this point in the history
  • Loading branch information
aplab committed Jun 8, 2021
1 parent 34c50b9 commit 8d9c0ca
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions lib/Tools.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ public static function my_strtok($string = NULL, $delimiter = NULL)
if ($i == $match_pos) {
if ($i != $curr_pos) {
$result = trim(substr($str_original, $curr_pos, $i - $curr_pos));
if (strncasecmp($result, 'delimiter', 9) == 0 && (strlen($result) == 9 || FALSE !== strpos(" \t", $result{9}))) {
if (strncasecmp($result, 'delimiter', 9) == 0 && (strlen($result) == 9 || FALSE !== strpos(" \t", $result[9]))) {
$delim = trim(strtolower(substr($result, 10)));
if ("" == $delim) {
$delim = ";";
Expand All @@ -177,23 +177,23 @@ public static function my_strtok($string = NULL, $delimiter = NULL)
if (FALSE !== $result) {
break;
}
} else if ($str{$i} == "'") {
} else if ($str[$i] == "'") {
for ($j = $i + 1; $j < $len; ++$j) {
if ($str{$j} == "\\") ++$j;
else if ($str{$j} == "'") break;
if ($str[$j] == "\\") ++$j;
else if ($str[$j] == "'") break;
}
$i = $j;
} else if ($str{$i} == "\"") {
} else if ($str[$i] == "\"") {
for ($j = $i + 1; $j < $len; ++$j) {
if ($str{$j} == "\\") ++$j;
else if ($str{$j} == "\"") break;
if ($str[$j] == "\\") ++$j;
else if ($str[$j] == "\"") break;
}
$i = $j;
} else if ($i < $len - 1 && $str{$i} == "/" && $str{$i + 1} == "*") {
} else if ($i < $len - 1 && $str[$i] == "/" && $str[$i + 1] == "*") {
$j = $i + 2;
while ($j) {
$j = strpos($str, "*/", $j);
if (!$j || $str{$j - 1} != "\\") {
if (!$j || $str[$j - 1] != "\\") {
break;
}
++$j;
Expand All @@ -202,26 +202,26 @@ public static function my_strtok($string = NULL, $delimiter = NULL)
break;
}
$i = $j + 1;
} else if ($str{$i} == "#") {
} else if ($str[$i] == "#") {
$j = strpos($str, "\n", $i + 1) or strpos($str, "\r", $i + 1);
if (!$j) {
break;
}
$i = $j;
} else if ($i < $len - 2 && $str{$i} == "-" && $str{$i + 1} == "-" && FALSE !== strpos(" \t", $str{$i + 2})) {
} else if ($i < $len - 2 && $str[$i] == "-" && $str[$i + 1] == "-" && FALSE !== strpos(" \t", $str[$i + 2])) {
$j = strpos($str, "\n", $i + 3) or strpos($str, "\r", $i + 1);
if (!$j) {
break;
}
$i = $j;
} else if ($str{$i} == "\\") {
} else if ($str[$i] == "\\") {
++$i;
}
}

if (FALSE === $result && $curr_pos < $len) {
$result = trim(substr($str_original, $curr_pos));
if (strncasecmp($result, 'delimiter', 9) == 0 && (strlen($result) == 9 || FALSE !== strpos(" \t", $result{9}))) {
if (strncasecmp($result, 'delimiter', 9) == 0 && (strlen($result) == 9 || FALSE !== strpos(" \t", $result[9]))) {
$delim = trim(strtolower(substr($result, 10)));
if ("" == $delim) {
$delim = ";";
Expand Down

0 comments on commit 8d9c0ca

Please sign in to comment.