Skip to content

Commit

Permalink
corrected some variables to make simpler
Browse files Browse the repository at this point in the history
  • Loading branch information
vladimir-xz committed Feb 25, 2024
1 parent 87cada2 commit a85cc8c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Formatters/Stylish.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ function stringify(mixed $item, int $depth = 0, int $offset = 2, string $separat
return trim($jsonFile, "\"");
}
$emptySpace = str_repeat($separator, $depth);
$result = array_map(function ($key, $value) use ($depth, $separator, $offset) {
$lines = array_map(function ($key, $value) use ($depth, $separator, $offset) {
$nextDepth = $depth + 1;
$emptySpace = substr(str_repeat($separator, $nextDepth), $offset, null);
$valueString = stringify($value, $depth + 1, $offset);
return "{$emptySpace}{$key}: {$valueString}";
}, array_keys($item), $item);
$resultWithBrackets = ['{', ...$result, "{$emptySpace}}"];
return implode("\n", $resultWithBrackets);
$linesWithBrackets = ['{', ...$lines, "{$emptySpace}}"];
return implode("\n", $linesWithBrackets);
}

function makeStylish(mixed $comparedData, int $depth = 0)
Expand Down

0 comments on commit a85cc8c

Please sign in to comment.