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,
|
||||
// output a new line and indent the next line
|
||||
$result .= $newLine;
|
||||
for ($j = 0; $j < $pos; $j++) {
|
||||
$result .= $indentStr;
|
||||
}
|
||||
$result .= str_repeat($indentStr, $pos);
|
||||
} else {
|
||||
// Collapse empty {} and []
|
||||
$result = rtrim($result);
|
||||
|
@ -128,9 +126,7 @@ class JsonFormatter
|
|||
$pos++;
|
||||
}
|
||||
|
||||
for ($j = 0; $j < $pos; $j++) {
|
||||
$result .= $indentStr;
|
||||
}
|
||||
$result .= str_repeat($indentStr, $pos);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue