From 3fed1d0cae772a90851fc2f32a591c53acd7d6af Mon Sep 17 00:00:00 2001 From: ihsudg Date: Thu, 27 Jul 2023 13:34:40 +0200 Subject: [PATCH 1/6] TV Season: add translation --- lib/Tmdb/Api/TvSeason.php | 17 + lib/Tmdb/Factory/TvSeasonFactory.php | 12 +- lib/Tmdb/Model/Tv/Season.php | 30 +- lib/Tmdb/Repository/TvSeasonRepository.php | 33 +- test/Tmdb/Tests/Api/TvSeasonTest.php | 11 + .../Tests/Factory/TvSeasonFactoryTest.php | 10 +- test/Tmdb/Tests/Model/Tv/SeasonTest.php | 1 + .../Repository/TvSeasonRepositoryTest.php | 17 + test/Tmdb/Tests/Resources/tv/season/all.json | 426 +++++++++++++++++- 9 files changed, 544 insertions(+), 13 deletions(-) diff --git a/lib/Tmdb/Api/TvSeason.php b/lib/Tmdb/Api/TvSeason.php index 61ebad47..ceea3069 100644 --- a/lib/Tmdb/Api/TvSeason.php +++ b/lib/Tmdb/Api/TvSeason.php @@ -107,4 +107,21 @@ public function getChanges($tvshow_id, $season_number, array $parameters = [], a { return $this->get(sprintf('tv/%s/season/%s/changes', $tvshow_id, $season_number), $parameters, $headers); } + + /** + * Look up a TV season's changes by season ID. + * This method is used in conjunction with the /tv/{id}/changes method. + * + * This method uses the season_id value found in the change entries. + * + * @param integer $tvshow_id + * @param integer $season_number + * @param array $parameters + * @param array $headers + * @return mixed + */ + public function getTranslations($tvshow_id, $season_number, array $parameters = [], array $headers = []) + { + return $this->get(sprintf('tv/%s/season/%s/translations', $tvshow_id, $season_number), $parameters, $headers); + } } diff --git a/lib/Tmdb/Factory/TvSeasonFactory.php b/lib/Tmdb/Factory/TvSeasonFactory.php index e2a92db6..ba883419 100644 --- a/lib/Tmdb/Factory/TvSeasonFactory.php +++ b/lib/Tmdb/Factory/TvSeasonFactory.php @@ -22,13 +22,13 @@ use Tmdb\Model\AbstractModel; use Tmdb\Model\Common\ExternalIds; use Tmdb\Model\Common\GenericCollection; +use Tmdb\Model\Common\Translation; use Tmdb\Model\Person\CastMember; use Tmdb\Model\Person\CrewMember; use Tmdb\Model\Tv\Season; /** * Class TvSeasonFactory - * @extends AbstractFactory * @package Tmdb\Factory */ class TvSeasonFactory extends AbstractFactory @@ -85,7 +85,6 @@ public function __construct(HttpClient $httpClient) */ public function createCollection(array $data = []) { - /** @var GenericCollection */ $collection = new GenericCollection(); foreach ($data as $item) { @@ -157,6 +156,15 @@ public function create(array $data = []): ?Season $tvSeason->setChanges($this->getChangesFactory()->createCollection($data['changes'])); } + if (array_key_exists('translations', $data) && $data['translations'] !== null) { + $tvSeason->setTranslations( + $this->createGenericCollection( + $data['translations']['translations'] ?? [], + new Translation() + ) + ); + } + return $this->hydrate($tvSeason, $data); } diff --git a/lib/Tmdb/Model/Tv/Season.php b/lib/Tmdb/Model/Tv/Season.php index 2941f38e..0b5cd541 100644 --- a/lib/Tmdb/Model/Tv/Season.php +++ b/lib/Tmdb/Model/Tv/Season.php @@ -22,6 +22,7 @@ use Tmdb\Model\Collection\Videos; use Tmdb\Model\Common\ExternalIds; use Tmdb\Model\Common\GenericCollection; +use Tmdb\Model\Common\Translation; use Tmdb\Model\Image\PosterImage; /** @@ -38,6 +39,7 @@ class Season extends AbstractModel * @var array */ public static $properties = [ + 'adult', 'air_date', 'name', 'overview', @@ -75,6 +77,10 @@ class Season extends AbstractModel * @var Changes */ protected $changes; + /** + * @var GenericCollection|Translation[] + */ + protected $translations; /** * @var DateTime */ @@ -115,6 +121,7 @@ public function __construct() $this->episodes = new GenericCollection(); $this->videos = new Videos(); $this->changes = new Changes(); + $this->translations = new GenericCollection(); } /** @@ -126,7 +133,7 @@ public function getAirDate() } /** - * @param string $airDate + * @param DateTime $airDate * @return self */ public function setAirDate($airDate) @@ -319,7 +326,7 @@ public function setPosterImage($poster) } /** - * @return ?PosterImage + * @return PosterImage */ public function getPosterImage() { @@ -363,4 +370,23 @@ public function setChanges($changes) return $this; } + + /** + * @return GenericCollection + */ + public function getTranslations(): GenericCollection + { + return $this->translations; + } + + /** + * @param GenericCollection $changes + * @return self + */ + public function setTranslations($changes) + { + $this->translations = $changes; + + return $this; + } } diff --git a/lib/Tmdb/Repository/TvSeasonRepository.php b/lib/Tmdb/Repository/TvSeasonRepository.php index 4354947c..f7b5bc8c 100644 --- a/lib/Tmdb/Repository/TvSeasonRepository.php +++ b/lib/Tmdb/Repository/TvSeasonRepository.php @@ -18,8 +18,6 @@ use Tmdb\Exception\RuntimeException; use Tmdb\Factory\TvSeasonFactory; use Tmdb\Model\AbstractModel; -use Tmdb\Model\Collection\CreditsCollection; -use Tmdb\Model\Collection\Images; use Tmdb\Model\Collection\Videos; use Tmdb\Model\Common\Video; use Tmdb\Model\Tv; @@ -100,10 +98,10 @@ public function getFactory() * Just like the website, we pull this information from the last season of the series. * * @param Tv|int $tvShow - * @param Season|int $season + * @param TvSeason|int $season * @param array $parameters * @param array $headers - * @return CreditsCollection + * @return null|AbstractModel */ public function getCredits($tvShow, $season, array $parameters = [], array $headers = []) { @@ -153,7 +151,7 @@ public function getExternalIds($tvShow, $season, array $parameters = [], array $ * @param $season * @param $parameters * @param $headers - * @return Images + * @return null|AbstractModel */ public function getImages($tvShow, $season, array $parameters = [], array $headers = []) { @@ -195,4 +193,29 @@ public function getVideos($tvShow, $season, array $parameters = [], array $heade return $season->getVideos(); } + + /** + * Get the videos that have been added to a TV season (trailers, teasers, etc...) + * + * @param $tvShow + * @param $season + * @param $parameters + * @param $headers + * @return Videos|Video[] + */ + public function getTranslations($tvShow, $season, array $parameters = [], array $headers = []) + { + if ($tvShow instanceof Tv) { + $tvShow = $tvShow->getId(); + } + + if ($season instanceof Season) { + $season = $season->getSeasonNumber(); + } + + $data = $this->getApi()->getTranslations($tvShow, $season, $this->parseQueryParameters($parameters), $headers); + $season = $this->getFactory()->create(['translations' => $data]); + + return $season->getTranslations(); + } } diff --git a/test/Tmdb/Tests/Api/TvSeasonTest.php b/test/Tmdb/Tests/Api/TvSeasonTest.php index 330809dd..20b04d49 100644 --- a/test/Tmdb/Tests/Api/TvSeasonTest.php +++ b/test/Tmdb/Tests/Api/TvSeasonTest.php @@ -87,6 +87,17 @@ public function shouldGetSeasonChanges() $this->assertLastRequestIsWithPathAndMethod('/3/tv/' . self::TV_ID . '/season/' . self::SEASON_ID . '/changes'); } + /** + * @test + */ + public function shouldGetSeasonTranslations() + { + $api = $this->getApiWithMockedHttpAdapter(); + + $api->getTranslations(self::TV_ID, self::SEASON_ID); + $this->assertLastRequestIsWithPathAndMethod('/3/tv/' . self::TV_ID . '/season/' . self::SEASON_ID . '/translations'); + } + protected function getApiClass() { return 'Tmdb\Api\TvSeason'; diff --git a/test/Tmdb/Tests/Factory/TvSeasonFactoryTest.php b/test/Tmdb/Tests/Factory/TvSeasonFactoryTest.php index de9300ed..bfe54695 100644 --- a/test/Tmdb/Tests/Factory/TvSeasonFactoryTest.php +++ b/test/Tmdb/Tests/Factory/TvSeasonFactoryTest.php @@ -30,10 +30,10 @@ public function setUp(): void * @var TvSeasonFactory $factory */ $factory = $this->getFactory(); - $data = $this->loadByFile('tv/season/all.json'); + $data = $this->loadByFile('tv/season/all.json'); /** - * @var Season $this->season + * @var Season $this- >season */ $this->season = $factory->create($data); } @@ -52,6 +52,7 @@ public function shouldConstructTvSeason() $this->assertInstanceOf('Tmdb\Model\Collection\Images', $this->season->getImages()); $this->assertInstanceOf('Tmdb\Model\Common\GenericCollection', $this->season->getEpisodes()); $this->assertInstanceOf('Tmdb\Model\Image\PosterImage', $this->season->getPosterImage()); + $this->assertInstanceOf('Tmdb\Model\Common\GenericCollection', $this->season->getTranslations()); } /** @@ -88,7 +89,10 @@ public function shouldBeFunctional() $this->assertEquals(3573, $this->season->getId()); $this->assertEquals('/rCdISteF1GPvPsy0a5L0LDffjtP.jpg', $this->season->getPosterPath()); $this->assertEquals(2, $this->season->getSeasonNumber()); - } + $this->assertEquals("Sein Ruf eilt dem zum Meth-Dealer gewordenen Lehrer Walter voraus – das erregt die Aufmerksamkeit rivalisierender Kartelle und gefährdet seinen Schwager, einen Drogencop.", + $this->season->getTranslations()->filterLanguage('de')->getIterator()->current()->getData()['overview'] + ); +} protected function getFactoryClass() { diff --git a/test/Tmdb/Tests/Model/Tv/SeasonTest.php b/test/Tmdb/Tests/Model/Tv/SeasonTest.php index 3e762ec6..528ed3cd 100644 --- a/test/Tmdb/Tests/Model/Tv/SeasonTest.php +++ b/test/Tmdb/Tests/Model/Tv/SeasonTest.php @@ -35,6 +35,7 @@ public function shouldConstructTvSeason() 'getImages' => 'Tmdb\Model\Collection\Images', 'getEpisodes' => 'Tmdb\Model\Common\GenericCollection', 'getVideos' => 'Tmdb\Model\Collection\Videos', + 'getTranslations' => 'Tmdb\Model\Common\GenericCollection', ] ); } diff --git a/test/Tmdb/Tests/Repository/TvSeasonRepositoryTest.php b/test/Tmdb/Tests/Repository/TvSeasonRepositoryTest.php index 389ee936..1d0626fa 100644 --- a/test/Tmdb/Tests/Repository/TvSeasonRepositoryTest.php +++ b/test/Tmdb/Tests/Repository/TvSeasonRepositoryTest.php @@ -69,6 +69,23 @@ public function shouldGetCredits() $this->assertLastRequestIsWithPathAndMethod('/3/tv/' . self::TV_ID . '/season/' . self::SEASON_NUMBER . '/credits'); } + /** + * @test + */ + public function shouldGetTranslations() + { + $repository = $this->getRepositoryWithMockedHttpAdapter(); + + $tv = new Tv(); + $tv->setId(self::TV_ID); + + $season = new Tv\Season(); + $season->setSeasonNumber(self::SEASON_NUMBER); + + $repository->getTranslations($tv, $season); + $this->assertLastRequestIsWithPathAndMethod('/3/tv/' . self::TV_ID . '/season/' . self::SEASON_NUMBER . '/translations'); + } + /** * @test */ diff --git a/test/Tmdb/Tests/Resources/tv/season/all.json b/test/Tmdb/Tests/Resources/tv/season/all.json index d9542966..fd8dceca 100644 --- a/test/Tmdb/Tests/Resources/tv/season/all.json +++ b/test/Tmdb/Tests/Resources/tv/season/all.json @@ -407,5 +407,429 @@ "width":400 } ] + }, + "translations":{ + "translations": [ + { + "iso_3166_1": "SA", + "iso_639_1": "ar", + "name": "العربية", + "english_name": "Arabic", + "data": { + "name": "", + "overview": "مع ارتقاء \"والتر\" في عالم تجارة المخدرات، يلفت انتباه منافسيه ويعرّض حياة صهره (ضابط وكالة مكافحة المخدرات) للخطر." + } + }, + { + "iso_3166_1": "BG", + "iso_639_1": "bg", + "name": "български език", + "english_name": "Bulgarian", + "data": { + "name": "", + "overview": "" + } + }, + { + "iso_3166_1": "BS", + "iso_639_1": "bs", + "name": "Bosanski", + "english_name": "Bosnian", + "data": { + "name": "Season 2", + "overview": "Walterovi računi za liječenje sve su veći pa se odluči ponovno udružiti s Jessejem. Iako njih dvojica lako proizvedu drogu, dilanje je mnogo veći problem, što zbog policije, što zbog rivalskih bandi. U priču ulazi odvjetnik Saul..." + } + }, + { + "iso_3166_1": "ES", + "iso_639_1": "ca", + "name": "Català", + "english_name": "Catalan", + "data": { + "name": "", + "overview": "" + } + }, + { + "iso_3166_1": "CZ", + "iso_639_1": "cs", + "name": "Český", + "english_name": "Czech", + "data": { + "name": "", + "overview": "V druhé sezóně seriálu Perníkový táta Waltovi a Jessemu vše přerůstá přes hlavu. Jejich podnikání dosahuje nových rozměrů a oba zažívají, co všechno obnáší obchodování s drogami. Proslulý modrý amfetamin z nich udělal boháče, ale pro Walta je stále složitější skrývat pravdu před svou manželkou Skyler (Anna Gunn), synem Walterem juniorem (RJ Mitte) a švagrem Hankem (Dean Norris), protidrogovým agentem. Ze všech sil se snaží udržet svůj život pod kontrolou, musí se ale potýkat s brutálními drogovými dealery, stále odtažitější ženou a synem, blížícím se narozením dcery a drogově závislým obchodním partnerem – a při tom všem navíc bojovat s rakovinou plic v konečném stádiu. Za kamerou Perníkového táty: Kompletní druhé sezóny stál Michael Slovis, střihu se ujala držitelka Ceny Emmy® Lynne Willingham, A.C.E. Výkonnými producenty byli Vince Gilligan a Mark Johnson." + } + }, + { + "iso_3166_1": "DK", + "iso_639_1": "da", + "name": "Dansk", + "english_name": "Danish", + "data": { + "name": "", + "overview": "" + } + }, + { + "iso_3166_1": "DE", + "iso_639_1": "de", + "name": "Deutsch", + "english_name": "German", + "data": { + "name": "", + "overview": "Sein Ruf eilt dem zum Meth-Dealer gewordenen Lehrer Walter voraus – das erregt die Aufmerksamkeit rivalisierender Kartelle und gefährdet seinen Schwager, einen Drogencop." + } + }, + { + "iso_3166_1": "GR", + "iso_639_1": "el", + "name": "ελληνικά", + "english_name": "Greek", + "data": { + "name": "Σαιζόν 2", + "overview": "Ο Γουόλτερ από καθηγητής έγινε ανερχόμενος έμπορος ναρκωτικών, τραβώντας την προσοχή ανταγωνιστικών καρτέλ και θέτοντας σε κίνδυνο τον εισαγγελέα κουνιάδο του." + } + }, + { + "iso_3166_1": "US", + "iso_639_1": "en", + "name": "English", + "english_name": "English", + "data": { + "name": "", + "overview": "Walt must deal with the chain reaction of his choice, as he and Jesse face new and severe consequences. When danger and suspicion around Walt escalate, he is pushed to new levels of desperation. Just how much higher will the stakes rise? How far is Walt willing to go to ensure his family's security? Will his grand plan spiral out of control?" + } + }, + { + "iso_3166_1": "ES", + "iso_639_1": "es", + "name": "Español", + "english_name": "Spanish", + "data": { + "name": "", + "overview": "Walt (interpretado por Bryan Cranston, ganador de dos Premios Emmy) y Jesse (Aaron Paul) están con el agua al cuello en la segunda temporada de \"Breaking Bad\". A medida que se estrecha su relación, Walt y Jesse empiezan a ver el lado más oscuro del narcotráfico. Aunque ha hecho fortuna gracias a su metanfetamina azul, a Walt le resulta cada vez más difícil ocultarle la verdad a su esposa Skyler (Anna Gunn), a su hijo Walter Jr. (RJ Mitte) y a su cuñado Hank (Dean Norris), el agente de la D.E.A. Walt lucha por mantener su vida bajo control al lidiar con narcotraficantes despiadados, con una esposa e hijo cada vez más distantes, con el nacimiento inminente de su hija y con un socio drogadicto – y eso sin contar con que debe enfrentarse a un cáncer terminal de pulmón." + } + }, + { + "iso_3166_1": "MX", + "iso_639_1": "es", + "name": "Español", + "english_name": "Spanish", + "data": { + "name": "", + "overview": "Walter y Jesse, llegan alto en el juego de las drogas, llamando la atención del cartel rival y poniendo en peligro a Hank; cuñado de Walter y agente de la DEA." + } + }, + { + "iso_3166_1": "EE", + "iso_639_1": "et", + "name": "Eesti", + "english_name": "Estonian", + "data": { + "name": "", + "overview": "" + } + }, + { + "iso_3166_1": "IR", + "iso_639_1": "fa", + "name": "فارسی", + "english_name": "Persian", + "data": { + "name": "فصل ۲", + "overview": "" + } + }, + { + "iso_3166_1": "FI", + "iso_639_1": "fi", + "name": "suomi", + "english_name": "Finnish", + "data": { + "name": "", + "overview": "" + } + }, + { + "iso_3166_1": "CA", + "iso_639_1": "fr", + "name": "Français", + "english_name": "French", + "data": { + "name": "", + "overview": "" + } + }, + { + "iso_3166_1": "FR", + "iso_639_1": "fr", + "name": "Français", + "english_name": "French", + "data": { + "name": "", + "overview": "Après les mésaventures rencontrées avec Krazy-8 et Tuco Salamanca, Walter et Jesse décident de monter leur propre affaire. Mais alors que l’empire d'Heisenberg s’étend de plus en plus, un deal tourne mal et les ennuis commencent. Sur les conseils de Saul Goodman, son avocat véreux, Walter entre en contact avec le propriétaire d’une chaîne de restaurant qui pourrait l’aider à écouler ses stocks de drogue. Pendant ce temps, Skyler commence à avoir des doutes sur son mari tandis que Jesse sombre peu à peu dans l’héroïne." + } + }, + { + "iso_3166_1": "IL", + "iso_639_1": "he", + "name": "עִבְרִית", + "english_name": "Hebrew", + "data": { + "name": "", + "overview": "וולטר וייט, מורה שנהפך לסוחר סמים, עולה שלב במשחק הסמים, מושך אליו את תשומת לבם של קרטלים מתחרים ומסכן את גיסו, איש הסוכנות האמריקנית למלחמה בסמים." + } + }, + { + "iso_3166_1": "HR", + "iso_639_1": "hr", + "name": "Hrvatski", + "english_name": "Croatian", + "data": { + "name": "", + "overview": "" + } + }, + { + "iso_3166_1": "HU", + "iso_639_1": "hu", + "name": "Magyar", + "english_name": "Hungarian", + "data": { + "name": "2. évad", + "overview": "Vajon összejön már végre egy normális drogüzlet ennek a két lúzernek? És vajon jót tesz a biznisznek, ha az ember üzlettársa ritkán van magánál?" + } + }, + { + "iso_3166_1": "ID", + "iso_639_1": "id", + "name": "Bahasa indonesia", + "english_name": "Indonesian", + "data": { + "name": "", + "overview": "" + } + }, + { + "iso_3166_1": "IT", + "iso_639_1": "it", + "name": "Italiano", + "english_name": "Italian", + "data": { + "name": "", + "overview": "Improvvisatosi spacciatore, un insegnante si fa un nome nel giro della droga e attira l'attenzione dei cartelli rivali, mettendo a rischio la vita dei suoi cari." + } + }, + { + "iso_3166_1": "JP", + "iso_639_1": "ja", + "name": "日本語", + "english_name": "Japanese", + "data": { + "name": "", + "overview": "第2シーズンでは、ウォルターの下した決断が次々と連鎖反応を引き起こす。その対応に追われるウォルターは、ジェシーともどもシビアな事態に巻き込まれていく。膨らむ疑惑、高まる危険。さらなる自暴自棄に追いやられるウォルター。賭け金はどこまでつり上がるのか。家族を守るため、ウォルターはどこまで深入りするのか。彼の壮大な計画は、果たして制御不能に陥ってしまうのか?" + } + }, + { + "iso_3166_1": "GE", + "iso_639_1": "ka", + "name": "ქართული", + "english_name": "Georgian", + "data": { + "name": "", + "overview": "" + } + }, + { + "iso_3166_1": "KR", + "iso_639_1": "ko", + "name": "한국어/조선말", + "english_name": "Korean", + "data": { + "name": "시즌 2", + "overview": "마약상이 된 교사 월터는 마약 게임에서 승승장구하면서 경쟁하는 카르텔의 표적이 되고, 마약단속국 직원인 처남을 위험에 빠뜨린다." + } + }, + { + "iso_3166_1": "LT", + "iso_639_1": "lt", + "name": "Lietuvių", + "english_name": "Lithuanian", + "data": { + "name": "", + "overview": "" + } + }, + { + "iso_3166_1": "LV", + "iso_639_1": "lv", + "name": "Latviešu", + "english_name": "Latvian", + "data": { + "name": "", + "overview": "" + } + }, + { + "iso_3166_1": "NL", + "iso_639_1": "nl", + "name": "Nederlands", + "english_name": "Dutch", + "data": { + "name": "Seizoen 2", + "overview": "De compagnons Walt en Jesse krijgen steeds meer te maken met de extremen van de drugshandel. Hun handelsmerk blue meth maakt ze rijk, maar het wordt voor Walt steeds moeilijker om zijn dubbelleven verborgen te houden voor zijn vrouw Skyler, zijn zoon Walter Jr. en zijn zwager Hank, die bij de narcoticabrigade werkt. Walt leeft in een achtbaan met keiharde drugsdealers, een vrouw en een zoon die steeds verder van hem verwijderd raken, de aanstaande geboorte van zijn dochter, een gebruikende compagnon en zijn strijd tegen longkanker." + } + }, + { + "iso_3166_1": "NO", + "iso_639_1": "no", + "name": "Norsk", + "english_name": "Norwegian", + "data": { + "name": "Sesong 2", + "overview": "" + } + }, + { + "iso_3166_1": "PL", + "iso_639_1": "pl", + "name": "Polski", + "english_name": "Polish", + "data": { + "name": "", + "overview": "Walter wspina się po szczeblach kariery dilera, co przykuwa uwagę konkurencyjnych karteli i zagraża szwagrowi pracującemu w rządowej agencji antynarkotykowej." + } + }, + { + "iso_3166_1": "BR", + "iso_639_1": "pt", + "name": "Português", + "english_name": "Portuguese", + "data": { + "name": "", + "overview": "Walter e Jesse sobem rápido no mundo das drogas, atraindo a atenção de cartéis rivais e ameaçando a vida de Hank, cunhado policial de Walter." + } + }, + { + "iso_3166_1": "PT", + "iso_639_1": "pt", + "name": "Português", + "english_name": "Portuguese", + "data": { + "name": "2ª Temporada", + "overview": "Walter continua a sua ascensão no mundo da droga, o que começa a chamar a atenção de cartéis rivais e põe em perigo a vida do seu cunhado." + } + }, + { + "iso_3166_1": "RO", + "iso_639_1": "ro", + "name": "Română", + "english_name": "Romanian", + "data": { + "name": "", + "overview": "În cel de-al doilea sezon, Walt trebuie să facă față reacției în lanț alese de el, deoarece el și Jesse se confruntă cu consecințe noi și grave. Când pericolul și suspiciunea în jurul lui Walt escaladează, el este împins la noi niveluri de disperare. Cât de mult vor crește miza? Cât de departe este dispus Walt să meargă pentru a asigura securitatea familiei sale? Marele său plan va scăpa de sub control?" + } + }, + { + "iso_3166_1": "RU", + "iso_639_1": "ru", + "name": "Pусский", + "english_name": "Russian", + "data": { + "name": "", + "overview": "Во втором сезоне Уолтера и Джесси похищает наркоторговец Туко, но им удаётся сбежать. Никакие проблемы не могут остановить Уолтера Уайта на пути к намеченной цели, и они с Джесси опять отправляются в пустыню, где за четыре дня готовят крупную партию наркотика. Джесси привлекает своих приятелей для сбыта метамфетамина. Однако вскоре один из них попадает под арест. Начинающие наркоторговцы обращаются за помощью к адвокату Солу Гудману (Боб Оденкерк). Благодаря криминальным связям Сола Уолтер Уайт знакомится с Гусом Фрингом (Джанкарло Эспозито), который покупает весь оставшийся запас метамфетамина за 1,2 миллиона долларов..." + } + }, + { + "iso_3166_1": "SK", + "iso_639_1": "sk", + "name": "Slovenčina", + "english_name": "Slovak", + "data": { + "name": "", + "overview": "" + } + }, + { + "iso_3166_1": "RS", + "iso_639_1": "sr", + "name": "Srpski", + "english_name": "Serbian", + "data": { + "name": "", + "overview": "" + } + }, + { + "iso_3166_1": "SE", + "iso_639_1": "sv", + "name": "svenska", + "english_name": "Swedish", + "data": { + "name": "", + "overview": "Walter klättrar allt högre inom drogbranschen, vilket drar till sig uppmärksamhet från karteller och utsätter hans svåger inom narkotikapolisen för fara." + } + }, + { + "iso_3166_1": "TH", + "iso_639_1": "th", + "name": "ภาษาไทย", + "english_name": "Thai", + "data": { + "name": "", + "overview": "" + } + }, + { + "iso_3166_1": "TR", + "iso_639_1": "tr", + "name": "Türkçe", + "english_name": "Turkish", + "data": { + "name": "", + "overview": "Uyuşturucu piyasasında basamakları hızla tırmanan eski öğretmen Walter, rakip kartellerin dikkatini çekerken, Narkotikçi kayınbiraderini tehlikeye sokar." + } + }, + { + "iso_3166_1": "UA", + "iso_639_1": "uk", + "name": "Український", + "english_name": "Ukrainian", + "data": { + "name": "", + "overview": "" + } + }, + { + "iso_3166_1": "VN", + "iso_639_1": "vi", + "name": "Tiếng Việt", + "english_name": "Vietnamese", + "data": { + "name": "", + "overview": "" + } + }, + { + "iso_3166_1": "CN", + "iso_639_1": "zh", + "name": "普通话", + "english_name": "Mandarin", + "data": { + "name": "", + "overview": "贩卖冰毒的沃尔特老师在毒品交易中越陷越深,这引起了竞争对手的注意并使他在缉毒局的小舅子陷入危险中。" + } + }, + { + "iso_3166_1": "TW", + "iso_639_1": "zh", + "name": "普通话", + "english_name": "Mandarin", + "data": { + "name": "", + "overview": "" + } + } + ] } -} \ No newline at end of file +} From 96c6db286fcab916a16a628b302c9434e6043478 Mon Sep 17 00:00:00 2001 From: ihsudg Date: Thu, 27 Jul 2023 13:38:00 +0200 Subject: [PATCH 2/6] remove wrong property --- lib/Tmdb/Model/Tv/Season.php | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/Tmdb/Model/Tv/Season.php b/lib/Tmdb/Model/Tv/Season.php index 0b5cd541..5eaab50a 100644 --- a/lib/Tmdb/Model/Tv/Season.php +++ b/lib/Tmdb/Model/Tv/Season.php @@ -39,7 +39,6 @@ class Season extends AbstractModel * @var array */ public static $properties = [ - 'adult', 'air_date', 'name', 'overview', From f39877815fb3c86f53648a5e986de5bbe59fd561 Mon Sep 17 00:00:00 2001 From: ihsudg Date: Thu, 27 Jul 2023 13:49:40 +0200 Subject: [PATCH 3/6] revert auto changes --- lib/Tmdb/Factory/TvSeasonFactory.php | 3 ++- lib/Tmdb/Model/Tv/Season.php | 2 +- lib/Tmdb/Repository/TvSeasonRepository.php | 8 +++++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/Tmdb/Factory/TvSeasonFactory.php b/lib/Tmdb/Factory/TvSeasonFactory.php index ba883419..8b53f689 100644 --- a/lib/Tmdb/Factory/TvSeasonFactory.php +++ b/lib/Tmdb/Factory/TvSeasonFactory.php @@ -19,7 +19,6 @@ use Tmdb\Factory\People\CastFactory; use Tmdb\Factory\People\CrewFactory; use Tmdb\HttpClient\HttpClient; -use Tmdb\Model\AbstractModel; use Tmdb\Model\Common\ExternalIds; use Tmdb\Model\Common\GenericCollection; use Tmdb\Model\Common\Translation; @@ -29,6 +28,7 @@ /** * Class TvSeasonFactory + * @extends AbstractFactory * @package Tmdb\Factory */ class TvSeasonFactory extends AbstractFactory @@ -85,6 +85,7 @@ public function __construct(HttpClient $httpClient) */ public function createCollection(array $data = []) { + /** @var GenericCollection */ $collection = new GenericCollection(); foreach ($data as $item) { diff --git a/lib/Tmdb/Model/Tv/Season.php b/lib/Tmdb/Model/Tv/Season.php index 5eaab50a..f583e791 100644 --- a/lib/Tmdb/Model/Tv/Season.php +++ b/lib/Tmdb/Model/Tv/Season.php @@ -132,7 +132,7 @@ public function getAirDate() } /** - * @param DateTime $airDate + * @param string $airDate * @return self */ public function setAirDate($airDate) diff --git a/lib/Tmdb/Repository/TvSeasonRepository.php b/lib/Tmdb/Repository/TvSeasonRepository.php index f7b5bc8c..31216e77 100644 --- a/lib/Tmdb/Repository/TvSeasonRepository.php +++ b/lib/Tmdb/Repository/TvSeasonRepository.php @@ -18,6 +18,8 @@ use Tmdb\Exception\RuntimeException; use Tmdb\Factory\TvSeasonFactory; use Tmdb\Model\AbstractModel; +use Tmdb\Model\Collection\CreditsCollection; +use Tmdb\Model\Collection\Images; use Tmdb\Model\Collection\Videos; use Tmdb\Model\Common\Video; use Tmdb\Model\Tv; @@ -98,10 +100,10 @@ public function getFactory() * Just like the website, we pull this information from the last season of the series. * * @param Tv|int $tvShow - * @param TvSeason|int $season + * @param Season|int $season * @param array $parameters * @param array $headers - * @return null|AbstractModel + * @return CreditsCollection */ public function getCredits($tvShow, $season, array $parameters = [], array $headers = []) { @@ -151,7 +153,7 @@ public function getExternalIds($tvShow, $season, array $parameters = [], array $ * @param $season * @param $parameters * @param $headers - * @return null|AbstractModel + * @return Images */ public function getImages($tvShow, $season, array $parameters = [], array $headers = []) { From 92409388e1b3f30a87c5e59698acab55ee53d87a Mon Sep 17 00:00:00 2001 From: ihsudg Date: Thu, 27 Jul 2023 13:53:11 +0200 Subject: [PATCH 4/6] revert auto changes --- test/Tmdb/Tests/Factory/TvSeasonFactoryTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Tmdb/Tests/Factory/TvSeasonFactoryTest.php b/test/Tmdb/Tests/Factory/TvSeasonFactoryTest.php index bfe54695..b7d2978d 100644 --- a/test/Tmdb/Tests/Factory/TvSeasonFactoryTest.php +++ b/test/Tmdb/Tests/Factory/TvSeasonFactoryTest.php @@ -33,7 +33,7 @@ public function setUp(): void $data = $this->loadByFile('tv/season/all.json'); /** - * @var Season $this- >season + * @var Season $this->season */ $this->season = $factory->create($data); } From 3fd7ec6946a02afe66753ef6ddc409c1bd647426 Mon Sep 17 00:00:00 2001 From: ihsudg Date: Thu, 27 Jul 2023 14:29:35 +0200 Subject: [PATCH 5/6] Configuration: get languages --- lib/Tmdb/Api/Configuration.php | 9 +++++++++ test/Tmdb/Tests/Api/ConfigurationTest.php | 11 +++++++++++ 2 files changed, 20 insertions(+) diff --git a/lib/Tmdb/Api/Configuration.php b/lib/Tmdb/Api/Configuration.php index eb2c4014..4a48785f 100644 --- a/lib/Tmdb/Api/Configuration.php +++ b/lib/Tmdb/Api/Configuration.php @@ -46,4 +46,13 @@ public function getConfiguration(array $headers = []) { return $this->get('configuration', [], $headers); } + + /** + * @param array $headers + * @return array + */ + public function getLanguages(array $headers = []): array + { + return $this->get('configuration/languages', [], $headers); + } } diff --git a/test/Tmdb/Tests/Api/ConfigurationTest.php b/test/Tmdb/Tests/Api/ConfigurationTest.php index 6426f63c..ade094e1 100644 --- a/test/Tmdb/Tests/Api/ConfigurationTest.php +++ b/test/Tmdb/Tests/Api/ConfigurationTest.php @@ -27,6 +27,17 @@ public function shouldGetConfiguration() $this->assertLastRequestIsWithPathAndMethod('/3/configuration'); } + /** + * @test + */ + public function shouldGetLanguages() + { + $api = $this->getApiWithMockedHttpAdapter(); + + $api->getLanguages(); + $this->assertLastRequestIsWithPathAndMethod('/3/configuration/languages'); + } + protected function getApiClass() { return 'Tmdb\Api\Configuration'; From 76bfaaef8e812f2b725cf4d099485b7ce6b730c9 Mon Sep 17 00:00:00 2001 From: ihsudg Date: Thu, 27 Jul 2023 14:30:43 +0200 Subject: [PATCH 6/6] Revert "Configuration: get languages" This reverts commit 3fd7ec6946a02afe66753ef6ddc409c1bd647426. --- lib/Tmdb/Api/Configuration.php | 9 --------- test/Tmdb/Tests/Api/ConfigurationTest.php | 11 ----------- 2 files changed, 20 deletions(-) diff --git a/lib/Tmdb/Api/Configuration.php b/lib/Tmdb/Api/Configuration.php index 4a48785f..eb2c4014 100644 --- a/lib/Tmdb/Api/Configuration.php +++ b/lib/Tmdb/Api/Configuration.php @@ -46,13 +46,4 @@ public function getConfiguration(array $headers = []) { return $this->get('configuration', [], $headers); } - - /** - * @param array $headers - * @return array - */ - public function getLanguages(array $headers = []): array - { - return $this->get('configuration/languages', [], $headers); - } } diff --git a/test/Tmdb/Tests/Api/ConfigurationTest.php b/test/Tmdb/Tests/Api/ConfigurationTest.php index ade094e1..6426f63c 100644 --- a/test/Tmdb/Tests/Api/ConfigurationTest.php +++ b/test/Tmdb/Tests/Api/ConfigurationTest.php @@ -27,17 +27,6 @@ public function shouldGetConfiguration() $this->assertLastRequestIsWithPathAndMethod('/3/configuration'); } - /** - * @test - */ - public function shouldGetLanguages() - { - $api = $this->getApiWithMockedHttpAdapter(); - - $api->getLanguages(); - $this->assertLastRequestIsWithPathAndMethod('/3/configuration/languages'); - } - protected function getApiClass() { return 'Tmdb\Api\Configuration';