Skip to content

Commit

Permalink
Introduced normalizers for Generator state
Browse files Browse the repository at this point in the history
  • Loading branch information
Steveb-p committed Oct 8, 2024
1 parent 264eb4f commit a78bb4b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/lib/Output/Normalizer/JsonObjectNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@ public function normalize($object, ?string $format = null, array $context = []):
{
$vars = get_object_vars($object);

$data = [];
foreach ($vars as $key => $value) {
if ($value instanceof ArrayList) {
$name = $value->getName();
unset($vars[$key]);
$vars[$name] = $this->normalizer->normalize($value, $format, $context);
$data[$name] = $this->normalizer->normalize($value, $format, $context);
} else {
$vars[$key] = $this->normalizer->normalize($value, $format, $context);
$data[$key] = $this->normalizer->normalize($value, $format, $context);
}
}

return $vars;
return $data;
}

public function supportsNormalization($data, ?string $format = null): bool
Expand Down

0 comments on commit a78bb4b

Please sign in to comment.