From 4138250370b832d3170b46ba2ea6466be6d13763 Mon Sep 17 00:00:00 2001 From: Kalle Fagerberg Date: Sat, 17 Sep 2022 21:47:49 +0200 Subject: [PATCH] Added JsonSerializable on ActionCounts as well --- lib/Core/PodcastData/PodcastActionCounts.php | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/lib/Core/PodcastData/PodcastActionCounts.php b/lib/Core/PodcastData/PodcastActionCounts.php index 0da4e43..2683da8 100644 --- a/lib/Core/PodcastData/PodcastActionCounts.php +++ b/lib/Core/PodcastData/PodcastActionCounts.php @@ -3,7 +3,9 @@ declare(strict_types=1); namespace OCA\GPodderSync\Core\PodcastData; -class PodcastActionCounts { +use JsonSerializable; + +class PodcastActionCounts implements JsonSerializable { private int $delete = 0; private int $download = 0; private int $flattr = 0; @@ -23,9 +25,11 @@ class PodcastActionCounts { } } + /** + * @return array + */ public function toArray(): array { - return - [ + return [ 'delete' => $this->delete, 'download' => $this->download, 'flattr' => $this->flattr, @@ -33,4 +37,11 @@ class PodcastActionCounts { 'play' => $this->play, ]; } + + /** + * @return array + */ + public function jsonSerialize(): mixed { + return $this->toArray(); + } }