PHP Class Moinax\TvDb\Client

Author: Jérôme Poskin ([email protected])
Afficher le fichier Open project: moinax/tvdb Class Usage Examples

Protected Properties

Свойство Type Description
$apiKey string API key for thetvdb.com
$baseUrl string Base url for TheTVDB
$defaultLanguage string Default language.
$httpClient Moinax\TvDb\Http\HttpClient HttpClient used to query the API.
$languages array Array of available languages
$mirrors array Array of available mirrors

Méthodes publiques

Méthode Description
__construct ( string $baseUrl, string $apiKey )
fetchBanner ( string $banner ) : string Fetch banner raw jpeg data from banner mirror.
getActors ( integer $serieId ) : array Find all actors related to a serie
getBanners ( integer $serieId ) : string Find all banners related to a serie
getBannersFiltered ( $serieId, $filter ) Find banners that match a filter string Eg: poster or season
getDefaultLanguage ( ) : string Get the default query language.
getEpisode ( $serieId, $season, $episode, $language = null ) : Episode Get a specific episode by season and episode number
getEpisodeByAirDate ( $serieId, $airdate, null $language = null ) : Episode
getEpisodeById ( $episodeId, $language = null ) : Episode Get a specific episode by his id
getLanguage ( string $abbreviation ) : array Get a language information
getMirror ( integer $typeMask = self::MIRROR_TYPE_XML ) : string Get a random mirror from the list of available mirrors
getSerie ( $serieId, $language = null ) : Serie Find a tv serie by the id from thetvdb.com
getSerieByRemoteId ( array $remoteId, string $language = null ) : Serie Find a tv serie by a remote id
getSerieEpisodes ( integer $serieId, string $language = null, string $format = self::FORMAT_XML ) : array Get all episodes for a serie
getSeries ( string $seriesName, string $language = null ) : array Searches for tv serie based on series name
getServerTime ( ) : string Get the server time for further updates
getUpdates ( integer $previousTime ) : array Get updates list based on previous time you got data
removeEmptyIndexes ( array $array ) : array Removes indexes from an array if they are zero length after trimming
setDefaultLanguage ( string $language ) Set the default query language. It must be a valid language code.
setHttpClient ( Moinax\TvDb\Http\HttpClient $client ) Set the HttpClient used to query the API.

Méthodes protégées

Méthode Description
fetch ( string $url, array $params = [], string $method = self::GET ) : boolean | string Fetch data with curl
fetchXml ( string $function, array $params = [], string $method = self::GET ) : string Fetches data via curl and returns result
fetchZIP ( string $function, array $params = [], string $method = self::GET, string $file = null ) : string Fetches data via curl and returns result
getLanguages ( ) : SimpleXMLElement Get a list of languages available for the content of the api
getMirrors ( ) : void Get a list of mirrors available to fetchXml the data from the api
getXml ( string $data ) : SimpleXMLElement Convert xml string to SimpleXMLElement

Method Details

__construct() public méthode

public __construct ( string $baseUrl, string $apiKey )
$baseUrl string Domain name of the api without trailing slash
$apiKey string Api key provided by http://thetvdb.com

fetch() protected méthode

Fetch data with curl
protected fetch ( string $url, array $params = [], string $method = self::GET ) : boolean | string
$url string
$params array
$method string
Résultat boolean | string

fetchBanner() public méthode

Fetch banner raw jpeg data from banner mirror.
public fetchBanner ( string $banner ) : string
$banner string the banner to fetch like graphical/79349-g7.jpg
Résultat string raw jpeg data

fetchXml() protected méthode

Fetches data via curl and returns result
protected fetchXml ( string $function, array $params = [], string $method = self::GET ) : string
$function string The function used to fetch data in xml
$params array
$method string
Résultat string The data

fetchZIP() protected méthode

Fetches data via curl and returns result
protected fetchZIP ( string $function, array $params = [], string $method = self::GET, string $file = null ) : string
$function string The function used to fetch data in zip
$params array
$method string
$file string The file to extract from the ZIP
Résultat string The data

