From 979f570f5ab8604533c776f14dd106d1ccaaaf67 Mon Sep 17 00:00:00 2001 From: nouser <> Date: Wed, 6 Oct 2021 16:48:02 +0200 Subject: [PATCH 1/5] Extended the network model to match all properties --- lib/Tmdb/Model/Network.php | 102 +++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) diff --git a/lib/Tmdb/Model/Network.php b/lib/Tmdb/Model/Network.php index 84f47ec5..8208cc8c 100644 --- a/lib/Tmdb/Model/Network.php +++ b/lib/Tmdb/Model/Network.php @@ -30,7 +30,12 @@ class Network extends AbstractModel public static $properties = [ 'id', 'name', + 'headquarters', + 'homepage', + 'logo_path', + 'origin_country' ]; + /** * @var integer */ @@ -39,6 +44,26 @@ class Network extends AbstractModel * @var string */ private $name; + /** + * @var string + */ + private $headquarters; + + /** + * @var string + */ + private $homepage; + + /** + * @var string|null + */ + private $logoPath; + + /** + * @var string + */ + private $originCountry; + /** * @return integer @@ -77,4 +102,81 @@ public function setName($name) return $this; } + + /** + * @return string + */ + public function getHeadquarters(): string + { + return $this->headquarters; + } + + /** + * @param string $headquarters + * @return Network + */ + public function setHeadquarters(string $headquarters): Network + { + $this->headquarters = $headquarters; + + return $this; + } + + /** + * @return string + */ + public function getHomepage(): string + { + return $this->homepage; + } + + /** + * @param string $homepage + * @return Network + */ + public function setHomepage(string $homepage): Network + { + $this->homepage = $homepage; + + return $this; + } + + /** + * @return string|null + */ + public function getLogoPath(): ?string + { + return $this->logoPath; + } + + /** + * @param string|null $logoPath + * @return Network + */ + public function setLogoPath(?string $logoPath): Network + { + $this->logoPath = $logoPath; + + return $this; + } + + /** + * @return string + */ + public function getOriginCountry(): string + { + return $this->originCountry; + } + + /** + * @param string $originCountry + * @return Network + */ + public function setOriginCountry(string $originCountry): Network + { + $this->originCountry = $originCountry; + + return $this; + } + } From a1fe153cadac533f14094a5ef69ccf9621beaa29 Mon Sep 17 00:00:00 2001 From: nouser <> Date: Wed, 6 Oct 2021 16:53:10 +0200 Subject: [PATCH 2/5] Extended the network model to match all properties --- lib/Tmdb/Model/Network.php | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/Tmdb/Model/Network.php b/lib/Tmdb/Model/Network.php index 8208cc8c..f09c1227 100644 --- a/lib/Tmdb/Model/Network.php +++ b/lib/Tmdb/Model/Network.php @@ -99,7 +99,6 @@ public function getName() public function setName($name) { $this->name = $name; - return $this; } From 78e7c65283f2ba7d5953ff025bc579c21ec5a1b6 Mon Sep 17 00:00:00 2001 From: nouser <> Date: Wed, 6 Oct 2021 19:49:17 +0200 Subject: [PATCH 3/5] Added support for episode groups --- lib/Tmdb/Api/Tv.php | 11 + lib/Tmdb/Api/TvEpisodeGroup.php | 47 ++++ lib/Tmdb/ApiMethodsTrait.php | 8 + lib/Tmdb/Factory/TvEpisodeGroupFactory.php | 85 +++++++ lib/Tmdb/Factory/TvEpisodeGroupsFactory.php | 99 ++++++++ lib/Tmdb/Factory/TvFactory.php | 22 +- lib/Tmdb/Model/Tv.php | 25 ++ lib/Tmdb/Model/Tv/Episode.php | 30 ++- lib/Tmdb/Model/Tv/EpisodeGroup.php | 238 ++++++++++++++++++ lib/Tmdb/Model/Tv/EpisodeGroups.php | 222 ++++++++++++++++ .../Tv/QueryParameter/AppendToResponse.php | 1 + lib/Tmdb/Model/Tv/TvEpisodeGroup.php | 189 ++++++++++++++ .../Repository/TvEpisodeGroupRepository.php | 83 ++++++ lib/Tmdb/Repository/TvRepository.php | 1 + test/Tmdb/Tests/Api/TvTest.php | 12 + 15 files changed, 1069 insertions(+), 4 deletions(-) create mode 100644 lib/Tmdb/Api/TvEpisodeGroup.php create mode 100644 lib/Tmdb/Factory/TvEpisodeGroupFactory.php create mode 100644 lib/Tmdb/Factory/TvEpisodeGroupsFactory.php create mode 100644 lib/Tmdb/Model/Tv/EpisodeGroup.php create mode 100644 lib/Tmdb/Model/Tv/EpisodeGroups.php create mode 100644 lib/Tmdb/Model/Tv/TvEpisodeGroup.php create mode 100644 lib/Tmdb/Repository/TvEpisodeGroupRepository.php diff --git a/lib/Tmdb/Api/Tv.php b/lib/Tmdb/Api/Tv.php index d86a317b..ea43d3e6 100644 --- a/lib/Tmdb/Api/Tv.php +++ b/lib/Tmdb/Api/Tv.php @@ -295,4 +295,15 @@ public function getAlternativeTitles($id) { return $this->get('tv/' . $id . '/alternative_titles'); } + + /** + * Get the alternative titles for a specific show ID. + * + * @param integer $id + * @return mixed + */ + public function getEpisodeGroups($id) + { + return $this->get('tv/' . $id . '/episode_groups'); + } } diff --git a/lib/Tmdb/Api/TvEpisodeGroup.php b/lib/Tmdb/Api/TvEpisodeGroup.php new file mode 100644 index 00000000..79e3fea6 --- /dev/null +++ b/lib/Tmdb/Api/TvEpisodeGroup.php @@ -0,0 +1,47 @@ +get( + sprintf( + 'tv/episode_group/%s', + $episode_group + ), + $parameters, + $headers + ); + } + +} diff --git a/lib/Tmdb/ApiMethodsTrait.php b/lib/Tmdb/ApiMethodsTrait.php index 5d79bcf9..aed724ae 100644 --- a/lib/Tmdb/ApiMethodsTrait.php +++ b/lib/Tmdb/ApiMethodsTrait.php @@ -207,4 +207,12 @@ public function getTvEpisodeApi() { return new Api\TvEpisode($this); } + + /** + * @return Api\TvEpisodeGroup + */ + public function getTvEpisodeGroupApi() + { + return new Api\TvEpisodeGroup($this); + } } diff --git a/lib/Tmdb/Factory/TvEpisodeGroupFactory.php b/lib/Tmdb/Factory/TvEpisodeGroupFactory.php new file mode 100644 index 00000000..f6db5b13 --- /dev/null +++ b/lib/Tmdb/Factory/TvEpisodeGroupFactory.php @@ -0,0 +1,85 @@ +tvEpisodeGroupsFactory = new TvEpisodeGroupsFactory($httpClient); + + parent::__construct($httpClient); + } + + /** + * {@inheritdoc} + */ + public function createCollection(array $data = []) + { + $collection = new GenericCollection(); + + foreach ($data as $item) { + $collection->add(null, $this->create($item)); + } + + return $collection; + } + + /** + * {@inheritdoc} + * + * @return AbstractModel|null + */ + public function create(array $data = []): ?AbstractModel + { + if (!$data) { + return null; + } + + $episodeGroup = new EpisodeGroup(); + + if(array_key_exists('network', $data) && !is_null($data['network'])){ + $episodeGroup->setNetwork($this->hydrate(new Network(), $data['network'])); + } + + if (array_key_exists('groups', $data) && $data['groups'] !== null) { + $episodeGroup->setGroups($this->tvEpisodeGroupsFactory->createCollection($data['groups'])); + } + + return $this->hydrate($episodeGroup, $data); + } + +} diff --git a/lib/Tmdb/Factory/TvEpisodeGroupsFactory.php b/lib/Tmdb/Factory/TvEpisodeGroupsFactory.php new file mode 100644 index 00000000..3fdddb12 --- /dev/null +++ b/lib/Tmdb/Factory/TvEpisodeGroupsFactory.php @@ -0,0 +1,99 @@ +tvEpisodeFactory = new TvEpisodeFactory($httpClient); + + parent::__construct($httpClient); + } + + /** + * {@inheritdoc} + */ + public function createCollection(array $data = []) + { + $collection = new GenericCollection(); + + foreach ($data as $item) { + $collection->add(null, $this->create($item)); + } + + return $collection; + } + + /** + * {@inheritdoc} + * + * @return AbstractModel|null + */ + public function create(array $data = []): ?AbstractModel + { + if (!$data) { + return null; + } + + $tvEpisodeGroup = new TvEpisodeGroup(); + + /** Episodes */ + if (array_key_exists('episodes', $data) && $data['episodes'] !== null) { + $tvEpisodeGroup->setEpisodes($this->getTvEpisodeFactory()->createCollection($data['episodes'])); + } + + return $this->hydrate($tvEpisodeGroup, $data); + } + + /** + * @return TvEpisodeFactory + */ + public function getTvEpisodeFactory() + { + return $this->tvEpisodeFactory; + } + + /** + * @param TvEpisodeFactory $tvEpisodeFactory + * @return $this + */ + public function setTvEpisodeFactory($tvEpisodeFactory) + { + $this->tvEpisodeFactory = $tvEpisodeFactory; + + return $this; + } +} diff --git a/lib/Tmdb/Factory/TvFactory.php b/lib/Tmdb/Factory/TvFactory.php index 911ef4b5..6b63ed13 100644 --- a/lib/Tmdb/Factory/TvFactory.php +++ b/lib/Tmdb/Factory/TvFactory.php @@ -26,6 +26,7 @@ use Tmdb\Model\Common\SpokenLanguage; use Tmdb\Model\Common\Translation; use Tmdb\Model\Company; +use Tmdb\Model\Network; use Tmdb\Model\Person\CastMember; use Tmdb\Model\Person\CrewMember; use Tmdb\Model\Tv; @@ -249,7 +250,7 @@ public function create(array $data = []): ?AbstractModel $watchProviders = new GenericCollection(); foreach ($data['watch/providers']['results'] as $iso31661 => $countryWatchData) { $countryWatchData['iso_3166_1'] = $iso31661; - + foreach (['flatrate', 'rent', 'buy'] as $providerType) { $typeProviders = new GenericCollection(); foreach ($countryWatchData[$providerType] ?? [] as $providerData) { @@ -259,14 +260,14 @@ public function create(array $data = []): ?AbstractModel if (isset($providerData['provider_name'])) { $providerData['name'] = $providerData['provider_name']; } - + $providerData['iso_3166_1'] = $iso31661; $providerData['type'] = $providerType; $typeProviders->add(null, $this->hydrate(new Watch\Provider(), $providerData)); } $countryWatchData[$providerType] = $typeProviders; } - + $watchProviders->add($iso31661, $this->hydrate(new Watch\Providers(), $countryWatchData)); } $tvShow->setWatchProviders($watchProviders); @@ -343,6 +344,21 @@ public function create(array $data = []): ?AbstractModel ); } + if (array_key_exists('episode_groups', $data) && array_key_exists('results', $data['episode_groups'])) { + $episodeGroupCollection = new GenericCollection(); + + foreach ($data['episode_groups']['results'] as $episodeGroup) { + + + if(!is_null($episodeGroup['network'])){ + $episodeGroup['network'] = $this->hydrate(new Network(), $episodeGroup['network']); + } + + $episodeGroupCollection->add(null, $this->hydrate(new Tv\EpisodeGroups(), $episodeGroup)); + } + $tvShow->setEpisodeGroups($episodeGroupCollection); + } + return $this->hydrate($tvShow, $data); } diff --git a/lib/Tmdb/Model/Tv.php b/lib/Tmdb/Model/Tv.php index f5562c72..a2f17a2b 100644 --- a/lib/Tmdb/Model/Tv.php +++ b/lib/Tmdb/Model/Tv.php @@ -238,6 +238,10 @@ class Tv extends AbstractModel * @var GenericCollection */ private $watchProviders; + /** + * @var GenericCollection + */ + protected $episodeGroups; /** * Constructor @@ -263,6 +267,7 @@ public function __construct() $this->alternativeTitles = new GenericCollection(); $this->languages = new GenericCollection(); $this->watchProviders = new GenericCollection(); + $this->episodeGroups = new GenericCollection(); } /** @@ -1069,4 +1074,24 @@ public function setWatchProviders($watchProviders) return $this; } + + /** + * @return GenericCollection + */ + public function getEpisodeGroups(): GenericCollection + { + return $this->episodeGroups; + } + + /** + * @param GenericCollection $episodeGroups + * @return Tv + */ + public function setEpisodeGroups(GenericCollection $episodeGroups): Tv + { + $this->episodeGroups = $episodeGroups; + + return $this; + } + } diff --git a/lib/Tmdb/Model/Tv/Episode.php b/lib/Tmdb/Model/Tv/Episode.php index 0b2fa57f..72e89905 100644 --- a/lib/Tmdb/Model/Tv/Episode.php +++ b/lib/Tmdb/Model/Tv/Episode.php @@ -49,7 +49,8 @@ class Episode extends AbstractModel 'season_number', 'still_path', 'vote_average', - 'vote_count' + 'vote_count', + 'show_id' ]; /** * Credits @@ -137,6 +138,13 @@ class Episode extends AbstractModel */ private $voteCount; + /** + * Only available in episode group + * + * @var integer + */ + private $showId; + /** * Constructor */ @@ -476,4 +484,24 @@ public function setChanges($changes) return $this; } + + /** + * @return int + */ + public function getShowId(): int + { + return $this->showId; + } + + /** + * @param int $showId + * @return Episode + */ + public function setShowId(int $showId): Episode + { + $this->showId = $showId; + + return $this; + } + } diff --git a/lib/Tmdb/Model/Tv/EpisodeGroup.php b/lib/Tmdb/Model/Tv/EpisodeGroup.php new file mode 100644 index 00000000..b75c9dd8 --- /dev/null +++ b/lib/Tmdb/Model/Tv/EpisodeGroup.php @@ -0,0 +1,238 @@ +description; + } + + /** + * @param string $description + * @return EpisodeGroup + */ + public function setDescription(string $description): EpisodeGroup + { + $this->description = $description; + + return $this; + } + + /** + * @return int + */ + public function getEpisodeCount(): int + { + return $this->episodeCount; + } + + /** + * @param int $episodeCount + * @return EpisodeGroup + */ + public function setEpisodeCount(int $episodeCount): EpisodeGroup + { + $this->episodeCount = $episodeCount; + + return $this; + } + + /** + * @return int + */ + public function getGroupCount(): int + { + return $this->groupCount; + } + + /** + * @param int $groupCount + * @return EpisodeGroup + */ + public function setGroupCount(int $groupCount): EpisodeGroup + { + $this->groupCount = $groupCount; + + return $this; + } + + /** + * @return string + */ + public function getId(): string + { + return $this->id; + } + + /** + * @param string $id + * @return EpisodeGroup + */ + public function setId(string $id): EpisodeGroup + { + $this->id = $id; + + return $this; + } + + /** + * @return string + */ + public function getName(): string + { + return $this->name; + } + + /** + * @param string $name + * @return EpisodeGroup + */ + public function setName(string $name): EpisodeGroup + { + $this->name = $name; + + return $this; + } + + /** + * @return Network|null + */ + public function getNetwork(): ?Network + { + return $this->network; + } + + /** + * @param Network|null $network + * @return EpisodeGroup + */ + public function setNetwork(?Network $network): EpisodeGroup + { + $this->network = $network; + + return $this; + } + + /** + * @return int + */ + public function getType(): int + { + return $this->type; + } + + /** + * @param int $type + * @return EpisodeGroup + */ + public function setType(int $type): EpisodeGroup + { + $this->type = $type; + + return $this; + } + + /** + * @return GenericCollection + */ + public function getGroups(): GenericCollection + { + return $this->groups; + } + + /** + * @param GenericCollection $groups + * @return EpisodeGroup + */ + public function setGroups(GenericCollection $groups): EpisodeGroup + { + $this->groups = $groups; + + return $this; + } + + +} diff --git a/lib/Tmdb/Model/Tv/EpisodeGroups.php b/lib/Tmdb/Model/Tv/EpisodeGroups.php new file mode 100644 index 00000000..fcbaad2f --- /dev/null +++ b/lib/Tmdb/Model/Tv/EpisodeGroups.php @@ -0,0 +1,222 @@ +description; + } + + /** + * @param string $description + * @return EpisodeGroups + */ + public function setDescription(string $description): EpisodeGroups + { + $this->description = $description; + + return $this; + } + + /** + * @return int + */ + public function getEpisodeCount(): int + { + return $this->episodeCount; + } + + /** + * @param int $episodeCount + * @return EpisodeGroups + */ + public function setEpisodeCount(int $episodeCount): EpisodeGroups + { + $this->episodeCount = $episodeCount; + + return $this; + } + + /** + * @return int + */ + public function getGroupCount(): int + { + return $this->groupCount; + } + + /** + * @param int $groupCount + * @return EpisodeGroups + */ + public function setGroupCount(int $groupCount): EpisodeGroups + { + $this->groupCount = $groupCount; + + return $this; + } + + /** + * @return string + */ + public function getId(): string + { + return $this->id; + } + + /** + * @param string $id + * @return EpisodeGroups + */ + public function setId(string $id): EpisodeGroups + { + $this->id = $id; + + return $this; + } + + /** + * @return string + */ + public function getName(): string + { + return $this->name; + } + + /** + * @param string $name + * @return EpisodeGroups + */ + public function setName(string $name): EpisodeGroups + { + $this->name = $name; + + return $this; + } + + /** + * @return Network|null + */ + public function getNetwork(): ?Network + { + return $this->network; + } + + /** + * @param Network|null $network + * @return EpisodeGroups + */ + public function setNetwork(?Network $network): EpisodeGroups + { + $this->network = $network; + + return $this; + } + + /** + * @return int + */ + public function getType(): int + { + return $this->type; + } + + /** + * @param int $type + * @return EpisodeGroups + */ + public function setType(int $type): EpisodeGroups + { + $this->type = $type; + + return $this; + } + +} diff --git a/lib/Tmdb/Model/Tv/QueryParameter/AppendToResponse.php b/lib/Tmdb/Model/Tv/QueryParameter/AppendToResponse.php index ca0bffeb..00b0511f 100644 --- a/lib/Tmdb/Model/Tv/QueryParameter/AppendToResponse.php +++ b/lib/Tmdb/Model/Tv/QueryParameter/AppendToResponse.php @@ -34,4 +34,5 @@ class AppendToResponse extends BaseAppendToResponse public const CONTENT_RATINGS = 'content_ratings'; public const ALTERNATIVE_TITLES = 'alternative_titles'; public const WATCH_PROVIDERS = 'watch/providers'; + public const EPISODE_GROUPS = 'episode_groups'; } diff --git a/lib/Tmdb/Model/Tv/TvEpisodeGroup.php b/lib/Tmdb/Model/Tv/TvEpisodeGroup.php new file mode 100644 index 00000000..008e76e2 --- /dev/null +++ b/lib/Tmdb/Model/Tv/TvEpisodeGroup.php @@ -0,0 +1,189 @@ +episodes = new GenericCollection(); + } + + /** + * @return string + */ + public function getId(): string + { + return $this->id; + } + + /** + * @param string $id + * @return TvEpisodeGroup + */ + public function setId(string $id): TvEpisodeGroup + { + $this->id = $id; + + return $this; + } + + /** + * @return string + */ + public function getName(): string + { + return $this->name; + } + + /** + * @param string $name + * @return TvEpisodeGroup + */ + public function setName(string $name): TvEpisodeGroup + { + $this->name = $name; + + return $this; + } + + /** + * @return Network|null + */ + public function getNetwork(): ?Network + { + return $this->network; + } + + /** + * @param Network|null $network + * @return TvEpisodeGroup + */ + public function setNetwork(?Network $network): TvEpisodeGroup + { + $this->network = $network; + + return $this; + } + + /** + * @return bool + */ + public function isLocked(): bool + { + return $this->locked; + } + + /** + * @param bool $locked + * @return TvEpisodeGroup + */ + public function setLocked(bool $locked): TvEpisodeGroup + { + $this->locked = $locked; + + return $this; + } + + /** + * @return GenericCollection + */ + public function getEpisodes(): GenericCollection + { + return $this->episodes; + } + + /** + * @param GenericCollection $episodes + * @return TvEpisodeGroup + */ + public function setEpisodes(GenericCollection $episodes): TvEpisodeGroup + { + $this->episodes = $episodes; + + return $this; + } + + /** + * @return int + */ + public function getOrder(): int + { + return $this->order; + } + + /** + * @param int $order + * @return TvEpisodeGroup + */ + public function setOrder(int $order): TvEpisodeGroup + { + $this->order = $order; + + return $this; + } +} diff --git a/lib/Tmdb/Repository/TvEpisodeGroupRepository.php b/lib/Tmdb/Repository/TvEpisodeGroupRepository.php new file mode 100644 index 00000000..118b645d --- /dev/null +++ b/lib/Tmdb/Repository/TvEpisodeGroupRepository.php @@ -0,0 +1,83 @@ +getApi()->getEpisodeGroup( + $episode_group_id, + $this->parseQueryParameters($parameters), + $headers + ); + + return $this->getFactory()->create($data); + } + + /** + * Return the Seasons API Class + * + * @return TvEpisodeGroup + */ + public function getApi() + { + return $this->getClient()->getTvEpisodeGroupApi(); + } + + /** + * @return TvEpisodeGroupFactory + */ + public function getFactory() + { + return new TvEpisodeGroupFactory($this->getClient()->getHttpClient()); + } + +} diff --git a/lib/Tmdb/Repository/TvRepository.php b/lib/Tmdb/Repository/TvRepository.php index 9380154f..86fbb846 100644 --- a/lib/Tmdb/Repository/TvRepository.php +++ b/lib/Tmdb/Repository/TvRepository.php @@ -62,6 +62,7 @@ public function load($id, array $parameters = [], array $headers = []) AppendToResponse::ALTERNATIVE_TITLES, AppendToResponse::VIDEOS, AppendToResponse::WATCH_PROVIDERS, + AppendToResponse::EPISODE_GROUPS, ]) ]); } diff --git a/test/Tmdb/Tests/Api/TvTest.php b/test/Tmdb/Tests/Api/TvTest.php index 386b1f65..72ccb161 100644 --- a/test/Tmdb/Tests/Api/TvTest.php +++ b/test/Tmdb/Tests/Api/TvTest.php @@ -232,6 +232,18 @@ public function shouldGetWatchProviders() $this->assertLastRequestIsWithPathAndMethod('/3/tv/' . self::TV_ID . '/watch/providers'); } + /** + * @test + */ + public function shouldGetEpisodeGroups() + { + $api = $this->getApiWithMockedHttpAdapter(); + + $api->getEpisodeGroups(self::TV_ID); + $this->assertLastRequestIsWithPathAndMethod('/3/tv/' . self::TV_ID . '/episode_groups'); + } + + protected function getApiClass() { return 'Tmdb\Api\Tv'; From a8adade2a15eb64a1301a61edef2719f39c9f2c4 Mon Sep 17 00:00:00 2001 From: Michael Roterman Date: Sat, 11 Dec 2021 15:17:47 +0100 Subject: [PATCH 4/5] Fix unit tests for TvRepository --- test/Tmdb/Tests/Repository/TvRepositoryTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Tmdb/Tests/Repository/TvRepositoryTest.php b/test/Tmdb/Tests/Repository/TvRepositoryTest.php index e5357029..93f09801 100644 --- a/test/Tmdb/Tests/Repository/TvRepositoryTest.php +++ b/test/Tmdb/Tests/Repository/TvRepositoryTest.php @@ -28,7 +28,7 @@ public function shouldLoadTv() $repository->load(self::TV_ID); $this->assertLastRequestIsWithPathAndMethod('/3/tv/' . self::TV_ID); $this->assertRequestHasQueryParameters( - ['append_to_response' => 'credits,external_ids,images,translations,similar,recommendations,keywords,changes,content_ratings,alternative_titles,videos,watch/providers'] + ['append_to_response' => 'credits,external_ids,images,translations,similar,recommendations,keywords,changes,content_ratings,alternative_titles,videos,watch/providers,episode_groups'] ); } From 55f849557d304a413d99ff00b5c61de4faddd84d Mon Sep 17 00:00:00 2001 From: Michael Roterman Date: Sat, 11 Dec 2021 15:22:13 +0100 Subject: [PATCH 5/5] Fix PHPCS --- lib/Tmdb/Api/TvEpisodeGroup.php | 1 - lib/Tmdb/Factory/MovieFactory.php | 6 +++--- lib/Tmdb/Factory/TvEpisodeGroupFactory.php | 3 +-- lib/Tmdb/Factory/TvFactory.php | 4 +--- lib/Tmdb/Model/Network.php | 1 - lib/Tmdb/Model/Tv.php | 1 - lib/Tmdb/Model/Tv/Episode.php | 1 - lib/Tmdb/Model/Tv/EpisodeGroup.php | 3 --- lib/Tmdb/Model/Tv/EpisodeGroups.php | 2 -- lib/Tmdb/Model/Watch/Providers.php | 2 +- lib/Tmdb/Repository/TvEpisodeGroupRepository.php | 1 - 11 files changed, 6 insertions(+), 19 deletions(-) diff --git a/lib/Tmdb/Api/TvEpisodeGroup.php b/lib/Tmdb/Api/TvEpisodeGroup.php index 79e3fea6..76b111e2 100644 --- a/lib/Tmdb/Api/TvEpisodeGroup.php +++ b/lib/Tmdb/Api/TvEpisodeGroup.php @@ -43,5 +43,4 @@ public function getEpisodeGroup( $headers ); } - } diff --git a/lib/Tmdb/Factory/MovieFactory.php b/lib/Tmdb/Factory/MovieFactory.php index e937ea5f..c8d0bf3c 100644 --- a/lib/Tmdb/Factory/MovieFactory.php +++ b/lib/Tmdb/Factory/MovieFactory.php @@ -211,7 +211,7 @@ public function create(array $data = []): ?AbstractModel $watchProviders = new GenericCollection(); foreach ($data['watch/providers']['results'] as $iso31661 => $countryWatchData) { $countryWatchData['iso_3166_1'] = $iso31661; - + foreach (['flatrate', 'rent', 'buy'] as $providerType) { $typeProviders = new GenericCollection(); foreach ($countryWatchData[$providerType] ?? [] as $providerData) { @@ -221,14 +221,14 @@ public function create(array $data = []): ?AbstractModel if (isset($providerData['provider_name'])) { $providerData['name'] = $providerData['provider_name']; } - + $providerData['iso_3166_1'] = $iso31661; $providerData['type'] = $providerType; $typeProviders->add(null, $this->hydrate(new Watch\Provider(), $providerData)); } $countryWatchData[$providerType] = $typeProviders; } - + $watchProviders->add($iso31661, $this->hydrate(new Watch\Providers(), $countryWatchData)); } $movie->setWatchProviders($watchProviders); diff --git a/lib/Tmdb/Factory/TvEpisodeGroupFactory.php b/lib/Tmdb/Factory/TvEpisodeGroupFactory.php index f6db5b13..4a59aca6 100644 --- a/lib/Tmdb/Factory/TvEpisodeGroupFactory.php +++ b/lib/Tmdb/Factory/TvEpisodeGroupFactory.php @@ -71,7 +71,7 @@ public function create(array $data = []): ?AbstractModel $episodeGroup = new EpisodeGroup(); - if(array_key_exists('network', $data) && !is_null($data['network'])){ + if (array_key_exists('network', $data) && !is_null($data['network'])) { $episodeGroup->setNetwork($this->hydrate(new Network(), $data['network'])); } @@ -81,5 +81,4 @@ public function create(array $data = []): ?AbstractModel return $this->hydrate($episodeGroup, $data); } - } diff --git a/lib/Tmdb/Factory/TvFactory.php b/lib/Tmdb/Factory/TvFactory.php index 6b63ed13..3de92381 100644 --- a/lib/Tmdb/Factory/TvFactory.php +++ b/lib/Tmdb/Factory/TvFactory.php @@ -348,9 +348,7 @@ public function create(array $data = []): ?AbstractModel $episodeGroupCollection = new GenericCollection(); foreach ($data['episode_groups']['results'] as $episodeGroup) { - - - if(!is_null($episodeGroup['network'])){ + if (!is_null($episodeGroup['network'])) { $episodeGroup['network'] = $this->hydrate(new Network(), $episodeGroup['network']); } diff --git a/lib/Tmdb/Model/Network.php b/lib/Tmdb/Model/Network.php index f09c1227..1e0e53a1 100644 --- a/lib/Tmdb/Model/Network.php +++ b/lib/Tmdb/Model/Network.php @@ -177,5 +177,4 @@ public function setOriginCountry(string $originCountry): Network return $this; } - } diff --git a/lib/Tmdb/Model/Tv.php b/lib/Tmdb/Model/Tv.php index a2f17a2b..2d05eef5 100644 --- a/lib/Tmdb/Model/Tv.php +++ b/lib/Tmdb/Model/Tv.php @@ -1093,5 +1093,4 @@ public function setEpisodeGroups(GenericCollection $episodeGroups): Tv return $this; } - } diff --git a/lib/Tmdb/Model/Tv/Episode.php b/lib/Tmdb/Model/Tv/Episode.php index 72e89905..937ff146 100644 --- a/lib/Tmdb/Model/Tv/Episode.php +++ b/lib/Tmdb/Model/Tv/Episode.php @@ -503,5 +503,4 @@ public function setShowId(int $showId): Episode return $this; } - } diff --git a/lib/Tmdb/Model/Tv/EpisodeGroup.php b/lib/Tmdb/Model/Tv/EpisodeGroup.php index b75c9dd8..5f77b367 100644 --- a/lib/Tmdb/Model/Tv/EpisodeGroup.php +++ b/lib/Tmdb/Model/Tv/EpisodeGroup.php @@ -79,7 +79,6 @@ class EpisodeGroup extends AbstractModel */ public function __construct() { - } /** @@ -233,6 +232,4 @@ public function setGroups(GenericCollection $groups): EpisodeGroup return $this; } - - } diff --git a/lib/Tmdb/Model/Tv/EpisodeGroups.php b/lib/Tmdb/Model/Tv/EpisodeGroups.php index fcbaad2f..210ab3e7 100644 --- a/lib/Tmdb/Model/Tv/EpisodeGroups.php +++ b/lib/Tmdb/Model/Tv/EpisodeGroups.php @@ -83,7 +83,6 @@ class EpisodeGroups extends AbstractModel */ public function __construct() { - } /** @@ -218,5 +217,4 @@ public function setType(int $type): EpisodeGroups return $this; } - } diff --git a/lib/Tmdb/Model/Watch/Providers.php b/lib/Tmdb/Model/Watch/Providers.php index 3dec27ff..109478ce 100644 --- a/lib/Tmdb/Model/Watch/Providers.php +++ b/lib/Tmdb/Model/Watch/Providers.php @@ -36,7 +36,7 @@ class Providers extends AbstractModel implements CountryFilter private $flatrate; private $rent; private $buy; - + /** * Constructor * diff --git a/lib/Tmdb/Repository/TvEpisodeGroupRepository.php b/lib/Tmdb/Repository/TvEpisodeGroupRepository.php index 118b645d..deade20d 100644 --- a/lib/Tmdb/Repository/TvEpisodeGroupRepository.php +++ b/lib/Tmdb/Repository/TvEpisodeGroupRepository.php @@ -79,5 +79,4 @@ public function getFactory() { return new TvEpisodeGroupFactory($this->getClient()->getHttpClient()); } - }