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
bizley/yii2-migration
src/controllers/MigrationController.php
MigrationController.removeExcludedTables
public function removeExcludedTables(array $tables): array { if (!$tables) { return []; } $filteredTables = []; $excludedTables = array_merge( [$this->db->schema->getRawTableName($this->migrationTable)], $this->excludeTables ); foreach ($tables as $table) { if (!in_array($table, $excludedTables, true)) { $filteredTables[] = $table; } } return $filteredTables; }
php
public function removeExcludedTables(array $tables): array { if (!$tables) { return []; } $filteredTables = []; $excludedTables = array_merge( [$this->db->schema->getRawTableName($this->migrationTable)], $this->excludeTables ); foreach ($tables as $table) { if (!in_array($table, $excludedTables, true)) { $filteredTables[] = $table; } } return $filteredTables; }
[ "public", "function", "removeExcludedTables", "(", "array", "$", "tables", ")", ":", "array", "{", "if", "(", "!", "$", "tables", ")", "{", "return", "[", "]", ";", "}", "$", "filteredTables", "=", "[", "]", ";", "$", "excludedTables", "=", "array_merg...
Removes excluded tables names from the tables list. @param array $tables @return array @since 3.2.0
[ "Removes", "excluded", "tables", "names", "from", "the", "tables", "list", "." ]
train
https://github.com/bizley/yii2-migration/blob/881d9a790a137a0e1aa7b0bb40c71ebc9bdab83f/src/controllers/MigrationController.php#L644-L663
bizley/yii2-migration
src/table/TableIndex.php
TableIndex.render
public function render(TableStructure $table, int $indent = 8) { return str_repeat(' ', $indent) . "\$this->createIndex('{$this->name}', '" . $table->renderName() . "', " . (count($this->columns) === 1 ? "'{$this->columns[0]}'" : "['" . implode("', '", $this->columns) . "']") . ($this->unique ? ', true' : '') . ');'; }
php
public function render(TableStructure $table, int $indent = 8) { return str_repeat(' ', $indent) . "\$this->createIndex('{$this->name}', '" . $table->renderName() . "', " . (count($this->columns) === 1 ? "'{$this->columns[0]}'" : "['" . implode("', '", $this->columns) . "']") . ($this->unique ? ', true' : '') . ');'; }
[ "public", "function", "render", "(", "TableStructure", "$", "table", ",", "int", "$", "indent", "=", "8", ")", "{", "return", "str_repeat", "(", "' '", ",", "$", "indent", ")", ".", "\"\\$this->createIndex('{$this->name}', '\"", ".", "$", "table", "->", "ren...
Renders the index. @param TableStructure $table @param int $indent @return string
[ "Renders", "the", "index", "." ]
train
https://github.com/bizley/yii2-migration/blob/881d9a790a137a0e1aa7b0bb40c71ebc9bdab83f/src/table/TableIndex.php#L36-L45
bizley/yii2-migration
src/table/TableColumnDecimal.php
TableColumnDecimal.getLength
public function getLength() { return in_array($this->schema, $this->lengthSchemas, true) ? ($this->precision . ($this->scale ? ', ' . $this->scale : null)) : null; }
php
public function getLength() { return in_array($this->schema, $this->lengthSchemas, true) ? ($this->precision . ($this->scale ? ', ' . $this->scale : null)) : null; }
[ "public", "function", "getLength", "(", ")", "{", "return", "in_array", "(", "$", "this", "->", "schema", ",", "$", "this", "->", "lengthSchemas", ",", "true", ")", "?", "(", "$", "this", "->", "precision", ".", "(", "$", "this", "->", "scale", "?", ...
Returns length of the column. @return int|string
[ "Returns", "length", "of", "the", "column", "." ]
train
https://github.com/bizley/yii2-migration/blob/881d9a790a137a0e1aa7b0bb40c71ebc9bdab83f/src/table/TableColumnDecimal.php#L33-L36
bizley/yii2-migration
src/table/TableColumnDecimal.php
TableColumnDecimal.setLength
public function setLength($value): void { if (in_array($this->schema, $this->lengthSchemas, true)) { $length = is_array($value) ? $value : preg_split('\s*,\s*', $value); if (isset($length[0]) && !empty($length[0])) { $this->precision = $length[0]; } if (isset($length[1]) && !empty($length[1])) { $this->scale = $length[1]; } } }
php
public function setLength($value): void { if (in_array($this->schema, $this->lengthSchemas, true)) { $length = is_array($value) ? $value : preg_split('\s*,\s*', $value); if (isset($length[0]) && !empty($length[0])) { $this->precision = $length[0]; } if (isset($length[1]) && !empty($length[1])) { $this->scale = $length[1]; } } }
[ "public", "function", "setLength", "(", "$", "value", ")", ":", "void", "{", "if", "(", "in_array", "(", "$", "this", "->", "schema", ",", "$", "this", "->", "lengthSchemas", ",", "true", ")", ")", "{", "$", "length", "=", "is_array", "(", "$", "va...
Sets length of the column. @param array|string|int $value
[ "Sets", "length", "of", "the", "column", "." ]
train
https://github.com/bizley/yii2-migration/blob/881d9a790a137a0e1aa7b0bb40c71ebc9bdab83f/src/table/TableColumnDecimal.php#L42-L55
bizley/yii2-migration
src/table/TableColumnJson.php
TableColumnJson.init
public function init(): void { parent::init(); if ($this->default !== '' && $this->default !== null && !is_array($this->default)) { try { $default = Json::decode($this->default); if (is_array($default)) { $this->default = $default; } } catch (InvalidArgumentException $exception) {} } }
php
public function init(): void { parent::init(); if ($this->default !== '' && $this->default !== null && !is_array($this->default)) { try { $default = Json::decode($this->default); if (is_array($default)) { $this->default = $default; } } catch (InvalidArgumentException $exception) {} } }
[ "public", "function", "init", "(", ")", ":", "void", "{", "parent", "::", "init", "(", ")", ";", "if", "(", "$", "this", "->", "default", "!==", "''", "&&", "$", "this", "->", "default", "!==", "null", "&&", "!", "is_array", "(", "$", "this", "->...
Checks if default value is JSONed array. If so it's decoded. @since 3.3.0
[ "Checks", "if", "default", "value", "is", "JSONed", "array", ".", "If", "so", "it", "s", "decoded", "." ]
train
https://github.com/bizley/yii2-migration/blob/881d9a790a137a0e1aa7b0bb40c71ebc9bdab83f/src/table/TableColumnJson.php#L21-L34
bizley/yii2-migration
src/table/TableForeignKey.php
TableForeignKey.renderName
public function renderName(TableStructure $table): string { if ($this->name === null || is_numeric($this->name)) { return "fk-{$table->name}-" . implode('-', $this->columns); } return $this->name; }
php
public function renderName(TableStructure $table): string { if ($this->name === null || is_numeric($this->name)) { return "fk-{$table->name}-" . implode('-', $this->columns); } return $this->name; }
[ "public", "function", "renderName", "(", "TableStructure", "$", "table", ")", ":", "string", "{", "if", "(", "$", "this", "->", "name", "===", "null", "||", "is_numeric", "(", "$", "this", "->", "name", ")", ")", "{", "return", "\"fk-{$table->name}-\"", ...
Renders key name. @param TableStructure $table @return string
[ "Renders", "key", "name", "." ]
train
https://github.com/bizley/yii2-migration/blob/881d9a790a137a0e1aa7b0bb40c71ebc9bdab83f/src/table/TableForeignKey.php#L57-L64
bizley/yii2-migration
src/table/TableForeignKey.php
TableForeignKey.renderRefTableName
public function renderRefTableName(TableStructure $table): string { $tableName = $this->refTable; if (!$table->usePrefix) { return $tableName; } if ($table->dbPrefix && strpos($this->refTable, $table->dbPrefix) === 0) { $tableName = substr($this->refTable, mb_strlen($table->dbPrefix, 'UTF-8')); } return '{{%' . $tableName . '}}'; }
php
public function renderRefTableName(TableStructure $table): string { $tableName = $this->refTable; if (!$table->usePrefix) { return $tableName; } if ($table->dbPrefix && strpos($this->refTable, $table->dbPrefix) === 0) { $tableName = substr($this->refTable, mb_strlen($table->dbPrefix, 'UTF-8')); } return '{{%' . $tableName . '}}'; }
[ "public", "function", "renderRefTableName", "(", "TableStructure", "$", "table", ")", ":", "string", "{", "$", "tableName", "=", "$", "this", "->", "refTable", ";", "if", "(", "!", "$", "table", "->", "usePrefix", ")", "{", "return", "$", "tableName", ";...
Renders reference table name. @param TableStructure $table @return string
[ "Renders", "reference", "table", "name", "." ]
train
https://github.com/bizley/yii2-migration/blob/881d9a790a137a0e1aa7b0bb40c71ebc9bdab83f/src/table/TableForeignKey.php#L71-L84
bizley/yii2-migration
src/table/TableForeignKey.php
TableForeignKey.render
public function render(TableStructure $table, int $indent = 8): string { return str_repeat(' ', $indent) . '$this->addForeignKey(\'' . $this->renderName($table) . "', '" . $table->renderName() . "', " . (count($this->columns) === 1 ? "'{$this->columns[0]}'" : "['" . implode("', '", $this->columns) . "']") . ", '" . $this->renderRefTableName($table) . "', " . (count($this->refColumns) === 1 ? "'{$this->refColumns[0]}'" : "['" . implode("', '", $this->refColumns) . "']") . ($this->onDelete ? ", '{$this->onDelete}'" : '') . ($this->onUpdate ? ($this->onDelete === null ? ', null' : '') . ", '{$this->onUpdate}'" : '') . ');'; }
php
public function render(TableStructure $table, int $indent = 8): string { return str_repeat(' ', $indent) . '$this->addForeignKey(\'' . $this->renderName($table) . "', '" . $table->renderName() . "', " . (count($this->columns) === 1 ? "'{$this->columns[0]}'" : "['" . implode("', '", $this->columns) . "']") . ", '" . $this->renderRefTableName($table) . "', " . (count($this->refColumns) === 1 ? "'{$this->refColumns[0]}'" : "['" . implode("', '", $this->refColumns) . "']") . ($this->onDelete ? ", '{$this->onDelete}'" : '') . ($this->onUpdate ? ($this->onDelete === null ? ', null' : '') . ", '{$this->onUpdate}'" : '') . ');'; }
[ "public", "function", "render", "(", "TableStructure", "$", "table", ",", "int", "$", "indent", "=", "8", ")", ":", "string", "{", "return", "str_repeat", "(", "' '", ",", "$", "indent", ")", ".", "'$this->addForeignKey(\\''", ".", "$", "this", "->", "re...
Renders the key. @param TableStructure $table @param int $indent @return string
[ "Renders", "the", "key", "." ]
train
https://github.com/bizley/yii2-migration/blob/881d9a790a137a0e1aa7b0bb40c71ebc9bdab83f/src/table/TableForeignKey.php#L92-L108
layershifter/TLDExtract
src/Result.php
Result.getFullHost
public function getFullHost() { // Case 1: Host hasn't suffix, possibly IP. if (null === $this->suffix) { return $this->hostname; } // Case 2: Domain with suffix, but without subdomain. if (null === $this->subdomain) { return $this->hostname . '.' . $this->suffix; } // Case 3: Domain with suffix & subdomain. return implode('.', [$this->subdomain, $this->hostname, $this->suffix]); }
php
public function getFullHost() { // Case 1: Host hasn't suffix, possibly IP. if (null === $this->suffix) { return $this->hostname; } // Case 2: Domain with suffix, but without subdomain. if (null === $this->subdomain) { return $this->hostname . '.' . $this->suffix; } // Case 3: Domain with suffix & subdomain. return implode('.', [$this->subdomain, $this->hostname, $this->suffix]); }
[ "public", "function", "getFullHost", "(", ")", "{", "// Case 1: Host hasn't suffix, possibly IP.", "if", "(", "null", "===", "$", "this", "->", "suffix", ")", "{", "return", "$", "this", "->", "hostname", ";", "}", "// Case 2: Domain with suffix, but without subdomain...
Method that returns full host record. @return string
[ "Method", "that", "returns", "full", "host", "record", "." ]
train
https://github.com/layershifter/TLDExtract/blob/b49cb89a4ed59a9474a47589054e56ce57787348/src/Result.php#L107-L124
layershifter/TLDExtract
src/Result.php
Result.getRegistrableDomain
public function getRegistrableDomain() { if (null === $this->suffix) { return null; } return null === $this->hostname ? null : $this->hostname . '.' . $this->suffix; }
php
public function getRegistrableDomain() { if (null === $this->suffix) { return null; } return null === $this->hostname ? null : $this->hostname . '.' . $this->suffix; }
[ "public", "function", "getRegistrableDomain", "(", ")", "{", "if", "(", "null", "===", "$", "this", "->", "suffix", ")", "{", "return", "null", ";", "}", "return", "null", "===", "$", "this", "->", "hostname", "?", "null", ":", "$", "this", "->", "ho...
Returns registrable domain or null. @return null|string
[ "Returns", "registrable", "domain", "or", "null", "." ]
train
https://github.com/layershifter/TLDExtract/blob/b49cb89a4ed59a9474a47589054e56ce57787348/src/Result.php#L131-L138
layershifter/TLDExtract
src/Extract.php
Extract.setExtractionMode
public function setExtractionMode($extractionMode = null) { if (null === $extractionMode) { $this->extractionMode = static::MODE_ALLOW_ICANN | static::MODE_ALLOW_PRIVATE | static::MODE_ALLOW_NOT_EXISTING_SUFFIXES; return; } if (!is_int($extractionMode)) { throw new RuntimeException('Invalid argument type, extractionMode must be integer'); } if (!in_array($extractionMode, [ static::MODE_ALLOW_ICANN, static::MODE_ALLOW_PRIVATE, static::MODE_ALLOW_NOT_EXISTING_SUFFIXES, static::MODE_ALLOW_ICANN | static::MODE_ALLOW_PRIVATE, static::MODE_ALLOW_ICANN | static::MODE_ALLOW_NOT_EXISTING_SUFFIXES, static::MODE_ALLOW_ICANN | static::MODE_ALLOW_PRIVATE | static::MODE_ALLOW_NOT_EXISTING_SUFFIXES, static::MODE_ALLOW_PRIVATE | static::MODE_ALLOW_NOT_EXISTING_SUFFIXES ], true) ) { throw new RuntimeException( 'Invalid argument type, extractionMode must be one of defined constants of their combination' ); } $this->extractionMode = $extractionMode; }
php
public function setExtractionMode($extractionMode = null) { if (null === $extractionMode) { $this->extractionMode = static::MODE_ALLOW_ICANN | static::MODE_ALLOW_PRIVATE | static::MODE_ALLOW_NOT_EXISTING_SUFFIXES; return; } if (!is_int($extractionMode)) { throw new RuntimeException('Invalid argument type, extractionMode must be integer'); } if (!in_array($extractionMode, [ static::MODE_ALLOW_ICANN, static::MODE_ALLOW_PRIVATE, static::MODE_ALLOW_NOT_EXISTING_SUFFIXES, static::MODE_ALLOW_ICANN | static::MODE_ALLOW_PRIVATE, static::MODE_ALLOW_ICANN | static::MODE_ALLOW_NOT_EXISTING_SUFFIXES, static::MODE_ALLOW_ICANN | static::MODE_ALLOW_PRIVATE | static::MODE_ALLOW_NOT_EXISTING_SUFFIXES, static::MODE_ALLOW_PRIVATE | static::MODE_ALLOW_NOT_EXISTING_SUFFIXES ], true) ) { throw new RuntimeException( 'Invalid argument type, extractionMode must be one of defined constants of their combination' ); } $this->extractionMode = $extractionMode; }
[ "public", "function", "setExtractionMode", "(", "$", "extractionMode", "=", "null", ")", "{", "if", "(", "null", "===", "$", "extractionMode", ")", "{", "$", "this", "->", "extractionMode", "=", "static", "::", "MODE_ALLOW_ICANN", "|", "static", "::", "MODE_...
Sets extraction mode, option that will control extraction process. @param int $extractionMode One of MODE_* constants @throws RuntimeException
[ "Sets", "extraction", "mode", "option", "that", "will", "control", "extraction", "process", "." ]
train
https://github.com/layershifter/TLDExtract/blob/b49cb89a4ed59a9474a47589054e56ce57787348/src/Extract.php#L116-L146
layershifter/TLDExtract
src/Extract.php
Extract.parse
public function parse($url) { $hostname = $this->extractHostname($url); // If received hostname is valid IP address, result will be formed from it. if (IP::isValid($hostname)) { return new $this->resultClassName(null, $hostname, null); } list($subDomain, $host, $suffix) = $this->extractParts($hostname); return new $this->resultClassName($subDomain, $host, $suffix); }
php
public function parse($url) { $hostname = $this->extractHostname($url); // If received hostname is valid IP address, result will be formed from it. if (IP::isValid($hostname)) { return new $this->resultClassName(null, $hostname, null); } list($subDomain, $host, $suffix) = $this->extractParts($hostname); return new $this->resultClassName($subDomain, $host, $suffix); }
[ "public", "function", "parse", "(", "$", "url", ")", "{", "$", "hostname", "=", "$", "this", "->", "extractHostname", "(", "$", "url", ")", ";", "// If received hostname is valid IP address, result will be formed from it.", "if", "(", "IP", "::", "isValid", "(", ...
Extract the subdomain, host and gTLD/ccTLD components from a URL. @param string $url URL that will be extracted @return ResultInterface
[ "Extract", "the", "subdomain", "host", "and", "gTLD", "/", "ccTLD", "components", "from", "a", "URL", "." ]
train
https://github.com/layershifter/TLDExtract/blob/b49cb89a4ed59a9474a47589054e56ce57787348/src/Extract.php#L155-L168
layershifter/TLDExtract
src/Extract.php
Extract.extractHostname
private function extractHostname($url) { $url = trim(Str::lower($url)); // Removes scheme and path i.e. "https://github.com/layershifter" to "github.com/layershifter". $url = preg_replace(static::SCHEMA_PATTERN, '', $url); // Removes path and query part of URL i.e. "github.com/layershifter" to "github.com". $url = $this->fixUriParts($url); $hostname = Arr::first(explode('/', $url, 2)); // Removes username from URL i.e. user@github.com to github.com. $hostname = Arr::last(explode('@', $hostname)); // Remove ports from hosts, also check for IPv6 literals like "[3ffe:2a00:100:7031::1]". // // @see http://www.ietf.org/rfc/rfc2732.txt $lastBracketPosition = Str::strrpos($hostname, ']'); if ($lastBracketPosition !== false && Str::startsWith($hostname, '[')) { return Str::substr($hostname, 1, $lastBracketPosition - 1); } // This is either a normal hostname or an IPv4 address, just remove the port. $hostname = Arr::first(explode(':', $hostname)); // If string is empty, null will be returned. return '' === $hostname ? null : $hostname; }
php
private function extractHostname($url) { $url = trim(Str::lower($url)); // Removes scheme and path i.e. "https://github.com/layershifter" to "github.com/layershifter". $url = preg_replace(static::SCHEMA_PATTERN, '', $url); // Removes path and query part of URL i.e. "github.com/layershifter" to "github.com". $url = $this->fixUriParts($url); $hostname = Arr::first(explode('/', $url, 2)); // Removes username from URL i.e. user@github.com to github.com. $hostname = Arr::last(explode('@', $hostname)); // Remove ports from hosts, also check for IPv6 literals like "[3ffe:2a00:100:7031::1]". // // @see http://www.ietf.org/rfc/rfc2732.txt $lastBracketPosition = Str::strrpos($hostname, ']'); if ($lastBracketPosition !== false && Str::startsWith($hostname, '[')) { return Str::substr($hostname, 1, $lastBracketPosition - 1); } // This is either a normal hostname or an IPv4 address, just remove the port. $hostname = Arr::first(explode(':', $hostname)); // If string is empty, null will be returned. return '' === $hostname ? null : $hostname; }
[ "private", "function", "extractHostname", "(", "$", "url", ")", "{", "$", "url", "=", "trim", "(", "Str", "::", "lower", "(", "$", "url", ")", ")", ";", "// Removes scheme and path i.e. \"https://github.com/layershifter\" to \"github.com/layershifter\".", "$", "url", ...
Method that extracts the hostname or IP address from a URL. @param string $url URL for extraction @return null|string Hostname or IP address
[ "Method", "that", "extracts", "the", "hostname", "or", "IP", "address", "from", "a", "URL", "." ]
train
https://github.com/layershifter/TLDExtract/blob/b49cb89a4ed59a9474a47589054e56ce57787348/src/Extract.php#L177-L211
layershifter/TLDExtract
src/Extract.php
Extract.extractParts
public function extractParts($hostname) { $suffix = $this->extractSuffix($hostname); if ($suffix === $hostname) { return [null, $hostname, null]; } if (null !== $suffix) { $hostname = Str::substr($hostname, 0, -Str::length($suffix) - 1); } $lastDot = Str::strrpos($hostname, '.'); if (false === $lastDot) { return [null, $hostname, $suffix]; } $subDomain = Str::substr($hostname, 0, $lastDot); $host = Str::substr($hostname, $lastDot + 1); return [ $subDomain, $host, $suffix ]; }
php
public function extractParts($hostname) { $suffix = $this->extractSuffix($hostname); if ($suffix === $hostname) { return [null, $hostname, null]; } if (null !== $suffix) { $hostname = Str::substr($hostname, 0, -Str::length($suffix) - 1); } $lastDot = Str::strrpos($hostname, '.'); if (false === $lastDot) { return [null, $hostname, $suffix]; } $subDomain = Str::substr($hostname, 0, $lastDot); $host = Str::substr($hostname, $lastDot + 1); return [ $subDomain, $host, $suffix ]; }
[ "public", "function", "extractParts", "(", "$", "hostname", ")", "{", "$", "suffix", "=", "$", "this", "->", "extractSuffix", "(", "$", "hostname", ")", ";", "if", "(", "$", "suffix", "===", "$", "hostname", ")", "{", "return", "[", "null", ",", "$",...
Extracts subdomain, host and suffix from input string. Based on algorithm described in https://publicsuffix.org/list/. @param string $hostname Hostname for extraction @return array|string[] An array that contains subdomain, host and suffix.
[ "Extracts", "subdomain", "host", "and", "suffix", "from", "input", "string", ".", "Based", "on", "algorithm", "described", "in", "https", ":", "//", "publicsuffix", ".", "org", "/", "list", "/", "." ]
train
https://github.com/layershifter/TLDExtract/blob/b49cb89a4ed59a9474a47589054e56ce57787348/src/Extract.php#L221-L247
layershifter/TLDExtract
src/Extract.php
Extract.extractSuffix
private function extractSuffix($hostname) { // If hostname has leading dot, it's invalid. // If hostname is a single label domain makes, it's invalid. if (Str::startsWith($hostname, '.') || Str::strpos($hostname, '.') === false) { return null; } // If domain is in punycode, it will be converted to IDN. $isPunycoded = Str::strpos($hostname, 'xn--') !== false; if ($isPunycoded) { $hostname = $this->idn->toUTF8($hostname); } // URI producers should use names that conform to the DNS syntax, even when use of DNS is not immediately // apparent, and should limit these names to no more than 255 characters in length. // // @see https://tools.ietf.org/html/rfc3986 // @see http://blogs.msdn.com/b/oldnewthing/archive/2012/04/12/10292868.aspx if (Str::length($hostname) > 253) { return null; } // The DNS itself places only one restriction on the particular labels that can be used to identify resource // records. That one restriction relates to the length of the label and the full name. The length of any one // label is limited to between 1 and 63 octets. A full domain name is limited to 255 octets (including the // separators). // // @see http://tools.ietf.org/html/rfc2181 try { $asciiHostname = $this->idn->toASCII($hostname); } catch (OutOfBoundsException $e) { return null; } if (0 === preg_match(self::HOSTNAME_PATTERN, $asciiHostname)) { return null; } $suffix = $this->parseSuffix($hostname); if (null === $suffix) { if (!($this->extractionMode & static::MODE_ALLOW_NOT_EXISTING_SUFFIXES)) { return null; } $suffix = Str::substr($hostname, Str::strrpos($hostname, '.') + 1); } // If domain is punycoded, suffix will be converted to punycode. return $isPunycoded ? $this->idn->toASCII($suffix) : $suffix; }
php
private function extractSuffix($hostname) { // If hostname has leading dot, it's invalid. // If hostname is a single label domain makes, it's invalid. if (Str::startsWith($hostname, '.') || Str::strpos($hostname, '.') === false) { return null; } // If domain is in punycode, it will be converted to IDN. $isPunycoded = Str::strpos($hostname, 'xn--') !== false; if ($isPunycoded) { $hostname = $this->idn->toUTF8($hostname); } // URI producers should use names that conform to the DNS syntax, even when use of DNS is not immediately // apparent, and should limit these names to no more than 255 characters in length. // // @see https://tools.ietf.org/html/rfc3986 // @see http://blogs.msdn.com/b/oldnewthing/archive/2012/04/12/10292868.aspx if (Str::length($hostname) > 253) { return null; } // The DNS itself places only one restriction on the particular labels that can be used to identify resource // records. That one restriction relates to the length of the label and the full name. The length of any one // label is limited to between 1 and 63 octets. A full domain name is limited to 255 octets (including the // separators). // // @see http://tools.ietf.org/html/rfc2181 try { $asciiHostname = $this->idn->toASCII($hostname); } catch (OutOfBoundsException $e) { return null; } if (0 === preg_match(self::HOSTNAME_PATTERN, $asciiHostname)) { return null; } $suffix = $this->parseSuffix($hostname); if (null === $suffix) { if (!($this->extractionMode & static::MODE_ALLOW_NOT_EXISTING_SUFFIXES)) { return null; } $suffix = Str::substr($hostname, Str::strrpos($hostname, '.') + 1); } // If domain is punycoded, suffix will be converted to punycode. return $isPunycoded ? $this->idn->toASCII($suffix) : $suffix; }
[ "private", "function", "extractSuffix", "(", "$", "hostname", ")", "{", "// If hostname has leading dot, it's invalid.", "// If hostname is a single label domain makes, it's invalid.", "if", "(", "Str", "::", "startsWith", "(", "$", "hostname", ",", "'.'", ")", "||", "Str...
Extracts suffix from hostname using Public Suffix List database. @param string $hostname Hostname for extraction @return null|string
[ "Extracts", "suffix", "from", "hostname", "using", "Public", "Suffix", "List", "database", "." ]
train
https://github.com/layershifter/TLDExtract/blob/b49cb89a4ed59a9474a47589054e56ce57787348/src/Extract.php#L256-L313
layershifter/TLDExtract
src/Extract.php
Extract.parseSuffix
private function parseSuffix($hostname) { $hostnameParts = explode('.', $hostname); $realSuffix = null; for ($i = 0, $count = count($hostnameParts); $i < $count; $i++) { $possibleSuffix = implode('.', array_slice($hostnameParts, $i)); $exceptionSuffix = '!' . $possibleSuffix; if ($this->suffixExists($exceptionSuffix)) { $realSuffix = implode('.', array_slice($hostnameParts, $i + 1)); break; } if ($this->suffixExists($possibleSuffix)) { $realSuffix = $possibleSuffix; break; } $wildcardTld = '*.' . implode('.', array_slice($hostnameParts, $i + 1)); if ($this->suffixExists($wildcardTld)) { $realSuffix = $possibleSuffix; break; } } return $realSuffix; }
php
private function parseSuffix($hostname) { $hostnameParts = explode('.', $hostname); $realSuffix = null; for ($i = 0, $count = count($hostnameParts); $i < $count; $i++) { $possibleSuffix = implode('.', array_slice($hostnameParts, $i)); $exceptionSuffix = '!' . $possibleSuffix; if ($this->suffixExists($exceptionSuffix)) { $realSuffix = implode('.', array_slice($hostnameParts, $i + 1)); break; } if ($this->suffixExists($possibleSuffix)) { $realSuffix = $possibleSuffix; break; } $wildcardTld = '*.' . implode('.', array_slice($hostnameParts, $i + 1)); if ($this->suffixExists($wildcardTld)) { $realSuffix = $possibleSuffix; break; } } return $realSuffix; }
[ "private", "function", "parseSuffix", "(", "$", "hostname", ")", "{", "$", "hostnameParts", "=", "explode", "(", "'.'", ",", "$", "hostname", ")", ";", "$", "realSuffix", "=", "null", ";", "for", "(", "$", "i", "=", "0", ",", "$", "count", "=", "co...
Extracts suffix from hostname using Public Suffix List database. @param string $hostname Hostname for extraction @return null|string
[ "Extracts", "suffix", "from", "hostname", "using", "Public", "Suffix", "List", "database", "." ]
train
https://github.com/layershifter/TLDExtract/blob/b49cb89a4ed59a9474a47589054e56ce57787348/src/Extract.php#L322-L353
layershifter/TLDExtract
src/Extract.php
Extract.suffixExists
protected function suffixExists($entry) { if (!$this->suffixStore->isExists($entry)) { return false; } $type = $this->suffixStore->getType($entry); if ($this->extractionMode & static::MODE_ALLOW_ICANN && $type === Store::TYPE_ICANN) { return true; } return $this->extractionMode & static::MODE_ALLOW_PRIVATE && $type === Store::TYPE_PRIVATE; }
php
protected function suffixExists($entry) { if (!$this->suffixStore->isExists($entry)) { return false; } $type = $this->suffixStore->getType($entry); if ($this->extractionMode & static::MODE_ALLOW_ICANN && $type === Store::TYPE_ICANN) { return true; } return $this->extractionMode & static::MODE_ALLOW_PRIVATE && $type === Store::TYPE_PRIVATE; }
[ "protected", "function", "suffixExists", "(", "$", "entry", ")", "{", "if", "(", "!", "$", "this", "->", "suffixStore", "->", "isExists", "(", "$", "entry", ")", ")", "{", "return", "false", ";", "}", "$", "type", "=", "$", "this", "->", "suffixStore...
Method that checks existence of entry in Public Suffix List database, including provided options. @param string $entry Entry for check in Public Suffix List database @return bool
[ "Method", "that", "checks", "existence", "of", "entry", "in", "Public", "Suffix", "List", "database", "including", "provided", "options", "." ]
train
https://github.com/layershifter/TLDExtract/blob/b49cb89a4ed59a9474a47589054e56ce57787348/src/Extract.php#L362-L375
layershifter/TLDExtract
src/Extract.php
Extract.fixUriParts
private function fixUriParts($url) { $position = Str::strpos($url, '?') ?: Str::strpos($url, '#'); if ($position === false) { return $url; } return Str::substr($url, 0, $position) . '/' . Str::substr($url, $position); }
php
private function fixUriParts($url) { $position = Str::strpos($url, '?') ?: Str::strpos($url, '#'); if ($position === false) { return $url; } return Str::substr($url, 0, $position) . '/' . Str::substr($url, $position); }
[ "private", "function", "fixUriParts", "(", "$", "url", ")", "{", "$", "position", "=", "Str", "::", "strpos", "(", "$", "url", ",", "'?'", ")", "?", ":", "Str", "::", "strpos", "(", "$", "url", ",", "'#'", ")", ";", "if", "(", "$", "position", ...
Fixes URL: - from "github.com?layershifter" to "github.com/?layershifter". - from "github.com#layershifter" to "github.com/#layershifter". @see https://github.com/layershifter/TLDExtract/issues/5 @param string $url @return string
[ "Fixes", "URL", ":", "-", "from", "github", ".", "com?layershifter", "to", "github", ".", "com", "/", "?layershifter", ".", "-", "from", "github", ".", "com#layershifter", "to", "github", ".", "com", "/", "#layershifter", "." ]
train
https://github.com/layershifter/TLDExtract/blob/b49cb89a4ed59a9474a47589054e56ce57787348/src/Extract.php#L388-L397
qcod/laravel-settings
src/Setting/SettingEloquentStorage.php
SettingEloquentStorage.all
public function all($fresh = false) { if ($fresh) { return $this->getSettingModel()->pluck('val', 'name'); } return Cache::rememberForever($this->settingsCacheKey, function () { return $this->getSettingModel()->pluck('val', 'name'); }); }
php
public function all($fresh = false) { if ($fresh) { return $this->getSettingModel()->pluck('val', 'name'); } return Cache::rememberForever($this->settingsCacheKey, function () { return $this->getSettingModel()->pluck('val', 'name'); }); }
[ "public", "function", "all", "(", "$", "fresh", "=", "false", ")", "{", "if", "(", "$", "fresh", ")", "{", "return", "$", "this", "->", "getSettingModel", "(", ")", "->", "pluck", "(", "'val'", ",", "'name'", ")", ";", "}", "return", "Cache", "::",...
{@inheritdoc}
[ "{" ]
train
https://github.com/qcod/laravel-settings/blob/42dacdc9ca5e8b9994dafb737be41a3f5ba3e5c5/src/Setting/SettingEloquentStorage.php#L19-L28
qcod/laravel-settings
src/Setting/SettingEloquentStorage.php
SettingEloquentStorage.get
public function get($key, $default = null, $fresh = false) { return $this->all($fresh)->get($key, $default); }
php
public function get($key, $default = null, $fresh = false) { return $this->all($fresh)->get($key, $default); }
[ "public", "function", "get", "(", "$", "key", ",", "$", "default", "=", "null", ",", "$", "fresh", "=", "false", ")", "{", "return", "$", "this", "->", "all", "(", "$", "fresh", ")", "->", "get", "(", "$", "key", ",", "$", "default", ")", ";", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/qcod/laravel-settings/blob/42dacdc9ca5e8b9994dafb737be41a3f5ba3e5c5/src/Setting/SettingEloquentStorage.php#L33-L36
qcod/laravel-settings
src/Setting/SettingEloquentStorage.php
SettingEloquentStorage.set
public function set($key, $val = null) { // if its an array, batch save settings if (is_array($key)) { foreach ($key as $name => $value) { $this->set($name, $value); } return true; } $setting = $this->getSettingModel()->firstOrNew(['name' => $key]); $setting->val = $val; $setting->save(); $this->flushCache(); return $val; }
php
public function set($key, $val = null) { // if its an array, batch save settings if (is_array($key)) { foreach ($key as $name => $value) { $this->set($name, $value); } return true; } $setting = $this->getSettingModel()->firstOrNew(['name' => $key]); $setting->val = $val; $setting->save(); $this->flushCache(); return $val; }
[ "public", "function", "set", "(", "$", "key", ",", "$", "val", "=", "null", ")", "{", "// if its an array, batch save settings", "if", "(", "is_array", "(", "$", "key", ")", ")", "{", "foreach", "(", "$", "key", "as", "$", "name", "=>", "$", "value", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/qcod/laravel-settings/blob/42dacdc9ca5e8b9994dafb737be41a3f5ba3e5c5/src/Setting/SettingEloquentStorage.php#L41-L59
qcod/laravel-settings
src/Setting/SettingEloquentStorage.php
SettingEloquentStorage.remove
public function remove($key) { $deleted = $this->getSettingModel()->where('name', $key)->delete(); $this->flushCache(); return $deleted; }
php
public function remove($key) { $deleted = $this->getSettingModel()->where('name', $key)->delete(); $this->flushCache(); return $deleted; }
[ "public", "function", "remove", "(", "$", "key", ")", "{", "$", "deleted", "=", "$", "this", "->", "getSettingModel", "(", ")", "->", "where", "(", "'name'", ",", "$", "key", ")", "->", "delete", "(", ")", ";", "$", "this", "->", "flushCache", "(",...
{@inheritdoc}
[ "{" ]
train
https://github.com/qcod/laravel-settings/blob/42dacdc9ca5e8b9994dafb737be41a3f5ba3e5c5/src/Setting/SettingEloquentStorage.php#L72-L79
php-tmdb/api
lib/Tmdb/Factory/Account/AvatarFactory.php
AvatarFactory.create
public function create(array $data = []) { foreach ($data as $type => $content) { switch ($type) { case "gravatar": return $this->hydrate(new Gravatar(), $content); default: throw new InvalidArgumentException(sprintf( 'The avatar type "%s" has not been defined in the factory "%s".', $type, __CLASS__ )); } } return null; }
php
public function create(array $data = []) { foreach ($data as $type => $content) { switch ($type) { case "gravatar": return $this->hydrate(new Gravatar(), $content); default: throw new InvalidArgumentException(sprintf( 'The avatar type "%s" has not been defined in the factory "%s".', $type, __CLASS__ )); } } return null; }
[ "public", "function", "create", "(", "array", "$", "data", "=", "[", "]", ")", "{", "foreach", "(", "$", "data", "as", "$", "type", "=>", "$", "content", ")", "{", "switch", "(", "$", "type", ")", "{", "case", "\"gravatar\"", ":", "return", "$", ...
@param array $data @throws InvalidArgumentException @return mixed
[ "@param", "array", "$data" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Factory/Account/AvatarFactory.php#L33-L50
php-tmdb/api
lib/Tmdb/Client.php
Client.constructHttpClient
protected function constructHttpClient() { $hasHttpClient = (null !== $this->httpClient); $this->httpClient = new HttpClient($this->getOptions()); if (!$hasHttpClient) { $this->httpClient->registerDefaults(); } }
php
protected function constructHttpClient() { $hasHttpClient = (null !== $this->httpClient); $this->httpClient = new HttpClient($this->getOptions()); if (!$hasHttpClient) { $this->httpClient->registerDefaults(); } }
[ "protected", "function", "constructHttpClient", "(", ")", "{", "$", "hasHttpClient", "=", "(", "null", "!==", "$", "this", "->", "httpClient", ")", ";", "$", "this", "->", "httpClient", "=", "new", "HttpClient", "(", "$", "this", "->", "getOptions", "(", ...
Construct the http client In case you are implementing your own adapter, the base url will be passed on through the options bag at every call in the respective get / post methods etc. of the adapter. @return void
[ "Construct", "the", "http", "client" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Client.php#L177-L186
php-tmdb/api
lib/Tmdb/Client.php
Client.configureOptions
protected function configureOptions(array $options) { $resolver = new OptionsResolver(); $resolver->setDefaults([ 'adapter' => null, 'secure' => true, 'host' => self::TMDB_URI, 'base_url' => null, 'token' => null, 'session_token' => null, 'event_dispatcher' => array_key_exists('event_dispatcher', $this->options) ? $this->options['event_dispatcher'] : new EventDispatcher(), 'cache' => [], 'log' => [], ]); $resolver->setRequired([ 'adapter', 'host', 'token', 'secure', 'event_dispatcher', 'cache', 'log' ]); $resolver->setAllowedTypes('adapter', ['object', 'null']); $resolver->setAllowedTypes('host', ['string']); $resolver->setAllowedTypes('secure', ['bool']); $resolver->setAllowedTypes('token', ['object']); $resolver->setAllowedTypes('session_token', ['object', 'null']); $resolver->setAllowedTypes('event_dispatcher', ['object']); $this->options = $resolver->resolve($options); $this->postResolve($options); return $this->options; }
php
protected function configureOptions(array $options) { $resolver = new OptionsResolver(); $resolver->setDefaults([ 'adapter' => null, 'secure' => true, 'host' => self::TMDB_URI, 'base_url' => null, 'token' => null, 'session_token' => null, 'event_dispatcher' => array_key_exists('event_dispatcher', $this->options) ? $this->options['event_dispatcher'] : new EventDispatcher(), 'cache' => [], 'log' => [], ]); $resolver->setRequired([ 'adapter', 'host', 'token', 'secure', 'event_dispatcher', 'cache', 'log' ]); $resolver->setAllowedTypes('adapter', ['object', 'null']); $resolver->setAllowedTypes('host', ['string']); $resolver->setAllowedTypes('secure', ['bool']); $resolver->setAllowedTypes('token', ['object']); $resolver->setAllowedTypes('session_token', ['object', 'null']); $resolver->setAllowedTypes('event_dispatcher', ['object']); $this->options = $resolver->resolve($options); $this->postResolve($options); return $this->options; }
[ "protected", "function", "configureOptions", "(", "array", "$", "options", ")", "{", "$", "resolver", "=", "new", "OptionsResolver", "(", ")", ";", "$", "resolver", "->", "setDefaults", "(", "[", "'adapter'", "=>", "null", ",", "'secure'", "=>", "true", ",...
Configure options @param array $options @return array
[ "Configure", "options" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Client.php#L204-L242
php-tmdb/api
lib/Tmdb/Client.php
Client.configureCacheOptions
protected function configureCacheOptions(array $options = []) { $resolver = new OptionsResolver(); $resolver->setDefaults([ 'enabled' => true, 'handler' => null, 'subscriber' => null, 'path' => sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'php-tmdb-api', ]); $resolver->setRequired([ 'enabled', 'handler', ]); $resolver->setAllowedTypes('enabled', ['bool']); $resolver->setAllowedTypes('handler', ['object', 'null']); $resolver->setAllowedTypes('subscriber', ['object', 'null']); $resolver->setAllowedTypes('path', ['string', 'null']); $options = $resolver->resolve(array_key_exists('cache', $options) ? $options['cache'] : []); if ($options['enabled'] && !$options['handler']) { $options['handler'] = new FilesystemCache($options['path']); } return $options; }
php
protected function configureCacheOptions(array $options = []) { $resolver = new OptionsResolver(); $resolver->setDefaults([ 'enabled' => true, 'handler' => null, 'subscriber' => null, 'path' => sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'php-tmdb-api', ]); $resolver->setRequired([ 'enabled', 'handler', ]); $resolver->setAllowedTypes('enabled', ['bool']); $resolver->setAllowedTypes('handler', ['object', 'null']); $resolver->setAllowedTypes('subscriber', ['object', 'null']); $resolver->setAllowedTypes('path', ['string', 'null']); $options = $resolver->resolve(array_key_exists('cache', $options) ? $options['cache'] : []); if ($options['enabled'] && !$options['handler']) { $options['handler'] = new FilesystemCache($options['path']); } return $options; }
[ "protected", "function", "configureCacheOptions", "(", "array", "$", "options", "=", "[", "]", ")", "{", "$", "resolver", "=", "new", "OptionsResolver", "(", ")", ";", "$", "resolver", "->", "setDefaults", "(", "[", "'enabled'", "=>", "true", ",", "'handle...
Configure caching @param array $options @return array
[ "Configure", "caching" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Client.php#L250-L278
php-tmdb/api
lib/Tmdb/Client.php
Client.configureLogOptions
protected function configureLogOptions(array $options = []) { $resolver = new OptionsResolver(); $resolver->setDefaults([ 'enabled' => false, 'level' => LogLevel::DEBUG, 'handler' => null, 'subscriber' => null, 'path' => sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'php-tmdb-api.log', ]); $resolver->setRequired([ 'enabled', 'level', 'handler', ]); $resolver->setAllowedTypes('enabled', ['bool']); $resolver->setAllowedTypes('level', ['string']); $resolver->setAllowedTypes('handler', ['object', 'null']); $resolver->setAllowedTypes('path', ['string', 'null']); $resolver->setAllowedTypes('subscriber', ['object', 'null']); $options = $resolver->resolve(array_key_exists('log', $options) ? $options['log'] : []); if ($options['enabled'] && !$options['handler']) { $options['handler'] = new StreamHandler( $options['path'], $options['level'] ); } return $options; }
php
protected function configureLogOptions(array $options = []) { $resolver = new OptionsResolver(); $resolver->setDefaults([ 'enabled' => false, 'level' => LogLevel::DEBUG, 'handler' => null, 'subscriber' => null, 'path' => sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'php-tmdb-api.log', ]); $resolver->setRequired([ 'enabled', 'level', 'handler', ]); $resolver->setAllowedTypes('enabled', ['bool']); $resolver->setAllowedTypes('level', ['string']); $resolver->setAllowedTypes('handler', ['object', 'null']); $resolver->setAllowedTypes('path', ['string', 'null']); $resolver->setAllowedTypes('subscriber', ['object', 'null']); $options = $resolver->resolve(array_key_exists('log', $options) ? $options['log'] : []); if ($options['enabled'] && !$options['handler']) { $options['handler'] = new StreamHandler( $options['path'], $options['level'] ); } return $options; }
[ "protected", "function", "configureLogOptions", "(", "array", "$", "options", "=", "[", "]", ")", "{", "$", "resolver", "=", "new", "OptionsResolver", "(", ")", ";", "$", "resolver", "->", "setDefaults", "(", "[", "'enabled'", "=>", "false", ",", "'level'"...
Configure logging @param array $options @return array
[ "Configure", "logging" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Client.php#L286-L320
php-tmdb/api
lib/Tmdb/Client.php
Client.postResolve
protected function postResolve(array $options = []) { $this->options['base_url'] = sprintf( '%s://%s', $this->options['secure'] ? self::SCHEME_SECURE : self::SCHEME_INSECURE, $this->options['host'] ); if (!$this->options['adapter']) { $this->options['adapter'] = new GuzzleAdapter( new \GuzzleHttp\Client() ); } $this->options['cache'] = $this->configureCacheOptions($options); $this->options['log'] = $this->configureLogOptions($options); }
php
protected function postResolve(array $options = []) { $this->options['base_url'] = sprintf( '%s://%s', $this->options['secure'] ? self::SCHEME_SECURE : self::SCHEME_INSECURE, $this->options['host'] ); if (!$this->options['adapter']) { $this->options['adapter'] = new GuzzleAdapter( new \GuzzleHttp\Client() ); } $this->options['cache'] = $this->configureCacheOptions($options); $this->options['log'] = $this->configureLogOptions($options); }
[ "protected", "function", "postResolve", "(", "array", "$", "options", "=", "[", "]", ")", "{", "$", "this", "->", "options", "[", "'base_url'", "]", "=", "sprintf", "(", "'%s://%s'", ",", "$", "this", "->", "options", "[", "'secure'", "]", "?", "self",...
Post resolve @param array $options
[ "Post", "resolve" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Client.php#L327-L343
php-tmdb/api
lib/Tmdb/Api/Lists.php
Lists.createList
public function createList($name, $description, array $parameters = [], array $headers = []) { return $this->postJson('list', ['name' => $name, 'description' => $description], $parameters, $headers); }
php
public function createList($name, $description, array $parameters = [], array $headers = []) { return $this->postJson('list', ['name' => $name, 'description' => $description], $parameters, $headers); }
[ "public", "function", "createList", "(", "$", "name", ",", "$", "description", ",", "array", "$", "parameters", "=", "[", "]", ",", "array", "$", "headers", "=", "[", "]", ")", "{", "return", "$", "this", "->", "postJson", "(", "'list'", ",", "[", ...
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 mixed
[ "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/Api/Lists.php#L44-L47
php-tmdb/api
lib/Tmdb/Api/Lists.php
Lists.getItemStatus
public function getItemStatus($id, $movieId, array $parameters = [], array $headers = []) { return $this->get( 'list/' . $id . '/item_status', array_merge($parameters, ['movie_id' => $movieId]), $headers ); }
php
public function getItemStatus($id, $movieId, array $parameters = [], array $headers = []) { return $this->get( 'list/' . $id . '/item_status', array_merge($parameters, ['movie_id' => $movieId]), $headers ); }
[ "public", "function", "getItemStatus", "(", "$", "id", ",", "$", "movieId", ",", "array", "$", "parameters", "=", "[", "]", ",", "array", "$", "headers", "=", "[", "]", ")", "{", "return", "$", "this", "->", "get", "(", "'list/'", ".", "$", "id", ...
Check to see if a movie ID is already added to a list. @param string $id @param int $movieId @param array $parameters @param array $headers @return mixed
[ "Check", "to", "see", "if", "a", "movie", "ID", "is", "already", "added", "to", "a", "list", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Api/Lists.php#L58-L65
php-tmdb/api
lib/Tmdb/Api/Lists.php
Lists.clearList
public function clearList($id, $confirm) { return $this->post( 'list/'.$id.'/clear', null, ['confirm' => (bool) $confirm === true ? 'true':'false'] ); }
php
public function clearList($id, $confirm) { return $this->post( 'list/'.$id.'/clear', null, ['confirm' => (bool) $confirm === true ? 'true':'false'] ); }
[ "public", "function", "clearList", "(", "$", "id", ",", "$", "confirm", ")", "{", "return", "$", "this", "->", "post", "(", "'list/'", ".", "$", "id", ".", "'/clear'", ",", "null", ",", "[", "'confirm'", "=>", "(", "bool", ")", "$", "confirm", "===...
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 mixed
[ "Clear", "all", "of", "the", "items", "within", "a", "list", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Api/Lists.php#L112-L119
php-tmdb/api
lib/Tmdb/Factory/KeywordFactory.php
KeywordFactory.createCollection
public function createCollection(array $data = []) { $collection = new Keywords(); if (array_key_exists('keywords', $data)) { $data = $data['keywords']; } foreach ($data as $item) { $collection->addKeyword($this->create($item)); } return $collection; }
php
public function createCollection(array $data = []) { $collection = new Keywords(); if (array_key_exists('keywords', $data)) { $data = $data['keywords']; } foreach ($data as $item) { $collection->addKeyword($this->create($item)); } return $collection; }
[ "public", "function", "createCollection", "(", "array", "$", "data", "=", "[", "]", ")", "{", "$", "collection", "=", "new", "Keywords", "(", ")", ";", "if", "(", "array_key_exists", "(", "'keywords'", ",", "$", "data", ")", ")", "{", "$", "data", "=...
{@inheritdoc}
[ "{" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Factory/KeywordFactory.php#L37-L50
php-tmdb/api
lib/Tmdb/Api/TvSeason.php
TvSeason.getSeason
public function getSeason($tvshow_id, $season_number, array $parameters = [], array $headers = []) { return $this->get(sprintf('tv/%s/season/%s', $tvshow_id, $season_number), $parameters, $headers); }
php
public function getSeason($tvshow_id, $season_number, array $parameters = [], array $headers = []) { return $this->get(sprintf('tv/%s/season/%s', $tvshow_id, $season_number), $parameters, $headers); }
[ "public", "function", "getSeason", "(", "$", "tvshow_id", ",", "$", "season_number", ",", "array", "$", "parameters", "=", "[", "]", ",", "array", "$", "headers", "=", "[", "]", ")", "{", "return", "$", "this", "->", "get", "(", "sprintf", "(", "'tv/...
Get the primary information about a TV season by its season number. @param $tvshow_id @param $season_number @param array $parameters @param array $headers @return mixed
[ "Get", "the", "primary", "information", "about", "a", "TV", "season", "by", "its", "season", "number", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Api/TvSeason.php#L31-L34
php-tmdb/api
lib/Tmdb/Api/TvSeason.php
TvSeason.getCredits
public function getCredits($tvshow_id, $season_number, array $parameters = [], array $headers = []) { return $this->get(sprintf('tv/%s/season/%s/credits', $tvshow_id, $season_number), $parameters, $headers); }
php
public function getCredits($tvshow_id, $season_number, array $parameters = [], array $headers = []) { return $this->get(sprintf('tv/%s/season/%s/credits', $tvshow_id, $season_number), $parameters, $headers); }
[ "public", "function", "getCredits", "(", "$", "tvshow_id", ",", "$", "season_number", ",", "array", "$", "parameters", "=", "[", "]", ",", "array", "$", "headers", "=", "[", "]", ")", "{", "return", "$", "this", "->", "get", "(", "sprintf", "(", "'tv...
Get the cast & crew credits for a TV season by season number. @param $tvshow_id @param $season_number @param array $parameters @param array $headers @return mixed
[ "Get", "the", "cast", "&", "crew", "credits", "for", "a", "TV", "season", "by", "season", "number", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Api/TvSeason.php#L45-L48
php-tmdb/api
lib/Tmdb/Factory/Movie/ListItemFactory.php
ListItemFactory.create
public function create(array $data = []) { $listItem = new ListItem(); if (array_key_exists('poster_path', $data)) { $listItem->setPosterImage($this->getImageFactory()->createFromPath($data['poster_path'], 'poster_path')); } return $this->hydrate($listItem, $data); }
php
public function create(array $data = []) { $listItem = new ListItem(); if (array_key_exists('poster_path', $data)) { $listItem->setPosterImage($this->getImageFactory()->createFromPath($data['poster_path'], 'poster_path')); } return $this->hydrate($listItem, $data); }
[ "public", "function", "create", "(", "array", "$", "data", "=", "[", "]", ")", "{", "$", "listItem", "=", "new", "ListItem", "(", ")", ";", "if", "(", "array_key_exists", "(", "'poster_path'", ",", "$", "data", ")", ")", "{", "$", "listItem", "->", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Factory/Movie/ListItemFactory.php#L46-L55
php-tmdb/api
lib/Tmdb/Factory/TvSeasonFactory.php
TvSeasonFactory.create
public function create(array $data = []) { if (!$data) { return null; } $tvSeason = new Season(); if (array_key_exists('credits', $data)) { if (array_key_exists('cast', $data['credits']) && $data['credits']['cast'] !== null) { $tvSeason->getCredits()->setCast( $this->getCastFactory()->createCollection( $data['credits']['cast'], new CastMember() ) ); } if (array_key_exists('crew', $data['credits']) && $data['credits']['crew'] !== null) { $tvSeason->getCredits()->setCrew( $this->getCrewFactory()->createCollection( $data['credits']['crew'], new CrewMember() ) ); } } /** External ids */ if (array_key_exists('external_ids', $data) && $data['external_ids'] !== null) { $tvSeason->setExternalIds( $this->hydrate(new ExternalIds(), $data['external_ids']) ); } /** Images */ if (array_key_exists('images', $data) && $data['images'] !== null) { $tvSeason->setImages($this->getImageFactory()->createCollectionFromTvSeason($data['images'])); } if (array_key_exists('poster_path', $data)) { $tvSeason->setPosterImage($this->getImageFactory()->createFromPath($data['poster_path'], 'poster_path')); } /** Episodes */ if (array_key_exists('episodes', $data) && $data['episodes'] !== null) { $tvSeason->setEpisodes($this->getTvEpisodeFactory()->createCollection($data['episodes'])); } if (array_key_exists('videos', $data) && $data['videos'] !== null) { $tvSeason->setVideos($this->getVideoFactory()->createCollection($data['videos'])); } if (array_key_exists('changes', $data) && $data['changes'] !== null) { $tvSeason->setChanges($this->getChangesFactory()->createCollection($data['changes'])); } return $this->hydrate($tvSeason, $data); }
php
public function create(array $data = []) { if (!$data) { return null; } $tvSeason = new Season(); if (array_key_exists('credits', $data)) { if (array_key_exists('cast', $data['credits']) && $data['credits']['cast'] !== null) { $tvSeason->getCredits()->setCast( $this->getCastFactory()->createCollection( $data['credits']['cast'], new CastMember() ) ); } if (array_key_exists('crew', $data['credits']) && $data['credits']['crew'] !== null) { $tvSeason->getCredits()->setCrew( $this->getCrewFactory()->createCollection( $data['credits']['crew'], new CrewMember() ) ); } } /** External ids */ if (array_key_exists('external_ids', $data) && $data['external_ids'] !== null) { $tvSeason->setExternalIds( $this->hydrate(new ExternalIds(), $data['external_ids']) ); } /** Images */ if (array_key_exists('images', $data) && $data['images'] !== null) { $tvSeason->setImages($this->getImageFactory()->createCollectionFromTvSeason($data['images'])); } if (array_key_exists('poster_path', $data)) { $tvSeason->setPosterImage($this->getImageFactory()->createFromPath($data['poster_path'], 'poster_path')); } /** Episodes */ if (array_key_exists('episodes', $data) && $data['episodes'] !== null) { $tvSeason->setEpisodes($this->getTvEpisodeFactory()->createCollection($data['episodes'])); } if (array_key_exists('videos', $data) && $data['videos'] !== null) { $tvSeason->setVideos($this->getVideoFactory()->createCollection($data['videos'])); } if (array_key_exists('changes', $data) && $data['changes'] !== null) { $tvSeason->setChanges($this->getChangesFactory()->createCollection($data['changes'])); } return $this->hydrate($tvSeason, $data); }
[ "public", "function", "create", "(", "array", "$", "data", "=", "[", "]", ")", "{", "if", "(", "!", "$", "data", ")", "{", "return", "null", ";", "}", "$", "tvSeason", "=", "new", "Season", "(", ")", ";", "if", "(", "array_key_exists", "(", "'cre...
{@inheritdoc}
[ "{" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Factory/TvSeasonFactory.php#L82-L140
php-tmdb/api
lib/Tmdb/Api/Account.php
Account.favorite
public function favorite($accountId, $mediaId, $isFavorite = true, $mediaType = 'movie') { return $this->postJson('account/' . $accountId . '/favorite', [ 'media_id' => $mediaId, 'media_type' => $mediaType, 'favorite' => $isFavorite ]); }
php
public function favorite($accountId, $mediaId, $isFavorite = true, $mediaType = 'movie') { return $this->postJson('account/' . $accountId . '/favorite', [ 'media_id' => $mediaId, 'media_type' => $mediaType, 'favorite' => $isFavorite ]); }
[ "public", "function", "favorite", "(", "$", "accountId", ",", "$", "mediaId", ",", "$", "isFavorite", "=", "true", ",", "$", "mediaType", "=", "'movie'", ")", "{", "return", "$", "this", "->", "postJson", "(", "'account/'", ".", "$", "accountId", ".", ...
Add or remove a movie to an accounts favorite list. @param integer $accountId @param integer $mediaId @param boolean $isFavorite @param string $mediaType Either movie or tv @return mixed
[ "Add", "or", "remove", "a", "movie", "to", "an", "accounts", "favorite", "list", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Api/Account.php#L82-L89
php-tmdb/api
lib/Tmdb/Api/Account.php
Account.watchlist
public function watchlist($accountId, $mediaId, $isOnWatchlist = true, $mediaType = 'movie') { return $this->postJson('account/' . $accountId . '/watchlist', [ 'media_id' => $mediaId, 'media_type' => $mediaType, 'watchlist' => $isOnWatchlist ]); }
php
public function watchlist($accountId, $mediaId, $isOnWatchlist = true, $mediaType = 'movie') { return $this->postJson('account/' . $accountId . '/watchlist', [ 'media_id' => $mediaId, 'media_type' => $mediaType, 'watchlist' => $isOnWatchlist ]); }
[ "public", "function", "watchlist", "(", "$", "accountId", ",", "$", "mediaId", ",", "$", "isOnWatchlist", "=", "true", ",", "$", "mediaType", "=", "'movie'", ")", "{", "return", "$", "this", "->", "postJson", "(", "'account/'", ".", "$", "accountId", "."...
Add or remove a movie to an accounts watch list. @param integer $accountId @param integer $mediaId @param boolean $isOnWatchlist @param string $mediaType Either movie or tv @return mixed
[ "Add", "or", "remove", "a", "movie", "to", "an", "accounts", "watch", "list", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Api/Account.php#L152-L159
php-tmdb/api
lib/Tmdb/Api/Genres.php
Genres.getGenre
public function getGenre($id, array $parameters = [], array $headers = []) { $response = $this->getGenres($parameters, $headers); if (null !== $response && array_key_exists('genres', $response)) { return $this->extractGenreByIdFromResponse($id, $response['genres']); } return null; }
php
public function getGenre($id, array $parameters = [], array $headers = []) { $response = $this->getGenres($parameters, $headers); if (null !== $response && array_key_exists('genres', $response)) { return $this->extractGenreByIdFromResponse($id, $response['genres']); } return null; }
[ "public", "function", "getGenre", "(", "$", "id", ",", "array", "$", "parameters", "=", "[", "]", ",", "array", "$", "headers", "=", "[", "]", ")", "{", "$", "response", "=", "$", "this", "->", "getGenres", "(", "$", "parameters", ",", "$", "header...
Get the list of genres, and return one by id @param integer $id @param array $parameters @param array $headers @return mixed
[ "Get", "the", "list", "of", "genres", "and", "return", "one", "by", "id" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Api/Genres.php#L30-L39
php-tmdb/api
lib/Tmdb/Api/Genres.php
Genres.getGenres
public function getGenres(array $parameters = [], array $headers = []) { $data = array_merge_recursive( $this->getMovieGenres($parameters, $headers), $this->getTvGenres($parameters, $headers) ); return $data; }
php
public function getGenres(array $parameters = [], array $headers = []) { $data = array_merge_recursive( $this->getMovieGenres($parameters, $headers), $this->getTvGenres($parameters, $headers) ); return $data; }
[ "public", "function", "getGenres", "(", "array", "$", "parameters", "=", "[", "]", ",", "array", "$", "headers", "=", "[", "]", ")", "{", "$", "data", "=", "array_merge_recursive", "(", "$", "this", "->", "getMovieGenres", "(", "$", "parameters", ",", ...
Get the list of genres. @param array $parameters @param array $headers @return mixed
[ "Get", "the", "list", "of", "genres", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Api/Genres.php#L48-L56
php-tmdb/api
lib/Tmdb/Repository/CollectionRepository.php
CollectionRepository.load
public function load($id, array $parameters = [], array $headers = []) { if (empty($parameters)) { $parameters = [ new AppendToResponse([ AppendToResponse::IMAGES, ]) ]; } $data = $this->getApi()->getCollection($id, $this->parseQueryParameters($parameters), $headers); return $this->getFactory()->create($data); }
php
public function load($id, array $parameters = [], array $headers = []) { if (empty($parameters)) { $parameters = [ new AppendToResponse([ AppendToResponse::IMAGES, ]) ]; } $data = $this->getApi()->getCollection($id, $this->parseQueryParameters($parameters), $headers); return $this->getFactory()->create($data); }
[ "public", "function", "load", "(", "$", "id", ",", "array", "$", "parameters", "=", "[", "]", ",", "array", "$", "headers", "=", "[", "]", ")", "{", "if", "(", "empty", "(", "$", "parameters", ")", ")", "{", "$", "parameters", "=", "[", "new", ...
Load a collection 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 ApiCollection
[ "Load", "a", "collection", "with", "the", "given", "identifier" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Repository/CollectionRepository.php#L48-L61
php-tmdb/api
lib/Tmdb/Repository/PeopleRepository.php
PeopleRepository.load
public function load($id, array $parameters = [], array $headers = []) { if (!isset($parameters['append_to_response'])) { // Load a no-nonsense default set $parameters = array_merge($parameters, [ new AppendToResponse([ AppendToResponse::IMAGES, AppendToResponse::CHANGES, AppendToResponse::COMBINED_CREDITS, AppendToResponse::MOVIE_CREDITS, AppendToResponse::TV_CREDITS, AppendToResponse::EXTERNAL_IDS, AppendToResponse::TAGGED_IMAGES ]) ]); } $data = $this->getApi()->getPerson($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'])) { // Load a no-nonsense default set $parameters = array_merge($parameters, [ new AppendToResponse([ AppendToResponse::IMAGES, AppendToResponse::CHANGES, AppendToResponse::COMBINED_CREDITS, AppendToResponse::MOVIE_CREDITS, AppendToResponse::TV_CREDITS, AppendToResponse::EXTERNAL_IDS, AppendToResponse::TAGGED_IMAGES ]) ]); } $data = $this->getApi()->getPerson($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 person with the given identifier @param $id @param array $parameters @param array $headers @return Person
[ "Load", "a", "person", "with", "the", "given", "identifier" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Repository/PeopleRepository.php#L36-L56
php-tmdb/api
lib/Tmdb/Repository/PeopleRepository.php
PeopleRepository.getExternalIds
public function getExternalIds($id) { $data = $this->getApi()->getExternalIds($id); $person = $this->getFactory()->create(['external_ids' => $data]); return $person->getExternalIds(); }
php
public function getExternalIds($id) { $data = $this->getApi()->getExternalIds($id); $person = $this->getFactory()->create(['external_ids' => $data]); return $person->getExternalIds(); }
[ "public", "function", "getExternalIds", "(", "$", "id", ")", "{", "$", "data", "=", "$", "this", "->", "getApi", "(", ")", "->", "getExternalIds", "(", "$", "id", ")", ";", "$", "person", "=", "$", "this", "->", "getFactory", "(", ")", "->", "creat...
Get the external ids for a specific person id. @param $id @return \Tmdb\Model\Common\ExternalIds
[ "Get", "the", "external", "ids", "for", "a", "specific", "person", "id", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Repository/PeopleRepository.php#L122-L128
php-tmdb/api
lib/Tmdb/Repository/PeopleRepository.php
PeopleRepository.getImages
public function getImages($id) { $data = $this->getApi()->getImages($id); $person = $this->getFactory()->create(['images' => $data]); return $person->getImages(); }
php
public function getImages($id) { $data = $this->getApi()->getImages($id); $person = $this->getFactory()->create(['images' => $data]); return $person->getImages(); }
[ "public", "function", "getImages", "(", "$", "id", ")", "{", "$", "data", "=", "$", "this", "->", "getApi", "(", ")", "->", "getImages", "(", "$", "id", ")", ";", "$", "person", "=", "$", "this", "->", "getFactory", "(", ")", "->", "create", "(",...
Get the images for a specific person id. @param $id @return \Tmdb\Model\Collection\Images
[ "Get", "the", "images", "for", "a", "specific", "person", "id", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Repository/PeopleRepository.php#L136-L142
php-tmdb/api
lib/Tmdb/Repository/PeopleRepository.php
PeopleRepository.getTaggedImages
public function getTaggedImages($id, array $parameters = [], array $headers = []) { $data = $this->getApi()->getTaggedImages($id, $this->parseQueryParameters($parameters), $headers); $factory = new ImageFactory($this->getClient()->getHttpClient()); return $factory->createResultCollection($data, 'createMediaImage'); }
php
public function getTaggedImages($id, array $parameters = [], array $headers = []) { $data = $this->getApi()->getTaggedImages($id, $this->parseQueryParameters($parameters), $headers); $factory = new ImageFactory($this->getClient()->getHttpClient()); return $factory->createResultCollection($data, 'createMediaImage'); }
[ "public", "function", "getTaggedImages", "(", "$", "id", ",", "array", "$", "parameters", "=", "[", "]", ",", "array", "$", "headers", "=", "[", "]", ")", "{", "$", "data", "=", "$", "this", "->", "getApi", "(", ")", "->", "getTaggedImages", "(", "...
Get the changes for a specific person id. Changes are grouped by key, and ordered by date in descending order. By default, only the last 24 hours of changes are returned. The maximum number of days that can be returned in a single request is 14. The language is present on fields that are translatable. @param $id @param array $parameters @param array $headers @return \Tmdb\Model\Collection\ResultCollection
[ "Get", "the", "changes", "for", "a", "specific", "person", "id", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Repository/PeopleRepository.php#L180-L187
php-tmdb/api
lib/Tmdb/Repository/PeopleRepository.php
PeopleRepository.getPopular
public function getPopular(array $parameters = [], array $headers = []) { $data = $this->getApi()->getPopular($parameters, $headers); return $this->getFactory()->createResultCollection($data); }
php
public function getPopular(array $parameters = [], array $headers = []) { $data = $this->getApi()->getPopular($parameters, $headers); return $this->getFactory()->createResultCollection($data); }
[ "public", "function", "getPopular", "(", "array", "$", "parameters", "=", "[", "]", ",", "array", "$", "headers", "=", "[", "]", ")", "{", "$", "data", "=", "$", "this", "->", "getApi", "(", ")", "->", "getPopular", "(", "$", "parameters", ",", "$"...
Get the list of popular people on The Movie Database. This list refreshes every day. @param array $parameters @param array $headers @return \Tmdb\Model\Collection\ResultCollection
[ "Get", "the", "list", "of", "popular", "people", "on", "The", "Movie", "Database", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Repository/PeopleRepository.php#L198-L203
php-tmdb/api
lib/Tmdb/Repository/JobsRepository.php
JobsRepository.loadCollection
public function loadCollection(array $parameters = [], array $headers = []) { return $this->createCollection( $this->getApi()->getJobs($parameters, $headers) ); }
php
public function loadCollection(array $parameters = [], array $headers = []) { return $this->createCollection( $this->getApi()->getJobs($parameters, $headers) ); }
[ "public", "function", "loadCollection", "(", "array", "$", "parameters", "=", "[", "]", ",", "array", "$", "headers", "=", "[", "]", ")", "{", "return", "$", "this", "->", "createCollection", "(", "$", "this", "->", "getApi", "(", ")", "->", "getJobs",...
Get the list of jobs. @param array $parameters @param array $headers @return Jobs|Job[]
[ "Get", "the", "list", "of", "jobs", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Repository/JobsRepository.php#L43-L48
php-tmdb/api
lib/Tmdb/Repository/FindRepository.php
FindRepository.findBy
public function findBy($id, array $parameters = [], array $headers = []) { return $this->getFactory()->create( $this->getApi()->findBy($id, $parameters, $headers) ); }
php
public function findBy($id, array $parameters = [], array $headers = []) { return $this->getFactory()->create( $this->getApi()->findBy($id, $parameters, $headers) ); }
[ "public", "function", "findBy", "(", "$", "id", ",", "array", "$", "parameters", "=", "[", "]", ",", "array", "$", "headers", "=", "[", "]", ")", "{", "return", "$", "this", "->", "getFactory", "(", ")", "->", "create", "(", "$", "this", "->", "g...
Find something @param $id @param array $parameters @param array $headers @return Find
[ "Find", "something" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Repository/FindRepository.php#L33-L38
php-tmdb/api
lib/Tmdb/Api/Find.php
Find.findBy
public function findBy($id, array $parameters = [], array $headers = []) { return $this->get( sprintf('find/%s', $id), $parameters, $headers ); }
php
public function findBy($id, array $parameters = [], array $headers = []) { return $this->get( sprintf('find/%s', $id), $parameters, $headers ); }
[ "public", "function", "findBy", "(", "$", "id", ",", "array", "$", "parameters", "=", "[", "]", ",", "array", "$", "headers", "=", "[", "]", ")", "{", "return", "$", "this", "->", "get", "(", "sprintf", "(", "'find/%s'", ",", "$", "id", ")", ",",...
The find method makes it easy to search for objects in our database by an external id. For instance, an IMDB ID. This will search all objects (movies, TV shows and people) and return the results in a single response. TV season and TV episode searches will be supported shortly. The supported external sources for each object are as follows: Movies: imdb_id People: imdb_id, freebase_mid, freebase_id, tvrage_id TV Series: imdb_id, freebase_mid, freebase_id, tvdb_id, tvrage_id @param string $id @param array $parameters @param array $headers @return mixed
[ "The", "find", "method", "makes", "it", "easy", "to", "search", "for", "objects", "in", "our", "database", "by", "an", "external", "id", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Api/Find.php#L40-L47
php-tmdb/api
lib/Tmdb/Helper/ImageHelper.php
ImageHelper.getHtml
public function getHtml($image, $size = 'original', $width = null, $height = null) { if ($image instanceof Image) { if (null == $image->getFilePath()) { return ''; } $aspectRatio = $image->getAspectRatio(); if (null !== $width && null == $height && $aspectRatio !== null) { $height = round($width / $aspectRatio); } if (null !== $height && null == $width && $aspectRatio !== null) { $width = round($height * $aspectRatio); } if (null == $width) { $width = $image->getWidth(); } if (null == $height) { $height = $image->getHeight(); } } return sprintf( '<img src="%s" width="%s" height="%s" />', $this->getUrl($image, $size), $width, $height ); }
php
public function getHtml($image, $size = 'original', $width = null, $height = null) { if ($image instanceof Image) { if (null == $image->getFilePath()) { return ''; } $aspectRatio = $image->getAspectRatio(); if (null !== $width && null == $height && $aspectRatio !== null) { $height = round($width / $aspectRatio); } if (null !== $height && null == $width && $aspectRatio !== null) { $width = round($height * $aspectRatio); } if (null == $width) { $width = $image->getWidth(); } if (null == $height) { $height = $image->getHeight(); } } return sprintf( '<img src="%s" width="%s" height="%s" />', $this->getUrl($image, $size), $width, $height ); }
[ "public", "function", "getHtml", "(", "$", "image", ",", "$", "size", "=", "'original'", ",", "$", "width", "=", "null", ",", "$", "height", "=", "null", ")", "{", "if", "(", "$", "image", "instanceof", "Image", ")", "{", "if", "(", "null", "==", ...
Get an img html tag for the image in the specified size @param Image|string $image Either an instance of Image or the file_path @param string $size @param int|null $width @param int|null $height @return string
[ "Get", "an", "img", "html", "tag", "for", "the", "image", "in", "the", "specified", "size" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Helper/ImageHelper.php#L73-L105
php-tmdb/api
lib/Tmdb/Factory/TvFactory.php
TvFactory.create
public function create(array $data = []) { if (!$data) { return null; } $tvShow = new Tv(); if (array_key_exists('content_ratings', $data) && array_key_exists('results', $data['content_ratings'])) { $tvShow->setContentRatings( $this->createGenericCollection($data['content_ratings']['results'], new Tv\ContentRating()) ); } if (array_key_exists('credits', $data)) { if (array_key_exists('cast', $data['credits']) && $data['credits']['cast'] !== null) { $tvShow->getCredits()->setCast( $this->getCastFactory()->createCollection( $data['credits']['cast'], new CastMember() ) ); } if (array_key_exists('crew', $data['credits']) && $data['credits']['crew'] !== null) { $tvShow->getCredits()->setCrew( $this->getCrewFactory()->createCollection( $data['credits']['crew'], new CrewMember() ) ); } } /** External ids */ if (array_key_exists('external_ids', $data) && $data['external_ids'] !== null) { $tvShow->setExternalIds( $this->hydrate(new ExternalIds(), $data['external_ids']) ); } /** Genres */ if (array_key_exists('genres', $data) && $data['genres'] !== null) { $tvShow->setGenres($this->getGenreFactory()->createCollection($data['genres'])); } /** Genres */ if (array_key_exists('genre_ids', $data)) { $formattedData = []; foreach ($data['genre_ids'] as $genreId) { $formattedData[] = [ 'id' => $genreId ]; } $tvShow->setGenres($this->getGenreFactory()->createCollection($formattedData)); } /** Images */ if (array_key_exists('images', $data) && $data['images'] !== null) { $tvShow->setImages( $this->getImageFactory()->createCollectionFromTv($data['images']) ); } if (array_key_exists('backdrop_path', $data)) { $tvShow->setBackdropImage( $this->getImageFactory()->createFromPath($data['backdrop_path'], 'backdrop_path') ); } if (array_key_exists('poster_path', $data)) { $tvShow->setPosterImage( $this->getImageFactory()->createFromPath($data['poster_path'], 'poster_path') ); } /** Translations */ if (array_key_exists('translations', $data) && null !== $data['translations']) { if (array_key_exists('translations', $data['translations'])) { $translations = $data['translations']['translations']; } else { $translations = $data['translations']; } $tvShow->setTranslations( $this->createGenericCollection($translations, new Translation()) ); } /** Seasons */ if (array_key_exists('seasons', $data) && $data['seasons'] !== null) { $tvShow->setSeasons($this->getTvSeasonFactory()->createCollection($data['seasons'])); } /** Networks */ if (array_key_exists('networks', $data) && $data['networks'] !== null) { $tvShow->setNetworks($this->getNetworkFactory()->createCollection($data['networks'])); } if (array_key_exists('videos', $data) && $data['videos'] !== null) { $tvShow->setVideos($this->getVideoFactory()->createCollection($data['videos'])); } if (array_key_exists('keywords', $data) && array_key_exists('results', $data['keywords'])) { $tvShow->setKeywords($this->getKeywordFactory()->createCollection($data['keywords']['results'])); } if (array_key_exists('changes', $data) && $data['changes'] !== null) { $tvShow->setChanges($this->getChangesFactory()->createCollection($data['changes'])); } if (array_key_exists('similar', $data) && $data['similar'] !== null) { $tvShow->setSimilar($this->createResultCollection($data['similar'])); } if (array_key_exists('recommendations', $data) && $data['recommendations'] !== null) { $tvShow->setRecommendations($this->createResultCollection($data['recommendations'])); } if (array_key_exists('languages', $data) && $data['languages'] !== null) { $collection = new GenericCollection(); foreach ($data['languages'] as $iso6391) { $object = new SpokenLanguage(); $object->setIso6391($iso6391); $collection->add(null, $object); } $tvShow->setLanguages($collection); } if (array_key_exists('origin_country', $data) && $data['origin_country'] !== null) { $collection = new GenericCollection(); foreach ($data['origin_country'] as $iso31661) { $object = new Country(); $object->setIso31661($iso31661); $collection->add(null, $object); } $tvShow->setOriginCountry($collection); } if (array_key_exists('production_companies', $data)) { $tvShow->setProductionCompanies( $this->createGenericCollection($data['production_companies'], new Company()) ); } if (array_key_exists('created_by', $data) && $data['created_by'] !== null) { $collection = new GenericCollection(); $factory = new PeopleFactory($this->getHttpClient()); foreach ($data['created_by'] as $castMember) { $object = $factory->create($castMember, new CastMember()); $collection->add(null, $object); } $tvShow->setCreatedBy($collection); } if (array_key_exists('alternative_titles', $data) && array_key_exists('results', $data['alternative_titles'])) { $tvShow->setAlternativeTitles( $this->createGenericCollection($data['alternative_titles']['results'], new Tv\AlternativeTitle()) ); } return $this->hydrate($tvShow, $data); }
php
public function create(array $data = []) { if (!$data) { return null; } $tvShow = new Tv(); if (array_key_exists('content_ratings', $data) && array_key_exists('results', $data['content_ratings'])) { $tvShow->setContentRatings( $this->createGenericCollection($data['content_ratings']['results'], new Tv\ContentRating()) ); } if (array_key_exists('credits', $data)) { if (array_key_exists('cast', $data['credits']) && $data['credits']['cast'] !== null) { $tvShow->getCredits()->setCast( $this->getCastFactory()->createCollection( $data['credits']['cast'], new CastMember() ) ); } if (array_key_exists('crew', $data['credits']) && $data['credits']['crew'] !== null) { $tvShow->getCredits()->setCrew( $this->getCrewFactory()->createCollection( $data['credits']['crew'], new CrewMember() ) ); } } /** External ids */ if (array_key_exists('external_ids', $data) && $data['external_ids'] !== null) { $tvShow->setExternalIds( $this->hydrate(new ExternalIds(), $data['external_ids']) ); } /** Genres */ if (array_key_exists('genres', $data) && $data['genres'] !== null) { $tvShow->setGenres($this->getGenreFactory()->createCollection($data['genres'])); } /** Genres */ if (array_key_exists('genre_ids', $data)) { $formattedData = []; foreach ($data['genre_ids'] as $genreId) { $formattedData[] = [ 'id' => $genreId ]; } $tvShow->setGenres($this->getGenreFactory()->createCollection($formattedData)); } /** Images */ if (array_key_exists('images', $data) && $data['images'] !== null) { $tvShow->setImages( $this->getImageFactory()->createCollectionFromTv($data['images']) ); } if (array_key_exists('backdrop_path', $data)) { $tvShow->setBackdropImage( $this->getImageFactory()->createFromPath($data['backdrop_path'], 'backdrop_path') ); } if (array_key_exists('poster_path', $data)) { $tvShow->setPosterImage( $this->getImageFactory()->createFromPath($data['poster_path'], 'poster_path') ); } /** Translations */ if (array_key_exists('translations', $data) && null !== $data['translations']) { if (array_key_exists('translations', $data['translations'])) { $translations = $data['translations']['translations']; } else { $translations = $data['translations']; } $tvShow->setTranslations( $this->createGenericCollection($translations, new Translation()) ); } /** Seasons */ if (array_key_exists('seasons', $data) && $data['seasons'] !== null) { $tvShow->setSeasons($this->getTvSeasonFactory()->createCollection($data['seasons'])); } /** Networks */ if (array_key_exists('networks', $data) && $data['networks'] !== null) { $tvShow->setNetworks($this->getNetworkFactory()->createCollection($data['networks'])); } if (array_key_exists('videos', $data) && $data['videos'] !== null) { $tvShow->setVideos($this->getVideoFactory()->createCollection($data['videos'])); } if (array_key_exists('keywords', $data) && array_key_exists('results', $data['keywords'])) { $tvShow->setKeywords($this->getKeywordFactory()->createCollection($data['keywords']['results'])); } if (array_key_exists('changes', $data) && $data['changes'] !== null) { $tvShow->setChanges($this->getChangesFactory()->createCollection($data['changes'])); } if (array_key_exists('similar', $data) && $data['similar'] !== null) { $tvShow->setSimilar($this->createResultCollection($data['similar'])); } if (array_key_exists('recommendations', $data) && $data['recommendations'] !== null) { $tvShow->setRecommendations($this->createResultCollection($data['recommendations'])); } if (array_key_exists('languages', $data) && $data['languages'] !== null) { $collection = new GenericCollection(); foreach ($data['languages'] as $iso6391) { $object = new SpokenLanguage(); $object->setIso6391($iso6391); $collection->add(null, $object); } $tvShow->setLanguages($collection); } if (array_key_exists('origin_country', $data) && $data['origin_country'] !== null) { $collection = new GenericCollection(); foreach ($data['origin_country'] as $iso31661) { $object = new Country(); $object->setIso31661($iso31661); $collection->add(null, $object); } $tvShow->setOriginCountry($collection); } if (array_key_exists('production_companies', $data)) { $tvShow->setProductionCompanies( $this->createGenericCollection($data['production_companies'], new Company()) ); } if (array_key_exists('created_by', $data) && $data['created_by'] !== null) { $collection = new GenericCollection(); $factory = new PeopleFactory($this->getHttpClient()); foreach ($data['created_by'] as $castMember) { $object = $factory->create($castMember, new CastMember()); $collection->add(null, $object); } $tvShow->setCreatedBy($collection); } if (array_key_exists('alternative_titles', $data) && array_key_exists('results', $data['alternative_titles'])) { $tvShow->setAlternativeTitles( $this->createGenericCollection($data['alternative_titles']['results'], new Tv\AlternativeTitle()) ); } return $this->hydrate($tvShow, $data); }
[ "public", "function", "create", "(", "array", "$", "data", "=", "[", "]", ")", "{", "if", "(", "!", "$", "data", ")", "{", "return", "null", ";", "}", "$", "tvShow", "=", "new", "Tv", "(", ")", ";", "if", "(", "array_key_exists", "(", "'content_r...
@param array $data @return Tv
[ "@param", "array", "$data" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Factory/TvFactory.php#L111-L285
php-tmdb/api
lib/Tmdb/Factory/ImageFactory.php
ImageFactory.create
public function create(array $data = [], $key = null) { $type = self::resolveImageType($key); return $this->hydrate($type, $data); }
php
public function create(array $data = [], $key = null) { $type = self::resolveImageType($key); return $this->hydrate($type, $data); }
[ "public", "function", "create", "(", "array", "$", "data", "=", "[", "]", ",", "$", "key", "=", "null", ")", "{", "$", "type", "=", "self", "::", "resolveImageType", "(", "$", "key", ")", ";", "return", "$", "this", "->", "hydrate", "(", "$", "ty...
Convert an array to an hydrated object @param array $data @param string|null $key @return Image
[ "Convert", "an", "array", "to", "an", "hydrated", "object" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Factory/ImageFactory.php#L32-L37
php-tmdb/api
lib/Tmdb/Factory/ImageFactory.php
ImageFactory.createMediaImage
public function createMediaImage(array $data = []) { $type = $this->resolveImageType(array_key_exists('image_type', $data) ? $data['image_type'] : null); $image = $this->hydrate($type, $data); if (array_key_exists('media', $data) && array_key_exists('media_type', $data)) { switch ($data['media_type']) { case "movie": $factory = new MovieFactory($this->getHttpClient()); break; case "tv": $factory = new TvFactory($this->getHttpClient()); break; case "season": $factory = new TvSeasonFactory($this->getHttpClient()); break; // I don't think this ever occurs, but just in case.. case "episode": $factory = new TvEpisodeFactory($this->getHttpClient()); break; // I don't think this ever occurs, but just in case.. case "person": $factory = new PeopleFactory($this->getHttpClient()); break; default: throw new RuntimeException(sprintf( 'Unrecognized media_type "%s" for method "%s::%s".', $data['media_type'], __CLASS__, __METHOD__ )); } $media = $factory->create($data['media']); $image->setMedia($media); } return $image; }
php
public function createMediaImage(array $data = []) { $type = $this->resolveImageType(array_key_exists('image_type', $data) ? $data['image_type'] : null); $image = $this->hydrate($type, $data); if (array_key_exists('media', $data) && array_key_exists('media_type', $data)) { switch ($data['media_type']) { case "movie": $factory = new MovieFactory($this->getHttpClient()); break; case "tv": $factory = new TvFactory($this->getHttpClient()); break; case "season": $factory = new TvSeasonFactory($this->getHttpClient()); break; // I don't think this ever occurs, but just in case.. case "episode": $factory = new TvEpisodeFactory($this->getHttpClient()); break; // I don't think this ever occurs, but just in case.. case "person": $factory = new PeopleFactory($this->getHttpClient()); break; default: throw new RuntimeException(sprintf( 'Unrecognized media_type "%s" for method "%s::%s".', $data['media_type'], __CLASS__, __METHOD__ )); } $media = $factory->create($data['media']); $image->setMedia($media); } return $image; }
[ "public", "function", "createMediaImage", "(", "array", "$", "data", "=", "[", "]", ")", "{", "$", "type", "=", "$", "this", "->", "resolveImageType", "(", "array_key_exists", "(", "'image_type'", ",", "$", "data", ")", "?", "$", "data", "[", "'image_typ...
Create an Media/Image type which is used in calls like person/tagged_images, which contains an getMedia() reference either referring to movies / tv shows etc. @param array $data @return Image @throws \RuntimeException
[ "Create", "an", "Media", "/", "Image", "type", "which", "is", "used", "in", "calls", "like", "person", "/", "tagged_images", "which", "contains", "an", "getMedia", "()", "reference", "either", "referring", "to", "movies", "/", "tv", "shows", "etc", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Factory/ImageFactory.php#L65-L109
php-tmdb/api
lib/Tmdb/Factory/ImageFactory.php
ImageFactory.resolveImageType
public function resolveImageType($key = null) { switch ($key) { case 'poster': case 'posters': case 'poster_path': $object = new Image\PosterImage(); break; case 'backdrop': case 'backdrops': case 'backdrop_path': $object = new Image\BackdropImage(); break; case 'profile': case 'profiles': case 'profile_path': $object = new Image\ProfileImage(); break; case 'logo': case 'logos': case 'logo_path': $object = new Image\LogoImage(); break; case 'still': case 'stills': case 'still_path': $object = new Image\StillImage(); break; case 'file_path': default: $object = new Image(); break; } return $object; }
php
public function resolveImageType($key = null) { switch ($key) { case 'poster': case 'posters': case 'poster_path': $object = new Image\PosterImage(); break; case 'backdrop': case 'backdrops': case 'backdrop_path': $object = new Image\BackdropImage(); break; case 'profile': case 'profiles': case 'profile_path': $object = new Image\ProfileImage(); break; case 'logo': case 'logos': case 'logo_path': $object = new Image\LogoImage(); break; case 'still': case 'stills': case 'still_path': $object = new Image\StillImage(); break; case 'file_path': default: $object = new Image(); break; } return $object; }
[ "public", "function", "resolveImageType", "(", "$", "key", "=", "null", ")", "{", "switch", "(", "$", "key", ")", "{", "case", "'poster'", ":", "case", "'posters'", ":", "case", "'poster_path'", ":", "$", "object", "=", "new", "Image", "\\", "PosterImage...
Helper function to obtain a new object for an image type @param string|null $key @return Image|Image\BackdropImage|Image\LogoImage|Image\PosterImage|Image\ProfileImage|Image\StillImage
[ "Helper", "function", "to", "obtain", "a", "new", "object", "for", "an", "image", "type" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Factory/ImageFactory.php#L117-L157
php-tmdb/api
lib/Tmdb/Factory/ImageFactory.php
ImageFactory.createCollection
public function createCollection(array $data = []) { $collection = new Images(); foreach ($data as $item) { $collection->add(null, $this->create($item)); } return $collection; }
php
public function createCollection(array $data = []) { $collection = new Images(); foreach ($data as $item) { $collection->add(null, $this->create($item)); } return $collection; }
[ "public", "function", "createCollection", "(", "array", "$", "data", "=", "[", "]", ")", "{", "$", "collection", "=", "new", "Images", "(", ")", ";", "foreach", "(", "$", "data", "as", "$", "item", ")", "{", "$", "collection", "->", "add", "(", "nu...
Create generic collection @param array $data @return Images
[ "Create", "generic", "collection" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Factory/ImageFactory.php#L165-L174
php-tmdb/api
lib/Tmdb/Factory/ImageFactory.php
ImageFactory.createImageCollection
public function createImageCollection(array $data = []) { $collection = new Images(); foreach ($data as $format => $formatCollection) { if (!is_array($formatCollection)) { continue; } foreach ($formatCollection as $item) { if (array_key_exists($format, Image::$formats)) { $item = $this->create($item, $format); $collection->addImage($item); } } } return $collection; }
php
public function createImageCollection(array $data = []) { $collection = new Images(); foreach ($data as $format => $formatCollection) { if (!is_array($formatCollection)) { continue; } foreach ($formatCollection as $item) { if (array_key_exists($format, Image::$formats)) { $item = $this->create($item, $format); $collection->addImage($item); } } } return $collection; }
[ "public", "function", "createImageCollection", "(", "array", "$", "data", "=", "[", "]", ")", "{", "$", "collection", "=", "new", "Images", "(", ")", ";", "foreach", "(", "$", "data", "as", "$", "format", "=>", "$", "formatCollection", ")", "{", "if", ...
Create full collection @param array $data @return Images
[ "Create", "full", "collection" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Factory/ImageFactory.php#L182-L202
php-tmdb/api
lib/Tmdb/Model/Query/Discover/DiscoverTvQuery.php
DiscoverTvQuery.firstAirDateYear
public function firstAirDateYear($year) { if ($year instanceof \DateTime) { $year = $year->format('Y'); } $this->set('first_air_date_year', (int) $year); return $this; }
php
public function firstAirDateYear($year) { if ($year instanceof \DateTime) { $year = $year->format('Y'); } $this->set('first_air_date_year', (int) $year); return $this; }
[ "public", "function", "firstAirDateYear", "(", "$", "year", ")", "{", "if", "(", "$", "year", "instanceof", "\\", "DateTime", ")", "{", "$", "year", "=", "$", "year", "->", "format", "(", "'Y'", ")", ";", "}", "$", "this", "->", "set", "(", "'first...
Filter the results release dates to matches that include this value. Expected value is a year. @param \DateTime|integer $year @return $this
[ "Filter", "the", "results", "release", "dates", "to", "matches", "that", "include", "this", "value", ".", "Expected", "value", "is", "a", "year", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Model/Query/Discover/DiscoverTvQuery.php#L70-L79
php-tmdb/api
lib/Tmdb/Model/Query/Discover/DiscoverTvQuery.php
DiscoverTvQuery.withGenres
public function withGenres($genres) { if (is_array($genres)) { $genres = $this->withGenresAnd($genres); } $this->set('with_genres', $genres); return $this; }
php
public function withGenres($genres) { if (is_array($genres)) { $genres = $this->withGenresAnd($genres); } $this->set('with_genres', $genres); return $this; }
[ "public", "function", "withGenres", "(", "$", "genres", ")", "{", "if", "(", "is_array", "(", "$", "genres", ")", ")", "{", "$", "genres", "=", "$", "this", "->", "withGenresAnd", "(", "$", "genres", ")", ";", "}", "$", "this", "->", "set", "(", ...
Only include TV shows with the specified genres. Expected value is an integer (the id of a genre). Multiple values can be specified. Comma separated indicates an 'AND' query, while a pipe (|) separated value indicates an 'OR'. @param array|string $genres @return $this
[ "Only", "include", "TV", "shows", "with", "the", "specified", "genres", ".", "Expected", "value", "is", "an", "integer", "(", "the", "id", "of", "a", "genre", ")", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Model/Query/Discover/DiscoverTvQuery.php#L121-L130
php-tmdb/api
lib/Tmdb/Model/Query/Discover/DiscoverTvQuery.php
DiscoverTvQuery.firstAirDateGte
public function firstAirDateGte($date) { if ($date instanceof \DateTime) { $date = $date->format('Y-m-d'); } $this->set('first_air_date.gte', $date); return $this; }
php
public function firstAirDateGte($date) { if ($date instanceof \DateTime) { $date = $date->format('Y-m-d'); } $this->set('first_air_date.gte', $date); return $this; }
[ "public", "function", "firstAirDateGte", "(", "$", "date", ")", "{", "if", "(", "$", "date", "instanceof", "\\", "DateTime", ")", "{", "$", "date", "=", "$", "date", "->", "format", "(", "'Y-m-d'", ")", ";", "}", "$", "this", "->", "set", "(", "'fi...
The minimum release to include. Expected format is YYYY-MM-DD. @param \DateTime|string $date @return $this
[ "The", "minimum", "release", "to", "include", ".", "Expected", "format", "is", "YYYY", "-", "MM", "-", "DD", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Model/Query/Discover/DiscoverTvQuery.php#L164-L173
php-tmdb/api
lib/Tmdb/Model/Query/Discover/DiscoverTvQuery.php
DiscoverTvQuery.firstAirDateLte
public function firstAirDateLte($date) { if ($date instanceof \DateTime) { $date = $date->format('Y-m-d'); } $this->set('first_air_date.lte', $date); return $this; }
php
public function firstAirDateLte($date) { if ($date instanceof \DateTime) { $date = $date->format('Y-m-d'); } $this->set('first_air_date.lte', $date); return $this; }
[ "public", "function", "firstAirDateLte", "(", "$", "date", ")", "{", "if", "(", "$", "date", "instanceof", "\\", "DateTime", ")", "{", "$", "date", "=", "$", "date", "->", "format", "(", "'Y-m-d'", ")", ";", "}", "$", "this", "->", "set", "(", "'fi...
The maximum release to include. Expected format is YYYY-MM-DD. @param \DateTime|string $date @return $this
[ "The", "maximum", "release", "to", "include", ".", "Expected", "format", "is", "YYYY", "-", "MM", "-", "DD", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Model/Query/Discover/DiscoverTvQuery.php#L181-L190
php-tmdb/api
lib/Tmdb/Model/Query/Discover/DiscoverTvQuery.php
DiscoverTvQuery.withNetworks
public function withNetworks($networks) { if (is_array($networks)) { $networks = $this->withNetworksAnd($networks); } $this->set('with_networks', $networks); return $this; }
php
public function withNetworks($networks) { if (is_array($networks)) { $networks = $this->withNetworksAnd($networks); } $this->set('with_networks', $networks); return $this; }
[ "public", "function", "withNetworks", "(", "$", "networks", ")", "{", "if", "(", "is_array", "(", "$", "networks", ")", ")", "{", "$", "networks", "=", "$", "this", "->", "withNetworksAnd", "(", "$", "networks", ")", ";", "}", "$", "this", "->", "set...
Filter TV shows to include a specific network. Expected value is an integer (the id of a network). They can be comma separated to indicate an 'AND' query. Expected value is an integer (the id of a company). They can be comma separated to indicate an 'AND' query. @param array|string $networks @return $this
[ "Filter", "TV", "shows", "to", "include", "a", "specific", "network", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Model/Query/Discover/DiscoverTvQuery.php#L204-L213
php-tmdb/api
lib/Tmdb/Factory/TimezoneFactory.php
TimezoneFactory.createCollection
public function createCollection(array $data = []) { $collection = new Timezones(); foreach ($data as $foobar_data) { foreach ($foobar_data as $iso_3166_1 => $timezones) { $country = new Timezone\CountryTimezone(); $country->setIso31661($iso_3166_1); foreach ($timezones as $timezone) { $country->getTimezones()->add(null, $timezone); } $collection->add(null, $country); } } return $collection; }
php
public function createCollection(array $data = []) { $collection = new Timezones(); foreach ($data as $foobar_data) { foreach ($foobar_data as $iso_3166_1 => $timezones) { $country = new Timezone\CountryTimezone(); $country->setIso31661($iso_3166_1); foreach ($timezones as $timezone) { $country->getTimezones()->add(null, $timezone); } $collection->add(null, $country); } } return $collection; }
[ "public", "function", "createCollection", "(", "array", "$", "data", "=", "[", "]", ")", "{", "$", "collection", "=", "new", "Timezones", "(", ")", ";", "foreach", "(", "$", "data", "as", "$", "foobar_data", ")", "{", "foreach", "(", "$", "foobar_data"...
{@inheritdoc}
[ "{" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Factory/TimezoneFactory.php#L37-L55
php-tmdb/api
lib/Tmdb/Factory/CreditsFactory.php
CreditsFactory.create
public function create(array $data = []) { $credits = new Credits(); if (array_key_exists('media', $data)) { $credits->setMedia( $this->hydrate($credits->getMedia(), $data['media']) ); if (array_key_exists('seasons', $data['media'])) { $episodes = $this->getTvSeasonFactory()->createCollection($data['media']['seasons']); $credits->getMedia()->setSeasons($episodes); } if (array_key_exists('episodes', $data['media'])) { $episodes = $this->getTvEpisodeFactory()->createCollection($data['media']['episodes']); $credits->getMedia()->setEpisodes($episodes); } } if (array_key_exists('person', $data)) { $person = $this->getPeopleFactory()->create($data['person']); if ($person instanceof Person) { $credits->setPerson($person); } } return $this->hydrate($credits, $data); }
php
public function create(array $data = []) { $credits = new Credits(); if (array_key_exists('media', $data)) { $credits->setMedia( $this->hydrate($credits->getMedia(), $data['media']) ); if (array_key_exists('seasons', $data['media'])) { $episodes = $this->getTvSeasonFactory()->createCollection($data['media']['seasons']); $credits->getMedia()->setSeasons($episodes); } if (array_key_exists('episodes', $data['media'])) { $episodes = $this->getTvEpisodeFactory()->createCollection($data['media']['episodes']); $credits->getMedia()->setEpisodes($episodes); } } if (array_key_exists('person', $data)) { $person = $this->getPeopleFactory()->create($data['person']); if ($person instanceof Person) { $credits->setPerson($person); } } return $this->hydrate($credits, $data); }
[ "public", "function", "create", "(", "array", "$", "data", "=", "[", "]", ")", "{", "$", "credits", "=", "new", "Credits", "(", ")", ";", "if", "(", "array_key_exists", "(", "'media'", ",", "$", "data", ")", ")", "{", "$", "credits", "->", "setMedi...
@param array $data @return Genre
[ "@param", "array", "$data" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Factory/CreditsFactory.php#L61-L91
php-tmdb/api
lib/Tmdb/Model/Query/Discover/DiscoverMoviesQuery.php
DiscoverMoviesQuery.withCast
public function withCast($cast, $mode = self::MODE_OR) { $this->set('with_cast', $this->with($cast, $mode)); return $this; }
php
public function withCast($cast, $mode = self::MODE_OR) { $this->set('with_cast', $this->with($cast, $mode)); return $this; }
[ "public", "function", "withCast", "(", "$", "cast", ",", "$", "mode", "=", "self", "::", "MODE_OR", ")", "{", "$", "this", "->", "set", "(", "'with_cast'", ",", "$", "this", "->", "with", "(", "$", "cast", ",", "$", "mode", ")", ")", ";", "return...
Only include movies that have this person id added as a cast member. Expected value is an integer (the id of a person). Comma separated indicates an 'AND' query, while a pipe (|) separated value indicates an 'OR'. @param array|string $cast @param int $mode @return $this
[ "Only", "include", "movies", "that", "have", "this", "person", "id", "added", "as", "a", "cast", "member", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Model/Query/Discover/DiscoverMoviesQuery.php#L323-L328
php-tmdb/api
lib/Tmdb/Model/Query/Discover/DiscoverMoviesQuery.php
DiscoverMoviesQuery.withCrew
public function withCrew($crew, $mode = self::MODE_OR) { $this->set('with_crew', $this->with($crew, $mode)); return $this; }
php
public function withCrew($crew, $mode = self::MODE_OR) { $this->set('with_crew', $this->with($crew, $mode)); return $this; }
[ "public", "function", "withCrew", "(", "$", "crew", ",", "$", "mode", "=", "self", "::", "MODE_OR", ")", "{", "$", "this", "->", "set", "(", "'with_crew'", ",", "$", "this", "->", "with", "(", "$", "crew", ",", "$", "mode", ")", ")", ";", "return...
Only include movies that have this person id added as a crew member. Expected value is an integer (the id of a person). Comma separated indicates an 'AND' query, while a pipe (|) separated value indicates an 'OR'. @param array|string $crew @param int $mode @return $this
[ "Only", "include", "movies", "that", "have", "this", "person", "id", "added", "as", "a", "crew", "member", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Model/Query/Discover/DiscoverMoviesQuery.php#L340-L345
php-tmdb/api
lib/Tmdb/Model/Query/Discover/DiscoverMoviesQuery.php
DiscoverMoviesQuery.withCompanies
public function withCompanies($companies, $mode = self::MODE_OR) { $this->set('with_companies', $this->with($companies, $mode)); return $this; }
php
public function withCompanies($companies, $mode = self::MODE_OR) { $this->set('with_companies', $this->with($companies, $mode)); return $this; }
[ "public", "function", "withCompanies", "(", "$", "companies", ",", "$", "mode", "=", "self", "::", "MODE_OR", ")", "{", "$", "this", "->", "set", "(", "'with_companies'", ",", "$", "this", "->", "with", "(", "$", "companies", ",", "$", "mode", ")", "...
Filter movies to include a specific company. Expected value is an integer (the id of a company). Comma separated indicates an 'AND' query, while a pipe (|) separated value indicates an 'OR'. @param array|string $companies @param int $mode @return $this
[ "Filter", "movies", "to", "include", "a", "specific", "company", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Model/Query/Discover/DiscoverMoviesQuery.php#L357-L362
php-tmdb/api
lib/Tmdb/Model/Query/Discover/DiscoverMoviesQuery.php
DiscoverMoviesQuery.withGenres
public function withGenres($genres, $mode = self::MODE_OR) { $this->set('with_genres', $this->with($genres, $mode)); return $this; }
php
public function withGenres($genres, $mode = self::MODE_OR) { $this->set('with_genres', $this->with($genres, $mode)); return $this; }
[ "public", "function", "withGenres", "(", "$", "genres", ",", "$", "mode", "=", "self", "::", "MODE_OR", ")", "{", "$", "this", "->", "set", "(", "'with_genres'", ",", "$", "this", "->", "with", "(", "$", "genres", ",", "$", "mode", ")", ")", ";", ...
Only include movies with the specified genres. Expected value is an integer (the id of a genre). Multiple values can be specified. Comma separated indicates an 'AND' query, while a pipe (|) separated value indicates an 'OR'. If an array is supplied this defaults to an AND query @param array|string $genres @param int $mode @return $this
[ "Only", "include", "movies", "with", "the", "specified", "genres", ".", "Expected", "value", "is", "an", "integer", "(", "the", "id", "of", "a", "genre", ")", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Model/Query/Discover/DiscoverMoviesQuery.php#L378-L383
php-tmdb/api
lib/Tmdb/Model/Query/Discover/DiscoverMoviesQuery.php
DiscoverMoviesQuery.withKeywords
public function withKeywords($keywords, $mode = self::MODE_OR) { $this->set('with_keywords', $this->with($keywords, $mode)); return $this; }
php
public function withKeywords($keywords, $mode = self::MODE_OR) { $this->set('with_keywords', $this->with($keywords, $mode)); return $this; }
[ "public", "function", "withKeywords", "(", "$", "keywords", ",", "$", "mode", "=", "self", "::", "MODE_OR", ")", "{", "$", "this", "->", "set", "(", "'with_keywords'", ",", "$", "this", "->", "with", "(", "$", "keywords", ",", "$", "mode", ")", ")", ...
Only include movies with the specified keywords. Expected value is an integer (the id of a keyword). Multiple values can be specified. Comma separated indicates an 'AND' query, while a pipe (|) separated value indicates an 'OR'. If an array is supplied this defaults to an AND query @param array|string $keywords @param int $mode @return $this
[ "Only", "include", "movies", "with", "the", "specified", "keywords", ".", "Expected", "value", "is", "an", "integer", "(", "the", "id", "of", "a", "keyword", ")", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Model/Query/Discover/DiscoverMoviesQuery.php#L399-L404
php-tmdb/api
lib/Tmdb/Model/Query/Discover/DiscoverMoviesQuery.php
DiscoverMoviesQuery.withPeople
public function withPeople($people, $mode = self::MODE_OR) { $this->set('with_people', $this->with($people, $mode)); return $this; }
php
public function withPeople($people, $mode = self::MODE_OR) { $this->set('with_people', $this->with($people, $mode)); return $this; }
[ "public", "function", "withPeople", "(", "$", "people", ",", "$", "mode", "=", "self", "::", "MODE_OR", ")", "{", "$", "this", "->", "set", "(", "'with_people'", ",", "$", "this", "->", "with", "(", "$", "people", ",", "$", "mode", ")", ")", ";", ...
Only include movies that have these person id's added as a cast or crew member. Expected value is an integer (the id or ids of a person). Comma separated indicates an 'AND' query, while a pipe (|) separated value indicates an 'OR'. @param array|string $people @param int $mode @return $this
[ "Only", "include", "movies", "that", "have", "these", "person", "id", "s", "added", "as", "a", "cast", "or", "crew", "member", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Model/Query/Discover/DiscoverMoviesQuery.php#L416-L421
php-tmdb/api
lib/Tmdb/Model/Query/Discover/DiscoverMoviesQuery.php
DiscoverMoviesQuery.with
protected function with($with = null, $mode = self::MODE_OR) { if ($with instanceof GenericCollection) { $with = $with->toArray(); } if (is_array($with)) { return $this->andWith((array) $with, $mode); } return $with; }
php
protected function with($with = null, $mode = self::MODE_OR) { if ($with instanceof GenericCollection) { $with = $with->toArray(); } if (is_array($with)) { return $this->andWith((array) $with, $mode); } return $with; }
[ "protected", "function", "with", "(", "$", "with", "=", "null", ",", "$", "mode", "=", "self", "::", "MODE_OR", ")", "{", "if", "(", "$", "with", "instanceof", "GenericCollection", ")", "{", "$", "with", "=", "$", "with", "->", "toArray", "(", ")", ...
Format the with compatible parameters. @param array|string $with @param int $mode @return string
[ "Format", "the", "with", "compatible", "parameters", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Model/Query/Discover/DiscoverMoviesQuery.php#L444-L455
php-tmdb/api
lib/Tmdb/Model/Query/Discover/DiscoverMoviesQuery.php
DiscoverMoviesQuery.andWith
protected function andWith(array $with, $mode) { return ( implode( $mode === self::MODE_OR ? '|' : ',', array_map([$this, 'normalize'], $with) ) ); }
php
protected function andWith(array $with, $mode) { return ( implode( $mode === self::MODE_OR ? '|' : ',', array_map([$this, 'normalize'], $with) ) ); }
[ "protected", "function", "andWith", "(", "array", "$", "with", ",", "$", "mode", ")", "{", "return", "(", "implode", "(", "$", "mode", "===", "self", "::", "MODE_OR", "?", "'|'", ":", "','", ",", "array_map", "(", "[", "$", "this", ",", "'normalize'"...
Creates an and query to combine an AND or an OR expression. @param array $with @param int $mode @return string
[ "Creates", "an", "and", "query", "to", "combine", "an", "AND", "or", "an", "OR", "expression", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Model/Query/Discover/DiscoverMoviesQuery.php#L464-L472
php-tmdb/api
lib/Tmdb/Repository/AccountRepository.php
AccountRepository.getLists
public function getLists($accountId, array $parameters = [], array $headers = []) { $data = $this->getApi()->getLists($accountId, $parameters, $headers); return $this->getFactory()->createResultCollection($data, 'createListItem'); }
php
public function getLists($accountId, array $parameters = [], array $headers = []) { $data = $this->getApi()->getLists($accountId, $parameters, $headers); return $this->getFactory()->createResultCollection($data, 'createListItem'); }
[ "public", "function", "getLists", "(", "$", "accountId", ",", "array", "$", "parameters", "=", "[", "]", ",", "array", "$", "headers", "=", "[", "]", ")", "{", "$", "data", "=", "$", "this", "->", "getApi", "(", ")", "->", "getLists", "(", "$", "...
Get the lists that you have created and marked as a favorite. @param string $accountId @param array $parameters @param array $headers @return ResultCollection
[ "Get", "the", "lists", "that", "you", "have", "created", "and", "marked", "as", "a", "favorite", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Repository/AccountRepository.php#L48-L53
php-tmdb/api
lib/Tmdb/Repository/AccountRepository.php
AccountRepository.favorite
public function favorite($accountId, $media, $isFavorite = true, $mediaType = 'movie') { if ($media instanceof Tv) { $mediaType = 'tv'; } if ($media instanceof Movie || $media instanceof Tv) { $media = $media->getId(); } $data = $this->getApi()->favorite($accountId, $media, $isFavorite, $mediaType); return $this->getFactory()->createStatusResult($data); }
php
public function favorite($accountId, $media, $isFavorite = true, $mediaType = 'movie') { if ($media instanceof Tv) { $mediaType = 'tv'; } if ($media instanceof Movie || $media instanceof Tv) { $media = $media->getId(); } $data = $this->getApi()->favorite($accountId, $media, $isFavorite, $mediaType); return $this->getFactory()->createStatusResult($data); }
[ "public", "function", "favorite", "(", "$", "accountId", ",", "$", "media", ",", "$", "isFavorite", "=", "true", ",", "$", "mediaType", "=", "'movie'", ")", "{", "if", "(", "$", "media", "instanceof", "Tv", ")", "{", "$", "mediaType", "=", "'tv'", ";...
Add or remove a movie to an accounts favorite list. @param string $accountId @param int|Movie|Tv $media @param boolean $isFavorite @param string $mediaType @return \Tmdb\Model\Lists\Result
[ "Add", "or", "remove", "a", "movie", "to", "an", "accounts", "favorite", "list", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Repository/AccountRepository.php#L94-L107
php-tmdb/api
lib/Tmdb/Repository/AccountRepository.php
AccountRepository.watchlist
public function watchlist($accountId, $media, $isOnWatchlist = true, $mediaType = 'movie') { if ($media instanceof Tv) { $mediaType = 'tv'; } if ($media instanceof Movie || $media instanceof Tv) { $media = $media->getId(); } $data = $this->getApi()->watchlist($accountId, $media, $isOnWatchlist, $mediaType); return $this->getFactory()->createStatusResult($data); }
php
public function watchlist($accountId, $media, $isOnWatchlist = true, $mediaType = 'movie') { if ($media instanceof Tv) { $mediaType = 'tv'; } if ($media instanceof Movie || $media instanceof Tv) { $media = $media->getId(); } $data = $this->getApi()->watchlist($accountId, $media, $isOnWatchlist, $mediaType); return $this->getFactory()->createStatusResult($data); }
[ "public", "function", "watchlist", "(", "$", "accountId", ",", "$", "media", ",", "$", "isOnWatchlist", "=", "true", ",", "$", "mediaType", "=", "'movie'", ")", "{", "if", "(", "$", "media", "instanceof", "Tv", ")", "{", "$", "mediaType", "=", "'tv'", ...
Add or remove a movie to an accounts watch list. @param string $accountId @param integer $media @param bool $isOnWatchlist @param string $mediaType @return \Tmdb\Model\Lists\Result
[ "Add", "or", "remove", "a", "movie", "to", "an", "accounts", "watch", "list", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Repository/AccountRepository.php#L178-L191
php-tmdb/api
lib/Tmdb/Factory/ChangesFactory.php
ChangesFactory.createCollection
public function createCollection(array $data = []) { $collection = new Changes(); 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->create($item)); } return $collection; }
php
public function createCollection(array $data = []) { $collection = new Changes(); 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->create($item)); } return $collection; }
[ "public", "function", "createCollection", "(", "array", "$", "data", "=", "[", "]", ")", "{", "$", "collection", "=", "new", "Changes", "(", ")", ";", "if", "(", "array_key_exists", "(", "'page'", ",", "$", "data", ")", ")", "{", "$", "collection", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Factory/ChangesFactory.php#L36-L61
php-tmdb/api
lib/Tmdb/Repository/AuthenticationRepository.php
AuthenticationRepository.getSessionToken
public function getSessionToken(RequestToken $requestToken) { $data = $this->getApi()->getNewSession($requestToken->getToken()); return $this->getFactory()->createSessionToken($data); }
php
public function getSessionToken(RequestToken $requestToken) { $data = $this->getApi()->getNewSession($requestToken->getToken()); return $this->getFactory()->createSessionToken($data); }
[ "public", "function", "getSessionToken", "(", "RequestToken", "$", "requestToken", ")", "{", "$", "data", "=", "$", "this", "->", "getApi", "(", ")", "->", "getNewSession", "(", "$", "requestToken", "->", "getToken", "(", ")", ")", ";", "return", "$", "t...
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 RequestToken $requestToken @return \Tmdb\SessionToken
[ "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/Repository/AuthenticationRepository.php#L49-L54
php-tmdb/api
lib/Tmdb/Repository/AuthenticationRepository.php
AuthenticationRepository.validateRequestTokenWithLogin
public function validateRequestTokenWithLogin(RequestToken $requestToken, $username, $password) { $data = $this->getApi()->validateRequestTokenWithLogin( $requestToken, $username, $password ); return $this->getFactory()->createRequestToken($data); }
php
public function validateRequestTokenWithLogin(RequestToken $requestToken, $username, $password) { $data = $this->getApi()->validateRequestTokenWithLogin( $requestToken, $username, $password ); return $this->getFactory()->createRequestToken($data); }
[ "public", "function", "validateRequestTokenWithLogin", "(", "RequestToken", "$", "requestToken", ",", "$", "username", ",", "$", "password", ")", "{", "$", "data", "=", "$", "this", "->", "getApi", "(", ")", "->", "validateRequestTokenWithLogin", "(", "$", "re...
This method is used to validate a request_token for user based authentication. A request_token is required in order to use any of the write methods. @param RequestToken $requestToken @param string $username @param string $password @throws UnauthorizedRequestTokenException @return RequestToken
[ "This", "method", "is", "used", "to", "validate", "a", "request_token", "for", "user", "based", "authentication", ".", "A", "request_token", "is", "required", "in", "order", "to", "use", "any", "of", "the", "write", "methods", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Repository/AuthenticationRepository.php#L66-L75
php-tmdb/api
lib/Tmdb/Repository/AuthenticationRepository.php
AuthenticationRepository.getSessionTokenWithLogin
public function getSessionTokenWithLogin(RequestToken $requestToken, $username, $password) { $data = $this->getApi()->getSessionTokenWithLogin( $requestToken, $username, $password ); return $this->getFactory()->createSessionToken($data); }
php
public function getSessionTokenWithLogin(RequestToken $requestToken, $username, $password) { $data = $this->getApi()->getSessionTokenWithLogin( $requestToken, $username, $password ); return $this->getFactory()->createSessionToken($data); }
[ "public", "function", "getSessionTokenWithLogin", "(", "RequestToken", "$", "requestToken", ",", "$", "username", ",", "$", "password", ")", "{", "$", "data", "=", "$", "this", "->", "getApi", "(", ")", "->", "getSessionTokenWithLogin", "(", "$", "requestToken...
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 RequestToken $requestToken @param string $username @param string $password @throws UnauthorizedRequestTokenException @return \Tmdb\SessionToken
[ "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/Repository/AuthenticationRepository.php#L87-L96
php-tmdb/api
lib/Tmdb/Repository/ConfigurationRepository.php
ConfigurationRepository.load
public function load(array $headers = []) { $data = $this->getApi()->getConfiguration($headers); return $this->getFactory()->create($data); }
php
public function load(array $headers = []) { $data = $this->getApi()->getConfiguration($headers); return $this->getFactory()->create($data); }
[ "public", "function", "load", "(", "array", "$", "headers", "=", "[", "]", ")", "{", "$", "data", "=", "$", "this", "->", "getApi", "(", ")", "->", "getConfiguration", "(", "$", "headers", ")", ";", "return", "$", "this", "->", "getFactory", "(", "...
Load up TMDB Configuration @param array $headers @return Configuration
[ "Load", "up", "TMDB", "Configuration" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Repository/ConfigurationRepository.php#L31-L36
php-tmdb/api
lib/Tmdb/Factory/AccountFactory.php
AccountFactory.create
public function create(array $data = []) { $account = new Account(); if (array_key_exists('avatar', $data)) { $account->setAvatar( $this->getAvatarFactory()->createCollection($data['avatar']) ); } return $this->hydrate($account, $data); }
php
public function create(array $data = []) { $account = new Account(); if (array_key_exists('avatar', $data)) { $account->setAvatar( $this->getAvatarFactory()->createCollection($data['avatar']) ); } return $this->hydrate($account, $data); }
[ "public", "function", "create", "(", "array", "$", "data", "=", "[", "]", ")", "{", "$", "account", "=", "new", "Account", "(", ")", ";", "if", "(", "array_key_exists", "(", "'avatar'", ",", "$", "data", ")", ")", "{", "$", "account", "->", "setAva...
@param array $data @return Account
[ "@param", "array", "$data" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Factory/AccountFactory.php#L61-L72
php-tmdb/api
lib/Tmdb/Factory/AccountFactory.php
AccountFactory.createListItem
public function createListItem(array $data = []) { $listItem = new Account\ListItem(); if (array_key_exists('poster_path', $data)) { $listItem->setPosterImage($this->getImageFactory()->createFromPath($data['poster_path'], 'poster_path')); } return $this->hydrate($listItem, $data); }
php
public function createListItem(array $data = []) { $listItem = new Account\ListItem(); if (array_key_exists('poster_path', $data)) { $listItem->setPosterImage($this->getImageFactory()->createFromPath($data['poster_path'], 'poster_path')); } return $this->hydrate($listItem, $data); }
[ "public", "function", "createListItem", "(", "array", "$", "data", "=", "[", "]", ")", "{", "$", "listItem", "=", "new", "Account", "\\", "ListItem", "(", ")", ";", "if", "(", "array_key_exists", "(", "'poster_path'", ",", "$", "data", ")", ")", "{", ...
Create list item @param array $data @return \Tmdb\Model\AbstractModel
[ "Create", "list", "item" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Factory/AccountFactory.php#L112-L121
php-tmdb/api
lib/Tmdb/Event/HydrationSubscriber.php
HydrationSubscriber.hydrate
public function hydrate(HydrationEvent $event, $eventName, $eventDispatcher) { // Possibility to load serialized cache $eventDispatcher->dispatch(TmdbEvents::BEFORE_HYDRATION, $event); if ($event->isPropagationStopped()) { return $event->getSubject(); } $subject = $this->hydrateSubject($event); $event->setSubject($subject); // Possibility to cache the data $eventDispatcher->dispatch(TmdbEvents::AFTER_HYDRATION, $event); return $event->getSubject(); }
php
public function hydrate(HydrationEvent $event, $eventName, $eventDispatcher) { // Possibility to load serialized cache $eventDispatcher->dispatch(TmdbEvents::BEFORE_HYDRATION, $event); if ($event->isPropagationStopped()) { return $event->getSubject(); } $subject = $this->hydrateSubject($event); $event->setSubject($subject); // Possibility to cache the data $eventDispatcher->dispatch(TmdbEvents::AFTER_HYDRATION, $event); return $event->getSubject(); }
[ "public", "function", "hydrate", "(", "HydrationEvent", "$", "event", ",", "$", "eventName", ",", "$", "eventDispatcher", ")", "{", "// Possibility to load serialized cache", "$", "eventDispatcher", "->", "dispatch", "(", "TmdbEvents", "::", "BEFORE_HYDRATION", ",", ...
Hydrate the subject with data @param HydrationEvent $event @param string $eventName @param EventDispatcherInterface $eventDispatcher @return \Tmdb\Model\AbstractModel
[ "Hydrate", "the", "subject", "with", "data" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Event/HydrationSubscriber.php#L46-L62
php-tmdb/api
lib/Tmdb/Event/HydrationSubscriber.php
HydrationSubscriber.hydrateSubject
public function hydrateSubject(HydrationEvent $event) { $objectHydrator = new ObjectHydrator(); return $objectHydrator->hydrate($event->getSubject(), $event->getData()); }
php
public function hydrateSubject(HydrationEvent $event) { $objectHydrator = new ObjectHydrator(); return $objectHydrator->hydrate($event->getSubject(), $event->getData()); }
[ "public", "function", "hydrateSubject", "(", "HydrationEvent", "$", "event", ")", "{", "$", "objectHydrator", "=", "new", "ObjectHydrator", "(", ")", ";", "return", "$", "objectHydrator", "->", "hydrate", "(", "$", "event", "->", "getSubject", "(", ")", ",",...
Hydrate the subject @param HydrationEvent $event @return \Tmdb\Model\AbstractModel
[ "Hydrate", "the", "subject" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Event/HydrationSubscriber.php#L70-L75
php-tmdb/api
lib/Tmdb/Common/ParameterBag.php
ParameterBag.getDigits
public function getDigits($key, $default = '', $deep = false) { // we need to remove - and + because they're allowed in the filter return str_replace(array('-', '+'), '', $this->filter($key, $default, $deep, FILTER_SANITIZE_NUMBER_INT)); }
php
public function getDigits($key, $default = '', $deep = false) { // we need to remove - and + because they're allowed in the filter return str_replace(array('-', '+'), '', $this->filter($key, $default, $deep, FILTER_SANITIZE_NUMBER_INT)); }
[ "public", "function", "getDigits", "(", "$", "key", ",", "$", "default", "=", "''", ",", "$", "deep", "=", "false", ")", "{", "// we need to remove - and + because they're allowed in the filter", "return", "str_replace", "(", "array", "(", "'-'", ",", "'+'", ")"...
Returns the digits of the parameter value. @param string $key The parameter key @param mixed $default The default value if the parameter key does not exist @param bool $deep If true, a path like foo[bar] will find deeper items @return string The filtered value @api
[ "Returns", "the", "digits", "of", "the", "parameter", "value", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Common/ParameterBag.php#L210-L214
php-tmdb/api
lib/Tmdb/Common/ParameterBag.php
ParameterBag.getBoolean
public function getBoolean($key, $default = false, $deep = false) { return $this->filter($key, $default, $deep, FILTER_VALIDATE_BOOLEAN); }
php
public function getBoolean($key, $default = false, $deep = false) { return $this->filter($key, $default, $deep, FILTER_VALIDATE_BOOLEAN); }
[ "public", "function", "getBoolean", "(", "$", "key", ",", "$", "default", "=", "false", ",", "$", "deep", "=", "false", ")", "{", "return", "$", "this", "->", "filter", "(", "$", "key", ",", "$", "default", ",", "$", "deep", ",", "FILTER_VALIDATE_BOO...
Returns the parameter value converted to boolean. @param string $key The parameter key @param mixed $default The default value if the parameter key does not exist @param bool $deep If true, a path like foo[bar] will find deeper items @return bool The filtered value
[ "Returns", "the", "parameter", "value", "converted", "to", "boolean", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Common/ParameterBag.php#L239-L242
php-tmdb/api
lib/Tmdb/Common/ParameterBag.php
ParameterBag.filter
public function filter($key, $default = null, $deep = false, $filter = FILTER_DEFAULT, $options = array()) { $value = $this->get($key, $default, $deep); // Always turn $options into an array - this allows filter_var option shortcuts. if (!is_array($options) && $options) { $options = array('flags' => $options); } // Add a convenience check for arrays. if (is_array($value) && !isset($options['flags'])) { $options['flags'] = FILTER_REQUIRE_ARRAY; } return filter_var($value, $filter, $options); }
php
public function filter($key, $default = null, $deep = false, $filter = FILTER_DEFAULT, $options = array()) { $value = $this->get($key, $default, $deep); // Always turn $options into an array - this allows filter_var option shortcuts. if (!is_array($options) && $options) { $options = array('flags' => $options); } // Add a convenience check for arrays. if (is_array($value) && !isset($options['flags'])) { $options['flags'] = FILTER_REQUIRE_ARRAY; } return filter_var($value, $filter, $options); }
[ "public", "function", "filter", "(", "$", "key", ",", "$", "default", "=", "null", ",", "$", "deep", "=", "false", ",", "$", "filter", "=", "FILTER_DEFAULT", ",", "$", "options", "=", "array", "(", ")", ")", "{", "$", "value", "=", "$", "this", "...
Filter key. @param string $key Key. @param mixed $default Default = null. @param bool $deep Default = false. @param int $filter FILTER_* constant. @param mixed $options Filter options. @see http://php.net/manual/en/function.filter-var.php @return mixed
[ "Filter", "key", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Common/ParameterBag.php#L256-L269
php-tmdb/api
lib/Tmdb/Repository/TvEpisodeRepository.php
TvEpisodeRepository.load
public function load($tvShow, $season, $episode, array $parameters = [], array $headers = []) { if ($tvShow instanceof Tv) { $tvShow = $tvShow->getId(); } if ($season instanceof Season) { $season = $season->getSeasonNumber(); } if ($episode instanceof Tv\Episode) { $episode = $episode->getEpisodeNumber(); } if (is_null($tvShow) || is_null($season) || is_null($episode) ) { throw new RuntimeException('Not all required parameters to load an tv episode 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()->getEpisode( $tvShow, $season, $episode, $this->parseQueryParameters($parameters), $headers ); return $this->getFactory()->create($data); }
php
public function load($tvShow, $season, $episode, array $parameters = [], array $headers = []) { if ($tvShow instanceof Tv) { $tvShow = $tvShow->getId(); } if ($season instanceof Season) { $season = $season->getSeasonNumber(); } if ($episode instanceof Tv\Episode) { $episode = $episode->getEpisodeNumber(); } if (is_null($tvShow) || is_null($season) || is_null($episode) ) { throw new RuntimeException('Not all required parameters to load an tv episode 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()->getEpisode( $tvShow, $season, $episode, $this->parseQueryParameters($parameters), $headers ); return $this->getFactory()->create($data); }
[ "public", "function", "load", "(", "$", "tvShow", ",", "$", "season", ",", "$", "episode", ",", "array", "$", "parameters", "=", "[", "]", ",", "array", "$", "headers", "=", "[", "]", ")", "{", "if", "(", "$", "tvShow", "instanceof", "Tv", ")", "...
Load a tv season with the given identifier If you want to optimize the result set/bandwidth you should define the AppendToResponse parameter @param $tvShow Tv|integer @param $season Season|integer @param $episode Episode|integer @param $parameters @param $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/TvEpisodeRepository.php#L47-L86
php-tmdb/api
lib/Tmdb/Repository/TvEpisodeRepository.php
TvEpisodeRepository.getAccountStates
public function getAccountStates($tvShow, $season, $episode) { if ($tvShow instanceof Tv) { $tvShow = $tvShow->getId(); } if ($season instanceof Season) { $season = $season->getSeasonNumber(); } if ($episode instanceof Tv\Episode) { $episode = $episode->getEpisodeNumber(); } return $this->getFactory()->createAccountStates( $this->getApi()->getAccountStates($tvShow, $season, $episode) ); }
php
public function getAccountStates($tvShow, $season, $episode) { if ($tvShow instanceof Tv) { $tvShow = $tvShow->getId(); } if ($season instanceof Season) { $season = $season->getSeasonNumber(); } if ($episode instanceof Tv\Episode) { $episode = $episode->getEpisodeNumber(); } return $this->getFactory()->createAccountStates( $this->getApi()->getAccountStates($tvShow, $season, $episode) ); }
[ "public", "function", "getAccountStates", "(", "$", "tvShow", ",", "$", "season", ",", "$", "episode", ")", "{", "if", "(", "$", "tvShow", "instanceof", "Tv", ")", "{", "$", "tvShow", "=", "$", "tvShow", "->", "getId", "(", ")", ";", "}", "if", "("...
This method lets users get the status of whether or not the TV show has been rated or added to their favourite or watch lists. A valid session id is required. @param mixed $tvShow @param mixed $season @param mixed $episode @return AccountStates
[ "This", "method", "lets", "users", "get", "the", "status", "of", "whether", "or", "not", "the", "TV", "show", "has", "been", "rated", "or", "added", "to", "their", "favourite", "or", "watch", "lists", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Repository/TvEpisodeRepository.php#L249-L266
php-tmdb/api
lib/Tmdb/Repository/TvEpisodeRepository.php
TvEpisodeRepository.rate
public function rate($tvShow, $season, $episode, $rating) { if ($tvShow instanceof Tv) { $tvShow = $tvShow->getId(); } if ($season instanceof Season) { $season = $season->getSeasonNumber(); } if ($episode instanceof Tv\Episode) { $episode = $episode->getEpisodeNumber(); } return $this->getFactory()->createResult( $this->getApi()->rateTvEpisode($tvShow, $season, $episode, $rating) ); }
php
public function rate($tvShow, $season, $episode, $rating) { if ($tvShow instanceof Tv) { $tvShow = $tvShow->getId(); } if ($season instanceof Season) { $season = $season->getSeasonNumber(); } if ($episode instanceof Tv\Episode) { $episode = $episode->getEpisodeNumber(); } return $this->getFactory()->createResult( $this->getApi()->rateTvEpisode($tvShow, $season, $episode, $rating) ); }
[ "public", "function", "rate", "(", "$", "tvShow", ",", "$", "season", ",", "$", "episode", ",", "$", "rating", ")", "{", "if", "(", "$", "tvShow", "instanceof", "Tv", ")", "{", "$", "tvShow", "=", "$", "tvShow", "->", "getId", "(", ")", ";", "}",...
This method lets users rate a TV show. A valid session id or guest session id is required. @param mixed $tvShow @param mixed $season @param mixed $episode @param double $rating @return Result
[ "This", "method", "lets", "users", "rate", "a", "TV", "show", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Repository/TvEpisodeRepository.php#L279-L296
php-tmdb/api
lib/Tmdb/Model/Collection/Timezones.php
Timezones.getCountry
public function getCountry($id) { foreach ($this->data as $country) { if (strtoupper($id) == (string) $country) { return $country; } } return null; }
php
public function getCountry($id) { foreach ($this->data as $country) { if (strtoupper($id) == (string) $country) { return $country; } } return null; }
[ "public", "function", "getCountry", "(", "$", "id", ")", "{", "foreach", "(", "$", "this", "->", "data", "as", "$", "country", ")", "{", "if", "(", "strtoupper", "(", "$", "id", ")", "==", "(", "string", ")", "$", "country", ")", "{", "return", "...
Retrieve a country from the collection @param $id @return CountryTimezone|null
[ "Retrieve", "a", "country", "from", "the", "collection" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Model/Collection/Timezones.php#L40-L49
php-tmdb/api
lib/Tmdb/Model/Collection/Jobs.php
Jobs.filterByDepartment
public function filterByDepartment($department) { $result = $this->filter( function ($key, $value) use ($department) { if ($value->getDepartment() == $department) { return true; } } ); if ($result && 1 === count($result)) { $results = $result->toArray(); return array_shift($results); } return $result; }
php
public function filterByDepartment($department) { $result = $this->filter( function ($key, $value) use ($department) { if ($value->getDepartment() == $department) { return true; } } ); if ($result && 1 === count($result)) { $results = $result->toArray(); return array_shift($results); } return $result; }
[ "public", "function", "filterByDepartment", "(", "$", "department", ")", "{", "$", "result", "=", "$", "this", "->", "filter", "(", "function", "(", "$", "key", ",", "$", "value", ")", "use", "(", "$", "department", ")", "{", "if", "(", "$", "value",...
Filter by department @param string $department @return $this
[ "Filter", "by", "department" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Model/Collection/Jobs.php#L29-L46
php-tmdb/api
lib/Tmdb/Model/Collection/Jobs.php
Jobs.filterByDepartmentAndReturnJobsList
public function filterByDepartmentAndReturnJobsList($department) { $result = $this->filter( function ($key, $value) use ($department) { if ($value->getDepartment() == $department) { return true; } } ); if ($result && 1 === count($result)) { $results = $result->toArray(); $data = array_shift($results); return $data->getJobList(); } return $result; }
php
public function filterByDepartmentAndReturnJobsList($department) { $result = $this->filter( function ($key, $value) use ($department) { if ($value->getDepartment() == $department) { return true; } } ); if ($result && 1 === count($result)) { $results = $result->toArray(); $data = array_shift($results); return $data->getJobList(); } return $result; }
[ "public", "function", "filterByDepartmentAndReturnJobsList", "(", "$", "department", ")", "{", "$", "result", "=", "$", "this", "->", "filter", "(", "function", "(", "$", "key", ",", "$", "value", ")", "use", "(", "$", "department", ")", "{", "if", "(", ...
Filter by department and return the jobs collection @param string $department @return $this
[ "Filter", "by", "department", "and", "return", "the", "jobs", "collection" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Model/Collection/Jobs.php#L54-L72
php-tmdb/api
lib/Tmdb/Model/Collection/Jobs.php
Jobs.filterByJob
public function filterByJob($filterByJob) { $result = $this->filter( function ($key, $value) use ($filterByJob) { $jobList = $value->getJobList(); foreach ($jobList as $job) { if ($filterByJob == $job) { return true; } } } ); if ($result && 1 === count($result)) { $results = $result->toArray(); return array_shift($results); } return $result; }
php
public function filterByJob($filterByJob) { $result = $this->filter( function ($key, $value) use ($filterByJob) { $jobList = $value->getJobList(); foreach ($jobList as $job) { if ($filterByJob == $job) { return true; } } } ); if ($result && 1 === count($result)) { $results = $result->toArray(); return array_shift($results); } return $result; }
[ "public", "function", "filterByJob", "(", "$", "filterByJob", ")", "{", "$", "result", "=", "$", "this", "->", "filter", "(", "function", "(", "$", "key", ",", "$", "value", ")", "use", "(", "$", "filterByJob", ")", "{", "$", "jobList", "=", "$", "...
Filter by job @param string $filterByJob @return $this
[ "Filter", "by", "job" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Model/Collection/Jobs.php#L80-L101
php-tmdb/api
lib/Tmdb/Repository/GenreRepository.php
GenreRepository.load
public function load($id, array $parameters = [], array $headers = []) { return $this->loadCollection($parameters, $headers)->filterId($id); }
php
public function load($id, array $parameters = [], array $headers = []) { return $this->loadCollection($parameters, $headers)->filterId($id); }
[ "public", "function", "load", "(", "$", "id", ",", "array", "$", "parameters", "=", "[", "]", ",", "array", "$", "headers", "=", "[", "]", ")", "{", "return", "$", "this", "->", "loadCollection", "(", "$", "parameters", ",", "$", "headers", ")", "-...
Load a genre with the given identifier @param $id @param array $parameters @param array $headers @return Genre
[ "Load", "a", "genre", "with", "the", "given", "identifier" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Repository/GenreRepository.php#L35-L38
php-tmdb/api
lib/Tmdb/Repository/GenreRepository.php
GenreRepository.loadCollection
public function loadCollection(array $parameters = [], array $headers = []) { return $this->createCollection( $this->getApi()->getGenres($parameters, $headers) ); }
php
public function loadCollection(array $parameters = [], array $headers = []) { return $this->createCollection( $this->getApi()->getGenres($parameters, $headers) ); }
[ "public", "function", "loadCollection", "(", "array", "$", "parameters", "=", "[", "]", ",", "array", "$", "headers", "=", "[", "]", ")", "{", "return", "$", "this", "->", "createCollection", "(", "$", "this", "->", "getApi", "(", ")", "->", "getGenres...
Get the list of genres. @param array $parameters @param array $headers @return GenericCollection
[ "Get", "the", "list", "of", "genres", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Repository/GenreRepository.php#L47-L52
php-tmdb/api
lib/Tmdb/Repository/GenreRepository.php
GenreRepository.loadMovieCollection
public function loadMovieCollection(array $parameters = [], array $headers = []) { return $this->createCollection( $this->getApi()->getMovieGenres($parameters, $headers) ); }
php
public function loadMovieCollection(array $parameters = [], array $headers = []) { return $this->createCollection( $this->getApi()->getMovieGenres($parameters, $headers) ); }
[ "public", "function", "loadMovieCollection", "(", "array", "$", "parameters", "=", "[", "]", ",", "array", "$", "headers", "=", "[", "]", ")", "{", "return", "$", "this", "->", "createCollection", "(", "$", "this", "->", "getApi", "(", ")", "->", "getM...
Get the list of movie genres. @param array $parameters @param array $headers @return GenericCollection
[ "Get", "the", "list", "of", "movie", "genres", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Repository/GenreRepository.php#L61-L66
php-tmdb/api
lib/Tmdb/Repository/GenreRepository.php
GenreRepository.loadTvCollection
public function loadTvCollection(array $parameters = [], array $headers = []) { return $this->createCollection( $this->getApi()->getTvGenres($parameters, $headers) ); }
php
public function loadTvCollection(array $parameters = [], array $headers = []) { return $this->createCollection( $this->getApi()->getTvGenres($parameters, $headers) ); }
[ "public", "function", "loadTvCollection", "(", "array", "$", "parameters", "=", "[", "]", ",", "array", "$", "headers", "=", "[", "]", ")", "{", "return", "$", "this", "->", "createCollection", "(", "$", "this", "->", "getApi", "(", ")", "->", "getTvGe...
Get the list of tv genres. @param array $parameters @param array $headers @return GenericCollection
[ "Get", "the", "list", "of", "tv", "genres", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Repository/GenreRepository.php#L75-L80
php-tmdb/api
lib/Tmdb/Repository/GenreRepository.php
GenreRepository.getMovies
public function getMovies($id, array $parameters = [], array $headers = []) { return $this->getMovieFactory()->createResultCollection($this->getApi()->getMovies($id, $parameters, $headers)); }
php
public function getMovies($id, array $parameters = [], array $headers = []) { return $this->getMovieFactory()->createResultCollection($this->getApi()->getMovies($id, $parameters, $headers)); }
[ "public", "function", "getMovies", "(", "$", "id", ",", "array", "$", "parameters", "=", "[", "]", ",", "array", "$", "headers", "=", "[", "]", ")", "{", "return", "$", "this", "->", "getMovieFactory", "(", ")", "->", "createResultCollection", "(", "$"...
Get the list of movies for a particular genre by id. By default, only movies with 10 or more votes are included. @param $id @param array $parameters @return Genre[] @param array $headers
[ "Get", "the", "list", "of", "movies", "for", "a", "particular", "genre", "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/GenreRepository.php#L91-L94
php-tmdb/api
lib/Tmdb/Repository/CertificationRepository.php
CertificationRepository.getMovieList
public function getMovieList(array $parameters = [], array $headers = []) { $data = $this->getApi()->getMovieList($this->parseQueryParameters($parameters), $headers); return $this->getFactory()->createCollection($data); }
php
public function getMovieList(array $parameters = [], array $headers = []) { $data = $this->getApi()->getMovieList($this->parseQueryParameters($parameters), $headers); return $this->getFactory()->createCollection($data); }
[ "public", "function", "getMovieList", "(", "array", "$", "parameters", "=", "[", "]", ",", "array", "$", "headers", "=", "[", "]", ")", "{", "$", "data", "=", "$", "this", "->", "getApi", "(", ")", "->", "getMovieList", "(", "$", "this", "->", "par...
Get the list of supported certifications for movies. These can be used in conjunction with the certification_country and certification.lte parameters when using discover. @param $parameters @param $headers @return \Tmdb\Model\Common\GenericCollection
[ "Get", "the", "list", "of", "supported", "certifications", "for", "movies", "." ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Repository/CertificationRepository.php#L34-L39
php-tmdb/api
lib/Tmdb/Repository/AbstractRepository.php
AbstractRepository.parseQueryParameters
protected function parseQueryParameters(array $parameters = []) { foreach ($parameters as $key => $candidate) { if (is_a($candidate, 'Tmdb\Model\Common\QueryParameter\QueryParameterInterface')) { $interfaces = class_implements($candidate); if (array_key_exists('Tmdb\Model\Common\QueryParameter\QueryParameterInterface', $interfaces)) { unset($parameters[$key]); $parameters[$candidate->getKey()] = $candidate->getValue(); } } } return $parameters; }
php
protected function parseQueryParameters(array $parameters = []) { foreach ($parameters as $key => $candidate) { if (is_a($candidate, 'Tmdb\Model\Common\QueryParameter\QueryParameterInterface')) { $interfaces = class_implements($candidate); if (array_key_exists('Tmdb\Model\Common\QueryParameter\QueryParameterInterface', $interfaces)) { unset($parameters[$key]); $parameters[$candidate->getKey()] = $candidate->getValue(); } } } return $parameters; }
[ "protected", "function", "parseQueryParameters", "(", "array", "$", "parameters", "=", "[", "]", ")", "{", "foreach", "(", "$", "parameters", "as", "$", "key", "=>", "$", "candidate", ")", "{", "if", "(", "is_a", "(", "$", "candidate", ",", "'Tmdb\\Model...
Process query parameters @param array $parameters @return array
[ "Process", "query", "parameters" ]
train
https://github.com/php-tmdb/api/blob/92cbf43a291bf0113ff2cce91d2db242fe6e6fcb/lib/Tmdb/Repository/AbstractRepository.php#L64-L79