-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #59 from vfalies/feature/TVShowCredit
Feature/tvShowCredit
- Loading branch information
Showing
15 changed files
with
493 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ | |
* file that was distributed with this source code. | ||
* | ||
* @author Vincent Faliès <[email protected]> | ||
* @copyright Copyright (c) 2017 | ||
* @copyright Copyright (c) 2017-2021 | ||
*/ | ||
|
||
|
||
|
@@ -18,7 +18,7 @@ | |
* Interface for Cast results type object | ||
* @package Tmdb | ||
* @author Vincent Faliès <[email protected]> | ||
* @copyright Copyright (c) 2017 | ||
* @copyright Copyright (c) 2017-2021 | ||
*/ | ||
interface CastResultsInterface | ||
{ | ||
|
@@ -41,11 +41,6 @@ public function getCharacter() : string; | |
*/ | ||
public function getGender() : int; | ||
|
||
/** | ||
* Cast Id | ||
* @return int | ||
*/ | ||
public function getCastId() : int; | ||
|
||
/** | ||
* Name | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ | |
* file that was distributed with this source code. | ||
* | ||
* @author Vincent Faliès <[email protected]> | ||
* @copyright Copyright (c) 2017 | ||
* @copyright Copyright (c) 2017-2021 | ||
*/ | ||
|
||
|
||
|
@@ -24,7 +24,7 @@ | |
* TVEpisode class | ||
* @package Tmdb | ||
* @author Vincent Faliès <[email protected]> | ||
* @copyright Copyright (c) 2017 | ||
* @copyright Copyright (c) 2017-2021 | ||
*/ | ||
class TVEpisode extends TVItem implements TVEpisodeInterface | ||
{ | ||
|
@@ -207,4 +207,23 @@ public function getChanges(array $options = array()) : \Generator | |
$changes = $this->getItemChanges($options); | ||
return $changes->getChanges(); | ||
} | ||
/** | ||
* Get TVShow episode crew | ||
* @return \Generator|Results\Crew | ||
*/ | ||
public function getCrew() : \Generator | ||
{ | ||
$credit = new TVEpisodeCredit($this->tmdb, $this->tv_id, $this->season_number, $this->episode_number); | ||
return $credit->getCrew(); | ||
} | ||
|
||
/** | ||
* Get TVShow episode cast | ||
* @return \Generator|Results\Cast | ||
*/ | ||
public function getCast() : \Generator | ||
{ | ||
$cast = new TVEpisodeCredit($this->tmdb, $this->tv_id, $this->season_number, $this->episode_number); | ||
return $cast->getCast(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
<?php declare(strict_types=1); | ||
/** | ||
* This file is part of the Tmdb package. | ||
* | ||
* (c) Vincent Faliès <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
* @author Vincent Faliès <[email protected]> | ||
* @copyright Copyright (c) 2017-2021 | ||
*/ | ||
|
||
|
||
namespace VfacTmdb\Items; | ||
|
||
use VfacTmdb\Results; | ||
use VfacTmdb\Interfaces\TmdbInterface; | ||
|
||
/** | ||
* TVSeason Credit class | ||
* @package Tmdb | ||
* @author Vincent Faliès <[email protected]> | ||
* @copyright Copyright (c) 2017-2021 | ||
*/ | ||
class TVEpisodeCredit | ||
{ | ||
/** | ||
* Tmdb object | ||
* @var TmdbInterface | ||
*/ | ||
private $tmdb = null; | ||
/** | ||
* Logger object | ||
* @var \Psr\Log\LoggerInterface | ||
*/ | ||
protected $logger = null; | ||
/** | ||
* Params | ||
* @var array | ||
*/ | ||
protected $params = null; | ||
/** | ||
* Data | ||
* @var \stdClass | ||
*/ | ||
protected $data = null; | ||
/** | ||
* Crew | ||
* @var \stdClass | ||
*/ | ||
protected $crew; | ||
/** | ||
* Options array | ||
* @var array | ||
*/ | ||
protected $options; | ||
|
||
/** | ||
* Constructor | ||
* @param TmdbInterface $tmdb | ||
* @param int $tvshow_id | ||
* @param array $options | ||
*/ | ||
public function __construct(TmdbInterface $tmdb, int $tv_id, int $season_number, int $episode_number, array $options = array()) | ||
{ | ||
$this->tmdb = $tmdb; | ||
$this->logger = $tmdb->getLogger(); | ||
$this->data = $this->tmdb->getRequest('tv/' . $tv_id . '/season/'.$season_number.'/episode/'.$episode_number.'/credits'); | ||
$this->options = $options; | ||
} | ||
|
||
/** | ||
* Crew | ||
* @return \Generator|Results\Crew | ||
*/ | ||
public function getCrew() : \Generator | ||
{ | ||
if (!empty($this->data->crew)) { | ||
foreach ($this->data->crew as $c) { | ||
$crew = new Results\Crew($this->tmdb, $c); | ||
yield $crew; | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* Cast | ||
* @return \Generator|Results\Cast | ||
*/ | ||
public function getCast() : \Generator | ||
{ | ||
if (!empty($this->data->cast)) { | ||
foreach ($this->data->cast as $c) { | ||
$cast = new Results\Cast($this->tmdb, $c); | ||
yield $cast; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ | |
* file that was distributed with this source code. | ||
* | ||
* @author Vincent Faliès <[email protected]> | ||
* @copyright Copyright (c) 2017 | ||
* @copyright Copyright (c) 2017-2021 | ||
*/ | ||
|
||
|
||
|
@@ -24,7 +24,7 @@ | |
* TVSeason class | ||
* @package Tmdb | ||
* @author Vincent Faliès <[email protected]> | ||
* @copyright Copyright (c) 2017 | ||
* @copyright Copyright (c) 2017-2021 | ||
*/ | ||
class TVSeason extends TVItem implements TVSeasonInterface | ||
{ | ||
|
@@ -153,4 +153,25 @@ public function getChanges(array $options = array()) : \Generator | |
$changes = $this->getItemChanges($options); | ||
return $changes->getChanges(); | ||
} | ||
|
||
|
||
/** | ||
* Get TVShow Season crew | ||
* @return \Generator|Results\Crew | ||
*/ | ||
public function getCrew() : \Generator | ||
{ | ||
$credit = new TVSeasonCredit($this->tmdb, $this->tv_id, $this->season_number); | ||
return $credit->getCrew(); | ||
} | ||
|
||
/** | ||
* Get TVShow Season cast | ||
* @return \Generator|Results\Cast | ||
*/ | ||
public function getCast() : \Generator | ||
{ | ||
$cast = new TVSeasonCredit($this->tmdb, $this->tv_id, $this->season_number); | ||
return $cast->getCast(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
<?php declare(strict_types=1); | ||
/** | ||
* This file is part of the Tmdb package. | ||
* | ||
* (c) Vincent Faliès <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
* @author Vincent Faliès <[email protected]> | ||
* @copyright Copyright (c) 2017-2021 | ||
*/ | ||
|
||
|
||
namespace VfacTmdb\Items; | ||
|
||
use VfacTmdb\Results; | ||
use VfacTmdb\Interfaces\TmdbInterface; | ||
|
||
/** | ||
* TVSeason Credit class | ||
* @package Tmdb | ||
* @author Vincent Faliès <[email protected]> | ||
* @copyright Copyright (c) 2017-2021 | ||
*/ | ||
class TVSeasonCredit | ||
{ | ||
/** | ||
* Tmdb object | ||
* @var TmdbInterface | ||
*/ | ||
private $tmdb = null; | ||
/** | ||
* Logger object | ||
* @var \Psr\Log\LoggerInterface | ||
*/ | ||
protected $logger = null; | ||
/** | ||
* Params | ||
* @var array | ||
*/ | ||
protected $params = null; | ||
/** | ||
* Data | ||
* @var \stdClass | ||
*/ | ||
protected $data = null; | ||
/** | ||
* Crew | ||
* @var \stdClass | ||
*/ | ||
protected $crew; | ||
/** | ||
* Options array | ||
* @var array | ||
*/ | ||
protected $options; | ||
|
||
/** | ||
* Constructor | ||
* @param TmdbInterface $tmdb | ||
* @param int $tvshow_id | ||
* @param array $options | ||
*/ | ||
public function __construct(TmdbInterface $tmdb, int $tv_id, int $season_number, array $options = array()) | ||
{ | ||
$this->tmdb = $tmdb; | ||
$this->logger = $tmdb->getLogger(); | ||
$this->data = $this->tmdb->getRequest('tv/' . $tv_id . '/season/'.$season_number.'/credits'); | ||
$this->options = $options; | ||
} | ||
|
||
/** | ||
* Crew | ||
* @return \Generator|Results\Crew | ||
*/ | ||
public function getCrew() : \Generator | ||
{ | ||
if (!empty($this->data->crew)) { | ||
foreach ($this->data->crew as $c) { | ||
$crew = new Results\Crew($this->tmdb, $c); | ||
yield $crew; | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* Cast | ||
* @return \Generator|Results\Cast | ||
*/ | ||
public function getCast() : \Generator | ||
{ | ||
if (!empty($this->data->cast)) { | ||
foreach ($this->data->cast as $c) { | ||
$cast = new Results\Cast($this->tmdb, $c); | ||
yield $cast; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ | |
* file that was distributed with this source code. | ||
* | ||
* @author Vincent Faliès <[email protected]> | ||
* @copyright Copyright (c) 2017 | ||
* @copyright Copyright (c) 2017-2021 | ||
*/ | ||
|
||
|
||
|
@@ -24,7 +24,7 @@ | |
* TVShow class | ||
* @package Tmdb | ||
* @author Vincent Faliès <[email protected]> | ||
* @copyright Copyright (c) 2017 | ||
* @copyright Copyright (c) 2017-2021 | ||
*/ | ||
class TVShow extends Item implements TVShowInterface | ||
{ | ||
|
@@ -240,6 +240,27 @@ public function getSimilar() : \Generator | |
} | ||
} | ||
|
||
|
||
/** | ||
* Get TVShow crew | ||
* @return \Generator|Results\Crew | ||
*/ | ||
public function getCrew() : \Generator | ||
{ | ||
$credit = new TVShowCredit($this->tmdb, $this->id); | ||
return $credit->getCrew(); | ||
} | ||
|
||
/** | ||
* Get TVShow cast | ||
* @return \Generator|Results\Cast | ||
*/ | ||
public function getCast() : \Generator | ||
{ | ||
$cast = new TVShowCredit($this->tmdb, $this->id); | ||
return $cast->getCast(); | ||
} | ||
|
||
/** | ||
* Get the underlying ItemChanges object for this Item | ||
* @param array $options Array of options for the request | ||
|
Oops, something went wrong.