* @license http://www.apache.org/licenses/LICENSE-2.0 * @package EPGService\Presenter */ final class ServicePresenter { /** * @var \EPGService\Environments\ServiceEnvironment */ private ServiceEnvironment$environment; /** * @param \EPGService\Environments\ServiceEnvironment $environment */ private function __construct(ServiceEnvironment $environment) { $this->environment = $environment; } /** * @param \EPGService\Environments\ServiceEnvironment $environment * * @return \EPGService\Presenter\ServicePresenter */ public static function create(ServiceEnvironment $environment): ServicePresenter { return new ServicePresenter($environment); } /** * @return \EPGService\Entities\CategoryEntity[] * * @throws \GuzzleHttp\Exception\GuzzleException * @throws \RuntimeException * @throws \Exception */ public function getCategories(): array { return CategoryRepository::create($this->environment)->get(); } /** * @return \EPGService\Entities\ChannelEntity[] * * @throws \GuzzleHttp\Exception\GuzzleException * @throws \RuntimeException * @throws \Exception */ public function getChannels(): array { return ChannelRepository::create($this->environment)->get(); } /** * @return \EPGService\Entities\GenreEntity[] * * @throws \GuzzleHttp\Exception\GuzzleException * @throws \RuntimeException * @throws \Exception */ public function getGenres(): array { return GenreRepository::create($this->environment)->get(); } /** * @param string $channel_id * @param string $week * * @return \EPGService\Entities\ProgramEntity[] * * @throws \GuzzleHttp\Exception\GuzzleException * @throws \RuntimeException * @throws \Exception */ public function getPrograms(string $channel_id, string $week): array { return ProgramRepository::create($this->environment, $channel_id, $week)->get(); } }