replace 'for' loop with 'str_repeat' function (#10788)
parent
176d25851d
commit
b2006fbe9c
|
@ -108,9 +108,7 @@ class JsonFormatter
|
||||||
// If this character is the end of an element,
|
// If this character is the end of an element,
|
||||||
// output a new line and indent the next line
|
// output a new line and indent the next line
|
||||||
$result .= $newLine;
|
$result .= $newLine;
|
||||||
for ($j = 0; $j < $pos; $j++) {
|
$result .= str_repeat($indentStr, $pos);
|
||||||
$result .= $indentStr;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// Collapse empty {} and []
|
// Collapse empty {} and []
|
||||||
$result = rtrim($result);
|
$result = rtrim($result);
|
||||||
|
@ -128,9 +126,7 @@ class JsonFormatter
|
||||||
$pos++;
|
$pos++;
|
||||||
}
|
}
|
||||||
|
|
||||||
for ($j = 0; $j < $pos; $j++) {
|
$result .= str_repeat($indentStr, $pos);
|
||||||
$result .= $indentStr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue