Skip to content

Commit

Permalink
Added recursive map call after separation into two methods
Browse files Browse the repository at this point in the history
  • Loading branch information
juniwalk authored Jul 10, 2024
1 parent 02c119e commit bfa1ad7
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/Json.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ public static function literal(string $code): object
{
return new class($code) implements Stringable {
public function __construct(
private readonly string $code
) {}
private readonly string $code,
) {
}

public function __toString(): string
{
Expand All @@ -46,7 +47,7 @@ public static function encode(mixed $content, int $flags = 0): string
return NetteJson::encode($content, $flags);
}

$content = Arrays::map($content, fn($v) => Format::serializable($v));
$content = Arrays::mapRecursive($content, fn($v) => Format::serializable($v));
$json = NetteJson::encode($content, $flags);

if (!($flags & static::PRETTY)) {
Expand Down

0 comments on commit bfa1ad7

Please sign in to comment.