idx
int64
0
60.3k
question
stringlengths
92
4.62k
target
stringlengths
7
635
51,500
protected function constructHttpClient ( ) { $ hasHttpClient = ( null !== $ this -> httpClient ) ; $ this -> httpClient = new HttpClient ( $ this -> getOptions ( ) ) ; if ( ! $ hasHttpClient ) { $ this -> httpClient -> registerDefaults ( ) ; } }
Construct the http client
51,501
public function getSeason ( $ tvshow_id , $ season_number , array $ parameters = [ ] , array $ headers = [ ] ) { return $ this -> get ( sprintf ( 'tv/%s/season/%s' , $ tvshow_id , $ season_number ) , $ parameters , $ headers ) ; }
Get the primary information about a TV season by its season number .
51,502
public function getCredits ( $ tvshow_id , $ season_number , array $ parameters = [ ] , array $ headers = [ ] ) { return $ this -> get ( sprintf ( 'tv/%s/season/%s/credits' , $ tvshow_id , $ season_number ) , $ parameters , $ headers ) ; }
Get the cast & crew credits for a TV season by season number .
51,503
public function getGenre ( $ id , array $ parameters = [ ] , array $ headers = [ ] ) { $ response = $ this -> getGenres ( $ parameters , $ headers ) ; if ( null !== $ response && array_key_exists ( 'genres' , $ response ) ) { return $ this -> extractGenreByIdFromResponse ( $ id , $ response [ 'genres' ] ) ; } return nu...
Get the list of genres and return one by id
51,504
public function load ( $ id , array $ parameters = [ ] , array $ headers = [ ] ) { if ( empty ( $ parameters ) ) { $ parameters = [ new AppendToResponse ( [ AppendToResponse :: IMAGES , ] ) ] ; } $ data = $ this -> getApi ( ) -> getCollection ( $ id , $ this -> parseQueryParameters ( $ parameters ) , $ headers ) ; retu...
Load a collection with the given identifier
51,505
public function load ( $ id , array $ parameters = [ ] , array $ headers = [ ] ) { if ( ! isset ( $ parameters [ 'append_to_response' ] ) ) { $ parameters = array_merge ( $ parameters , [ new AppendToResponse ( [ AppendToResponse :: IMAGES , AppendToResponse :: CHANGES , AppendToResponse :: COMBINED_CREDITS , AppendToR...
Load a person with the given identifier
51,506
public function getExternalIds ( $ id ) { $ data = $ this -> getApi ( ) -> getExternalIds ( $ id ) ; $ person = $ this -> getFactory ( ) -> create ( [ 'external_ids' => $ data ] ) ; return $ person -> getExternalIds ( ) ; }
Get the external ids for a specific person id .
51,507
public function getImages ( $ id ) { $ data = $ this -> getApi ( ) -> getImages ( $ id ) ; $ person = $ this -> getFactory ( ) -> create ( [ 'images' => $ data ] ) ; return $ person -> getImages ( ) ; }
Get the images for a specific person id .
51,508
public function getTaggedImages ( $ id , array $ parameters = [ ] , array $ headers = [ ] ) { $ data = $ this -> getApi ( ) -> getTaggedImages ( $ id , $ this -> parseQueryParameters ( $ parameters ) , $ headers ) ; $ factory = new ImageFactory ( $ this -> getClient ( ) -> getHttpClient ( ) ) ; return $ factory -> crea...
Get the changes for a specific person id .
51,509
public function getPopular ( array $ parameters = [ ] , array $ headers = [ ] ) { $ data = $ this -> getApi ( ) -> getPopular ( $ parameters , $ headers ) ; return $ this -> getFactory ( ) -> createResultCollection ( $ data ) ; }
Get the list of popular people on The Movie Database .
51,510
public function loadCollection ( array $ parameters = [ ] , array $ headers = [ ] ) { return $ this -> createCollection ( $ this -> getApi ( ) -> getJobs ( $ parameters , $ headers ) ) ; }
Get the list of jobs .
51,511
public function findBy ( $ id , array $ parameters = [ ] , array $ headers = [ ] ) { return $ this -> get ( sprintf ( 'find/%s' , $ id ) , $ parameters , $ headers ) ; }
The find method makes it easy to search for objects in our database by an external id .
51,512
public function getHtml ( $ image , $ size = 'original' , $ width = null , $ height = null ) { if ( $ image instanceof Image ) { if ( null == $ image -> getFilePath ( ) ) { return '' ; } $ aspectRatio = $ image -> getAspectRatio ( ) ; if ( null !== $ width && null == $ height && $ aspectRatio !== null ) { $ height = ro...
Get an img html tag for the image in the specified size
51,513
public function create ( array $ data = [ ] , $ key = null ) { $ type = self :: resolveImageType ( $ key ) ; return $ this -> hydrate ( $ type , $ data ) ; }
Convert an array to an hydrated object
51,514
public function resolveImageType ( $ key = null ) { switch ( $ key ) { case 'poster' : case 'posters' : case 'poster_path' : $ object = new Image \ PosterImage ( ) ; break ; case 'backdrop' : case 'backdrops' : case 'backdrop_path' : $ object = new Image \ BackdropImage ( ) ; break ; case 'profile' : case 'profiles' : ...
Helper function to obtain a new object for an image type
51,515
public function createCollection ( array $ data = [ ] ) { $ collection = new Images ( ) ; foreach ( $ data as $ item ) { $ collection -> add ( null , $ this -> create ( $ item ) ) ; } return $ collection ; }
Create generic collection
51,516
public function createImageCollection ( array $ data = [ ] ) { $ collection = new Images ( ) ; foreach ( $ data as $ format => $ formatCollection ) { if ( ! is_array ( $ formatCollection ) ) { continue ; } foreach ( $ formatCollection as $ item ) { if ( array_key_exists ( $ format , Image :: $ formats ) ) { $ item = $ ...
Create full collection
51,517
public function firstAirDateYear ( $ year ) { if ( $ year instanceof \ DateTime ) { $ year = $ year -> format ( 'Y' ) ; } $ this -> set ( 'first_air_date_year' , ( int ) $ year ) ; return $ this ; }
Filter the results release dates to matches that include this value . Expected value is a year .
51,518
public function firstAirDateGte ( $ date ) { if ( $ date instanceof \ DateTime ) { $ date = $ date -> format ( 'Y-m-d' ) ; } $ this -> set ( 'first_air_date.gte' , $ date ) ; return $ this ; }
The minimum release to include . Expected format is YYYY - MM - DD .
51,519
public function firstAirDateLte ( $ date ) { if ( $ date instanceof \ DateTime ) { $ date = $ date -> format ( 'Y-m-d' ) ; } $ this -> set ( 'first_air_date.lte' , $ date ) ; return $ this ; }
The maximum release to include . Expected format is YYYY - MM - DD .
51,520
public function withNetworks ( $ networks ) { if ( is_array ( $ networks ) ) { $ networks = $ this -> withNetworksAnd ( $ networks ) ; } $ this -> set ( 'with_networks' , $ networks ) ; return $ this ; }
Filter TV shows to include a specific network .
51,521
public function withCast ( $ cast , $ mode = self :: MODE_OR ) { $ this -> set ( 'with_cast' , $ this -> with ( $ cast , $ mode ) ) ; return $ this ; }
Only include movies that have this person id added as a cast member .
51,522
public function withCrew ( $ crew , $ mode = self :: MODE_OR ) { $ this -> set ( 'with_crew' , $ this -> with ( $ crew , $ mode ) ) ; return $ this ; }
Only include movies that have this person id added as a crew member .
51,523
public function withCompanies ( $ companies , $ mode = self :: MODE_OR ) { $ this -> set ( 'with_companies' , $ this -> with ( $ companies , $ mode ) ) ; return $ this ; }
Filter movies to include a specific company .
51,524
public function withPeople ( $ people , $ mode = self :: MODE_OR ) { $ this -> set ( 'with_people' , $ this -> with ( $ people , $ mode ) ) ; return $ this ; }
Only include movies that have these person id s added as a cast or crew member .
51,525
protected function with ( $ with = null , $ mode = self :: MODE_OR ) { if ( $ with instanceof GenericCollection ) { $ with = $ with -> toArray ( ) ; } if ( is_array ( $ with ) ) { return $ this -> andWith ( ( array ) $ with , $ mode ) ; } return $ with ; }
Format the with compatible parameters .
51,526
protected function andWith ( array $ with , $ mode ) { return ( implode ( $ mode === self :: MODE_OR ? '|' : ',' , array_map ( [ $ this , 'normalize' ] , $ with ) ) ) ; }
Creates an and query to combine an AND or an OR expression .
51,527
public function getLists ( $ accountId , array $ parameters = [ ] , array $ headers = [ ] ) { $ data = $ this -> getApi ( ) -> getLists ( $ accountId , $ parameters , $ headers ) ; return $ this -> getFactory ( ) -> createResultCollection ( $ data , 'createListItem' ) ; }
Get the lists that you have created and marked as a favorite .
51,528
public function validateRequestTokenWithLogin ( RequestToken $ requestToken , $ username , $ password ) { $ data = $ this -> getApi ( ) -> validateRequestTokenWithLogin ( $ requestToken , $ username , $ password ) ; return $ this -> getFactory ( ) -> createRequestToken ( $ data ) ; }
This method is used to validate a request_token for user based authentication . A request_token is required in order to use any of the write methods .
51,529
public function load ( array $ headers = [ ] ) { $ data = $ this -> getApi ( ) -> getConfiguration ( $ headers ) ; return $ this -> getFactory ( ) -> create ( $ data ) ; }
Load up TMDB Configuration
51,530
public function createListItem ( array $ data = [ ] ) { $ listItem = new Account \ ListItem ( ) ; if ( array_key_exists ( 'poster_path' , $ data ) ) { $ listItem -> setPosterImage ( $ this -> getImageFactory ( ) -> createFromPath ( $ data [ 'poster_path' ] , 'poster_path' ) ) ; } return $ this -> hydrate ( $ listItem ,...
Create list item
51,531
public function hydrate ( HydrationEvent $ event , $ eventName , $ eventDispatcher ) { $ eventDispatcher -> dispatch ( TmdbEvents :: BEFORE_HYDRATION , $ event ) ; if ( $ event -> isPropagationStopped ( ) ) { return $ event -> getSubject ( ) ; } $ subject = $ this -> hydrateSubject ( $ event ) ; $ event -> setSubject (...
Hydrate the subject with data
51,532
public function hydrateSubject ( HydrationEvent $ event ) { $ objectHydrator = new ObjectHydrator ( ) ; return $ objectHydrator -> hydrate ( $ event -> getSubject ( ) , $ event -> getData ( ) ) ; }
Hydrate the subject
51,533
public function getDigits ( $ key , $ default = '' , $ deep = false ) { return str_replace ( array ( '-' , '+' ) , '' , $ this -> filter ( $ key , $ default , $ deep , FILTER_SANITIZE_NUMBER_INT ) ) ; }
Returns the digits of the parameter value .
51,534
public function getBoolean ( $ key , $ default = false , $ deep = false ) { return $ this -> filter ( $ key , $ default , $ deep , FILTER_VALIDATE_BOOLEAN ) ; }
Returns the parameter value converted to boolean .
51,535
public function getAccountStates ( $ tvShow , $ season , $ episode ) { if ( $ tvShow instanceof Tv ) { $ tvShow = $ tvShow -> getId ( ) ; } if ( $ season instanceof Season ) { $ season = $ season -> getSeasonNumber ( ) ; } if ( $ episode instanceof Tv \ Episode ) { $ episode = $ episode -> getEpisodeNumber ( ) ; } retu...
This method lets users get the status of whether or not the TV show has been rated or added to their favourite or watch lists .
51,536
public function getCountry ( $ id ) { foreach ( $ this -> data as $ country ) { if ( strtoupper ( $ id ) == ( string ) $ country ) { return $ country ; } } return null ; }
Retrieve a country from the collection
51,537
public function filterByDepartment ( $ department ) { $ result = $ this -> filter ( function ( $ key , $ value ) use ( $ department ) { if ( $ value -> getDepartment ( ) == $ department ) { return true ; } } ) ; if ( $ result && 1 === count ( $ result ) ) { $ results = $ result -> toArray ( ) ; return array_shift ( $ r...
Filter by department
51,538
public function filterByDepartmentAndReturnJobsList ( $ department ) { $ result = $ this -> filter ( function ( $ key , $ value ) use ( $ department ) { if ( $ value -> getDepartment ( ) == $ department ) { return true ; } } ) ; if ( $ result && 1 === count ( $ result ) ) { $ results = $ result -> toArray ( ) ; $ data ...
Filter by department and return the jobs collection
51,539
public function filterByJob ( $ filterByJob ) { $ result = $ this -> filter ( function ( $ key , $ value ) use ( $ filterByJob ) { $ jobList = $ value -> getJobList ( ) ; foreach ( $ jobList as $ job ) { if ( $ filterByJob == $ job ) { return true ; } } } ) ; if ( $ result && 1 === count ( $ result ) ) { $ results = $ ...
Filter by job
51,540
public function load ( $ id , array $ parameters = [ ] , array $ headers = [ ] ) { return $ this -> loadCollection ( $ parameters , $ headers ) -> filterId ( $ id ) ; }
Load a genre with the given identifier
51,541
public function loadMovieCollection ( array $ parameters = [ ] , array $ headers = [ ] ) { return $ this -> createCollection ( $ this -> getApi ( ) -> getMovieGenres ( $ parameters , $ headers ) ) ; }
Get the list of movie genres .
51,542
public function loadTvCollection ( array $ parameters = [ ] , array $ headers = [ ] ) { return $ this -> createCollection ( $ this -> getApi ( ) -> getTvGenres ( $ parameters , $ headers ) ) ; }
Get the list of tv genres .
51,543
public function getMovies ( $ id , array $ parameters = [ ] , array $ headers = [ ] ) { return $ this -> getMovieFactory ( ) -> createResultCollection ( $ this -> getApi ( ) -> getMovies ( $ id , $ parameters , $ headers ) ) ; }
Get the list of movies for a particular genre by id . By default only movies with 10 or more votes are included .
51,544
public function getMovieList ( array $ parameters = [ ] , array $ headers = [ ] ) { $ data = $ this -> getApi ( ) -> getMovieList ( $ this -> parseQueryParameters ( $ parameters ) , $ headers ) ; return $ this -> getFactory ( ) -> createCollection ( $ data ) ; }
Get the list of supported certifications for movies .
51,545
protected function parseQueryParameters ( array $ parameters = [ ] ) { foreach ( $ parameters as $ key => $ candidate ) { if ( is_a ( $ candidate , 'Tmdb\Model\Common\QueryParameter\QueryParameterInterface' ) ) { $ interfaces = class_implements ( $ candidate ) ; if ( array_key_exists ( 'Tmdb\Model\Common\QueryParameter...
Process query parameters
51,546
public function addSubscriber ( EventSubscriberInterface $ subscriber ) { if ( $ subscriber instanceof HttpClientEventSubscriber ) { $ subscriber -> attachHttpClient ( $ this ) ; } $ this -> eventDispatcher -> addSubscriber ( $ subscriber ) ; }
Add a subscriber
51,547
public function removeSubscriber ( EventSubscriberInterface $ subscriber ) { if ( $ subscriber instanceof HttpClientEventSubscriber ) { $ subscriber -> attachHttpClient ( $ this ) ; } $ this -> eventDispatcher -> removeSubscriber ( $ subscriber ) ; }
Remove a subscriber
51,548
public function setSessionToken ( SessionToken $ sessionToken ) { $ sessionTokenPlugin = new SessionTokenPlugin ( $ sessionToken ) ; $ this -> addSubscriber ( $ sessionTokenPlugin ) ; $ this -> sessionToken = $ sessionToken ; }
Add an subscriber to append the session_token to the query parameters .
51,549
public function registerDefaults ( ) { if ( ! array_key_exists ( 'token' , $ this -> options ) ) { throw new ApiTokenMissingException ( 'An API token was not configured, please configure the `token` option with an correct ApiToken() object.' ) ; } $ requestSubscriber = new RequestSubscriber ( ) ; $ this -> addSubscribe...
Register the default plugins
51,550
public function load ( $ id , array $ parameters = [ ] , array $ headers = [ ] ) { $ data = $ this -> getApi ( ) -> getCompany ( $ id , $ this -> parseQueryParameters ( $ parameters ) , $ headers ) ; return $ this -> getFactory ( ) -> create ( $ data ) ; }
Load a company with the given identifier
51,551
public function getMovies ( $ id , array $ parameters = [ ] , array $ headers = [ ] ) { return $ this -> createMovieCollection ( $ this -> getApi ( ) -> getMovies ( $ id , $ this -> parseQueryParameters ( $ parameters ) , $ headers ) ) ; }
Get the list of movies associated with a particular company .
51,552
public function createMovieCollection ( $ data ) { $ collection = new ResultCollection ( ) ; if ( array_key_exists ( 'results' , $ data ) ) { $ data = $ data [ 'results' ] ; } foreach ( $ data as $ item ) { $ collection -> add ( null , $ this -> getMovieFactory ( ) -> create ( $ item ) ) ; } return $ collection ; }
Create an collection of an array
51,553
public function get ( $ key ) { if ( is_object ( $ key ) ) { $ key = spl_object_hash ( $ key ) ; } return isset ( $ this -> data [ $ key ] ) ? $ this -> data [ $ key ] : null ; }
Get a specific key value .
51,554
public function set ( $ key , $ value ) { if ( $ key === null && is_object ( $ value ) ) { $ key = spl_object_hash ( $ value ) ; } $ this -> data [ $ key ] = $ value ; return $ this ; }
Set a key value pair
51,555
public function add ( $ key , $ value ) { if ( $ key === null && is_object ( $ value ) ) { $ key = spl_object_hash ( $ value ) ; } if ( ! array_key_exists ( $ key , $ this -> data ) && null !== $ key ) { $ this -> data [ $ key ] = $ value ; } elseif ( ! array_key_exists ( $ key , $ this -> data ) && null == $ key ) { $...
Add a value to a key .
51,556
public function remove ( $ key ) { if ( is_object ( $ key ) ) { $ key = spl_object_hash ( $ key ) ; } unset ( $ this -> data [ $ key ] ) ; return $ this ; }
Remove a specific key value pair
51,557
public function filterLanguage ( $ language = 'en' ) { return $ this -> filter ( function ( $ key , $ value ) use ( $ language ) { if ( $ value instanceof LanguageFilter && $ value -> getIso6391 ( ) == $ language ) { return true ; } } ) ; }
Filter by language ISO 639 - 1 code .
51,558
public function filterCountry ( $ country = 'US' ) { return $ this -> filter ( function ( $ key , $ value ) use ( $ country ) { if ( $ value instanceof CountryFilter && $ value -> getIso31661 ( ) == $ country ) { return true ; } } ) ; }
Filter by country ISO 3166 - 1 code .
51,559
public function filterAdult ( $ adult = false ) { return $ this -> filter ( function ( $ key , $ value ) use ( $ adult ) { if ( $ value instanceof AdultFilter && $ value -> getAdult ( ) == $ adult ) { return true ; } } ) ; }
Filter by adult content
51,560
public function load ( $ id , array $ parameters = [ ] , array $ headers = [ ] ) { if ( ! isset ( $ parameters [ 'append_to_response' ] ) ) { $ parameters = array_merge ( $ parameters , [ new AppendToResponse ( [ AppendToResponse :: ALTERNATIVE_TITLES , AppendToResponse :: CHANGES , AppendToResponse :: CREDITS , Append...
Load a movie with the given identifier
51,561
public function getTranslations ( $ id , array $ parameters = [ ] , array $ headers = [ ] ) { $ data = $ this -> getApi ( ) -> getTranslations ( $ id , $ this -> parseQueryParameters ( $ parameters ) , $ headers ) ; $ movie = $ this -> getFactory ( ) -> create ( [ 'translations' => $ data ] ) ; return $ movie -> getTra...
Get the translations for a specific movie id .
51,562
public function rate ( $ id , $ rating ) { return $ this -> getFactory ( ) -> createResult ( $ this -> getApi ( ) -> rateMovie ( $ id , $ rating ) ) ; }
This method lets users rate a movie . A valid session id or guest session id is required .
51,563
public function createResultCollection ( $ data = [ ] , $ method = 'create' ) { $ collection = new ResultCollection ( ) ; if ( null === $ data ) { return $ collection ; } if ( array_key_exists ( 'page' , $ data ) ) { $ collection -> setPage ( $ data [ 'page' ] ) ; } if ( array_key_exists ( 'total_pages' , $ data ) ) { ...
Create a result collection
51,564
protected function createGenericCollectionFromMediaTypes ( $ data = [ ] ) { $ movieFactory = new MovieFactory ( $ this -> getHttpClient ( ) ) ; $ tvFactory = new TvFactory ( $ this -> getHttpClient ( ) ) ; $ collection = new GenericCollection ( ) ; foreach ( $ data as $ item ) { switch ( $ item [ 'media_type' ] ) { cas...
Create an generic collection of an array that consists out of a mix of movies and tv shows
51,565
public function createAccountStates ( array $ data = [ ] ) { $ accountStates = new AccountStates ( ) ; if ( array_key_exists ( 'rated' , $ data ) ) { if ( $ data [ 'rated' ] ) { $ rating = new Rating ( ) ; $ accountStates -> setRated ( $ this -> hydrate ( $ rating , $ data [ 'rated' ] ) ) ; } else { $ accountStates -> ...
Create the account states
51,566
public function getRatedMovies ( array $ parameters = [ ] , array $ headers = [ ] ) { $ sessionToken = $ this -> client -> getSessionToken ( ) ; if ( ! $ sessionToken instanceof SessionToken ) { throw new MissingSessionTokenException ( 'The guest session token was not set on the client.' ) ; } return $ this -> get ( 'g...
Get a list of rated movies for a specific guest session id .
51,567
public function discoverMovies ( DiscoverMoviesQuery $ query , array $ headers = [ ] ) { $ query = $ query -> toArray ( ) ; if ( array_key_exists ( 'certification_country' , $ query ) && ! array_key_exists ( 'certification.lte' , $ query ) ) { throw new RuntimeException ( 'When the certification_country option is given...
Discover movies by different types of data like average rating number of votes genres and certifications .
51,568
public function discoverTv ( DiscoverTvQuery $ query , array $ headers = [ ] ) { $ data = $ this -> getApi ( ) -> discoverTv ( $ query -> toArray ( ) , $ headers ) ; return $ this -> getTvFactory ( ) -> createResultCollection ( $ data ) ; }
Discover TV shows by different types of data like average rating number of votes genres the network they aired on and air dates .
51,569
public function load ( $ id , array $ parameters = [ ] , array $ headers = [ ] ) { return $ this -> getFactory ( ) -> create ( $ this -> getApi ( ) -> getList ( $ id , $ parameters , $ headers ) ) ; }
Get a list by id .
51,570
public function add ( $ id , $ mediaId ) { return $ this -> getFactory ( ) -> createResult ( $ this -> getApi ( ) -> addMediaToList ( $ id , $ mediaId ) ) ; }
This method lets users add new movies to a list that they created . A valid session id is required .
51,571
public function remove ( $ id , $ mediaId ) { return $ this -> getFactory ( ) -> createResult ( $ this -> getApi ( ) -> removeMediaFromList ( $ id , $ mediaId ) ) ; }
This method lets users delete movies from a list that they created . A valid session id is required .
51,572
public function load ( $ id , array $ parameters = [ ] , array $ headers = [ ] ) { if ( ! isset ( $ parameters [ 'append_to_response' ] ) ) { $ parameters = array_merge ( $ parameters , [ new AppendToResponse ( [ AppendToResponse :: CREDITS , AppendToResponse :: EXTERNAL_IDS , AppendToResponse :: IMAGES , AppendToRespo...
Load a tv with the given identifier
51,573
public function getPopular ( array $ options = [ ] , array $ headers = [ ] ) { return $ this -> getFactory ( ) -> createResultCollection ( $ this -> getApi ( ) -> getPopular ( $ options , $ headers ) ) ; }
Get the list of popular tvs on The Tv Database . This list refreshes every day .
51,574
public function getAiringToday ( array $ options = [ ] , array $ headers = [ ] ) { return $ this -> getFactory ( ) -> createResultCollection ( $ this -> getApi ( ) -> getAiringToday ( $ options , $ headers ) ) ; }
Get the list of TV shows that air today .
51,575
public function getMovieChanges ( ChangesQuery $ query , array $ headers = [ ] ) { $ data = $ this -> getApi ( ) -> getMovieChanges ( $ query -> toArray ( ) , $ headers ) ; return $ this -> getFactory ( ) -> createResultCollection ( $ data ) ; }
Get a list of movie ids that have been edited .
51,576
public function getPeopleChanges ( ChangesQuery $ query , array $ headers = [ ] ) { $ data = $ this -> getApi ( ) -> getPersonChanges ( $ query -> toArray ( ) , $ headers ) ; return $ this -> getFactory ( ) -> createResultCollection ( $ data ) ; }
Get a list of people ids that have been edited .
51,577
public function getMovies ( $ id , array $ parameters = [ ] , array $ headers = [ ] ) { return $ this -> getFactory ( ) -> createResultCollection ( $ this -> getApi ( ) -> getMovies ( $ id , $ parameters , $ headers ) , 'createMovie' ) ; }
Get the list of movies for a particular keyword by id . By default only movies with 10 or more votes are included .
51,578
public function createRequestToken ( array $ data = [ ] ) { $ token = new RequestToken ( ) ; if ( array_key_exists ( 'expires_at' , $ data ) ) { $ token -> setExpiresAt ( new \ DateTime ( $ data [ 'expires_at' ] ) ) ; } if ( array_key_exists ( 'request_token' , $ data ) ) { $ token -> setToken ( $ data [ 'request_token...
Create request token
51,579
public function createSessionToken ( array $ data = [ ] ) { $ token = new SessionToken ( ) ; if ( array_key_exists ( 'session_id' , $ data ) ) { $ token -> setToken ( $ data [ 'session_id' ] ) ; } if ( array_key_exists ( 'success' , $ data ) ) { $ token -> setSuccess ( $ data [ 'success' ] ) ; } return $ token ; }
Create session token for user
51,580
public function createGuestSessionToken ( array $ data = [ ] ) { $ token = new GuestSessionToken ( ) ; if ( array_key_exists ( 'expires_at' , $ data ) ) { $ token -> setExpiresAt ( new \ DateTime ( $ data [ 'expires_at' ] ) ) ; } if ( array_key_exists ( 'guest_session_id' , $ data ) ) { $ token -> setToken ( $ data [ '...
Create session token for guest
51,581
public function getSessionTokenWithLogin ( $ requestToken , $ username , $ password ) { $ validatedRequestToken = $ this -> validateRequestTokenWithLogin ( $ requestToken , $ username , $ password ) ; if ( ! $ validatedRequestToken [ 'success' ] ) { throw new \ InvalidArgumentException ( 'Unable to validate the request...
Helper method to validate the request_token and obtain a session_token
51,582
public function getCredits ( $ tvShow , $ season , array $ parameters = [ ] , array $ headers = [ ] ) { if ( $ tvShow instanceof Tv ) { $ tvShow = $ tvShow -> getId ( ) ; } if ( $ season instanceof Season ) { $ season = $ season -> getSeasonNumber ( ) ; } $ data = $ this -> getApi ( ) -> getCredits ( $ tvShow , $ seaso...
Get the cast & crew information about a TV series .
51,583
public function getAccountStates ( $ tvshow_id , $ season_number , $ episode_number ) { return $ this -> get ( sprintf ( 'tv/%s/season/%s/episode/%s/account_states' , $ tvshow_id , $ season_number , $ episode_number ) ) ; }
This method lets users get the status of whether or not the TV episode has been rated .
51,584
public function rateTvEpisode ( $ tvshow_id , $ season_number , $ episode_number , $ rating ) { return $ this -> postJson ( sprintf ( 'tv/%s/season/%s/episode/%s/rating' , $ tvshow_id , $ season_number , $ episode_number ) , [ 'value' => ( float ) $ rating ] ) ; }
This method lets users rate a TV episode .
51,585
public function getConfiguration ( Request $ request ) { $ this -> request = $ request ; return [ 'base_uri' => $ request -> getOptions ( ) -> get ( 'base_url' ) , 'headers' => $ request -> getHeaders ( ) -> all ( ) , 'query' => $ request -> getParameters ( ) -> all ( ) ] ; }
Format the request for Guzzle
51,586
private function createResponse ( ResponseInterface $ adapterResponse = null ) { $ response = new Response ( ) ; if ( $ adapterResponse !== null ) { $ response -> setCode ( $ adapterResponse -> getStatusCode ( ) ) ; $ response -> setHeaders ( new ParameterBag ( $ adapterResponse -> getHeaders ( ) ) ) ; $ response -> se...
Create the response object
51,587
protected function handleRequestException ( Request $ request , RequestException $ previousException ) { if ( null !== $ previousException ) { $ response = $ previousException -> getResponse ( ) ; if ( null == $ response || ( $ response -> getStatusCode ( ) >= 500 && $ response -> getStatusCode ( ) <= 599 ) ) { throw n...
Create the request exception
51,588
protected function createApiException ( Request $ request , Response $ response , \ Exception $ previous = null ) { $ errors = json_decode ( ( string ) $ response -> getBody ( ) ) ; return new TmdbApiException ( isset ( $ errors -> status_code ) ? $ errors -> status_code : $ response -> getCode ( ) , isset ( $ errors -...
Create the unified exception to throw
51,589
public function filterPosters ( ) { return $ this -> filter ( function ( $ key , $ value ) { if ( $ value instanceof ImageFilter && $ value instanceof Image \ PosterImage ) { return true ; } } ) ; }
Filter poster images
51,590
public function filterBackdrops ( ) { return $ this -> filter ( function ( $ key , $ value ) { if ( $ value instanceof ImageFilter && $ value instanceof Image \ BackdropImage ) { return true ; } } ) ; }
Filter backdrop images
51,591
public function filterProfile ( ) { return $ this -> filter ( function ( $ key , $ value ) { if ( $ value instanceof ImageFilter && $ value instanceof Image \ ProfileImage ) { return true ; } } ) ; }
Filter profile images
51,592
public function filterStills ( ) { return $ this -> filter ( function ( $ key , $ value ) { if ( $ value instanceof ImageFilter && $ value instanceof Image \ StillImage ) { return true ; } } ) ; }
Filter still images
51,593
public function filterBestVotedImage ( ) { $ currentImage = null ; $ voteAverage = - 1 ; foreach ( $ this -> data as $ image ) { if ( $ image -> getVoteAverage ( ) > $ voteAverage ) { $ voteAverage = $ image -> getVoteAverage ( ) ; $ currentImage = $ image ; } } return $ currentImage ; }
Return a single image that is rated highest
51,594
public function sendRequest ( RequestEvent $ event ) { switch ( $ event -> getMethod ( ) ) { case 'GET' : $ response = $ this -> getHttpClient ( ) -> getAdapter ( ) -> get ( $ event -> getRequest ( ) ) ; break ; case 'HEAD' : $ response = $ this -> getHttpClient ( ) -> getAdapter ( ) -> head ( $ event -> getRequest ( )...
Call upon the adapter to create an response object
51,595
public function searchMovies ( $ query , array $ parameters = [ ] , array $ headers = [ ] ) { return $ this -> get ( 'search/movie' , array_merge ( $ parameters , [ 'query' => $ query ] , $ headers ) ) ; }
Search for movies by title .
51,596
public function searchCollection ( $ query , array $ parameters = [ ] , array $ headers = [ ] ) { return $ this -> get ( 'search/collection' , array_merge ( $ parameters , [ 'query' => $ query ] , $ headers ) ) ; }
Search for collections by name .
51,597
public function searchTv ( $ query , array $ parameters = [ ] , array $ headers = [ ] ) { return $ this -> get ( 'search/tv' , array_merge ( $ parameters , [ 'query' => $ query ] , $ headers ) ) ; }
Search for TV shows by title .
51,598
public function searchPersons ( $ query , array $ parameters = [ ] , array $ headers = [ ] ) { return $ this -> get ( 'search/person' , array_merge ( $ parameters , [ 'query' => $ query ] , $ headers ) ) ; }
Search for people by name .
51,599
public function searchList ( $ query , array $ parameters = [ ] , array $ headers = [ ] ) { return $ this -> get ( 'search/list' , array_merge ( $ parameters , [ 'query' => $ query ] , $ headers ) ) ; }
Search for lists by name and description .