4
0
mirror of https://github.com/AzuraCast/AzuraCast.git synced 2024-06-14 05:06:37 +00:00

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

View File

@ -29,9 +29,13 @@ abstract class AbstractStationConfiguration implements JsonSerializable
return $return; 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 protected function get(string $key, mixed $default = null): mixed