1
0
Fork 0

replace 'for' loop with 'str_repeat' function (#10788)

pull/10809/head
Subhan Shamsoddini 2022-05-24 23:42:10 +04:30 committed by GitHub
parent 176d25851d
commit b2006fbe9c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 6 deletions

View File

@ -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);
}
}