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
mimmi20/Wurfl
src/Handlers/NintendoHandler.php
NintendoHandler.applyConclusiveMatch
public function applyConclusiveMatch($userAgent) { if (Utils::checkIfContains($userAgent, 'Nintendo WiiU')) { return 'nintendo_wii_u_ver1'; } if (Utils::checkIfContains($userAgent, 'Nintendo Wii')) { return 'nintendo_wii_ver1'; } if (Utils::checkIfCo...
php
public function applyConclusiveMatch($userAgent) { if (Utils::checkIfContains($userAgent, 'Nintendo WiiU')) { return 'nintendo_wii_u_ver1'; } if (Utils::checkIfContains($userAgent, 'Nintendo Wii')) { return 'nintendo_wii_ver1'; } if (Utils::checkIfCo...
[ "public", "function", "applyConclusiveMatch", "(", "$", "userAgent", ")", "{", "if", "(", "Utils", "::", "checkIfContains", "(", "$", "userAgent", ",", "'Nintendo WiiU'", ")", ")", "{", "return", "'nintendo_wii_u_ver1'", ";", "}", "if", "(", "Utils", "::", "...
@param string $userAgent @return string
[ "@param", "string", "$userAgent" ]
train
https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/NintendoHandler.php#L65-L86
sifophp/sifo-common-instance
controllers/locales/index.php
LocalesIndexController.build
public function build() { $this->setLayout( 'locales/index.tpl' ); $this->addModule( 'head', 'SharedHead' ); $this->addModule( 'footer', 'SharedFooter' ); $this->addModule( 'system_messages', 'SharedSystemMessages' ); $params = $this->getParams(); $action = \Sifo\Router::getReversalRoute( $params['path_...
php
public function build() { $this->setLayout( 'locales/index.tpl' ); $this->addModule( 'head', 'SharedHead' ); $this->addModule( 'footer', 'SharedFooter' ); $this->addModule( 'system_messages', 'SharedSystemMessages' ); $params = $this->getParams(); $action = \Sifo\Router::getReversalRoute( $params['path_...
[ "public", "function", "build", "(", ")", "{", "$", "this", "->", "setLayout", "(", "'locales/index.tpl'", ")", ";", "$", "this", "->", "addModule", "(", "'head'", ",", "'SharedHead'", ")", ";", "$", "this", "->", "addModule", "(", "'footer'", ",", "'Shar...
Main method controller. @return unknown_type
[ "Main", "method", "controller", "." ]
train
https://github.com/sifophp/sifo-common-instance/blob/52d54ea3e565bd2bccd77e0b0a6a99b5cae3aff5/controllers/locales/index.php#L18-L62
sifophp/sifo-common-instance
controllers/locales/index.php
LocalesIndexController.getLanguagesInstance
public function getLanguagesInstance($instance = null) { $languages = false; if ($instance != '') { $languages = $this->scanFiles(ROOT_PATH . '/instances/' . $instance . '/locale', false); if (is_array($languages) && count($languages) > 0) { $locales = array(); foreach ($languages as $index => $...
php
public function getLanguagesInstance($instance = null) { $languages = false; if ($instance != '') { $languages = $this->scanFiles(ROOT_PATH . '/instances/' . $instance . '/locale', false); if (is_array($languages) && count($languages) > 0) { $locales = array(); foreach ($languages as $index => $...
[ "public", "function", "getLanguagesInstance", "(", "$", "instance", "=", "null", ")", "{", "$", "languages", "=", "false", ";", "if", "(", "$", "instance", "!=", "''", ")", "{", "$", "languages", "=", "$", "this", "->", "scanFiles", "(", "ROOT_PATH", "...
Build a list with all of the languages of an instance @return array
[ "Build", "a", "list", "with", "all", "of", "the", "languages", "of", "an", "instance" ]
train
https://github.com/sifophp/sifo-common-instance/blob/52d54ea3e565bd2bccd77e0b0a6a99b5cae3aff5/controllers/locales/index.php#L78-L118
liuguangw/mvc
src/services/RouteHandler.php
RouteHandler.createUrl
public function createUrl(string $moduleName, string $controllerName, string $actionName, ?DataMap $params = null): string { $url = '/'; if (! $this->isModuleName($moduleName)) { Application::$app->dispatchEvent(ApplicationErrorEvent::createCustom(500, '模块名' . $moduleName . '非法')); ...
php
public function createUrl(string $moduleName, string $controllerName, string $actionName, ?DataMap $params = null): string { $url = '/'; if (! $this->isModuleName($moduleName)) { Application::$app->dispatchEvent(ApplicationErrorEvent::createCustom(500, '模块名' . $moduleName . '非法')); ...
[ "public", "function", "createUrl", "(", "string", "$", "moduleName", ",", "string", "$", "controllerName", ",", "string", "$", "actionName", ",", "?", "DataMap", "$", "params", "=", "null", ")", ":", "string", "{", "$", "url", "=", "'/'", ";", "if", "(...
根据路由信息生成URL地址 @param string $moduleName 模块名 @param string $controllerName 控制器名 @param string $actionName 操作名 @param DataMap $params 路由参数 @return string
[ "根据路由信息生成URL地址" ]
train
https://github.com/liuguangw/mvc/blob/70f98f37ec59fae50650102a99fbcab88bef9f54/src/services/RouteHandler.php#L82-L95
unimapper/unimapper
src/Query/Select.php
Select._mergeAssociated
private function _mergeAssociated( array $result, array $associated, $refKey, $colName ) { foreach ($result as $index => $item) { if (is_array($item)) { $refValue = $item[$refKey]; } else { $refValue = $item->{$refKey};...
php
private function _mergeAssociated( array $result, array $associated, $refKey, $colName ) { foreach ($result as $index => $item) { if (is_array($item)) { $refValue = $item[$refKey]; } else { $refValue = $item->{$refKey};...
[ "private", "function", "_mergeAssociated", "(", "array", "$", "result", ",", "array", "$", "associated", ",", "$", "refKey", ",", "$", "colName", ")", "{", "foreach", "(", "$", "result", "as", "$", "index", "=>", "$", "item", ")", "{", "if", "(", "is...
Merge associated data with result @param array $result @param array $associated @param string $refKey @param string $colName @return array
[ "Merge", "associated", "data", "with", "result" ]
train
https://github.com/unimapper/unimapper/blob/a63b39f38a790fec7e852c8ef1e4c31653e689f7/src/Query/Select.php#L150-L174
unimapper/unimapper
src/Query/Select.php
Select._getQueryChecksum
private function _getQueryChecksum() { return md5( serialize( [ "name" => $this->getName(), "entity" => Convention::classToName( $this->reflection->getClassName(), Convention::ENTITY_MASK ), ...
php
private function _getQueryChecksum() { return md5( serialize( [ "name" => $this->getName(), "entity" => Convention::classToName( $this->reflection->getClassName(), Convention::ENTITY_MASK ), ...
[ "private", "function", "_getQueryChecksum", "(", ")", "{", "return", "md5", "(", "serialize", "(", "[", "\"name\"", "=>", "$", "this", "->", "getName", "(", ")", ",", "\"entity\"", "=>", "Convention", "::", "classToName", "(", "$", "this", "->", "reflectio...
Get a unique query checksum @return integer
[ "Get", "a", "unique", "query", "checksum" ]
train
https://github.com/unimapper/unimapper/blob/a63b39f38a790fec7e852c8ef1e4c31653e689f7/src/Query/Select.php#L181-L200
vi-kon/laravel-parser
src/ViKon/Parser/rule/AbstractSingleRule.php
AbstractSingleRule.embedInto
public function embedInto($parentRuleName, Lexer $lexer) { if (is_array($this->pattern)) { foreach ($this->pattern as $pattern) { $lexer->addSinglePattern($pattern, $parentRuleName, $this->name); } } else { $lexer->addSinglePattern($this->pattern, $par...
php
public function embedInto($parentRuleName, Lexer $lexer) { if (is_array($this->pattern)) { foreach ($this->pattern as $pattern) { $lexer->addSinglePattern($pattern, $parentRuleName, $this->name); } } else { $lexer->addSinglePattern($this->pattern, $par...
[ "public", "function", "embedInto", "(", "$", "parentRuleName", ",", "Lexer", "$", "lexer", ")", "{", "if", "(", "is_array", "(", "$", "this", "->", "pattern", ")", ")", "{", "foreach", "(", "$", "this", "->", "pattern", "as", "$", "pattern", ")", "{"...
Embed rule into parent rule @param string $parentRuleName parent rule name @param \ViKon\Parser\Lexer\Lexer $lexer lexer instance @return \ViKon\Parser\Rule\AbstractSingleRule
[ "Embed", "rule", "into", "parent", "rule" ]
train
https://github.com/vi-kon/laravel-parser/blob/070f0bb9120cb9ca6ff836d4f418e78ee33ee182/src/ViKon/Parser/rule/AbstractSingleRule.php#L39-L49
vi-kon/laravel-parser
src/ViKon/Parser/rule/AbstractSingleRule.php
AbstractSingleRule.parseToken
public function parseToken($content, $position, $state, TokenList $tokenList) { switch ($state) { case Lexer::STATE_SINGLE: $this->handleSingleState($content, $position, $tokenList); break; default: throw new RuleException($state . ' state...
php
public function parseToken($content, $position, $state, TokenList $tokenList) { switch ($state) { case Lexer::STATE_SINGLE: $this->handleSingleState($content, $position, $tokenList); break; default: throw new RuleException($state . ' state...
[ "public", "function", "parseToken", "(", "$", "content", ",", "$", "position", ",", "$", "state", ",", "TokenList", "$", "tokenList", ")", "{", "switch", "(", "$", "state", ")", "{", "case", "Lexer", "::", "STATE_SINGLE", ":", "$", "this", "->", "handl...
Parse token @param string $content matched token string @param int $position matched token position @param int $state matched state @param \ViKon\Parser\TokenList $tokenList token list @throws \ViKon\Parser\Rule\RuleException
[ "Parse", "token" ]
train
https://github.com/vi-kon/laravel-parser/blob/070f0bb9120cb9ca6ff836d4f418e78ee33ee182/src/ViKon/Parser/rule/AbstractSingleRule.php#L61-L70
keboola/juicer
Client/RestClient.php
RestClient.getRequestConfig
protected function getRequestConfig(array $config) : array { if (!empty($this->defaultRequestOptions)) { $config = array_replace_recursive($this->defaultRequestOptions, $config); } return $config; }
php
protected function getRequestConfig(array $config) : array { if (!empty($this->defaultRequestOptions)) { $config = array_replace_recursive($this->defaultRequestOptions, $config); } return $config; }
[ "protected", "function", "getRequestConfig", "(", "array", "$", "config", ")", ":", "array", "{", "if", "(", "!", "empty", "(", "$", "this", "->", "defaultRequestOptions", ")", ")", "{", "$", "config", "=", "array_replace_recursive", "(", "$", "this", "->"...
Update request config with default options @param array $config @return array
[ "Update", "request", "config", "with", "default", "options" ]
train
https://github.com/keboola/juicer/blob/780e7900ccd23082ed234cc2c51b279a4223e9f5/Client/RestClient.php#L83-L90
keboola/juicer
Client/RestClient.php
RestClient.createBackoff
private static function createBackoff(array $options, LoggerInterface $logger) { $headerName = isset($options['http']['retryHeader']) ? $options['http']['retryHeader'] : 'Retry-After'; $httpRetryCodes = isset($options['http']['codes']) ? $options['http']['codes'] : [500, 502, 503, 504, 408, 420, 429...
php
private static function createBackoff(array $options, LoggerInterface $logger) { $headerName = isset($options['http']['retryHeader']) ? $options['http']['retryHeader'] : 'Retry-After'; $httpRetryCodes = isset($options['http']['codes']) ? $options['http']['codes'] : [500, 502, 503, 504, 408, 420, 429...
[ "private", "static", "function", "createBackoff", "(", "array", "$", "options", ",", "LoggerInterface", "$", "logger", ")", "{", "$", "headerName", "=", "isset", "(", "$", "options", "[", "'http'", "]", "[", "'retryHeader'", "]", ")", "?", "$", "options", ...
Create exponential backoff for GuzzleClient options - maxRetries: (integer) max retries count - http - retryHeader (string) header containing retry time header - codes (array) list of status codes to retry on - curl - codes (array) list of error codes to retry on @param array $options @param LoggerInterface $logger @...
[ "Create", "exponential", "backoff", "for", "GuzzleClient" ]
train
https://github.com/keboola/juicer/blob/780e7900ccd23082ed234cc2c51b279a4223e9f5/Client/RestClient.php#L268-L306
o2system/parser
src/String/Adapters/BBCode.php
BBCode.initialize
public function initialize(array $config = []) { if (empty($this->engine)) { if ($this->isSupported()) { $this->engine = new \JBBCode\Parser(); $this->engine->addCodeDefinitionSet(new \JBBCode\DefaultCodeDefinitionSet()); } else { ...
php
public function initialize(array $config = []) { if (empty($this->engine)) { if ($this->isSupported()) { $this->engine = new \JBBCode\Parser(); $this->engine->addCodeDefinitionSet(new \JBBCode\DefaultCodeDefinitionSet()); } else { ...
[ "public", "function", "initialize", "(", "array", "$", "config", "=", "[", "]", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "engine", ")", ")", "{", "if", "(", "$", "this", "->", "isSupported", "(", ")", ")", "{", "$", "this", "->", "...
BBCode::initialize @param array $config @return static @throws \O2System\Spl\Exceptions\RuntimeException
[ "BBCode", "::", "initialize" ]
train
https://github.com/o2system/parser/blob/1b85fe676ea043a500842e61731ab4d38e5323e4/src/String/Adapters/BBCode.php#L38-L54
o2system/parser
src/String/Adapters/BBCode.php
BBCode.parse
public function parse(array $vars = []) { $this->engine->parse($this->string); return $this->engine->getAsHtml(); }
php
public function parse(array $vars = []) { $this->engine->parse($this->string); return $this->engine->getAsHtml(); }
[ "public", "function", "parse", "(", "array", "$", "vars", "=", "[", "]", ")", "{", "$", "this", "->", "engine", "->", "parse", "(", "$", "this", "->", "string", ")", ";", "return", "$", "this", "->", "engine", "->", "getAsHtml", "(", ")", ";", "}...
BBCode::parse @param array $vars Variable to be parsed. @return string
[ "BBCode", "::", "parse" ]
train
https://github.com/o2system/parser/blob/1b85fe676ea043a500842e61731ab4d38e5323e4/src/String/Adapters/BBCode.php#L83-L88
gorkalaucirica/HipchatAPIv2Client
Model/Webhook.php
Webhook.toJson
public function toJson() { $json = array(); $json['id'] = $this->id; $json['url'] = $this->url; $json['pattern'] = $this->pattern; $json['event'] = $this->event; $json['name'] = $this->name; $json['links'] = $this->links; return $json; }
php
public function toJson() { $json = array(); $json['id'] = $this->id; $json['url'] = $this->url; $json['pattern'] = $this->pattern; $json['event'] = $this->event; $json['name'] = $this->name; $json['links'] = $this->links; return $json; }
[ "public", "function", "toJson", "(", ")", "{", "$", "json", "=", "array", "(", ")", ";", "$", "json", "[", "'id'", "]", "=", "$", "this", "->", "id", ";", "$", "json", "[", "'url'", "]", "=", "$", "this", "->", "url", ";", "$", "json", "[", ...
Serializes Webhook object @return array
[ "Serializes", "Webhook", "object" ]
train
https://github.com/gorkalaucirica/HipchatAPIv2Client/blob/eef9c91d5efe5ae9cad27c503601ffff089c9547/Model/Webhook.php#L79-L90
activecollab/user
src/UserInterface/FormatNameImplementation.php
FormatNameImplementation.formatName
public function formatName($format = UserInterface::NAME_FULL) { $first_name = $this->getFirstName(); $last_name = $this->getLastName(); if (empty($first_name) && empty($last_name)) { list($first_name, $last_name) = $this->getFirstAndLastNameFromEmail(); } if ($...
php
public function formatName($format = UserInterface::NAME_FULL) { $first_name = $this->getFirstName(); $last_name = $this->getLastName(); if (empty($first_name) && empty($last_name)) { list($first_name, $last_name) = $this->getFirstAndLastNameFromEmail(); } if ($...
[ "public", "function", "formatName", "(", "$", "format", "=", "UserInterface", "::", "NAME_FULL", ")", "{", "$", "first_name", "=", "$", "this", "->", "getFirstName", "(", ")", ";", "$", "last_name", "=", "$", "this", "->", "getLastName", "(", ")", ";", ...
Return display name of this user. @param string $format @return string
[ "Return", "display", "name", "of", "this", "user", "." ]
train
https://github.com/activecollab/user/blob/f54b858eb9016fbca32090e624eccb0354e93d8f/src/UserInterface/FormatNameImplementation.php#L24-L44
activecollab/user
src/UserInterface/FormatNameImplementation.php
FormatNameImplementation.getFirstAndLastNameFromEmail
public function getFirstAndLastNameFromEmail() { $exploded_full_name = explode(' ', str_replace(['.', '-', '_'], [' ', ' ', ' '], substr($this->getEmail(), 0, strpos($this->getEmail(), '@')))); if (count($exploded_full_name) === 1) { $first_name = mb_strtoupper(mb_substr($exploded_full_...
php
public function getFirstAndLastNameFromEmail() { $exploded_full_name = explode(' ', str_replace(['.', '-', '_'], [' ', ' ', ' '], substr($this->getEmail(), 0, strpos($this->getEmail(), '@')))); if (count($exploded_full_name) === 1) { $first_name = mb_strtoupper(mb_substr($exploded_full_...
[ "public", "function", "getFirstAndLastNameFromEmail", "(", ")", "{", "$", "exploded_full_name", "=", "explode", "(", "' '", ",", "str_replace", "(", "[", "'.'", ",", "'-'", ",", "'_'", "]", ",", "[", "' '", ",", "' '", ",", "' '", "]", ",", "substr", "...
Try to get first and last name from email address. @return array
[ "Try", "to", "get", "first", "and", "last", "name", "from", "email", "address", "." ]
train
https://github.com/activecollab/user/blob/f54b858eb9016fbca32090e624eccb0354e93d8f/src/UserInterface/FormatNameImplementation.php#L51-L70
transfer-framework/transfer
src/Transfer/Console/Command/Manifest/DescribeCommand.php
DescribeCommand.execute
protected function execute(InputInterface $input, OutputInterface $output) { parent::execute($input, $output); $name = $input->getArgument('name'); if (!($manifest = $this->chain->getManifest($name))) { throw new ManifestNotFoundException($name); } $this->descr...
php
protected function execute(InputInterface $input, OutputInterface $output) { parent::execute($input, $output); $name = $input->getArgument('name'); if (!($manifest = $this->chain->getManifest($name))) { throw new ManifestNotFoundException($name); } $this->descr...
[ "protected", "function", "execute", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "parent", "::", "execute", "(", "$", "input", ",", "$", "output", ")", ";", "$", "name", "=", "$", "input", "->", "getArgument", "("...
{@inheritdoc}
[ "{" ]
train
https://github.com/transfer-framework/transfer/blob/9225ae068d5924982f14ad4446b15f75384a058a/src/Transfer/Console/Command/Manifest/DescribeCommand.php#L41-L52
transfer-framework/transfer
src/Transfer/Console/Command/Manifest/DescribeCommand.php
DescribeCommand.describeManifest
private function describeManifest(ManifestInterface $manifest, OutputInterface $output) { $builder = new ProcedureBuilder(); $manifest->configureProcedureBuilder($builder); $output->writeln(sprintf("Manifest description for <info>%s</info>\n", $manifest->getName())); $output->writel...
php
private function describeManifest(ManifestInterface $manifest, OutputInterface $output) { $builder = new ProcedureBuilder(); $manifest->configureProcedureBuilder($builder); $output->writeln(sprintf("Manifest description for <info>%s</info>\n", $manifest->getName())); $output->writel...
[ "private", "function", "describeManifest", "(", "ManifestInterface", "$", "manifest", ",", "OutputInterface", "$", "output", ")", "{", "$", "builder", "=", "new", "ProcedureBuilder", "(", ")", ";", "$", "manifest", "->", "configureProcedureBuilder", "(", "$", "b...
Describes a manifest. @param ManifestInterface $manifest Manifest @param OutputInterface $output Output
[ "Describes", "a", "manifest", "." ]
train
https://github.com/transfer-framework/transfer/blob/9225ae068d5924982f14ad4446b15f75384a058a/src/Transfer/Console/Command/Manifest/DescribeCommand.php#L60-L69
transfer-framework/transfer
src/Transfer/Console/Command/Manifest/DescribeCommand.php
DescribeCommand.describeProcedure
private function describeProcedure(Procedure $procedure, OutputInterface $output, $depth = 0) { $output->writeln(sprintf('%sProcedure <info>%s</info>', str_repeat(' ', $depth), $procedure->getName())); $this->describeComponents($procedure->getSources(), 'SOURCES', $output, $depth); $this->d...
php
private function describeProcedure(Procedure $procedure, OutputInterface $output, $depth = 0) { $output->writeln(sprintf('%sProcedure <info>%s</info>', str_repeat(' ', $depth), $procedure->getName())); $this->describeComponents($procedure->getSources(), 'SOURCES', $output, $depth); $this->d...
[ "private", "function", "describeProcedure", "(", "Procedure", "$", "procedure", ",", "OutputInterface", "$", "output", ",", "$", "depth", "=", "0", ")", "{", "$", "output", "->", "writeln", "(", "sprintf", "(", "'%sProcedure <info>%s</info>'", ",", "str_repeat",...
Describes a procedure. @param Procedure $procedure Procedure @param OutputInterface $output Console output handle @param int $depth Current depth
[ "Describes", "a", "procedure", "." ]
train
https://github.com/transfer-framework/transfer/blob/9225ae068d5924982f14ad4446b15f75384a058a/src/Transfer/Console/Command/Manifest/DescribeCommand.php#L78-L88
transfer-framework/transfer
src/Transfer/Console/Command/Manifest/DescribeCommand.php
DescribeCommand.describeChildProcedures
private function describeChildProcedures($children, $output, $depth) { if (is_array($children)) { $output->writeln(sprintf('%s<comment>SUB-PROCEDURES</comment>', str_repeat(' ', $depth))); foreach ($children as $child) { $this->describeProcedure($child, $output, $dep...
php
private function describeChildProcedures($children, $output, $depth) { if (is_array($children)) { $output->writeln(sprintf('%s<comment>SUB-PROCEDURES</comment>', str_repeat(' ', $depth))); foreach ($children as $child) { $this->describeProcedure($child, $output, $dep...
[ "private", "function", "describeChildProcedures", "(", "$", "children", ",", "$", "output", ",", "$", "depth", ")", "{", "if", "(", "is_array", "(", "$", "children", ")", ")", "{", "$", "output", "->", "writeln", "(", "sprintf", "(", "'%s<comment>SUB-PROCE...
Describes child procedures. @param array $children Procedure children @param OutputInterface $output Console output handle @param int $depth Current depth
[ "Describes", "child", "procedures", "." ]
train
https://github.com/transfer-framework/transfer/blob/9225ae068d5924982f14ad4446b15f75384a058a/src/Transfer/Console/Command/Manifest/DescribeCommand.php#L97-L107
transfer-framework/transfer
src/Transfer/Console/Command/Manifest/DescribeCommand.php
DescribeCommand.describeComponents
private function describeComponents($components, $name, OutputInterface $output, $depth = 0) { if (is_array($components)) { $output->writeln(sprintf('%s<comment>%s</comment>', str_repeat(' ', $depth), $name)); foreach ($components as $component) { $output->writeln(sp...
php
private function describeComponents($components, $name, OutputInterface $output, $depth = 0) { if (is_array($components)) { $output->writeln(sprintf('%s<comment>%s</comment>', str_repeat(' ', $depth), $name)); foreach ($components as $component) { $output->writeln(sp...
[ "private", "function", "describeComponents", "(", "$", "components", ",", "$", "name", ",", "OutputInterface", "$", "output", ",", "$", "depth", "=", "0", ")", "{", "if", "(", "is_array", "(", "$", "components", ")", ")", "{", "$", "output", "->", "wri...
Describes components. @param array $components Components @param string $name Component type @param OutputInterface $output Console output handle @param int $depth Current depth
[ "Describes", "components", "." ]
train
https://github.com/transfer-framework/transfer/blob/9225ae068d5924982f14ad4446b15f75384a058a/src/Transfer/Console/Command/Manifest/DescribeCommand.php#L117-L130
vardius/crud-bundle
Data/Provider/Propel/DataProvider.php
DataProvider.remove
public function remove($data) { $entity = null; if (is_object($data)) { $entity = $data; } elseif (is_numeric($data)) { $this->source->clear(); $entity = $this->source->findPk($data); } else { throw new \InvalidArgumentException('Argume...
php
public function remove($data) { $entity = null; if (is_object($data)) { $entity = $data; } elseif (is_numeric($data)) { $this->source->clear(); $entity = $this->source->findPk($data); } else { throw new \InvalidArgumentException('Argume...
[ "public", "function", "remove", "(", "$", "data", ")", "{", "$", "entity", "=", "null", ";", "if", "(", "is_object", "(", "$", "data", ")", ")", "{", "$", "entity", "=", "$", "data", ";", "}", "elseif", "(", "is_numeric", "(", "$", "data", ")", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/vardius/crud-bundle/blob/dda957e3f8516c3b0d6270ea5a6eb50d98e71444/Data/Provider/Propel/DataProvider.php#L81-L102
vardius/crud-bundle
Data/Provider/Propel/DataProvider.php
DataProvider.add
public function add($data) { if (!$data instanceof \Persistent) { throw new \InvalidArgumentException('The $data instance is not supported by the Propel implementation'); } if ($this->crudManager instanceof CrudManagerInterface) { $this->crudManager->add($data); ...
php
public function add($data) { if (!$data instanceof \Persistent) { throw new \InvalidArgumentException('The $data instance is not supported by the Propel implementation'); } if ($this->crudManager instanceof CrudManagerInterface) { $this->crudManager->add($data); ...
[ "public", "function", "add", "(", "$", "data", ")", "{", "if", "(", "!", "$", "data", "instanceof", "\\", "Persistent", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'The $data instance is not supported by the Propel implementation'", ")", ";", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/vardius/crud-bundle/blob/dda957e3f8516c3b0d6270ea5a6eb50d98e71444/Data/Provider/Propel/DataProvider.php#L107-L118
vardius/crud-bundle
Data/Provider/Propel/DataProvider.php
DataProvider.findBy
public function findBy(array $criteria) { $this->source->clear(); foreach ($criteria as $field => $value) { $method = 'filterBy' . ucfirst($field); $this->source->$method($value); } return $this->source->findOne(); }
php
public function findBy(array $criteria) { $this->source->clear(); foreach ($criteria as $field => $value) { $method = 'filterBy' . ucfirst($field); $this->source->$method($value); } return $this->source->findOne(); }
[ "public", "function", "findBy", "(", "array", "$", "criteria", ")", "{", "$", "this", "->", "source", "->", "clear", "(", ")", ";", "foreach", "(", "$", "criteria", "as", "$", "field", "=>", "$", "value", ")", "{", "$", "method", "=", "'filterBy'", ...
{@inheritDoc}
[ "{" ]
train
https://github.com/vardius/crud-bundle/blob/dda957e3f8516c3b0d6270ea5a6eb50d98e71444/Data/Provider/Propel/DataProvider.php#L139-L149
nyeholt/silverstripe-simplewiki
code/formatters/SimpleWikiFormatter.php
SimpleWikiFormatter.analyseSavedContent
public function analyseSavedContent($wikiPage) { $newPages = $this->parseNewPagesFrom($wikiPage->Content); foreach ($newPages as $pageTitle) { $trimmedTitle = trim($pageTitle); // need to trim the title before doing the search $page = DataObject::get_one('WikiPage', '"SiteTree"."Title" = \'' . Convert::r...
php
public function analyseSavedContent($wikiPage) { $newPages = $this->parseNewPagesFrom($wikiPage->Content); foreach ($newPages as $pageTitle) { $trimmedTitle = trim($pageTitle); // need to trim the title before doing the search $page = DataObject::get_one('WikiPage', '"SiteTree"."Title" = \'' . Convert::r...
[ "public", "function", "analyseSavedContent", "(", "$", "wikiPage", ")", "{", "$", "newPages", "=", "$", "this", "->", "parseNewPagesFrom", "(", "$", "wikiPage", "->", "Content", ")", ";", "foreach", "(", "$", "newPages", "as", "$", "pageTitle", ")", "{", ...
Analyse content just after it's saved. This is useful for creating new pages etc where referenced by particular formatting
[ "Analyse", "content", "just", "after", "it", "s", "saved", ".", "This", "is", "useful", "for", "creating", "new", "pages", "etc", "where", "referenced", "by", "particular", "formatting" ]
train
https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/code/formatters/SimpleWikiFormatter.php#L14-L40
nyeholt/silverstripe-simplewiki
code/formatters/SimpleWikiFormatter.php
SimpleWikiFormatter.parseNewPagesFrom
public function parseNewPagesFrom($content) { $pages = array(); if (preg_match_all('/\[\[([\w\s_.-]+)\]\]/', $content, $matches)) { // exit(print_r($matches)); foreach ($matches[1] as $pageTitle) { $pages[] = $pageTitle; } } return $pages; }
php
public function parseNewPagesFrom($content) { $pages = array(); if (preg_match_all('/\[\[([\w\s_.-]+)\]\]/', $content, $matches)) { // exit(print_r($matches)); foreach ($matches[1] as $pageTitle) { $pages[] = $pageTitle; } } return $pages; }
[ "public", "function", "parseNewPagesFrom", "(", "$", "content", ")", "{", "$", "pages", "=", "array", "(", ")", ";", "if", "(", "preg_match_all", "(", "'/\\[\\[([\\w\\s_.-]+)\\]\\]/'", ",", "$", "content", ",", "$", "matches", ")", ")", "{", "// exit(print_r...
Separated into a separate method for testing @param String $content @return array
[ "Separated", "into", "a", "separate", "method", "for", "testing" ]
train
https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/code/formatters/SimpleWikiFormatter.php#L49-L59
mimmi20/Wurfl
src/Handlers/MaemoHandler.php
MaemoHandler.applyConclusiveMatch
public function applyConclusiveMatch($userAgent) { $tolerance = Utils::toleranceToRisDelimeter($userAgent); if ($tolerance !== false) { return $this->getDeviceIDFromRIS($userAgent, $tolerance); } $tolerance = Utils::firstSlash($userAgent); return $this->getDevic...
php
public function applyConclusiveMatch($userAgent) { $tolerance = Utils::toleranceToRisDelimeter($userAgent); if ($tolerance !== false) { return $this->getDeviceIDFromRIS($userAgent, $tolerance); } $tolerance = Utils::firstSlash($userAgent); return $this->getDevic...
[ "public", "function", "applyConclusiveMatch", "(", "$", "userAgent", ")", "{", "$", "tolerance", "=", "Utils", "::", "toleranceToRisDelimeter", "(", "$", "userAgent", ")", ";", "if", "(", "$", "tolerance", "!==", "false", ")", "{", "return", "$", "this", "...
@param string $userAgent @return null|string
[ "@param", "string", "$userAgent" ]
train
https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/MaemoHandler.php#L57-L67
mimmi20/Wurfl
src/Handlers/MaemoHandler.php
MaemoHandler.getMaemoModel
public static function getMaemoModel($userAgent) { if (preg_match('/Maemo [bB]rowser [\d\.]+ (.+)/', $userAgent, $matches)) { $model = $matches[1]; $idx = strpos($model, ' GTB'); if ($idx !== false) { $model = substr($model, 0, $idx); } ...
php
public static function getMaemoModel($userAgent) { if (preg_match('/Maemo [bB]rowser [\d\.]+ (.+)/', $userAgent, $matches)) { $model = $matches[1]; $idx = strpos($model, ' GTB'); if ($idx !== false) { $model = substr($model, 0, $idx); } ...
[ "public", "static", "function", "getMaemoModel", "(", "$", "userAgent", ")", "{", "if", "(", "preg_match", "(", "'/Maemo [bB]rowser [\\d\\.]+ (.+)/'", ",", "$", "userAgent", ",", "$", "matches", ")", ")", "{", "$", "model", "=", "$", "matches", "[", "1", "...
@param $userAgent @return null|string
[ "@param", "$userAgent" ]
train
https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/MaemoHandler.php#L91-L105
PandaPlatform/framework
src/Panda/Http/Response.php
Response.redirect
public function redirect($url, $status = 302) { // Set headers $this->setStatusCode($status); $this->headers->set('Location', $url); return $this; }
php
public function redirect($url, $status = 302) { // Set headers $this->setStatusCode($status); $this->headers->set('Location', $url); return $this; }
[ "public", "function", "redirect", "(", "$", "url", ",", "$", "status", "=", "302", ")", "{", "// Set headers", "$", "this", "->", "setStatusCode", "(", "$", "status", ")", ";", "$", "this", "->", "headers", "->", "set", "(", "'Location'", ",", "$", "...
Create a redirect response. @param string $url @param int $status @return $this @throws \InvalidArgumentException
[ "Create", "a", "redirect", "response", "." ]
train
https://github.com/PandaPlatform/framework/blob/a78cf051b379896b5a4d5df620988e37a0e632f5/src/Panda/Http/Response.php#L31-L38
o2system/parser
src/Template/Adapters/Smarty.php
Smarty.initialize
public function initialize(array $config = []) { if (empty($this->engine)) { if ($this->isSupported()) { $this->engine = new \Smarty(); } else { throw new RuntimeException( 'PARSER_E_THIRD_PARTY', 0, ...
php
public function initialize(array $config = []) { if (empty($this->engine)) { if ($this->isSupported()) { $this->engine = new \Smarty(); } else { throw new RuntimeException( 'PARSER_E_THIRD_PARTY', 0, ...
[ "public", "function", "initialize", "(", "array", "$", "config", "=", "[", "]", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "engine", ")", ")", "{", "if", "(", "$", "this", "->", "isSupported", "(", ")", ")", "{", "$", "this", "->", "...
Smarty::initialize @param array $config @return static @throws \O2System\Spl\Exceptions\RuntimeException
[ "Smarty", "::", "initialize" ]
train
https://github.com/o2system/parser/blob/1b85fe676ea043a500842e61731ab4d38e5323e4/src/Template/Adapters/Smarty.php#L38-L53
o2system/parser
src/Template/Adapters/Smarty.php
Smarty.parse
public function parse(array $vars = []) { foreach ($vars as $_assign_key => $_assign_value) { $this->engine->assign($_assign_key, $_assign_value); } return $this->engine->fetch('string:' . $this->string); }
php
public function parse(array $vars = []) { foreach ($vars as $_assign_key => $_assign_value) { $this->engine->assign($_assign_key, $_assign_value); } return $this->engine->fetch('string:' . $this->string); }
[ "public", "function", "parse", "(", "array", "$", "vars", "=", "[", "]", ")", "{", "foreach", "(", "$", "vars", "as", "$", "_assign_key", "=>", "$", "_assign_value", ")", "{", "$", "this", "->", "engine", "->", "assign", "(", "$", "_assign_key", ",",...
Smarty::parse @param array $vars Variable to be parsed. @return string
[ "Smarty", "::", "parse" ]
train
https://github.com/o2system/parser/blob/1b85fe676ea043a500842e61731ab4d38e5323e4/src/Template/Adapters/Smarty.php#L82-L89
pantera-digital/yii2-seo
models/SeoSlugSearch.php
SeoSlugSearch.search
public function search($params) { $query = SeoSlug::find(); $dataProvider = new ActiveDataProvider([ 'query' => $query, 'sort' => [ 'defaultOrder' => ['id' => SORT_DESC], ], ]); $this->load($params); if (!$this->validate()) ...
php
public function search($params) { $query = SeoSlug::find(); $dataProvider = new ActiveDataProvider([ 'query' => $query, 'sort' => [ 'defaultOrder' => ['id' => SORT_DESC], ], ]); $this->load($params); if (!$this->validate()) ...
[ "public", "function", "search", "(", "$", "params", ")", "{", "$", "query", "=", "SeoSlug", "::", "find", "(", ")", ";", "$", "dataProvider", "=", "new", "ActiveDataProvider", "(", "[", "'query'", "=>", "$", "query", ",", "'sort'", "=>", "[", "'default...
Creates data provider instance with search query applied @param array $params @return ActiveDataProvider
[ "Creates", "data", "provider", "instance", "with", "search", "query", "applied" ]
train
https://github.com/pantera-digital/yii2-seo/blob/7673224ef601bfbccc57c96e7413ceb43d8332b2/models/SeoSlugSearch.php#L36-L54
mimmi20/Wurfl
src/Logger/FileLogger.php
FileLogger.log
public function log($level, $message, array $context = array()) { $time = date('F jS Y, h:iA'); $fullMessage = '[' . $time . '] [' . $level . '] ' . $message; fwrite($this->filePointer, $fullMessage . PHP_EOL); }
php
public function log($level, $message, array $context = array()) { $time = date('F jS Y, h:iA'); $fullMessage = '[' . $time . '] [' . $level . '] ' . $message; fwrite($this->filePointer, $fullMessage . PHP_EOL); }
[ "public", "function", "log", "(", "$", "level", ",", "$", "message", ",", "array", "$", "context", "=", "array", "(", ")", ")", "{", "$", "time", "=", "date", "(", "'F jS Y, h:iA'", ")", ";", "$", "fullMessage", "=", "'['", ".", "$", "time", ".", ...
Logs with an arbitrary level. @param mixed $level @param string $message @param array $context @return null|void
[ "Logs", "with", "an", "arbitrary", "level", "." ]
train
https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Logger/FileLogger.php#L69-L74
sebastiansulinski/laravel-pagination
src/Pagination/Select.php
Select.render
public function render() { if ( ! $this->hasPages()) { return null; } return sprintf( $this->wrapper, $this->getPreviousButton(), $this->pageLabel, $this->getSelect(), $this->getPageOfLabel(), $this->getNext...
php
public function render() { if ( ! $this->hasPages()) { return null; } return sprintf( $this->wrapper, $this->getPreviousButton(), $this->pageLabel, $this->getSelect(), $this->getPageOfLabel(), $this->getNext...
[ "public", "function", "render", "(", ")", "{", "if", "(", "!", "$", "this", "->", "hasPages", "(", ")", ")", "{", "return", "null", ";", "}", "return", "sprintf", "(", "$", "this", "->", "wrapper", ",", "$", "this", "->", "getPreviousButton", "(", ...
Render the given paginator. @return string|null
[ "Render", "the", "given", "paginator", "." ]
train
https://github.com/sebastiansulinski/laravel-pagination/blob/fdd1e6e437c908ce360e72c1f99eb0142a35e8f2/src/Pagination/Select.php#L75-L89
sebastiansulinski/laravel-pagination
src/Pagination/Select.php
Select.getSelect
protected function getSelect() { $html = '<select>'; if (is_array($this->window['all'])) { $html .= $this->getOptionLinks($this->window['all']); } $html .= '</select>'; return $html; }
php
protected function getSelect() { $html = '<select>'; if (is_array($this->window['all'])) { $html .= $this->getOptionLinks($this->window['all']); } $html .= '</select>'; return $html; }
[ "protected", "function", "getSelect", "(", ")", "{", "$", "html", "=", "'<select>'", ";", "if", "(", "is_array", "(", "$", "this", "->", "window", "[", "'all'", "]", ")", ")", "{", "$", "html", ".=", "$", "this", "->", "getOptionLinks", "(", "$", "...
Get the select tag with options for the URLs in the given array. @return string
[ "Get", "the", "select", "tag", "with", "options", "for", "the", "URLs", "in", "the", "given", "array", "." ]
train
https://github.com/sebastiansulinski/laravel-pagination/blob/fdd1e6e437c908ce360e72c1f99eb0142a35e8f2/src/Pagination/Select.php#L106-L117
sebastiansulinski/laravel-pagination
src/Pagination/Select.php
Select.getOptionLinks
protected function getOptionLinks(array $urls) { $html = ''; foreach ($urls as $page => $url) { $html .= $this->getOption($url, $page); } return $html; }
php
protected function getOptionLinks(array $urls) { $html = ''; foreach ($urls as $page => $url) { $html .= $this->getOption($url, $page); } return $html; }
[ "protected", "function", "getOptionLinks", "(", "array", "$", "urls", ")", "{", "$", "html", "=", "''", ";", "foreach", "(", "$", "urls", "as", "$", "page", "=>", "$", "url", ")", "{", "$", "html", ".=", "$", "this", "->", "getOption", "(", "$", ...
Get option tags with links for the URLs in the given array. @param array $urls @return string
[ "Get", "option", "tags", "with", "links", "for", "the", "URLs", "in", "the", "given", "array", "." ]
train
https://github.com/sebastiansulinski/laravel-pagination/blob/fdd1e6e437c908ce360e72c1f99eb0142a35e8f2/src/Pagination/Select.php#L125-L134
sebastiansulinski/laravel-pagination
src/Pagination/Select.php
Select.getOption
protected function getOption($url, $page) { if ($page == $this->paginator->currentPage()) { return $this->getActiveOption($page); } return $this->getAvailableOption($url, $page); }
php
protected function getOption($url, $page) { if ($page == $this->paginator->currentPage()) { return $this->getActiveOption($page); } return $this->getAvailableOption($url, $page); }
[ "protected", "function", "getOption", "(", "$", "url", ",", "$", "page", ")", "{", "if", "(", "$", "page", "==", "$", "this", "->", "paginator", "->", "currentPage", "(", ")", ")", "{", "return", "$", "this", "->", "getActiveOption", "(", "$", "page"...
Get html option tag. @param string $url @param int $page @return string
[ "Get", "html", "option", "tag", "." ]
train
https://github.com/sebastiansulinski/laravel-pagination/blob/fdd1e6e437c908ce360e72c1f99eb0142a35e8f2/src/Pagination/Select.php#L143-L150
ptlis/conneg
src/Parser/FieldParser.php
FieldParser.parse
public function parse(array $tokenList, $serverField, $fromField) { // Bundle tokens by variant. $bundleList = $this->bundleTokens($tokenList, Tokens::VARIANT_SEPARATOR); $prefList = array(); foreach ($bundleList as $bundle) { $prefList[] = $this->parseBundle($bundle, $s...
php
public function parse(array $tokenList, $serverField, $fromField) { // Bundle tokens by variant. $bundleList = $this->bundleTokens($tokenList, Tokens::VARIANT_SEPARATOR); $prefList = array(); foreach ($bundleList as $bundle) { $prefList[] = $this->parseBundle($bundle, $s...
[ "public", "function", "parse", "(", "array", "$", "tokenList", ",", "$", "serverField", ",", "$", "fromField", ")", "{", "// Bundle tokens by variant.", "$", "bundleList", "=", "$", "this", "->", "bundleTokens", "(", "$", "tokenList", ",", "Tokens", "::", "V...
Accepts a tokenized Accept* HTTP field and returns an array of Preference value objects. @throws InvalidVariantException @param array<string> $tokenList Parsed tokens @param bool $serverField If true the field came from the server & we error on malformed data, otherwise we suppress errors for client preferences.. @pa...
[ "Accepts", "a", "tokenized", "Accept", "*", "HTTP", "field", "and", "returns", "an", "array", "of", "Preference", "value", "objects", "." ]
train
https://github.com/ptlis/conneg/blob/04afb568f368ecdd81c13277006c4be041ccb58b/src/Parser/FieldParser.php#L57-L68
ptlis/conneg
src/Parser/FieldParser.php
FieldParser.parseBundle
private function parseBundle(array $tokenBundle, $serverField, $fromField) { $pref = null; try { list($variantTokenList, $paramTokenList) = $this->splitVariantAndParamTokens($tokenBundle, $fromField); $paramBundleList = $this->bundleTokens($paramTokenList, Tokens::PARAMS_SEP...
php
private function parseBundle(array $tokenBundle, $serverField, $fromField) { $pref = null; try { list($variantTokenList, $paramTokenList) = $this->splitVariantAndParamTokens($tokenBundle, $fromField); $paramBundleList = $this->bundleTokens($paramTokenList, Tokens::PARAMS_SEP...
[ "private", "function", "parseBundle", "(", "array", "$", "tokenBundle", ",", "$", "serverField", ",", "$", "fromField", ")", "{", "$", "pref", "=", "null", ";", "try", "{", "list", "(", "$", "variantTokenList", ",", "$", "paramTokenList", ")", "=", "$", ...
Accepts tokens for a single variant and returns the Preference value object encapsulating that data. @throws InvalidVariantException @param array<string> $tokenBundle @param bool $serverField @param string $fromField @return null|PreferenceInterface
[ "Accepts", "tokens", "for", "a", "single", "variant", "and", "returns", "the", "Preference", "value", "object", "encapsulating", "that", "data", "." ]
train
https://github.com/ptlis/conneg/blob/04afb568f368ecdd81c13277006c4be041ccb58b/src/Parser/FieldParser.php#L81-L99
ptlis/conneg
src/Parser/FieldParser.php
FieldParser.splitVariantAndParamTokens
private function splitVariantAndParamTokens(array $tokenBundle, $fromField) { if (PreferenceInterface::MIME === $fromField) { $this->validateBundleMimeVariant($tokenBundle); $variantTokenList = array_slice($tokenBundle, 0, 3); $paramTokenList = array_slice($tokenBundle, 3...
php
private function splitVariantAndParamTokens(array $tokenBundle, $fromField) { if (PreferenceInterface::MIME === $fromField) { $this->validateBundleMimeVariant($tokenBundle); $variantTokenList = array_slice($tokenBundle, 0, 3); $paramTokenList = array_slice($tokenBundle, 3...
[ "private", "function", "splitVariantAndParamTokens", "(", "array", "$", "tokenBundle", ",", "$", "fromField", ")", "{", "if", "(", "PreferenceInterface", "::", "MIME", "===", "$", "fromField", ")", "{", "$", "this", "->", "validateBundleMimeVariant", "(", "$", ...
Splits the token list into variant & parameter arrays. @throws InvalidVariantException @param array<string> $tokenBundle @param string $fromField @return string[][]
[ "Splits", "the", "token", "list", "into", "variant", "&", "parameter", "arrays", "." ]
train
https://github.com/ptlis/conneg/blob/04afb568f368ecdd81c13277006c4be041ccb58b/src/Parser/FieldParser.php#L111-L123
ptlis/conneg
src/Parser/FieldParser.php
FieldParser.createPreference
private function createPreference(array $variantTokenList, array $paramBundleList, $serverField, $fromField) { $builder = $this->getBuilder($fromField) ->setFromField($fromField) ->setFromServer($serverField) ->setVariant(implode('', $variantTokenList)); // Look ...
php
private function createPreference(array $variantTokenList, array $paramBundleList, $serverField, $fromField) { $builder = $this->getBuilder($fromField) ->setFromField($fromField) ->setFromServer($serverField) ->setVariant(implode('', $variantTokenList)); // Look ...
[ "private", "function", "createPreference", "(", "array", "$", "variantTokenList", ",", "array", "$", "paramBundleList", ",", "$", "serverField", ",", "$", "fromField", ")", "{", "$", "builder", "=", "$", "this", "->", "getBuilder", "(", "$", "fromField", ")"...
Accepts the bundled tokens for variant & parameter data and builds the Preference value object. @param array<string> $variantTokenList @param array<array<string>> $paramBundleList @param bool $serverField @param string $fromField @return PreferenceInterface
[ "Accepts", "the", "bundled", "tokens", "for", "variant", "&", "parameter", "data", "and", "builds", "the", "Preference", "value", "object", "." ]
train
https://github.com/ptlis/conneg/blob/04afb568f368ecdd81c13277006c4be041ccb58b/src/Parser/FieldParser.php#L135-L152
ptlis/conneg
src/Parser/FieldParser.php
FieldParser.bundleTokens
private function bundleTokens(array $tokenList, $targetToken) { $bundleList = array(); $bundle = array(); foreach ($tokenList as $token) { // On token match add the bundle to list & re-initialize empty bundle if ($targetToken === $token) { $bundleList...
php
private function bundleTokens(array $tokenList, $targetToken) { $bundleList = array(); $bundle = array(); foreach ($tokenList as $token) { // On token match add the bundle to list & re-initialize empty bundle if ($targetToken === $token) { $bundleList...
[ "private", "function", "bundleTokens", "(", "array", "$", "tokenList", ",", "$", "targetToken", ")", "{", "$", "bundleList", "=", "array", "(", ")", ";", "$", "bundle", "=", "array", "(", ")", ";", "foreach", "(", "$", "tokenList", "as", "$", "token", ...
Splits token list up into one bundle per variant for later processing. @param array<string> $tokenList @param string $targetToken The token to split the list up by. @return array<array<string>> an array of arrays - the child array contains the tokens for a single variant.
[ "Splits", "token", "list", "up", "into", "one", "bundle", "per", "variant", "for", "later", "processing", "." ]
train
https://github.com/ptlis/conneg/blob/04afb568f368ecdd81c13277006c4be041ccb58b/src/Parser/FieldParser.php#L176-L200
ptlis/conneg
src/Parser/FieldParser.php
FieldParser.validateBundleMimeVariant
private function validateBundleMimeVariant(array $bundle) { if (count($bundle) < 3 // Too few items in bundle || Tokens::MIME_SEPARATOR !== $bundle[1] // Invalid separator || Tokens::isSeparator($bundle[0], true) // Invalid type || Tokens::i...
php
private function validateBundleMimeVariant(array $bundle) { if (count($bundle) < 3 // Too few items in bundle || Tokens::MIME_SEPARATOR !== $bundle[1] // Invalid separator || Tokens::isSeparator($bundle[0], true) // Invalid type || Tokens::i...
[ "private", "function", "validateBundleMimeVariant", "(", "array", "$", "bundle", ")", "{", "if", "(", "count", "(", "$", "bundle", ")", "<", "3", "// Too few items in bundle", "||", "Tokens", "::", "MIME_SEPARATOR", "!==", "$", "bundle", "[", "1", "]", "// I...
Checks to see if the bundle is valid for a mime type, if an anomaly is detected then an exception is thrown. @throws InvalidVariantException @param array<string> $bundle
[ "Checks", "to", "see", "if", "the", "bundle", "is", "valid", "for", "a", "mime", "type", "if", "an", "anomaly", "is", "detected", "then", "an", "exception", "is", "thrown", "." ]
train
https://github.com/ptlis/conneg/blob/04afb568f368ecdd81c13277006c4be041ccb58b/src/Parser/FieldParser.php#L209-L220
ptlis/conneg
src/Parser/FieldParser.php
FieldParser.validateParamBundleList
private function validateParamBundleList(array $paramBundleList, $serverField) { foreach ($paramBundleList as $paramBundle) { try { $this->validateParamBundle($paramBundle); } catch (InvalidVariantException $e) { // Rethrow exception only if the field ...
php
private function validateParamBundleList(array $paramBundleList, $serverField) { foreach ($paramBundleList as $paramBundle) { try { $this->validateParamBundle($paramBundle); } catch (InvalidVariantException $e) { // Rethrow exception only if the field ...
[ "private", "function", "validateParamBundleList", "(", "array", "$", "paramBundleList", ",", "$", "serverField", ")", "{", "foreach", "(", "$", "paramBundleList", "as", "$", "paramBundle", ")", "{", "try", "{", "$", "this", "->", "validateParamBundle", "(", "$...
Checks to see if the parameters are correctly formed, if an anomaly is detected then an exception is thrown. @throws InvalidVariantException @param array<array<string>> $paramBundleList @param bool $serverField If true the field came from the server & we error on malformed data otherwise we suppress errors for cl...
[ "Checks", "to", "see", "if", "the", "parameters", "are", "correctly", "formed", "if", "an", "anomaly", "is", "detected", "then", "an", "exception", "is", "thrown", "." ]
train
https://github.com/ptlis/conneg/blob/04afb568f368ecdd81c13277006c4be041ccb58b/src/Parser/FieldParser.php#L231-L243
TypistTech/cloudflare-wp-api
src/Api.php
Api.request
protected function request($path, array $data = null, $method = null) { $authError = $this->authenticationError(); if (null !== $authError) { return $authError; } $url = 'https://api.cloudflare.com/client/v4/' . $path; $args = $this->prepareRequestArguments($dat...
php
protected function request($path, array $data = null, $method = null) { $authError = $this->authenticationError(); if (null !== $authError) { return $authError; } $url = 'https://api.cloudflare.com/client/v4/' . $path; $args = $this->prepareRequestArguments($dat...
[ "protected", "function", "request", "(", "$", "path", ",", "array", "$", "data", "=", "null", ",", "$", "method", "=", "null", ")", "{", "$", "authError", "=", "$", "this", "->", "authenticationError", "(", ")", ";", "if", "(", "null", "!==", "$", ...
API call method for sending requests via wp_remote_request. @param string $path Path of the endpoint. @param array|null $data Data to be sent along with the request. @param string|null $method Type of method that should be used ('GET', 'POST', 'PUT', 'DELETE', 'PATCH'). @return array|WP_Error
[ "API", "call", "method", "for", "sending", "requests", "via", "wp_remote_request", "." ]
train
https://github.com/TypistTech/cloudflare-wp-api/blob/e25f1f0d7cec1dc54e3b0fc4fc770742299fc98b/src/Api.php#L34-L51
TypistTech/cloudflare-wp-api
src/Api.php
Api.authenticationError
private function authenticationError() { if (empty($this->email) || empty($this->auth_key)) { return new WP_Error('authentication-error', 'Authentication information must be provided'); } if (! is_email($this->email)) { return new WP_Error('authentication-error', 'Em...
php
private function authenticationError() { if (empty($this->email) || empty($this->auth_key)) { return new WP_Error('authentication-error', 'Authentication information must be provided'); } if (! is_email($this->email)) { return new WP_Error('authentication-error', 'Em...
[ "private", "function", "authenticationError", "(", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "email", ")", "||", "empty", "(", "$", "this", "->", "auth_key", ")", ")", "{", "return", "new", "WP_Error", "(", "'authentication-error'", ",", "'Au...
Return WP Error if this object does not contain necessary info to perform API requests. @return null|WP_Error
[ "Return", "WP", "Error", "if", "this", "object", "does", "not", "contain", "necessary", "info", "to", "perform", "API", "requests", "." ]
train
https://github.com/TypistTech/cloudflare-wp-api/blob/e25f1f0d7cec1dc54e3b0fc4fc770742299fc98b/src/Api.php#L58-L69
TypistTech/cloudflare-wp-api
src/Api.php
Api.prepareRequestArguments
private function prepareRequestArguments(array $data = null, string $method = null): array { $data = $data ?? []; $method = $method ?? 'GET'; // Removes null entries. $data = array_filter($data, function ($val) { return (null !== $val); }); $headers = ...
php
private function prepareRequestArguments(array $data = null, string $method = null): array { $data = $data ?? []; $method = $method ?? 'GET'; // Removes null entries. $data = array_filter($data, function ($val) { return (null !== $val); }); $headers = ...
[ "private", "function", "prepareRequestArguments", "(", "array", "$", "data", "=", "null", ",", "string", "$", "method", "=", "null", ")", ":", "array", "{", "$", "data", "=", "$", "data", "??", "[", "]", ";", "$", "method", "=", "$", "method", "??", ...
Prepare arguments for wp_remote_request. @param array|null $data Data to be sent along with the request. @param string|null $method Type of method that should be used ('GET', 'POST', 'PUT', 'DELETE', 'PATCH'). @return array
[ "Prepare", "arguments", "for", "wp_remote_request", "." ]
train
https://github.com/TypistTech/cloudflare-wp-api/blob/e25f1f0d7cec1dc54e3b0fc4fc770742299fc98b/src/Api.php#L79-L103
TypistTech/cloudflare-wp-api
src/Api.php
Api.decode
private function decode(array $response) { $decodedBody = json_decode($response['body'], true); if (null === $decodedBody) { return new WP_Error('decode-error', 'Unable to decode response body', $response); } if (true !== $decodedBody['success']) { return $t...
php
private function decode(array $response) { $decodedBody = json_decode($response['body'], true); if (null === $decodedBody) { return new WP_Error('decode-error', 'Unable to decode response body', $response); } if (true !== $decodedBody['success']) { return $t...
[ "private", "function", "decode", "(", "array", "$", "response", ")", "{", "$", "decodedBody", "=", "json_decode", "(", "$", "response", "[", "'body'", "]", ",", "true", ")", ";", "if", "(", "null", "===", "$", "decodedBody", ")", "{", "return", "new", ...
Decode Cloudflare response. @param array $response The response from Cloudflare. @return array|WP_Error
[ "Decode", "Cloudflare", "response", "." ]
train
https://github.com/TypistTech/cloudflare-wp-api/blob/e25f1f0d7cec1dc54e3b0fc4fc770742299fc98b/src/Api.php#L112-L125
TypistTech/cloudflare-wp-api
src/Api.php
Api.wpErrorFor
private function wpErrorFor(array $errors, array $response): WP_Error { $wpError = new WP_Error; foreach ($errors as $error) { $wpError->add($error['code'], $error['message'], $response); } return $wpError; }
php
private function wpErrorFor(array $errors, array $response): WP_Error { $wpError = new WP_Error; foreach ($errors as $error) { $wpError->add($error['code'], $error['message'], $response); } return $wpError; }
[ "private", "function", "wpErrorFor", "(", "array", "$", "errors", ",", "array", "$", "response", ")", ":", "WP_Error", "{", "$", "wpError", "=", "new", "WP_Error", ";", "foreach", "(", "$", "errors", "as", "$", "error", ")", "{", "$", "wpError", "->", ...
Decode Cloudflare error messages to WP Error. @param array $errors The error messages from Cloudflare. @param array $response The full response from Cloudflare. @return WP_Error
[ "Decode", "Cloudflare", "error", "messages", "to", "WP", "Error", "." ]
train
https://github.com/TypistTech/cloudflare-wp-api/blob/e25f1f0d7cec1dc54e3b0fc4fc770742299fc98b/src/Api.php#L135-L143
iP1SMS/ip1-php-sdk
src/Recipient/ProcessedBlacklistEntry.php
ProcessedBlacklistEntry.jsonSerialize
public function jsonSerialize(): array { $array = parent::jsonSerialize(); $array['ID'] = $this->blacklistEntryID; $array['Created'] = isset($this->created) ? $this->created->format("Y-m-d\TH:i:s."). substr($this->updated->format('u'), 0, 3) : null; return array_filter($...
php
public function jsonSerialize(): array { $array = parent::jsonSerialize(); $array['ID'] = $this->blacklistEntryID; $array['Created'] = isset($this->created) ? $this->created->format("Y-m-d\TH:i:s."). substr($this->updated->format('u'), 0, 3) : null; return array_filter($...
[ "public", "function", "jsonSerialize", "(", ")", ":", "array", "{", "$", "array", "=", "parent", "::", "jsonSerialize", "(", ")", ";", "$", "array", "[", "'ID'", "]", "=", "$", "this", "->", "blacklistEntryID", ";", "$", "array", "[", "'Created'", "]",...
Serializes the object to a value that can be serialized natively by json_encode(). @return array Associative. @link http://php.net/manual/en/jsonserializable.jsonserialize.php
[ "Serializes", "the", "object", "to", "a", "value", "that", "can", "be", "serialized", "natively", "by", "json_encode", "()", "." ]
train
https://github.com/iP1SMS/ip1-php-sdk/blob/348e6572a279363ba689c9e0f5689b83a25930f5/src/Recipient/ProcessedBlacklistEntry.php#L69-L76
mwr/robo-deployer
src/Task/AbstractTask.php
AbstractTask.getCommand
public function getCommand() { if (!isset($this->ansi) && $this->getConfig()->isDecorated()) { $this->ansi(); } $this->option($this->ansi); return "{$this->command} {$this->action}{$this->arguments}"; }
php
public function getCommand() { if (!isset($this->ansi) && $this->getConfig()->isDecorated()) { $this->ansi(); } $this->option($this->ansi); return "{$this->command} {$this->action}{$this->arguments}"; }
[ "public", "function", "getCommand", "(", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "ansi", ")", "&&", "$", "this", "->", "getConfig", "(", ")", "->", "isDecorated", "(", ")", ")", "{", "$", "this", "->", "ansi", "(", ")", ";", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/mwr/robo-deployer/blob/9929c1d664c93042487f24048f20a486f756a393/src/Task/AbstractTask.php#L47-L55
mimmi20/Wurfl
src/Handlers/SmartTVHandler.php
SmartTVHandler.applyRecoveryMatch
public function applyRecoveryMatch($userAgent) { if (Utils::checkIfContains($userAgent, 'SmartTV')) { return 'generic_smarttv_browser'; } if (Utils::checkIfContains($userAgent, 'GoogleTV')) { return 'generic_smarttv_googletv_browser'; } if (Utils::ch...
php
public function applyRecoveryMatch($userAgent) { if (Utils::checkIfContains($userAgent, 'SmartTV')) { return 'generic_smarttv_browser'; } if (Utils::checkIfContains($userAgent, 'GoogleTV')) { return 'generic_smarttv_googletv_browser'; } if (Utils::ch...
[ "public", "function", "applyRecoveryMatch", "(", "$", "userAgent", ")", "{", "if", "(", "Utils", "::", "checkIfContains", "(", "$", "userAgent", ",", "'SmartTV'", ")", ")", "{", "return", "'generic_smarttv_browser'", ";", "}", "if", "(", "Utils", "::", "chec...
@param string $userAgent @return string
[ "@param", "string", "$userAgent" ]
train
https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/SmartTVHandler.php#L69-L92
dekuan/delib
src/CEnv.php
CEnv.GetEnvType
static function GetEnvType() { // // RETURN - environment type // 0 - production // 1 - pre-production // 2 - development // 3 - local // 4 - test // if ( ! is_array( $_SERVER ) || ! array_key_exists( 'SERVER_NAME', $_SERVER ) || ! is_string( $_SERVER[ 'SERVER_NAME' ] ) || empty( $_SERV...
php
static function GetEnvType() { // // RETURN - environment type // 0 - production // 1 - pre-production // 2 - development // 3 - local // 4 - test // if ( ! is_array( $_SERVER ) || ! array_key_exists( 'SERVER_NAME', $_SERVER ) || ! is_string( $_SERVER[ 'SERVER_NAME' ] ) || empty( $_SERV...
[ "static", "function", "GetEnvType", "(", ")", "{", "//", "//\tRETURN\t- environment type", "//\t\t0\t- production", "//\t\t1\t- pre-production", "//\t\t2\t- development", "//\t\t3\t- local", "//\t\t4\t- test", "//", "if", "(", "!", "is_array", "(", "$", "_SERVER", ")", "|...
get environment type @return int
[ "get", "environment", "type" ]
train
https://github.com/dekuan/delib/blob/a0b82c5f1eb0cf7379eac3670ebf362787a7c6f8/src/CEnv.php#L27-L92
dekuan/delib
src/CEnv.php
CEnv.IsSecureHttp
static function IsSecureHttp() { return ( CLib::IsArrayWithKeys( $_SERVER, 'HTTPS' ) && CLib::IsExistingString( $_SERVER[ 'HTTPS' ] ) && ( 0 == strcasecmp( 'ON', $_SERVER[ 'HTTPS' ] ) || 0 == strcasecmp( '1', $_SERVER[ 'HTTPS' ] ) ) ); }
php
static function IsSecureHttp() { return ( CLib::IsArrayWithKeys( $_SERVER, 'HTTPS' ) && CLib::IsExistingString( $_SERVER[ 'HTTPS' ] ) && ( 0 == strcasecmp( 'ON', $_SERVER[ 'HTTPS' ] ) || 0 == strcasecmp( '1', $_SERVER[ 'HTTPS' ] ) ) ); }
[ "static", "function", "IsSecureHttp", "(", ")", "{", "return", "(", "CLib", "::", "IsArrayWithKeys", "(", "$", "_SERVER", ",", "'HTTPS'", ")", "&&", "CLib", "::", "IsExistingString", "(", "$", "_SERVER", "[", "'HTTPS'", "]", ")", "&&", "(", "0", "==", ...
detect if the protocol of current request is secure @return boolean
[ "detect", "if", "the", "protocol", "of", "current", "request", "is", "secure" ]
train
https://github.com/dekuan/delib/blob/a0b82c5f1eb0cf7379eac3670ebf362787a7c6f8/src/CEnv.php#L99-L107
todstoychev/icr
src/Manipulator/Scale.php
Scale.manipulate
public function manipulate(AbstractImage $image, $width, $height) { $this->box->setHeight($height) ->setWidth($width); return $image->resize($this->box); }
php
public function manipulate(AbstractImage $image, $width, $height) { $this->box->setHeight($height) ->setWidth($width); return $image->resize($this->box); }
[ "public", "function", "manipulate", "(", "AbstractImage", "$", "image", ",", "$", "width", ",", "$", "height", ")", "{", "$", "this", "->", "box", "->", "setHeight", "(", "$", "height", ")", "->", "setWidth", "(", "$", "width", ")", ";", "return", "$...
{@inheritdoc}
[ "{" ]
train
https://github.com/todstoychev/icr/blob/0214c7bc76e44488e98758d55deb707b72e24000/src/Manipulator/Scale.php#L18-L24
christophe-brachet/aspi-framework
src/Framework/Form/Element/RadioSet.php
RadioSet.setRadioAttribute
public function setRadioAttribute($a, $v) { foreach ($this->radios as $radio) { $radio->setAttribute($a, $v); if ($a == 'tabindex') { $v++; } } return $this; }
php
public function setRadioAttribute($a, $v) { foreach ($this->radios as $radio) { $radio->setAttribute($a, $v); if ($a == 'tabindex') { $v++; } } return $this; }
[ "public", "function", "setRadioAttribute", "(", "$", "a", ",", "$", "v", ")", "{", "foreach", "(", "$", "this", "->", "radios", "as", "$", "radio", ")", "{", "$", "radio", "->", "setAttribute", "(", "$", "a", ",", "$", "v", ")", ";", "if", "(", ...
Set an attribute for the input radio elements @param string $a @param string $v @return Child
[ "Set", "an", "attribute", "for", "the", "input", "radio", "elements" ]
train
https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Form/Element/RadioSet.php#L96-L105
christophe-brachet/aspi-framework
src/Framework/Form/Element/RadioSet.php
RadioSet.setRadioAttributes
public function setRadioAttributes(array $a) { foreach ($this->radios as $radio) { $radio->setAttributes($a); if (isset($a['tabindex'])) { $a['tabindex']++; } } return $this; }
php
public function setRadioAttributes(array $a) { foreach ($this->radios as $radio) { $radio->setAttributes($a); if (isset($a['tabindex'])) { $a['tabindex']++; } } return $this; }
[ "public", "function", "setRadioAttributes", "(", "array", "$", "a", ")", "{", "foreach", "(", "$", "this", "->", "radios", "as", "$", "radio", ")", "{", "$", "radio", "->", "setAttributes", "(", "$", "a", ")", ";", "if", "(", "isset", "(", "$", "a"...
Set an attribute or attributes for the input radio elements @param array $a @return Child
[ "Set", "an", "attribute", "or", "attributes", "for", "the", "input", "radio", "elements" ]
train
https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Form/Element/RadioSet.php#L112-L121
christophe-brachet/aspi-framework
src/Framework/Form/Element/RadioSet.php
RadioSet.setValue
public function setValue($value) { $this->checked = $value; if ((null !== $this->checked) && ($this->hasChildren())) { foreach ($this->childNodes as $child) { if ($child instanceof Input\Radio) { if ($child->getValue() == $this->checked) { ...
php
public function setValue($value) { $this->checked = $value; if ((null !== $this->checked) && ($this->hasChildren())) { foreach ($this->childNodes as $child) { if ($child instanceof Input\Radio) { if ($child->getValue() == $this->checked) { ...
[ "public", "function", "setValue", "(", "$", "value", ")", "{", "$", "this", "->", "checked", "=", "$", "value", ";", "if", "(", "(", "null", "!==", "$", "this", "->", "checked", ")", "&&", "(", "$", "this", "->", "hasChildren", "(", ")", ")", ")"...
Set the checked value of the radio form elements @param mixed $value @return RadioSet
[ "Set", "the", "checked", "value", "of", "the", "radio", "form", "elements" ]
train
https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Form/Element/RadioSet.php#L128-L143
christophe-brachet/aspi-framework
src/Framework/Form/Element/RadioSet.php
RadioSet.resetValue
public function resetValue() { $this->checked = null; foreach ($this->childNodes as $child) { if ($child instanceof Input\Radio) { $child->uncheck(); } } return $this; }
php
public function resetValue() { $this->checked = null; foreach ($this->childNodes as $child) { if ($child instanceof Input\Radio) { $child->uncheck(); } } return $this; }
[ "public", "function", "resetValue", "(", ")", "{", "$", "this", "->", "checked", "=", "null", ";", "foreach", "(", "$", "this", "->", "childNodes", "as", "$", "child", ")", "{", "if", "(", "$", "child", "instanceof", "Input", "\\", "Radio", ")", "{",...
Reset the value of the form element @return RadioSet
[ "Reset", "the", "value", "of", "the", "form", "element" ]
train
https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Form/Element/RadioSet.php#L149-L158
granulephp/util
lib/Map/HashMap.php
HashMap.offsetGet
public function offsetGet($offset) { TypeHelper::validateKey($offset, $this); return $this->values[$this->getKeyHash($offset)]; }
php
public function offsetGet($offset) { TypeHelper::validateKey($offset, $this); return $this->values[$this->getKeyHash($offset)]; }
[ "public", "function", "offsetGet", "(", "$", "offset", ")", "{", "TypeHelper", "::", "validateKey", "(", "$", "offset", ",", "$", "this", ")", ";", "return", "$", "this", "->", "values", "[", "$", "this", "->", "getKeyHash", "(", "$", "offset", ")", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/granulephp/util/blob/8dcac627fbf9cf5e4219b6dec8ba8ad7c0a3186e/lib/Map/HashMap.php#L95-L99
granulephp/util
lib/Map/HashMap.php
HashMap.filter
public function filter(callable $filter): Map { $builder = static::builder(); foreach ($this as $key => $element) { if ($filter($element, $key)) { $builder->add($key, $element); } } return $builder->build(); }
php
public function filter(callable $filter): Map { $builder = static::builder(); foreach ($this as $key => $element) { if ($filter($element, $key)) { $builder->add($key, $element); } } return $builder->build(); }
[ "public", "function", "filter", "(", "callable", "$", "filter", ")", ":", "Map", "{", "$", "builder", "=", "static", "::", "builder", "(", ")", ";", "foreach", "(", "$", "this", "as", "$", "key", "=>", "$", "element", ")", "{", "if", "(", "$", "f...
{@inheritdoc}
[ "{" ]
train
https://github.com/granulephp/util/blob/8dcac627fbf9cf5e4219b6dec8ba8ad7c0a3186e/lib/Map/HashMap.php#L132-L141
granulephp/util
lib/Map/HashMap.php
HashMap.get
public function get($key) { TypeHelper::validateKey($key, $this); $hash = $this->getKeyHash($key); return array_key_exists( $hash, $this->values ) ? $this->values[$hash] : null; }
php
public function get($key) { TypeHelper::validateKey($key, $this); $hash = $this->getKeyHash($key); return array_key_exists( $hash, $this->values ) ? $this->values[$hash] : null; }
[ "public", "function", "get", "(", "$", "key", ")", "{", "TypeHelper", "::", "validateKey", "(", "$", "key", ",", "$", "this", ")", ";", "$", "hash", "=", "$", "this", "->", "getKeyHash", "(", "$", "key", ")", ";", "return", "array_key_exists", "(", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/granulephp/util/blob/8dcac627fbf9cf5e4219b6dec8ba8ad7c0a3186e/lib/Map/HashMap.php#L144-L152
granulephp/util
lib/Map/HashMap.php
HashMap.getOrDefault
public function getOrDefault($key, $defaultValue) { TypeHelper::validateKey($key, $this); TypeHelper::validateValue($defaultValue, $this); return $this->get($key) ?: $defaultValue; }
php
public function getOrDefault($key, $defaultValue) { TypeHelper::validateKey($key, $this); TypeHelper::validateValue($defaultValue, $this); return $this->get($key) ?: $defaultValue; }
[ "public", "function", "getOrDefault", "(", "$", "key", ",", "$", "defaultValue", ")", "{", "TypeHelper", "::", "validateKey", "(", "$", "key", ",", "$", "this", ")", ";", "TypeHelper", "::", "validateValue", "(", "$", "defaultValue", ",", "$", "this", ")...
{@inheritdoc}
[ "{" ]
train
https://github.com/granulephp/util/blob/8dcac627fbf9cf5e4219b6dec8ba8ad7c0a3186e/lib/Map/HashMap.php#L155-L160
markwatkinson/luminous
src/Luminous/Scanners/ErlangScanner.php
ErlangScanner.buildBasedIntRegex
public static function buildBasedIntRegex($base) { assert(2 <= $base && $base <= 16); $regex = '/(?i:[0-'; if ($base <= 10) { $regex .= (string)$base-1; } else { $regex .= '9a-' . strtolower(dechex($base-1)); } $regex .= '])+/'; return ...
php
public static function buildBasedIntRegex($base) { assert(2 <= $base && $base <= 16); $regex = '/(?i:[0-'; if ($base <= 10) { $regex .= (string)$base-1; } else { $regex .= '9a-' . strtolower(dechex($base-1)); } $regex .= '])+/'; return ...
[ "public", "static", "function", "buildBasedIntRegex", "(", "$", "base", ")", "{", "assert", "(", "2", "<=", "$", "base", "&&", "$", "base", "<=", "16", ")", ";", "$", "regex", "=", "'/(?i:[0-'", ";", "if", "(", "$", "base", "<=", "10", ")", "{", ...
in the given base
[ "in", "the", "given", "base" ]
train
https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Scanners/ErlangScanner.php#L31-L42
markwatkinson/luminous
src/Luminous/Scanners/ErlangScanner.php
ErlangScanner.basedInt
public function basedInt($matches) { $base = $matches[1]; $match = $matches[0]; $this->posShift(strlen($matches[0])); $number = null; if ($base >= 2 && $base <= 16) { $number = $this->scan($this->buildBasedIntRegex((int)$base)); } if ($number !== n...
php
public function basedInt($matches) { $base = $matches[1]; $match = $matches[0]; $this->posShift(strlen($matches[0])); $number = null; if ($base >= 2 && $base <= 16) { $number = $this->scan($this->buildBasedIntRegex((int)$base)); } if ($number !== n...
[ "public", "function", "basedInt", "(", "$", "matches", ")", "{", "$", "base", "=", "$", "matches", "[", "1", "]", ";", "$", "match", "=", "$", "matches", "[", "0", "]", ";", "$", "this", "->", "posShift", "(", "strlen", "(", "$", "matches", "[", ...
2 ><= b <= 16 arbitrarily.
[ "2", ">", "<", "=", "b", "<", "=", "16", "arbitrarily", "." ]
train
https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Scanners/ErlangScanner.php#L46-L67
hannesvdvreken/msgpack
src/Decoder.php
Decoder.decode
public static function decode($string, $assoc = true) { $result = self::decodeRecursive($string, $assoc); return $result[0]; }
php
public static function decode($string, $assoc = true) { $result = self::decodeRecursive($string, $assoc); return $result[0]; }
[ "public", "static", "function", "decode", "(", "$", "string", ",", "$", "assoc", "=", "true", ")", "{", "$", "result", "=", "self", "::", "decodeRecursive", "(", "$", "string", ",", "$", "assoc", ")", ";", "return", "$", "result", "[", "0", "]", ";...
@param string $string @param bool $assoc @throws UndecodeableException @return mixed
[ "@param", "string", "$string", "@param", "bool", "$assoc" ]
train
https://github.com/hannesvdvreken/msgpack/blob/8ff24533419b96acfcccacd2ab7f1d7d2e1668dc/src/Decoder.php#L31-L35
hannesvdvreken/msgpack
src/Decoder.php
Decoder.decodeRecursive
public static function decodeRecursive($string, $assoc = false) { list($firstHex, $firstOctal) = self::analyzeFirstChar($string[0]); switch (true) { case $firstOctal === '8': // fixmap 1000xxxx case $firstHex === 'de': // map 16 case $firstHex === 'df': // map 32...
php
public static function decodeRecursive($string, $assoc = false) { list($firstHex, $firstOctal) = self::analyzeFirstChar($string[0]); switch (true) { case $firstOctal === '8': // fixmap 1000xxxx case $firstHex === 'de': // map 16 case $firstHex === 'df': // map 32...
[ "public", "static", "function", "decodeRecursive", "(", "$", "string", ",", "$", "assoc", "=", "false", ")", "{", "list", "(", "$", "firstHex", ",", "$", "firstOctal", ")", "=", "self", "::", "analyzeFirstChar", "(", "$", "string", "[", "0", "]", ")", ...
@param string $string @param bool $assoc @return array @throws UndecodeableException
[ "@param", "string", "$string", "@param", "bool", "$assoc" ]
train
https://github.com/hannesvdvreken/msgpack/blob/8ff24533419b96acfcccacd2ab7f1d7d2e1668dc/src/Decoder.php#L44-L82
hannesvdvreken/msgpack
src/Decoder.php
Decoder.decodeMap
private static function decodeMap($string, $assoc) { $size = 0; $offset = 1; list($firstHex, $firstOctal) = self::analyzeFirstChar($string[0]); if ($firstOctal === '8') { // fixmap 1000xxxx $size = hexdec($firstHex) - bindec('10000000'); $offset =...
php
private static function decodeMap($string, $assoc) { $size = 0; $offset = 1; list($firstHex, $firstOctal) = self::analyzeFirstChar($string[0]); if ($firstOctal === '8') { // fixmap 1000xxxx $size = hexdec($firstHex) - bindec('10000000'); $offset =...
[ "private", "static", "function", "decodeMap", "(", "$", "string", ",", "$", "assoc", ")", "{", "$", "size", "=", "0", ";", "$", "offset", "=", "1", ";", "list", "(", "$", "firstHex", ",", "$", "firstOctal", ")", "=", "self", "::", "analyzeFirstChar",...
@param $string @param $assoc @return array|stdClass @throws UndecodeableException
[ "@param", "$string", "@param", "$assoc" ]
train
https://github.com/hannesvdvreken/msgpack/blob/8ff24533419b96acfcccacd2ab7f1d7d2e1668dc/src/Decoder.php#L91-L137
hannesvdvreken/msgpack
src/Decoder.php
Decoder.decodeArray
private static function decodeArray($string, $assoc) { // Start empty. $arr = array(); $size = 0; $offset = 1; // Get some information on the first byte. list($firstHex, $firstOctal) = self::analyzeFirstChar($string[0]); if ($firstOctal === '9') { ...
php
private static function decodeArray($string, $assoc) { // Start empty. $arr = array(); $size = 0; $offset = 1; // Get some information on the first byte. list($firstHex, $firstOctal) = self::analyzeFirstChar($string[0]); if ($firstOctal === '9') { ...
[ "private", "static", "function", "decodeArray", "(", "$", "string", ",", "$", "assoc", ")", "{", "// Start empty.", "$", "arr", "=", "array", "(", ")", ";", "$", "size", "=", "0", ";", "$", "offset", "=", "1", ";", "// Get some information on the first byt...
@param $string @param $assoc @return array @throws UndecodeableException
[ "@param", "$string", "@param", "$assoc" ]
train
https://github.com/hannesvdvreken/msgpack/blob/8ff24533419b96acfcccacd2ab7f1d7d2e1668dc/src/Decoder.php#L146-L181
hannesvdvreken/msgpack
src/Decoder.php
Decoder.decodeInt
private static function decodeInt($string) { // Get info on the first char. list($firstHex, $firstOctal) = self::analyzeFirstChar($string[0]); if (hexdec($firstHex) < pow(2, 7)) { // fixint 0xxxxxxx $int = hexdec($firstHex); return array($int, substr($str...
php
private static function decodeInt($string) { // Get info on the first char. list($firstHex, $firstOctal) = self::analyzeFirstChar($string[0]); if (hexdec($firstHex) < pow(2, 7)) { // fixint 0xxxxxxx $int = hexdec($firstHex); return array($int, substr($str...
[ "private", "static", "function", "decodeInt", "(", "$", "string", ")", "{", "// Get info on the first char.", "list", "(", "$", "firstHex", ",", "$", "firstOctal", ")", "=", "self", "::", "analyzeFirstChar", "(", "$", "string", "[", "0", "]", ")", ";", "if...
@param $string @return array
[ "@param", "$string" ]
train
https://github.com/hannesvdvreken/msgpack/blob/8ff24533419b96acfcccacd2ab7f1d7d2e1668dc/src/Decoder.php#L188-L226
hannesvdvreken/msgpack
src/Decoder.php
Decoder.decodeString
private static function decodeString($string) { $size = 0; $offset = 1; // Get some information on the first character. list($firstHex, $firstOctal) = self::analyzeFirstChar($string[0]); if (in_array(hexdec($firstOctal), array(10, 11))) { // fixstr $...
php
private static function decodeString($string) { $size = 0; $offset = 1; // Get some information on the first character. list($firstHex, $firstOctal) = self::analyzeFirstChar($string[0]); if (in_array(hexdec($firstOctal), array(10, 11))) { // fixstr $...
[ "private", "static", "function", "decodeString", "(", "$", "string", ")", "{", "$", "size", "=", "0", ";", "$", "offset", "=", "1", ";", "// Get some information on the first character.", "list", "(", "$", "firstHex", ",", "$", "firstOctal", ")", "=", "self"...
@param $string @return array
[ "@param", "$string" ]
train
https://github.com/hannesvdvreken/msgpack/blob/8ff24533419b96acfcccacd2ab7f1d7d2e1668dc/src/Decoder.php#L233-L266
hannesvdvreken/msgpack
src/Decoder.php
Decoder.analyzeFirstChar
private static function analyzeFirstChar($char) { list(, $firstHex) = unpack('H*', $char); $firstOctal = substr($firstHex, 0, 1); return array($firstHex, $firstOctal); }
php
private static function analyzeFirstChar($char) { list(, $firstHex) = unpack('H*', $char); $firstOctal = substr($firstHex, 0, 1); return array($firstHex, $firstOctal); }
[ "private", "static", "function", "analyzeFirstChar", "(", "$", "char", ")", "{", "list", "(", ",", "$", "firstHex", ")", "=", "unpack", "(", "'H*'", ",", "$", "char", ")", ";", "$", "firstOctal", "=", "substr", "(", "$", "firstHex", ",", "0", ",", ...
@param string $char @return array
[ "@param", "string", "$char" ]
train
https://github.com/hannesvdvreken/msgpack/blob/8ff24533419b96acfcccacd2ab7f1d7d2e1668dc/src/Decoder.php#L273-L279
transfer-framework/transfer
src/Transfer/Processor/EventSubscriber/Logger.php
Logger.getSubscribedEvents
public static function getSubscribedEvents() { return array( TransferEvents::PRE_PROCESS => array('logPreProcessEvent', 0), TransferEvents::POST_PROCESS => array('logPostProcessEvent', 0), TransferEvents::PRE_PROCEDURE => array('logPreProcedureEvent', 0), Tran...
php
public static function getSubscribedEvents() { return array( TransferEvents::PRE_PROCESS => array('logPreProcessEvent', 0), TransferEvents::POST_PROCESS => array('logPostProcessEvent', 0), TransferEvents::PRE_PROCEDURE => array('logPreProcedureEvent', 0), Tran...
[ "public", "static", "function", "getSubscribedEvents", "(", ")", "{", "return", "array", "(", "TransferEvents", "::", "PRE_PROCESS", "=>", "array", "(", "'logPreProcessEvent'", ",", "0", ")", ",", "TransferEvents", "::", "POST_PROCESS", "=>", "array", "(", "'log...
{@inheritdoc}
[ "{" ]
train
https://github.com/transfer-framework/transfer/blob/9225ae068d5924982f14ad4446b15f75384a058a/src/Transfer/Processor/EventSubscriber/Logger.php#L38-L52
transfer-framework/transfer
src/Transfer/Processor/EventSubscriber/Logger.php
Logger.logPreProcedureEvent
public function logPreProcedureEvent(Events\PreProcedureEvent $event) { $procedure = $event->getProcedure(); $this->logger->info(sprintf('Starting procedure "%s"...', $procedure->getName())); }
php
public function logPreProcedureEvent(Events\PreProcedureEvent $event) { $procedure = $event->getProcedure(); $this->logger->info(sprintf('Starting procedure "%s"...', $procedure->getName())); }
[ "public", "function", "logPreProcedureEvent", "(", "Events", "\\", "PreProcedureEvent", "$", "event", ")", "{", "$", "procedure", "=", "$", "event", "->", "getProcedure", "(", ")", ";", "$", "this", "->", "logger", "->", "info", "(", "sprintf", "(", "'Star...
Logs pre procedure event. @param Events\PreProcedureEvent $event
[ "Logs", "pre", "procedure", "event", "." ]
train
https://github.com/transfer-framework/transfer/blob/9225ae068d5924982f14ad4446b15f75384a058a/src/Transfer/Processor/EventSubscriber/Logger.php#L75-L80
transfer-framework/transfer
src/Transfer/Processor/EventSubscriber/Logger.php
Logger.logPostProcedureEvent
public function logPostProcedureEvent(Events\PostProcedureEvent $event) { $procedure = $event->getProcedure(); $this->logger->info(sprintf('Finished procedure "%s"', $procedure->getName())); }
php
public function logPostProcedureEvent(Events\PostProcedureEvent $event) { $procedure = $event->getProcedure(); $this->logger->info(sprintf('Finished procedure "%s"', $procedure->getName())); }
[ "public", "function", "logPostProcedureEvent", "(", "Events", "\\", "PostProcedureEvent", "$", "event", ")", "{", "$", "procedure", "=", "$", "event", "->", "getProcedure", "(", ")", ";", "$", "this", "->", "logger", "->", "info", "(", "sprintf", "(", "'Fi...
Logs post procedure event. @param Events\PostProcedureEvent $event
[ "Logs", "post", "procedure", "event", "." ]
train
https://github.com/transfer-framework/transfer/blob/9225ae068d5924982f14ad4446b15f75384a058a/src/Transfer/Processor/EventSubscriber/Logger.php#L87-L92
transfer-framework/transfer
src/Transfer/Processor/EventSubscriber/Logger.php
Logger.logPostAdapterReceiveEvent
public function logPostAdapterReceiveEvent(Events\PostAdapterReceiveEvent $event) { $source = $event->getSourceAdapter(); $this->logger->info(sprintf('Received data from adapter "%s"', get_class($source))); }
php
public function logPostAdapterReceiveEvent(Events\PostAdapterReceiveEvent $event) { $source = $event->getSourceAdapter(); $this->logger->info(sprintf('Received data from adapter "%s"', get_class($source))); }
[ "public", "function", "logPostAdapterReceiveEvent", "(", "Events", "\\", "PostAdapterReceiveEvent", "$", "event", ")", "{", "$", "source", "=", "$", "event", "->", "getSourceAdapter", "(", ")", ";", "$", "this", "->", "logger", "->", "info", "(", "sprintf", ...
Logs post adapter receive. @param Events\PostAdapterReceiveEvent $event
[ "Logs", "post", "adapter", "receive", "." ]
train
https://github.com/transfer-framework/transfer/blob/9225ae068d5924982f14ad4446b15f75384a058a/src/Transfer/Processor/EventSubscriber/Logger.php#L107-L112
transfer-framework/transfer
src/Transfer/Processor/EventSubscriber/Logger.php
Logger.logPostWorkerEvent
public function logPostWorkerEvent(Events\PostWorkerEvent $event) { $worker = $event->getWorker(); $this->logger->info(sprintf('Worked an object with "%s"', get_class($worker))); }
php
public function logPostWorkerEvent(Events\PostWorkerEvent $event) { $worker = $event->getWorker(); $this->logger->info(sprintf('Worked an object with "%s"', get_class($worker))); }
[ "public", "function", "logPostWorkerEvent", "(", "Events", "\\", "PostWorkerEvent", "$", "event", ")", "{", "$", "worker", "=", "$", "event", "->", "getWorker", "(", ")", ";", "$", "this", "->", "logger", "->", "info", "(", "sprintf", "(", "'Worked an obje...
Logs post worker event. @param Events\PostWorkerEvent $event
[ "Logs", "post", "worker", "event", "." ]
train
https://github.com/transfer-framework/transfer/blob/9225ae068d5924982f14ad4446b15f75384a058a/src/Transfer/Processor/EventSubscriber/Logger.php#L127-L132
transfer-framework/transfer
src/Transfer/Processor/EventSubscriber/Logger.php
Logger.logPostAdapterSendEvent
public function logPostAdapterSendEvent(Events\PostAdapterSendEvent $event) { $target = $event->getTargetAdapter(); $this->logger->info(sprintf('Objects sent to adapter "%s"', get_class($target))); }
php
public function logPostAdapterSendEvent(Events\PostAdapterSendEvent $event) { $target = $event->getTargetAdapter(); $this->logger->info(sprintf('Objects sent to adapter "%s"', get_class($target))); }
[ "public", "function", "logPostAdapterSendEvent", "(", "Events", "\\", "PostAdapterSendEvent", "$", "event", ")", "{", "$", "target", "=", "$", "event", "->", "getTargetAdapter", "(", ")", ";", "$", "this", "->", "logger", "->", "info", "(", "sprintf", "(", ...
Logs post adapter send event. @param Events\PostAdapterSendEvent $event
[ "Logs", "post", "adapter", "send", "event", "." ]
train
https://github.com/transfer-framework/transfer/blob/9225ae068d5924982f14ad4446b15f75384a058a/src/Transfer/Processor/EventSubscriber/Logger.php#L147-L152
Stratadox/ImmutableCollection
src/CannotAlterCollection.php
CannotAlterCollection.byOverWriting
public static function byOverWriting(Collection $collection, int $index): NotAllowed { return new static(sprintf( 'Cannot write to the immutable collection `%s`. ' . '(Tried writing to position %d).', get_class($collection), $index )); }
php
public static function byOverWriting(Collection $collection, int $index): NotAllowed { return new static(sprintf( 'Cannot write to the immutable collection `%s`. ' . '(Tried writing to position %d).', get_class($collection), $index )); }
[ "public", "static", "function", "byOverWriting", "(", "Collection", "$", "collection", ",", "int", "$", "index", ")", ":", "NotAllowed", "{", "return", "new", "static", "(", "sprintf", "(", "'Cannot write to the immutable collection `%s`. '", ".", "'(Tried writing to ...
Indicates that this write operation is not allowed. @param Collection $collection The collection that may not be mutated. @param int $index The index that will not be overwritten. @return NotAllowed The exception object.
[ "Indicates", "that", "this", "write", "operation", "is", "not", "allowed", "." ]
train
https://github.com/Stratadox/ImmutableCollection/blob/eac441bc1762eefda6da25354b4e8f91f48bd733/src/CannotAlterCollection.php#L57-L65
Stratadox/ImmutableCollection
src/CannotAlterCollection.php
CannotAlterCollection.byRemoving
public static function byRemoving(Collection $collection, int $index): NotAllowed { return new static(sprintf( 'Cannot alter the immutable collection `%s`. ' . '(Tried to unset position %d).', get_class($collection), $index )); }
php
public static function byRemoving(Collection $collection, int $index): NotAllowed { return new static(sprintf( 'Cannot alter the immutable collection `%s`. ' . '(Tried to unset position %d).', get_class($collection), $index )); }
[ "public", "static", "function", "byRemoving", "(", "Collection", "$", "collection", ",", "int", "$", "index", ")", ":", "NotAllowed", "{", "return", "new", "static", "(", "sprintf", "(", "'Cannot alter the immutable collection `%s`. '", ".", "'(Tried to unset position...
Indicates that this unset operation is not allowed. @param Collection $collection The collection that may not be mutated. @param int $index The index that will not be removed. @return NotAllowed The exception object.
[ "Indicates", "that", "this", "unset", "operation", "is", "not", "allowed", "." ]
train
https://github.com/Stratadox/ImmutableCollection/blob/eac441bc1762eefda6da25354b4e8f91f48bd733/src/CannotAlterCollection.php#L74-L82
Stratadox/ImmutableCollection
src/CannotAlterCollection.php
CannotAlterCollection.byResizingTo
public static function byResizingTo(Collection $collection, int $size): NotAllowed { return new static(sprintf( 'Cannot directly resize the immutable collection `%s`. ' . '(Tried to resize from %d to %d).', get_class($collection), count($collection), ...
php
public static function byResizingTo(Collection $collection, int $size): NotAllowed { return new static(sprintf( 'Cannot directly resize the immutable collection `%s`. ' . '(Tried to resize from %d to %d).', get_class($collection), count($collection), ...
[ "public", "static", "function", "byResizingTo", "(", "Collection", "$", "collection", ",", "int", "$", "size", ")", ":", "NotAllowed", "{", "return", "new", "static", "(", "sprintf", "(", "'Cannot directly resize the immutable collection `%s`. '", ".", "'(Tried to res...
Indicates that this resize operation is not allowed. @param Collection $collection The collection that may not be mutated. @param int $size The size that will not be assigned. @return NotAllowed The exception object.
[ "Indicates", "that", "this", "resize", "operation", "is", "not", "allowed", "." ]
train
https://github.com/Stratadox/ImmutableCollection/blob/eac441bc1762eefda6da25354b4e8f91f48bd733/src/CannotAlterCollection.php#L91-L100
crysalead/net
src/Mime/Header/Addresses.php
Addresses.offsetSet
public function offsetSet($name, $address) { if (!$address instanceof Address) { $address = new Address($address); } return $this->_data[$address->email()] = $address; }
php
public function offsetSet($name, $address) { if (!$address instanceof Address) { $address = new Address($address); } return $this->_data[$address->email()] = $address; }
[ "public", "function", "offsetSet", "(", "$", "name", ",", "$", "address", ")", "{", "if", "(", "!", "$", "address", "instanceof", "Address", ")", "{", "$", "address", "=", "new", "Address", "(", "$", "address", ")", ";", "}", "return", "$", "this", ...
Assigns a header. @param string $name The header name. @param string $address The header value. @return object The setted value.
[ "Assigns", "a", "header", "." ]
train
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Mime/Header/Addresses.php#L16-L22
markwatkinson/luminous
src/Luminous/Core/Scanners/Scanner.php
Scanner.userDefFilter
protected function userDefFilter($token) { if (isset($this->userDefs[$token[1]])) { $token[0] = $this->userDefs[$token[1]]; } return $token; }
php
protected function userDefFilter($token) { if (isset($this->userDefs[$token[1]])) { $token[0] = $this->userDefs[$token[1]]; } return $token; }
[ "protected", "function", "userDefFilter", "(", "$", "token", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "userDefs", "[", "$", "token", "[", "1", "]", "]", ")", ")", "{", "$", "token", "[", "0", "]", "=", "$", "this", "->", "userDefs", ...
@brief Filter to highlight identifiers whose definitions are in the source maps anything recorded in LuminousScanner::user_defs to the recorded type. This is called as the filter 'user-defs' @internal
[ "@brief", "Filter", "to", "highlight", "identifiers", "whose", "definitions", "are", "in", "the", "source" ]
train
https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Core/Scanners/Scanner.php#L184-L190
markwatkinson/luminous
src/Luminous/Core/Scanners/Scanner.php
Scanner.ruleMapperFilter
protected function ruleMapperFilter($tokens) { foreach ($tokens as &$t) { if (array_key_exists($t[0], $this->ruleTagMap)) { $t[0] = $this->ruleTagMap[$t[0]]; } } return $tokens; }
php
protected function ruleMapperFilter($tokens) { foreach ($tokens as &$t) { if (array_key_exists($t[0], $this->ruleTagMap)) { $t[0] = $this->ruleTagMap[$t[0]]; } } return $tokens; }
[ "protected", "function", "ruleMapperFilter", "(", "$", "tokens", ")", "{", "foreach", "(", "$", "tokens", "as", "&", "$", "t", ")", "{", "if", "(", "array_key_exists", "(", "$", "t", "[", "0", "]", ",", "$", "this", "->", "ruleTagMap", ")", ")", "{...
@brief Rule re-mapper filter Re-maps token rules according to the LuminousScanner::rule_tag_map map. This is called as the filter 'rule-map' @internal
[ "@brief", "Rule", "re", "-", "mapper", "filter" ]
train
https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Core/Scanners/Scanner.php#L200-L208
markwatkinson/luminous
src/Luminous/Core/Scanners/Scanner.php
Scanner.highlight
public function highlight($src) { $this->string($src); $this->init(); $this->main(); return $this->tagged(); }
php
public function highlight($src) { $this->string($src); $this->init(); $this->main(); return $this->tagged(); }
[ "public", "function", "highlight", "(", "$", "src", ")", "{", "$", "this", "->", "string", "(", "$", "src", ")", ";", "$", "this", "->", "init", "(", ")", ";", "$", "this", "->", "main", "(", ")", ";", "return", "$", "this", "->", "tagged", "("...
@brief Public convenience function for setting the string and highlighting it Alias for: $s->string($src) $s->init(); $s->main(); return $s->tagged(); @returns the highlighted string, as an XML string
[ "@brief", "Public", "convenience", "function", "for", "setting", "the", "string", "and", "highlighting", "it" ]
train
https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Core/Scanners/Scanner.php#L221-L227
markwatkinson/luminous
src/Luminous/Core/Scanners/Scanner.php
Scanner.addFilter
public function addFilter($arg1, $arg2, $arg3 = null) { $filter = null; $name = null; $token = null; if ($arg3 === null) { $filter = $arg2; $token = $arg1; } else { $filter = $arg3; $token = $arg2; $name = $arg1; ...
php
public function addFilter($arg1, $arg2, $arg3 = null) { $filter = null; $name = null; $token = null; if ($arg3 === null) { $filter = $arg2; $token = $arg1; } else { $filter = $arg3; $token = $arg2; $name = $arg1; ...
[ "public", "function", "addFilter", "(", "$", "arg1", ",", "$", "arg2", ",", "$", "arg3", "=", "null", ")", "{", "$", "filter", "=", "null", ";", "$", "name", "=", "null", ";", "$", "token", "=", "null", ";", "if", "(", "$", "arg3", "===", "null...
@brief Add an individual token filter Adds an indivdual token filter. The filter is bound to the given token_name. The filter is a callback which should take a token and return a token. The arguments are: [name], token_name, filter Name is an optional argument.
[ "@brief", "Add", "an", "individual", "token", "filter" ]
train
https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Core/Scanners/Scanner.php#L264-L281
markwatkinson/luminous
src/Luminous/Core/Scanners/Scanner.php
Scanner.addStreamFilter
public function addStreamFilter($arg1, $arg2 = null) { $filter = null; $name = null; if ($arg2 === null) { $filter = $arg1; } else { $filter = $arg2; $name = $arg1; } $this->streamFilters[] = array($name, $filter); }
php
public function addStreamFilter($arg1, $arg2 = null) { $filter = null; $name = null; if ($arg2 === null) { $filter = $arg1; } else { $filter = $arg2; $name = $arg1; } $this->streamFilters[] = array($name, $filter); }
[ "public", "function", "addStreamFilter", "(", "$", "arg1", ",", "$", "arg2", "=", "null", ")", "{", "$", "filter", "=", "null", ";", "$", "name", "=", "null", ";", "if", "(", "$", "arg2", "===", "null", ")", "{", "$", "filter", "=", "$", "arg1", ...
@brief Adds a stream filter A stream filter receives the entire token stream and should return it. The parameters are: ([name], filter). Name is an optional argument.
[ "@brief", "Adds", "a", "stream", "filter" ]
train
https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Core/Scanners/Scanner.php#L316-L327
markwatkinson/luminous
src/Luminous/Core/Scanners/Scanner.php
Scanner.recordRange
public function recordRange($from, $to, $type) { if ($to === $from) { return; } if ($to > $from) { $this->record(substr($this->string(), $from, $to - $from), $type); return; } throw new RangeException("Invalid range supplied [$from, $to]");...
php
public function recordRange($from, $to, $type) { if ($to === $from) { return; } if ($to > $from) { $this->record(substr($this->string(), $from, $to - $from), $type); return; } throw new RangeException("Invalid range supplied [$from, $to]");...
[ "public", "function", "recordRange", "(", "$", "from", ",", "$", "to", ",", "$", "type", ")", "{", "if", "(", "$", "to", "===", "$", "from", ")", "{", "return", ";", "}", "if", "(", "$", "to", ">", "$", "from", ")", "{", "$", "this", "->", ...
@brief Helper function to record a range of the string @param $from the start index @param $to the end index @param $type the type of the token This is shorthand for <code> $this->record(substr($this->string(), $from, $to-$from)</code> @throw RangeException if the range is invalid (i.e. $to < $from) An empty range (i...
[ "@brief", "Helper", "function", "to", "record", "a", "range", "of", "the", "string", "@param", "$from", "the", "start", "index", "@param", "$to", "the", "end", "index", "@param", "$type", "the", "type", "of", "the", "token", "This", "is", "shorthand", "for...
train
https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Core/Scanners/Scanner.php#L400-L410
markwatkinson/luminous
src/Luminous/Core/Scanners/Scanner.php
Scanner.tagged
public function tagged() { $out = ''; // call stream filters. foreach ($this->streamFilters as $f) { $this->tokens = call_user_func($f[1], $this->tokens); } foreach ($this->tokens as $t) { $type = $t[0]; // speed is roughly 10% faster if ...
php
public function tagged() { $out = ''; // call stream filters. foreach ($this->streamFilters as $f) { $this->tokens = call_user_func($f[1], $this->tokens); } foreach ($this->tokens as $t) { $type = $t[0]; // speed is roughly 10% faster if ...
[ "public", "function", "tagged", "(", ")", "{", "$", "out", "=", "''", ";", "// call stream filters.", "foreach", "(", "$", "this", "->", "streamFilters", "as", "$", "f", ")", "{", "$", "this", "->", "tokens", "=", "call_user_func", "(", "$", "f", "[", ...
@brief Returns the XML representation of the token stream This function triggers the generation of the XML output. @return An XML-string which represents the tokens recorded by the scanner.
[ "@brief", "Returns", "the", "XML", "representation", "of", "the", "token", "stream" ]
train
https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Core/Scanners/Scanner.php#L418-L448
markwatkinson/luminous
src/Luminous/Core/Scanners/Scanner.php
Scanner.mapIdentifierFilter
public function mapIdentifierFilter($token) { $ident = $token[1]; if (!$this->caseSensitive) { $ident = strtolower($ident); } foreach ($this->identMap as $n => $hits) { if (isset($hits[$ident])) { $token[0] = $n; break; ...
php
public function mapIdentifierFilter($token) { $ident = $token[1]; if (!$this->caseSensitive) { $ident = strtolower($ident); } foreach ($this->identMap as $n => $hits) { if (isset($hits[$ident])) { $token[0] = $n; break; ...
[ "public", "function", "mapIdentifierFilter", "(", "$", "token", ")", "{", "$", "ident", "=", "$", "token", "[", "1", "]", ";", "if", "(", "!", "$", "this", "->", "caseSensitive", ")", "{", "$", "ident", "=", "strtolower", "(", "$", "ident", ")", ";...
@brief Identifier mapping filter Tries to map any 'IDENT' token to a TOKEN_NAME in LuminousScanner::$ident_map This is implemented as the filter 'map-ident'
[ "@brief", "Identifier", "mapping", "filter" ]
train
https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Core/Scanners/Scanner.php#L466-L479
markwatkinson/luminous
src/Luminous/Core/Scanners/Scanner.php
Scanner.addIdentifierMapping
public function addIdentifierMapping($name, $matches) { $array = array(); foreach ($matches as $m) { if (!$this->caseSensitive) { $m = strtolower($m); } $array[$m] = true; } if (!isset($this->identMap[$name])) { $this->i...
php
public function addIdentifierMapping($name, $matches) { $array = array(); foreach ($matches as $m) { if (!$this->caseSensitive) { $m = strtolower($m); } $array[$m] = true; } if (!isset($this->identMap[$name])) { $this->i...
[ "public", "function", "addIdentifierMapping", "(", "$", "name", ",", "$", "matches", ")", "{", "$", "array", "=", "array", "(", ")", ";", "foreach", "(", "$", "matches", "as", "$", "m", ")", "{", "if", "(", "!", "$", "this", "->", "caseSensitive", ...
@brief Adds an identifier mapping which is later analysed by map_identifier_filter @param $name The token name @param $matches an array of identifiers which correspond to this token name, i.e. add_identifier_mapping('KEYWORD', array('if', 'else', ...)); This method observes LuminousScanner::$case_sensitive
[ "@brief", "Adds", "an", "identifier", "mapping", "which", "is", "later", "analysed", "by", "map_identifier_filter", "@param", "$name", "The", "token", "name", "@param", "$matches", "an", "array", "of", "identifiers", "which", "correspond", "to", "this", "token", ...
train
https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Core/Scanners/Scanner.php#L489-L502
markwatkinson/luminous
src/Luminous/Core/Scanners/Scanner.php
Scanner.nestableToken
public function nestableToken($tokenName, $open, $close) { if ($this->check($open) === null) { throw new Exception('Nestable called at a non-matching point'); return; } $patterns = array('open' => $open, 'close' => $close); $stack = 0; $start = $this-...
php
public function nestableToken($tokenName, $open, $close) { if ($this->check($open) === null) { throw new Exception('Nestable called at a non-matching point'); return; } $patterns = array('open' => $open, 'close' => $close); $stack = 0; $start = $this-...
[ "public", "function", "nestableToken", "(", "$", "tokenName", ",", "$", "open", ",", "$", "close", ")", "{", "if", "(", "$", "this", "->", "check", "(", "$", "open", ")", "===", "null", ")", "{", "throw", "new", "Exception", "(", "'Nestable called at a...
@brief Handles tokens that may nest inside themselves Convenience function. It's fairly common for many languages to allow things like nestable comments. Handling these is easy but fairly long winded, so this function will take an opening and closing delimiter and consume the token until it is fully closed, or until t...
[ "@brief", "Handles", "tokens", "that", "may", "nest", "inside", "themselves" ]
train
https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Core/Scanners/Scanner.php#L539-L563
LightboxDigital/wp-dynamic-image-resizer
public/class-dynamic-image-resizer-public.php
Dynamic_Image_Resizer_Public.resize_image
public function resize_image( $downsize = true, $id, $size, $crop = false ) { // Get metadata for attachment (generated sizes stored there). $meta = wp_get_attachment_metadata( $id ); // Get all of the created image sizes (add_image_size()). $sizes = $this->get_sizes(); // If size is not an array fall back o...
php
public function resize_image( $downsize = true, $id, $size, $crop = false ) { // Get metadata for attachment (generated sizes stored there). $meta = wp_get_attachment_metadata( $id ); // Get all of the created image sizes (add_image_size()). $sizes = $this->get_sizes(); // If size is not an array fall back o...
[ "public", "function", "resize_image", "(", "$", "downsize", "=", "true", ",", "$", "id", ",", "$", "size", ",", "$", "crop", "=", "false", ")", "{", "// Get metadata for attachment (generated sizes stored there).", "$", "meta", "=", "wp_get_attachment_metadata", "...
Handle image downsize/resize requests. @since 1.0.0 @param bool $downsize Whether to short-circuit the image downsize. Default true. @param int $id Attachment ID for image. @param array|string $size Size of image, either array or string. Default 'medium'. @param bool $crop Wheth...
[ "Handle", "image", "downsize", "/", "resize", "requests", "." ]
train
https://github.com/LightboxDigital/wp-dynamic-image-resizer/blob/cc1d67192c8463eba4c0920130abec933ed2296b/public/class-dynamic-image-resizer-public.php#L78-L155
LightboxDigital/wp-dynamic-image-resizer
public/class-dynamic-image-resizer-public.php
Dynamic_Image_Resizer_Public.get_sizes
public function get_sizes( $size = '' ) { global $_wp_additional_image_sizes; $sizes = array(); $get_intermediate_image_sizes = get_intermediate_image_sizes(); // Create the full array with sizes and crop info. foreach ( $get_intermediate_image_sizes as $_size ) { if ( in_array( $_size, array( 'thumbnail'...
php
public function get_sizes( $size = '' ) { global $_wp_additional_image_sizes; $sizes = array(); $get_intermediate_image_sizes = get_intermediate_image_sizes(); // Create the full array with sizes and crop info. foreach ( $get_intermediate_image_sizes as $_size ) { if ( in_array( $_size, array( 'thumbnail'...
[ "public", "function", "get_sizes", "(", "$", "size", "=", "''", ")", "{", "global", "$", "_wp_additional_image_sizes", ";", "$", "sizes", "=", "array", "(", ")", ";", "$", "get_intermediate_image_sizes", "=", "get_intermediate_image_sizes", "(", ")", ";", "// ...
Get all the currently defined named image sizes @since 1.0.0 @param string $size If supplied, only return this size. @return array Image sizes
[ "Get", "all", "the", "currently", "defined", "named", "image", "sizes" ]
train
https://github.com/LightboxDigital/wp-dynamic-image-resizer/blob/cc1d67192c8463eba4c0920130abec933ed2296b/public/class-dynamic-image-resizer-public.php#L164-L194
flagrow/flarum-ext-latex
src/Listeners/AddClientAssets.php
AddClientAssets.addForumAssets
public function addForumAssets(ConfigureClientView $event) { if ($event->isForum()) { $event->addAssets([ __DIR__.'/../../js/forum/dist/extension.js', ]); //Include css and java for KaTeX $event->view->addHeadString('<link rel="stylesheet" href...
php
public function addForumAssets(ConfigureClientView $event) { if ($event->isForum()) { $event->addAssets([ __DIR__.'/../../js/forum/dist/extension.js', ]); //Include css and java for KaTeX $event->view->addHeadString('<link rel="stylesheet" href...
[ "public", "function", "addForumAssets", "(", "ConfigureClientView", "$", "event", ")", "{", "if", "(", "$", "event", "->", "isForum", "(", ")", ")", "{", "$", "event", "->", "addAssets", "(", "[", "__DIR__", ".", "'/../../js/forum/dist/extension.js'", ",", "...
Modifies the client view for the Forum. @param ConfigureClientView $event
[ "Modifies", "the", "client", "view", "for", "the", "Forum", "." ]
train
https://github.com/flagrow/flarum-ext-latex/blob/4db38817d26cb5e3a7e8a0b53f042c61d14af606/src/Listeners/AddClientAssets.php#L35-L48
mimmi20/Wurfl
src/Manager.php
Manager.factory
public static function factory($config) { static $instance = null; if (is_string($config)) { $config = new FileConfig($config); } if (! $config instanceof Config) { throw new \InvalidArgumentException( 'the parameter $xmlConfig has to be a pa...
php
public static function factory($config) { static $instance = null; if (is_string($config)) { $config = new FileConfig($config); } if (! $config instanceof Config) { throw new \InvalidArgumentException( 'the parameter $xmlConfig has to be a pa...
[ "public", "static", "function", "factory", "(", "$", "config", ")", "{", "static", "$", "instance", "=", "null", ";", "if", "(", "is_string", "(", "$", "config", ")", ")", "{", "$", "config", "=", "new", "FileConfig", "(", "$", "config", ")", ";", ...
@param string|\Noodlehaus\Config $config @return \Wurfl\Manager
[ "@param", "string|", "\\", "Noodlehaus", "\\", "Config", "$config" ]
train
https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Manager.php#L116-L141
mimmi20/Wurfl
src/Manager.php
Manager.reload
public function reload() { $this->getPersistenceStorage()->setWURFLLoaded(false); $this->remove(); $this->invalidateCache(); $this->init(); $this->getPersistenceStorage()->save(self::WURFL_API_STATE, $this->getState()); }
php
public function reload() { $this->getPersistenceStorage()->setWURFLLoaded(false); $this->remove(); $this->invalidateCache(); $this->init(); $this->getPersistenceStorage()->save(self::WURFL_API_STATE, $this->getState()); }
[ "public", "function", "reload", "(", ")", "{", "$", "this", "->", "getPersistenceStorage", "(", ")", "->", "setWURFLLoaded", "(", "false", ")", ";", "$", "this", "->", "remove", "(", ")", ";", "$", "this", "->", "invalidateCache", "(", ")", ";", "$", ...
Reload the WURFL Data into the persistence provider
[ "Reload", "the", "WURFL", "Data", "into", "the", "persistence", "provider" ]
train
https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Manager.php#L242-L249
mimmi20/Wurfl
src/Manager.php
Manager.hasToBeReloaded
private function hasToBeReloaded() { if (!$this->getWurflConfig()->allowReload) { return false; } $state = $this->getPersistenceStorage()->load(self::WURFL_API_STATE); return !$this->isStateCurrent($state); }
php
private function hasToBeReloaded() { if (!$this->getWurflConfig()->allowReload) { return false; } $state = $this->getPersistenceStorage()->load(self::WURFL_API_STATE); return !$this->isStateCurrent($state); }
[ "private", "function", "hasToBeReloaded", "(", ")", "{", "if", "(", "!", "$", "this", "->", "getWurflConfig", "(", ")", "->", "allowReload", ")", "{", "return", "false", ";", "}", "$", "state", "=", "$", "this", "->", "getPersistenceStorage", "(", ")", ...
Returns true if the WURFL is out of date or otherwise needs to be reloaded @return bool
[ "Returns", "true", "if", "the", "WURFL", "is", "out", "of", "date", "or", "otherwise", "needs", "to", "be", "reloaded" ]
train
https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Manager.php#L256-L265
mimmi20/Wurfl
src/Manager.php
Manager.init
private function init() { $devicePatcher = new Device\Xml\DevicePatcher(); $deviceRepositoryBuilder = new Device\DeviceRepositoryBuilder( $this->getPersistenceStorage(), $this->getUserAgentHandlerChain(), $devicePatcher, $this->getLogger() ...
php
private function init() { $devicePatcher = new Device\Xml\DevicePatcher(); $deviceRepositoryBuilder = new Device\DeviceRepositoryBuilder( $this->getPersistenceStorage(), $this->getUserAgentHandlerChain(), $devicePatcher, $this->getLogger() ...
[ "private", "function", "init", "(", ")", "{", "$", "devicePatcher", "=", "new", "Device", "\\", "Xml", "\\", "DevicePatcher", "(", ")", ";", "$", "deviceRepositoryBuilder", "=", "new", "Device", "\\", "DeviceRepositoryBuilder", "(", "$", "this", "->", "getPe...
Initializes the WURFL Manager Factory by assigning cache and persistence providers
[ "Initializes", "the", "WURFL", "Manager", "Factory", "by", "assigning", "cache", "and", "persistence", "providers" ]
train
https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Manager.php#L315-L330
mimmi20/Wurfl
src/Manager.php
Manager.getDeviceForHttpRequest
public function getDeviceForHttpRequest(array $httpRequest = array(), $override_sideloaded_browser_ua = true) { if (!isset($httpRequest)) { throw new Exception('The $httpRequest parameter must be set.'); } $requestFactory = new Request\GenericRequestFactory(); $request ...
php
public function getDeviceForHttpRequest(array $httpRequest = array(), $override_sideloaded_browser_ua = true) { if (!isset($httpRequest)) { throw new Exception('The $httpRequest parameter must be set.'); } $requestFactory = new Request\GenericRequestFactory(); $request ...
[ "public", "function", "getDeviceForHttpRequest", "(", "array", "$", "httpRequest", "=", "array", "(", ")", ",", "$", "override_sideloaded_browser_ua", "=", "true", ")", "{", "if", "(", "!", "isset", "(", "$", "httpRequest", ")", ")", "{", "throw", "new", "...
Return a device for the given http request(user-agent..) @param array $httpRequest HTTP Request array (normally $_SERVER) @param bool $override_sideloaded_browser_ua @throws Exception if $httpRequest is not set @return \Wurfl\CustomDevice device
[ "Return", "a", "device", "for", "the", "given", "http", "request", "(", "user", "-", "agent", "..", ")" ]
train
https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Manager.php#L363-L374
mimmi20/Wurfl
src/Manager.php
Manager.getDeviceForRequest
private function getDeviceForRequest(Request\GenericRequest $request) { Handlers\Utils::reset(); $deviceId = $this->deviceIdForRequest($request); return $this->getWrappedDevice($deviceId, $request); }
php
private function getDeviceForRequest(Request\GenericRequest $request) { Handlers\Utils::reset(); $deviceId = $this->deviceIdForRequest($request); return $this->getWrappedDevice($deviceId, $request); }
[ "private", "function", "getDeviceForRequest", "(", "Request", "\\", "GenericRequest", "$", "request", ")", "{", "Handlers", "\\", "Utils", "::", "reset", "(", ")", ";", "$", "deviceId", "=", "$", "this", "->", "deviceIdForRequest", "(", "$", "request", ")", ...
Returns the Device for the given \Wurfl\Request_GenericRequest @param Request\GenericRequest $request @return \Wurfl\CustomDevice
[ "Returns", "the", "Device", "for", "the", "given", "\\", "Wurfl", "\\", "Request_GenericRequest" ]
train
https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Manager.php#L383-L390