From b95c97fc07bee5c4bcb5d582d8aff9991922aaa1 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Sat, 18 Jul 2020 16:04:57 +0400 Subject: Added presenter Signed-off-by: Valentin Popov --- src/Presenter/ServicePresenter.php | 92 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 src/Presenter/ServicePresenter.php diff --git a/src/Presenter/ServicePresenter.php b/src/Presenter/ServicePresenter.php new file mode 100644 index 0000000..f5b1e61 --- /dev/null +++ b/src/Presenter/ServicePresenter.php @@ -0,0 +1,92 @@ + + * @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; + } + + /** + * @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(); + } +} -- cgit v1.2.3