Added JsonSerializable on ActionCounts as well

This commit is contained in:
Kalle Fagerberg 2022-09-17 21:47:49 +02:00 committed by thrillfall
parent 5cc63b4582
commit 4138250370

View File

@ -3,7 +3,9 @@ declare(strict_types=1);
namespace OCA\GPodderSync\Core\PodcastData; namespace OCA\GPodderSync\Core\PodcastData;
class PodcastActionCounts { use JsonSerializable;
class PodcastActionCounts implements JsonSerializable {
private int $delete = 0; private int $delete = 0;
private int $download = 0; private int $download = 0;
private int $flattr = 0; private int $flattr = 0;
@ -23,9 +25,11 @@ class PodcastActionCounts {
} }
} }
/**
* @return array<string,int>
*/
public function toArray(): array { public function toArray(): array {
return return [
[
'delete' => $this->delete, 'delete' => $this->delete,
'download' => $this->download, 'download' => $this->download,
'flattr' => $this->flattr, 'flattr' => $this->flattr,
@ -33,4 +37,11 @@ class PodcastActionCounts {
'play' => $this->play, 'play' => $this->play,
]; ];
} }
/**
* @return array<string,int>
*/
public function jsonSerialize(): mixed {
return $this->toArray();
}
} }