Update Core\Config
Make it beautiful when adding new elements to the engine configuration.
This commit is contained in:
parent
7ac3620a33
commit
c9899bbb90
1 changed files with 7 additions and 2 deletions
|
@ -470,8 +470,11 @@ class Config
|
|||
{
|
||||
$space = \str_repeat(' ', $level);
|
||||
$result = '[';
|
||||
$tail = '';
|
||||
|
||||
foreach ($data as $key => $cur) {
|
||||
$tail = '';
|
||||
|
||||
if ($this->isFormat($cur)) {
|
||||
if (\is_string($key)) {
|
||||
$result .= "{$cur['key_before']}'{$key}'{$cur['key_after']}=>{$cur['value_before']}";
|
||||
|
@ -486,7 +489,9 @@ class Config
|
|||
}
|
||||
} else {
|
||||
if (\is_string($key)) {
|
||||
$result .= "\n{$space}'{$key}' => ";
|
||||
$result = \rtrim($result, "\n\t ");
|
||||
$result .= "\n{$space}'{$key}' => ";
|
||||
$tail = "\n" . \str_repeat(' ', $level - 1);
|
||||
} else {
|
||||
$result .= ' ';
|
||||
}
|
||||
|
@ -499,6 +504,6 @@ class Config
|
|||
}
|
||||
}
|
||||
|
||||
return \rtrim($result, ',') . ']';
|
||||
return \rtrim($result . $tail, ',') . ']';
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue