Skip to content

Commit

Permalink
Splitting up Tv into Tv, TvSeason and TvEpisode
Browse files Browse the repository at this point in the history
  • Loading branch information
wtfzdotnet committed Nov 3, 2013
1 parent 0812794 commit 3ce13f6
Show file tree
Hide file tree
Showing 4 changed files with 130 additions and 84 deletions.
82 changes: 0 additions & 82 deletions lib/Tmdb/Api/Tv.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,86 +64,4 @@ public function getImages($tvshow_id, array $options = array())
{
return $this->get('tv/' . $tvshow_id . '/images', $options);
}

/**
* Get the primary information about a TV season by its season number.
*
* @param $tvshow_id
* @param $season_number
* @param array $options
* @return mixed
*/
public function getSeason($tvshow_id, $season_number, array $options = array())
{
return $this->get(sprintf('tv/%s/season/%s', $tvshow_id, $season_number), $options);
}

/**
* Get the external ids that we have stored for a TV season by season number.
*
* @param $tvshow_id
* @param $season_number
* @param array $options
* @return mixed
*/
public function getSeasonExternalIds($tvshow_id, $season_number, array $options = array())
{
return $this->get(sprintf('tv/%s/season/%s/external_ids', $tvshow_id, $season_number), $options);
}

/**
* Get the primary information about a TV episode by combination of a season and episode number.
*
* @param $tvshow_id
* @param $season_number
* @param $episode_number
* @param array $options
* @return mixed
*/
public function getEpisode($tvshow_id, $season_number, $episode_number, array $options = array())
{
return $this->get(sprintf('tv/%s/season/%s/episode/%s', $tvshow_id, $season_number,$episode_number), $options);
}

/**
* Get the TV episode credits by combination of season and episode number.
*
* @param $tvshow_id
* @param $season_number
* @param $episode_number
* @param array $options
* @return mixed
*/
public function getEpisodeCredits($tvshow_id, $season_number, $episode_number, array $options = array())
{
return $this->get(sprintf('tv/%s/season/%s/episode/%s/credits', $tvshow_id, $season_number,$episode_number), $options);
}

/**
* Get the external ids for a TV episode by comabination of a season and episode number.
*
* @param $tvshow_id
* @param $season_number
* @param $episode_number
* @param array $options
* @return mixed
*/
public function getEpisodeExternalIds($tvshow_id, $season_number, $episode_number, array $options = array())
{
return $this->get(sprintf('tv/%s/season/%s/episode/%s/external_ids', $tvshow_id, $season_number,$episode_number), $options);
}

/**
* Get the images (episode stills) for a TV episode by combination of a season and episode number.
*
* @param $tvshow_id
* @param $season_number
* @param $episode_number
* @param array $options
* @return mixed
*/
public function getEpisodeImages($tvshow_id, $season_number, $episode_number, array $options = array())
{
return $this->get(sprintf('tv/%s/season/%s/episode/%s/images', $tvshow_id, $season_number,$episode_number), $options);
}
}
75 changes: 75 additions & 0 deletions lib/Tmdb/Api/TvEpisode.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<?php
/**
* This file is part of the Tmdb PHP API created by Michael Roterman.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @package Tmdb
* @author Michael Roterman <[email protected]>
* @copyright (c) 2013, Michael Roterman
* @version 0.0.1
*/
namespace Tmdb\Api;

use Tmdb\Exception\NotImplementedException;

class TvEpisode
extends AbstractApi
{
/**
* Get the primary information about a TV episode by combination of a season and episode number.
*
* @param $tvshow_id
* @param $season_number
* @param $episode_number
* @param array $options
* @return mixed
*/
public function getEpisode($tvshow_id, $season_number, $episode_number, array $options = array())
{
return $this->get(sprintf('tv/%s/season/%s/episode/%s', $tvshow_id, $season_number,$episode_number), $options);
}

/**
* Get the TV episode credits by combination of season and episode number.
*
* @param $tvshow_id
* @param $season_number
* @param $episode_number
* @param array $options
* @return mixed
*/
public function getEpisodeCredits($tvshow_id, $season_number, $episode_number, array $options = array())
{
return $this->get(sprintf('tv/%s/season/%s/episode/%s/credits', $tvshow_id, $season_number,$episode_number), $options);
}

/**
* Get the external ids for a TV episode by comabination of a season and episode number.
*
* @param $tvshow_id
* @param $season_number
* @param $episode_number
* @param array $options
* @return mixed
*/
public function getEpisodeExternalIds($tvshow_id, $season_number, $episode_number, array $options = array())
{
return $this->get(sprintf('tv/%s/season/%s/episode/%s/external_ids', $tvshow_id, $season_number,$episode_number), $options);
}

/**
* Get the images (episode stills) for a TV episode by combination of a season and episode number.
*
* @param $tvshow_id
* @param $season_number
* @param $episode_number
* @param array $options
* @return mixed
*/
public function getEpisodeImages($tvshow_id, $season_number, $episode_number, array $options = array())
{
return $this->get(sprintf('tv/%s/season/%s/episode/%s/images', $tvshow_id, $season_number,$episode_number), $options);
}
}
45 changes: 45 additions & 0 deletions lib/Tmdb/Api/TvSeason.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php
/**
* This file is part of the Tmdb PHP API created by Michael Roterman.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @package Tmdb
* @author Michael Roterman <[email protected]>
* @copyright (c) 2013, Michael Roterman
* @version 0.0.1
*/
namespace Tmdb\Api;

use Tmdb\Exception\NotImplementedException;

class TvSeason
extends AbstractApi
{
/**
* Get the primary information about a TV season by its season number.
*
* @param $tvshow_id
* @param $season_number
* @param array $options
* @return mixed
*/
public function getSeason($tvshow_id, $season_number, array $options = array())
{
return $this->get(sprintf('tv/%s/season/%s', $tvshow_id, $season_number), $options);
}

/**
* Get the external ids that we have stored for a TV season by season number.
*
* @param $tvshow_id
* @param $season_number
* @param array $options
* @return mixed
*/
public function getSeasonExternalIds($tvshow_id, $season_number, array $options = array())
{
return $this->get(sprintf('tv/%s/season/%s/external_ids', $tvshow_id, $season_number), $options);
}
}
12 changes: 10 additions & 2 deletions lib/Tmdb/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,20 @@ public function api($name)
break;

case 'tv':
case 'tvseasons':
case 'tvepisodes':
/** @return Api\Tv */
$api = new Api\Tv($this);
break;

case 'tvseason':
/** @return Api\TvSeason */
$api = new Api\TvSeason($this);
break;

case 'tvepisode':
/** @return Api\TvEpisode */
$api = new Api\TvEpisode($this);
break;

case 'people':
/** @return Api\People */
$api = new Api\People($this);
Expand Down

0 comments on commit 3ce13f6

Please sign in to comment.