getActors() public méthode

Find all actors related to a serie
public getActors ( integer $serieId ) : array
$serieId integer
Résultat array

getBanners() public méthode

Find all banners related to a serie
public getBanners ( integer $serieId ) : string
$serieId integer
Résultat string

getBannersFiltered() public méthode

Find banners that match a filter string Eg: poster or season
public getBannersFiltered ( $serieId, $filter )

getDefaultLanguage() public méthode

Get the default query language.
public getDefaultLanguage ( ) : string
Résultat string

getEpisode() public méthode

Get a specific episode by season and episode number
public getEpisode ( $serieId, $season, $episode, $language = null ) : Episode
Résultat Episode

getEpisodeByAirDate() public méthode

public getEpisodeByAirDate ( $serieId, $airdate, null $language = null ) : Episode
$serieId
$airdate
$language null
Résultat Episode

getEpisodeById() public méthode

Get a specific episode by his id
public getEpisodeById ( $episodeId, $language = null ) : Episode
Résultat Episode

getLanguage() public méthode

Get a language information
public getLanguage ( string $abbreviation ) : array
$abbreviation string
Résultat array

getLanguages() protected méthode

Get a list of languages available for the content of the api
protected getLanguages ( ) : SimpleXMLElement
Résultat SimpleXMLElement

getMirror() public méthode

Get a random mirror from the list of available mirrors
public getMirror ( integer $typeMask = self::MIRROR_TYPE_XML ) : string
$typeMask integer
Résultat string

getMirrors() protected méthode

Get a list of mirrors available to fetchXml the data from the api
protected getMirrors ( ) : void
Résultat void

getSerie() public méthode

Find a tv serie by the id from thetvdb.com
public getSerie ( $serieId, $language = null ) : Serie
Résultat Serie A serie object or false if not found

getSerieByRemoteId() public méthode

Find a tv serie by a remote id
public getSerieByRemoteId ( array $remoteId, string $language = null ) : Serie
$remoteId array
$language string
Résultat Serie

getSerieEpisodes() public méthode

Get all episodes for a serie
public getSerieEpisodes ( integer $serieId, string $language = null, string $format = self::FORMAT_XML ) : array
$serieId integer
$language string
$format string
Résultat array

getSeries() public méthode

Searches for tv serie based on series name
public getSeries ( string $seriesName, string $language = null ) : array
$seriesName string
$language string
Résultat array

getServerTime() public méthode

Get the server time for further updates
public getServerTime ( ) : string
Résultat string

getUpdates() public méthode

Get updates list based on previous time you got data
public getUpdates ( integer $previousTime ) : array
$previousTime integer
Résultat array

getXml() protected méthode

Convert xml string to SimpleXMLElement
protected getXml ( string $data ) : SimpleXMLElement
$data string
Résultat SimpleXMLElement

removeEmptyIndexes() public static méthode

Removes indexes from an array if they are zero length after trimming
public static removeEmptyIndexes ( array $array ) : array
$array array The array to remove empty indexes from
Résultat array An array with all empty indexes removed

setDefaultLanguage() public méthode

Set the default query language. It must be a valid language code.
public setDefaultLanguage ( string $language )
$language string

setHttpClient() public méthode

Set the HttpClient used to query the API.
public setHttpClient ( Moinax\TvDb\Http\HttpClient $client )
$client Moinax\TvDb\Http\HttpClient

Property Details

$apiKey protected_oe property

API key for thetvdb.com
protected string $apiKey
Résultat string

$baseUrl protected_oe property

Base url for TheTVDB
protected string $baseUrl
Résultat string

$defaultLanguage protected_oe property

Default language.
protected string $defaultLanguage
Résultat string

$httpClient protected_oe property

HttpClient used to query the API.
protected HttpClient,Moinax\TvDb\Http $httpClient
Résultat Moinax\TvDb\Http\HttpClient

$languages protected_oe property

Array of available languages
protected array $languages
Résultat array

$mirrors protected_oe property

Array of available mirrors
protected array $mirrors
Résultat array