url = $url; $this->actionCounts = $actionCounts ?? new PodcastActionCounts; $this->listenedSeconds = $listenedSeconds; $this->podcastData = $podcastData; } /** * @return string */ public function getUrl(): string { return $this->url; } /** * @return PodcastActionCounts */ public function getActionCounts(): PodcastActionCounts { return $this->actionCounts; } /** * @return int */ public function getListenedSeconds(): int { return $this->listenedSeconds; } /** * @param int $seconds */ public function addListenedSeconds(int $seconds): void { $this->listenedSeconds += $seconds; } /** * @return PodcastData|null */ public function getPodcastData(): ?PodcastData { return $this->podcastData; } /** * @return array */ public function toArray(): array { return [ 'url' => $this->url, 'listenedSeconds' => $this->listenedSeconds, 'actionCounts' => $this->actionCounts->toArray(), 'podcastData' => $this->podcastData->toArray(), ]; } /** * @return array */ public function jsonSerialize(): mixed { return $this->toArray(); } }