Skip to content

Commit

Permalink
Adding changes influenced by tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
wtfzdotnet committed Jan 26, 2014
1 parent a3980c9 commit f5f14c8
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 16 deletions.
2 changes: 1 addition & 1 deletion lib/Tmdb/Api/Changes.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function getMovieChanges(array $options = array(), array $headers = array
* @param array $headers
* @return mixed
*/
public function getPeopleChanges(array $options = array(), array $headers = array())
public function getPersonChanges(array $options = array(), array $headers = array())
{
return $this->get('person/changes', $options, $headers);
}
Expand Down
8 changes: 5 additions & 3 deletions lib/Tmdb/Api/Genres.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ public function getGenre($id, array $options = array(), array $headers = array()
{
$response = $this->getGenres();

foreach($response['genres'] as $genre) {
if ($id == $genre['id']) {
return $genre;
if (array_key_exists('genres', $response)) {
foreach($response['genres'] as $genre) {
if ($id == $genre['id']) {
return $genre;
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Tmdb/Api/Jobs.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Jobs
* @param array $headers
* @return mixed
*/
public function getMovieChanges(array $options = array(), array $headers = array())
public function getJobs(array $options = array(), array $headers = array())
{
return $this->get('job/list', $options, $headers);
}
Expand Down
7 changes: 4 additions & 3 deletions lib/Tmdb/Api/Keywords.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,20 @@ class Keywords
/**
* Get the basic information for a specific keyword id.
*
* @param int $keyword_id
* @param array $options
* @param array $headers
* @return mixed
*/
public function getKeywords(array $options = array(), array $headers = array())
public function getKeyword($keyword_id, array $options = array(), array $headers = array())
{
return $this->get('keyword/list', $options, $headers);
return $this->get('keyword/' . $keyword_id, $options, $headers);
}

/**
* Get the list of movies for a particular keyword by id.
*
* @param $keyword_id
* @param int $keyword_id
* @param array $options
* @param array $headers
* @return mixed
Expand Down
14 changes: 7 additions & 7 deletions lib/Tmdb/Api/Search.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Search
public function searchMovies($query, array $options = array(), array $headers = array())
{
return $this->get('search/movie', array_merge($options, array(
'query' => $query
'query' => urlencode($query)
), $headers));
}

Expand All @@ -41,7 +41,7 @@ public function searchMovies($query, array $options = array(), array $headers =
public function searchCollection($query, array $options = array(), array $headers = array())
{
return $this->get('search/collection', array_merge($options, array(
'query' => $query
'query' => urlencode($query)
), $headers));
}

Expand All @@ -56,7 +56,7 @@ public function searchCollection($query, array $options = array(), array $header
public function searchTv($query, array $options = array(), array $headers = array())
{
return $this->get('search/tv', array_merge($options, array(
'query' => $query
'query' => urlencode($query)
), $headers));
}

Expand All @@ -71,7 +71,7 @@ public function searchTv($query, array $options = array(), array $headers = arra
public function searchPersons($query, array $options = array(), array $headers = array())
{
return $this->get('search/person', array_merge($options, array(
'query' => $query
'query' => urlencode($query)
), $headers));
}

Expand All @@ -86,7 +86,7 @@ public function searchPersons($query, array $options = array(), array $headers =
public function searchList($query, array $options = array(), array $headers = array())
{
return $this->get('search/list', array_merge($options, array(
'query' => $query
'query' => urlencode($query)
), $headers));
}

Expand All @@ -101,7 +101,7 @@ public function searchList($query, array $options = array(), array $headers = ar
public function searchCompany($query, array $options = array(), array $headers = array())
{
return $this->get('search/company', array_merge($options, array(
'query' => $query
'query' => urlencode($query)
), $headers));
}

Expand All @@ -116,7 +116,7 @@ public function searchCompany($query, array $options = array(), array $headers =
public function searchKeyword($query, array $options = array(), array $headers = array())
{
return $this->get('search/keyword', array_merge($options, array(
'query' => $query
'query' => urlencode($query)
), $headers));
}
}
2 changes: 1 addition & 1 deletion lib/Tmdb/Api/Tv.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function getCredits($tvshow_id, array $options = array(), array $headers
* @param array $headers
* @return mixed
*/
public function getCast($tvshow_id, array $options = array(), array $headers = array())
public function getExternalIds($tvshow_id, array $options = array(), array $headers = array())
{
return $this->get('tv/' . $tvshow_id . '/external_ids', $options, $headers);
}
Expand Down
28 changes: 28 additions & 0 deletions lib/Tmdb/Api/TvSeason.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,20 @@ public function getSeason($tvshow_id, $season_number, array $options = array(),
return $this->get(sprintf('tv/%s/season/%s', $tvshow_id, $season_number), $options, $headers);
}

/**
* Get the cast & crew credits for a TV season by season number.
*
* @param $tvshow_id
* @param $season_number
* @param array $options
* @param array $headers
* @return mixed
*/
public function getSeasonCredits($tvshow_id, $season_number, array $options = array(), array $headers = array())
{
return $this->get(sprintf('tv/%s/season/%s/credits', $tvshow_id, $season_number), $options, $headers);
}

/**
* Get the external ids that we have stored for a TV season by season number.
*
Expand All @@ -42,4 +56,18 @@ public function getSeasonExternalIds($tvshow_id, $season_number, array $options
{
return $this->get(sprintf('tv/%s/season/%s/external_ids', $tvshow_id, $season_number), $options, $headers);
}

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

0 comments on commit f5f14c8

Please sign in to comment.