Set the station config classes to return `{}` when empty and serialized to JSON.

This commit is contained in:
Buster Neece 2024-04-25 12:48:03 -05:00
parent b1662a4757
commit 1a68f34452
No known key found for this signature in database
1 changed files with 6 additions and 2 deletions

View File

@ -29,9 +29,13 @@ abstract class AbstractStationConfiguration implements JsonSerializable
return $return;
}
public function jsonSerialize(): array
public function jsonSerialize(): array|object
{
return $this->toArray();
$result = $this->toArray();
return (0 !== count($result))
? $result
: (object)[];
}
protected function get(string $key, mixed $default = null): mixed