repo
stringclasses
21 values
path
stringlengths
10
100
func_name
stringlengths
6
71
original_string
stringlengths
115
97k
language
stringclasses
1 value
code
stringlengths
115
97k
code_tokens
listlengths
27
7.5k
docstring
stringlengths
6
1.88k
docstring_tokens
listlengths
1
177
sha
stringclasses
21 values
url
stringlengths
100
189
partition
stringclasses
1 value
summary
stringlengths
9
340
input_ids
listlengths
502
502
token_type_ids
listlengths
502
502
attention_mask
listlengths
502
502
labels
listlengths
502
502
octobercms/october
modules/system/classes/MailManager.php
MailManager.startTwig
protected function startTwig() { if ($this->isTwigStarted) { return; } $this->isTwigStarted = true; $markupManager = MarkupManager::instance(); $markupManager->beginTransaction(); $markupManager->registerTokenParsers([ new MailPartialTokenParser ]); }
php
protected function startTwig() { if ($this->isTwigStarted) { return; } $this->isTwigStarted = true; $markupManager = MarkupManager::instance(); $markupManager->beginTransaction(); $markupManager->registerTokenParsers([ new MailPartialTokenParser ]); }
[ "protected", "function", "startTwig", "(", ")", "{", "if", "(", "$", "this", "->", "isTwigStarted", ")", "{", "return", ";", "}", "$", "this", "->", "isTwigStarted", "=", "true", ";", "$", "markupManager", "=", "MarkupManager", "::", "instance", "(", ")"...
Temporarily registers mail based token parsers with Twig. @return void
[ "Temporarily", "registers", "mail", "based", "token", "parsers", "with", "Twig", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/MailManager.php#L296-L309
train
Starts Twig.
[ 30522, 5123, 3853, 2707, 2102, 16279, 1006, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 21541, 16279, 14117, 3064, 1007, 1063, 2709, 1025, 1065, 1002, 2023, 1011, 1028, 21541, 16279, 14117, 3064, 1027, 2995, 1025, 1002, 2928, 6279, 2480...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Form/Extension/Core/Type/CollectionType.php
CollectionType.buildView
public function buildView(FormView $view, FormInterface $form, array $options) { $view->vars = array_replace($view->vars, [ 'allow_add' => $options['allow_add'], 'allow_delete' => $options['allow_delete'], ]); if ($form->getConfig()->hasAttribute('prototype')) { $prototype = $form->getConfig()->getAttribute('prototype'); $view->vars['prototype'] = $prototype->setParent($form)->createView($view); } }
php
public function buildView(FormView $view, FormInterface $form, array $options) { $view->vars = array_replace($view->vars, [ 'allow_add' => $options['allow_add'], 'allow_delete' => $options['allow_delete'], ]); if ($form->getConfig()->hasAttribute('prototype')) { $prototype = $form->getConfig()->getAttribute('prototype'); $view->vars['prototype'] = $prototype->setParent($form)->createView($view); } }
[ "public", "function", "buildView", "(", "FormView", "$", "view", ",", "FormInterface", "$", "form", ",", "array", "$", "options", ")", "{", "$", "view", "->", "vars", "=", "array_replace", "(", "$", "view", "->", "vars", ",", "[", "'allow_add'", "=>", ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Extension/Core/Type/CollectionType.php#L57-L68
train
Build the view
[ 30522, 2270, 3853, 3857, 8584, 1006, 2433, 8584, 1002, 3193, 1010, 2433, 18447, 2121, 12172, 1002, 2433, 1010, 9140, 1002, 7047, 1007, 1063, 1002, 3193, 1011, 1028, 13075, 2015, 1027, 9140, 1035, 5672, 1006, 1002, 3193, 1011, 1028, 13075, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
overtrue/wechat
src/OpenPlatform/Application.php
Application.getPreAuthorizationUrl
public function getPreAuthorizationUrl(string $callbackUrl, $optional = []): string { // 兼容旧版 API 设计 if (\is_string($optional)) { $optional = [ 'pre_auth_code' => $optional, ]; } else { $optional['pre_auth_code'] = $this->createPreAuthorizationCode()['pre_auth_code']; } $queries = \array_merge($optional, [ 'component_appid' => $this['config']['app_id'], 'redirect_uri' => $callbackUrl, ]); return 'https://mp.weixin.qq.com/cgi-bin/componentloginpage?'.http_build_query($queries); }
php
public function getPreAuthorizationUrl(string $callbackUrl, $optional = []): string { // 兼容旧版 API 设计 if (\is_string($optional)) { $optional = [ 'pre_auth_code' => $optional, ]; } else { $optional['pre_auth_code'] = $this->createPreAuthorizationCode()['pre_auth_code']; } $queries = \array_merge($optional, [ 'component_appid' => $this['config']['app_id'], 'redirect_uri' => $callbackUrl, ]); return 'https://mp.weixin.qq.com/cgi-bin/componentloginpage?'.http_build_query($queries); }
[ "public", "function", "getPreAuthorizationUrl", "(", "string", "$", "callbackUrl", ",", "$", "optional", "=", "[", "]", ")", ":", "string", "{", "// 兼容旧版 API 设计", "if", "(", "\\", "is_string", "(", "$", "optional", ")", ")", "{", "$", "optional", "=", "[...
Return the pre-authorization login page url. @param string $callbackUrl @param string|array|null $optional @return string
[ "Return", "the", "pre", "-", "authorization", "login", "page", "url", "." ]
120c72faaa93c270365bc75c73c362d5fd583209
https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/OpenPlatform/Application.php#L119-L136
train
Get pre authorization url
[ 30522, 2270, 3853, 2131, 28139, 4887, 27844, 3989, 3126, 2140, 1006, 5164, 1002, 2655, 5963, 3126, 2140, 1010, 1002, 11887, 1027, 1031, 1033, 1007, 1024, 5164, 1063, 1013, 1013, 100, 100, 100, 1907, 17928, 100, 100, 2065, 1006, 1032, 2003...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Queue/Console/TableCommand.php
TableCommand.handle
public function handle() { $table = $this->laravel['config']['queue.connections.database.table']; $this->replaceMigration( $this->createBaseMigration($table), $table, Str::studly($table) ); $this->info('Migration created successfully!'); $this->composer->dumpAutoloads(); }
php
public function handle() { $table = $this->laravel['config']['queue.connections.database.table']; $this->replaceMigration( $this->createBaseMigration($table), $table, Str::studly($table) ); $this->info('Migration created successfully!'); $this->composer->dumpAutoloads(); }
[ "public", "function", "handle", "(", ")", "{", "$", "table", "=", "$", "this", "->", "laravel", "[", "'config'", "]", "[", "'queue.connections.database.table'", "]", ";", "$", "this", "->", "replaceMigration", "(", "$", "this", "->", "createBaseMigration", "...
Execute the console command. @return void
[ "Execute", "the", "console", "command", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Queue/Console/TableCommand.php#L58-L69
train
Create base migration and dump autoloader
[ 30522, 2270, 3853, 5047, 1006, 1007, 1063, 1002, 2795, 1027, 1002, 2023, 1011, 1028, 13679, 15985, 1031, 1005, 9530, 8873, 2290, 1005, 1033, 1031, 1005, 24240, 1012, 7264, 1012, 7809, 1012, 2795, 1005, 1033, 1025, 1002, 2023, 1011, 1028, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Db/Table/Row/Abstract.php
Zend_Db_Table_Row_Abstract.setFromArray
public function setFromArray(array $data) { $data = array_intersect_key($data, $this->_data); foreach ($data as $columnName => $value) { $this->__set($columnName, $value); } return $this; }
php
public function setFromArray(array $data) { $data = array_intersect_key($data, $this->_data); foreach ($data as $columnName => $value) { $this->__set($columnName, $value); } return $this; }
[ "public", "function", "setFromArray", "(", "array", "$", "data", ")", "{", "$", "data", "=", "array_intersect_key", "(", "$", "data", ",", "$", "this", "->", "_data", ")", ";", "foreach", "(", "$", "data", "as", "$", "columnName", "=>", "$", "value", ...
Sets all data in the row from an array. @param array $data @return Zend_Db_Table_Row_Abstract Provides a fluent interface
[ "Sets", "all", "data", "in", "the", "row", "from", "an", "array", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Table/Row/Abstract.php#L666-L675
train
Set the values of the object from an array
[ 30522, 2270, 3853, 2275, 19699, 9626, 11335, 2100, 1006, 9140, 1002, 2951, 1007, 1063, 1002, 2951, 1027, 9140, 1035, 29261, 1035, 3145, 1006, 1002, 2951, 1010, 1002, 2023, 1011, 1028, 1035, 2951, 1007, 1025, 18921, 6776, 1006, 1002, 2951, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/DomCrawler/Crawler.php
Crawler.xpathLiteral
public static function xpathLiteral($s) { if (false === strpos($s, "'")) { return sprintf("'%s'", $s); } if (false === strpos($s, '"')) { return sprintf('"%s"', $s); } $string = $s; $parts = []; while (true) { if (false !== $pos = strpos($string, "'")) { $parts[] = sprintf("'%s'", substr($string, 0, $pos)); $parts[] = "\"'\""; $string = substr($string, $pos + 1); } else { $parts[] = "'$string'"; break; } } return sprintf('concat(%s)', implode(', ', $parts)); }
php
public static function xpathLiteral($s) { if (false === strpos($s, "'")) { return sprintf("'%s'", $s); } if (false === strpos($s, '"')) { return sprintf('"%s"', $s); } $string = $s; $parts = []; while (true) { if (false !== $pos = strpos($string, "'")) { $parts[] = sprintf("'%s'", substr($string, 0, $pos)); $parts[] = "\"'\""; $string = substr($string, $pos + 1); } else { $parts[] = "'$string'"; break; } } return sprintf('concat(%s)', implode(', ', $parts)); }
[ "public", "static", "function", "xpathLiteral", "(", "$", "s", ")", "{", "if", "(", "false", "===", "strpos", "(", "$", "s", ",", "\"'\"", ")", ")", "{", "return", "sprintf", "(", "\"'%s'\"", ",", "$", "s", ")", ";", "}", "if", "(", "false", "===...
Converts string for XPath expressions. Escaped characters are: quotes (") and apostrophe ('). Examples: echo Crawler::xpathLiteral('foo " bar'); //prints 'foo " bar' echo Crawler::xpathLiteral("foo ' bar"); //prints "foo ' bar" echo Crawler::xpathLiteral('a\'b"c'); //prints concat('a', "'", 'b"c') @param string $s String to be escaped @return string Converted string
[ "Converts", "string", "for", "XPath", "expressions", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DomCrawler/Crawler.php#L928-L952
train
Converts a string like a xpath literal to a string
[ 30522, 2270, 10763, 3853, 26726, 8988, 22779, 7941, 1006, 1002, 1055, 1007, 1063, 2065, 1006, 6270, 1027, 1027, 1027, 2358, 14536, 2891, 1006, 1002, 1055, 1010, 1000, 1005, 1000, 1007, 1007, 1063, 2709, 9043, 2546, 1006, 1000, 1005, 1003, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Framework/Flex/FlexForm.php
FlexForm.filterData
protected function filterData(\ArrayAccess $data): void { if ($data instanceof Data) { $data->filter(true, true); } }
php
protected function filterData(\ArrayAccess $data): void { if ($data instanceof Data) { $data->filter(true, true); } }
[ "protected", "function", "filterData", "(", "\\", "ArrayAccess", "$", "data", ")", ":", "void", "{", "if", "(", "$", "data", "instanceof", "Data", ")", "{", "$", "data", "->", "filter", "(", "true", ",", "true", ")", ";", "}", "}" ]
Filter validated data. @param \ArrayAccess $data
[ "Filter", "validated", "data", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Framework/Flex/FlexForm.php#L337-L342
train
Filter data to avoid memory leaks
[ 30522, 5123, 3853, 11307, 2850, 2696, 1006, 1032, 9140, 6305, 9623, 2015, 1002, 2951, 1007, 1024, 11675, 1063, 2065, 1006, 1002, 2951, 6013, 11253, 2951, 1007, 1063, 1002, 2951, 1011, 1028, 11307, 1006, 2995, 1010, 2995, 1007, 1025, 1065, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/UserCountry/LocationProvider/GeoIp/Pecl.php
Pecl.getInfo
public function getInfo() { $desc = Piwik::translate('UserCountry_GeoIpLocationProviderDesc_Pecl1') . '<br/><br/>' . Piwik::translate('UserCountry_GeoIpLocationProviderDesc_Pecl2'); $installDocs = '<a rel="noreferrer noopener" target="_blank" href="https://matomo.org/faq/how-to/#faq_164">' . Piwik::translate('UserCountry_HowToInstallGeoIpPecl') . '</a>'; $extraMessage = false; if ($this->isAvailable()) { $peclDir = ini_get('geoip.custom_directory'); if ($peclDir === false) { $extraMessage = Piwik::translate('UserCountry_GeoIPPeclCustomDirNotSet', "'geoip.custom_directory'"); } else { $extraMessage = 'The \'geoip.custom_directory\' PHP ini option is set to \'' . $peclDir . '\'.'; } $availableDatabaseTypes = array(); if (self::isCityDatabaseAvailable()) { $availableDatabaseTypes[] = Piwik::translate('UserCountry_City'); } if (self::isRegionDatabaseAvailable()) { $availableDatabaseTypes[] = Piwik::translate('UserCountry_Region'); } if (self::isCountryDatabaseAvailable()) { $availableDatabaseTypes[] = Piwik::translate('UserCountry_Country'); } if (self::isISPDatabaseAvailable()) { $availableDatabaseTypes[] = 'ISP'; } if (self::isOrgDatabaseAvailable()) { $availableDatabaseTypes[] = Piwik::translate('UserCountry_Organization'); } $extraMessage .= '<br/><br/>' . Piwik::translate('UserCountry_GeoIPImplHasAccessTo') . ':&nbsp;<strong>' . implode(', ', $availableDatabaseTypes) . '</strong>.'; $extraMessage = '<strong>' . Piwik::translate('General_Note') . ':&nbsp;</strong>' . $extraMessage; } return array('id' => self::ID, 'title' => self::TITLE, 'description' => $desc, 'install_docs' => $installDocs, 'extra_message' => $extraMessage, 'order' => 13); }
php
public function getInfo() { $desc = Piwik::translate('UserCountry_GeoIpLocationProviderDesc_Pecl1') . '<br/><br/>' . Piwik::translate('UserCountry_GeoIpLocationProviderDesc_Pecl2'); $installDocs = '<a rel="noreferrer noopener" target="_blank" href="https://matomo.org/faq/how-to/#faq_164">' . Piwik::translate('UserCountry_HowToInstallGeoIpPecl') . '</a>'; $extraMessage = false; if ($this->isAvailable()) { $peclDir = ini_get('geoip.custom_directory'); if ($peclDir === false) { $extraMessage = Piwik::translate('UserCountry_GeoIPPeclCustomDirNotSet', "'geoip.custom_directory'"); } else { $extraMessage = 'The \'geoip.custom_directory\' PHP ini option is set to \'' . $peclDir . '\'.'; } $availableDatabaseTypes = array(); if (self::isCityDatabaseAvailable()) { $availableDatabaseTypes[] = Piwik::translate('UserCountry_City'); } if (self::isRegionDatabaseAvailable()) { $availableDatabaseTypes[] = Piwik::translate('UserCountry_Region'); } if (self::isCountryDatabaseAvailable()) { $availableDatabaseTypes[] = Piwik::translate('UserCountry_Country'); } if (self::isISPDatabaseAvailable()) { $availableDatabaseTypes[] = 'ISP'; } if (self::isOrgDatabaseAvailable()) { $availableDatabaseTypes[] = Piwik::translate('UserCountry_Organization'); } $extraMessage .= '<br/><br/>' . Piwik::translate('UserCountry_GeoIPImplHasAccessTo') . ':&nbsp;<strong>' . implode(', ', $availableDatabaseTypes) . '</strong>.'; $extraMessage = '<strong>' . Piwik::translate('General_Note') . ':&nbsp;</strong>' . $extraMessage; } return array('id' => self::ID, 'title' => self::TITLE, 'description' => $desc, 'install_docs' => $installDocs, 'extra_message' => $extraMessage, 'order' => 13); }
[ "public", "function", "getInfo", "(", ")", "{", "$", "desc", "=", "Piwik", "::", "translate", "(", "'UserCountry_GeoIpLocationProviderDesc_Pecl1'", ")", ".", "'<br/><br/>'", ".", "Piwik", "::", "translate", "(", "'UserCountry_GeoIpLocationProviderDesc_Pecl2'", ")", ";...
Returns information about this location provider. Contains an id, title & description: array( 'id' => 'geoip_pecl', 'title' => '...', 'description' => '...' ); @return array
[ "Returns", "information", "about", "this", "location", "provider", ".", "Contains", "an", "id", "title", "&", "description", ":" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/UserCountry/LocationProvider/GeoIp/Pecl.php#L216-L262
train
Returns the info about the country
[ 30522, 2270, 3853, 2131, 2378, 14876, 1006, 1007, 1063, 1002, 4078, 2278, 1027, 14255, 9148, 2243, 1024, 1024, 17637, 1006, 1005, 5310, 3597, 16671, 2854, 1035, 20248, 11514, 4135, 10719, 21572, 17258, 2121, 6155, 2278, 1035, 21877, 20464, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Config/Writer.php
Zend_Config_Writer.setOptions
public function setOptions(array $options) { foreach ($options as $key => $value) { if (in_array(strtolower($key), $this->_skipOptions)) { continue; } $method = 'set' . ucfirst($key); if (method_exists($this, $method)) { $this->$method($value); } } return $this; }
php
public function setOptions(array $options) { foreach ($options as $key => $value) { if (in_array(strtolower($key), $this->_skipOptions)) { continue; } $method = 'set' . ucfirst($key); if (method_exists($this, $method)) { $this->$method($value); } } return $this; }
[ "public", "function", "setOptions", "(", "array", "$", "options", ")", "{", "foreach", "(", "$", "options", "as", "$", "key", "=>", "$", "value", ")", "{", "if", "(", "in_array", "(", "strtolower", "(", "$", "key", ")", ",", "$", "this", "->", "_sk...
Set options via an array @param array $options @return Zend_Config_Writer
[ "Set", "options", "via", "an", "array" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Config/Writer.php#L79-L93
train
Set options for this object
[ 30522, 2270, 3853, 2275, 30524, 1063, 3613, 1025, 1065, 1002, 4118, 1027, 1005, 2275, 1005, 1012, 15384, 8873, 12096, 1006, 1002, 3145, 1007, 1025, 2065, 1006, 4118, 1035, 6526, 1006, 1002, 2023, 1010, 1002, 4118, 1007, 1007, 1063, 1002, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Db/Adapter/Mysqli.php
Zend_Db_Adapter_Mysqli.prepare
public function prepare($sql) { $this->_connect(); if ($this->_stmt) { $this->_stmt->close(); } $stmtClass = $this->_defaultStmtClass; if (!class_exists($stmtClass)) { // require_once 'Zend/Loader.php'; Zend_Loader::loadClass($stmtClass); } $stmt = new $stmtClass($this, $sql); if ($stmt === false) { return false; } $stmt->setFetchMode($this->_fetchMode); $this->_stmt = $stmt; return $stmt; }
php
public function prepare($sql) { $this->_connect(); if ($this->_stmt) { $this->_stmt->close(); } $stmtClass = $this->_defaultStmtClass; if (!class_exists($stmtClass)) { // require_once 'Zend/Loader.php'; Zend_Loader::loadClass($stmtClass); } $stmt = new $stmtClass($this, $sql); if ($stmt === false) { return false; } $stmt->setFetchMode($this->_fetchMode); $this->_stmt = $stmt; return $stmt; }
[ "public", "function", "prepare", "(", "$", "sql", ")", "{", "$", "this", "->", "_connect", "(", ")", ";", "if", "(", "$", "this", "->", "_stmt", ")", "{", "$", "this", "->", "_stmt", "->", "close", "(", ")", ";", "}", "$", "stmtClass", "=", "$"...
Prepare a statement and return a PDOStatement-like object. @param string $sql SQL query @return Zend_Db_Statement_Mysqli
[ "Prepare", "a", "statement", "and", "return", "a", "PDOStatement", "-", "like", "object", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Adapter/Mysqli.php#L406-L424
train
Prepare statement for execution
[ 30522, 2270, 3853, 7374, 1006, 1002, 29296, 1007, 1063, 1002, 2023, 1011, 1028, 1035, 7532, 1006, 1007, 1025, 2065, 1006, 1002, 2023, 1011, 1028, 1035, 2358, 20492, 1007, 1063, 1002, 2023, 1011, 1028, 1035, 2358, 20492, 1011, 1028, 2485, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/View.php
View.assign
public function assign($var, $value = null) { if (is_string($var)) { $this->$var = $value; } elseif (is_array($var)) { foreach ($var as $key => $value) { $this->$key = $value; } } }
php
public function assign($var, $value = null) { if (is_string($var)) { $this->$var = $value; } elseif (is_array($var)) { foreach ($var as $key => $value) { $this->$key = $value; } } }
[ "public", "function", "assign", "(", "$", "var", ",", "$", "value", "=", "null", ")", "{", "if", "(", "is_string", "(", "$", "var", ")", ")", "{", "$", "this", "->", "$", "var", "=", "$", "value", ";", "}", "elseif", "(", "is_array", "(", "$", ...
Assign value to a variable for use in a template @param string|array $var @param mixed $value @ignore
[ "Assign", "value", "to", "a", "variable", "for", "use", "in", "a", "template" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/View.php#L410-L419
train
Assign a value to the class variables
[ 30522, 2270, 3853, 23911, 1006, 1002, 13075, 1010, 1002, 3643, 1027, 19701, 1007, 1063, 2065, 1006, 2003, 1035, 5164, 1006, 1002, 13075, 1007, 1007, 1063, 1002, 2023, 1011, 1028, 1002, 13075, 1027, 1002, 3643, 1025, 1065, 2842, 10128, 1006,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Translation/Dumper/PhpFileDumper.php
PhpFileDumper.formatCatalogue
public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = []) { return "<?php\n\nreturn ".var_export($messages->all($domain), true).";\n"; }
php
public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = []) { return "<?php\n\nreturn ".var_export($messages->all($domain), true).";\n"; }
[ "public", "function", "formatCatalogue", "(", "MessageCatalogue", "$", "messages", ",", "$", "domain", ",", "array", "$", "options", "=", "[", "]", ")", "{", "return", "\"<?php\\n\\nreturn \"", ".", "var_export", "(", "$", "messages", "->", "all", "(", "$", ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Translation/Dumper/PhpFileDumper.php#L26-L29
train
Format the message catalogue into a PHP string
[ 30522, 2270, 3853, 4289, 11266, 23067, 9077, 1006, 4471, 11266, 23067, 9077, 1002, 7696, 1010, 1002, 5884, 1010, 9140, 1002, 7047, 1027, 1031, 1033, 1007, 1063, 2709, 1000, 1026, 1029, 25718, 1032, 1050, 1032, 17212, 3388, 14287, 1000, 1012...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
barryvdh/laravel-debugbar
src/DataCollector/LaravelCollector.php
LaravelCollector.collect
public function collect() { // Fallback if not injected $app = $this->app ?: app(); return [ "version" => $app::VERSION, "environment" => $app->environment(), "locale" => $app->getLocale(), ]; }
php
public function collect() { // Fallback if not injected $app = $this->app ?: app(); return [ "version" => $app::VERSION, "environment" => $app->environment(), "locale" => $app->getLocale(), ]; }
[ "public", "function", "collect", "(", ")", "{", "// Fallback if not injected", "$", "app", "=", "$", "this", "->", "app", "?", ":", "app", "(", ")", ";", "return", "[", "\"version\"", "=>", "$", "app", "::", "VERSION", ",", "\"environment\"", "=>", "$", ...
{@inheritDoc}
[ "{" ]
2d195779ea4f809f69764a795e2ec371dbb76a96
https://github.com/barryvdh/laravel-debugbar/blob/2d195779ea4f809f69764a795e2ec371dbb76a96/src/DataCollector/LaravelCollector.php#L25-L35
train
Collect the array of all the configuration options
[ 30522, 2270, 3853, 8145, 1006, 1007, 1063, 1013, 1013, 2991, 5963, 2065, 2025, 19737, 1002, 10439, 1027, 1002, 2023, 1011, 1028, 10439, 1029, 1024, 10439, 1006, 1007, 1025, 2709, 1031, 1000, 2544, 1000, 1027, 1028, 1002, 10439, 1024, 1024, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Bridge/Twig/Extension/WorkflowExtension.php
WorkflowExtension.canTransition
public function canTransition($subject, $transitionName, $name = null) { return $this->workflowRegistry->get($subject, $name)->can($subject, $transitionName); }
php
public function canTransition($subject, $transitionName, $name = null) { return $this->workflowRegistry->get($subject, $name)->can($subject, $transitionName); }
[ "public", "function", "canTransition", "(", "$", "subject", ",", "$", "transitionName", ",", "$", "name", "=", "null", ")", "{", "return", "$", "this", "->", "workflowRegistry", "->", "get", "(", "$", "subject", ",", "$", "name", ")", "->", "can", "(",...
Returns true if the transition is enabled. @param object $subject A subject @param string $transitionName A transition @param string $name A workflow name @return bool true if the transition is enabled
[ "Returns", "true", "if", "the", "transition", "is", "enabled", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bridge/Twig/Extension/WorkflowExtension.php#L55-L58
train
Can transition a subject
[ 30522, 2270, 3853, 2064, 6494, 3619, 22753, 1006, 1002, 3395, 1010, 1002, 6653, 18442, 1010, 1002, 2171, 1027, 19701, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 2147, 12314, 2890, 24063, 2854, 1011, 1028, 2131, 1006, 1002, 3395, 1010, 1002, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php
BelongsToMany.updateOrCreate
public function updateOrCreate(array $attributes, array $values = [], array $joining = [], $touch = true) { if (is_null($instance = $this->where($attributes)->first())) { return $this->create($values, $joining, $touch); } $instance->fill($values); $instance->save(['touch' => false]); return $instance; }
php
public function updateOrCreate(array $attributes, array $values = [], array $joining = [], $touch = true) { if (is_null($instance = $this->where($attributes)->first())) { return $this->create($values, $joining, $touch); } $instance->fill($values); $instance->save(['touch' => false]); return $instance; }
[ "public", "function", "updateOrCreate", "(", "array", "$", "attributes", ",", "array", "$", "values", "=", "[", "]", ",", "array", "$", "joining", "=", "[", "]", ",", "$", "touch", "=", "true", ")", "{", "if", "(", "is_null", "(", "$", "instance", ...
Create or update a related record matching the attributes, and fill it with values. @param array $attributes @param array $values @param array $joining @param bool $touch @return \Illuminate\Database\Eloquent\Model
[ "Create", "or", "update", "a", "related", "record", "matching", "the", "attributes", "and", "fill", "it", "with", "values", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php#L485-L496
train
Update or Create a record if it doesn t exist
[ 30522, 2270, 3853, 10651, 2953, 16748, 3686, 1006, 9140, 1002, 12332, 1010, 9140, 1002, 5300, 1027, 1031, 1033, 1010, 9140, 1002, 5241, 1027, 1031, 1033, 1010, 1002, 3543, 1027, 2995, 1007, 1063, 2065, 1006, 2003, 1035, 19701, 1006, 1002, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/Period/Range.php
Range.processOptimalSubperiods
protected function processOptimalSubperiods($startDate, $endDate) { while ($startDate->isEarlier($endDate) || $startDate == $endDate) { $endOfPeriod = null; $month = new Month($startDate); $endOfMonth = $month->getDateEnd(); $startOfMonth = $month->getDateStart(); $year = new Year($startDate); $endOfYear = $year->getDateEnd(); $startOfYear = $year->getDateStart(); if ($startDate == $startOfYear && ($endOfYear->isEarlier($endDate) || $endOfYear == $endDate || $endOfYear->isLater($this->today) ) // We don't use the year if // the end day is in this year, is before today, and year not finished && !($endDate->isEarlier($this->today) && $this->today->toString('Y') == $endOfYear->toString('Y') && $this->today->compareYear($endOfYear) == 0) ) { $this->addSubperiod($year); $endOfPeriod = $endOfYear; } elseif ($startDate == $startOfMonth && ($endOfMonth->isEarlier($endDate) || $endOfMonth == $endDate || $endOfMonth->isLater($this->today) ) // We don't use the month if // the end day is in this month, is before today, and month not finished && !($endDate->isEarlier($this->today) && $this->today->toString('Y') == $endOfMonth->toString('Y') && $this->today->compareMonth($endOfMonth) == 0) ) { $this->addSubperiod($month); $endOfPeriod = $endOfMonth; } else { // From start date, // Process end of week $week = new Week($startDate); $startOfWeek = $week->getDateStart(); $endOfWeek = $week->getDateEnd(); $firstDayNextMonth = $startDate->addPeriod(2, 'month')->setDay(1); $useMonthsNextIteration = $firstDayNextMonth->isEarlier($endDate); if ($useMonthsNextIteration && $endOfWeek->isLater($endOfMonth) ) { $this->fillArraySubPeriods($startDate, $endOfMonth, 'day'); $endOfPeriod = $endOfMonth; } // If end of this week is later than end date, we use days elseif ($this->isEndOfWeekLaterThanEndDate($endDate, $endOfWeek) && ($endOfWeek->isEarlier($this->today) || $startOfWeek->toString() != $startDate->toString() || $endDate->isEarlier($this->today)) ) { $this->fillArraySubPeriods($startDate, $endDate, 'day'); break 1; } elseif ($startOfWeek->isEarlier($startDate) && $endOfWeek->isEarlier($this->today) ) { $this->fillArraySubPeriods($startDate, $endOfWeek, 'day'); $endOfPeriod = $endOfWeek; } else { $this->addSubperiod($week); $endOfPeriod = $endOfWeek; } } $startDate = $endOfPeriod->addDay(1); } }
php
protected function processOptimalSubperiods($startDate, $endDate) { while ($startDate->isEarlier($endDate) || $startDate == $endDate) { $endOfPeriod = null; $month = new Month($startDate); $endOfMonth = $month->getDateEnd(); $startOfMonth = $month->getDateStart(); $year = new Year($startDate); $endOfYear = $year->getDateEnd(); $startOfYear = $year->getDateStart(); if ($startDate == $startOfYear && ($endOfYear->isEarlier($endDate) || $endOfYear == $endDate || $endOfYear->isLater($this->today) ) // We don't use the year if // the end day is in this year, is before today, and year not finished && !($endDate->isEarlier($this->today) && $this->today->toString('Y') == $endOfYear->toString('Y') && $this->today->compareYear($endOfYear) == 0) ) { $this->addSubperiod($year); $endOfPeriod = $endOfYear; } elseif ($startDate == $startOfMonth && ($endOfMonth->isEarlier($endDate) || $endOfMonth == $endDate || $endOfMonth->isLater($this->today) ) // We don't use the month if // the end day is in this month, is before today, and month not finished && !($endDate->isEarlier($this->today) && $this->today->toString('Y') == $endOfMonth->toString('Y') && $this->today->compareMonth($endOfMonth) == 0) ) { $this->addSubperiod($month); $endOfPeriod = $endOfMonth; } else { // From start date, // Process end of week $week = new Week($startDate); $startOfWeek = $week->getDateStart(); $endOfWeek = $week->getDateEnd(); $firstDayNextMonth = $startDate->addPeriod(2, 'month')->setDay(1); $useMonthsNextIteration = $firstDayNextMonth->isEarlier($endDate); if ($useMonthsNextIteration && $endOfWeek->isLater($endOfMonth) ) { $this->fillArraySubPeriods($startDate, $endOfMonth, 'day'); $endOfPeriod = $endOfMonth; } // If end of this week is later than end date, we use days elseif ($this->isEndOfWeekLaterThanEndDate($endDate, $endOfWeek) && ($endOfWeek->isEarlier($this->today) || $startOfWeek->toString() != $startDate->toString() || $endDate->isEarlier($this->today)) ) { $this->fillArraySubPeriods($startDate, $endDate, 'day'); break 1; } elseif ($startOfWeek->isEarlier($startDate) && $endOfWeek->isEarlier($this->today) ) { $this->fillArraySubPeriods($startDate, $endOfWeek, 'day'); $endOfPeriod = $endOfWeek; } else { $this->addSubperiod($week); $endOfPeriod = $endOfWeek; } } $startDate = $endOfPeriod->addDay(1); } }
[ "protected", "function", "processOptimalSubperiods", "(", "$", "startDate", ",", "$", "endDate", ")", "{", "while", "(", "$", "startDate", "->", "isEarlier", "(", "$", "endDate", ")", "||", "$", "startDate", "==", "$", "endDate", ")", "{", "$", "endOfPerio...
Determine which kind of period is best to use. See Range.test.php @param Date $startDate @param Date $endDate
[ "Determine", "which", "kind", "of", "period", "is", "best", "to", "use", ".", "See", "Range", ".", "test", ".", "php" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Period/Range.php#L325-L400
train
Process Optimal Subperiods
[ 30522, 5123, 3853, 2832, 7361, 3775, 9067, 6342, 2497, 4842, 3695, 5104, 1006, 1002, 2707, 13701, 1010, 1002, 2203, 13701, 1007, 1063, 2096, 1006, 1002, 2707, 13701, 1011, 1028, 2003, 14644, 14355, 1006, 1002, 2203, 13701, 1007, 1064, 1064,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/Page/Page.php
Page.getContentMeta
public function getContentMeta($name = null) { if ($name) { if (isset($this->content_meta[$name])) { return $this->content_meta[$name]; } return null; } return $this->content_meta; }
php
public function getContentMeta($name = null) { if ($name) { if (isset($this->content_meta[$name])) { return $this->content_meta[$name]; } return null; } return $this->content_meta; }
[ "public", "function", "getContentMeta", "(", "$", "name", "=", "null", ")", "{", "if", "(", "$", "name", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "content_meta", "[", "$", "name", "]", ")", ")", "{", "return", "$", "this", "->", "con...
Return the whole contentMeta array as it currently stands @param string|null $name @return string
[ "Return", "the", "whole", "contentMeta", "array", "as", "it", "currently", "stands" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L789-L800
train
Get content meta
[ 30522, 2270, 3853, 2131, 8663, 6528, 21246, 12928, 1006, 1002, 2171, 1027, 19701, 1007, 1063, 2065, 1006, 1002, 2171, 1007, 1063, 2065, 1006, 26354, 3388, 1006, 1002, 2023, 1011, 1028, 4180, 1035, 18804, 1031, 1002, 2171, 1033, 1007, 1007, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php
NumberFormatter.create
public static function create($locale = 'en', $style = null, $pattern = null) { return new self($locale, $style, $pattern); }
php
public static function create($locale = 'en', $style = null, $pattern = null) { return new self($locale, $style, $pattern); }
[ "public", "static", "function", "create", "(", "$", "locale", "=", "'en'", ",", "$", "style", "=", "null", ",", "$", "pattern", "=", "null", ")", "{", "return", "new", "self", "(", "$", "locale", ",", "$", "style", ",", "$", "pattern", ")", ";", ...
Static constructor. @param string $locale The locale code. The only supported locale is "en" (or null using the default locale, i.e. "en") @param int $style Style of the formatting, one of the format style constants. The only currently supported styles are NumberFormatter::DECIMAL and NumberFormatter::CURRENCY. @param string $pattern Not supported. A pattern string in case $style is NumberFormat::PATTERN_DECIMAL or NumberFormat::PATTERN_RULEBASED. It must conform to the syntax described in the ICU DecimalFormat or ICU RuleBasedNumberFormat documentation @return self @see http://www.php.net/manual/en/numberformatter.create.php @see http://www.icu-project.org/apiref/icu4c/classDecimalFormat.html#_details @see http://www.icu-project.org/apiref/icu4c/classRuleBasedNumberFormat.html#_details @throws MethodArgumentValueNotImplementedException When $locale different than "en" or null is passed @throws MethodArgumentValueNotImplementedException When the $style is not supported @throws MethodArgumentNotImplementedException When the pattern value is different than null
[ "Static", "constructor", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php#L299-L302
train
Create a new Locale Style Pattern
[ 30522, 2270, 10763, 3853, 3443, 1006, 1002, 2334, 2063, 1027, 1005, 4372, 1005, 1010, 1002, 2806, 1027, 19701, 1010, 1002, 5418, 1027, 19701, 1007, 1063, 2709, 2047, 2969, 1006, 1002, 2334, 2063, 1010, 1002, 2806, 1010, 1002, 5418, 1007, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/Annotations/AnnotationList.php
AnnotationList.augmentAnnotationData
private function augmentAnnotationData($idSite, $idNote, &$annotation) { $annotation['idNote'] = $idNote; $annotation['canEditOrDelete'] = self::canUserModifyOrDelete($idSite, $annotation); // we don't supply user info if the current user is anonymous if (Piwik::isUserIsAnonymous()) { unset($annotation['user']); } }
php
private function augmentAnnotationData($idSite, $idNote, &$annotation) { $annotation['idNote'] = $idNote; $annotation['canEditOrDelete'] = self::canUserModifyOrDelete($idSite, $annotation); // we don't supply user info if the current user is anonymous if (Piwik::isUserIsAnonymous()) { unset($annotation['user']); } }
[ "private", "function", "augmentAnnotationData", "(", "$", "idSite", ",", "$", "idNote", ",", "&", "$", "annotation", ")", "{", "$", "annotation", "[", "'idNote'", "]", "=", "$", "idNote", ";", "$", "annotation", "[", "'canEditOrDelete'", "]", "=", "self", ...
Adds extra data to an annotation, including the annotation's ID and whether the current user can edit or delete it. Also, if the current user is anonymous, the user attribute is removed. @param int $idSite @param int $idNote @param array $annotation
[ "Adds", "extra", "data", "to", "an", "annotation", "including", "the", "annotation", "s", "ID", "and", "whether", "the", "current", "user", "can", "edit", "or", "delete", "it", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Annotations/AnnotationList.php#L408-L417
train
augment the annotation data with the correct idNote and canEditOrDelete values
[ 30522, 2797, 3853, 15476, 3672, 11639, 17287, 3508, 2850, 2696, 1006, 1002, 8909, 28032, 2063, 1010, 1002, 8909, 22074, 1010, 1004, 30524, 5302, 4305, 12031, 8551, 12260, 2618, 1006, 1002, 8909, 28032, 2063, 1010, 1002, 5754, 17287, 3508, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Concerns/ManagesTransactions.php
ManagesTransactions.commit
public function commit() { if ($this->transactions == 1) { $this->getPdo()->commit(); } $this->transactions = max(0, $this->transactions - 1); $this->fireConnectionEvent('committed'); }
php
public function commit() { if ($this->transactions == 1) { $this->getPdo()->commit(); } $this->transactions = max(0, $this->transactions - 1); $this->fireConnectionEvent('committed'); }
[ "public", "function", "commit", "(", ")", "{", "if", "(", "$", "this", "->", "transactions", "==", "1", ")", "{", "$", "this", "->", "getPdo", "(", ")", "->", "commit", "(", ")", ";", "}", "$", "this", "->", "transactions", "=", "max", "(", "0", ...
Commit the active database transaction. @return void
[ "Commit", "the", "active", "database", "transaction", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Concerns/ManagesTransactions.php#L154-L163
train
Commit all transactions
[ 30522, 2270, 3853, 10797, 1006, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 11817, 1027, 1027, 1015, 1007, 1063, 1002, 2023, 1011, 1028, 2131, 17299, 2080, 1006, 1007, 1011, 1028, 10797, 1006, 1007, 1025, 1065, 1002, 2023, 1011, 1028, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Validate/File/Exists.php
Zend_Validate_File_Exists.getDirectory
public function getDirectory($asArray = false) { $asArray = (bool) $asArray; $directory = (string) $this->_directory; if ($asArray) { $directory = explode(',', $directory); } return $directory; }
php
public function getDirectory($asArray = false) { $asArray = (bool) $asArray; $directory = (string) $this->_directory; if ($asArray) { $directory = explode(',', $directory); } return $directory; }
[ "public", "function", "getDirectory", "(", "$", "asArray", "=", "false", ")", "{", "$", "asArray", "=", "(", "bool", ")", "$", "asArray", ";", "$", "directory", "=", "(", "string", ")", "$", "this", "->", "_directory", ";", "if", "(", "$", "asArray",...
Returns the set file directories which are checked @param boolean $asArray Returns the values as array, when false an concated string is returned @return string
[ "Returns", "the", "set", "file", "directories", "which", "are", "checked" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Validate/File/Exists.php#L88-L97
train
Get directory of the file
[ 30522, 2270, 3853, 2131, 4305, 2890, 16761, 2100, 1006, 1002, 17306, 11335, 2100, 1027, 6270, 1007, 1063, 1002, 17306, 11335, 2100, 1027, 1006, 22017, 2140, 1007, 1002, 17306, 11335, 2100, 1025, 1002, 14176, 1027, 1006, 5164, 1007, 1002, 20...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/Plugin/ComponentFactory.php
ComponentFactory.factory
public static function factory($pluginName, $componentClassSimpleName, $componentTypeClass) { if (empty($pluginName) || empty($componentClassSimpleName)) { Log::debug("ComponentFactory::%s: empty plugin name or component simple name requested (%s, %s)", __FUNCTION__, $pluginName, $componentClassSimpleName); return null; } $plugin = self::getActivatedPlugin(__FUNCTION__, $pluginName); if (empty($plugin)) { return null; } $subnamespace = $componentTypeClass::COMPONENT_SUBNAMESPACE; $desiredComponentClass = 'Piwik\\Plugins\\' . $pluginName . '\\' . $subnamespace . '\\' . $componentClassSimpleName; $components = $plugin->findMultipleComponents($subnamespace, $componentTypeClass); foreach ($components as $class) { if ($class == $desiredComponentClass) { return new $class(); } } Log::debug("ComponentFactory::%s: Could not find requested component (args = ['%s', '%s', '%s']).", __FUNCTION__, $pluginName, $componentClassSimpleName, $componentTypeClass); return null; }
php
public static function factory($pluginName, $componentClassSimpleName, $componentTypeClass) { if (empty($pluginName) || empty($componentClassSimpleName)) { Log::debug("ComponentFactory::%s: empty plugin name or component simple name requested (%s, %s)", __FUNCTION__, $pluginName, $componentClassSimpleName); return null; } $plugin = self::getActivatedPlugin(__FUNCTION__, $pluginName); if (empty($plugin)) { return null; } $subnamespace = $componentTypeClass::COMPONENT_SUBNAMESPACE; $desiredComponentClass = 'Piwik\\Plugins\\' . $pluginName . '\\' . $subnamespace . '\\' . $componentClassSimpleName; $components = $plugin->findMultipleComponents($subnamespace, $componentTypeClass); foreach ($components as $class) { if ($class == $desiredComponentClass) { return new $class(); } } Log::debug("ComponentFactory::%s: Could not find requested component (args = ['%s', '%s', '%s']).", __FUNCTION__, $pluginName, $componentClassSimpleName, $componentTypeClass); return null; }
[ "public", "static", "function", "factory", "(", "$", "pluginName", ",", "$", "componentClassSimpleName", ",", "$", "componentTypeClass", ")", "{", "if", "(", "empty", "(", "$", "pluginName", ")", "||", "empty", "(", "$", "componentClassSimpleName", ")", ")", ...
Create a component instance that exists within a specific plugin. Uses the component's unqualified class name and expected base type. This method will only create a class if it is located within the component type's associated subdirectory. @param string $pluginName The name of the plugin the component is expected to belong to, eg, `'DevicesDetection'`. @param string $componentClassSimpleName The component's class name w/o namespace, eg, `"GetKeywords"`. @param string $componentTypeClass The fully qualified class name of the component type, eg, `"Piwik\Plugin\Report"`. @return mixed|null A new instance of the desired component or null if not found. If the plugin is not loaded or activated or the component is not located in in the sub-namespace specified by `$componentTypeClass::COMPONENT_SUBNAMESPACE`, this method will return null.
[ "Create", "a", "component", "instance", "that", "exists", "within", "a", "specific", "plugin", ".", "Uses", "the", "component", "s", "unqualified", "class", "name", "and", "expected", "base", "type", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Plugin/ComponentFactory.php#L37-L65
train
Factory method to create a new component
[ 30522, 2270, 10763, 3853, 4713, 1006, 1002, 13354, 23111, 14074, 1010, 1002, 6922, 26266, 5332, 23344, 18442, 1010, 1002, 6922, 13874, 26266, 1007, 1063, 2065, 1006, 4064, 1006, 1002, 13354, 23111, 14074, 1007, 1064, 1064, 4064, 1006, 1002, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
z-song/laravel-admin
src/Show.php
Show.handleModelField
protected function handleModelField($method, $label) { if (in_array($method, $this->model->getAttributes())) { return $this->addField($method, $label); } return false; }
php
protected function handleModelField($method, $label) { if (in_array($method, $this->model->getAttributes())) { return $this->addField($method, $label); } return false; }
[ "protected", "function", "handleModelField", "(", "$", "method", ",", "$", "label", ")", "{", "if", "(", "in_array", "(", "$", "method", ",", "$", "this", "->", "model", "->", "getAttributes", "(", ")", ")", ")", "{", "return", "$", "this", "->", "ad...
Handle model field. @param string $method @param string $label @return bool|Field
[ "Handle", "model", "field", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Show.php#L490-L497
train
Handle Model Field
[ 30522, 5123, 3853, 5047, 5302, 9247, 3790, 1006, 1002, 4118, 1010, 1002, 3830, 1007, 1063, 2065, 1006, 1999, 1035, 9140, 1006, 1002, 4118, 1010, 1002, 2023, 1011, 1028, 2944, 1011, 1028, 2131, 19321, 3089, 8569, 4570, 1006, 1007, 1007, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Validator/Mapping/ClassMetadata.php
ClassMetadata.addPropertyConstraint
public function addPropertyConstraint($property, Constraint $constraint) { if (!isset($this->properties[$property])) { $this->properties[$property] = new PropertyMetadata($this->getClassName(), $property); $this->addPropertyMetadata($this->properties[$property]); } $constraint->addImplicitGroupName($this->getDefaultGroup()); $this->properties[$property]->addConstraint($constraint); return $this; }
php
public function addPropertyConstraint($property, Constraint $constraint) { if (!isset($this->properties[$property])) { $this->properties[$property] = new PropertyMetadata($this->getClassName(), $property); $this->addPropertyMetadata($this->properties[$property]); } $constraint->addImplicitGroupName($this->getDefaultGroup()); $this->properties[$property]->addConstraint($constraint); return $this; }
[ "public", "function", "addPropertyConstraint", "(", "$", "property", ",", "Constraint", "$", "constraint", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "properties", "[", "$", "property", "]", ")", ")", "{", "$", "this", "->", "properties",...
Adds a constraint to the given property. @param string $property The name of the property @param Constraint $constraint The constraint @return $this
[ "Adds", "a", "constraint", "to", "the", "given", "property", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Validator/Mapping/ClassMetadata.php#L213-L226
train
Add a property constraint
[ 30522, 2270, 3853, 5587, 21572, 4842, 3723, 8663, 20528, 18447, 1006, 1002, 3200, 1010, 27142, 1002, 27142, 1007, 1063, 2065, 30524, 5144, 1031, 1002, 3200, 1033, 1027, 2047, 3200, 11368, 8447, 2696, 1006, 1002, 2023, 1011, 1028, 2131, 2626...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/cms/twig/Loader.php
Loader.isFresh
public function isFresh($name, $time) { if (!$this->validateCmsObject($name)) { return parent::isFresh($name, $time); } return $this->obj->mtime <= $time; }
php
public function isFresh($name, $time) { if (!$this->validateCmsObject($name)) { return parent::isFresh($name, $time); } return $this->obj->mtime <= $time; }
[ "public", "function", "isFresh", "(", "$", "name", ",", "$", "time", ")", "{", "if", "(", "!", "$", "this", "->", "validateCmsObject", "(", "$", "name", ")", ")", "{", "return", "parent", "::", "isFresh", "(", "$", "name", ",", "$", "time", ")", ...
Determines if the content is fresh.
[ "Determines", "if", "the", "content", "is", "fresh", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/twig/Loader.php#L81-L88
train
Returns true if the object is fresh.
[ 30522, 2270, 3853, 2003, 19699, 9953, 1006, 1002, 2171, 1010, 1002, 2051, 1007, 1063, 2065, 1006, 999, 1002, 2023, 1011, 1028, 9398, 3686, 27487, 6499, 2497, 20614, 1006, 1002, 2171, 1007, 1007, 1063, 2709, 6687, 1024, 1024, 2003, 19699, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/DataTable/Filter/ColumnDelete.php
ColumnDelete.filter
public function filter($table) { // always do recursive filter $this->enableRecursive(true); $recurse = false; // only recurse if there are columns to remove/keep // remove columns specified in $this->columnsToRemove if (!empty($this->columnsToRemove)) { $this->removeColumnsFromTable($table); $recurse = true; } // remove columns not specified in $columnsToKeep if (!empty($this->columnsToKeep)) { foreach ($table as $index => $row) { $columnsToDelete = array(); foreach ($row as $name => $value) { $keep = false; // @see self::APPEND_TO_COLUMN_NAME_TO_KEEP foreach ($this->columnsToKeep as $nameKeep => $true) { if (strpos($name, $nameKeep . self::APPEND_TO_COLUMN_NAME_TO_KEEP) === 0) { $keep = true; } } if (!$keep && $name != 'label' // label cannot be removed via whitelisting && !isset($this->columnsToKeep[$name]) ) { // we cannot remove row directly to prevent notice "ArrayIterator::next(): Array was modified // outside object and internal position is no longer valid in /var/www..." $columnsToDelete[] = $name; } } foreach ($columnsToDelete as $columnToDelete) { unset($table[$index][$columnToDelete]); } } $recurse = true; } // recurse if ($recurse && !is_array($table)) { foreach ($table as $row) { $this->filterSubTable($row); } } return $table; }
php
public function filter($table) { // always do recursive filter $this->enableRecursive(true); $recurse = false; // only recurse if there are columns to remove/keep // remove columns specified in $this->columnsToRemove if (!empty($this->columnsToRemove)) { $this->removeColumnsFromTable($table); $recurse = true; } // remove columns not specified in $columnsToKeep if (!empty($this->columnsToKeep)) { foreach ($table as $index => $row) { $columnsToDelete = array(); foreach ($row as $name => $value) { $keep = false; // @see self::APPEND_TO_COLUMN_NAME_TO_KEEP foreach ($this->columnsToKeep as $nameKeep => $true) { if (strpos($name, $nameKeep . self::APPEND_TO_COLUMN_NAME_TO_KEEP) === 0) { $keep = true; } } if (!$keep && $name != 'label' // label cannot be removed via whitelisting && !isset($this->columnsToKeep[$name]) ) { // we cannot remove row directly to prevent notice "ArrayIterator::next(): Array was modified // outside object and internal position is no longer valid in /var/www..." $columnsToDelete[] = $name; } } foreach ($columnsToDelete as $columnToDelete) { unset($table[$index][$columnToDelete]); } } $recurse = true; } // recurse if ($recurse && !is_array($table)) { foreach ($table as $row) { $this->filterSubTable($row); } } return $table; }
[ "public", "function", "filter", "(", "$", "table", ")", "{", "// always do recursive filter", "$", "this", "->", "enableRecursive", "(", "true", ")", ";", "$", "recurse", "=", "false", ";", "// only recurse if there are columns to remove/keep", "// remove columns specif...
See {@link ColumnDelete}. @param DataTable $table @return DataTable
[ "See", "{", "@link", "ColumnDelete", "}", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/DataTable/Filter/ColumnDelete.php#L96-L147
train
Filter the table
[ 30522, 2270, 3853, 11307, 1006, 1002, 2795, 1007, 1063, 1013, 1013, 2467, 2079, 28667, 9236, 3512, 11307, 1002, 2023, 1011, 1028, 9585, 2890, 10841, 2869, 3512, 1006, 2995, 1007, 1025, 1002, 28667, 28393, 1027, 6270, 1025, 1013, 1013, 2069,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Validation/Concerns/ValidatesAttributes.php
ValidatesAttributes.validateGt
public function validateGt($attribute, $value, $parameters) { $this->requireParameterCount(1, $parameters, 'gt'); $comparedToValue = $this->getValue($parameters[0]); $this->shouldBeNumeric($attribute, 'Gt'); if (is_null($comparedToValue) && (is_numeric($value) && is_numeric($parameters[0]))) { return $this->getSize($attribute, $value) > $parameters[0]; } if (! $this->isSameType($value, $comparedToValue)) { return false; } return $this->getSize($attribute, $value) > $this->getSize($attribute, $comparedToValue); }
php
public function validateGt($attribute, $value, $parameters) { $this->requireParameterCount(1, $parameters, 'gt'); $comparedToValue = $this->getValue($parameters[0]); $this->shouldBeNumeric($attribute, 'Gt'); if (is_null($comparedToValue) && (is_numeric($value) && is_numeric($parameters[0]))) { return $this->getSize($attribute, $value) > $parameters[0]; } if (! $this->isSameType($value, $comparedToValue)) { return false; } return $this->getSize($attribute, $value) > $this->getSize($attribute, $comparedToValue); }
[ "public", "function", "validateGt", "(", "$", "attribute", ",", "$", "value", ",", "$", "parameters", ")", "{", "$", "this", "->", "requireParameterCount", "(", "1", ",", "$", "parameters", ",", "'gt'", ")", ";", "$", "comparedToValue", "=", "$", "this",...
Validate that an attribute is greater than another attribute. @param string $attribute @param mixed $value @param array $parameters @return bool
[ "Validate", "that", "an", "attribute", "is", "greater", "than", "another", "attribute", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Validation/Concerns/ValidatesAttributes.php#L882-L899
train
Validate that an attribute is greater than another attribute value
[ 30522, 2270, 3853, 9398, 3686, 13512, 1006, 1002, 17961, 1010, 1002, 3643, 1010, 1002, 11709, 1007, 1063, 1002, 2023, 1011, 1028, 5478, 28689, 22828, 3597, 16671, 1006, 1015, 1010, 1002, 11709, 1010, 1005, 14181, 1005, 1007, 1025, 1002, 410...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/HttpFoundation/Session/Storage/MockFileSessionStorage.php
MockFileSessionStorage.read
private function read() { $filePath = $this->getFilePath(); $this->data = is_readable($filePath) && is_file($filePath) ? unserialize(file_get_contents($filePath)) : []; $this->loadSession(); }
php
private function read() { $filePath = $this->getFilePath(); $this->data = is_readable($filePath) && is_file($filePath) ? unserialize(file_get_contents($filePath)) : []; $this->loadSession(); }
[ "private", "function", "read", "(", ")", "{", "$", "filePath", "=", "$", "this", "->", "getFilePath", "(", ")", ";", "$", "this", "->", "data", "=", "is_readable", "(", "$", "filePath", ")", "&&", "is_file", "(", "$", "filePath", ")", "?", "unseriali...
Reads session from storage and loads session.
[ "Reads", "session", "from", "storage", "and", "loads", "session", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpFoundation/Session/Storage/MockFileSessionStorage.php#L145-L151
train
Read the session data from the file
[ 30522, 2797, 3853, 3191, 1006, 1007, 1063, 1002, 5371, 15069, 1027, 1002, 2023, 1011, 1028, 2131, 8873, 2571, 15069, 1006, 1007, 1025, 1002, 2023, 1011, 1028, 2951, 1027, 2003, 1035, 3191, 3085, 1006, 1002, 5371, 15069, 1007, 1004, 1004, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Eloquent/Relations/Concerns/AsPivot.php
AsPivot.newQueryForCollectionRestoration
protected function newQueryForCollectionRestoration(array $ids) { if (! Str::contains($ids[0], ':')) { return parent::newQueryForRestoration($ids); } $query = $this->newQueryWithoutScopes(); foreach ($ids as $id) { $segments = explode(':', $id); $query->orWhere(function ($query) use ($segments) { return $query->where($segments[0], $segments[1]) ->where($segments[2], $segments[3]); }); } return $query; }
php
protected function newQueryForCollectionRestoration(array $ids) { if (! Str::contains($ids[0], ':')) { return parent::newQueryForRestoration($ids); } $query = $this->newQueryWithoutScopes(); foreach ($ids as $id) { $segments = explode(':', $id); $query->orWhere(function ($query) use ($segments) { return $query->where($segments[0], $segments[1]) ->where($segments[2], $segments[3]); }); } return $query; }
[ "protected", "function", "newQueryForCollectionRestoration", "(", "array", "$", "ids", ")", "{", "if", "(", "!", "Str", "::", "contains", "(", "$", "ids", "[", "0", "]", ",", "':'", ")", ")", "{", "return", "parent", "::", "newQueryForRestoration", "(", ...
Get a new query to restore multiple models by their queueable IDs. @param array|int $ids @return \Illuminate\Database\Eloquent\Builder
[ "Get", "a", "new", "query", "to", "restore", "multiple", "models", "by", "their", "queueable", "IDs", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Relations/Concerns/AsPivot.php#L285-L303
train
Returns a new query for restoration
[ 30522, 5123, 3853, 2047, 4226, 2854, 29278, 26895, 18491, 28533, 21223, 1006, 9140, 1002, 8909, 2015, 1007, 1063, 2065, 1006, 999, 2358, 2099, 1024, 1024, 3397, 1006, 1002, 8909, 2015, 1031, 1014, 1033, 1010, 1005, 1024, 1005, 1007, 1007, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Eloquent/Relations/HasManyThrough.php
HasManyThrough.getRelationExistenceQueryForSelfRelation
public function getRelationExistenceQueryForSelfRelation(Builder $query, Builder $parentQuery, $columns = ['*']) { $query->from($query->getModel()->getTable().' as '.$hash = $this->getRelationCountHash()); $query->join($this->throughParent->getTable(), $this->getQualifiedParentKeyName(), '=', $hash.'.'.$this->secondKey); if ($this->throughParentSoftDeletes()) { $query->whereNull($this->throughParent->getQualifiedDeletedAtColumn()); } $query->getModel()->setTable($hash); return $query->select($columns)->whereColumn( $parentQuery->getQuery()->from.'.'.$this->localKey, '=', $this->getQualifiedFirstKeyName() ); }
php
public function getRelationExistenceQueryForSelfRelation(Builder $query, Builder $parentQuery, $columns = ['*']) { $query->from($query->getModel()->getTable().' as '.$hash = $this->getRelationCountHash()); $query->join($this->throughParent->getTable(), $this->getQualifiedParentKeyName(), '=', $hash.'.'.$this->secondKey); if ($this->throughParentSoftDeletes()) { $query->whereNull($this->throughParent->getQualifiedDeletedAtColumn()); } $query->getModel()->setTable($hash); return $query->select($columns)->whereColumn( $parentQuery->getQuery()->from.'.'.$this->localKey, '=', $this->getQualifiedFirstKeyName() ); }
[ "public", "function", "getRelationExistenceQueryForSelfRelation", "(", "Builder", "$", "query", ",", "Builder", "$", "parentQuery", ",", "$", "columns", "=", "[", "'*'", "]", ")", "{", "$", "query", "->", "from", "(", "$", "query", "->", "getModel", "(", "...
Add the constraints for a relationship query on the same table. @param \Illuminate\Database\Eloquent\Builder $query @param \Illuminate\Database\Eloquent\Builder $parentQuery @param array|mixed $columns @return \Illuminate\Database\Eloquent\Builder
[ "Add", "the", "constraints", "for", "a", "relationship", "query", "on", "the", "same", "table", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Relations/HasManyThrough.php#L526-L541
train
Get Query for a self relation
[ 30522, 2270, 3853, 2131, 16570, 3370, 10288, 27870, 5897, 4226, 2854, 29278, 11246, 19699, 10581, 3508, 1006, 12508, 1002, 23032, 1010, 12508, 1002, 6687, 4226, 2854, 1010, 1002, 7753, 1027, 1031, 1005, 1008, 1005, 1033, 1007, 1063, 1002, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/Tracker/Visit/ReferrerSpamFilter.php
ReferrerSpamFilter.isSpam
public function isSpam(Request $request) { $spammers = $this->getSpammerListFromCache(); $referrerUrl = $request->getParam('urlref'); foreach ($spammers as $spammerHost) { if (stripos($referrerUrl, $spammerHost) !== false) { Common::printDebug('Referrer URL is a known spam: ' . $spammerHost); return true; } } return false; }
php
public function isSpam(Request $request) { $spammers = $this->getSpammerListFromCache(); $referrerUrl = $request->getParam('urlref'); foreach ($spammers as $spammerHost) { if (stripos($referrerUrl, $spammerHost) !== false) { Common::printDebug('Referrer URL is a known spam: ' . $spammerHost); return true; } } return false; }
[ "public", "function", "isSpam", "(", "Request", "$", "request", ")", "{", "$", "spammers", "=", "$", "this", "->", "getSpammerListFromCache", "(", ")", ";", "$", "referrerUrl", "=", "$", "request", "->", "getParam", "(", "'urlref'", ")", ";", "foreach", ...
Check if the request is from a known spammer host. @param Request $request @return bool
[ "Check", "if", "the", "request", "is", "from", "a", "known", "spammer", "host", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Tracker/Visit/ReferrerSpamFilter.php#L33-L47
train
Check if the referrer URL is a known spam
[ 30522, 2270, 3853, 26354, 4502, 2213, 1006, 5227, 1002, 5227, 1007, 1063, 1002, 12403, 15810, 2015, 1027, 1002, 2023, 1011, 1028, 4152, 4502, 15810, 9863, 19699, 5358, 3540, 5403, 1006, 1007, 1025, 1002, 6523, 14544, 3126, 2140, 1027, 1002,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Finder/Finder.php
Finder.sortByName
public function sortByName(/* bool $useNaturalSort = false */) { if (\func_num_args() < 1 && __CLASS__ !== \get_class($this) && __CLASS__ !== (new \ReflectionMethod($this, __FUNCTION__))->getDeclaringClass()->getName() && !$this instanceof \PHPUnit\Framework\MockObject\MockObject && !$this instanceof \Prophecy\Prophecy\ProphecySubjectInterface) { @trigger_error(sprintf('The "%s()" method will have a new "bool $useNaturalSort = false" argument in version 5.0, not defining it is deprecated since Symfony 4.2.', __METHOD__), E_USER_DEPRECATED); } $useNaturalSort = 0 < \func_num_args() && func_get_arg(0); $this->sort = $useNaturalSort ? Iterator\SortableIterator::SORT_BY_NAME_NATURAL : Iterator\SortableIterator::SORT_BY_NAME; return $this; }
php
public function sortByName(/* bool $useNaturalSort = false */) { if (\func_num_args() < 1 && __CLASS__ !== \get_class($this) && __CLASS__ !== (new \ReflectionMethod($this, __FUNCTION__))->getDeclaringClass()->getName() && !$this instanceof \PHPUnit\Framework\MockObject\MockObject && !$this instanceof \Prophecy\Prophecy\ProphecySubjectInterface) { @trigger_error(sprintf('The "%s()" method will have a new "bool $useNaturalSort = false" argument in version 5.0, not defining it is deprecated since Symfony 4.2.', __METHOD__), E_USER_DEPRECATED); } $useNaturalSort = 0 < \func_num_args() && func_get_arg(0); $this->sort = $useNaturalSort ? Iterator\SortableIterator::SORT_BY_NAME_NATURAL : Iterator\SortableIterator::SORT_BY_NAME; return $this; }
[ "public", "function", "sortByName", "(", "/* bool $useNaturalSort = false */", ")", "{", "if", "(", "\\", "func_num_args", "(", ")", "<", "1", "&&", "__CLASS__", "!==", "\\", "get_class", "(", "$", "this", ")", "&&", "__CLASS__", "!==", "(", "new", "\\", "...
Sorts files and directories by name. This can be slow as all the matching files and directories must be retrieved for comparison. @param bool $useNaturalSort Whether to use natural sort or not, disabled by default @return $this @see SortableIterator
[ "Sorts", "files", "and", "directories", "by", "name", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Finder/Finder.php#L441-L451
train
Sort the iterator by name
[ 30522, 2270, 3853, 4066, 3762, 18442, 1006, 1013, 1008, 22017, 2140, 1002, 2224, 19833, 11137, 21748, 2102, 1027, 6270, 1008, 1013, 1007, 1063, 2065, 1006, 1032, 4569, 2278, 1035, 16371, 2213, 1035, 12098, 5620, 1006, 1007, 1026, 1015, 1004...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
ccxt/ccxt
php/Exchange.php
Exchange.safe_float_2
public static function safe_float_2 ($object, $key1, $key2, $default_value = null) { $value = static::safe_float ($object, $key1); return isset ($value) ? $value : static::safe_float ($object, $key2, $default_value); }
php
public static function safe_float_2 ($object, $key1, $key2, $default_value = null) { $value = static::safe_float ($object, $key1); return isset ($value) ? $value : static::safe_float ($object, $key2, $default_value); }
[ "public", "static", "function", "safe_float_2", "(", "$", "object", ",", "$", "key1", ",", "$", "key2", ",", "$", "default_value", "=", "null", ")", "{", "$", "value", "=", "static", "::", "safe_float", "(", "$", "object", ",", "$", "key1", ")", ";",...
we're not using safe_float_3 either because those cases are too rare to deserve their own optimization
[ "we", "re", "not", "using", "safe_float_3", "either", "because", "those", "cases", "are", "too", "rare", "to", "deserve", "their", "own", "optimization" ]
0113da333a51acded0b44d9528809bbf654acfbd
https://github.com/ccxt/ccxt/blob/0113da333a51acded0b44d9528809bbf654acfbd/php/Exchange.php#L247-L250
train
Wrapper for the safe_float function.
[ 30522, 2270, 10763, 3853, 3647, 1035, 14257, 1035, 1016, 1006, 1002, 4874, 1010, 1002, 3145, 2487, 1010, 1002, 3145, 2475, 1010, 1002, 12398, 1035, 3643, 1027, 19701, 1007, 1063, 1002, 3643, 1027, 10763, 1024, 1024, 3647, 1035, 14257, 1006,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Console/Style/SymfonyStyle.php
SymfonyStyle.writeln
public function writeln($messages, $type = self::OUTPUT_NORMAL) { if (!is_iterable($messages)) { $messages = [$messages]; } foreach ($messages as $message) { parent::writeln($message, $type); $this->writeBuffer($message, true, $type); } }
php
public function writeln($messages, $type = self::OUTPUT_NORMAL) { if (!is_iterable($messages)) { $messages = [$messages]; } foreach ($messages as $message) { parent::writeln($message, $type); $this->writeBuffer($message, true, $type); } }
[ "public", "function", "writeln", "(", "$", "messages", ",", "$", "type", "=", "self", "::", "OUTPUT_NORMAL", ")", "{", "if", "(", "!", "is_iterable", "(", "$", "messages", ")", ")", "{", "$", "messages", "=", "[", "$", "messages", "]", ";", "}", "f...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Console/Style/SymfonyStyle.php#L307-L317
train
Write messages to the output buffer
[ 30522, 2270, 3853, 4339, 19666, 1006, 1002, 7696, 1010, 1002, 2828, 1027, 2969, 1024, 1024, 6434, 1035, 3671, 1007, 1063, 2065, 1006, 999, 2003, 1035, 2009, 6906, 3468, 1006, 1002, 7696, 1007, 1007, 1063, 1002, 7696, 1027, 1031, 1002, 769...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/Db/Schema.php
Schema.loadSchema
private function loadSchema() { $config = Config::getInstance(); $dbInfos = $config->database; $schemaName = trim($dbInfos['schema']); $className = self::getSchemaClassName($schemaName); $this->schema = new $className(); }
php
private function loadSchema() { $config = Config::getInstance(); $dbInfos = $config->database; $schemaName = trim($dbInfos['schema']); $className = self::getSchemaClassName($schemaName); $this->schema = new $className(); }
[ "private", "function", "loadSchema", "(", ")", "{", "$", "config", "=", "Config", "::", "getInstance", "(", ")", ";", "$", "dbInfos", "=", "$", "config", "->", "database", ";", "$", "schemaName", "=", "trim", "(", "$", "dbInfos", "[", "'schema'", "]", ...
Load schema
[ "Load", "schema" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Db/Schema.php#L54-L62
train
Load schema from database
[ 30522, 2797, 3853, 15665, 30524, 1025, 1002, 16962, 2378, 14876, 2015, 1027, 1002, 9530, 8873, 2290, 1011, 1028, 7809, 1025, 1002, 8040, 28433, 18442, 1027, 12241, 1006, 1002, 16962, 2378, 14876, 2015, 1031, 1005, 8040, 28433, 1005, 1033, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/system/classes/MarkupManager.php
MarkupManager.registerExtensions
public function registerExtensions($type, array $definitions) { $items = $this->transactionMode ? 'transactionItems' : 'items'; if ($this->$items === null) { $this->$items = []; } if (!array_key_exists($type, $this->$items)) { $this->$items[$type] = []; } foreach ($definitions as $name => $definition) { switch ($type) { case self::EXTENSION_TOKEN_PARSER: $this->$items[$type][] = $definition; break; case self::EXTENSION_FILTER: case self::EXTENSION_FUNCTION: $this->$items[$type][$name] = $definition; break; } } }
php
public function registerExtensions($type, array $definitions) { $items = $this->transactionMode ? 'transactionItems' : 'items'; if ($this->$items === null) { $this->$items = []; } if (!array_key_exists($type, $this->$items)) { $this->$items[$type] = []; } foreach ($definitions as $name => $definition) { switch ($type) { case self::EXTENSION_TOKEN_PARSER: $this->$items[$type][] = $definition; break; case self::EXTENSION_FILTER: case self::EXTENSION_FUNCTION: $this->$items[$type][$name] = $definition; break; } } }
[ "public", "function", "registerExtensions", "(", "$", "type", ",", "array", "$", "definitions", ")", "{", "$", "items", "=", "$", "this", "->", "transactionMode", "?", "'transactionItems'", ":", "'items'", ";", "if", "(", "$", "this", "->", "$", "items", ...
Registers the CMS Twig extension items. The argument is an array of the extension definitions. The array keys represent the function/filter name, specific for the plugin/module. Each element in the array should be an associative array. @param string $type The extension type: filters, functions, tokens @param array $definitions An array of the extension definitions.
[ "Registers", "the", "CMS", "Twig", "extension", "items", ".", "The", "argument", "is", "an", "array", "of", "the", "extension", "definitions", ".", "The", "array", "keys", "represent", "the", "function", "/", "filter", "name", "specific", "for", "the", "plug...
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/MarkupManager.php#L114-L138
train
Registers the extensions for the given type
[ 30522, 2270, 3853, 4236, 10288, 29048, 2015, 1006, 1002, 2828, 1010, 9140, 1002, 15182, 1007, 1063, 1002, 5167, 1027, 1002, 2023, 1011, 1028, 12598, 5302, 3207, 1029, 1005, 12598, 4221, 5244, 1005, 1024, 1005, 5167, 1005, 1025, 2065, 1006, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Validator/Constraints/ExpressionValidator.php
ExpressionValidator.validate
public function validate($value, Constraint $constraint) { if (!$constraint instanceof Expression) { throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Expression'); } $variables = $constraint->values; $variables['value'] = $value; $variables['this'] = $this->context->getObject(); if (!$this->getExpressionLanguage()->evaluate($constraint->expression, $variables)) { $this->context->buildViolation($constraint->message) ->setParameter('{{ value }}', $this->formatValue($value, self::OBJECT_TO_STRING)) ->setCode(Expression::EXPRESSION_FAILED_ERROR) ->addViolation(); } }
php
public function validate($value, Constraint $constraint) { if (!$constraint instanceof Expression) { throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Expression'); } $variables = $constraint->values; $variables['value'] = $value; $variables['this'] = $this->context->getObject(); if (!$this->getExpressionLanguage()->evaluate($constraint->expression, $variables)) { $this->context->buildViolation($constraint->message) ->setParameter('{{ value }}', $this->formatValue($value, self::OBJECT_TO_STRING)) ->setCode(Expression::EXPRESSION_FAILED_ERROR) ->addViolation(); } }
[ "public", "function", "validate", "(", "$", "value", ",", "Constraint", "$", "constraint", ")", "{", "if", "(", "!", "$", "constraint", "instanceof", "Expression", ")", "{", "throw", "new", "UnexpectedTypeException", "(", "$", "constraint", ",", "__NAMESPACE__...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Validator/Constraints/ExpressionValidator.php#L36-L52
train
Validate the value against the expression
[ 30522, 2270, 3853, 9398, 3686, 1006, 1002, 3643, 1010, 27142, 1002, 27142, 1007, 1063, 2065, 1006, 999, 1002, 27142, 6013, 11253, 3670, 1007, 1063, 5466, 2047, 9223, 13874, 10288, 24422, 1006, 1002, 27142, 1010, 1035, 1035, 3415, 15327, 103...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Eloquent/Relations/HasOne.php
HasOne.match
public function match(array $models, Collection $results, $relation) { return $this->matchOne($models, $results, $relation); }
php
public function match(array $models, Collection $results, $relation) { return $this->matchOne($models, $results, $relation); }
[ "public", "function", "match", "(", "array", "$", "models", ",", "Collection", "$", "results", ",", "$", "relation", ")", "{", "return", "$", "this", "->", "matchOne", "(", "$", "models", ",", "$", "results", ",", "$", "relation", ")", ";", "}" ]
Match the eagerly loaded results to their parents. @param array $models @param \Illuminate\Database\Eloquent\Collection $results @param string $relation @return array
[ "Match", "the", "eagerly", "loaded", "results", "to", "their", "parents", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Relations/HasOne.php#L51-L54
train
Match one or more models to a list of models
[ 30522, 2270, 3853, 2674, 1006, 9140, 1002, 4275, 1010, 3074, 1002, 3463, 1010, 1002, 7189, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 2674, 5643, 1006, 1002, 4275, 1010, 1002, 3463, 1010, 1002, 7189, 1007, 1025, 1065, 102, 0, 0, 0, 0, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Notifications/Messages/MailMessage.php
MailMessage.markdown
public function markdown($view, array $data = []) { $this->markdown = $view; $this->viewData = $data; $this->view = null; return $this; }
php
public function markdown($view, array $data = []) { $this->markdown = $view; $this->viewData = $data; $this->view = null; return $this; }
[ "public", "function", "markdown", "(", "$", "view", ",", "array", "$", "data", "=", "[", "]", ")", "{", "$", "this", "->", "markdown", "=", "$", "view", ";", "$", "this", "->", "viewData", "=", "$", "data", ";", "$", "this", "->", "view", "=", ...
Set the Markdown template for the notification. @param string $view @param array $data @return $this
[ "Set", "the", "Markdown", "template", "for", "the", "notification", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Notifications/Messages/MailMessage.php#L107-L115
train
Set the Markdown view
[ 30522, 2270, 3853, 2928, 7698, 1006, 1002, 3193, 1010, 9140, 1002, 2951, 1027, 1031, 1033, 1007, 1063, 1002, 2023, 1011, 1028, 2928, 7698, 1027, 1002, 3193, 1025, 1002, 2023, 1011, 1028, 3193, 2850, 2696, 1027, 1002, 2951, 1025, 1002, 202...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/PropertyAccess/PropertyAccessor.php
PropertyAccessor.writeIndex
private function writeIndex($zval, $index, $value) { if (!$zval[self::VALUE] instanceof \ArrayAccess && !\is_array($zval[self::VALUE])) { throw new NoSuchIndexException(sprintf('Cannot modify index "%s" in object of type "%s" because it doesn\'t implement \ArrayAccess.', $index, \get_class($zval[self::VALUE]))); } $zval[self::REF][$index] = $value; }
php
private function writeIndex($zval, $index, $value) { if (!$zval[self::VALUE] instanceof \ArrayAccess && !\is_array($zval[self::VALUE])) { throw new NoSuchIndexException(sprintf('Cannot modify index "%s" in object of type "%s" because it doesn\'t implement \ArrayAccess.', $index, \get_class($zval[self::VALUE]))); } $zval[self::REF][$index] = $value; }
[ "private", "function", "writeIndex", "(", "$", "zval", ",", "$", "index", ",", "$", "value", ")", "{", "if", "(", "!", "$", "zval", "[", "self", "::", "VALUE", "]", "instanceof", "\\", "ArrayAccess", "&&", "!", "\\", "is_array", "(", "$", "zval", "...
Sets the value of an index in a given array-accessible value. @param array $zval The array containing the array or \ArrayAccess object to write to @param string|int $index The index to write at @param mixed $value The value to write @throws NoSuchIndexException If the array does not implement \ArrayAccess or it is not an array
[ "Sets", "the", "value", "of", "an", "index", "in", "a", "given", "array", "-", "accessible", "value", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/PropertyAccess/PropertyAccessor.php#L522-L529
train
Write an index value in the array
[ 30522, 2797, 3853, 4339, 22254, 10288, 1006, 1002, 1062, 10175, 1010, 1002, 5950, 1010, 1002, 3643, 1007, 1063, 2065, 1006, 999, 1002, 1062, 10175, 1031, 2969, 1024, 1024, 3643, 1033, 6013, 11253, 1032, 9140, 6305, 9623, 2015, 1004, 1004, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/DataAccess/RawLogDao.php
RawLogDao.insertActionsToKeep
protected function insertActionsToKeep($maxIds, $olderThan = true, $insertIntoTempIterationStep = 100000) { $tempTableName = Common::prefixTable(self::DELETE_UNUSED_ACTIONS_TEMP_TABLE_NAME); $idColumns = $this->getTableIdColumns(); foreach ($this->dimensionMetadataProvider->getActionReferenceColumnsByTable() as $table => $columns) { $idCol = $idColumns[$table]; // Create select query for requesting ALL needed fields at once $sql = "SELECT " . implode(',' ,$columns) . " FROM " . Common::prefixTable($table) . " WHERE $idCol >= ? AND $idCol < ?"; if ($olderThan) { // Why start on zero? When running for a couple of months, this will generate about 10000+ queries with zero result. Use the lowest value instead.... saves a LOT of waiting time! $start = (int) Db::fetchOne("SELECT MIN($idCol) FROM " . Common::prefixTable($table));; $finish = $maxIds[$table]; } else { $start = $maxIds[$table]; $finish = (int) Db::fetchOne("SELECT MAX($idCol) FROM " . Common::prefixTable($table)); } // Borrowed from Db::segmentedFetchAll // Request records per $insertIntoTempIterationStep amount // Loop over the result set, mapping all numeric fields in a single insert query // Insert query would be: INSERT IGNORE INTO [temp_table] VALUES (X),(Y),(Z) depending on the amount of fields requested per row for ($i = $start; $i <= $finish; $i += $insertIntoTempIterationStep) { $currentParams = array($i, $i + $insertIntoTempIterationStep); $result = Db::fetchAll($sql, $currentParams); // Now we loop over the result set of max $insertIntoTempIterationStep rows and create insert queries $keepValues = []; foreach ($result as $row) { $keepValues = array_merge($keepValues, array_filter(array_values($row), "is_numeric")); if (count($keepValues) >= 1000) { $insert = 'INSERT IGNORE INTO ' . $tempTableName .' VALUES ('; $insert .= implode('),(', $keepValues); $insert .= ')'; Db::exec($insert); $keepValues = []; } } $insert = 'INSERT IGNORE INTO ' . $tempTableName .' VALUES ('; $insert .= implode('),(', $keepValues); $insert .= ')'; Db::exec($insert); } } }
php
protected function insertActionsToKeep($maxIds, $olderThan = true, $insertIntoTempIterationStep = 100000) { $tempTableName = Common::prefixTable(self::DELETE_UNUSED_ACTIONS_TEMP_TABLE_NAME); $idColumns = $this->getTableIdColumns(); foreach ($this->dimensionMetadataProvider->getActionReferenceColumnsByTable() as $table => $columns) { $idCol = $idColumns[$table]; // Create select query for requesting ALL needed fields at once $sql = "SELECT " . implode(',' ,$columns) . " FROM " . Common::prefixTable($table) . " WHERE $idCol >= ? AND $idCol < ?"; if ($olderThan) { // Why start on zero? When running for a couple of months, this will generate about 10000+ queries with zero result. Use the lowest value instead.... saves a LOT of waiting time! $start = (int) Db::fetchOne("SELECT MIN($idCol) FROM " . Common::prefixTable($table));; $finish = $maxIds[$table]; } else { $start = $maxIds[$table]; $finish = (int) Db::fetchOne("SELECT MAX($idCol) FROM " . Common::prefixTable($table)); } // Borrowed from Db::segmentedFetchAll // Request records per $insertIntoTempIterationStep amount // Loop over the result set, mapping all numeric fields in a single insert query // Insert query would be: INSERT IGNORE INTO [temp_table] VALUES (X),(Y),(Z) depending on the amount of fields requested per row for ($i = $start; $i <= $finish; $i += $insertIntoTempIterationStep) { $currentParams = array($i, $i + $insertIntoTempIterationStep); $result = Db::fetchAll($sql, $currentParams); // Now we loop over the result set of max $insertIntoTempIterationStep rows and create insert queries $keepValues = []; foreach ($result as $row) { $keepValues = array_merge($keepValues, array_filter(array_values($row), "is_numeric")); if (count($keepValues) >= 1000) { $insert = 'INSERT IGNORE INTO ' . $tempTableName .' VALUES ('; $insert .= implode('),(', $keepValues); $insert .= ')'; Db::exec($insert); $keepValues = []; } } $insert = 'INSERT IGNORE INTO ' . $tempTableName .' VALUES ('; $insert .= implode('),(', $keepValues); $insert .= ')'; Db::exec($insert); } } }
[ "protected", "function", "insertActionsToKeep", "(", "$", "maxIds", ",", "$", "olderThan", "=", "true", ",", "$", "insertIntoTempIterationStep", "=", "100000", ")", "{", "$", "tempTableName", "=", "Common", "::", "prefixTable", "(", "self", "::", "DELETE_UNUSED_...
protected for testing purposes
[ "protected", "for", "testing", "purposes" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/DataAccess/RawLogDao.php#L324-L371
train
Insert actions into the temp table
[ 30522, 5123, 3853, 19274, 18908, 8496, 18715, 4402, 2361, 1006, 1002, 21510, 5104, 1010, 1002, 3080, 21604, 1027, 2995, 1010, 1002, 19274, 18447, 12184, 8737, 21646, 10708, 2618, 2361, 1027, 6694, 8889, 1007, 1063, 1002, 8915, 27718, 3085, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/backend/widgets/Form.php
Form.getFormWidget
public function getFormWidget($field) { if (isset($this->formWidgets[$field])) { return $this->formWidgets[$field]; } return null; }
php
public function getFormWidget($field) { if (isset($this->formWidgets[$field])) { return $this->formWidgets[$field]; } return null; }
[ "public", "function", "getFormWidget", "(", "$", "field", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "formWidgets", "[", "$", "field", "]", ")", ")", "{", "return", "$", "this", "->", "formWidgets", "[", "$", "field", "]", ";", "}", "ret...
Get a specified form widget @param string $field @return mixed
[ "Get", "a", "specified", "form", "widget" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/Form.php#L982-L989
train
Get Form Widget
[ 30522, 2270, 3853, 2131, 14192, 9148, 24291, 1006, 1002, 2492, 1007, 1063, 2065, 1006, 26354, 3388, 1006, 1002, 2023, 1011, 1028, 2433, 9148, 28682, 1031, 1002, 2492, 1033, 1007, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 2433, 9148, 28682, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/PropertyInfo/PropertyInfoCacheExtractor.php
PropertyInfoCacheExtractor.isInitializable
public function isInitializable(string $class, string $property, array $context = []): ?bool { return $this->extract('isInitializable', [$class, $property, $context]); }
php
public function isInitializable(string $class, string $property, array $context = []): ?bool { return $this->extract('isInitializable', [$class, $property, $context]); }
[ "public", "function", "isInitializable", "(", "string", "$", "class", ",", "string", "$", "property", ",", "array", "$", "context", "=", "[", "]", ")", ":", "?", "bool", "{", "return", "$", "this", "->", "extract", "(", "'isInitializable'", ",", "[", "...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/PropertyInfo/PropertyInfoCacheExtractor.php#L93-L96
train
Is initializable - Returns true if the property is initializable
[ 30522, 2270, 3853, 2003, 5498, 20925, 21335, 3468, 1006, 5164, 1002, 2465, 1010, 5164, 1002, 3200, 1010, 9140, 1002, 6123, 1027, 1031, 1033, 1007, 1024, 1029, 22017, 2140, 1063, 2709, 1002, 2023, 1011, 1028, 14817, 1006, 1005, 2003, 5498, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/SitesManager/Model.php
Model.getSiteFromId
public function getSiteFromId($idSite) { $db = $this->getDb(); $site = $db->fetchRow("SELECT * FROM " . $this->table . " WHERE idsite = ?", $idSite); return $site; }
php
public function getSiteFromId($idSite) { $db = $this->getDb(); $site = $db->fetchRow("SELECT * FROM " . $this->table . " WHERE idsite = ?", $idSite); return $site; }
[ "public", "function", "getSiteFromId", "(", "$", "idSite", ")", "{", "$", "db", "=", "$", "this", "->", "getDb", "(", ")", ";", "$", "site", "=", "$", "db", "->", "fetchRow", "(", "\"SELECT * FROM \"", ".", "$", "this", "->", "table", ".", "\"\n ...
Returns the website information : name, main_url @throws Exception if the site ID doesn't exist or the user doesn't have access to it @param int $idSite @return array
[ "Returns", "the", "website", "information", ":", "name", "main_url" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/SitesManager/Model.php#L230-L237
train
Get the record of the type of the site from the id
[ 30522, 2270, 3853, 4152, 4221, 19699, 20936, 2094, 1006, 1002, 8909, 28032, 2063, 1007, 1063, 1002, 16962, 1027, 1002, 2023, 1011, 1028, 2131, 18939, 1006, 1007, 1025, 1002, 2609, 1027, 1002, 16962, 1011, 1028, 18584, 10524, 1006, 1000, 727...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php
PdoSessionHandler.doWrite
protected function doWrite($sessionId, $data) { $maxlifetime = (int) ini_get('session.gc_maxlifetime'); try { // We use a single MERGE SQL query when supported by the database. $mergeStmt = $this->getMergeStatement($sessionId, $data, $maxlifetime); if (null !== $mergeStmt) { $mergeStmt->execute(); return true; } $updateStmt = $this->getUpdateStatement($sessionId, $data, $maxlifetime); $updateStmt->execute(); // When MERGE is not supported, like in Postgres < 9.5, we have to use this approach that can result in // duplicate key errors when the same session is written simultaneously (given the LOCK_NONE behavior). // We can just catch such an error and re-execute the update. This is similar to a serializable // transaction with retry logic on serialization failures but without the overhead and without possible // false positives due to longer gap locking. if (!$updateStmt->rowCount()) { try { $insertStmt = $this->getInsertStatement($sessionId, $data, $maxlifetime); $insertStmt->execute(); } catch (\PDOException $e) { // Handle integrity violation SQLSTATE 23000 (or a subclass like 23505 in Postgres) for duplicate keys if (0 === strpos($e->getCode(), '23')) { $updateStmt->execute(); } else { throw $e; } } } } catch (\PDOException $e) { $this->rollback(); throw $e; } return true; }
php
protected function doWrite($sessionId, $data) { $maxlifetime = (int) ini_get('session.gc_maxlifetime'); try { // We use a single MERGE SQL query when supported by the database. $mergeStmt = $this->getMergeStatement($sessionId, $data, $maxlifetime); if (null !== $mergeStmt) { $mergeStmt->execute(); return true; } $updateStmt = $this->getUpdateStatement($sessionId, $data, $maxlifetime); $updateStmt->execute(); // When MERGE is not supported, like in Postgres < 9.5, we have to use this approach that can result in // duplicate key errors when the same session is written simultaneously (given the LOCK_NONE behavior). // We can just catch such an error and re-execute the update. This is similar to a serializable // transaction with retry logic on serialization failures but without the overhead and without possible // false positives due to longer gap locking. if (!$updateStmt->rowCount()) { try { $insertStmt = $this->getInsertStatement($sessionId, $data, $maxlifetime); $insertStmt->execute(); } catch (\PDOException $e) { // Handle integrity violation SQLSTATE 23000 (or a subclass like 23505 in Postgres) for duplicate keys if (0 === strpos($e->getCode(), '23')) { $updateStmt->execute(); } else { throw $e; } } } } catch (\PDOException $e) { $this->rollback(); throw $e; } return true; }
[ "protected", "function", "doWrite", "(", "$", "sessionId", ",", "$", "data", ")", "{", "$", "maxlifetime", "=", "(", "int", ")", "ini_get", "(", "'session.gc_maxlifetime'", ")", ";", "try", "{", "// We use a single MERGE SQL query when supported by the database.", "...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php#L324-L365
train
Write session data
[ 30522, 5123, 3853, 23268, 17625, 1006, 1002, 5219, 3593, 1010, 1002, 2951, 1007, 1063, 1002, 4098, 15509, 7292, 1027, 1006, 20014, 1007, 1999, 2072, 1035, 2131, 1006, 1005, 5219, 1012, 1043, 2278, 1035, 4098, 15509, 7292, 1005, 1007, 1025, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php
NumberFormatter.formatNumber
private function formatNumber($value, $precision) { $precision = $this->getUninitializedPrecision($value, $precision); return number_format($value, $precision, '.', $this->getAttribute(self::GROUPING_USED) ? ',' : ''); }
php
private function formatNumber($value, $precision) { $precision = $this->getUninitializedPrecision($value, $precision); return number_format($value, $precision, '.', $this->getAttribute(self::GROUPING_USED) ? ',' : ''); }
[ "private", "function", "formatNumber", "(", "$", "value", ",", "$", "precision", ")", "{", "$", "precision", "=", "$", "this", "->", "getUninitializedPrecision", "(", "$", "value", ",", "$", "precision", ")", ";", "return", "number_format", "(", "$", "valu...
Formats a number. @param int|float $value The numeric value to format @param int $precision The number of decimal digits to use @return string The formatted number
[ "Formats", "a", "number", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php#L749-L754
train
Format number using number_format
[ 30522, 2797, 3853, 4289, 19172, 5677, 1006, 1002, 3643, 1010, 1002, 11718, 1007, 1063, 1002, 11718, 1027, 1002, 2023, 1011, 1028, 2131, 19496, 3490, 20925, 3550, 28139, 28472, 1006, 1002, 3643, 1010, 1002, 11718, 1007, 1025, 2709, 2193, 103...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/DependencyInjection/Loader/GlobFileLoader.php
GlobFileLoader.load
public function load($resource, $type = null) { foreach ($this->glob($resource, false, $globResource) as $path => $info) { $this->import($path); } $this->container->addResource($globResource); }
php
public function load($resource, $type = null) { foreach ($this->glob($resource, false, $globResource) as $path => $info) { $this->import($path); } $this->container->addResource($globResource); }
[ "public", "function", "load", "(", "$", "resource", ",", "$", "type", "=", "null", ")", "{", "foreach", "(", "$", "this", "->", "glob", "(", "$", "resource", ",", "false", ",", "$", "globResource", ")", "as", "$", "path", "=>", "$", "info", ")", ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DependencyInjection/Loader/GlobFileLoader.php#L24-L31
train
Load the content of a resource into the container
[ 30522, 2270, 3853, 7170, 1006, 1002, 7692, 1010, 1002, 2828, 1027, 19701, 1007, 1063, 18921, 6776, 1006, 1002, 2023, 1011, 1028, 1043, 4135, 2497, 1006, 1002, 7692, 1010, 6270, 1010, 1002, 1043, 4135, 13578, 6499, 3126, 3401, 1007, 2004, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Auth/EloquentUserProvider.php
EloquentUserProvider.retrieveById
public function retrieveById($identifier) { $model = $this->createModel(); return $this->newModelQuery($model) ->where($model->getAuthIdentifierName(), $identifier) ->first(); }
php
public function retrieveById($identifier) { $model = $this->createModel(); return $this->newModelQuery($model) ->where($model->getAuthIdentifierName(), $identifier) ->first(); }
[ "public", "function", "retrieveById", "(", "$", "identifier", ")", "{", "$", "model", "=", "$", "this", "->", "createModel", "(", ")", ";", "return", "$", "this", "->", "newModelQuery", "(", "$", "model", ")", "->", "where", "(", "$", "model", "->", ...
Retrieve a user by their unique identifier. @param mixed $identifier @return \Illuminate\Contracts\Auth\Authenticatable|null
[ "Retrieve", "a", "user", "by", "their", "unique", "identifier", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Auth/EloquentUserProvider.php#L46-L53
train
Retrieve a record by its identifier
[ 30522, 2270, 3853, 12850, 3762, 3593, 1006, 1002, 8909, 4765, 18095, 1007, 1063, 1002, 2944, 1027, 1002, 2023, 1011, 1028, 3443, 5302, 9247, 1006, 1007, 1025, 2709, 1002, 2023, 1011, 1028, 2047, 5302, 9247, 4226, 2854, 1006, 1002, 2944, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Db/Statement.php
Zend_Db_Statement._stripQuoted
protected function _stripQuoted($sql) { // get the character for delimited id quotes, // this is usually " but in MySQL is ` $d = $this->_adapter->quoteIdentifier('a'); $d = $d[0]; // get the value used as an escaped delimited id quote, // e.g. \" or "" or \` $de = $this->_adapter->quoteIdentifier($d); $de = substr($de, 1, 2); $de = str_replace('\\', '\\\\', $de); // get the character for value quoting // this should be ' $q = $this->_adapter->quote('a'); $q = $q[0]; // get the value used as an escaped quote, // e.g. \' or '' $qe = $this->_adapter->quote($q); $qe = substr($qe, 1, 2); $qe = str_replace('\\', '\\\\', $qe); // get a version of the SQL statement with all quoted // values and delimited identifiers stripped out // remove "foo\"bar" $sql = preg_replace("/$q($qe|\\\\{2}|[^$q])*$q/", '', $sql); // remove 'foo\'bar' if (!empty($q)) { $sql = preg_replace("/$q($qe|[^$q])*$q/", '', $sql); } return $sql; }
php
protected function _stripQuoted($sql) { // get the character for delimited id quotes, // this is usually " but in MySQL is ` $d = $this->_adapter->quoteIdentifier('a'); $d = $d[0]; // get the value used as an escaped delimited id quote, // e.g. \" or "" or \` $de = $this->_adapter->quoteIdentifier($d); $de = substr($de, 1, 2); $de = str_replace('\\', '\\\\', $de); // get the character for value quoting // this should be ' $q = $this->_adapter->quote('a'); $q = $q[0]; // get the value used as an escaped quote, // e.g. \' or '' $qe = $this->_adapter->quote($q); $qe = substr($qe, 1, 2); $qe = str_replace('\\', '\\\\', $qe); // get a version of the SQL statement with all quoted // values and delimited identifiers stripped out // remove "foo\"bar" $sql = preg_replace("/$q($qe|\\\\{2}|[^$q])*$q/", '', $sql); // remove 'foo\'bar' if (!empty($q)) { $sql = preg_replace("/$q($qe|[^$q])*$q/", '', $sql); } return $sql; }
[ "protected", "function", "_stripQuoted", "(", "$", "sql", ")", "{", "// get the character for delimited id quotes,", "// this is usually \" but in MySQL is `", "$", "d", "=", "$", "this", "->", "_adapter", "->", "quoteIdentifier", "(", "'a'", ")", ";", "$", "d", "="...
Remove parts of a SQL string that contain quoted strings of values or identifiers. @param string $sql @return string
[ "Remove", "parts", "of", "a", "SQL", "string", "that", "contain", "quoted", "strings", "of", "values", "or", "identifiers", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Statement.php#L177-L211
train
Strip quoted SQL statement
[ 30522, 5123, 3853, 1035, 6167, 28940, 27428, 1006, 1002, 29296, 1007, 1063, 1013, 1013, 2131, 1996, 2839, 2005, 3972, 27605, 3064, 8909, 16614, 1010, 1013, 1013, 2023, 2003, 2788, 1000, 2021, 1999, 2026, 2015, 4160, 2140, 2003, 1036, 1002, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/system/traits/AssetMaker.php
AssetMaker.addRss
public function addRss($name, $attributes = []) { $rssPath = $this->getAssetPath($name); if (isset($this->controller)) { $this->controller->addRss($rssPath, $attributes); } if (is_string($attributes)) { $attributes = ['build' => $attributes]; } $rssPath = $this->getAssetScheme($rssPath); if (!in_array($rssPath, $this->assets['rss'])) { $this->assets['rss'][] = ['path' => $rssPath, 'attributes' => $attributes]; } }
php
public function addRss($name, $attributes = []) { $rssPath = $this->getAssetPath($name); if (isset($this->controller)) { $this->controller->addRss($rssPath, $attributes); } if (is_string($attributes)) { $attributes = ['build' => $attributes]; } $rssPath = $this->getAssetScheme($rssPath); if (!in_array($rssPath, $this->assets['rss'])) { $this->assets['rss'][] = ['path' => $rssPath, 'attributes' => $attributes]; } }
[ "public", "function", "addRss", "(", "$", "name", ",", "$", "attributes", "=", "[", "]", ")", "{", "$", "rssPath", "=", "$", "this", "->", "getAssetPath", "(", "$", "name", ")", ";", "if", "(", "isset", "(", "$", "this", "->", "controller", ")", ...
Adds an RSS link asset to the asset list. Call $this->makeAssets() in a view to output corresponding markup. @param string $name Specifies a path (URL) to the RSS channel @param array $attributes Adds extra HTML attributes to the asset link. @return void
[ "Adds", "an", "RSS", "link", "asset", "to", "the", "asset", "list", ".", "Call", "$this", "-", ">", "makeAssets", "()", "in", "a", "view", "to", "output", "corresponding", "markup", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/traits/AssetMaker.php#L173-L190
train
Add Rss to the asset
[ 30522, 2270, 3853, 5587, 2869, 2015, 1006, 1002, 2171, 1010, 1002, 12332, 1027, 1031, 1033, 1007, 1063, 1002, 12667, 13102, 8988, 1027, 1002, 2023, 1011, 1028, 2131, 27241, 25856, 8988, 1006, 1002, 2171, 1007, 1025, 2065, 1006, 26354, 3388,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Translation/MessageCatalogue.php
MessageCatalogue.replace
public function replace($messages, $domain = 'messages') { unset($this->messages[$domain], $this->messages[$domain.self::INTL_DOMAIN_SUFFIX]); $this->add($messages, $domain); }
php
public function replace($messages, $domain = 'messages') { unset($this->messages[$domain], $this->messages[$domain.self::INTL_DOMAIN_SUFFIX]); $this->add($messages, $domain); }
[ "public", "function", "replace", "(", "$", "messages", ",", "$", "domain", "=", "'messages'", ")", "{", "unset", "(", "$", "this", "->", "messages", "[", "$", "domain", "]", ",", "$", "this", "->", "messages", "[", "$", "domain", ".", "self", "::", ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Translation/MessageCatalogue.php#L144-L149
train
Replace messages in the current language
[ 30522, 2270, 3853, 5672, 1006, 1002, 7696, 1010, 1002, 5884, 1027, 1005, 7696, 1005, 1007, 1063, 4895, 13462, 1006, 1002, 2023, 1011, 1028, 7696, 1031, 1002, 5884, 1033, 1010, 1002, 2023, 1011, 1028, 7696, 1031, 1002, 5884, 1012, 2969, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/API/Request.php
Request.getCurrentUrlWithoutGenericFilters
public static function getCurrentUrlWithoutGenericFilters($params) { // unset all filter query params so the related report will show up in its default state, // unless the filter param was in $queryParams $genericFiltersInfo = DataTableGenericFilter::getGenericFiltersInformation(); foreach ($genericFiltersInfo as $filter) { foreach ($filter[1] as $queryParamName => $queryParamInfo) { if (!isset($params[$queryParamName])) { $params[$queryParamName] = null; } } } return Url::getCurrentQueryStringWithParametersModified($params); }
php
public static function getCurrentUrlWithoutGenericFilters($params) { // unset all filter query params so the related report will show up in its default state, // unless the filter param was in $queryParams $genericFiltersInfo = DataTableGenericFilter::getGenericFiltersInformation(); foreach ($genericFiltersInfo as $filter) { foreach ($filter[1] as $queryParamName => $queryParamInfo) { if (!isset($params[$queryParamName])) { $params[$queryParamName] = null; } } } return Url::getCurrentQueryStringWithParametersModified($params); }
[ "public", "static", "function", "getCurrentUrlWithoutGenericFilters", "(", "$", "params", ")", "{", "// unset all filter query params so the related report will show up in its default state,", "// unless the filter param was in $queryParams", "$", "genericFiltersInfo", "=", "DataTableGen...
Returns the current URL without generic filter query parameters. @param array $params Query parameter values to override in the new URL. @return string
[ "Returns", "the", "current", "URL", "without", "generic", "filter", "query", "parameters", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/API/Request.php#L546-L560
train
Returns the current URL without generic filters
[ 30522, 2270, 10763, 3853, 2131, 10841, 14343, 3372, 3126, 2140, 24415, 5833, 6914, 22420, 8873, 21928, 2015, 1006, 1002, 11498, 5244, 1007, 1063, 1013, 1013, 4895, 13462, 2035, 11307, 23032, 11498, 5244, 2061, 1996, 3141, 3189, 2097, 2265, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Bundle/FrameworkBundle/Templating/DelegatingEngine.php
DelegatingEngine.resolveEngines
private function resolveEngines() { foreach ($this->engines as $i => $engine) { if (\is_string($engine)) { $this->engines[$i] = $this->container->get($engine); } } }
php
private function resolveEngines() { foreach ($this->engines as $i => $engine) { if (\is_string($engine)) { $this->engines[$i] = $this->container->get($engine); } } }
[ "private", "function", "resolveEngines", "(", ")", "{", "foreach", "(", "$", "this", "->", "engines", "as", "$", "i", "=>", "$", "engine", ")", "{", "if", "(", "\\", "is_string", "(", "$", "engine", ")", ")", "{", "$", "this", "->", "engines", "[",...
Resolved engine ids to their real engine instances from the container.
[ "Resolved", "engine", "ids", "to", "their", "real", "engine", "instances", "from", "the", "container", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/FrameworkBundle/Templating/DelegatingEngine.php#L70-L77
train
Resolve all engine objects
[ 30522, 2797, 3853, 10663, 13159, 10586, 1006, 1007, 1063, 18921, 6776, 1006, 1002, 2023, 1011, 1028, 5209, 2004, 1002, 1045, 1027, 1028, 1002, 3194, 1007, 1063, 2065, 1006, 1032, 2003, 1035, 5164, 1006, 1002, 3194, 1007, 1007, 1063, 1002, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
z-song/laravel-admin
src/Form/Footer.php
Footer.render
public function render() { $this->setupScript(); $data = [ 'buttons' => $this->buttons, 'checkboxes' => $this->checkboxes, 'width' => $this->builder->getWidth(), ]; return view($this->view, $data)->render(); }
php
public function render() { $this->setupScript(); $data = [ 'buttons' => $this->buttons, 'checkboxes' => $this->checkboxes, 'width' => $this->builder->getWidth(), ]; return view($this->view, $data)->render(); }
[ "public", "function", "render", "(", ")", "{", "$", "this", "->", "setupScript", "(", ")", ";", "$", "data", "=", "[", "'buttons'", "=>", "$", "this", "->", "buttons", ",", "'checkboxes'", "=>", "$", "this", "->", "checkboxes", ",", "'width'", "=>", ...
Render footer. @return string
[ "Render", "footer", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Form/Footer.php#L147-L158
train
Returns the HTML code of the form
[ 30522, 2270, 3853, 17552, 1006, 1007, 1063, 1002, 2023, 1011, 1028, 16437, 22483, 1006, 1007, 1025, 1002, 2951, 1027, 1031, 1005, 11287, 1005, 1027, 1028, 1002, 2023, 30524, 1011, 1028, 12508, 1011, 1028, 2131, 9148, 11927, 2232, 1006, 1007...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Finder/Finder.php
Finder.normalizeDir
private function normalizeDir($dir) { $dir = rtrim($dir, '/'.\DIRECTORY_SEPARATOR); if (preg_match('#^s?ftp://#', $dir)) { $dir .= '/'; } return $dir; }
php
private function normalizeDir($dir) { $dir = rtrim($dir, '/'.\DIRECTORY_SEPARATOR); if (preg_match('#^s?ftp://#', $dir)) { $dir .= '/'; } return $dir; }
[ "private", "function", "normalizeDir", "(", "$", "dir", ")", "{", "$", "dir", "=", "rtrim", "(", "$", "dir", ",", "'/'", ".", "\\", "DIRECTORY_SEPARATOR", ")", ";", "if", "(", "preg_match", "(", "'#^s?ftp://#'", ",", "$", "dir", ")", ")", "{", "$", ...
Normalizes given directory names by removing trailing slashes. Excluding: (s)ftp:// wrapper @param string $dir @return string
[ "Normalizes", "given", "directory", "names", "by", "removing", "trailing", "slashes", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Finder/Finder.php#L801-L810
train
Normalize directory to allow for ftp://
[ 30522, 2797, 3853, 3671, 3550, 4313, 1006, 1002, 16101, 1007, 1063, 1002, 16101, 1027, 19387, 20026, 1006, 1002, 16101, 1010, 1005, 1013, 1005, 1012, 1032, 14176, 1035, 19802, 25879, 2953, 1007, 1025, 2065, 1006, 3653, 2290, 1035, 2674, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/Piwik.php
Piwik.secureDiv
public static function secureDiv($i1, $i2) { if (is_numeric($i1) && is_numeric($i2) && floatval($i2) != 0) { return $i1 / $i2; } return 0; }
php
public static function secureDiv($i1, $i2) { if (is_numeric($i1) && is_numeric($i2) && floatval($i2) != 0) { return $i1 / $i2; } return 0; }
[ "public", "static", "function", "secureDiv", "(", "$", "i1", ",", "$", "i2", ")", "{", "if", "(", "is_numeric", "(", "$", "i1", ")", "&&", "is_numeric", "(", "$", "i2", ")", "&&", "floatval", "(", "$", "i2", ")", "!=", "0", ")", "{", "return", ...
Computes the division of i1 by i2. If either i1 or i2 are not number, or if i2 has a value of zero we return 0 to avoid the division by zero. @param number $i1 @param number $i2 @return number The result of the division or zero
[ "Computes", "the", "division", "of", "i1", "by", "i2", ".", "If", "either", "i1", "or", "i2", "are", "not", "number", "or", "if", "i2", "has", "a", "value", "of", "zero", "we", "return", "0", "to", "avoid", "the", "division", "by", "zero", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Piwik.php#L104-L110
train
Safely divides two numbers
[ 30522, 2270, 10763, 3853, 7119, 12848, 1006, 1002, 1045, 2487, 1010, 1002, 1045, 2475, 1007, 1063, 2065, 1006, 2003, 1035, 16371, 25531, 1006, 1002, 1045, 2487, 1007, 1004, 1004, 2003, 1035, 16371, 25531, 1006, 1002, 1045, 2475, 1007, 1004,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/HttpKernel/HttpCache/Store.php
Store.requestsMatch
private function requestsMatch($vary, $env1, $env2) { if (empty($vary)) { return true; } foreach (preg_split('/[\s,]+/', $vary) as $header) { $key = str_replace('_', '-', strtolower($header)); $v1 = isset($env1[$key]) ? $env1[$key] : null; $v2 = isset($env2[$key]) ? $env2[$key] : null; if ($v1 !== $v2) { return false; } } return true; }
php
private function requestsMatch($vary, $env1, $env2) { if (empty($vary)) { return true; } foreach (preg_split('/[\s,]+/', $vary) as $header) { $key = str_replace('_', '-', strtolower($header)); $v1 = isset($env1[$key]) ? $env1[$key] : null; $v2 = isset($env2[$key]) ? $env2[$key] : null; if ($v1 !== $v2) { return false; } } return true; }
[ "private", "function", "requestsMatch", "(", "$", "vary", ",", "$", "env1", ",", "$", "env2", ")", "{", "if", "(", "empty", "(", "$", "vary", ")", ")", "{", "return", "true", ";", "}", "foreach", "(", "preg_split", "(", "'/[\\s,]+/'", ",", "$", "va...
Determines whether two Request HTTP header sets are non-varying based on the vary response header value provided. @param string $vary A Response vary header @param array $env1 A Request HTTP header array @param array $env2 A Request HTTP header array @return bool true if the two environments match, false otherwise
[ "Determines", "whether", "two", "Request", "HTTP", "header", "sets", "are", "non", "-", "varying", "based", "on", "the", "vary", "response", "header", "value", "provided", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/HttpCache/Store.php#L264-L280
train
Checks if the Vary header matches the request headers
[ 30522, 2797, 3853, 11186, 18900, 2818, 1006, 1002, 8137, 1010, 1002, 4372, 2615, 2487, 1010, 1002, 4372, 2615, 2475, 1007, 1063, 2065, 1006, 4064, 1006, 1002, 8137, 1007, 1007, 1063, 2709, 2995, 1025, 1065, 18921, 6776, 1006, 3653, 2290, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/SitesManager/API.php
API.addSite
public function addSite($siteName, $urls = null, $ecommerce = null, $siteSearch = null, $searchKeywordParameters = null, $searchCategoryParameters = null, $excludedIps = null, $excludedQueryParameters = null, $timezone = null, $currency = null, $group = null, $startDate = null, $excludedUserAgents = null, $keepURLFragments = null, $type = null, $settingValues = null, $excludeUnknownUrls = null) { Piwik::checkUserHasSuperUserAccess(); $this->checkName($siteName); if (!isset($settingValues)) { $settingValues = array(); } $coreProperties = array(); $coreProperties = $this->setSettingValue('urls', $urls, $coreProperties, $settingValues); $coreProperties = $this->setSettingValue('ecommerce', $ecommerce, $coreProperties, $settingValues); $coreProperties = $this->setSettingValue('group', $group, $coreProperties, $settingValues); $coreProperties = $this->setSettingValue('sitesearch', $siteSearch, $coreProperties, $settingValues); $coreProperties = $this->setSettingValue('sitesearch_keyword_parameters', explode(',', $searchKeywordParameters), $coreProperties, $settingValues); $coreProperties = $this->setSettingValue('sitesearch_category_parameters', explode(',', $searchCategoryParameters), $coreProperties, $settingValues); $coreProperties = $this->setSettingValue('keep_url_fragment', $keepURLFragments, $coreProperties, $settingValues); $coreProperties = $this->setSettingValue('exclude_unknown_urls', $excludeUnknownUrls, $coreProperties, $settingValues); $coreProperties = $this->setSettingValue('excluded_ips', explode(',', $excludedIps), $coreProperties, $settingValues); $coreProperties = $this->setSettingValue('excluded_parameters', explode(',', $excludedQueryParameters), $coreProperties, $settingValues); $coreProperties = $this->setSettingValue('excluded_user_agents', explode(',', $excludedUserAgents), $coreProperties, $settingValues); $timezone = trim($timezone); if (empty($timezone)) { $timezone = $this->getDefaultTimezone(); } $this->checkValidTimezone($timezone); if (empty($currency)) { $currency = $this->getDefaultCurrency(); } $this->checkValidCurrency($currency); $bind = array('name' => $siteName); $bind['timezone'] = $timezone; $bind['currency'] = $currency; $bind['main_url'] = ''; if (is_null($startDate)) { $bind['ts_created'] = Date::now()->getDatetime(); } else { $bind['ts_created'] = Date::factory($startDate)->getDatetime(); } $bind['type'] = $this->checkAndReturnType($type); if (!empty($group) && Piwik::hasUserSuperUserAccess()) { $bind['group'] = trim($group); } else { $bind['group'] = ""; } $bind['creator_login'] = Piwik::getCurrentUserLogin(); $allSettings = $this->setAndValidateMeasurableSettings(0, 'website', $coreProperties); // any setting specified in setting values will overwrite other setting if (!empty($settingValues)) { $this->setAndValidateMeasurableSettings(0, $bind['type'], $settingValues); } foreach ($allSettings as $settings) { foreach ($settings->getSettingsWritableByCurrentUser() as $setting) { $name = $setting->getName(); if ($setting instanceof MeasurableProperty && $name !== 'urls') { $default = $setting->getDefaultValue(); if (is_bool($default)) { $default = (int) $default; } elseif (is_array($default)) { $default = implode(',', $default); } $bind[$name] = $default; } } } $idSite = $this->getModel()->createSite($bind); if (!empty($coreProperties)) { $this->saveMeasurableSettings($idSite, 'website', $coreProperties); } if (!empty($settingValues)) { $this->saveMeasurableSettings($idSite, $bind['type'], $settingValues); } // we reload the access list which doesn't yet take in consideration this new website Access::getInstance()->reloadAccess(); $this->postUpdateWebsite($idSite); /** * Triggered after a site has been added. * * @param int $idSite The ID of the site that was added. */ Piwik::postEvent('SitesManager.addSite.end', array($idSite)); return (int) $idSite; }
php
public function addSite($siteName, $urls = null, $ecommerce = null, $siteSearch = null, $searchKeywordParameters = null, $searchCategoryParameters = null, $excludedIps = null, $excludedQueryParameters = null, $timezone = null, $currency = null, $group = null, $startDate = null, $excludedUserAgents = null, $keepURLFragments = null, $type = null, $settingValues = null, $excludeUnknownUrls = null) { Piwik::checkUserHasSuperUserAccess(); $this->checkName($siteName); if (!isset($settingValues)) { $settingValues = array(); } $coreProperties = array(); $coreProperties = $this->setSettingValue('urls', $urls, $coreProperties, $settingValues); $coreProperties = $this->setSettingValue('ecommerce', $ecommerce, $coreProperties, $settingValues); $coreProperties = $this->setSettingValue('group', $group, $coreProperties, $settingValues); $coreProperties = $this->setSettingValue('sitesearch', $siteSearch, $coreProperties, $settingValues); $coreProperties = $this->setSettingValue('sitesearch_keyword_parameters', explode(',', $searchKeywordParameters), $coreProperties, $settingValues); $coreProperties = $this->setSettingValue('sitesearch_category_parameters', explode(',', $searchCategoryParameters), $coreProperties, $settingValues); $coreProperties = $this->setSettingValue('keep_url_fragment', $keepURLFragments, $coreProperties, $settingValues); $coreProperties = $this->setSettingValue('exclude_unknown_urls', $excludeUnknownUrls, $coreProperties, $settingValues); $coreProperties = $this->setSettingValue('excluded_ips', explode(',', $excludedIps), $coreProperties, $settingValues); $coreProperties = $this->setSettingValue('excluded_parameters', explode(',', $excludedQueryParameters), $coreProperties, $settingValues); $coreProperties = $this->setSettingValue('excluded_user_agents', explode(',', $excludedUserAgents), $coreProperties, $settingValues); $timezone = trim($timezone); if (empty($timezone)) { $timezone = $this->getDefaultTimezone(); } $this->checkValidTimezone($timezone); if (empty($currency)) { $currency = $this->getDefaultCurrency(); } $this->checkValidCurrency($currency); $bind = array('name' => $siteName); $bind['timezone'] = $timezone; $bind['currency'] = $currency; $bind['main_url'] = ''; if (is_null($startDate)) { $bind['ts_created'] = Date::now()->getDatetime(); } else { $bind['ts_created'] = Date::factory($startDate)->getDatetime(); } $bind['type'] = $this->checkAndReturnType($type); if (!empty($group) && Piwik::hasUserSuperUserAccess()) { $bind['group'] = trim($group); } else { $bind['group'] = ""; } $bind['creator_login'] = Piwik::getCurrentUserLogin(); $allSettings = $this->setAndValidateMeasurableSettings(0, 'website', $coreProperties); // any setting specified in setting values will overwrite other setting if (!empty($settingValues)) { $this->setAndValidateMeasurableSettings(0, $bind['type'], $settingValues); } foreach ($allSettings as $settings) { foreach ($settings->getSettingsWritableByCurrentUser() as $setting) { $name = $setting->getName(); if ($setting instanceof MeasurableProperty && $name !== 'urls') { $default = $setting->getDefaultValue(); if (is_bool($default)) { $default = (int) $default; } elseif (is_array($default)) { $default = implode(',', $default); } $bind[$name] = $default; } } } $idSite = $this->getModel()->createSite($bind); if (!empty($coreProperties)) { $this->saveMeasurableSettings($idSite, 'website', $coreProperties); } if (!empty($settingValues)) { $this->saveMeasurableSettings($idSite, $bind['type'], $settingValues); } // we reload the access list which doesn't yet take in consideration this new website Access::getInstance()->reloadAccess(); $this->postUpdateWebsite($idSite); /** * Triggered after a site has been added. * * @param int $idSite The ID of the site that was added. */ Piwik::postEvent('SitesManager.addSite.end', array($idSite)); return (int) $idSite; }
[ "public", "function", "addSite", "(", "$", "siteName", ",", "$", "urls", "=", "null", ",", "$", "ecommerce", "=", "null", ",", "$", "siteSearch", "=", "null", ",", "$", "searchKeywordParameters", "=", "null", ",", "$", "searchCategoryParameters", "=", "nul...
Add a website. Requires Super User access. The website is defined by a name and an array of URLs. @param string $siteName Site name @param array|string $urls The URLs array must contain at least one URL called the 'main_url' ; if several URLs are provided in the array, they will be recorded as Alias URLs for this website. When calling API via HTTP specify multiple URLs via `&urls[]=http...&urls[]=http...`. @param int $ecommerce Is Ecommerce Reporting enabled for this website? @param null $siteSearch @param string $searchKeywordParameters Comma separated list of search keyword parameter names @param string $searchCategoryParameters Comma separated list of search category parameter names @param string $excludedIps Comma separated list of IPs to exclude from the reports (allows wildcards) @param null $excludedQueryParameters @param string $timezone Timezone string, eg. 'Europe/London' @param string $currency Currency, eg. 'EUR' @param string $group Website group identifier @param string $startDate Date at which the statistics for this website will start. Defaults to today's date in YYYY-MM-DD format @param null|string $excludedUserAgents @param int $keepURLFragments If 1, URL fragments will be kept when tracking. If 2, they will be removed. If 0, the default global behavior will be used. @param array|null $settingValues JSON serialized settings eg {settingName: settingValue, ...} @see getKeepURLFragmentsGlobal. @param string $type The website type, defaults to "website" if not set. @param bool|null $excludeUnknownUrls Track only URL matching one of website URLs @return int the website ID created
[ "Add", "a", "website", ".", "Requires", "Super", "User", "access", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/SitesManager/API.php#L599-L715
train
Add a site to the site list
[ 30522, 2270, 3853, 9909, 4221, 1006, 1002, 2609, 18442, 1010, 1002, 24471, 4877, 1027, 19701, 1010, 1002, 17338, 15810, 3401, 1027, 19701, 1010, 1002, 4573, 14644, 2818, 1027, 19701, 1010, 1002, 3945, 14839, 18351, 28689, 22828, 2015, 1027, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/View/Compilers/BladeCompiler.php
BladeCompiler.compileStatement
protected function compileStatement($match) { if (Str::contains($match[1], '@')) { $match[0] = isset($match[3]) ? $match[1].$match[3] : $match[1]; } elseif (isset($this->customDirectives[$match[1]])) { $match[0] = $this->callCustomDirective($match[1], Arr::get($match, 3)); } elseif (method_exists($this, $method = 'compile'.ucfirst($match[1]))) { $match[0] = $this->$method(Arr::get($match, 3)); } return isset($match[3]) ? $match[0] : $match[0].$match[2]; }
php
protected function compileStatement($match) { if (Str::contains($match[1], '@')) { $match[0] = isset($match[3]) ? $match[1].$match[3] : $match[1]; } elseif (isset($this->customDirectives[$match[1]])) { $match[0] = $this->callCustomDirective($match[1], Arr::get($match, 3)); } elseif (method_exists($this, $method = 'compile'.ucfirst($match[1]))) { $match[0] = $this->$method(Arr::get($match, 3)); } return isset($match[3]) ? $match[0] : $match[0].$match[2]; }
[ "protected", "function", "compileStatement", "(", "$", "match", ")", "{", "if", "(", "Str", "::", "contains", "(", "$", "match", "[", "1", "]", ",", "'@'", ")", ")", "{", "$", "match", "[", "0", "]", "=", "isset", "(", "$", "match", "[", "3", "...
Compile a single Blade @ statement. @param array $match @return string
[ "Compile", "a", "single", "Blade", "@", "statement", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/View/Compilers/BladeCompiler.php#L356-L367
train
Compiles a statement into PHP code.
[ 30522, 5123, 3853, 4012, 22090, 9153, 18532, 4765, 1006, 1002, 2674, 1007, 1063, 2065, 1006, 2358, 2099, 1024, 1024, 3397, 1006, 1002, 2674, 1031, 1015, 1033, 1010, 1005, 1030, 1005, 1007, 1007, 1063, 1002, 2674, 1031, 1014, 1033, 1027, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Intl/Data/Generator/CurrencyDataGenerator.php
CurrencyDataGenerator.generateDataForMeta
protected function generateDataForMeta(BundleReaderInterface $reader, $tempDir) { $rootBundle = $reader->read($tempDir, 'root'); $supplementalDataBundle = $reader->read($tempDir, 'supplementalData'); $numericCodesBundle = $reader->read($tempDir, 'currencyNumericCodes'); $this->currencyCodes = array_unique($this->currencyCodes); sort($this->currencyCodes); $data = [ 'Version' => $rootBundle['Version'], 'Currencies' => $this->currencyCodes, 'Meta' => $this->generateCurrencyMeta($supplementalDataBundle), 'Alpha3ToNumeric' => $this->generateAlpha3ToNumericMapping($numericCodesBundle, $this->currencyCodes), ]; $data['NumericToAlpha3'] = $this->generateNumericToAlpha3Mapping($data['Alpha3ToNumeric']); return $data; }
php
protected function generateDataForMeta(BundleReaderInterface $reader, $tempDir) { $rootBundle = $reader->read($tempDir, 'root'); $supplementalDataBundle = $reader->read($tempDir, 'supplementalData'); $numericCodesBundle = $reader->read($tempDir, 'currencyNumericCodes'); $this->currencyCodes = array_unique($this->currencyCodes); sort($this->currencyCodes); $data = [ 'Version' => $rootBundle['Version'], 'Currencies' => $this->currencyCodes, 'Meta' => $this->generateCurrencyMeta($supplementalDataBundle), 'Alpha3ToNumeric' => $this->generateAlpha3ToNumericMapping($numericCodesBundle, $this->currencyCodes), ]; $data['NumericToAlpha3'] = $this->generateNumericToAlpha3Mapping($data['Alpha3ToNumeric']); return $data; }
[ "protected", "function", "generateDataForMeta", "(", "BundleReaderInterface", "$", "reader", ",", "$", "tempDir", ")", "{", "$", "rootBundle", "=", "$", "reader", "->", "read", "(", "$", "tempDir", ",", "'root'", ")", ";", "$", "supplementalDataBundle", "=", ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Intl/Data/Generator/CurrencyDataGenerator.php#L128-L148
train
Generate data for meta
[ 30522, 5123, 3853, 7013, 6790, 14192, 12928, 1006, 14012, 16416, 4063, 18447, 2121, 12172, 1002, 8068, 1010, 1002, 8915, 8737, 4305, 2099, 1007, 1063, 1002, 7117, 27265, 2571, 1027, 1002, 8068, 1011, 1028, 3191, 1006, 1002, 8915, 8737, 4305...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Cache/Core.php
Zend_Cache_Core.setBackend
public function setBackend(Zend_Cache_Backend $backendObject) { $this->_backend= $backendObject; // some options (listed in $_directivesList) have to be given // to the backend too (even if they are not "backend specific") $directives = array(); foreach (Zend_Cache_Core::$_directivesList as $directive) { $directives[$directive] = $this->_options[$directive]; } $this->_backend->setDirectives($directives); if (in_array('Zend_Cache_Backend_ExtendedInterface', class_implements($this->_backend))) { $this->_extendedBackend = true; $this->_backendCapabilities = $this->_backend->getCapabilities(); } }
php
public function setBackend(Zend_Cache_Backend $backendObject) { $this->_backend= $backendObject; // some options (listed in $_directivesList) have to be given // to the backend too (even if they are not "backend specific") $directives = array(); foreach (Zend_Cache_Core::$_directivesList as $directive) { $directives[$directive] = $this->_options[$directive]; } $this->_backend->setDirectives($directives); if (in_array('Zend_Cache_Backend_ExtendedInterface', class_implements($this->_backend))) { $this->_extendedBackend = true; $this->_backendCapabilities = $this->_backend->getCapabilities(); } }
[ "public", "function", "setBackend", "(", "Zend_Cache_Backend", "$", "backendObject", ")", "{", "$", "this", "->", "_backend", "=", "$", "backendObject", ";", "// some options (listed in $_directivesList) have to be given", "// to the backend too (even if they are not \"backend sp...
Set the backend @param Zend_Cache_Backend $backendObject @throws Zend_Cache_Exception @return void
[ "Set", "the", "backend" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Cache/Core.php#L174-L189
train
set the cache backend
[ 30522, 2270, 3853, 2275, 5963, 10497, 1006, 16729, 2094, 1035, 17053, 1035, 2067, 10497, 1002, 2067, 10497, 16429, 20614, 1007, 1063, 1002, 2023, 1011, 1028, 1035, 2067, 10497, 1027, 1002, 2067, 10497, 16429, 20614, 1025, 1013, 1013, 2070, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Console/Application.php
Application.run
public function run(InputInterface $input = null, OutputInterface $output = null) { putenv('LINES='.$this->terminal->getHeight()); putenv('COLUMNS='.$this->terminal->getWidth()); if (null === $input) { $input = new ArgvInput(); } if (null === $output) { $output = new ConsoleOutput(); } $renderException = function ($e) use ($output) { if (!$e instanceof \Exception) { $e = class_exists(FatalThrowableError::class) ? new FatalThrowableError($e) : new \ErrorException($e->getMessage(), $e->getCode(), E_ERROR, $e->getFile(), $e->getLine()); } if ($output instanceof ConsoleOutputInterface) { $this->renderException($e, $output->getErrorOutput()); } else { $this->renderException($e, $output); } }; if ($phpHandler = set_exception_handler($renderException)) { restore_exception_handler(); if (!\is_array($phpHandler) || !$phpHandler[0] instanceof ErrorHandler) { $debugHandler = true; } elseif ($debugHandler = $phpHandler[0]->setExceptionHandler($renderException)) { $phpHandler[0]->setExceptionHandler($debugHandler); } } $this->configureIO($input, $output); try { $exitCode = $this->doRun($input, $output); } catch (\Exception $e) { if (!$this->catchExceptions) { throw $e; } $renderException($e); $exitCode = $e->getCode(); if (is_numeric($exitCode)) { $exitCode = (int) $exitCode; if (0 === $exitCode) { $exitCode = 1; } } else { $exitCode = 1; } } finally { // if the exception handler changed, keep it // otherwise, unregister $renderException if (!$phpHandler) { if (set_exception_handler($renderException) === $renderException) { restore_exception_handler(); } restore_exception_handler(); } elseif (!$debugHandler) { $finalHandler = $phpHandler[0]->setExceptionHandler(null); if ($finalHandler !== $renderException) { $phpHandler[0]->setExceptionHandler($finalHandler); } } } if ($this->autoExit) { if ($exitCode > 255) { $exitCode = 255; } exit($exitCode); } return $exitCode; }
php
public function run(InputInterface $input = null, OutputInterface $output = null) { putenv('LINES='.$this->terminal->getHeight()); putenv('COLUMNS='.$this->terminal->getWidth()); if (null === $input) { $input = new ArgvInput(); } if (null === $output) { $output = new ConsoleOutput(); } $renderException = function ($e) use ($output) { if (!$e instanceof \Exception) { $e = class_exists(FatalThrowableError::class) ? new FatalThrowableError($e) : new \ErrorException($e->getMessage(), $e->getCode(), E_ERROR, $e->getFile(), $e->getLine()); } if ($output instanceof ConsoleOutputInterface) { $this->renderException($e, $output->getErrorOutput()); } else { $this->renderException($e, $output); } }; if ($phpHandler = set_exception_handler($renderException)) { restore_exception_handler(); if (!\is_array($phpHandler) || !$phpHandler[0] instanceof ErrorHandler) { $debugHandler = true; } elseif ($debugHandler = $phpHandler[0]->setExceptionHandler($renderException)) { $phpHandler[0]->setExceptionHandler($debugHandler); } } $this->configureIO($input, $output); try { $exitCode = $this->doRun($input, $output); } catch (\Exception $e) { if (!$this->catchExceptions) { throw $e; } $renderException($e); $exitCode = $e->getCode(); if (is_numeric($exitCode)) { $exitCode = (int) $exitCode; if (0 === $exitCode) { $exitCode = 1; } } else { $exitCode = 1; } } finally { // if the exception handler changed, keep it // otherwise, unregister $renderException if (!$phpHandler) { if (set_exception_handler($renderException) === $renderException) { restore_exception_handler(); } restore_exception_handler(); } elseif (!$debugHandler) { $finalHandler = $phpHandler[0]->setExceptionHandler(null); if ($finalHandler !== $renderException) { $phpHandler[0]->setExceptionHandler($finalHandler); } } } if ($this->autoExit) { if ($exitCode > 255) { $exitCode = 255; } exit($exitCode); } return $exitCode; }
[ "public", "function", "run", "(", "InputInterface", "$", "input", "=", "null", ",", "OutputInterface", "$", "output", "=", "null", ")", "{", "putenv", "(", "'LINES='", ".", "$", "this", "->", "terminal", "->", "getHeight", "(", ")", ")", ";", "putenv", ...
Runs the current application. @return int 0 if everything went fine, or an error code @throws \Exception When running fails. Bypass this when {@link setCatchExceptions()}.
[ "Runs", "the", "current", "application", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Console/Application.php#L114-L191
train
Runs the terminal
[ 30522, 2270, 3853, 2448, 1006, 7953, 18447, 2121, 12172, 1002, 7953, 1027, 19701, 1010, 6434, 18447, 2121, 12172, 1002, 6434, 1027, 19701, 1007, 1063, 2404, 2368, 2615, 1006, 1005, 3210, 1027, 1005, 1012, 1002, 2023, 1011, 1028, 5536, 1011,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
z-song/laravel-admin
src/Grid/Concerns/HasFilter.php
HasFilter.disableFilter
public function disableFilter(bool $disable = true) { $this->tools->disableFilterButton($disable); return $this->option('show_filter', !$disable); }
php
public function disableFilter(bool $disable = true) { $this->tools->disableFilterButton($disable); return $this->option('show_filter', !$disable); }
[ "public", "function", "disableFilter", "(", "bool", "$", "disable", "=", "true", ")", "{", "$", "this", "->", "tools", "->", "disableFilterButton", "(", "$", "disable", ")", ";", "return", "$", "this", "->", "option", "(", "'show_filter'", ",", "!", "$",...
Disable grid filter. @return $this
[ "Disable", "grid", "filter", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid/Concerns/HasFilter.php#L33-L38
train
Disable the filter button
[ 30522, 2270, 3853, 4487, 19150, 8873, 21928, 1006, 22017, 2140, 1002, 4487, 19150, 1027, 2995, 1007, 1063, 1002, 2023, 1011, 1028, 5906, 1011, 1028, 4487, 19150, 8873, 21928, 8569, 15474, 1006, 1002, 4487, 19150, 1007, 1025, 2709, 1002, 202...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Serializer/Normalizer/PropertyNormalizer.php
PropertyNormalizer.isAllowedAttribute
protected function isAllowedAttribute($classOrObject, $attribute, $format = null, array $context = []) { if (!parent::isAllowedAttribute($classOrObject, $attribute, $format, $context)) { return false; } try { $reflectionProperty = $this->getReflectionProperty($classOrObject, $attribute); if ($reflectionProperty->isStatic()) { return false; } } catch (\ReflectionException $reflectionException) { return false; } return true; }
php
protected function isAllowedAttribute($classOrObject, $attribute, $format = null, array $context = []) { if (!parent::isAllowedAttribute($classOrObject, $attribute, $format, $context)) { return false; } try { $reflectionProperty = $this->getReflectionProperty($classOrObject, $attribute); if ($reflectionProperty->isStatic()) { return false; } } catch (\ReflectionException $reflectionException) { return false; } return true; }
[ "protected", "function", "isAllowedAttribute", "(", "$", "classOrObject", ",", "$", "attribute", ",", "$", "format", "=", "null", ",", "array", "$", "context", "=", "[", "]", ")", "{", "if", "(", "!", "parent", "::", "isAllowedAttribute", "(", "$", "clas...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Serializer/Normalizer/PropertyNormalizer.php#L79-L95
train
Check if an attribute is allowed in the class
[ 30522, 5123, 3853, 18061, 7174, 15557, 19321, 3089, 8569, 2618, 1006, 1002, 2465, 14604, 2497, 20614, 1010, 1002, 17961, 1010, 1002, 4289, 1027, 19701, 1010, 9140, 1002, 6123, 1027, 1031, 1033, 1007, 1063, 2065, 1006, 999, 6687, 1024, 1024,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Routing/ImplicitRouteBinding.php
ImplicitRouteBinding.resolveForRoute
public static function resolveForRoute($container, $route) { $parameters = $route->parameters(); foreach ($route->signatureParameters(UrlRoutable::class) as $parameter) { if (! $parameterName = static::getParameterName($parameter->name, $parameters)) { continue; } $parameterValue = $parameters[$parameterName]; if ($parameterValue instanceof UrlRoutable) { continue; } $instance = $container->make($parameter->getClass()->name); if (! $model = $instance->resolveRouteBinding($parameterValue)) { throw (new ModelNotFoundException)->setModel(get_class($instance)); } $route->setParameter($parameterName, $model); } }
php
public static function resolveForRoute($container, $route) { $parameters = $route->parameters(); foreach ($route->signatureParameters(UrlRoutable::class) as $parameter) { if (! $parameterName = static::getParameterName($parameter->name, $parameters)) { continue; } $parameterValue = $parameters[$parameterName]; if ($parameterValue instanceof UrlRoutable) { continue; } $instance = $container->make($parameter->getClass()->name); if (! $model = $instance->resolveRouteBinding($parameterValue)) { throw (new ModelNotFoundException)->setModel(get_class($instance)); } $route->setParameter($parameterName, $model); } }
[ "public", "static", "function", "resolveForRoute", "(", "$", "container", ",", "$", "route", ")", "{", "$", "parameters", "=", "$", "route", "->", "parameters", "(", ")", ";", "foreach", "(", "$", "route", "->", "signatureParameters", "(", "UrlRoutable", "...
Resolve the implicit route bindings for the given route. @param \Illuminate\Container\Container $container @param \Illuminate\Routing\Route $route @return void @throws \Illuminate\Database\Eloquent\ModelNotFoundException
[ "Resolve", "the", "implicit", "route", "bindings", "for", "the", "given", "route", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Routing/ImplicitRouteBinding.php#L20-L43
train
Resolve for route
[ 30522, 2270, 10763, 3853, 10663, 29278, 22494, 2618, 1006, 1002, 11661, 1010, 1002, 2799, 1007, 1063, 1002, 11709, 1027, 1002, 2799, 1011, 1028, 11709, 1006, 1007, 1025, 18921, 6776, 1006, 1002, 2799, 1011, 1028, 8085, 28689, 22828, 2015, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Cache/Core.php
Zend_Cache_Core.load
public function load($id, $doNotTestCacheValidity = false, $doNotUnserialize = false) { if (!$this->_options['caching']) { return false; } $id = $this->_id($id); // cache id may need prefix $this->_lastId = $id; self::_validateIdOrTag($id); $this->_log("Zend_Cache_Core: load item '{$id}'", 7); $data = $this->_backend->load($id, $doNotTestCacheValidity); if ($data===false) { // no cache available return false; } if ((!$doNotUnserialize) && $this->_options['automatic_serialization']) { // we need to unserialize before sending the result return unserialize($data); } return $data; }
php
public function load($id, $doNotTestCacheValidity = false, $doNotUnserialize = false) { if (!$this->_options['caching']) { return false; } $id = $this->_id($id); // cache id may need prefix $this->_lastId = $id; self::_validateIdOrTag($id); $this->_log("Zend_Cache_Core: load item '{$id}'", 7); $data = $this->_backend->load($id, $doNotTestCacheValidity); if ($data===false) { // no cache available return false; } if ((!$doNotUnserialize) && $this->_options['automatic_serialization']) { // we need to unserialize before sending the result return unserialize($data); } return $data; }
[ "public", "function", "load", "(", "$", "id", ",", "$", "doNotTestCacheValidity", "=", "false", ",", "$", "doNotUnserialize", "=", "false", ")", "{", "if", "(", "!", "$", "this", "->", "_options", "[", "'caching'", "]", ")", "{", "return", "false", ";"...
Test if a cache is available for the given id and (if yes) return it (false else) @param string $id Cache id @param boolean $doNotTestCacheValidity If set to true, the cache validity won't be tested @param boolean $doNotUnserialize Do not serialize (even if automatic_serialization is true) => for internal use @return mixed|false Cached datas
[ "Test", "if", "a", "cache", "is", "available", "for", "the", "given", "id", "and", "(", "if", "yes", ")", "return", "it", "(", "false", "else", ")" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Cache/Core.php#L295-L315
train
Load an item from the cache
[ 30522, 2270, 3853, 7170, 1006, 1002, 8909, 1010, 1002, 2123, 28495, 3367, 3540, 16179, 11475, 25469, 1027, 6270, 1010, 1002, 2123, 4140, 4609, 8043, 4818, 4697, 1027, 6270, 1007, 1063, 2065, 1006, 999, 1002, 2023, 1011, 1028, 1035, 7047, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/Uri.php
Uri.init
public function init() { $grav = Grav::instance(); /** @var Config $config */ $config = $grav['config']; /** @var Language $language */ $language = $grav['language']; // add the port to the base for non-standard ports if ($this->port !== null && $config->get('system.reverse_proxy_setup') === false) { $this->base .= ':' . (string)$this->port; } // Handle custom base $custom_base = rtrim($grav['config']->get('system.custom_base_url'), '/'); if ($custom_base) { $custom_parts = parse_url($custom_base); $orig_root_path = $this->root_path; $this->root_path = isset($custom_parts['path']) ? rtrim($custom_parts['path'], '/') : ''; if (isset($custom_parts['scheme'])) { $this->base = $custom_parts['scheme'] . '://' . $custom_parts['host']; $this->root = $custom_base; } else { $this->root = $this->base . $this->root_path; } $this->uri = Utils::replaceFirstOccurrence($orig_root_path, $this->root_path, $this->uri); } else { $this->root = $this->base . $this->root_path; } $this->url = $this->base . $this->uri; $uri = str_replace(static::filterPath($this->root), '', $this->url); // remove the setup.php based base if set: $setup_base = $grav['pages']->base(); if ($setup_base) { $uri = preg_replace('|^' . preg_quote($setup_base, '|') . '|', '', $uri); } // process params $uri = $this->processParams($uri, $config->get('system.param_sep')); // set active language $uri = $language->setActiveFromUri($uri); // split the URL and params $bits = parse_url($uri); //process fragment if (isset($bits['fragment'])) { $this->fragment = $bits['fragment']; } // Get the path. If there's no path, make sure pathinfo() still returns dirname variable $path = $bits['path'] ?? '/'; // remove the extension if there is one set $parts = pathinfo($path); // set the original basename $this->basename = $parts['basename']; // set the extension if (isset($parts['extension'])) { $this->extension = $parts['extension']; } // Strip the file extension for valid page types if ($this->isValidExtension($this->extension)) { $path = Utils::replaceLastOccurrence(".{$this->extension}", '', $path); } // set the new url $this->url = $this->root . $path; $this->path = static::cleanPath($path); $this->content_path = trim(str_replace($this->base, '', $this->path), '/'); if ($this->content_path !== '') { $this->paths = explode('/', $this->content_path); } // Set some Grav stuff $grav['base_url_absolute'] = $config->get('system.custom_base_url') ?: $this->rootUrl(true); $grav['base_url_relative'] = $this->rootUrl(false); $grav['base_url'] = $config->get('system.absolute_urls') ? $grav['base_url_absolute'] : $grav['base_url_relative']; RouteFactory::setRoot($this->root_path); RouteFactory::setLanguage($language->getLanguageURLPrefix()); }
php
public function init() { $grav = Grav::instance(); /** @var Config $config */ $config = $grav['config']; /** @var Language $language */ $language = $grav['language']; // add the port to the base for non-standard ports if ($this->port !== null && $config->get('system.reverse_proxy_setup') === false) { $this->base .= ':' . (string)$this->port; } // Handle custom base $custom_base = rtrim($grav['config']->get('system.custom_base_url'), '/'); if ($custom_base) { $custom_parts = parse_url($custom_base); $orig_root_path = $this->root_path; $this->root_path = isset($custom_parts['path']) ? rtrim($custom_parts['path'], '/') : ''; if (isset($custom_parts['scheme'])) { $this->base = $custom_parts['scheme'] . '://' . $custom_parts['host']; $this->root = $custom_base; } else { $this->root = $this->base . $this->root_path; } $this->uri = Utils::replaceFirstOccurrence($orig_root_path, $this->root_path, $this->uri); } else { $this->root = $this->base . $this->root_path; } $this->url = $this->base . $this->uri; $uri = str_replace(static::filterPath($this->root), '', $this->url); // remove the setup.php based base if set: $setup_base = $grav['pages']->base(); if ($setup_base) { $uri = preg_replace('|^' . preg_quote($setup_base, '|') . '|', '', $uri); } // process params $uri = $this->processParams($uri, $config->get('system.param_sep')); // set active language $uri = $language->setActiveFromUri($uri); // split the URL and params $bits = parse_url($uri); //process fragment if (isset($bits['fragment'])) { $this->fragment = $bits['fragment']; } // Get the path. If there's no path, make sure pathinfo() still returns dirname variable $path = $bits['path'] ?? '/'; // remove the extension if there is one set $parts = pathinfo($path); // set the original basename $this->basename = $parts['basename']; // set the extension if (isset($parts['extension'])) { $this->extension = $parts['extension']; } // Strip the file extension for valid page types if ($this->isValidExtension($this->extension)) { $path = Utils::replaceLastOccurrence(".{$this->extension}", '', $path); } // set the new url $this->url = $this->root . $path; $this->path = static::cleanPath($path); $this->content_path = trim(str_replace($this->base, '', $this->path), '/'); if ($this->content_path !== '') { $this->paths = explode('/', $this->content_path); } // Set some Grav stuff $grav['base_url_absolute'] = $config->get('system.custom_base_url') ?: $this->rootUrl(true); $grav['base_url_relative'] = $this->rootUrl(false); $grav['base_url'] = $config->get('system.absolute_urls') ? $grav['base_url_absolute'] : $grav['base_url_relative']; RouteFactory::setRoot($this->root_path); RouteFactory::setLanguage($language->getLanguageURLPrefix()); }
[ "public", "function", "init", "(", ")", "{", "$", "grav", "=", "Grav", "::", "instance", "(", ")", ";", "/** @var Config $config */", "$", "config", "=", "$", "grav", "[", "'config'", "]", ";", "/** @var Language $language */", "$", "language", "=", "$", "...
Initializes the URI object based on the url set on the object
[ "Initializes", "the", "URI", "object", "based", "on", "the", "url", "set", "on", "the", "object" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Uri.php#L119-L210
train
Initializes the class variables
[ 30522, 2270, 3853, 1999, 4183, 1006, 1007, 1063, 1002, 24665, 11431, 1027, 24665, 11431, 1024, 1024, 6013, 1006, 1007, 1025, 1013, 1008, 1008, 1030, 13075, 9530, 8873, 2290, 1002, 9530, 8873, 2290, 1008, 1013, 1002, 9530, 8873, 2290, 1027, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Foundation/Console/VendorPublishCommand.php
VendorPublishCommand.handle
public function handle() { $this->determineWhatShouldBePublished(); foreach ($this->tags ?: [null] as $tag) { $this->publishTag($tag); } $this->info('Publishing complete.'); }
php
public function handle() { $this->determineWhatShouldBePublished(); foreach ($this->tags ?: [null] as $tag) { $this->publishTag($tag); } $this->info('Publishing complete.'); }
[ "public", "function", "handle", "(", ")", "{", "$", "this", "->", "determineWhatShouldBePublished", "(", ")", ";", "foreach", "(", "$", "this", "->", "tags", "?", ":", "[", "null", "]", "as", "$", "tag", ")", "{", "$", "this", "->", "publishTag", "("...
Execute the console command. @return void
[ "Execute", "the", "console", "command", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Foundation/Console/VendorPublishCommand.php#L71-L80
train
Publishes all tags
[ 30522, 2270, 3853, 5047, 1006, 1007, 1063, 1002, 2023, 1011, 1028, 5646, 2860, 12707, 22231, 21285, 4783, 14289, 16558, 13295, 1006, 1007, 1025, 18921, 6776, 1006, 1002, 2023, 1011, 1028, 22073, 1029, 1024, 1031, 19701, 1033, 2004, 1002, 64...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
dompdf/dompdf
src/Frame.php
Frame.get_margin_width
public function get_margin_width() { $style = $this->_style; return (float)$style->length_in_pt(array( $style->width, $style->margin_left, $style->margin_right, $style->border_left_width, $style->border_right_width, $style->padding_left, $style->padding_right ), $this->_containing_block["w"]); }
php
public function get_margin_width() { $style = $this->_style; return (float)$style->length_in_pt(array( $style->width, $style->margin_left, $style->margin_right, $style->border_left_width, $style->border_right_width, $style->padding_left, $style->padding_right ), $this->_containing_block["w"]); }
[ "public", "function", "get_margin_width", "(", ")", "{", "$", "style", "=", "$", "this", "->", "_style", ";", "return", "(", "float", ")", "$", "style", "->", "length_in_pt", "(", "array", "(", "$", "style", "->", "width", ",", "$", "style", "->", "m...
Return the width of the margin box of the frame, in pt. Meaningless unless the width has been calculated properly. @return float
[ "Return", "the", "width", "of", "the", "margin", "box", "of", "the", "frame", "in", "pt", ".", "Meaningless", "unless", "the", "width", "has", "been", "calculated", "properly", "." ]
75f13c700009be21a1965dc2c5b68a8708c22ba2
https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/src/Frame.php#L495-L508
train
Return the width of the margin box
[ 30522, 2270, 3853, 2131, 1035, 7785, 1035, 9381, 1006, 1007, 1063, 1002, 2806, 1027, 1002, 2023, 1011, 1028, 1035, 2806, 1025, 2709, 1006, 14257, 1007, 1002, 2806, 1011, 1028, 3091, 1035, 1999, 1035, 13866, 1006, 9140, 1006, 1002, 2806, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Eloquent/Builder.php
Builder.withoutGlobalScope
public function withoutGlobalScope($scope) { if (! is_string($scope)) { $scope = get_class($scope); } unset($this->scopes[$scope]); $this->removedScopes[] = $scope; return $this; }
php
public function withoutGlobalScope($scope) { if (! is_string($scope)) { $scope = get_class($scope); } unset($this->scopes[$scope]); $this->removedScopes[] = $scope; return $this; }
[ "public", "function", "withoutGlobalScope", "(", "$", "scope", ")", "{", "if", "(", "!", "is_string", "(", "$", "scope", ")", ")", "{", "$", "scope", "=", "get_class", "(", "$", "scope", ")", ";", "}", "unset", "(", "$", "this", "->", "scopes", "["...
Remove a registered global scope. @param \Illuminate\Database\Eloquent\Scope|string $scope @return $this
[ "Remove", "a", "registered", "global", "scope", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Builder.php#L138-L149
train
Remove a global scope from the list of scopes
[ 30522, 2270, 3853, 2302, 23296, 16429, 9777, 16186, 1006, 1002, 9531, 1007, 1063, 2065, 1006, 999, 2003, 1035, 5164, 1006, 1002, 9531, 1007, 1007, 1063, 1002, 9531, 1027, 2131, 1035, 2465, 1006, 1002, 9531, 1007, 1025, 1065, 4895, 13462, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
z-song/laravel-admin
src/Grid/Tools/ColumnSelector.php
ColumnSelector.render
public function render() { if (!$this->grid->showColumnSelector()) { return ''; } $show = array_filter(explode(',', request(static::SELECT_COLUMN_NAME))); $columns = $this->getGridColumns(); $this->setupScript(); $lists = $columns->map(function ($val, $key) use ($show) { if (empty($show)) { $checked = 'checked'; } else { $checked = in_array($key, $show) ? 'checked' : ''; } return <<<HTML <li class="checkbox icheck" style="margin: 0;"> <label style="width: 100%;padding: 3px;"> <input type="checkbox" class="column-select-item" value="{$key}" {$checked}/>&nbsp;&nbsp;&nbsp;{$val} </label> </li> HTML; })->implode("\r\n"); $btns = [ 'all' => __('admin.all'), 'submit' => __('admin.submit'), ]; return <<<EOT <div class="dropdown pull-right column-selector" style="margin-right: 10px"> <button type="button" class="btn btn-sm btn-instagram dropdown-toggle" data-toggle="dropdown"> <i class="fa fa-table"></i> &nbsp; <span class="caret"></span> </button> <ul class="dropdown-menu" role="menu" style="padding: 10px;"> <li> <ul style='padding: 0;'> {$lists} </ul> </li> <li class="divider"></li> <li class="text-right"> <button class="btn btn-sm btn-defalut column-select-all">{$btns['all']}</button>&nbsp;&nbsp; <button class="btn btn-sm btn-primary column-select-submit">{$btns['submit']}</button> </li> </ul> </div> EOT; }
php
public function render() { if (!$this->grid->showColumnSelector()) { return ''; } $show = array_filter(explode(',', request(static::SELECT_COLUMN_NAME))); $columns = $this->getGridColumns(); $this->setupScript(); $lists = $columns->map(function ($val, $key) use ($show) { if (empty($show)) { $checked = 'checked'; } else { $checked = in_array($key, $show) ? 'checked' : ''; } return <<<HTML <li class="checkbox icheck" style="margin: 0;"> <label style="width: 100%;padding: 3px;"> <input type="checkbox" class="column-select-item" value="{$key}" {$checked}/>&nbsp;&nbsp;&nbsp;{$val} </label> </li> HTML; })->implode("\r\n"); $btns = [ 'all' => __('admin.all'), 'submit' => __('admin.submit'), ]; return <<<EOT <div class="dropdown pull-right column-selector" style="margin-right: 10px"> <button type="button" class="btn btn-sm btn-instagram dropdown-toggle" data-toggle="dropdown"> <i class="fa fa-table"></i> &nbsp; <span class="caret"></span> </button> <ul class="dropdown-menu" role="menu" style="padding: 10px;"> <li> <ul style='padding: 0;'> {$lists} </ul> </li> <li class="divider"></li> <li class="text-right"> <button class="btn btn-sm btn-defalut column-select-all">{$btns['all']}</button>&nbsp;&nbsp; <button class="btn btn-sm btn-primary column-select-submit">{$btns['submit']}</button> </li> </ul> </div> EOT; }
[ "public", "function", "render", "(", ")", "{", "if", "(", "!", "$", "this", "->", "grid", "->", "showColumnSelector", "(", ")", ")", "{", "return", "''", ";", "}", "$", "show", "=", "array_filter", "(", "explode", "(", "','", ",", "request", "(", "...
{@inheritdoc} @return string
[ "{", "@inheritdoc", "}" ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid/Tools/ColumnSelector.php#L33-L87
train
Renders the language tree
[ 30522, 2270, 3853, 17552, 1006, 1007, 1063, 2065, 1006, 999, 1002, 2023, 1011, 1028, 8370, 1011, 1028, 2265, 25778, 2819, 12325, 2571, 16761, 1006, 1007, 1007, 1063, 2709, 1005, 1005, 1025, 1065, 1002, 2265, 1027, 9140, 1035, 11307, 1006, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/Utils.php
Utils.getPagePathFromToken
public static function getPagePathFromToken($path, PageInterface $page = null) { $path_parts = pathinfo($path); $grav = Grav::instance(); $basename = ''; if (isset($path_parts['extension'])) { $basename = '/' . $path_parts['basename']; $path = rtrim($path_parts['dirname'], ':'); } $regex = '/(@self|self@)|((?:@page|page@):(?:.*))|((?:@theme|theme@):(?:.*))/'; preg_match($regex, $path, $matches); if ($matches) { if ($matches[1]) { if (null === $page) { throw new \RuntimeException('Page not available for this self@ reference'); } } elseif ($matches[2]) { // page@ $parts = explode(':', $path); $route = $parts[1]; $page = $grav['page']->find($route); } elseif ($matches[3]) { // theme@ $parts = explode(':', $path); $route = $parts[1]; $theme = str_replace(ROOT_DIR, '', $grav['locator']->findResource("theme://")); return $theme . $route . $basename; } } else { return $path . $basename; } if (!$page) { throw new \RuntimeException('Page route not found: ' . $path); } $path = str_replace($matches[0], rtrim($page->relativePagePath(), '/'), $path); return $path . $basename; }
php
public static function getPagePathFromToken($path, PageInterface $page = null) { $path_parts = pathinfo($path); $grav = Grav::instance(); $basename = ''; if (isset($path_parts['extension'])) { $basename = '/' . $path_parts['basename']; $path = rtrim($path_parts['dirname'], ':'); } $regex = '/(@self|self@)|((?:@page|page@):(?:.*))|((?:@theme|theme@):(?:.*))/'; preg_match($regex, $path, $matches); if ($matches) { if ($matches[1]) { if (null === $page) { throw new \RuntimeException('Page not available for this self@ reference'); } } elseif ($matches[2]) { // page@ $parts = explode(':', $path); $route = $parts[1]; $page = $grav['page']->find($route); } elseif ($matches[3]) { // theme@ $parts = explode(':', $path); $route = $parts[1]; $theme = str_replace(ROOT_DIR, '', $grav['locator']->findResource("theme://")); return $theme . $route . $basename; } } else { return $path . $basename; } if (!$page) { throw new \RuntimeException('Page route not found: ' . $path); } $path = str_replace($matches[0], rtrim($page->relativePagePath(), '/'), $path); return $path . $basename; }
[ "public", "static", "function", "getPagePathFromToken", "(", "$", "path", ",", "PageInterface", "$", "page", "=", "null", ")", "{", "$", "path_parts", "=", "pathinfo", "(", "$", "path", ")", ";", "$", "grav", "=", "Grav", "::", "instance", "(", ")", ";...
Get's path based on a token @param string $path @param PageInterface|null $page @return string @throws \RuntimeException
[ "Get", "s", "path", "based", "on", "a", "token" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Utils.php#L1297-L1340
train
Get the page path from a token
[ 30522, 2270, 10763, 3853, 2131, 13704, 15069, 19699, 5358, 18715, 2368, 1006, 1002, 4130, 1010, 3931, 18447, 2121, 12172, 1002, 3931, 1027, 19701, 1007, 1063, 1002, 4130, 1035, 3033, 1027, 4130, 2378, 14876, 1006, 1002, 4130, 1007, 1025, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
barryvdh/laravel-debugbar
src/DataFormatter/QueryFormatter.php
QueryFormatter.escapeBindings
public function escapeBindings($bindings) { foreach ($bindings as &$binding) { $binding = htmlentities($binding, ENT_QUOTES, 'UTF-8', false); } return $bindings; }
php
public function escapeBindings($bindings) { foreach ($bindings as &$binding) { $binding = htmlentities($binding, ENT_QUOTES, 'UTF-8', false); } return $bindings; }
[ "public", "function", "escapeBindings", "(", "$", "bindings", ")", "{", "foreach", "(", "$", "bindings", "as", "&", "$", "binding", ")", "{", "$", "binding", "=", "htmlentities", "(", "$", "binding", ",", "ENT_QUOTES", ",", "'UTF-8'", ",", "false", ")", ...
Make the bindings safe for outputting. @param array $bindings @return array
[ "Make", "the", "bindings", "safe", "for", "outputting", "." ]
2d195779ea4f809f69764a795e2ec371dbb76a96
https://github.com/barryvdh/laravel-debugbar/blob/2d195779ea4f809f69764a795e2ec371dbb76a96/src/DataFormatter/QueryFormatter.php#L44-L51
train
escape all bindings
[ 30522, 2270, 3853, 4019, 8428, 4667, 2015, 1006, 1002, 8031, 2015, 1007, 1063, 18921, 6776, 1006, 1002, 8031, 2015, 2004, 1004, 1002, 8031, 1007, 1063, 1002, 8031, 1027, 16129, 4765, 6447, 1006, 1002, 8031, 1010, 4372, 2102, 1035, 16614, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/CoreVisualizations/Visualizations/Sparklines/Config.php
Config.replaceSparklineMetric
public function replaceSparklineMetric($metricNames, $replacementColumns) { foreach ($this->sparkline_metrics as $index => $metric) { if ($metric['columns'] === $metricNames) { $this->sparkline_metrics[$index]['columns'] = $replacementColumns; } } }
php
public function replaceSparklineMetric($metricNames, $replacementColumns) { foreach ($this->sparkline_metrics as $index => $metric) { if ($metric['columns'] === $metricNames) { $this->sparkline_metrics[$index]['columns'] = $replacementColumns; } } }
[ "public", "function", "replaceSparklineMetric", "(", "$", "metricNames", ",", "$", "replacementColumns", ")", "{", "foreach", "(", "$", "this", "->", "sparkline_metrics", "as", "$", "index", "=>", "$", "metric", ")", "{", "if", "(", "$", "metric", "[", "'c...
Replaces an existing sparkline entry with different columns. Especially useful in dataTable filters in case sparklines should be not displayed depending on the fetched data. Example: $config->addSparklineMetric('nb_users'); $config->filters[] = function ($dataTable) use ($config) { if ($dataTable->getFirstRow()->getColumn('nb_users') == 0) { // instead of showing the sparklines for users, show a placeholder if there are no recorded users $config->replaceSparklineMetric(array('nb_users'), ''); } } @param array|string $metricNames The name of the metrics in the same format they were used when added via {@link addSparklineMetric} @param array|string $replacementColumns The removed columns will be replaced with these columns
[ "Replaces", "an", "existing", "sparkline", "entry", "with", "different", "columns", ".", "Especially", "useful", "in", "dataTable", "filters", "in", "case", "sparklines", "should", "be", "not", "displayed", "depending", "on", "the", "fetched", "data", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/CoreVisualizations/Visualizations/Sparklines/Config.php#L118-L125
train
Replace the sparkline metric with the new columns
[ 30522, 2270, 3853, 20736, 14432, 4179, 12589, 1006, 1002, 12046, 18442, 2015, 1010, 1002, 6110, 25778, 2819, 3619, 1007, 1063, 18921, 6776, 1006, 1002, 2023, 1011, 1028, 12125, 4179, 1035, 12046, 2015, 2004, 1002, 5950, 1027, 1028, 1002, 12...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/Twig/TwigExtension.php
TwigExtension.absoluteUrlFilter
public function absoluteUrlFilter($string) { $url = $this->grav['uri']->base(); $string = preg_replace('/((?:href|src) *= *[\'"](?!(http|ftp)))/i', "$1$url", $string); return $string; }
php
public function absoluteUrlFilter($string) { $url = $this->grav['uri']->base(); $string = preg_replace('/((?:href|src) *= *[\'"](?!(http|ftp)))/i', "$1$url", $string); return $string; }
[ "public", "function", "absoluteUrlFilter", "(", "$", "string", ")", "{", "$", "url", "=", "$", "this", "->", "grav", "[", "'uri'", "]", "->", "base", "(", ")", ";", "$", "string", "=", "preg_replace", "(", "'/((?:href|src) *= *[\\'\"](?!(http|ftp)))/i'", ","...
@param string $string @return mixed
[ "@param", "string", "$string" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Twig/TwigExtension.php#L604-L611
train
This filter is used to filter the absolute URL of a string.
[ 30522, 2270, 3853, 7619, 3126, 10270, 4014, 3334, 1006, 1002, 5164, 1007, 1063, 1002, 24471, 2140, 1027, 1002, 2023, 1011, 1028, 24665, 11431, 1031, 1005, 24471, 2072, 1005, 1033, 1011, 1028, 2918, 1006, 1007, 1025, 1002, 5164, 1027, 3653, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
barryvdh/laravel-debugbar
src/DataCollector/LogsCollector.php
LogsCollector.tailFile
protected function tailFile($file, $lines) { $handle = fopen($file, "r"); $linecounter = $lines; $pos = -2; $beginning = false; $text = []; while ($linecounter > 0) { $t = " "; while ($t != "\n") { if (fseek($handle, $pos, SEEK_END) == -1) { $beginning = true; break; } $t = fgetc($handle); $pos--; } $linecounter--; if ($beginning) { rewind($handle); } $text[$lines - $linecounter - 1] = fgets($handle); if ($beginning) { break; } } fclose($handle); return array_reverse($text); }
php
protected function tailFile($file, $lines) { $handle = fopen($file, "r"); $linecounter = $lines; $pos = -2; $beginning = false; $text = []; while ($linecounter > 0) { $t = " "; while ($t != "\n") { if (fseek($handle, $pos, SEEK_END) == -1) { $beginning = true; break; } $t = fgetc($handle); $pos--; } $linecounter--; if ($beginning) { rewind($handle); } $text[$lines - $linecounter - 1] = fgets($handle); if ($beginning) { break; } } fclose($handle); return array_reverse($text); }
[ "protected", "function", "tailFile", "(", "$", "file", ",", "$", "lines", ")", "{", "$", "handle", "=", "fopen", "(", "$", "file", ",", "\"r\"", ")", ";", "$", "linecounter", "=", "$", "lines", ";", "$", "pos", "=", "-", "2", ";", "$", "beginning...
By Ain Tohvri (ain) http://tekkie.flashbit.net/php/tail-functionality-in-php @param string $file @param int $lines @return array
[ "By", "Ain", "Tohvri", "(", "ain", ")", "http", ":", "//", "tekkie", ".", "flashbit", ".", "net", "/", "php", "/", "tail", "-", "functionality", "-", "in", "-", "php" ]
2d195779ea4f809f69764a795e2ec371dbb76a96
https://github.com/barryvdh/laravel-debugbar/blob/2d195779ea4f809f69764a795e2ec371dbb76a96/src/DataCollector/LogsCollector.php#L67-L95
train
Tail a file
[ 30522, 5123, 3853, 5725, 8873, 2571, 1006, 1002, 5371, 1010, 1002, 3210, 1007, 1063, 1002, 5047, 1027, 1042, 26915, 1006, 1002, 5371, 1010, 1000, 1054, 1000, 1007, 1025, 1002, 2240, 3597, 16671, 2121, 1027, 1002, 3210, 1025, 1002, 13433, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
dompdf/dompdf
src/Css/Stylesheet.php
Stylesheet.load_css
function load_css(&$css, $origin = self::ORIG_AUTHOR) { if ($origin) { $this->_current_origin = $origin; } $this->_parse_css($css); }
php
function load_css(&$css, $origin = self::ORIG_AUTHOR) { if ($origin) { $this->_current_origin = $origin; } $this->_parse_css($css); }
[ "function", "load_css", "(", "&", "$", "css", ",", "$", "origin", "=", "self", "::", "ORIG_AUTHOR", ")", "{", "if", "(", "$", "origin", ")", "{", "$", "this", "->", "_current_origin", "=", "$", "origin", ";", "}", "$", "this", "->", "_parse_css", "...
load and parse a CSS string @param string $css @param int $origin
[ "load", "and", "parse", "a", "CSS", "string" ]
75f13c700009be21a1965dc2c5b68a8708c22ba2
https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/src/Css/Stylesheet.php#L324-L330
train
Load the CSS file
[ 30522, 3853, 7170, 1035, 20116, 2015, 1006, 1004, 1002, 20116, 2015, 1010, 1002, 4761, 1027, 2969, 1024, 1024, 2030, 8004, 1035, 3166, 1007, 1063, 2065, 1006, 1002, 4761, 1007, 1063, 1002, 2023, 1011, 1028, 1035, 2783, 1035, 4761, 1027, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/Plugin/Controller.php
Controller.setGeneralVariablesView
protected function setGeneralVariablesView($view) { $view->idSite = $this->idSite; $this->checkSitePermission(); $this->setPeriodVariablesView($view); $view->siteName = $this->site->getName(); $view->siteMainUrl = $this->site->getMainUrl(); $siteTimezone = $this->site->getTimezone(); $datetimeMinDate = $this->site->getCreationDate()->getDatetime(); $minDate = Date::factory($datetimeMinDate, $siteTimezone); $this->setMinDateView($minDate, $view); $maxDate = Date::factory('now', $siteTimezone); $this->setMaxDateView($maxDate, $view); $rawDate = Common::getRequestVar('date'); Period::checkDateFormat($rawDate); $periodStr = Common::getRequestVar('period'); if ($periodStr != 'range') { $date = Date::factory($this->strDate); $validDate = $this->getValidDate($date, $minDate, $maxDate); $period = Period\Factory::build($periodStr, $validDate); if ($date->toString() !== $validDate->toString()) { // we to not always change date since it could convert a strDate "today" to "YYYY-MM-DD" // only change $this->strDate if it was not valid before $this->setDate($validDate); } } else { $period = new Range($periodStr, $rawDate, $siteTimezone); } // Setting current period start & end dates, for pre-setting the calendar when "Date Range" is selected $dateStart = $period->getDateStart(); $dateStart = $this->getValidDate($dateStart, $minDate, $maxDate); $dateEnd = $period->getDateEnd(); $dateEnd = $this->getValidDate($dateEnd, $minDate, $maxDate); if ($periodStr == 'range') { // make sure we actually display the correct calendar pretty date $newRawDate = $dateStart->toString() . ',' . $dateEnd->toString(); $period = new Range($periodStr, $newRawDate, $siteTimezone); } $view->date = $this->strDate; $view->prettyDate = self::getCalendarPrettyDate($period); // prettyDateLong is not used by core, leaving in case plugins may be using it $view->prettyDateLong = $period->getLocalizedLongString(); $view->rawDate = $rawDate; $view->startDate = $dateStart; $view->endDate = $dateEnd; $timezoneOffsetInSeconds = Date::getUtcOffset($siteTimezone); $view->timezoneOffset = $timezoneOffsetInSeconds; $language = LanguagesManager::getLanguageForSession(); $view->language = !empty($language) ? $language : LanguagesManager::getLanguageCodeForCurrentUser(); $this->setBasicVariablesView($view); $view->topMenu = MenuTop::getInstance()->getMenu(); $view->adminMenu = MenuAdmin::getInstance()->getMenu(); $notifications = $view->notifications; if (empty($notifications)) { $view->notifications = NotificationManager::getAllNotificationsToDisplay(); NotificationManager::cancelAllNonPersistent(); } }
php
protected function setGeneralVariablesView($view) { $view->idSite = $this->idSite; $this->checkSitePermission(); $this->setPeriodVariablesView($view); $view->siteName = $this->site->getName(); $view->siteMainUrl = $this->site->getMainUrl(); $siteTimezone = $this->site->getTimezone(); $datetimeMinDate = $this->site->getCreationDate()->getDatetime(); $minDate = Date::factory($datetimeMinDate, $siteTimezone); $this->setMinDateView($minDate, $view); $maxDate = Date::factory('now', $siteTimezone); $this->setMaxDateView($maxDate, $view); $rawDate = Common::getRequestVar('date'); Period::checkDateFormat($rawDate); $periodStr = Common::getRequestVar('period'); if ($periodStr != 'range') { $date = Date::factory($this->strDate); $validDate = $this->getValidDate($date, $minDate, $maxDate); $period = Period\Factory::build($periodStr, $validDate); if ($date->toString() !== $validDate->toString()) { // we to not always change date since it could convert a strDate "today" to "YYYY-MM-DD" // only change $this->strDate if it was not valid before $this->setDate($validDate); } } else { $period = new Range($periodStr, $rawDate, $siteTimezone); } // Setting current period start & end dates, for pre-setting the calendar when "Date Range" is selected $dateStart = $period->getDateStart(); $dateStart = $this->getValidDate($dateStart, $minDate, $maxDate); $dateEnd = $period->getDateEnd(); $dateEnd = $this->getValidDate($dateEnd, $minDate, $maxDate); if ($periodStr == 'range') { // make sure we actually display the correct calendar pretty date $newRawDate = $dateStart->toString() . ',' . $dateEnd->toString(); $period = new Range($periodStr, $newRawDate, $siteTimezone); } $view->date = $this->strDate; $view->prettyDate = self::getCalendarPrettyDate($period); // prettyDateLong is not used by core, leaving in case plugins may be using it $view->prettyDateLong = $period->getLocalizedLongString(); $view->rawDate = $rawDate; $view->startDate = $dateStart; $view->endDate = $dateEnd; $timezoneOffsetInSeconds = Date::getUtcOffset($siteTimezone); $view->timezoneOffset = $timezoneOffsetInSeconds; $language = LanguagesManager::getLanguageForSession(); $view->language = !empty($language) ? $language : LanguagesManager::getLanguageCodeForCurrentUser(); $this->setBasicVariablesView($view); $view->topMenu = MenuTop::getInstance()->getMenu(); $view->adminMenu = MenuAdmin::getInstance()->getMenu(); $notifications = $view->notifications; if (empty($notifications)) { $view->notifications = NotificationManager::getAllNotificationsToDisplay(); NotificationManager::cancelAllNonPersistent(); } }
[ "protected", "function", "setGeneralVariablesView", "(", "$", "view", ")", "{", "$", "view", "->", "idSite", "=", "$", "this", "->", "idSite", ";", "$", "this", "->", "checkSitePermission", "(", ")", ";", "$", "this", "->", "setPeriodVariablesView", "(", "...
Assigns variables to {@link Piwik\View} instances that display an entire page. The following variables assigned: **date** - The value of the **date** query parameter. **idSite** - The value of the **idSite** query parameter. **rawDate** - The value of the **date** query parameter. **prettyDate** - A pretty string description of the current period. **siteName** - The current site's name. **siteMainUrl** - The URL of the current site. **startDate** - The start date of the current period. A {@link Piwik\Date} instance. **endDate** - The end date of the current period. A {@link Piwik\Date} instance. **language** - The current language's language code. **config_action_url_category_delimiter** - The value of the `[General] action_url_category_delimiter` INI config option. **topMenu** - The result of `MenuTop::getInstance()->getMenu()`. As well as the variables set by {@link setPeriodVariablesView()}. Will exit on error. @param View $view @return void @api
[ "Assigns", "variables", "to", "{", "@link", "Piwik", "\\", "View", "}", "instances", "that", "display", "an", "entire", "page", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Plugin/Controller.php#L582-L656
train
Set the variables view for the calendar
[ 30522, 5123, 3853, 2275, 6914, 21673, 10755, 19210, 2015, 8584, 1006, 1002, 3193, 1007, 1063, 1002, 3193, 1011, 1028, 8909, 28032, 2063, 1027, 1002, 2023, 1011, 1028, 8909, 28032, 2063, 1025, 1002, 2023, 1011, 1028, 14148, 4221, 4842, 25481...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/Referrers/Archiver.php
Archiver.insertDayReports
protected function insertDayReports() { $this->insertDayNumericMetrics(); // insert DataTable reports foreach ($this->getRecordNames() as $recordName) { $blob = $this->getDataArray($recordName)->asDataTable()->getSerialized($this->maximumRowsInDataTableLevelZero, $this->maximumRowsInSubDataTable, $this->columnToSortByBeforeTruncation); $this->getProcessor()->insertBlobRecord($recordName, $blob); } }
php
protected function insertDayReports() { $this->insertDayNumericMetrics(); // insert DataTable reports foreach ($this->getRecordNames() as $recordName) { $blob = $this->getDataArray($recordName)->asDataTable()->getSerialized($this->maximumRowsInDataTableLevelZero, $this->maximumRowsInSubDataTable, $this->columnToSortByBeforeTruncation); $this->getProcessor()->insertBlobRecord($recordName, $blob); } }
[ "protected", "function", "insertDayReports", "(", ")", "{", "$", "this", "->", "insertDayNumericMetrics", "(", ")", ";", "// insert DataTable reports", "foreach", "(", "$", "this", "->", "getRecordNames", "(", ")", "as", "$", "recordName", ")", "{", "$", "blob...
Records the daily stats (numeric or datatable blob) into the archive tables.
[ "Records", "the", "daily", "stats", "(", "numeric", "or", "datatable", "blob", ")", "into", "the", "archive", "tables", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Referrers/Archiver.php#L205-L214
train
Insert Day reports
[ 30522, 5123, 3853, 19274, 10259, 2890, 25378, 1006, 1007, 1063, 1002, 2023, 1011, 1028, 19274, 10259, 19172, 22420, 12589, 2015, 1006, 1007, 1025, 1013, 1013, 30524, 2004, 2850, 29336, 3085, 1006, 1007, 1011, 1028, 4152, 11610, 28931, 1006, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/backend/ServiceProvider.php
ServiceProvider.registerBackendSettings
protected function registerBackendSettings() { SettingsManager::instance()->registerCallback(function ($manager) { $manager->registerSettingItems('October.Backend', [ 'branding' => [ 'label' => 'backend::lang.branding.menu_label', 'description' => 'backend::lang.branding.menu_description', 'category' => SettingsManager::CATEGORY_SYSTEM, 'icon' => 'icon-paint-brush', 'class' => 'Backend\Models\BrandSetting', 'permissions' => ['backend.manage_branding'], 'order' => 500, 'keywords' => 'brand style' ], 'editor' => [ 'label' => 'backend::lang.editor.menu_label', 'description' => 'backend::lang.editor.menu_description', 'category' => SettingsManager::CATEGORY_SYSTEM, 'icon' => 'icon-code', 'class' => 'Backend\Models\EditorSetting', 'permissions' => ['backend.manage_editor'], 'order' => 500, 'keywords' => 'html code class style' ], 'myaccount' => [ 'label' => 'backend::lang.myaccount.menu_label', 'description' => 'backend::lang.myaccount.menu_description', 'category' => SettingsManager::CATEGORY_MYSETTINGS, 'icon' => 'icon-user', 'url' => Backend::url('backend/users/myaccount'), 'order' => 500, 'context' => 'mysettings', 'keywords' => 'backend::lang.myaccount.menu_keywords' ], 'preferences' => [ 'label' => 'backend::lang.backend_preferences.menu_label', 'description' => 'backend::lang.backend_preferences.menu_description', 'category' => SettingsManager::CATEGORY_MYSETTINGS, 'icon' => 'icon-laptop', 'url' => Backend::url('backend/preferences'), 'permissions' => ['backend.manage_preferences'], 'order' => 510, 'context' => 'mysettings' ], 'access_logs' => [ 'label' => 'backend::lang.access_log.menu_label', 'description' => 'backend::lang.access_log.menu_description', 'category' => SettingsManager::CATEGORY_LOGS, 'icon' => 'icon-lock', 'url' => Backend::url('backend/accesslogs'), 'permissions' => ['system.access_logs'], 'order' => 920 ] ]); }); }
php
protected function registerBackendSettings() { SettingsManager::instance()->registerCallback(function ($manager) { $manager->registerSettingItems('October.Backend', [ 'branding' => [ 'label' => 'backend::lang.branding.menu_label', 'description' => 'backend::lang.branding.menu_description', 'category' => SettingsManager::CATEGORY_SYSTEM, 'icon' => 'icon-paint-brush', 'class' => 'Backend\Models\BrandSetting', 'permissions' => ['backend.manage_branding'], 'order' => 500, 'keywords' => 'brand style' ], 'editor' => [ 'label' => 'backend::lang.editor.menu_label', 'description' => 'backend::lang.editor.menu_description', 'category' => SettingsManager::CATEGORY_SYSTEM, 'icon' => 'icon-code', 'class' => 'Backend\Models\EditorSetting', 'permissions' => ['backend.manage_editor'], 'order' => 500, 'keywords' => 'html code class style' ], 'myaccount' => [ 'label' => 'backend::lang.myaccount.menu_label', 'description' => 'backend::lang.myaccount.menu_description', 'category' => SettingsManager::CATEGORY_MYSETTINGS, 'icon' => 'icon-user', 'url' => Backend::url('backend/users/myaccount'), 'order' => 500, 'context' => 'mysettings', 'keywords' => 'backend::lang.myaccount.menu_keywords' ], 'preferences' => [ 'label' => 'backend::lang.backend_preferences.menu_label', 'description' => 'backend::lang.backend_preferences.menu_description', 'category' => SettingsManager::CATEGORY_MYSETTINGS, 'icon' => 'icon-laptop', 'url' => Backend::url('backend/preferences'), 'permissions' => ['backend.manage_preferences'], 'order' => 510, 'context' => 'mysettings' ], 'access_logs' => [ 'label' => 'backend::lang.access_log.menu_label', 'description' => 'backend::lang.access_log.menu_description', 'category' => SettingsManager::CATEGORY_LOGS, 'icon' => 'icon-lock', 'url' => Backend::url('backend/accesslogs'), 'permissions' => ['system.access_logs'], 'order' => 920 ] ]); }); }
[ "protected", "function", "registerBackendSettings", "(", ")", "{", "SettingsManager", "::", "instance", "(", ")", "->", "registerCallback", "(", "function", "(", "$", "manager", ")", "{", "$", "manager", "->", "registerSettingItems", "(", "'October.Backend'", ",",...
/* Register settings
[ "/", "*", "Register", "settings" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/ServiceProvider.php#L194-L249
train
Registers the backend settings
[ 30522, 5123, 3853, 4236, 5963, 10497, 21678, 8613, 1006, 1007, 1063, 10906, 24805, 4590, 1024, 1024, 6013, 1006, 1007, 1011, 1028, 4236, 9289, 20850, 8684, 1006, 3853, 1006, 1002, 3208, 1007, 1063, 1002, 3208, 1011, 1028, 18687, 18319, 3070...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Validator/ValidatorBuilder.php
ValidatorBuilder.addXmlMappings
public function addXmlMappings(array $paths) { if (null !== $this->metadataFactory) { throw new ValidatorException('You cannot add custom mappings after setting a custom metadata factory. Configure your metadata factory instead.'); } $this->xmlMappings = array_merge($this->xmlMappings, $paths); return $this; }
php
public function addXmlMappings(array $paths) { if (null !== $this->metadataFactory) { throw new ValidatorException('You cannot add custom mappings after setting a custom metadata factory. Configure your metadata factory instead.'); } $this->xmlMappings = array_merge($this->xmlMappings, $paths); return $this; }
[ "public", "function", "addXmlMappings", "(", "array", "$", "paths", ")", "{", "if", "(", "null", "!==", "$", "this", "->", "metadataFactory", ")", "{", "throw", "new", "ValidatorException", "(", "'You cannot add custom mappings after setting a custom metadata factory. C...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Validator/ValidatorBuilder.php#L119-L128
train
Add custom xml mappings
[ 30522, 2270, 3853, 5587, 2595, 19968, 2863, 14853, 2015, 1006, 9140, 1002, 10425, 1007, 1063, 2065, 1006, 19701, 999, 1027, 1027, 1002, 2023, 1011, 1028, 27425, 21450, 1007, 1063, 5466, 2047, 9398, 8844, 10288, 24422, 1006, 1005, 2017, 3685...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Validation/ValidationRuleParser.php
ValidationRuleParser.mergeRulesForAttribute
protected function mergeRulesForAttribute($results, $attribute, $rules) { $merge = head($this->explodeRules([$rules])); $results[$attribute] = array_merge( isset($results[$attribute]) ? $this->explodeExplicitRule($results[$attribute]) : [], $merge ); return $results; }
php
protected function mergeRulesForAttribute($results, $attribute, $rules) { $merge = head($this->explodeRules([$rules])); $results[$attribute] = array_merge( isset($results[$attribute]) ? $this->explodeExplicitRule($results[$attribute]) : [], $merge ); return $results; }
[ "protected", "function", "mergeRulesForAttribute", "(", "$", "results", ",", "$", "attribute", ",", "$", "rules", ")", "{", "$", "merge", "=", "head", "(", "$", "this", "->", "explodeRules", "(", "[", "$", "rules", "]", ")", ")", ";", "$", "results", ...
Merge additional rules into a given attribute. @param array $results @param string $attribute @param string|array $rules @return array
[ "Merge", "additional", "rules", "into", "a", "given", "attribute", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Validation/ValidationRuleParser.php#L175-L184
train
Merge rules for attribute
[ 30522, 5123, 3853, 7660, 16308, 29278, 19321, 3089, 8569, 2618, 1006, 1002, 3463, 1010, 1002, 17961, 1010, 1002, 3513, 1007, 1063, 1002, 13590, 1027, 2132, 1006, 1002, 2023, 1011, 1028, 15044, 6820, 4244, 1006, 1031, 1002, 3513, 1033, 1007,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Console/Migrations/InstallCommand.php
InstallCommand.handle
public function handle() { $this->repository->setSource($this->input->getOption('database')); $this->repository->createRepository(); $this->info('Migration table created successfully.'); }
php
public function handle() { $this->repository->setSource($this->input->getOption('database')); $this->repository->createRepository(); $this->info('Migration table created successfully.'); }
[ "public", "function", "handle", "(", ")", "{", "$", "this", "->", "repository", "->", "setSource", "(", "$", "this", "->", "input", "->", "getOption", "(", "'database'", ")", ")", ";", "$", "this", "->", "repository", "->", "createRepository", "(", ")", ...
Execute the console command. @return void
[ "Execute", "the", "console", "command", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Console/Migrations/InstallCommand.php#L50-L57
train
Create migration table
[ 30522, 2270, 3853, 5047, 1006, 1007, 1063, 1002, 2023, 1011, 1028, 22409, 1011, 1028, 4520, 8162, 3401, 1006, 1002, 2023, 1011, 1028, 7953, 1011, 1028, 2131, 7361, 3508, 1006, 1005, 7809, 1005, 1007, 1007, 1025, 1002, 2023, 1011, 1028, 22...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Console/Output/StreamOutput.php
StreamOutput.hasColorSupport
protected function hasColorSupport() { if ('Hyper' === getenv('TERM_PROGRAM')) { return true; } if (\DIRECTORY_SEPARATOR === '\\') { return (\function_exists('sapi_windows_vt100_support') && @sapi_windows_vt100_support($this->stream)) || false !== getenv('ANSICON') || 'ON' === getenv('ConEmuANSI') || 'xterm' === getenv('TERM'); } if (\function_exists('stream_isatty')) { return @stream_isatty($this->stream); } if (\function_exists('posix_isatty')) { return @posix_isatty($this->stream); } $stat = @fstat($this->stream); // Check if formatted mode is S_IFCHR return $stat ? 0020000 === ($stat['mode'] & 0170000) : false; }
php
protected function hasColorSupport() { if ('Hyper' === getenv('TERM_PROGRAM')) { return true; } if (\DIRECTORY_SEPARATOR === '\\') { return (\function_exists('sapi_windows_vt100_support') && @sapi_windows_vt100_support($this->stream)) || false !== getenv('ANSICON') || 'ON' === getenv('ConEmuANSI') || 'xterm' === getenv('TERM'); } if (\function_exists('stream_isatty')) { return @stream_isatty($this->stream); } if (\function_exists('posix_isatty')) { return @posix_isatty($this->stream); } $stat = @fstat($this->stream); // Check if formatted mode is S_IFCHR return $stat ? 0020000 === ($stat['mode'] & 0170000) : false; }
[ "protected", "function", "hasColorSupport", "(", ")", "{", "if", "(", "'Hyper'", "===", "getenv", "(", "'TERM_PROGRAM'", ")", ")", "{", "return", "true", ";", "}", "if", "(", "\\", "DIRECTORY_SEPARATOR", "===", "'\\\\'", ")", "{", "return", "(", "\\", "f...
Returns true if the stream supports colorization. Colorization is disabled if not supported by the stream: This is tricky on Windows, because Cygwin, Msys2 etc emulate pseudo terminals via named pipes, so we can only check the environment. Reference: Composer\XdebugHandler\Process::supportsColor https://github.com/composer/xdebug-handler @return bool true if the stream supports colorization, false otherwise
[ "Returns", "true", "if", "the", "stream", "supports", "colorization", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Console/Output/StreamOutput.php#L98-L123
train
Returns true if the current stream has color support
[ 30522, 5123, 3853, 2038, 18717, 6342, 9397, 30524, 2615, 1006, 1005, 2744, 1035, 2565, 1005, 1007, 1007, 1063, 2709, 2995, 1025, 1065, 2065, 1006, 1032, 14176, 1035, 19802, 25879, 2953, 1027, 1027, 1027, 1005, 1032, 1032, 1005, 1007, 1063, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/cms/classes/CmsObject.php
CmsObject.getFilePath
public function getFilePath($fileName = null) { if ($fileName === null) { $fileName = $this->fileName; } return $this->theme->getPath().'/'.$this->getObjectTypeDirName().'/'.$fileName; }
php
public function getFilePath($fileName = null) { if ($fileName === null) { $fileName = $this->fileName; } return $this->theme->getPath().'/'.$this->getObjectTypeDirName().'/'.$fileName; }
[ "public", "function", "getFilePath", "(", "$", "fileName", "=", "null", ")", "{", "if", "(", "$", "fileName", "===", "null", ")", "{", "$", "fileName", "=", "$", "this", "->", "fileName", ";", "}", "return", "$", "this", "->", "theme", "->", "getPath...
Returns the full path to the template file corresponding to this object. @param string $fileName @return string
[ "Returns", "the", "full", "path", "to", "the", "template", "file", "corresponding", "to", "this", "object", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/CmsObject.php#L224-L231
train
Get the file path of the object
[ 30522, 2270, 3853, 2131, 8873, 2571, 15069, 1006, 1002, 5371, 18442, 1027, 19701, 1007, 1063, 2065, 1006, 1002, 5371, 18442, 1027, 1027, 1027, 19701, 1007, 1063, 1002, 5371, 18442, 1027, 1002, 2023, 1011, 1028, 5371, 18442, 1025, 1065, 2709...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/Access.php
Access.getCapabilitiesForSite
public function getCapabilitiesForSite($idSite) { $result = []; foreach ($this->capabilityProvider->getAllCapabilityIds() as $capabilityId) { if (empty($this->idsitesByAccess[$capabilityId])) { continue; } if (in_array($idSite, $this->idsitesByAccess[$capabilityId])) { $result[] = $capabilityId; } } return $result; }
php
public function getCapabilitiesForSite($idSite) { $result = []; foreach ($this->capabilityProvider->getAllCapabilityIds() as $capabilityId) { if (empty($this->idsitesByAccess[$capabilityId])) { continue; } if (in_array($idSite, $this->idsitesByAccess[$capabilityId])) { $result[] = $capabilityId; } } return $result; }
[ "public", "function", "getCapabilitiesForSite", "(", "$", "idSite", ")", "{", "$", "result", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "capabilityProvider", "->", "getAllCapabilityIds", "(", ")", "as", "$", "capabilityId", ")", "{", "if", "(",...
Returns the capabilities the current user has for a given site. @param int $idSite The site to check. @return string[] The capabilities the user has.
[ "Returns", "the", "capabilities", "the", "current", "user", "has", "for", "a", "given", "site", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Access.php#L677-L690
train
Returns the capability ids for the given site
[ 30522, 2270, 3853, 2131, 17695, 28518, 15909, 3111, 29278, 28032, 2063, 1006, 1002, 8909, 28032, 2063, 1007, 1063, 1002, 2765, 1027, 1031, 1033, 1025, 18921, 6776, 1006, 1002, 2023, 1011, 1028, 10673, 21572, 17258, 2121, 1011, 1028, 2131, 8...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
barryvdh/laravel-debugbar
src/Storage/FilesystemStorage.php
FilesystemStorage.get
public function get($id) { return json_decode($this->files->get($this->makeFilename($id)), true); }
php
public function get($id) { return json_decode($this->files->get($this->makeFilename($id)), true); }
[ "public", "function", "get", "(", "$", "id", ")", "{", "return", "json_decode", "(", "$", "this", "->", "files", "->", "get", "(", "$", "this", "->", "makeFilename", "(", "$", "id", ")", ")", ",", "true", ")", ";", "}" ]
{@inheritDoc}
[ "{" ]
2d195779ea4f809f69764a795e2ec371dbb76a96
https://github.com/barryvdh/laravel-debugbar/blob/2d195779ea4f809f69764a795e2ec371dbb76a96/src/Storage/FilesystemStorage.php#L80-L83
train
Get the record from the cache
[ 30522, 2270, 3853, 2131, 1006, 1002, 8909, 1007, 1063, 2709, 1046, 3385, 1035, 21933, 3207, 1006, 1002, 2023, 1011, 1028, 6764, 1011, 1028, 2131, 1006, 1002, 2023, 1011, 1028, 2191, 8873, 20844, 4168, 1006, 1002, 8909, 1007, 1007, 1010, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/UserCountry/UserCountry.php
UserCountry.getCountriesForContinent
public static function getCountriesForContinent($continent) { /** @var RegionDataProvider $regionDataProvider */ $regionDataProvider = StaticContainer::get('Piwik\Intl\Data\Provider\RegionDataProvider'); $result = array(); $continent = strtolower($continent); foreach ($regionDataProvider->getCountryList() as $countryCode => $continentCode) { if ($continent == $continentCode) { $result[] = $countryCode; } } return array('SQL' => "'" . implode("', '", $result) . "', ?", 'bind' => '-'); // HACK: SegmentExpression requires a $bind, even if there's nothing to bind }
php
public static function getCountriesForContinent($continent) { /** @var RegionDataProvider $regionDataProvider */ $regionDataProvider = StaticContainer::get('Piwik\Intl\Data\Provider\RegionDataProvider'); $result = array(); $continent = strtolower($continent); foreach ($regionDataProvider->getCountryList() as $countryCode => $continentCode) { if ($continent == $continentCode) { $result[] = $countryCode; } } return array('SQL' => "'" . implode("', '", $result) . "', ?", 'bind' => '-'); // HACK: SegmentExpression requires a $bind, even if there's nothing to bind }
[ "public", "static", "function", "getCountriesForContinent", "(", "$", "continent", ")", "{", "/** @var RegionDataProvider $regionDataProvider */", "$", "regionDataProvider", "=", "StaticContainer", "::", "get", "(", "'Piwik\\Intl\\Data\\Provider\\RegionDataProvider'", ")", ";",...
Returns a list of country codes for a given continent code. @param string $continent The continent code. @return array
[ "Returns", "a", "list", "of", "country", "codes", "for", "a", "given", "continent", "code", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/UserCountry/UserCountry.php#L72-L86
train
Returns all the countries for a given continent
[ 30522, 2270, 10763, 3853, 2131, 3597, 16671, 5134, 29278, 8663, 10196, 3372, 1006, 1002, 9983, 1007, 1063, 1013, 1008, 1008, 1030, 13075, 2555, 2850, 2696, 21572, 17258, 2121, 1002, 2555, 2850, 2696, 21572, 17258, 2121, 1008, 1013, 1002, 25...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
FrameworkExtension.createPackageDefinition
private function createPackageDefinition($basePath, array $baseUrls, Reference $version) { if ($basePath && $baseUrls) { throw new \LogicException('An asset package cannot have base URLs and base paths.'); } $package = new ChildDefinition($baseUrls ? 'assets.url_package' : 'assets.path_package'); $package ->setPublic(false) ->replaceArgument(0, $baseUrls ?: $basePath) ->replaceArgument(1, $version) ; return $package; }
php
private function createPackageDefinition($basePath, array $baseUrls, Reference $version) { if ($basePath && $baseUrls) { throw new \LogicException('An asset package cannot have base URLs and base paths.'); } $package = new ChildDefinition($baseUrls ? 'assets.url_package' : 'assets.path_package'); $package ->setPublic(false) ->replaceArgument(0, $baseUrls ?: $basePath) ->replaceArgument(1, $version) ; return $package; }
[ "private", "function", "createPackageDefinition", "(", "$", "basePath", ",", "array", "$", "baseUrls", ",", "Reference", "$", "version", ")", "{", "if", "(", "$", "basePath", "&&", "$", "baseUrls", ")", "{", "throw", "new", "\\", "LogicException", "(", "'A...
Returns a definition for an asset package.
[ "Returns", "a", "definition", "for", "an", "asset", "package", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php#L1038-L1052
train
Create a child definition for the asset package
[ 30522, 2797, 3853, 3443, 23947, 18655, 12879, 5498, 3508, 1006, 1002, 2918, 15069, 1010, 9140, 1002, 2918, 3126, 4877, 1010, 4431, 1002, 2544, 30524, 1032, 7961, 10288, 24422, 1006, 1005, 2019, 11412, 7427, 3685, 2031, 2918, 24471, 4877, 19...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
dompdf/dompdf
lib/Cpdf.php
Cpdf.scale
function scale($s_x, $s_y, $x, $y) { $y = $this->currentPageSize["height"] - $y; $tm = array( $s_x, 0, 0, $s_y, $x * (1 - $s_x), $y * (1 - $s_y) ); $this->transform($tm); }
php
function scale($s_x, $s_y, $x, $y) { $y = $this->currentPageSize["height"] - $y; $tm = array( $s_x, 0, 0, $s_y, $x * (1 - $s_x), $y * (1 - $s_y) ); $this->transform($tm); }
[ "function", "scale", "(", "$", "s_x", ",", "$", "s_y", ",", "$", "x", ",", "$", "y", ")", "{", "$", "y", "=", "$", "this", "->", "currentPageSize", "[", "\"height\"", "]", "-", "$", "y", ";", "$", "tm", "=", "array", "(", "$", "s_x", ",", "...
scale @param float $s_x scaling factor for width as percent @param float $s_y scaling factor for height as percent @param float $x Origin abscissa @param float $y Origin ordinate
[ "scale" ]
75f13c700009be21a1965dc2c5b68a8708c22ba2
https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/lib/Cpdf.php#L3714-L3728
train
Scales the page by the given values
[ 30522, 3853, 4094, 1006, 1002, 1055, 1035, 1060, 1010, 1002, 1055, 1035, 1061, 1010, 1002, 1060, 1010, 1002, 1061, 1007, 1063, 1002, 1061, 1027, 1002, 2023, 1011, 1028, 2783, 13704, 5332, 4371, 1031, 1000, 4578, 1000, 1033, 1011, 1002, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Serializer/Normalizer/ObjectNormalizer.php
ObjectNormalizer.getAttributeValue
protected function getAttributeValue($object, $attribute, $format = null, array $context = []) { $cacheKey = \get_class($object); if (!\array_key_exists($cacheKey, $this->discriminatorCache)) { $this->discriminatorCache[$cacheKey] = null; if (null !== $this->classDiscriminatorResolver) { $mapping = $this->classDiscriminatorResolver->getMappingForMappedObject($object); $this->discriminatorCache[$cacheKey] = null === $mapping ? null : $mapping->getTypeProperty(); } } return $attribute === $this->discriminatorCache[$cacheKey] ? $this->classDiscriminatorResolver->getTypeForMappedObject($object) : $this->propertyAccessor->getValue($object, $attribute); }
php
protected function getAttributeValue($object, $attribute, $format = null, array $context = []) { $cacheKey = \get_class($object); if (!\array_key_exists($cacheKey, $this->discriminatorCache)) { $this->discriminatorCache[$cacheKey] = null; if (null !== $this->classDiscriminatorResolver) { $mapping = $this->classDiscriminatorResolver->getMappingForMappedObject($object); $this->discriminatorCache[$cacheKey] = null === $mapping ? null : $mapping->getTypeProperty(); } } return $attribute === $this->discriminatorCache[$cacheKey] ? $this->classDiscriminatorResolver->getTypeForMappedObject($object) : $this->propertyAccessor->getValue($object, $attribute); }
[ "protected", "function", "getAttributeValue", "(", "$", "object", ",", "$", "attribute", ",", "$", "format", "=", "null", ",", "array", "$", "context", "=", "[", "]", ")", "{", "$", "cacheKey", "=", "\\", "get_class", "(", "$", "object", ")", ";", "i...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Serializer/Normalizer/ObjectNormalizer.php#L121-L133
train
Get the value of an attribute of an object
[ 30522, 5123, 3853, 2131, 19321, 3089, 8569, 2618, 10175, 5657, 1006, 1002, 4874, 1010, 1002, 17961, 1010, 1002, 4289, 1027, 19701, 1010, 9140, 1002, 6123, 1027, 1031, 1033, 1007, 1063, 1002, 30524, 5860, 20026, 23207, 3540, 5403, 1031, 1002...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Console/Helper/Table.php
Table.renderRowSeparator
private function renderRowSeparator(int $type = self::SEPARATOR_MID, string $title = null, string $titleFormat = null) { if (0 === $count = $this->numberOfColumns) { return; } $borders = $this->style->getBorderChars(); if (!$borders[0] && !$borders[2] && !$this->style->getCrossingChar()) { return; } $crossings = $this->style->getCrossingChars(); if (self::SEPARATOR_MID === $type) { list($horizontal, $leftChar, $midChar, $rightChar) = [$borders[2], $crossings[8], $crossings[0], $crossings[4]]; } elseif (self::SEPARATOR_TOP === $type) { list($horizontal, $leftChar, $midChar, $rightChar) = [$borders[0], $crossings[1], $crossings[2], $crossings[3]]; } elseif (self::SEPARATOR_TOP_BOTTOM === $type) { list($horizontal, $leftChar, $midChar, $rightChar) = [$borders[0], $crossings[9], $crossings[10], $crossings[11]]; } else { list($horizontal, $leftChar, $midChar, $rightChar) = [$borders[0], $crossings[7], $crossings[6], $crossings[5]]; } $markup = $leftChar; for ($column = 0; $column < $count; ++$column) { $markup .= str_repeat($horizontal, $this->effectiveColumnWidths[$column]); $markup .= $column === $count - 1 ? $rightChar : $midChar; } if (null !== $title) { $titleLength = Helper::strlenWithoutDecoration($formatter = $this->output->getFormatter(), $formattedTitle = sprintf($titleFormat, $title)); $markupLength = Helper::strlen($markup); if ($titleLength > $limit = $markupLength - 4) { $titleLength = $limit; $formatLength = Helper::strlenWithoutDecoration($formatter, sprintf($titleFormat, '')); $formattedTitle = sprintf($titleFormat, Helper::substr($title, 0, $limit - $formatLength - 3).'...'); } $titleStart = ($markupLength - $titleLength) / 2; if (false === mb_detect_encoding($markup, null, true)) { $markup = substr_replace($markup, $formattedTitle, $titleStart, $titleLength); } else { $markup = mb_substr($markup, 0, $titleStart).$formattedTitle.mb_substr($markup, $titleStart + $titleLength); } } $this->output->writeln(sprintf($this->style->getBorderFormat(), $markup)); }
php
private function renderRowSeparator(int $type = self::SEPARATOR_MID, string $title = null, string $titleFormat = null) { if (0 === $count = $this->numberOfColumns) { return; } $borders = $this->style->getBorderChars(); if (!$borders[0] && !$borders[2] && !$this->style->getCrossingChar()) { return; } $crossings = $this->style->getCrossingChars(); if (self::SEPARATOR_MID === $type) { list($horizontal, $leftChar, $midChar, $rightChar) = [$borders[2], $crossings[8], $crossings[0], $crossings[4]]; } elseif (self::SEPARATOR_TOP === $type) { list($horizontal, $leftChar, $midChar, $rightChar) = [$borders[0], $crossings[1], $crossings[2], $crossings[3]]; } elseif (self::SEPARATOR_TOP_BOTTOM === $type) { list($horizontal, $leftChar, $midChar, $rightChar) = [$borders[0], $crossings[9], $crossings[10], $crossings[11]]; } else { list($horizontal, $leftChar, $midChar, $rightChar) = [$borders[0], $crossings[7], $crossings[6], $crossings[5]]; } $markup = $leftChar; for ($column = 0; $column < $count; ++$column) { $markup .= str_repeat($horizontal, $this->effectiveColumnWidths[$column]); $markup .= $column === $count - 1 ? $rightChar : $midChar; } if (null !== $title) { $titleLength = Helper::strlenWithoutDecoration($formatter = $this->output->getFormatter(), $formattedTitle = sprintf($titleFormat, $title)); $markupLength = Helper::strlen($markup); if ($titleLength > $limit = $markupLength - 4) { $titleLength = $limit; $formatLength = Helper::strlenWithoutDecoration($formatter, sprintf($titleFormat, '')); $formattedTitle = sprintf($titleFormat, Helper::substr($title, 0, $limit - $formatLength - 3).'...'); } $titleStart = ($markupLength - $titleLength) / 2; if (false === mb_detect_encoding($markup, null, true)) { $markup = substr_replace($markup, $formattedTitle, $titleStart, $titleLength); } else { $markup = mb_substr($markup, 0, $titleStart).$formattedTitle.mb_substr($markup, $titleStart + $titleLength); } } $this->output->writeln(sprintf($this->style->getBorderFormat(), $markup)); }
[ "private", "function", "renderRowSeparator", "(", "int", "$", "type", "=", "self", "::", "SEPARATOR_MID", ",", "string", "$", "title", "=", "null", ",", "string", "$", "titleFormat", "=", "null", ")", "{", "if", "(", "0", "===", "$", "count", "=", "$",...
Renders horizontal header separator. Example: +-----+-----------+-------+
[ "Renders", "horizontal", "header", "separator", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Console/Helper/Table.php#L391-L437
train
Render row separator
[ 30522, 2797, 3853, 17552, 10524, 3366, 28689, 4263, 1006, 20014, 1002, 2828, 1027, 2969, 1024, 1024, 19802, 25879, 2953, 1035, 3054, 1010, 5164, 1002, 2516, 1027, 19701, 1010, 5164, 1002, 2516, 14192, 4017, 1027, 19701, 1007, 1063, 2065, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
dompdf/dompdf
src/Css/Style.php
Style.get_outline_width
function get_outline_width() { $style = $this->__get("outline_style"); return $style !== "none" && $style !== "hidden" ? $this->length_in_pt($this->_props["outline_width"]) : 0; }
php
function get_outline_width() { $style = $this->__get("outline_style"); return $style !== "none" && $style !== "hidden" ? $this->length_in_pt($this->_props["outline_width"]) : 0; }
[ "function", "get_outline_width", "(", ")", "{", "$", "style", "=", "$", "this", "->", "__get", "(", "\"outline_style\"", ")", ";", "return", "$", "style", "!==", "\"none\"", "&&", "$", "style", "!==", "\"hidden\"", "?", "$", "this", "->", "length_in_pt", ...
#@+ Returns the outline width, as it is currently stored @return float|string
[ "#" ]
75f13c700009be21a1965dc2c5b68a8708c22ba2
https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/src/Css/Style.php#L1539-L1543
train
Returns the outline width in pt
[ 30522, 3853, 2131, 1035, 12685, 1035, 9381, 1006, 1007, 1063, 1002, 2806, 1027, 1002, 2023, 1011, 1028, 1035, 1035, 2131, 1006, 1000, 12685, 1035, 2806, 1000, 1007, 1025, 2709, 1002, 2806, 999, 1027, 1027, 1000, 3904, 1000, 1004, 1004, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Validation/DatabasePresenceVerifier.php
DatabasePresenceVerifier.getMultiCount
public function getMultiCount($collection, $column, array $values, array $extra = []) { $query = $this->table($collection)->whereIn($column, $values); return $this->addConditions($query, $extra)->distinct()->count($column); }
php
public function getMultiCount($collection, $column, array $values, array $extra = []) { $query = $this->table($collection)->whereIn($column, $values); return $this->addConditions($query, $extra)->distinct()->count($column); }
[ "public", "function", "getMultiCount", "(", "$", "collection", ",", "$", "column", ",", "array", "$", "values", ",", "array", "$", "extra", "=", "[", "]", ")", "{", "$", "query", "=", "$", "this", "->", "table", "(", "$", "collection", ")", "->", "...
Count the number of objects in a collection with the given values. @param string $collection @param string $column @param array $values @param array $extra @return int
[ "Count", "the", "number", "of", "objects", "in", "a", "collection", "with", "the", "given", "values", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Validation/DatabasePresenceVerifier.php#L67-L72
train
Get Multi Count
[ 30522, 2270, 3853, 2131, 12274, 7096, 11261, 16671, 1006, 1002, 3074, 1010, 1002, 5930, 1010, 9140, 1002, 5300, 1010, 9140, 1002, 4469, 1027, 1031, 1033, 1007, 1063, 1002, 23032, 1027, 1002, 2023, 1011, 1028, 2795, 1006, 1002, 3074, 1007, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Foundation/Exceptions/Handler.php
Handler.toIlluminateResponse
protected function toIlluminateResponse($response, Exception $e) { if ($response instanceof SymfonyRedirectResponse) { $response = new RedirectResponse( $response->getTargetUrl(), $response->getStatusCode(), $response->headers->all() ); } else { $response = new Response( $response->getContent(), $response->getStatusCode(), $response->headers->all() ); } return $response->withException($e); }
php
protected function toIlluminateResponse($response, Exception $e) { if ($response instanceof SymfonyRedirectResponse) { $response = new RedirectResponse( $response->getTargetUrl(), $response->getStatusCode(), $response->headers->all() ); } else { $response = new Response( $response->getContent(), $response->getStatusCode(), $response->headers->all() ); } return $response->withException($e); }
[ "protected", "function", "toIlluminateResponse", "(", "$", "response", ",", "Exception", "$", "e", ")", "{", "if", "(", "$", "response", "instanceof", "SymfonyRedirectResponse", ")", "{", "$", "response", "=", "new", "RedirectResponse", "(", "$", "response", "...
Map the given exception into an Illuminate response. @param \Symfony\Component\HttpFoundation\Response $response @param \Exception $e @return \Illuminate\Http\Response
[ "Map", "the", "given", "exception", "into", "an", "Illuminate", "response", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Foundation/Exceptions/Handler.php#L407-L420
train
Converts an exception into an Illuminate response
[ 30522, 5123, 3853, 2000, 8591, 12717, 12556, 6072, 26029, 3366, 1006, 1002, 3433, 1010, 6453, 1002, 1041, 1007, 1063, 2065, 1006, 1002, 3433, 6013, 11253, 25353, 2213, 14876, 4890, 5596, 7442, 6593, 6072, 26029, 3366, 1007, 1063, 1002, 3433...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/Transitions/API.php
API.queryExternalReferrers
protected function queryExternalReferrers($idaction, $actionType, $logAggregator, $limitBeforeGrouping = false) { $rankingQuery = new RankingQuery($limitBeforeGrouping ? $limitBeforeGrouping : $this->limitBeforeGrouping); // we generate a single column that contains the interesting data for each referrer. // the reason we cannot group by referer_* becomes clear when we look at search engine keywords. // referer_url contains the url from the search engine, referer_keyword the keyword we want to // group by. when we group by both, we don't get a single column for the keyword but instead // one column per keyword + search engine url. this way, we could not get the top keywords using // the ranking query. $dimensions = array('referrer_data', 'referer_type'); $rankingQuery->addLabelColumn('referrer_data'); $selects = array( 'CASE log_visit.referer_type WHEN ' . Common::REFERRER_TYPE_DIRECT_ENTRY . ' THEN \'\' WHEN ' . Common::REFERRER_TYPE_SEARCH_ENGINE . ' THEN log_visit.referer_keyword WHEN ' . Common::REFERRER_TYPE_SOCIAL_NETWORK . ' THEN log_visit.referer_name WHEN ' . Common::REFERRER_TYPE_WEBSITE . ' THEN log_visit.referer_url WHEN ' . Common::REFERRER_TYPE_CAMPAIGN . ' THEN CONCAT(log_visit.referer_name, \' \', log_visit.referer_keyword) END AS `referrer_data`'); // get one limited group per referrer type $rankingQuery->partitionResultIntoMultipleGroups('referer_type', array( Common::REFERRER_TYPE_DIRECT_ENTRY, Common::REFERRER_TYPE_SEARCH_ENGINE, Common::REFERRER_TYPE_SOCIAL_NETWORK, Common::REFERRER_TYPE_WEBSITE, Common::REFERRER_TYPE_CAMPAIGN )); $type = $this->getColumnTypeSuffix($actionType); $where = 'visit_entry_idaction_' . $type . ' = ' . intval($idaction); $metrics = array(Metrics::INDEX_NB_VISITS); $data = $logAggregator->queryVisitsByDimension($dimensions, $where, $selects, $metrics, $rankingQuery); $referrerData = array(); $referrerSubData = array(); foreach ($data as $referrerType => &$subData) { $referrerData[$referrerType] = array(Metrics::INDEX_NB_VISITS => 0); if ($referrerType != Common::REFERRER_TYPE_DIRECT_ENTRY) { $referrerSubData[$referrerType] = array(); } foreach ($subData as &$row) { if ($referrerType == Common::REFERRER_TYPE_SEARCH_ENGINE && empty($row['referrer_data'])) { $row['referrer_data'] = \Piwik\Plugins\Referrers\API::LABEL_KEYWORD_NOT_DEFINED; } $referrerData[$referrerType][Metrics::INDEX_NB_VISITS] += $row[Metrics::INDEX_NB_VISITS]; $label = $row['referrer_data']; if ($label) { $referrerSubData[$referrerType][$label] = array( Metrics::INDEX_NB_VISITS => $row[Metrics::INDEX_NB_VISITS] ); } } } $array = new DataArray($referrerData, $referrerSubData); return $array->asDataTable(); }
php
protected function queryExternalReferrers($idaction, $actionType, $logAggregator, $limitBeforeGrouping = false) { $rankingQuery = new RankingQuery($limitBeforeGrouping ? $limitBeforeGrouping : $this->limitBeforeGrouping); // we generate a single column that contains the interesting data for each referrer. // the reason we cannot group by referer_* becomes clear when we look at search engine keywords. // referer_url contains the url from the search engine, referer_keyword the keyword we want to // group by. when we group by both, we don't get a single column for the keyword but instead // one column per keyword + search engine url. this way, we could not get the top keywords using // the ranking query. $dimensions = array('referrer_data', 'referer_type'); $rankingQuery->addLabelColumn('referrer_data'); $selects = array( 'CASE log_visit.referer_type WHEN ' . Common::REFERRER_TYPE_DIRECT_ENTRY . ' THEN \'\' WHEN ' . Common::REFERRER_TYPE_SEARCH_ENGINE . ' THEN log_visit.referer_keyword WHEN ' . Common::REFERRER_TYPE_SOCIAL_NETWORK . ' THEN log_visit.referer_name WHEN ' . Common::REFERRER_TYPE_WEBSITE . ' THEN log_visit.referer_url WHEN ' . Common::REFERRER_TYPE_CAMPAIGN . ' THEN CONCAT(log_visit.referer_name, \' \', log_visit.referer_keyword) END AS `referrer_data`'); // get one limited group per referrer type $rankingQuery->partitionResultIntoMultipleGroups('referer_type', array( Common::REFERRER_TYPE_DIRECT_ENTRY, Common::REFERRER_TYPE_SEARCH_ENGINE, Common::REFERRER_TYPE_SOCIAL_NETWORK, Common::REFERRER_TYPE_WEBSITE, Common::REFERRER_TYPE_CAMPAIGN )); $type = $this->getColumnTypeSuffix($actionType); $where = 'visit_entry_idaction_' . $type . ' = ' . intval($idaction); $metrics = array(Metrics::INDEX_NB_VISITS); $data = $logAggregator->queryVisitsByDimension($dimensions, $where, $selects, $metrics, $rankingQuery); $referrerData = array(); $referrerSubData = array(); foreach ($data as $referrerType => &$subData) { $referrerData[$referrerType] = array(Metrics::INDEX_NB_VISITS => 0); if ($referrerType != Common::REFERRER_TYPE_DIRECT_ENTRY) { $referrerSubData[$referrerType] = array(); } foreach ($subData as &$row) { if ($referrerType == Common::REFERRER_TYPE_SEARCH_ENGINE && empty($row['referrer_data'])) { $row['referrer_data'] = \Piwik\Plugins\Referrers\API::LABEL_KEYWORD_NOT_DEFINED; } $referrerData[$referrerType][Metrics::INDEX_NB_VISITS] += $row[Metrics::INDEX_NB_VISITS]; $label = $row['referrer_data']; if ($label) { $referrerSubData[$referrerType][$label] = array( Metrics::INDEX_NB_VISITS => $row[Metrics::INDEX_NB_VISITS] ); } } } $array = new DataArray($referrerData, $referrerSubData); return $array->asDataTable(); }
[ "protected", "function", "queryExternalReferrers", "(", "$", "idaction", ",", "$", "actionType", ",", "$", "logAggregator", ",", "$", "limitBeforeGrouping", "=", "false", ")", "{", "$", "rankingQuery", "=", "new", "RankingQuery", "(", "$", "limitBeforeGrouping", ...
Get information about external referrers (i.e. search engines, websites & campaigns) @param $idaction @param $actionType @param Logaggregator $logAggregator @param $limitBeforeGrouping @return DataTable
[ "Get", "information", "about", "external", "referrers", "(", "i", ".", "e", ".", "search", "engines", "websites", "&", "campaigns", ")" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Transitions/API.php#L301-L364
train
Query external referrer types
[ 30522, 5123, 3853, 23032, 10288, 16451, 2389, 2890, 7512, 14544, 2015, 1006, 1002, 16096, 7542, 1010, 1002, 2895, 13874, 1010, 1002, 8833, 8490, 17603, 20697, 2953, 1010, 1002, 5787, 4783, 29278, 13910, 22107, 2075, 1027, 6270, 1007, 1063, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/GPM/Installer.php
Installer.uninstall
public static function uninstall($path, $options = []) { $options = array_merge(self::$options, $options); if (!self::isValidDestination($path, $options['exclude_checks']) ) { return false; } $installer_file_folder = $path; $is_install = false; $installer = self::loadInstaller($installer_file_folder, $is_install); if ($installer && method_exists($installer, 'preUninstall')) { $method_result = $installer::preUninstall(); if ($method_result !== true) { self::$error = 'An error occurred'; if (is_string($method_result)) { self::$error = $method_result; } return false; } } $result = Folder::delete($path); self::$message = ''; if ($result && $installer && method_exists($installer, 'postUninstall')) { self::$message = $installer::postUninstall(); } return $result; }
php
public static function uninstall($path, $options = []) { $options = array_merge(self::$options, $options); if (!self::isValidDestination($path, $options['exclude_checks']) ) { return false; } $installer_file_folder = $path; $is_install = false; $installer = self::loadInstaller($installer_file_folder, $is_install); if ($installer && method_exists($installer, 'preUninstall')) { $method_result = $installer::preUninstall(); if ($method_result !== true) { self::$error = 'An error occurred'; if (is_string($method_result)) { self::$error = $method_result; } return false; } } $result = Folder::delete($path); self::$message = ''; if ($result && $installer && method_exists($installer, 'postUninstall')) { self::$message = $installer::postUninstall(); } return $result; }
[ "public", "static", "function", "uninstall", "(", "$", "path", ",", "$", "options", "=", "[", "]", ")", "{", "$", "options", "=", "array_merge", "(", "self", "::", "$", "options", ",", "$", "options", ")", ";", "if", "(", "!", "self", "::", "isVali...
Uninstalls one or more given package @param string $path The slug of the package(s) @param array $options Options to use for uninstalling @return bool True if everything went fine, False otherwise.
[ "Uninstalls", "one", "or", "more", "given", "package" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/GPM/Installer.php#L337-L369
train
Uninstalls a file or folder
[ 30522, 2270, 10763, 3853, 4895, 7076, 9080, 2140, 1006, 1002, 4130, 1010, 1002, 7047, 1027, 1031, 1033, 1007, 1063, 1002, 7047, 1027, 9140, 1035, 13590, 1006, 2969, 1024, 1024, 1002, 30524, 1025, 1065, 1002, 16500, 2121, 1035, 5371, 1035, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
PHPMailer/PHPMailer
src/PHPMailer.php
PHPMailer.smtpConnect
public function smtpConnect($options = null) { if (null === $this->smtp) { $this->smtp = $this->getSMTPInstance(); } //If no options are provided, use whatever is set in the instance if (null === $options) { $options = $this->SMTPOptions; } // Already connected? if ($this->smtp->connected()) { return true; } $this->smtp->setTimeout($this->Timeout); $this->smtp->setDebugLevel($this->SMTPDebug); $this->smtp->setDebugOutput($this->Debugoutput); $this->smtp->setVerp($this->do_verp); $hosts = explode(';', $this->Host); $lastexception = null; foreach ($hosts as $hostentry) { $hostinfo = []; if (!preg_match( '/^((ssl|tls):\/\/)*([a-zA-Z0-9\.-]*|\[[a-fA-F0-9:]+\]):?([0-9]*)$/', trim($hostentry), $hostinfo )) { static::edebug($this->lang('connect_host') . ' ' . $hostentry); // Not a valid host entry continue; } // $hostinfo[2]: optional ssl or tls prefix // $hostinfo[3]: the hostname // $hostinfo[4]: optional port number // The host string prefix can temporarily override the current setting for SMTPSecure // If it's not specified, the default value is used //Check the host name is a valid name or IP address before trying to use it if (!static::isValidHost($hostinfo[3])) { static::edebug($this->lang('connect_host') . ' ' . $hostentry); continue; } $prefix = ''; $secure = $this->SMTPSecure; $tls = ('tls' == $this->SMTPSecure); if ('ssl' == $hostinfo[2] or ('' == $hostinfo[2] and 'ssl' == $this->SMTPSecure)) { $prefix = 'ssl://'; $tls = false; // Can't have SSL and TLS at the same time $secure = 'ssl'; } elseif ('tls' == $hostinfo[2]) { $tls = true; // tls doesn't use a prefix $secure = 'tls'; } //Do we need the OpenSSL extension? $sslext = defined('OPENSSL_ALGO_SHA256'); if ('tls' === $secure or 'ssl' === $secure) { //Check for an OpenSSL constant rather than using extension_loaded, which is sometimes disabled if (!$sslext) { throw new Exception($this->lang('extension_missing') . 'openssl', self::STOP_CRITICAL); } } $host = $hostinfo[3]; $port = $this->Port; $tport = (int) $hostinfo[4]; if ($tport > 0 and $tport < 65536) { $port = $tport; } if ($this->smtp->connect($prefix . $host, $port, $this->Timeout, $options)) { try { if ($this->Helo) { $hello = $this->Helo; } else { $hello = $this->serverHostname(); } $this->smtp->hello($hello); //Automatically enable TLS encryption if: // * it's not disabled // * we have openssl extension // * we are not already using SSL // * the server offers STARTTLS if ($this->SMTPAutoTLS and $sslext and 'ssl' != $secure and $this->smtp->getServerExt('STARTTLS')) { $tls = true; } if ($tls) { if (!$this->smtp->startTLS()) { throw new Exception($this->lang('connect_host')); } // We must resend EHLO after TLS negotiation $this->smtp->hello($hello); } if ($this->SMTPAuth) { if (!$this->smtp->authenticate( $this->Username, $this->Password, $this->AuthType, $this->oauth ) ) { throw new Exception($this->lang('authenticate')); } } return true; } catch (Exception $exc) { $lastexception = $exc; $this->edebug($exc->getMessage()); // We must have connected, but then failed TLS or Auth, so close connection nicely $this->smtp->quit(); } } } // If we get here, all connection attempts have failed, so close connection hard $this->smtp->close(); // As we've caught all exceptions, just report whatever the last one was if ($this->exceptions and null !== $lastexception) { throw $lastexception; } return false; }
php
public function smtpConnect($options = null) { if (null === $this->smtp) { $this->smtp = $this->getSMTPInstance(); } //If no options are provided, use whatever is set in the instance if (null === $options) { $options = $this->SMTPOptions; } // Already connected? if ($this->smtp->connected()) { return true; } $this->smtp->setTimeout($this->Timeout); $this->smtp->setDebugLevel($this->SMTPDebug); $this->smtp->setDebugOutput($this->Debugoutput); $this->smtp->setVerp($this->do_verp); $hosts = explode(';', $this->Host); $lastexception = null; foreach ($hosts as $hostentry) { $hostinfo = []; if (!preg_match( '/^((ssl|tls):\/\/)*([a-zA-Z0-9\.-]*|\[[a-fA-F0-9:]+\]):?([0-9]*)$/', trim($hostentry), $hostinfo )) { static::edebug($this->lang('connect_host') . ' ' . $hostentry); // Not a valid host entry continue; } // $hostinfo[2]: optional ssl or tls prefix // $hostinfo[3]: the hostname // $hostinfo[4]: optional port number // The host string prefix can temporarily override the current setting for SMTPSecure // If it's not specified, the default value is used //Check the host name is a valid name or IP address before trying to use it if (!static::isValidHost($hostinfo[3])) { static::edebug($this->lang('connect_host') . ' ' . $hostentry); continue; } $prefix = ''; $secure = $this->SMTPSecure; $tls = ('tls' == $this->SMTPSecure); if ('ssl' == $hostinfo[2] or ('' == $hostinfo[2] and 'ssl' == $this->SMTPSecure)) { $prefix = 'ssl://'; $tls = false; // Can't have SSL and TLS at the same time $secure = 'ssl'; } elseif ('tls' == $hostinfo[2]) { $tls = true; // tls doesn't use a prefix $secure = 'tls'; } //Do we need the OpenSSL extension? $sslext = defined('OPENSSL_ALGO_SHA256'); if ('tls' === $secure or 'ssl' === $secure) { //Check for an OpenSSL constant rather than using extension_loaded, which is sometimes disabled if (!$sslext) { throw new Exception($this->lang('extension_missing') . 'openssl', self::STOP_CRITICAL); } } $host = $hostinfo[3]; $port = $this->Port; $tport = (int) $hostinfo[4]; if ($tport > 0 and $tport < 65536) { $port = $tport; } if ($this->smtp->connect($prefix . $host, $port, $this->Timeout, $options)) { try { if ($this->Helo) { $hello = $this->Helo; } else { $hello = $this->serverHostname(); } $this->smtp->hello($hello); //Automatically enable TLS encryption if: // * it's not disabled // * we have openssl extension // * we are not already using SSL // * the server offers STARTTLS if ($this->SMTPAutoTLS and $sslext and 'ssl' != $secure and $this->smtp->getServerExt('STARTTLS')) { $tls = true; } if ($tls) { if (!$this->smtp->startTLS()) { throw new Exception($this->lang('connect_host')); } // We must resend EHLO after TLS negotiation $this->smtp->hello($hello); } if ($this->SMTPAuth) { if (!$this->smtp->authenticate( $this->Username, $this->Password, $this->AuthType, $this->oauth ) ) { throw new Exception($this->lang('authenticate')); } } return true; } catch (Exception $exc) { $lastexception = $exc; $this->edebug($exc->getMessage()); // We must have connected, but then failed TLS or Auth, so close connection nicely $this->smtp->quit(); } } } // If we get here, all connection attempts have failed, so close connection hard $this->smtp->close(); // As we've caught all exceptions, just report whatever the last one was if ($this->exceptions and null !== $lastexception) { throw $lastexception; } return false; }
[ "public", "function", "smtpConnect", "(", "$", "options", "=", "null", ")", "{", "if", "(", "null", "===", "$", "this", "->", "smtp", ")", "{", "$", "this", "->", "smtp", "=", "$", "this", "->", "getSMTPInstance", "(", ")", ";", "}", "//If no options...
Initiate a connection to an SMTP server. Returns false if the operation failed. @param array $options An array of options compatible with stream_context_create() @throws Exception @uses \PHPMailer\PHPMailer\SMTP @return bool
[ "Initiate", "a", "connection", "to", "an", "SMTP", "server", ".", "Returns", "false", "if", "the", "operation", "failed", "." ]
3d7132341659a8a201adbc3ba11b1e202ee2857c
https://github.com/PHPMailer/PHPMailer/blob/3d7132341659a8a201adbc3ba11b1e202ee2857c/src/PHPMailer.php#L1881-L2004
train
Establishes a connection to the SMTP server
[ 30522, 2270, 3853, 15488, 25856, 8663, 2638, 6593, 1006, 1002, 7047, 1027, 19701, 1007, 1063, 2065, 1006, 19701, 1027, 1027, 1027, 1002, 2023, 1011, 1028, 15488, 25856, 1007, 1063, 1002, 2023, 1011, 1028, 15488, 25856, 1027, 1002, 2023, 101...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/Data/Validation.php
Validation.typeToggle
public static function typeToggle($value, array $params, array $field) { if (\is_bool($value)) { $value = (int)$value; } return self::typeArray((array) $value, $params, $field); }
php
public static function typeToggle($value, array $params, array $field) { if (\is_bool($value)) { $value = (int)$value; } return self::typeArray((array) $value, $params, $field); }
[ "public", "static", "function", "typeToggle", "(", "$", "value", ",", "array", "$", "params", ",", "array", "$", "field", ")", "{", "if", "(", "\\", "is_bool", "(", "$", "value", ")", ")", "{", "$", "value", "=", "(", "int", ")", "$", "value", ";...
Custom input: toggle @param mixed $value Value to be validated. @param array $params Validation parameters. @param array $field Blueprint for the field. @return bool True if validation succeeded.
[ "Custom", "input", ":", "toggle" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Data/Validation.php#L290-L297
train
Type Toggle value
[ 30522, 2270, 10763, 3853, 2828, 3406, 24679, 1006, 1002, 3643, 1010, 9140, 1002, 11498, 5244, 1010, 9140, 1002, 2492, 1007, 1063, 2065, 1006, 1032, 2003, 1035, 22017, 2140, 1006, 1002, 3643, 1007, 1007, 1063, 1002, 3643, 1027, 1006, 20014, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Cookie/CookieJar.php
CookieJar.queue
public function queue(...$parameters) { if (head($parameters) instanceof Cookie) { $cookie = head($parameters); } else { $cookie = call_user_func_array([$this, 'make'], $parameters); } $this->queued[$cookie->getName()] = $cookie; }
php
public function queue(...$parameters) { if (head($parameters) instanceof Cookie) { $cookie = head($parameters); } else { $cookie = call_user_func_array([$this, 'make'], $parameters); } $this->queued[$cookie->getName()] = $cookie; }
[ "public", "function", "queue", "(", "...", "$", "parameters", ")", "{", "if", "(", "head", "(", "$", "parameters", ")", "instanceof", "Cookie", ")", "{", "$", "cookie", "=", "head", "(", "$", "parameters", ")", ";", "}", "else", "{", "$", "cookie", ...
Queue a cookie to send with the next response. @param array $parameters @return void
[ "Queue", "a", "cookie", "to", "send", "with", "the", "next", "response", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Cookie/CookieJar.php#L133-L142
train
Queues a cookie for later use
[ 30522, 2270, 3853, 24240, 1006, 1012, 1012, 1012, 1002, 11709, 1007, 1063, 2065, 1006, 2132, 1006, 1002, 11709, 1007, 6013, 11253, 17387, 1007, 1063, 1002, 17387, 1027, 2132, 1006, 1002, 11709, 1007, 1025, 1065, 2842, 1063, 1002, 17387, 102...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...