repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
php-tmdb/api
lib/Tmdb/HttpClient/HttpClient.php
HttpClient.post
public function post($path, $body, array $parameters = [], array $headers = []) { return $this->send($path, 'POST', $parameters, $headers, $body); }
php
public function post($path, $body, array $parameters = [], array $headers = []) { return $this->send($path, 'POST', $parameters, $headers, $body); }
[ "public", "function", "post", "(", "$", "path", ",", "$", "body", ",", "array", "$", "parameters", "=", "[", "]", ",", "array", "$", "headers", "=", "[", "]", ")", "{", "return", "$", "this", "->", "send", "(", "$", "path", ",", "'POST'", ",", ...
{@inheritDoc}
[ "{" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/HttpClient/HttpClient.php#L113-L116
php-tmdb/api
lib/Tmdb/HttpClient/HttpClient.php
HttpClient.put
public function put($path, $body = null, array $parameters = [], array $headers = []) { return $this->send($path, 'PUT', $parameters, $headers, $body); }
php
public function put($path, $body = null, array $parameters = [], array $headers = []) { return $this->send($path, 'PUT', $parameters, $headers, $body); }
[ "public", "function", "put", "(", "$", "path", ",", "$", "body", "=", "null", ",", "array", "$", "parameters", "=", "[", "]", ",", "array", "$", "headers", "=", "[", "]", ")", "{", "return", "$", "this", "->", "send", "(", "$", "path", ",", "'P...
{@inheritDoc}
[ "{" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/HttpClient/HttpClient.php#L129-L132
php-tmdb/api
lib/Tmdb/HttpClient/HttpClient.php
HttpClient.patch
public function patch($path, $body = null, array $parameters = [], array $headers = []) { return $this->send($path, 'PATCH', $parameters, $headers, $body); }
php
public function patch($path, $body = null, array $parameters = [], array $headers = []) { return $this->send($path, 'PATCH', $parameters, $headers, $body); }
[ "public", "function", "patch", "(", "$", "path", ",", "$", "body", "=", "null", ",", "array", "$", "parameters", "=", "[", "]", ",", "array", "$", "headers", "=", "[", "]", ")", "{", "return", "$", "this", "->", "send", "(", "$", "path", ",", "...
{@inheritDoc}
[ "{" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/HttpClient/HttpClient.php#L137-L140
php-tmdb/api
lib/Tmdb/HttpClient/HttpClient.php
HttpClient.delete
public function delete($path, $body = null, array $parameters = [], array $headers = []) { return $this->send($path, 'DELETE', $parameters, $headers, $body); }
php
public function delete($path, $body = null, array $parameters = [], array $headers = []) { return $this->send($path, 'DELETE', $parameters, $headers, $body); }
[ "public", "function", "delete", "(", "$", "path", ",", "$", "body", "=", "null", ",", "array", "$", "parameters", "=", "[", "]", ",", "array", "$", "headers", "=", "[", "]", ")", "{", "return", "$", "this", "->", "send", "(", "$", "path", ",", ...
{@inheritDoc}
[ "{" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/HttpClient/HttpClient.php#L145-L148
php-tmdb/api
lib/Tmdb/HttpClient/HttpClient.php
HttpClient.createRequest
private function createRequest($path, $method, $parameters = [], $headers = [], $body) { $request = new Request(); $request ->setPath($path) ->setMethod($method) ->setParameters(new ParameterBag((array) $parameters)) ->setHeaders(new ParameterBag((array) $headers)) ->setBody($body) ->setOptions(new ParameterBag((array) $this->options)) ; return $this->lastRequest = $request; }
php
private function createRequest($path, $method, $parameters = [], $headers = [], $body) { $request = new Request(); $request ->setPath($path) ->setMethod($method) ->setParameters(new ParameterBag((array) $parameters)) ->setHeaders(new ParameterBag((array) $headers)) ->setBody($body) ->setOptions(new ParameterBag((array) $this->options)) ; return $this->lastRequest = $request; }
[ "private", "function", "createRequest", "(", "$", "path", ",", "$", "method", ",", "$", "parameters", "=", "[", "]", ",", "$", "headers", "=", "[", "]", ",", "$", "body", ")", "{", "$", "request", "=", "new", "Request", "(", ")", ";", "$", "reque...
Create the request object @param $path @param $method @param array $parameters @param array $headers @param $body @return Request
[ "Create", "the", "request", "object" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/HttpClient/HttpClient.php#L258-L272
php-tmdb/api
lib/Tmdb/HttpClient/HttpClient.php
HttpClient.addSubscriber
public function addSubscriber(EventSubscriberInterface $subscriber) { if ($subscriber instanceof HttpClientEventSubscriber) { $subscriber->attachHttpClient($this); } $this->eventDispatcher->addSubscriber($subscriber); }
php
public function addSubscriber(EventSubscriberInterface $subscriber) { if ($subscriber instanceof HttpClientEventSubscriber) { $subscriber->attachHttpClient($this); } $this->eventDispatcher->addSubscriber($subscriber); }
[ "public", "function", "addSubscriber", "(", "EventSubscriberInterface", "$", "subscriber", ")", "{", "if", "(", "$", "subscriber", "instanceof", "HttpClientEventSubscriber", ")", "{", "$", "subscriber", "->", "attachHttpClient", "(", "$", "this", ")", ";", "}", ...
Add a subscriber @param EventSubscriberInterface $subscriber
[ "Add", "a", "subscriber" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/HttpClient/HttpClient.php#L279-L286
php-tmdb/api
lib/Tmdb/HttpClient/HttpClient.php
HttpClient.removeSubscriber
public function removeSubscriber(EventSubscriberInterface $subscriber) { if ($subscriber instanceof HttpClientEventSubscriber) { $subscriber->attachHttpClient($this); } $this->eventDispatcher->removeSubscriber($subscriber); }
php
public function removeSubscriber(EventSubscriberInterface $subscriber) { if ($subscriber instanceof HttpClientEventSubscriber) { $subscriber->attachHttpClient($this); } $this->eventDispatcher->removeSubscriber($subscriber); }
[ "public", "function", "removeSubscriber", "(", "EventSubscriberInterface", "$", "subscriber", ")", "{", "if", "(", "$", "subscriber", "instanceof", "HttpClientEventSubscriber", ")", "{", "$", "subscriber", "->", "attachHttpClient", "(", "$", "this", ")", ";", "}",...
Remove a subscriber @param EventSubscriberInterface $subscriber
[ "Remove", "a", "subscriber" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/HttpClient/HttpClient.php#L293-L300
php-tmdb/api
lib/Tmdb/HttpClient/HttpClient.php
HttpClient.setSessionToken
public function setSessionToken(SessionToken $sessionToken) { $sessionTokenPlugin = new SessionTokenPlugin($sessionToken); $this->addSubscriber($sessionTokenPlugin); $this->sessionToken = $sessionToken; }
php
public function setSessionToken(SessionToken $sessionToken) { $sessionTokenPlugin = new SessionTokenPlugin($sessionToken); $this->addSubscriber($sessionTokenPlugin); $this->sessionToken = $sessionToken; }
[ "public", "function", "setSessionToken", "(", "SessionToken", "$", "sessionToken", ")", "{", "$", "sessionTokenPlugin", "=", "new", "SessionTokenPlugin", "(", "$", "sessionToken", ")", ";", "$", "this", "->", "addSubscriber", "(", "$", "sessionTokenPlugin", ")", ...
Add an subscriber to append the session_token to the query parameters. @param SessionToken $sessionToken
[ "Add", "an", "subscriber", "to", "append", "the", "session_token", "to", "the", "query", "parameters", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/HttpClient/HttpClient.php#L315-L321
php-tmdb/api
lib/Tmdb/HttpClient/HttpClient.php
HttpClient.registerDefaults
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->addSubscriber($requestSubscriber); $hydrationSubscriber = new HydrationSubscriber(); $this->addSubscriber($hydrationSubscriber); $apiTokenPlugin = new ApiTokenPlugin( is_string($this->options['token']) ? new ApiToken($this->options['token']): $this->options['token'] ); $this->addSubscriber($apiTokenPlugin); $acceptJsonHeaderPlugin = new AcceptJsonHeaderPlugin(); $this->addSubscriber($acceptJsonHeaderPlugin); $contentTypeHeaderPlugin = new ContentTypeJsonHeaderPlugin(); $this->addSubscriber($contentTypeHeaderPlugin); $userAgentHeaderPlugin = new UserAgentHeaderPlugin(); $this->addSubscriber($userAgentHeaderPlugin); return $this; }
php
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->addSubscriber($requestSubscriber); $hydrationSubscriber = new HydrationSubscriber(); $this->addSubscriber($hydrationSubscriber); $apiTokenPlugin = new ApiTokenPlugin( is_string($this->options['token']) ? new ApiToken($this->options['token']): $this->options['token'] ); $this->addSubscriber($apiTokenPlugin); $acceptJsonHeaderPlugin = new AcceptJsonHeaderPlugin(); $this->addSubscriber($acceptJsonHeaderPlugin); $contentTypeHeaderPlugin = new ContentTypeJsonHeaderPlugin(); $this->addSubscriber($contentTypeHeaderPlugin); $userAgentHeaderPlugin = new UserAgentHeaderPlugin(); $this->addSubscriber($userAgentHeaderPlugin); return $this; }
[ "public", "function", "registerDefaults", "(", ")", "{", "if", "(", "!", "array_key_exists", "(", "'token'", ",", "$", "this", "->", "options", ")", ")", "{", "throw", "new", "ApiTokenMissingException", "(", "'An API token was not configured, please configure the `tok...
Register the default plugins @return $this
[ "Register", "the", "default", "plugins" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/HttpClient/HttpClient.php#L348-L378
php-tmdb/api
lib/Tmdb/HttpClient/HttpClient.php
HttpClient.setDefaultCaching
public function setDefaultCaching(array $parameters) { if ($parameters['enabled']) { if (!class_exists('Doctrine\Common\Cache\CacheProvider')) { //@codeCoverageIgnoreStart throw new \RuntimeException( 'Could not find the doctrine cache library, have you added doctrine-cache to your composer.json?' ); //@codeCoverageIgnoreEnd } $this->adapter->getClient()->getConfig('handler')->push( new CacheMiddleware( new PrivateCacheStrategy( new DoctrineCacheStorage( $parameters['handler'] ) ) ), 'tmdb-cache' ); } return $this; }
php
public function setDefaultCaching(array $parameters) { if ($parameters['enabled']) { if (!class_exists('Doctrine\Common\Cache\CacheProvider')) { //@codeCoverageIgnoreStart throw new \RuntimeException( 'Could not find the doctrine cache library, have you added doctrine-cache to your composer.json?' ); //@codeCoverageIgnoreEnd } $this->adapter->getClient()->getConfig('handler')->push( new CacheMiddleware( new PrivateCacheStrategy( new DoctrineCacheStorage( $parameters['handler'] ) ) ), 'tmdb-cache' ); } return $this; }
[ "public", "function", "setDefaultCaching", "(", "array", "$", "parameters", ")", "{", "if", "(", "$", "parameters", "[", "'enabled'", "]", ")", "{", "if", "(", "!", "class_exists", "(", "'Doctrine\\Common\\Cache\\CacheProvider'", ")", ")", "{", "//@codeCoverageI...
Add an subscriber to enable caching. @param array $parameters @throws \RuntimeException @return $this
[ "Add", "an", "subscriber", "to", "enable", "caching", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/HttpClient/HttpClient.php#L435-L460
php-tmdb/api
lib/Tmdb/HttpClient/HttpClient.php
HttpClient.setDefaultLogging
public function setDefaultLogging(array $parameters) { if ($parameters['enabled']) { if (!class_exists('\Monolog\Logger')) { //@codeCoverageIgnoreStart throw new \RuntimeException( 'Could not find any logger set and the monolog logger library was not found to provide a default, you have to set a custom logger on the client or have you forgot adding monolog to your composer.json?' ); //@codeCoverageIgnoreEnd } $logger = new Logger('php-tmdb-api'); $logger->pushHandler($parameters['handler']); if ($this->getAdapter() instanceof GuzzleAdapter) { $middleware = new \Concat\Http\Middleware\Logger($logger); $middleware->setRequestLoggingEnabled(true); $middleware->setLogLevel(function($response) { return LogLevel::DEBUG; }); $this->getAdapter()->getClient()->getConfig('handler')->push( $middleware, 'tmdb-log' ); } } return $this; }
php
public function setDefaultLogging(array $parameters) { if ($parameters['enabled']) { if (!class_exists('\Monolog\Logger')) { //@codeCoverageIgnoreStart throw new \RuntimeException( 'Could not find any logger set and the monolog logger library was not found to provide a default, you have to set a custom logger on the client or have you forgot adding monolog to your composer.json?' ); //@codeCoverageIgnoreEnd } $logger = new Logger('php-tmdb-api'); $logger->pushHandler($parameters['handler']); if ($this->getAdapter() instanceof GuzzleAdapter) { $middleware = new \Concat\Http\Middleware\Logger($logger); $middleware->setRequestLoggingEnabled(true); $middleware->setLogLevel(function($response) { return LogLevel::DEBUG; }); $this->getAdapter()->getClient()->getConfig('handler')->push( $middleware, 'tmdb-log' ); } } return $this; }
[ "public", "function", "setDefaultLogging", "(", "array", "$", "parameters", ")", "{", "if", "(", "$", "parameters", "[", "'enabled'", "]", ")", "{", "if", "(", "!", "class_exists", "(", "'\\Monolog\\Logger'", ")", ")", "{", "//@codeCoverageIgnoreStart", "throw...
Enable logging @param array $parameters @throws \RuntimeException @return $this
[ "Enable", "logging" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/HttpClient/HttpClient.php#L469-L500
php-tmdb/api
lib/Tmdb/Factory/CertificationFactory.php
CertificationFactory.createCollection
public function createCollection(array $data = []) { if (array_key_exists('certifications', $data)) { $data = $data['certifications']; } $collection = new GenericCollection(); foreach ($data as $country => $certifications) { $certification = new Certification(); $certification->setCountry($country); foreach ($certifications as $countryCertification) { $object = $this->create($countryCertification); $certification->getCertifications()->add(null, $object); } $collection->add(null, $certification); } return $collection; }
php
public function createCollection(array $data = []) { if (array_key_exists('certifications', $data)) { $data = $data['certifications']; } $collection = new GenericCollection(); foreach ($data as $country => $certifications) { $certification = new Certification(); $certification->setCountry($country); foreach ($certifications as $countryCertification) { $object = $this->create($countryCertification); $certification->getCertifications()->add(null, $object); } $collection->add(null, $certification); } return $collection; }
[ "public", "function", "createCollection", "(", "array", "$", "data", "=", "[", "]", ")", "{", "if", "(", "array_key_exists", "(", "'certifications'", ",", "$", "data", ")", ")", "{", "$", "data", "=", "$", "data", "[", "'certifications'", "]", ";", "}"...
{@inheritdoc}
[ "{" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Factory/CertificationFactory.php#L37-L59
php-tmdb/api
lib/Tmdb/Repository/CompanyRepository.php
CompanyRepository.load
public function load($id, array $parameters = [], array $headers = []) { $data = $this->getApi()->getCompany($id, $this->parseQueryParameters($parameters), $headers); return $this->getFactory()->create($data); }
php
public function load($id, array $parameters = [], array $headers = []) { $data = $this->getApi()->getCompany($id, $this->parseQueryParameters($parameters), $headers); return $this->getFactory()->create($data); }
[ "public", "function", "load", "(", "$", "id", ",", "array", "$", "parameters", "=", "[", "]", ",", "array", "$", "headers", "=", "[", "]", ")", "{", "$", "data", "=", "$", "this", "->", "getApi", "(", ")", "->", "getCompany", "(", "$", "id", ",...
Load a company with the given identifier @param $id @param array $parameters @param array $headers @return Company
[ "Load", "a", "company", "with", "the", "given", "identifier" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Repository/CompanyRepository.php#L35-L40
php-tmdb/api
lib/Tmdb/Repository/CompanyRepository.php
CompanyRepository.getMovies
public function getMovies($id, array $parameters = [], array $headers = []) { return $this->createMovieCollection( $this->getApi()->getMovies($id, $this->parseQueryParameters($parameters), $headers) ); }
php
public function getMovies($id, array $parameters = [], array $headers = []) { return $this->createMovieCollection( $this->getApi()->getMovies($id, $this->parseQueryParameters($parameters), $headers) ); }
[ "public", "function", "getMovies", "(", "$", "id", ",", "array", "$", "parameters", "=", "[", "]", ",", "array", "$", "headers", "=", "[", "]", ")", "{", "return", "$", "this", "->", "createMovieCollection", "(", "$", "this", "->", "getApi", "(", ")"...
Get the list of movies associated with a particular company. @param integer $id @param array $parameters @param array $headers @return ResultCollection
[ "Get", "the", "list", "of", "movies", "associated", "with", "a", "particular", "company", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Repository/CompanyRepository.php#L50-L55
php-tmdb/api
lib/Tmdb/Repository/CompanyRepository.php
CompanyRepository.createMovieCollection
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; }
php
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; }
[ "public", "function", "createMovieCollection", "(", "$", "data", ")", "{", "$", "collection", "=", "new", "ResultCollection", "(", ")", ";", "if", "(", "array_key_exists", "(", "'results'", ",", "$", "data", ")", ")", "{", "$", "data", "=", "$", "data", ...
Create an collection of an array @param $data @return ResultCollection
[ "Create", "an", "collection", "of", "an", "array" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Repository/CompanyRepository.php#L89-L102
php-tmdb/api
lib/Tmdb/Factory/CompanyFactory.php
CompanyFactory.create
public function create(array $data = []) { $company = new Company(); if (array_key_exists('logo_path', $data)) { $company->setLogoImage($this->getImageFactory()->createFromPath($data['logo_path'], 'logo_path')); } return $this->hydrate($company, $data); }
php
public function create(array $data = []) { $company = new Company(); if (array_key_exists('logo_path', $data)) { $company->setLogoImage($this->getImageFactory()->createFromPath($data['logo_path'], 'logo_path')); } return $this->hydrate($company, $data); }
[ "public", "function", "create", "(", "array", "$", "data", "=", "[", "]", ")", "{", "$", "company", "=", "new", "Company", "(", ")", ";", "if", "(", "array_key_exists", "(", "'logo_path'", ",", "$", "data", ")", ")", "{", "$", "company", "->", "set...
{@inheritdoc}
[ "{" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Factory/CompanyFactory.php#L45-L54
php-tmdb/api
lib/Tmdb/Model/Common/GenericCollection.php
GenericCollection.get
public function get($key) { if (is_object($key)) { $key = spl_object_hash($key); } return isset($this->data[$key]) ? $this->data[$key] : null; }
php
public function get($key) { if (is_object($key)) { $key = spl_object_hash($key); } return isset($this->data[$key]) ? $this->data[$key] : null; }
[ "public", "function", "get", "(", "$", "key", ")", "{", "if", "(", "is_object", "(", "$", "key", ")", ")", "{", "$", "key", "=", "spl_object_hash", "(", "$", "key", ")", ";", "}", "return", "isset", "(", "$", "this", "->", "data", "[", "$", "ke...
Get a specific key value. @param string $key Key to retrieve. @return mixed|null Value of the key or NULL
[ "Get", "a", "specific", "key", "value", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Model/Common/GenericCollection.php#L94-L101
php-tmdb/api
lib/Tmdb/Model/Common/GenericCollection.php
GenericCollection.set
public function set($key, $value) { if ($key === null && is_object($value)) { $key = spl_object_hash($value); } $this->data[$key] = $value; return $this; }
php
public function set($key, $value) { if ($key === null && is_object($value)) { $key = spl_object_hash($value); } $this->data[$key] = $value; return $this; }
[ "public", "function", "set", "(", "$", "key", ",", "$", "value", ")", "{", "if", "(", "$", "key", "===", "null", "&&", "is_object", "(", "$", "value", ")", ")", "{", "$", "key", "=", "spl_object_hash", "(", "$", "value", ")", ";", "}", "$", "th...
Set a key value pair @param string $key Key to set @param mixed $value Value to set @return GenericCollection Returns a reference to the object
[ "Set", "a", "key", "value", "pair" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Model/Common/GenericCollection.php#L111-L120
php-tmdb/api
lib/Tmdb/Model/Common/GenericCollection.php
GenericCollection.add
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) { $this->data[] = $value; } elseif (is_array($this->data[$key])) { $this->data[$key][] = $value; } else { $this->data[$key] = [$this->data[$key], $value]; } return $this; }
php
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) { $this->data[] = $value; } elseif (is_array($this->data[$key])) { $this->data[$key][] = $value; } else { $this->data[$key] = [$this->data[$key], $value]; } return $this; }
[ "public", "function", "add", "(", "$", "key", ",", "$", "value", ")", "{", "if", "(", "$", "key", "===", "null", "&&", "is_object", "(", "$", "value", ")", ")", "{", "$", "key", "=", "spl_object_hash", "(", "$", "value", ")", ";", "}", "if", "(...
Add a value to a key. @param string $key Key to add @param mixed $value Value to add to the key @return GenericCollection Returns a reference to the object.
[ "Add", "a", "value", "to", "a", "key", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Model/Common/GenericCollection.php#L130-L147
php-tmdb/api
lib/Tmdb/Model/Common/GenericCollection.php
GenericCollection.remove
public function remove($key) { if (is_object($key)) { $key = spl_object_hash($key); } unset($this->data[$key]); return $this; }
php
public function remove($key) { if (is_object($key)) { $key = spl_object_hash($key); } unset($this->data[$key]); return $this; }
[ "public", "function", "remove", "(", "$", "key", ")", "{", "if", "(", "is_object", "(", "$", "key", ")", ")", "{", "$", "key", "=", "spl_object_hash", "(", "$", "key", ")", ";", "}", "unset", "(", "$", "this", "->", "data", "[", "$", "key", "]"...
Remove a specific key value pair @param string $key A key to remove or an object in the same state @return GenericCollection
[ "Remove", "a", "specific", "key", "value", "pair" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Model/Common/GenericCollection.php#L156-L165
php-tmdb/api
lib/Tmdb/Model/Common/GenericCollection.php
GenericCollection.filterId
public function filterId($id) { if (1 === count($this->data)) { return array_shift($this->data); } $result = $this->filter( function ($key, $value) use ($id) { if ($value->getId() == $id) { return true; } } ); if (!count($result)) { return null; } $collection = $result->getAll(); return array_shift($collection); }
php
public function filterId($id) { if (1 === count($this->data)) { return array_shift($this->data); } $result = $this->filter( function ($key, $value) use ($id) { if ($value->getId() == $id) { return true; } } ); if (!count($result)) { return null; } $collection = $result->getAll(); return array_shift($collection); }
[ "public", "function", "filterId", "(", "$", "id", ")", "{", "if", "(", "1", "===", "count", "(", "$", "this", "->", "data", ")", ")", "{", "return", "array_shift", "(", "$", "this", "->", "data", ")", ";", "}", "$", "result", "=", "$", "this", ...
Filter by id @param integer $id @return GenericCollection
[ "Filter", "by", "id" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Model/Common/GenericCollection.php#L342-L363
php-tmdb/api
lib/Tmdb/Model/Common/GenericCollection.php
GenericCollection.filterLanguage
public function filterLanguage($language = 'en') { return $this->filter( function ($key, $value) use ($language) { if ($value instanceof LanguageFilter && $value->getIso6391() == $language) { return true; } } ); }
php
public function filterLanguage($language = 'en') { return $this->filter( function ($key, $value) use ($language) { if ($value instanceof LanguageFilter && $value->getIso6391() == $language) { return true; } } ); }
[ "public", "function", "filterLanguage", "(", "$", "language", "=", "'en'", ")", "{", "return", "$", "this", "->", "filter", "(", "function", "(", "$", "key", ",", "$", "value", ")", "use", "(", "$", "language", ")", "{", "if", "(", "$", "value", "i...
Filter by language ISO 639-1 code. @param string $language @return GenericCollection
[ "Filter", "by", "language", "ISO", "639", "-", "1", "code", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Model/Common/GenericCollection.php#L371-L380
php-tmdb/api
lib/Tmdb/Model/Common/GenericCollection.php
GenericCollection.filterCountry
public function filterCountry($country = 'US') { return $this->filter( function ($key, $value) use ($country) { if ($value instanceof CountryFilter && $value->getIso31661() == $country) { return true; } } ); }
php
public function filterCountry($country = 'US') { return $this->filter( function ($key, $value) use ($country) { if ($value instanceof CountryFilter && $value->getIso31661() == $country) { return true; } } ); }
[ "public", "function", "filterCountry", "(", "$", "country", "=", "'US'", ")", "{", "return", "$", "this", "->", "filter", "(", "function", "(", "$", "key", ",", "$", "value", ")", "use", "(", "$", "country", ")", "{", "if", "(", "$", "value", "inst...
Filter by country ISO 3166-1 code. @param string $country @return GenericCollection
[ "Filter", "by", "country", "ISO", "3166", "-", "1", "code", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Model/Common/GenericCollection.php#L388-L397
php-tmdb/api
lib/Tmdb/Model/Common/GenericCollection.php
GenericCollection.filterAdult
public function filterAdult($adult = false) { return $this->filter( function ($key, $value) use ($adult) { if ($value instanceof AdultFilter && $value->getAdult() == $adult) { return true; } } ); }
php
public function filterAdult($adult = false) { return $this->filter( function ($key, $value) use ($adult) { if ($value instanceof AdultFilter && $value->getAdult() == $adult) { return true; } } ); }
[ "public", "function", "filterAdult", "(", "$", "adult", "=", "false", ")", "{", "return", "$", "this", "->", "filter", "(", "function", "(", "$", "key", ",", "$", "value", ")", "use", "(", "$", "adult", ")", "{", "if", "(", "$", "value", "instanceo...
Filter by adult content @param boolean $adult @return GenericCollection
[ "Filter", "by", "adult", "content" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Model/Common/GenericCollection.php#L405-L414
php-tmdb/api
lib/Tmdb/Repository/MovieRepository.php
MovieRepository.load
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, AppendToResponse::IMAGES, AppendToResponse::KEYWORDS, AppendToResponse::LISTS, AppendToResponse::RELEASE_DATES, AppendToResponse::REVIEWS, AppendToResponse::SIMILAR, AppendToResponse::RECOMMENDATIONS, AppendToResponse::TRANSLATIONS, AppendToResponse::VIDEOS, ]) ]); } $data = $this->getApi()->getMovie($id, $this->parseQueryParameters($parameters), $headers); return $this->getFactory()->create($data); }
php
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, AppendToResponse::IMAGES, AppendToResponse::KEYWORDS, AppendToResponse::LISTS, AppendToResponse::RELEASE_DATES, AppendToResponse::REVIEWS, AppendToResponse::SIMILAR, AppendToResponse::RECOMMENDATIONS, AppendToResponse::TRANSLATIONS, AppendToResponse::VIDEOS, ]) ]); } $data = $this->getApi()->getMovie($id, $this->parseQueryParameters($parameters), $headers); return $this->getFactory()->create($data); }
[ "public", "function", "load", "(", "$", "id", ",", "array", "$", "parameters", "=", "[", "]", ",", "array", "$", "headers", "=", "[", "]", ")", "{", "if", "(", "!", "isset", "(", "$", "parameters", "[", "'append_to_response'", "]", ")", ")", "{", ...
Load a movie with the given identifier If you want to optimize the result set/bandwidth you should define the AppendToResponse parameter @param $id @param $parameters @param $headers @return null|\Tmdb\Model\AbstractModel
[ "Load", "a", "movie", "with", "the", "given", "identifier" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Repository/MovieRepository.php#L58-L82
php-tmdb/api
lib/Tmdb/Repository/MovieRepository.php
MovieRepository.getTranslations
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->getTranslations(); }
php
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->getTranslations(); }
[ "public", "function", "getTranslations", "(", "$", "id", ",", "array", "$", "parameters", "=", "[", "]", ",", "array", "$", "headers", "=", "[", "]", ")", "{", "$", "data", "=", "$", "this", "->", "getApi", "(", ")", "->", "getTranslations", "(", "...
Get the translations for a specific movie id. @param $id @param $parameters @param $headers @return null|\Tmdb\Model\AbstractModel
[ "Get", "the", "translations", "for", "a", "specific", "movie", "id", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Repository/MovieRepository.php#L172-L178
php-tmdb/api
lib/Tmdb/Repository/MovieRepository.php
MovieRepository.rate
public function rate($id, $rating) { return $this->getFactory()->createResult( $this->getApi()->rateMovie($id, $rating) ); }
php
public function rate($id, $rating) { return $this->getFactory()->createResult( $this->getApi()->rateMovie($id, $rating) ); }
[ "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. @param integer $id @param float $rating @return Movie[]
[ "This", "method", "lets", "users", "rate", "a", "movie", ".", "A", "valid", "session", "id", "or", "guest", "session", "id", "is", "required", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Repository/MovieRepository.php#L373-L378
php-tmdb/api
lib/Tmdb/Factory/Common/VideoFactory.php
VideoFactory.create
public function create(array $data = []) { $videoType = $this->resolveVideoType($data); return (null === $videoType) ? null : $this->hydrate($videoType, $data); }
php
public function create(array $data = []) { $videoType = $this->resolveVideoType($data); return (null === $videoType) ? null : $this->hydrate($videoType, $data); }
[ "public", "function", "create", "(", "array", "$", "data", "=", "[", "]", ")", "{", "$", "videoType", "=", "$", "this", "->", "resolveVideoType", "(", "$", "data", ")", ";", "return", "(", "null", "===", "$", "videoType", ")", "?", "null", ":", "$"...
{@inheritdoc}
[ "{" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Factory/Common/VideoFactory.php#L28-L33
php-tmdb/api
lib/Tmdb/Factory/AbstractFactory.php
AbstractFactory.createGenericCollection
protected function createGenericCollection($data = [], $class) { if (is_object($class)) { $class = get_class($class); } $collection = new GenericCollection(); if (null === $data) { return $collection; } foreach ($data as $item) { $collection->add(null, $this->hydrate(new $class(), $item)); } return $collection; }
php
protected function createGenericCollection($data = [], $class) { if (is_object($class)) { $class = get_class($class); } $collection = new GenericCollection(); if (null === $data) { return $collection; } foreach ($data as $item) { $collection->add(null, $this->hydrate(new $class(), $item)); } return $collection; }
[ "protected", "function", "createGenericCollection", "(", "$", "data", "=", "[", "]", ",", "$", "class", ")", "{", "if", "(", "is_object", "(", "$", "class", ")", ")", "{", "$", "class", "=", "get_class", "(", "$", "class", ")", ";", "}", "$", "coll...
Create a generic collection of data and map it on the class by it's static parameter $properties @param array $data @param $class @return GenericCollection
[ "Create", "a", "generic", "collection", "of", "data", "and", "map", "it", "on", "the", "class", "by", "it", "s", "static", "parameter", "$properties" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Factory/AbstractFactory.php#L79-L96
php-tmdb/api
lib/Tmdb/Factory/AbstractFactory.php
AbstractFactory.createResultCollection
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)) { $collection->setTotalPages($data['total_pages']); } if (array_key_exists('total_results', $data)) { $collection->setTotalResults($data['total_results']); } if (array_key_exists('results', $data)) { $data = $data['results']; } foreach ($data as $item) { $collection->add(null, $this->$method($item)); } return $collection; }
php
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)) { $collection->setTotalPages($data['total_pages']); } if (array_key_exists('total_results', $data)) { $collection->setTotalResults($data['total_results']); } if (array_key_exists('results', $data)) { $data = $data['results']; } foreach ($data as $item) { $collection->add(null, $this->$method($item)); } return $collection; }
[ "public", "function", "createResultCollection", "(", "$", "data", "=", "[", "]", ",", "$", "method", "=", "'create'", ")", "{", "$", "collection", "=", "new", "ResultCollection", "(", ")", ";", "if", "(", "null", "===", "$", "data", ")", "{", "return",...
Create a result collection @param array $data @param string $method @return ResultCollection
[ "Create", "a", "result", "collection" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Factory/AbstractFactory.php#L105-L134
php-tmdb/api
lib/Tmdb/Factory/AbstractFactory.php
AbstractFactory.createCustomCollection
protected function createCustomCollection($data = [], $class, $collection) { if (is_object($class)) { $class = get_class($class); } if (null === $data) { return $collection; } foreach ($data as $item) { $collection->add(null, $this->hydrate(new $class(), $item)); } return $collection; }
php
protected function createCustomCollection($data = [], $class, $collection) { if (is_object($class)) { $class = get_class($class); } if (null === $data) { return $collection; } foreach ($data as $item) { $collection->add(null, $this->hydrate(new $class(), $item)); } return $collection; }
[ "protected", "function", "createCustomCollection", "(", "$", "data", "=", "[", "]", ",", "$", "class", ",", "$", "collection", ")", "{", "if", "(", "is_object", "(", "$", "class", ")", ")", "{", "$", "class", "=", "get_class", "(", "$", "class", ")",...
Create a generic collection of data and map it on the class by it's static parameter $properties @param array $data @param AbstractModel $class @param GenericCollection $collection @return GenericCollection
[ "Create", "a", "generic", "collection", "of", "data", "and", "map", "it", "on", "the", "class", "by", "it", "s", "static", "parameter", "$properties" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Factory/AbstractFactory.php#L144-L159
php-tmdb/api
lib/Tmdb/Factory/AbstractFactory.php
AbstractFactory.createGenericCollectionFromMediaTypes
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']) { case "movie": $collection->add(null, $movieFactory->create($item)); break; case "tv": $collection->add(null, $tvFactory->create($item)); break; default: throw new \RuntimeException('Unknown media type "%s"', $item['media_type']); } } return $collection; }
php
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']) { case "movie": $collection->add(null, $movieFactory->create($item)); break; case "tv": $collection->add(null, $tvFactory->create($item)); break; default: throw new \RuntimeException('Unknown media type "%s"', $item['media_type']); } } return $collection; }
[ "protected", "function", "createGenericCollectionFromMediaTypes", "(", "$", "data", "=", "[", "]", ")", "{", "$", "movieFactory", "=", "new", "MovieFactory", "(", "$", "this", "->", "getHttpClient", "(", ")", ")", ";", "$", "tvFactory", "=", "new", "TvFactor...
Create an generic collection of an array that consists out of a mix of movies and tv shows @param array $data @return GenericCollection
[ "Create", "an", "generic", "collection", "of", "an", "array", "that", "consists", "out", "of", "a", "mix", "of", "movies", "and", "tv", "shows" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Factory/AbstractFactory.php#L167-L189
php-tmdb/api
lib/Tmdb/Factory/AbstractFactory.php
AbstractFactory.createAccountStates
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->setRated(false); } } return $this->hydrate($accountStates, $data); }
php
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->setRated(false); } } return $this->hydrate($accountStates, $data); }
[ "public", "function", "createAccountStates", "(", "array", "$", "data", "=", "[", "]", ")", "{", "$", "accountStates", "=", "new", "AccountStates", "(", ")", ";", "if", "(", "array_key_exists", "(", "'rated'", ",", "$", "data", ")", ")", "{", "if", "("...
Create the account states @param array $data @return \Tmdb\Model\AbstractModel
[ "Create", "the", "account", "states" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Factory/AbstractFactory.php#L208-L223
php-tmdb/api
lib/Tmdb/Factory/AbstractFactory.php
AbstractFactory.hydrate
protected function hydrate(AbstractModel $subject, $data = []) { $httpClient = $this->getHttpClient(); $event = new HydrationEvent($subject, $data); $event->setLastRequest($httpClient->getLastRequest()); $event->setLastResponse($httpClient->getLastResponse()); $this->getHttpClient()->getEventDispatcher()->dispatch(TmdbEvents::HYDRATE, $event); return $event->getSubject(); }
php
protected function hydrate(AbstractModel $subject, $data = []) { $httpClient = $this->getHttpClient(); $event = new HydrationEvent($subject, $data); $event->setLastRequest($httpClient->getLastRequest()); $event->setLastResponse($httpClient->getLastResponse()); $this->getHttpClient()->getEventDispatcher()->dispatch(TmdbEvents::HYDRATE, $event); return $event->getSubject(); }
[ "protected", "function", "hydrate", "(", "AbstractModel", "$", "subject", ",", "$", "data", "=", "[", "]", ")", "{", "$", "httpClient", "=", "$", "this", "->", "getHttpClient", "(", ")", ";", "$", "event", "=", "new", "HydrationEvent", "(", "$", "subje...
Hydrate the object with data @param AbstractModel $subject @param array $data @return AbstractModel
[ "Hydrate", "the", "object", "with", "data" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Factory/AbstractFactory.php#L243-L254
php-tmdb/api
lib/Tmdb/Factory/Common/ChangeFactory.php
ChangeFactory.create
public function create(array $data = []) { $change = new Change(); if (array_key_exists('items', $data)) { $items = new GenericCollection(); foreach ($data['items'] as $item) { $item = $this->createChangeItem($item); $items->add(null, $item); } $change->setItems($items); } return $this->hydrate($change, $data); }
php
public function create(array $data = []) { $change = new Change(); if (array_key_exists('items', $data)) { $items = new GenericCollection(); foreach ($data['items'] as $item) { $item = $this->createChangeItem($item); $items->add(null, $item); } $change->setItems($items); } return $this->hydrate($change, $data); }
[ "public", "function", "create", "(", "array", "$", "data", "=", "[", "]", ")", "{", "$", "change", "=", "new", "Change", "(", ")", ";", "if", "(", "array_key_exists", "(", "'items'", ",", "$", "data", ")", ")", "{", "$", "items", "=", "new", "Gen...
{@inheritdoc}
[ "{" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Factory/Common/ChangeFactory.php#L28-L45
php-tmdb/api
lib/Tmdb/Api/GuestSession.php
GuestSession.getRatedMovies
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('guest_session/' . $sessionToken->getToken() . '/rated_movies', $parameters, $headers); }
php
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('guest_session/' . $sessionToken->getToken() . '/rated_movies', $parameters, $headers); }
[ "public", "function", "getRatedMovies", "(", "array", "$", "parameters", "=", "[", "]", ",", "array", "$", "headers", "=", "[", "]", ")", "{", "$", "sessionToken", "=", "$", "this", "->", "client", "->", "getSessionToken", "(", ")", ";", "if", "(", "...
Get a list of rated movies for a specific guest session id. @param array $parameters @param array $headers @throws MissingSessionTokenException when the guest session token was not set on the client. @return mixed
[ "Get", "a", "list", "of", "rated", "movies", "for", "a", "specific", "guest", "session", "id", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Api/GuestSession.php#L32-L41
php-tmdb/api
lib/Tmdb/Repository/DiscoverRepository.php
DiscoverRepository.discoverMovies
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 the certification.lte option is required.' ); } $data = $this->getApi()->discoverMovies($query, $headers); return $this->getMovieFactory()->createResultCollection($data); }
php
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 the certification.lte option is required.' ); } $data = $this->getApi()->discoverMovies($query, $headers); return $this->getMovieFactory()->createResultCollection($data); }
[ "public", "function", "discoverMovies", "(", "DiscoverMoviesQuery", "$", "query", ",", "array", "$", "headers", "=", "[", "]", ")", "{", "$", "query", "=", "$", "query", "->", "toArray", "(", ")", ";", "if", "(", "array_key_exists", "(", "'certification_co...
Discover movies by different types of data like average rating, number of votes, genres and certifications. @param DiscoverMoviesQuery $query @param array $headers @throws RuntimeException when certification_country is set but certification.lte is not given @return Movie[]
[ "Discover", "movies", "by", "different", "types", "of", "data", "like", "average", "rating", "number", "of", "votes", "genres", "and", "certifications", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Repository/DiscoverRepository.php#L38-L51
php-tmdb/api
lib/Tmdb/Repository/DiscoverRepository.php
DiscoverRepository.discoverTv
public function discoverTv(DiscoverTvQuery $query, array $headers = []) { $data = $this->getApi()->discoverTv($query->toArray(), $headers); return $this->getTvFactory()->createResultCollection($data); }
php
public function discoverTv(DiscoverTvQuery $query, array $headers = []) { $data = $this->getApi()->discoverTv($query->toArray(), $headers); return $this->getTvFactory()->createResultCollection($data); }
[ "public", "function", "discoverTv", "(", "DiscoverTvQuery", "$", "query", ",", "array", "$", "headers", "=", "[", "]", ")", "{", "$", "data", "=", "$", "this", "->", "getApi", "(", ")", "->", "discoverTv", "(", "$", "query", "->", "toArray", "(", ")"...
Discover TV shows by different types of data like average rating, number of votes, genres, the network they aired on and air dates. @param DiscoverTvQuery $query @param array $headers @return Tv[]
[ "Discover", "TV", "shows", "by", "different", "types", "of", "data", "like", "average", "rating", "number", "of", "votes", "genres", "the", "network", "they", "aired", "on", "and", "air", "dates", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Repository/DiscoverRepository.php#L61-L66
php-tmdb/api
lib/Tmdb/Factory/TvEpisodeFactory.php
TvEpisodeFactory.create
public function create(array $data = []) { if (!$data) { return null; } $tvEpisode = new Episode(); if (array_key_exists('credits', $data)) { if (array_key_exists('cast', $data['credits'])) { $tvEpisode ->getCredits() ->setCast( $this->getCastFactory() ->createCollection( $data['credits']['cast'], new CastMember() ) ); } if (array_key_exists('crew', $data['credits'])) { $tvEpisode->getCredits()->setCrew( $this->getCrewFactory()->createCollection( $data['credits']['crew'], new CrewMember() ) ); } if (array_key_exists('guest_stars', $data['credits'])) { $tvEpisode ->getCredits() ->setGuestStars( $this->getGuestStarFactory() ->createCollection( $data['credits']['guest_stars'], new GuestStar() ) ); } } /** External ids */ if (array_key_exists('external_ids', $data)) { $tvEpisode->setExternalIds( $this->hydrate(new ExternalIds(), $data['external_ids']) ); } /** Images */ if (array_key_exists('images', $data)) { $tvEpisode->setImages($this->getImageFactory()->createCollectionFromTvEpisode($data['images'])); } if (array_key_exists('still_path', $data)) { $tvEpisode->setStillImage($this->getImageFactory()->createFromPath($data['still_path'], 'still_path')); } if (array_key_exists('videos', $data)) { $tvEpisode->setVideos($this->getVideoFactory()->createResultCollection($data['videos'])); } if (array_key_exists('changes', $data)) { $tvEpisode->setChanges($this->getChangesFactory()->createCollection($data['changes'])); } return $this->hydrate($tvEpisode, $data); }
php
public function create(array $data = []) { if (!$data) { return null; } $tvEpisode = new Episode(); if (array_key_exists('credits', $data)) { if (array_key_exists('cast', $data['credits'])) { $tvEpisode ->getCredits() ->setCast( $this->getCastFactory() ->createCollection( $data['credits']['cast'], new CastMember() ) ); } if (array_key_exists('crew', $data['credits'])) { $tvEpisode->getCredits()->setCrew( $this->getCrewFactory()->createCollection( $data['credits']['crew'], new CrewMember() ) ); } if (array_key_exists('guest_stars', $data['credits'])) { $tvEpisode ->getCredits() ->setGuestStars( $this->getGuestStarFactory() ->createCollection( $data['credits']['guest_stars'], new GuestStar() ) ); } } /** External ids */ if (array_key_exists('external_ids', $data)) { $tvEpisode->setExternalIds( $this->hydrate(new ExternalIds(), $data['external_ids']) ); } /** Images */ if (array_key_exists('images', $data)) { $tvEpisode->setImages($this->getImageFactory()->createCollectionFromTvEpisode($data['images'])); } if (array_key_exists('still_path', $data)) { $tvEpisode->setStillImage($this->getImageFactory()->createFromPath($data['still_path'], 'still_path')); } if (array_key_exists('videos', $data)) { $tvEpisode->setVideos($this->getVideoFactory()->createResultCollection($data['videos'])); } if (array_key_exists('changes', $data)) { $tvEpisode->setChanges($this->getChangesFactory()->createCollection($data['changes'])); } return $this->hydrate($tvEpisode, $data); }
[ "public", "function", "create", "(", "array", "$", "data", "=", "[", "]", ")", "{", "if", "(", "!", "$", "data", ")", "{", "return", "null", ";", "}", "$", "tvEpisode", "=", "new", "Episode", "(", ")", ";", "if", "(", "array_key_exists", "(", "'c...
{@inheritdoc}
[ "{" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Factory/TvEpisodeFactory.php#L84-L152
php-tmdb/api
lib/Tmdb/Factory/CollectionFactory.php
CollectionFactory.create
public function create(array $data = []) { $collection = new Collection(); if (array_key_exists('parts', $data)) { $collection->setParts( $this->getMovieFactory()->createCollection($data['parts']) ); } if (array_key_exists('backdrop_path', $data)) { $collection->setBackdropImage( $this->getImageFactory()->createFromPath($data['backdrop_path'], 'backdrop_path') ); } if (array_key_exists('images', $data)) { $collection->setImages( $this->getImageFactory()->createCollectionFromMovie($data['images']) ); } if (array_key_exists('poster_path', $data)) { $collection->setPosterImage( $this->getImageFactory()->createFromPath($data['poster_path'], 'poster_path') ); } return $this->hydrate($collection, $data); }
php
public function create(array $data = []) { $collection = new Collection(); if (array_key_exists('parts', $data)) { $collection->setParts( $this->getMovieFactory()->createCollection($data['parts']) ); } if (array_key_exists('backdrop_path', $data)) { $collection->setBackdropImage( $this->getImageFactory()->createFromPath($data['backdrop_path'], 'backdrop_path') ); } if (array_key_exists('images', $data)) { $collection->setImages( $this->getImageFactory()->createCollectionFromMovie($data['images']) ); } if (array_key_exists('poster_path', $data)) { $collection->setPosterImage( $this->getImageFactory()->createFromPath($data['poster_path'], 'poster_path') ); } return $this->hydrate($collection, $data); }
[ "public", "function", "create", "(", "array", "$", "data", "=", "[", "]", ")", "{", "$", "collection", "=", "new", "Collection", "(", ")", ";", "if", "(", "array_key_exists", "(", "'parts'", ",", "$", "data", ")", ")", "{", "$", "collection", "->", ...
{@inheritdoc} @return \Tmdb\Model\Collection
[ "{" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Factory/CollectionFactory.php#L52-L81
php-tmdb/api
lib/Tmdb/Factory/PeopleFactory.php
PeopleFactory.create
public function create(array $data = [], $person = null) { if (!is_object($person)) { if (array_key_exists('character', $data)) { $person = new CastMember(); } if (array_key_exists('job', $data)) { $person = new CrewMember(); } if (null === $person) { $person = new Person(); } } if (array_key_exists('profile_path', $data)) { $person->setProfileImage($this->getImageFactory()->createFromPath($data['profile_path'], 'profile_path')); } if ($person instanceof Person) { /** Images */ if (array_key_exists('images', $data)) { $person->setImages($this->getImageFactory()->createCollectionFromPeople($data['images'])); } if (array_key_exists('changes', $data)) { $person->setChanges($this->getChangeFactory()->createCollection($data['changes'])); } /** External ids */ if (array_key_exists('external_ids', $data)) { $person->setExternalIds( $this->hydrate(new ExternalIds(), $data['external_ids']) ); } if (array_key_exists('tagged_images', $data)) { $person->setTaggedImages( $this->getImageFactory()->createResultCollection( $data['tagged_images'], 'createMediaImage' ) ); } /** External ids */ if (array_key_exists('known_for', $data)) { $person->setKnownFor( $this->createGenericCollectionFromMediaTypes($data['known_for']) ); } /** Credits */ $this->applyCredits($data, $person); } return $this->hydrate($person, $data); }
php
public function create(array $data = [], $person = null) { if (!is_object($person)) { if (array_key_exists('character', $data)) { $person = new CastMember(); } if (array_key_exists('job', $data)) { $person = new CrewMember(); } if (null === $person) { $person = new Person(); } } if (array_key_exists('profile_path', $data)) { $person->setProfileImage($this->getImageFactory()->createFromPath($data['profile_path'], 'profile_path')); } if ($person instanceof Person) { /** Images */ if (array_key_exists('images', $data)) { $person->setImages($this->getImageFactory()->createCollectionFromPeople($data['images'])); } if (array_key_exists('changes', $data)) { $person->setChanges($this->getChangeFactory()->createCollection($data['changes'])); } /** External ids */ if (array_key_exists('external_ids', $data)) { $person->setExternalIds( $this->hydrate(new ExternalIds(), $data['external_ids']) ); } if (array_key_exists('tagged_images', $data)) { $person->setTaggedImages( $this->getImageFactory()->createResultCollection( $data['tagged_images'], 'createMediaImage' ) ); } /** External ids */ if (array_key_exists('known_for', $data)) { $person->setKnownFor( $this->createGenericCollectionFromMediaTypes($data['known_for']) ); } /** Credits */ $this->applyCredits($data, $person); } return $this->hydrate($person, $data); }
[ "public", "function", "create", "(", "array", "$", "data", "=", "[", "]", ",", "$", "person", "=", "null", ")", "{", "if", "(", "!", "is_object", "(", "$", "person", ")", ")", "{", "if", "(", "array_key_exists", "(", "'character'", ",", "$", "data"...
@param array $data @param Person\AbstractMember|null $person @return Person
[ "@param", "array", "$data", "@param", "Person", "\\", "AbstractMember|null", "$person" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Factory/PeopleFactory.php#L56-L114
php-tmdb/api
lib/Tmdb/Factory/PeopleFactory.php
PeopleFactory.applyCredits
protected function applyCredits(array $data, Person $person) { $hydrator = new ObjectHydrator(); $types = ['movie_credits', 'tv_credits', 'combined_credits']; foreach ($types as $type) { if (array_key_exists($type, $data)) { $method = $hydrator->camelize(sprintf('get_%s', $type)); if (array_key_exists('cast', $data[$type])) { $cast = $this->createCustomCollection( $data[$type]['cast'], new Person\Credit(), new People\Cast() ); foreach ($cast as $member) { $member->setPosterImage($this->getPosterImageForCredit($member->getPosterPath())); } $person->$method()->setCast($cast); } if (array_key_exists('crew', $data[$type])) { $crew = $this->createCustomCollection( $data[$type]['crew'], new Person\Credit(), new People\Crew() ); foreach ($crew as $member) { $member->setPosterImage($this->getPosterImageForCredit($member->getPosterPath())); } $person->$method()->setCrew($crew); } } } }
php
protected function applyCredits(array $data, Person $person) { $hydrator = new ObjectHydrator(); $types = ['movie_credits', 'tv_credits', 'combined_credits']; foreach ($types as $type) { if (array_key_exists($type, $data)) { $method = $hydrator->camelize(sprintf('get_%s', $type)); if (array_key_exists('cast', $data[$type])) { $cast = $this->createCustomCollection( $data[$type]['cast'], new Person\Credit(), new People\Cast() ); foreach ($cast as $member) { $member->setPosterImage($this->getPosterImageForCredit($member->getPosterPath())); } $person->$method()->setCast($cast); } if (array_key_exists('crew', $data[$type])) { $crew = $this->createCustomCollection( $data[$type]['crew'], new Person\Credit(), new People\Crew() ); foreach ($crew as $member) { $member->setPosterImage($this->getPosterImageForCredit($member->getPosterPath())); } $person->$method()->setCrew($crew); } } } }
[ "protected", "function", "applyCredits", "(", "array", "$", "data", ",", "Person", "$", "person", ")", "{", "$", "hydrator", "=", "new", "ObjectHydrator", "(", ")", ";", "$", "types", "=", "[", "'movie_credits'", ",", "'tv_credits'", ",", "'combined_credits'...
Apply credits @param array $data @param Person $person
[ "Apply", "credits" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Factory/PeopleFactory.php#L122-L160
php-tmdb/api
lib/Tmdb/Factory/PeopleFactory.php
PeopleFactory.createCollection
public function createCollection(array $data = [], $person = null, $collection = null) { if (!$collection) { $collection = new People(); } if (array_key_exists('results', $data)) { $data = $data['results']; } if (is_object($person)) { $class = get_class($person); } else { $class = '\Tmdb\Model\Person'; } foreach ($data as $item) { $collection->add(null, $this->create($item, new $class())); } return $collection; }
php
public function createCollection(array $data = [], $person = null, $collection = null) { if (!$collection) { $collection = new People(); } if (array_key_exists('results', $data)) { $data = $data['results']; } if (is_object($person)) { $class = get_class($person); } else { $class = '\Tmdb\Model\Person'; } foreach ($data as $item) { $collection->add(null, $this->create($item, new $class())); } return $collection; }
[ "public", "function", "createCollection", "(", "array", "$", "data", "=", "[", "]", ",", "$", "person", "=", "null", ",", "$", "collection", "=", "null", ")", "{", "if", "(", "!", "$", "collection", ")", "{", "$", "collection", "=", "new", "People", ...
{@inheritdoc} @param Person\AbstractMember|null $person @param GenericCollection|null $collection
[ "{" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Factory/PeopleFactory.php#L172-L193
php-tmdb/api
lib/Tmdb/Repository/ListRepository.php
ListRepository.load
public function load($id, array $parameters = [], array $headers = []) { return $this->getFactory()->create( $this->getApi()->getList($id, $parameters, $headers) ); }
php
public function load($id, array $parameters = [], array $headers = []) { return $this->getFactory()->create( $this->getApi()->getList($id, $parameters, $headers) ); }
[ "public", "function", "load", "(", "$", "id", ",", "array", "$", "parameters", "=", "[", "]", ",", "array", "$", "headers", "=", "[", "]", ")", "{", "return", "$", "this", "->", "getFactory", "(", ")", "->", "create", "(", "$", "this", "->", "get...
Get a list by id. @param string $id @param array $parameters @param array $headers @return Lists
[ "Get", "a", "list", "by", "id", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Repository/ListRepository.php#L34-L39
php-tmdb/api
lib/Tmdb/Repository/ListRepository.php
ListRepository.getItemStatus
public function getItemStatus($id, $mediaId, array $parameters = [], array $headers = []) { return $this->getFactory()->createItemStatus( $this->getApi()->getItemStatus($id, $mediaId, $parameters, $headers) ); }
php
public function getItemStatus($id, $mediaId, array $parameters = [], array $headers = []) { return $this->getFactory()->createItemStatus( $this->getApi()->getItemStatus($id, $mediaId, $parameters, $headers) ); }
[ "public", "function", "getItemStatus", "(", "$", "id", ",", "$", "mediaId", ",", "array", "$", "parameters", "=", "[", "]", ",", "array", "$", "headers", "=", "[", "]", ")", "{", "return", "$", "this", "->", "getFactory", "(", ")", "->", "createItemS...
Check to see if a movie ID is already added to a list. @param string $id @param int $mediaId @param array $parameters @param array $headers @return ItemStatus
[ "Check", "to", "see", "if", "a", "movie", "ID", "is", "already", "added", "to", "a", "list", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Repository/ListRepository.php#L50-L55
php-tmdb/api
lib/Tmdb/Repository/ListRepository.php
ListRepository.createList
public function createList($name, $description = null, array $parameters = [], array $headers = []) { return $this->getFactory()->createResultWithListId( $this->getApi()->createList($name, $description, $parameters, $headers) ); }
php
public function createList($name, $description = null, array $parameters = [], array $headers = []) { return $this->getFactory()->createResultWithListId( $this->getApi()->createList($name, $description, $parameters, $headers) ); }
[ "public", "function", "createList", "(", "$", "name", ",", "$", "description", "=", "null", ",", "array", "$", "parameters", "=", "[", "]", ",", "array", "$", "headers", "=", "[", "]", ")", "{", "return", "$", "this", "->", "getFactory", "(", ")", ...
This method lets users create a new list. A valid session id is required. @param string $name @param string $description @param array $parameters @param array $headers @return string The list id
[ "This", "method", "lets", "users", "create", "a", "new", "list", ".", "A", "valid", "session", "id", "is", "required", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Repository/ListRepository.php#L66-L71
php-tmdb/api
lib/Tmdb/Repository/ListRepository.php
ListRepository.add
public function add($id, $mediaId) { return $this->getFactory()->createResult( $this->getApi()->addMediaToList($id, $mediaId) ); }
php
public function add($id, $mediaId) { return $this->getFactory()->createResult( $this->getApi()->addMediaToList($id, $mediaId) ); }
[ "public", "function", "add", "(", "$", "id", ",", "$", "mediaId", ")", "{", "return", "$", "this", "->", "getFactory", "(", ")", "->", "createResult", "(", "$", "this", "->", "getApi", "(", ")", "->", "addMediaToList", "(", "$", "id", ",", "$", "me...
This method lets users add new movies to a list that they created. A valid session id is required. @param string $id @param int $mediaId @return ItemStatus
[ "This", "method", "lets", "users", "add", "new", "movies", "to", "a", "list", "that", "they", "created", ".", "A", "valid", "session", "id", "is", "required", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Repository/ListRepository.php#L81-L86
php-tmdb/api
lib/Tmdb/Repository/ListRepository.php
ListRepository.remove
public function remove($id, $mediaId) { return $this->getFactory()->createResult( $this->getApi()->removeMediaFromList($id, $mediaId) ); }
php
public function remove($id, $mediaId) { return $this->getFactory()->createResult( $this->getApi()->removeMediaFromList($id, $mediaId) ); }
[ "public", "function", "remove", "(", "$", "id", ",", "$", "mediaId", ")", "{", "return", "$", "this", "->", "getFactory", "(", ")", "->", "createResult", "(", "$", "this", "->", "getApi", "(", ")", "->", "removeMediaFromList", "(", "$", "id", ",", "$...
This method lets users delete movies from a list that they created. A valid session id is required. @param string $id @param int $mediaId @return ItemStatus
[ "This", "method", "lets", "users", "delete", "movies", "from", "a", "list", "that", "they", "created", ".", "A", "valid", "session", "id", "is", "required", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Repository/ListRepository.php#L96-L101
php-tmdb/api
lib/Tmdb/Repository/ListRepository.php
ListRepository.clearList
public function clearList($id, $confirm) { return $this->getFactory()->createResult( $this->getApi()->clearList($id, (bool) $confirm) ); }
php
public function clearList($id, $confirm) { return $this->getFactory()->createResult( $this->getApi()->clearList($id, (bool) $confirm) ); }
[ "public", "function", "clearList", "(", "$", "id", ",", "$", "confirm", ")", "{", "return", "$", "this", "->", "getFactory", "(", ")", "->", "createResult", "(", "$", "this", "->", "getApi", "(", ")", "->", "clearList", "(", "$", "id", ",", "(", "b...
Clear all of the items within a list. This is a irreversible action and should be treated with caution. A valid session id is required. @param string $id @param boolean $confirm @return ItemStatus
[ "Clear", "all", "of", "the", "items", "within", "a", "list", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Repository/ListRepository.php#L127-L132
php-tmdb/api
lib/Tmdb/Repository/TvRepository.php
TvRepository.load
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, AppendToResponse::TRANSLATIONS, AppendToResponse::SIMILAR, AppendToResponse::RECOMMENDATIONS, AppendToResponse::KEYWORDS, AppendToResponse::CHANGES, AppendToResponse::CONTENT_RATINGS, AppendToResponse::ALTERNATIVE_TITLES, AppendToResponse::VIDEOS, ]) ]); } $data = $this->getApi()->getTvshow($id, $this->parseQueryParameters($parameters), $headers); return $this->getFactory()->create($data); }
php
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, AppendToResponse::TRANSLATIONS, AppendToResponse::SIMILAR, AppendToResponse::RECOMMENDATIONS, AppendToResponse::KEYWORDS, AppendToResponse::CHANGES, AppendToResponse::CONTENT_RATINGS, AppendToResponse::ALTERNATIVE_TITLES, AppendToResponse::VIDEOS, ]) ]); } $data = $this->getApi()->getTvshow($id, $this->parseQueryParameters($parameters), $headers); return $this->getFactory()->create($data); }
[ "public", "function", "load", "(", "$", "id", ",", "array", "$", "parameters", "=", "[", "]", ",", "array", "$", "headers", "=", "[", "]", ")", "{", "if", "(", "!", "isset", "(", "$", "parameters", "[", "'append_to_response'", "]", ")", ")", "{", ...
Load a tv with the given identifier If you want to optimize the result set/bandwidth you should define the AppendToResponse parameter @param integer $id @param $parameters @param $headers @return null|\Tmdb\Model\AbstractModel
[ "Load", "a", "tv", "with", "the", "given", "identifier" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Repository/TvRepository.php#L42-L66
php-tmdb/api
lib/Tmdb/Repository/TvRepository.php
TvRepository.getPopular
public function getPopular(array $options = [], array $headers = []) { return $this->getFactory()->createResultCollection( $this->getApi()->getPopular($options, $headers) ); }
php
public function getPopular(array $options = [], array $headers = []) { return $this->getFactory()->createResultCollection( $this->getApi()->getPopular($options, $headers) ); }
[ "public", "function", "getPopular", "(", "array", "$", "options", "=", "[", "]", ",", "array", "$", "headers", "=", "[", "]", ")", "{", "return", "$", "this", "->", "getFactory", "(", ")", "->", "createResultCollection", "(", "$", "this", "->", "getApi...
Get the list of popular tvs on The Tv Database. This list refreshes every day. @param array $options @param array $headers @return Tv[]
[ "Get", "the", "list", "of", "popular", "tvs", "on", "The", "Tv", "Database", ".", "This", "list", "refreshes", "every", "day", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Repository/TvRepository.php#L209-L214
php-tmdb/api
lib/Tmdb/Repository/TvRepository.php
TvRepository.getTopRated
public function getTopRated(array $options = [], array $headers = []) { return $this->getFactory()->createResultCollection( $this->getApi()->getTopRated($options, $headers) ); }
php
public function getTopRated(array $options = [], array $headers = []) { return $this->getFactory()->createResultCollection( $this->getApi()->getTopRated($options, $headers) ); }
[ "public", "function", "getTopRated", "(", "array", "$", "options", "=", "[", "]", ",", "array", "$", "headers", "=", "[", "]", ")", "{", "return", "$", "this", "->", "getFactory", "(", ")", "->", "createResultCollection", "(", "$", "this", "->", "getAp...
Get the list of top rated tvs. By default, this list will only include tvs that have 10 or more votes. This list refreshes every day. @param array $options @param array $headers @return Tv[]
[ "Get", "the", "list", "of", "top", "rated", "tvs", ".", "By", "default", "this", "list", "will", "only", "include", "tvs", "that", "have", "10", "or", "more", "votes", ".", "This", "list", "refreshes", "every", "day", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Repository/TvRepository.php#L224-L229
php-tmdb/api
lib/Tmdb/Repository/TvRepository.php
TvRepository.getOnTheAir
public function getOnTheAir(array $options = [], array $headers = []) { return $this->getFactory()->createResultCollection( $this->getApi()->getOnTheAir($options, $headers) ); }
php
public function getOnTheAir(array $options = [], array $headers = []) { return $this->getFactory()->createResultCollection( $this->getApi()->getOnTheAir($options, $headers) ); }
[ "public", "function", "getOnTheAir", "(", "array", "$", "options", "=", "[", "]", ",", "array", "$", "headers", "=", "[", "]", ")", "{", "return", "$", "this", "->", "getFactory", "(", ")", "->", "createResultCollection", "(", "$", "this", "->", "getAp...
Get the list of top rated tvs. By default, this list will only include tvs that have 10 or more votes. This list refreshes every day. @param array $options @param array $headers @return Tv[]
[ "Get", "the", "list", "of", "top", "rated", "tvs", ".", "By", "default", "this", "list", "will", "only", "include", "tvs", "that", "have", "10", "or", "more", "votes", ".", "This", "list", "refreshes", "every", "day", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Repository/TvRepository.php#L239-L244
php-tmdb/api
lib/Tmdb/Repository/TvRepository.php
TvRepository.getAiringToday
public function getAiringToday(array $options = [], array $headers = []) { return $this->getFactory()->createResultCollection( $this->getApi()->getAiringToday($options, $headers) ); }
php
public function getAiringToday(array $options = [], array $headers = []) { return $this->getFactory()->createResultCollection( $this->getApi()->getAiringToday($options, $headers) ); }
[ "public", "function", "getAiringToday", "(", "array", "$", "options", "=", "[", "]", ",", "array", "$", "headers", "=", "[", "]", ")", "{", "return", "$", "this", "->", "getFactory", "(", ")", "->", "createResultCollection", "(", "$", "this", "->", "ge...
Get the list of TV shows that air today. Without a specified timezone, this query defaults to EST (Eastern Time UTC-05:00). @param array $options @param array $headers @return Tv[]
[ "Get", "the", "list", "of", "TV", "shows", "that", "air", "today", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Repository/TvRepository.php#L255-L260
php-tmdb/api
lib/Tmdb/Repository/TvRepository.php
TvRepository.rate
public function rate($id, $rating) { return $this->getFactory()->createResult( $this->getApi()->rateTvShow($id, $rating) ); }
php
public function rate($id, $rating) { return $this->getFactory()->createResult( $this->getApi()->rateTvShow($id, $rating) ); }
[ "public", "function", "rate", "(", "$", "id", ",", "$", "rating", ")", "{", "return", "$", "this", "->", "getFactory", "(", ")", "->", "createResult", "(", "$", "this", "->", "getApi", "(", ")", "->", "rateTvShow", "(", "$", "id", ",", "$", "rating...
This method lets users rate a TV show. A valid session id or guest session id is required. @param integer $id @param float $rating @return Result
[ "This", "method", "lets", "users", "rate", "a", "TV", "show", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Repository/TvRepository.php#L300-L305
php-tmdb/api
lib/Tmdb/Repository/ChangesRepository.php
ChangesRepository.getMovieChanges
public function getMovieChanges(ChangesQuery $query, array $headers = []) { $data = $this->getApi()->getMovieChanges($query->toArray(), $headers); return $this->getFactory()->createResultCollection($data); }
php
public function getMovieChanges(ChangesQuery $query, array $headers = []) { $data = $this->getApi()->getMovieChanges($query->toArray(), $headers); return $this->getFactory()->createResultCollection($data); }
[ "public", "function", "getMovieChanges", "(", "ChangesQuery", "$", "query", ",", "array", "$", "headers", "=", "[", "]", ")", "{", "$", "data", "=", "$", "this", "->", "getApi", "(", ")", "->", "getMovieChanges", "(", "$", "query", "->", "toArray", "("...
Get a list of movie ids that have been edited. By default we show the last 24 hours and only 100 items per page. The maximum number of days that can be returned in a single request is 14. You can then use the movie changes API to get the actual data that has been changed. Please note that the change log system to support this was changed on October 5, 2012 and will only show movies that have been edited since. @param ChangesQuery $query @param array $headers @return \Tmdb\Model\Common\GenericCollection
[ "Get", "a", "list", "of", "movie", "ids", "that", "have", "been", "edited", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Repository/ChangesRepository.php#L40-L45
php-tmdb/api
lib/Tmdb/Repository/ChangesRepository.php
ChangesRepository.getPeopleChanges
public function getPeopleChanges(ChangesQuery $query, array $headers = []) { $data = $this->getApi()->getPersonChanges($query->toArray(), $headers); return $this->getFactory()->createResultCollection($data); }
php
public function getPeopleChanges(ChangesQuery $query, array $headers = []) { $data = $this->getApi()->getPersonChanges($query->toArray(), $headers); return $this->getFactory()->createResultCollection($data); }
[ "public", "function", "getPeopleChanges", "(", "ChangesQuery", "$", "query", ",", "array", "$", "headers", "=", "[", "]", ")", "{", "$", "data", "=", "$", "this", "->", "getApi", "(", ")", "->", "getPersonChanges", "(", "$", "query", "->", "toArray", "...
Get a list of people ids that have been edited. By default we show the last 24 hours and only 100 items per page. The maximum number of days that can be returned in a single request is 14. You can then use the person changes API to get the actual data that has been changed. Please note that the change log system to support this was changed on October 5, 2012 and will only show people that have been edited since. @param ChangesQuery $query @param array $headers @return People
[ "Get", "a", "list", "of", "people", "ids", "that", "have", "been", "edited", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Repository/ChangesRepository.php#L61-L66
php-tmdb/api
lib/Tmdb/Repository/KeywordRepository.php
KeywordRepository.getMovies
public function getMovies($id, array $parameters = [], array $headers = []) { return $this->getFactory()->createResultCollection( $this->getApi()->getMovies($id, $parameters, $headers), 'createMovie' ); }
php
public function getMovies($id, array $parameters = [], array $headers = []) { return $this->getFactory()->createResultCollection( $this->getApi()->getMovies($id, $parameters, $headers), 'createMovie' ); }
[ "public", "function", "getMovies", "(", "$", "id", ",", "array", "$", "parameters", "=", "[", "]", ",", "array", "$", "headers", "=", "[", "]", ")", "{", "return", "$", "this", "->", "getFactory", "(", ")", "->", "createResultCollection", "(", "$", "...
Get the list of movies for a particular keyword by id. By default, only movies with 10 or more votes are included. @param $id @param array $parameters @param array $headers @return ResultCollection|Keyword[]
[ "Get", "the", "list", "of", "movies", "for", "a", "particular", "keyword", "by", "id", ".", "By", "default", "only", "movies", "with", "10", "or", "more", "votes", "are", "included", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Repository/KeywordRepository.php#L50-L56
php-tmdb/api
lib/Tmdb/Factory/AuthenticationFactory.php
AuthenticationFactory.createRequestToken
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']); } if (array_key_exists('success', $data)) { $token->setSuccess($data['success']); } return $token; }
php
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']); } if (array_key_exists('success', $data)) { $token->setSuccess($data['success']); } return $token; }
[ "public", "function", "createRequestToken", "(", "array", "$", "data", "=", "[", "]", ")", "{", "$", "token", "=", "new", "RequestToken", "(", ")", ";", "if", "(", "array_key_exists", "(", "'expires_at'", ",", "$", "data", ")", ")", "{", "$", "token", ...
Create request token @param array $data @return RequestToken
[ "Create", "request", "token" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Factory/AuthenticationFactory.php#L61-L78
php-tmdb/api
lib/Tmdb/Factory/AuthenticationFactory.php
AuthenticationFactory.createSessionToken
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; }
php
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; }
[ "public", "function", "createSessionToken", "(", "array", "$", "data", "=", "[", "]", ")", "{", "$", "token", "=", "new", "SessionToken", "(", ")", ";", "if", "(", "array_key_exists", "(", "'session_id'", ",", "$", "data", ")", ")", "{", "$", "token", ...
Create session token for user @param array $data @return SessionToken
[ "Create", "session", "token", "for", "user" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Factory/AuthenticationFactory.php#L86-L99
php-tmdb/api
lib/Tmdb/Factory/AuthenticationFactory.php
AuthenticationFactory.createGuestSessionToken
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['guest_session_id']); } if (array_key_exists('success', $data)) { $token->setSuccess($data['success']); } return $token; }
php
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['guest_session_id']); } if (array_key_exists('success', $data)) { $token->setSuccess($data['success']); } return $token; }
[ "public", "function", "createGuestSessionToken", "(", "array", "$", "data", "=", "[", "]", ")", "{", "$", "token", "=", "new", "GuestSessionToken", "(", ")", ";", "if", "(", "array_key_exists", "(", "'expires_at'", ",", "$", "data", ")", ")", "{", "$", ...
Create session token for guest @param array $data @return SessionToken
[ "Create", "session", "token", "for", "guest" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Factory/AuthenticationFactory.php#L107-L124
php-tmdb/api
lib/Tmdb/Api/Authentication.php
Authentication.getNewSession
public function getNewSession($requestToken) { try { return $this->get('authentication/session/new', ['request_token' => (string) $requestToken]); //@codeCoverageIgnoreStart } catch (\Exception $e) { if ($e->getCode() == 401) { throw new UnauthorizedRequestTokenException("The request token has not been validated yet."); } //@codeCoverageIgnoreEnd } }
php
public function getNewSession($requestToken) { try { return $this->get('authentication/session/new', ['request_token' => (string) $requestToken]); //@codeCoverageIgnoreStart } catch (\Exception $e) { if ($e->getCode() == 401) { throw new UnauthorizedRequestTokenException("The request token has not been validated yet."); } //@codeCoverageIgnoreEnd } }
[ "public", "function", "getNewSession", "(", "$", "requestToken", ")", "{", "try", "{", "return", "$", "this", "->", "get", "(", "'authentication/session/new'", ",", "[", "'request_token'", "=>", "(", "string", ")", "$", "requestToken", "]", ")", ";", "//@cod...
This method is used to generate a session id for user based authentication. A session id is required in order to use any of the write methods. @param string $requestToken @throws UnauthorizedRequestTokenException @return mixed
[ "This", "method", "is", "used", "to", "generate", "a", "session", "id", "for", "user", "based", "authentication", ".", "A", "session", "id", "is", "required", "in", "order", "to", "use", "any", "of", "the", "write", "methods", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Api/Authentication.php#L65-L77
php-tmdb/api
lib/Tmdb/Api/Authentication.php
Authentication.getSessionTokenWithLogin
public function getSessionTokenWithLogin($requestToken, $username, $password) { $validatedRequestToken = $this->validateRequestTokenWithLogin($requestToken, $username, $password); if (!$validatedRequestToken['success']) { throw new \InvalidArgumentException('Unable to validate the request_token, please check your credentials.'); } return $this->getNewSession($validatedRequestToken['request_token']); }
php
public function getSessionTokenWithLogin($requestToken, $username, $password) { $validatedRequestToken = $this->validateRequestTokenWithLogin($requestToken, $username, $password); if (!$validatedRequestToken['success']) { throw new \InvalidArgumentException('Unable to validate the request_token, please check your credentials.'); } return $this->getNewSession($validatedRequestToken['request_token']); }
[ "public", "function", "getSessionTokenWithLogin", "(", "$", "requestToken", ",", "$", "username", ",", "$", "password", ")", "{", "$", "validatedRequestToken", "=", "$", "this", "->", "validateRequestTokenWithLogin", "(", "$", "requestToken", ",", "$", "username",...
Helper method to validate the request_token and obtain a session_token @param RequestToken $requestToken @param string $username @param string $password @return mixed @throws \InvalidArgumentException
[ "Helper", "method", "to", "validate", "the", "request_token", "and", "obtain", "a", "session_token" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Api/Authentication.php#L88-L97
php-tmdb/api
lib/Tmdb/Api/Authentication.php
Authentication.validateRequestTokenWithLogin
public function validateRequestTokenWithLogin($requestToken, $username, $password) { try { return $this->get('authentication/token/validate_with_login', [ 'username' => $username, 'password' => $password, 'request_token' => (string) $requestToken ]); //@codeCoverageIgnoreStart } catch (\Exception $e) { if ($e->getCode() == 401) { throw new UnauthorizedRequestTokenException("The request token has not been validated yet."); } } //@codeCoverageIgnoreEnd }
php
public function validateRequestTokenWithLogin($requestToken, $username, $password) { try { return $this->get('authentication/token/validate_with_login', [ 'username' => $username, 'password' => $password, 'request_token' => (string) $requestToken ]); //@codeCoverageIgnoreStart } catch (\Exception $e) { if ($e->getCode() == 401) { throw new UnauthorizedRequestTokenException("The request token has not been validated yet."); } } //@codeCoverageIgnoreEnd }
[ "public", "function", "validateRequestTokenWithLogin", "(", "$", "requestToken", ",", "$", "username", ",", "$", "password", ")", "{", "try", "{", "return", "$", "this", "->", "get", "(", "'authentication/token/validate_with_login'", ",", "[", "'username'", "=>", ...
This method is used to generate a session id for user based authentication. A session id is required in order to use any of the write methods. @param string $requestToken @param string $username @param string $password @throws UnauthorizedRequestTokenException @return mixed
[ "This", "method", "is", "used", "to", "generate", "a", "session", "id", "for", "user", "based", "authentication", ".", "A", "session", "id", "is", "required", "in", "order", "to", "use", "any", "of", "the", "write", "methods", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Api/Authentication.php#L109-L124
php-tmdb/api
lib/Tmdb/Repository/TvSeasonRepository.php
TvSeasonRepository.load
public function load($tvShow, $season, array $parameters = [], array $headers = []) { if ($tvShow instanceof Tv) { $tvShow = $tvShow->getId(); } if ($season instanceof Season) { $season = $season->getSeasonNumber(); } if (null === $tvShow || null === $season) { throw new RuntimeException('Not all required parameters to load an tv season are present.'); } if (!isset($parameters['append_to_response'])) { $parameters = array_merge($parameters, [ new AppendToResponse([ AppendToResponse::CREDITS, AppendToResponse::EXTERNAL_IDS, AppendToResponse::IMAGES, AppendToResponse::CHANGES, AppendToResponse::VIDEOS ]) ]); } $data = $this->getApi()->getSeason($tvShow, $season, $this->parseQueryParameters($parameters), $headers); return $this->getFactory()->create($data); }
php
public function load($tvShow, $season, array $parameters = [], array $headers = []) { if ($tvShow instanceof Tv) { $tvShow = $tvShow->getId(); } if ($season instanceof Season) { $season = $season->getSeasonNumber(); } if (null === $tvShow || null === $season) { throw new RuntimeException('Not all required parameters to load an tv season are present.'); } if (!isset($parameters['append_to_response'])) { $parameters = array_merge($parameters, [ new AppendToResponse([ AppendToResponse::CREDITS, AppendToResponse::EXTERNAL_IDS, AppendToResponse::IMAGES, AppendToResponse::CHANGES, AppendToResponse::VIDEOS ]) ]); } $data = $this->getApi()->getSeason($tvShow, $season, $this->parseQueryParameters($parameters), $headers); return $this->getFactory()->create($data); }
[ "public", "function", "load", "(", "$", "tvShow", ",", "$", "season", ",", "array", "$", "parameters", "=", "[", "]", ",", "array", "$", "headers", "=", "[", "]", ")", "{", "if", "(", "$", "tvShow", "instanceof", "Tv", ")", "{", "$", "tvShow", "=...
Load a tv season with the given identifier If you want to optimize the result set/bandwidth you should define the AppendToResponse parameter @param int|Tv $tvShow @param int|Season $season @param array $parameters @param array $headers @throws RuntimeException @return null|\Tmdb\Model\AbstractModel
[ "Load", "a", "tv", "season", "with", "the", "given", "identifier" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Repository/TvSeasonRepository.php#L42-L71
php-tmdb/api
lib/Tmdb/Repository/TvSeasonRepository.php
TvSeasonRepository.getCredits
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, $season, $this->parseQueryParameters($parameters), $headers); $season = $this->getFactory()->create(['credits' => $data]); return $season->getCredits(); }
php
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, $season, $this->parseQueryParameters($parameters), $headers); $season = $this->getFactory()->create(['credits' => $data]); return $season->getCredits(); }
[ "public", "function", "getCredits", "(", "$", "tvShow", ",", "$", "season", ",", "array", "$", "parameters", "=", "[", "]", ",", "array", "$", "headers", "=", "[", "]", ")", "{", "if", "(", "$", "tvShow", "instanceof", "Tv", ")", "{", "$", "tvShow"...
Get the cast & crew information about a TV series. Just like the website, we pull this information from the last season of the series. @param $tvShow @param $season @param $parameters @param $headers @return null|\Tmdb\Model\AbstractModel
[ "Get", "the", "cast", "&", "crew", "information", "about", "a", "TV", "series", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Repository/TvSeasonRepository.php#L84-L98
php-tmdb/api
lib/Tmdb/Api/TvEpisode.php
TvEpisode.getAccountStates
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 ) ); }
php
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 ) ); }
[ "public", "function", "getAccountStates", "(", "$", "tvshow_id", ",", "$", "season_number", ",", "$", "episode_number", ")", "{", "return", "$", "this", "->", "get", "(", "sprintf", "(", "'tv/%s/season/%s/episode/%s/account_states'", ",", "$", "tvshow_id", ",", ...
This method lets users get the status of whether or not the TV episode has been rated. A valid session id is required. @param $tvshow_id @param $season_number @param $episode_number @return mixed
[ "This", "method", "lets", "users", "get", "the", "status", "of", "whether", "or", "not", "the", "TV", "episode", "has", "been", "rated", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Api/TvEpisode.php#L210-L223
php-tmdb/api
lib/Tmdb/Api/TvEpisode.php
TvEpisode.rateTvEpisode
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] ); }
php
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] ); }
[ "public", "function", "rateTvEpisode", "(", "$", "tvshow_id", ",", "$", "season_number", ",", "$", "episode_number", ",", "$", "rating", ")", "{", "return", "$", "this", "->", "postJson", "(", "sprintf", "(", "'tv/%s/season/%s/episode/%s/rating'", ",", "$", "t...
This method lets users rate a TV episode. A valid session id or guest session id is required. @param $tvshow_id @param $season_number @param $episode_number @param double $rating @return mixed
[ "This", "method", "lets", "users", "rate", "a", "TV", "episode", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Api/TvEpisode.php#L237-L252
php-tmdb/api
lib/Tmdb/HttpClient/Adapter/GuzzleAdapter.php
GuzzleAdapter.registerSubscribers
public function registerSubscribers(EventDispatcherInterface $eventDispatcher) { /** @var HandlerStack $handler */ $handler = $this->client->getConfig('handler'); $handler->push(Middleware::retry(function( $retries, \GuzzleHttp\Psr7\Request $request, \GuzzleHttp\Psr7\Response $response = null, RequestException $exception = null ){ if ($retries >= 5) { return false; } // Retry connection exception if ($exception instanceof ConnectException) { return true; } if ($response) { if($response->getStatusCode() >= 500) { return true; } if($response->getStatusCode() === 429) { $sleep = (int) $response->getHeaderLine('retry-after'); /** * @see https://github.com/php-tmdb/api/issues/154 * Maybe it's even better to set it to $retries value */ if (0 === $sleep) $sleep = 1; // TMDB allows 40 requests per 10 seconds, anything higher should be faulty. if ($sleep > 10) { return false; } sleep($sleep); return true; } } return false; })); }
php
public function registerSubscribers(EventDispatcherInterface $eventDispatcher) { /** @var HandlerStack $handler */ $handler = $this->client->getConfig('handler'); $handler->push(Middleware::retry(function( $retries, \GuzzleHttp\Psr7\Request $request, \GuzzleHttp\Psr7\Response $response = null, RequestException $exception = null ){ if ($retries >= 5) { return false; } // Retry connection exception if ($exception instanceof ConnectException) { return true; } if ($response) { if($response->getStatusCode() >= 500) { return true; } if($response->getStatusCode() === 429) { $sleep = (int) $response->getHeaderLine('retry-after'); /** * @see https://github.com/php-tmdb/api/issues/154 * Maybe it's even better to set it to $retries value */ if (0 === $sleep) $sleep = 1; // TMDB allows 40 requests per 10 seconds, anything higher should be faulty. if ($sleep > 10) { return false; } sleep($sleep); return true; } } return false; })); }
[ "public", "function", "registerSubscribers", "(", "EventDispatcherInterface", "$", "eventDispatcher", ")", "{", "/** @var HandlerStack $handler */", "$", "handler", "=", "$", "this", "->", "client", "->", "getConfig", "(", "'handler'", ")", ";", "$", "handler", "->"...
{@inheritDoc}
[ "{" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/HttpClient/Adapter/GuzzleAdapter.php#L53-L100
php-tmdb/api
lib/Tmdb/HttpClient/Adapter/GuzzleAdapter.php
GuzzleAdapter.getConfiguration
public function getConfiguration(Request $request) { $this->request = $request; return [ 'base_uri' => $request->getOptions()->get('base_url'), 'headers' => $request->getHeaders()->all(), 'query' => $request->getParameters()->all() ]; }
php
public function getConfiguration(Request $request) { $this->request = $request; return [ 'base_uri' => $request->getOptions()->get('base_url'), 'headers' => $request->getHeaders()->all(), 'query' => $request->getParameters()->all() ]; }
[ "public", "function", "getConfiguration", "(", "Request", "$", "request", ")", "{", "$", "this", "->", "request", "=", "$", "request", ";", "return", "[", "'base_uri'", "=>", "$", "request", "->", "getOptions", "(", ")", "->", "get", "(", "'base_url'", "...
Format the request for Guzzle @param Request $request @return array
[ "Format", "the", "request", "for", "Guzzle" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/HttpClient/Adapter/GuzzleAdapter.php#L108-L117
php-tmdb/api
lib/Tmdb/HttpClient/Adapter/GuzzleAdapter.php
GuzzleAdapter.createResponse
private function createResponse(ResponseInterface $adapterResponse = null) { $response = new Response(); if ($adapterResponse !== null) { $response->setCode($adapterResponse->getStatusCode()); $response->setHeaders(new ParameterBag($adapterResponse->getHeaders())); $response->setBody((string) $adapterResponse->getBody()); } return $response; }
php
private function createResponse(ResponseInterface $adapterResponse = null) { $response = new Response(); if ($adapterResponse !== null) { $response->setCode($adapterResponse->getStatusCode()); $response->setHeaders(new ParameterBag($adapterResponse->getHeaders())); $response->setBody((string) $adapterResponse->getBody()); } return $response; }
[ "private", "function", "createResponse", "(", "ResponseInterface", "$", "adapterResponse", "=", "null", ")", "{", "$", "response", "=", "new", "Response", "(", ")", ";", "if", "(", "$", "adapterResponse", "!==", "null", ")", "{", "$", "response", "->", "se...
Create the response object @param ResponseInterface $adapterResponse @return \Tmdb\HttpClient\Response
[ "Create", "the", "response", "object" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/HttpClient/Adapter/GuzzleAdapter.php#L125-L136
php-tmdb/api
lib/Tmdb/HttpClient/Adapter/GuzzleAdapter.php
GuzzleAdapter.handleRequestException
protected function handleRequestException(Request $request, RequestException $previousException) { if (null !== $previousException) { $response = $previousException->getResponse(); if (null == $response || ($response->getStatusCode() >= 500 && $response->getStatusCode() <= 599)) { throw new NullResponseException($this->request, $previousException); } } throw $this->createApiException( $request, $this->createResponse($previousException->getResponse()), $previousException ); }
php
protected function handleRequestException(Request $request, RequestException $previousException) { if (null !== $previousException) { $response = $previousException->getResponse(); if (null == $response || ($response->getStatusCode() >= 500 && $response->getStatusCode() <= 599)) { throw new NullResponseException($this->request, $previousException); } } throw $this->createApiException( $request, $this->createResponse($previousException->getResponse()), $previousException ); }
[ "protected", "function", "handleRequestException", "(", "Request", "$", "request", ",", "RequestException", "$", "previousException", ")", "{", "if", "(", "null", "!==", "$", "previousException", ")", "{", "$", "response", "=", "$", "previousException", "->", "g...
Create the request exception @param Request $request @param RequestException|null $previousException @throws \Tmdb\Exception\TmdbApiException
[ "Create", "the", "request", "exception" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/HttpClient/Adapter/GuzzleAdapter.php#L145-L160
php-tmdb/api
lib/Tmdb/HttpClient/Adapter/GuzzleAdapter.php
GuzzleAdapter.head
public function head(Request $request) { $response = null; try { $response = $this->client->request( 'HEAD', $request->getPath(), $this->getConfiguration($request) ); } catch (RequestException $e) { $this->handleRequestException($request, $e); } return $this->createResponse($response); }
php
public function head(Request $request) { $response = null; try { $response = $this->client->request( 'HEAD', $request->getPath(), $this->getConfiguration($request) ); } catch (RequestException $e) { $this->handleRequestException($request, $e); } return $this->createResponse($response); }
[ "public", "function", "head", "(", "Request", "$", "request", ")", "{", "$", "response", "=", "null", ";", "try", "{", "$", "response", "=", "$", "this", "->", "client", "->", "request", "(", "'HEAD'", ",", "$", "request", "->", "getPath", "(", ")", ...
{@inheritDoc}
[ "{" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/HttpClient/Adapter/GuzzleAdapter.php#L276-L291
php-tmdb/api
lib/Tmdb/HttpClient/Adapter/AbstractAdapter.php
AbstractAdapter.createApiException
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->status_message) ? $errors->status_message : null, $request, $response, $previous ); }
php
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->status_message) ? $errors->status_message : null, $request, $response, $previous ); }
[ "protected", "function", "createApiException", "(", "Request", "$", "request", ",", "Response", "$", "response", ",", "\\", "Exception", "$", "previous", "=", "null", ")", "{", "$", "errors", "=", "json_decode", "(", "(", "string", ")", "$", "response", "-...
Create the unified exception to throw @param Request $request @param Response $response @param \Exception $previous @return TmdbApiException
[ "Create", "the", "unified", "exception", "to", "throw" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/HttpClient/Adapter/AbstractAdapter.php#L32-L43
php-tmdb/api
lib/Tmdb/Model/Collection/Images.php
Images.filterPosters
public function filterPosters() { return $this->filter( function ($key, $value) { if ($value instanceof ImageFilter && $value instanceof Image\PosterImage) { return true; } } ); }
php
public function filterPosters() { return $this->filter( function ($key, $value) { if ($value instanceof ImageFilter && $value instanceof Image\PosterImage) { return true; } } ); }
[ "public", "function", "filterPosters", "(", ")", "{", "return", "$", "this", "->", "filter", "(", "function", "(", "$", "key", ",", "$", "value", ")", "{", "if", "(", "$", "value", "instanceof", "ImageFilter", "&&", "$", "value", "instanceof", "Image", ...
Filter poster images @return Images
[ "Filter", "poster", "images" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Model/Collection/Images.php#L61-L70
php-tmdb/api
lib/Tmdb/Model/Collection/Images.php
Images.filterBackdrops
public function filterBackdrops() { return $this->filter( function ($key, $value) { if ($value instanceof ImageFilter && $value instanceof Image\BackdropImage) { return true; } } ); }
php
public function filterBackdrops() { return $this->filter( function ($key, $value) { if ($value instanceof ImageFilter && $value instanceof Image\BackdropImage) { return true; } } ); }
[ "public", "function", "filterBackdrops", "(", ")", "{", "return", "$", "this", "->", "filter", "(", "function", "(", "$", "key", ",", "$", "value", ")", "{", "if", "(", "$", "value", "instanceof", "ImageFilter", "&&", "$", "value", "instanceof", "Image",...
Filter backdrop images @return Images
[ "Filter", "backdrop", "images" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Model/Collection/Images.php#L77-L86
php-tmdb/api
lib/Tmdb/Model/Collection/Images.php
Images.filterProfile
public function filterProfile() { return $this->filter( function ($key, $value) { if ($value instanceof ImageFilter && $value instanceof Image\ProfileImage) { return true; } } ); }
php
public function filterProfile() { return $this->filter( function ($key, $value) { if ($value instanceof ImageFilter && $value instanceof Image\ProfileImage) { return true; } } ); }
[ "public", "function", "filterProfile", "(", ")", "{", "return", "$", "this", "->", "filter", "(", "function", "(", "$", "key", ",", "$", "value", ")", "{", "if", "(", "$", "value", "instanceof", "ImageFilter", "&&", "$", "value", "instanceof", "Image", ...
Filter profile images @return Images
[ "Filter", "profile", "images" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Model/Collection/Images.php#L93-L102
php-tmdb/api
lib/Tmdb/Model/Collection/Images.php
Images.filterStills
public function filterStills() { return $this->filter( function ($key, $value) { if ($value instanceof ImageFilter && $value instanceof Image\StillImage) { return true; } } ); }
php
public function filterStills() { return $this->filter( function ($key, $value) { if ($value instanceof ImageFilter && $value instanceof Image\StillImage) { return true; } } ); }
[ "public", "function", "filterStills", "(", ")", "{", "return", "$", "this", "->", "filter", "(", "function", "(", "$", "key", ",", "$", "value", ")", "{", "if", "(", "$", "value", "instanceof", "ImageFilter", "&&", "$", "value", "instanceof", "Image", ...
Filter still images @return Images
[ "Filter", "still", "images" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Model/Collection/Images.php#L109-L118
php-tmdb/api
lib/Tmdb/Model/Collection/Images.php
Images.filterMaxWidth
public function filterMaxWidth($width) { return $this->filter( function ($key, $value) use ($width) { if ($value instanceof ImageFilter && $value->getWidth() <= $width && $value->getWidth() !== null) { return true; } } ); }
php
public function filterMaxWidth($width) { return $this->filter( function ($key, $value) use ($width) { if ($value instanceof ImageFilter && $value->getWidth() <= $width && $value->getWidth() !== null) { return true; } } ); }
[ "public", "function", "filterMaxWidth", "(", "$", "width", ")", "{", "return", "$", "this", "->", "filter", "(", "function", "(", "$", "key", ",", "$", "value", ")", "use", "(", "$", "width", ")", "{", "if", "(", "$", "value", "instanceof", "ImageFil...
Filter by image size @param $width @return Images
[ "Filter", "by", "image", "size" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Model/Collection/Images.php#L126-L135
php-tmdb/api
lib/Tmdb/Model/Collection/Images.php
Images.filterMaxHeight
public function filterMaxHeight($height) { return $this->filter( function ($key, $value) use ($height) { if ($value instanceof ImageFilter && $value->getHeight() <= $height && $value->getHeight() !== null ) { return true; } } ); }
php
public function filterMaxHeight($height) { return $this->filter( function ($key, $value) use ($height) { if ($value instanceof ImageFilter && $value->getHeight() <= $height && $value->getHeight() !== null ) { return true; } } ); }
[ "public", "function", "filterMaxHeight", "(", "$", "height", ")", "{", "return", "$", "this", "->", "filter", "(", "function", "(", "$", "key", ",", "$", "value", ")", "use", "(", "$", "height", ")", "{", "if", "(", "$", "value", "instanceof", "Image...
Filter by image size @param $height @return Images
[ "Filter", "by", "image", "size" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Model/Collection/Images.php#L160-L171
php-tmdb/api
lib/Tmdb/Model/Collection/Images.php
Images.filterBestVotedImage
public function filterBestVotedImage() { $currentImage = null; $voteAverage = -1; /** * @var $image Image */ foreach ($this->data as $image) { if ($image->getVoteAverage() > $voteAverage) { $voteAverage = $image->getVoteAverage(); $currentImage = $image; } } return $currentImage; }
php
public function filterBestVotedImage() { $currentImage = null; $voteAverage = -1; /** * @var $image Image */ foreach ($this->data as $image) { if ($image->getVoteAverage() > $voteAverage) { $voteAverage = $image->getVoteAverage(); $currentImage = $image; } } return $currentImage; }
[ "public", "function", "filterBestVotedImage", "(", ")", "{", "$", "currentImage", "=", "null", ";", "$", "voteAverage", "=", "-", "1", ";", "/**\n * @var $image Image\n */", "foreach", "(", "$", "this", "->", "data", "as", "$", "image", ")", "{...
Return a single image that is rated highest @return ImageFilter|null
[ "Return", "a", "single", "image", "that", "is", "rated", "highest" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Model/Collection/Images.php#L197-L213
php-tmdb/api
lib/Tmdb/Event/RequestSubscriber.php
RequestSubscriber.send
public function send(RequestEvent $event, $eventName, EventDispatcherInterface $eventDispatcher) { // Preparation of request parameters / Possibility to use for logging and caching etc. $eventDispatcher->dispatch(TmdbEvents::BEFORE_REQUEST, $event); if ($event->isPropagationStopped() && $event->hasResponse()) { return $event->getResponse(); } $response = $this->sendRequest($event); $event->setResponse($response); // Possibility to cache the request $eventDispatcher->dispatch(TmdbEvents::AFTER_REQUEST, $event); return $response; }
php
public function send(RequestEvent $event, $eventName, EventDispatcherInterface $eventDispatcher) { // Preparation of request parameters / Possibility to use for logging and caching etc. $eventDispatcher->dispatch(TmdbEvents::BEFORE_REQUEST, $event); if ($event->isPropagationStopped() && $event->hasResponse()) { return $event->getResponse(); } $response = $this->sendRequest($event); $event->setResponse($response); // Possibility to cache the request $eventDispatcher->dispatch(TmdbEvents::AFTER_REQUEST, $event); return $response; }
[ "public", "function", "send", "(", "RequestEvent", "$", "event", ",", "$", "eventName", ",", "EventDispatcherInterface", "$", "eventDispatcher", ")", "{", "// Preparation of request parameters / Possibility to use for logging and caching etc.", "$", "eventDispatcher", "->", "...
@param RequestEvent $event @param string $eventName @param EventDispatcherInterface $eventDispatcher @return string|Response
[ "@param", "RequestEvent", "$event", "@param", "string", "$eventName", "@param", "EventDispatcherInterface", "$eventDispatcher" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Event/RequestSubscriber.php#L40-L56
php-tmdb/api
lib/Tmdb/Event/RequestSubscriber.php
RequestSubscriber.sendRequest
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()); break; case 'POST': $response = $this->getHttpClient()->getAdapter()->post($event->getRequest()); break; case 'PUT': $response = $this->getHttpClient()->getAdapter()->put($event->getRequest()); break; case 'PATCH': $response = $this->getHttpClient()->getAdapter()->patch($event->getRequest()); break; case 'DELETE': $response = $this->getHttpClient()->getAdapter()->delete($event->getRequest()); break; default: throw new RuntimeException(sprintf('Unknown request method "%s".', $event->getMethod())); } return $response; }
php
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()); break; case 'POST': $response = $this->getHttpClient()->getAdapter()->post($event->getRequest()); break; case 'PUT': $response = $this->getHttpClient()->getAdapter()->put($event->getRequest()); break; case 'PATCH': $response = $this->getHttpClient()->getAdapter()->patch($event->getRequest()); break; case 'DELETE': $response = $this->getHttpClient()->getAdapter()->delete($event->getRequest()); break; default: throw new RuntimeException(sprintf('Unknown request method "%s".', $event->getMethod())); } return $response; }
[ "public", "function", "sendRequest", "(", "RequestEvent", "$", "event", ")", "{", "switch", "(", "$", "event", "->", "getMethod", "(", ")", ")", "{", "case", "'GET'", ":", "$", "response", "=", "$", "this", "->", "getHttpClient", "(", ")", "->", "getAd...
Call upon the adapter to create an response object @param RequestEvent $event @throws \Exception @return Response
[ "Call", "upon", "the", "adapter", "to", "create", "an", "response", "object" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Event/RequestSubscriber.php#L65-L91
php-tmdb/api
lib/Tmdb/Common/ObjectHydrator.php
ObjectHydrator.hydrate
public function hydrate(AbstractModel $object, $data = []) { if (!empty($data)) { foreach ($data as $k => $v) { if (in_array($k, $object::$properties)) { $method = $this->camelize( sprintf('set_%s', $k) ); if (!is_callable([$object, $method])) { throw new RuntimeException(sprintf( 'Trying to call method "%s" on "%s" but it does not exist or is private.', $method, get_class($object) )); } else { $object->$method($v); } } } } return $object; }
php
public function hydrate(AbstractModel $object, $data = []) { if (!empty($data)) { foreach ($data as $k => $v) { if (in_array($k, $object::$properties)) { $method = $this->camelize( sprintf('set_%s', $k) ); if (!is_callable([$object, $method])) { throw new RuntimeException(sprintf( 'Trying to call method "%s" on "%s" but it does not exist or is private.', $method, get_class($object) )); } else { $object->$method($v); } } } } return $object; }
[ "public", "function", "hydrate", "(", "AbstractModel", "$", "object", ",", "$", "data", "=", "[", "]", ")", "{", "if", "(", "!", "empty", "(", "$", "data", ")", ")", "{", "foreach", "(", "$", "data", "as", "$", "k", "=>", "$", "v", ")", "{", ...
Hydrate the object with data @param AbstractModel $object @param array $data @return AbstractModel @throws RuntimeException
[ "Hydrate", "the", "object", "with", "data" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Common/ObjectHydrator.php#L34-L59
php-tmdb/api
lib/Tmdb/Api/Search.php
Search.searchMovies
public function searchMovies($query, array $parameters = [], array $headers = []) { return $this->get('search/movie', array_merge($parameters, [ 'query' => $query ], $headers)); }
php
public function searchMovies($query, array $parameters = [], array $headers = []) { return $this->get('search/movie', array_merge($parameters, [ 'query' => $query ], $headers)); }
[ "public", "function", "searchMovies", "(", "$", "query", ",", "array", "$", "parameters", "=", "[", "]", ",", "array", "$", "headers", "=", "[", "]", ")", "{", "return", "$", "this", "->", "get", "(", "'search/movie'", ",", "array_merge", "(", "$", "...
Search for movies by title. @param string $query @param array $parameters @param array $headers @return mixed
[ "Search", "for", "movies", "by", "title", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Api/Search.php#L30-L35
php-tmdb/api
lib/Tmdb/Api/Search.php
Search.searchCollection
public function searchCollection($query, array $parameters = [], array $headers = []) { return $this->get('search/collection', array_merge($parameters, [ 'query' => $query ], $headers)); }
php
public function searchCollection($query, array $parameters = [], array $headers = []) { return $this->get('search/collection', array_merge($parameters, [ 'query' => $query ], $headers)); }
[ "public", "function", "searchCollection", "(", "$", "query", ",", "array", "$", "parameters", "=", "[", "]", ",", "array", "$", "headers", "=", "[", "]", ")", "{", "return", "$", "this", "->", "get", "(", "'search/collection'", ",", "array_merge", "(", ...
Search for collections by name. @param string $query @param array $parameters @param array $headers @return mixed
[ "Search", "for", "collections", "by", "name", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Api/Search.php#L45-L50
php-tmdb/api
lib/Tmdb/Api/Search.php
Search.searchTv
public function searchTv($query, array $parameters = [], array $headers = []) { return $this->get('search/tv', array_merge($parameters, [ 'query' => $query ], $headers)); }
php
public function searchTv($query, array $parameters = [], array $headers = []) { return $this->get('search/tv', array_merge($parameters, [ 'query' => $query ], $headers)); }
[ "public", "function", "searchTv", "(", "$", "query", ",", "array", "$", "parameters", "=", "[", "]", ",", "array", "$", "headers", "=", "[", "]", ")", "{", "return", "$", "this", "->", "get", "(", "'search/tv'", ",", "array_merge", "(", "$", "paramet...
Search for TV shows by title. @param string $query @param array $parameters @param array $headers @return mixed
[ "Search", "for", "TV", "shows", "by", "title", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Api/Search.php#L60-L65
php-tmdb/api
lib/Tmdb/Api/Search.php
Search.searchPersons
public function searchPersons($query, array $parameters = [], array $headers = []) { return $this->get('search/person', array_merge($parameters, [ 'query' => $query ], $headers)); }
php
public function searchPersons($query, array $parameters = [], array $headers = []) { return $this->get('search/person', array_merge($parameters, [ 'query' => $query ], $headers)); }
[ "public", "function", "searchPersons", "(", "$", "query", ",", "array", "$", "parameters", "=", "[", "]", ",", "array", "$", "headers", "=", "[", "]", ")", "{", "return", "$", "this", "->", "get", "(", "'search/person'", ",", "array_merge", "(", "$", ...
Search for people by name. @param string $query @param array $parameters @param array $headers @return mixed
[ "Search", "for", "people", "by", "name", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Api/Search.php#L75-L80
php-tmdb/api
lib/Tmdb/Api/Search.php
Search.searchList
public function searchList($query, array $parameters = [], array $headers = []) { return $this->get('search/list', array_merge($parameters, [ 'query' => $query ], $headers)); }
php
public function searchList($query, array $parameters = [], array $headers = []) { return $this->get('search/list', array_merge($parameters, [ 'query' => $query ], $headers)); }
[ "public", "function", "searchList", "(", "$", "query", ",", "array", "$", "parameters", "=", "[", "]", ",", "array", "$", "headers", "=", "[", "]", ")", "{", "return", "$", "this", "->", "get", "(", "'search/list'", ",", "array_merge", "(", "$", "par...
Search for lists by name and description. @param string $query @param array $parameters @param array $headers @return mixed
[ "Search", "for", "lists", "by", "name", "and", "description", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Api/Search.php#L90-L95
php-tmdb/api
lib/Tmdb/Api/Search.php
Search.searchCompany
public function searchCompany($query, array $parameters = [], array $headers = []) { return $this->get('search/company', array_merge($parameters, [ 'query' => $query ], $headers)); }
php
public function searchCompany($query, array $parameters = [], array $headers = []) { return $this->get('search/company', array_merge($parameters, [ 'query' => $query ], $headers)); }
[ "public", "function", "searchCompany", "(", "$", "query", ",", "array", "$", "parameters", "=", "[", "]", ",", "array", "$", "headers", "=", "[", "]", ")", "{", "return", "$", "this", "->", "get", "(", "'search/company'", ",", "array_merge", "(", "$", ...
Search for companies by name. @param $query @param array $parameters @param array $headers @return mixed
[ "Search", "for", "companies", "by", "name", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Api/Search.php#L105-L110
php-tmdb/api
lib/Tmdb/Api/Search.php
Search.searchKeyword
public function searchKeyword($query, array $parameters = [], array $headers = []) { return $this->get('search/keyword', array_merge($parameters, [ 'query' => $query ], $headers)); }
php
public function searchKeyword($query, array $parameters = [], array $headers = []) { return $this->get('search/keyword', array_merge($parameters, [ 'query' => $query ], $headers)); }
[ "public", "function", "searchKeyword", "(", "$", "query", ",", "array", "$", "parameters", "=", "[", "]", ",", "array", "$", "headers", "=", "[", "]", ")", "{", "return", "$", "this", "->", "get", "(", "'search/keyword'", ",", "array_merge", "(", "$", ...
Search for companies by name. @param string $query @param array $parameters @param array $headers @return mixed
[ "Search", "for", "companies", "by", "name", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Api/Search.php#L120-L125
php-tmdb/api
lib/Tmdb/Api/Search.php
Search.searchMulti
public function searchMulti($query, array $parameters = [], array $headers = []) { return $this->get('search/multi', array_merge($parameters, [ 'query' => $query ], $headers)); }
php
public function searchMulti($query, array $parameters = [], array $headers = []) { return $this->get('search/multi', array_merge($parameters, [ 'query' => $query ], $headers)); }
[ "public", "function", "searchMulti", "(", "$", "query", ",", "array", "$", "parameters", "=", "[", "]", ",", "array", "$", "headers", "=", "[", "]", ")", "{", "return", "$", "this", "->", "get", "(", "'search/multi'", ",", "array_merge", "(", "$", "p...
Search the movie, tv show and person collections with a single query. Each item returned in the result array has a media_type field that maps to either movie, tv or person. Each mapped result is the same response you would get from each independent search. @param string $query @param array $parameters @param array $headers @return mixed
[ "Search", "the", "movie", "tv", "show", "and", "person", "collections", "with", "a", "single", "query", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Api/Search.php#L138-L143
php-tmdb/api
lib/Tmdb/Factory/ListFactory.php
ListFactory.create
public function create(array $data = []) { $lists = new Lists(); if (array_key_exists('items', $data)) { $lists->setItems( $this->getListItemFactory()->createCollection($data['items']) ); } /** Images */ if (array_key_exists('poster_path', $data)) { $lists->setPosterImage($this->getImageFactory()->createFromPath($data['poster_path'], 'poster_path')); } return $this->hydrate($lists, $data); }
php
public function create(array $data = []) { $lists = new Lists(); if (array_key_exists('items', $data)) { $lists->setItems( $this->getListItemFactory()->createCollection($data['items']) ); } /** Images */ if (array_key_exists('poster_path', $data)) { $lists->setPosterImage($this->getImageFactory()->createFromPath($data['poster_path'], 'poster_path')); } return $this->hydrate($lists, $data); }
[ "public", "function", "create", "(", "array", "$", "data", "=", "[", "]", ")", "{", "$", "lists", "=", "new", "Lists", "(", ")", ";", "if", "(", "array_key_exists", "(", "'items'", ",", "$", "data", ")", ")", "{", "$", "lists", "->", "setItems", ...
@param array $data @return Genre
[ "@param", "array", "$data" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Factory/ListFactory.php#L55-L71
php-tmdb/api
lib/Tmdb/Factory/GenreFactory.php
GenreFactory.createCollection
public function createCollection(array $data = [], $key = 'genres') { $collection = new Genres(); if (array_key_exists($key, $data)) { $data = $data[$key]; } foreach ($data as $item) { $collection->addGenre($this->create($item)); } return $collection; }
php
public function createCollection(array $data = [], $key = 'genres') { $collection = new Genres(); if (array_key_exists($key, $data)) { $data = $data[$key]; } foreach ($data as $item) { $collection->addGenre($this->create($item)); } return $collection; }
[ "public", "function", "createCollection", "(", "array", "$", "data", "=", "[", "]", ",", "$", "key", "=", "'genres'", ")", "{", "$", "collection", "=", "new", "Genres", "(", ")", ";", "if", "(", "array_key_exists", "(", "$", "key", ",", "$", "data", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Factory/GenreFactory.php#L37-L50
php-tmdb/api
lib/Tmdb/Api/AbstractApi.php
AbstractApi.get
public function get($path, array $parameters = [], $headers = []) { $response = $this->getClient()->getHttpClient()->get($path, $parameters, $headers); return $this->decodeResponse($response); }
php
public function get($path, array $parameters = [], $headers = []) { $response = $this->getClient()->getHttpClient()->get($path, $parameters, $headers); return $this->decodeResponse($response); }
[ "public", "function", "get", "(", "$", "path", ",", "array", "$", "parameters", "=", "[", "]", ",", "$", "headers", "=", "[", "]", ")", "{", "$", "response", "=", "$", "this", "->", "getClient", "(", ")", "->", "getHttpClient", "(", ")", "->", "g...
Send a GET request @param string $path @param array $parameters @param array $headers @return mixed
[ "Send", "a", "GET", "request" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Api/AbstractApi.php#L48-L53
php-tmdb/api
lib/Tmdb/Api/AbstractApi.php
AbstractApi.post
public function post($path, $postBody = null, array $parameters = [], $headers = []) { $response = $this->getClient()->getHttpClient()->post($path, $postBody, $parameters, $headers); return $this->decodeResponse($response); }
php
public function post($path, $postBody = null, array $parameters = [], $headers = []) { $response = $this->getClient()->getHttpClient()->post($path, $postBody, $parameters, $headers); return $this->decodeResponse($response); }
[ "public", "function", "post", "(", "$", "path", ",", "$", "postBody", "=", "null", ",", "array", "$", "parameters", "=", "[", "]", ",", "$", "headers", "=", "[", "]", ")", "{", "$", "response", "=", "$", "this", "->", "getClient", "(", ")", "->",...
Send a POST request @param string $path @param null $postBody @param array $parameters @param array $headers @return mixed
[ "Send", "a", "POST", "request" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Api/AbstractApi.php#L79-L84
php-tmdb/api
lib/Tmdb/Api/AbstractApi.php
AbstractApi.put
public function put($path, $body = null, array $parameters = [], $headers = []) { $response = $this->getClient()->getHttpClient()->put($path, $body, $parameters, $headers); return $this->decodeResponse($response); }
php
public function put($path, $body = null, array $parameters = [], $headers = []) { $response = $this->getClient()->getHttpClient()->put($path, $body, $parameters, $headers); return $this->decodeResponse($response); }
[ "public", "function", "put", "(", "$", "path", ",", "$", "body", "=", "null", ",", "array", "$", "parameters", "=", "[", "]", ",", "$", "headers", "=", "[", "]", ")", "{", "$", "response", "=", "$", "this", "->", "getClient", "(", ")", "->", "g...
Send a PUT request @param $path @param null $body @param array $parameters @param array $headers @return mixed
[ "Send", "a", "PUT", "request" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Api/AbstractApi.php#L95-L100
php-tmdb/api
lib/Tmdb/Api/AbstractApi.php
AbstractApi.postJson
public function postJson($path, $postBody = null, array $parameters = [], $headers = []) { if (is_array($postBody)) { $postBody = json_encode($postBody); } return $this->post($path, $postBody, $parameters, $headers); }
php
public function postJson($path, $postBody = null, array $parameters = [], $headers = []) { if (is_array($postBody)) { $postBody = json_encode($postBody); } return $this->post($path, $postBody, $parameters, $headers); }
[ "public", "function", "postJson", "(", "$", "path", ",", "$", "postBody", "=", "null", ",", "array", "$", "parameters", "=", "[", "]", ",", "$", "headers", "=", "[", "]", ")", "{", "if", "(", "is_array", "(", "$", "postBody", ")", ")", "{", "$", ...
Send a POST request but json_encode the post body in the request @param string $path @param mixed $postBody @param array $parameters @param array $headers @return mixed
[ "Send", "a", "POST", "request", "but", "json_encode", "the", "post", "body", "in", "the", "request" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Api/AbstractApi.php#L143-L150
php-tmdb/api
lib/Tmdb/Repository/SearchRepository.php
SearchRepository.searchMovie
public function searchMovie($query, MovieSearchQuery $parameters, array $headers = []) { $data = $this->getApi()->searchMovies($query, $this->getParameters($parameters), $headers); return $this->getMovieFactory()->createResultCollection($data); }
php
public function searchMovie($query, MovieSearchQuery $parameters, array $headers = []) { $data = $this->getApi()->searchMovies($query, $this->getParameters($parameters), $headers); return $this->getMovieFactory()->createResultCollection($data); }
[ "public", "function", "searchMovie", "(", "$", "query", ",", "MovieSearchQuery", "$", "parameters", ",", "array", "$", "headers", "=", "[", "]", ")", "{", "$", "data", "=", "$", "this", "->", "getApi", "(", ")", "->", "searchMovies", "(", "$", "query",...
@param string $query @param MovieSearchQuery $parameters @param array $headers @return ResultCollection|Movie[]
[ "@param", "string", "$query", "@param", "MovieSearchQuery", "$parameters", "@param", "array", "$headers" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Repository/SearchRepository.php#L101-L106
php-tmdb/api
lib/Tmdb/Repository/SearchRepository.php
SearchRepository.searchCollection
public function searchCollection($query, CollectionSearchQuery $parameters, array $headers = []) { $data = $this->getApi()->searchCollection($query, $this->getParameters($parameters), $headers); return $this->getCollectionFactory()->createResultCollection($data); }
php
public function searchCollection($query, CollectionSearchQuery $parameters, array $headers = []) { $data = $this->getApi()->searchCollection($query, $this->getParameters($parameters), $headers); return $this->getCollectionFactory()->createResultCollection($data); }
[ "public", "function", "searchCollection", "(", "$", "query", ",", "CollectionSearchQuery", "$", "parameters", ",", "array", "$", "headers", "=", "[", "]", ")", "{", "$", "data", "=", "$", "this", "->", "getApi", "(", ")", "->", "searchCollection", "(", "...
@param string $query @param CollectionSearchQuery $parameters @param array $headers @return ResultCollection[]
[ "@param", "string", "$query", "@param", "CollectionSearchQuery", "$parameters", "@param", "array", "$headers" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Repository/SearchRepository.php#L115-L120