repo
stringclasses
21 values
path
stringlengths
10
105
func_name
stringlengths
6
64
original_string
stringlengths
105
15.6k
language
stringclasses
1 value
code
stringlengths
105
15.6k
code_tokens
listlengths
29
2.15k
docstring
stringlengths
11
2.85k
docstring_tokens
listlengths
1
290
sha
stringclasses
21 values
url
stringlengths
100
194
partition
stringclasses
1 value
summary
stringlengths
8
319
input_ids
listlengths
502
502
token_type_ids
listlengths
502
502
attention_mask
listlengths
502
502
labels
listlengths
502
502
symfony/symfony
src/Symfony/Component/OptionsResolver/OptionsResolver.php
OptionsResolver.setAllowedValues
public function setAllowedValues($option, $allowedValues) { if ($this->locked) { throw new AccessException('Allowed values cannot be set from a lazy option or normalizer.'); } if (!isset($this->defined[$option])) { throw new UndefinedOptionsException(sprintf('The option "%s" does not exist. Defined options are: "%s".', $option, implode('", "', array_keys($this->defined)))); } $this->allowedValues[$option] = \is_array($allowedValues) ? $allowedValues : [$allowedValues]; // Make sure the option is processed unset($this->resolved[$option]); return $this; }
php
public function setAllowedValues($option, $allowedValues) { if ($this->locked) { throw new AccessException('Allowed values cannot be set from a lazy option or normalizer.'); } if (!isset($this->defined[$option])) { throw new UndefinedOptionsException(sprintf('The option "%s" does not exist. Defined options are: "%s".', $option, implode('", "', array_keys($this->defined)))); } $this->allowedValues[$option] = \is_array($allowedValues) ? $allowedValues : [$allowedValues]; // Make sure the option is processed unset($this->resolved[$option]); return $this; }
[ "public", "function", "setAllowedValues", "(", "$", "option", ",", "$", "allowedValues", ")", "{", "if", "(", "$", "this", "->", "locked", ")", "{", "throw", "new", "AccessException", "(", "'Allowed values cannot be set from a lazy option or normalizer.'", ")", ";",...
Sets allowed values for an option. Instead of passing values, you may also pass a closures with the following signature: function ($value) { // return true or false } The closure receives the value as argument and should return true to accept the value and false to reject the value. @param string $option The option name @param mixed $allowedValues One or more acceptable values/closures @return $this @throws UndefinedOptionsException If the option is undefined @throws AccessException If called from a lazy option or normalizer
[ "Sets", "allowed", "values", "for", "an", "option", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/OptionsResolver/OptionsResolver.php#L565-L581
train
Sets allowed values for an option
[ 30522, 2270, 3853, 2275, 8095, 15096, 10175, 15808, 1006, 1002, 5724, 1010, 1002, 3039, 10175, 15808, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 5299, 1007, 1063, 5466, 2047, 3229, 10288, 24422, 1006, 1005, 3039, 5300, 3685, 2022, 2275...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Db2.php
Zend_Db_Adapter_Db2.lastInsertId
public function lastInsertId($tableName = null, $primaryKey = null, $idType = null) { $this->_connect(); if ($this->_isI5) { return (string) $this->_i5LastInsertId($tableName, $idType); } if ($tableName !== null) { $sequenceName = $tableName; if ($primaryKey) { $sequenceName .= "_$primaryKey"; } $sequenceName .= '_seq'; return $this->lastSequenceId($sequenceName); } $sql = 'SELECT IDENTITY_VAL_LOCAL() AS VAL FROM SYSIBM.SYSDUMMY1'; $value = $this->fetchOne($sql); return (string) $value; }
php
public function lastInsertId($tableName = null, $primaryKey = null, $idType = null) { $this->_connect(); if ($this->_isI5) { return (string) $this->_i5LastInsertId($tableName, $idType); } if ($tableName !== null) { $sequenceName = $tableName; if ($primaryKey) { $sequenceName .= "_$primaryKey"; } $sequenceName .= '_seq'; return $this->lastSequenceId($sequenceName); } $sql = 'SELECT IDENTITY_VAL_LOCAL() AS VAL FROM SYSIBM.SYSDUMMY1'; $value = $this->fetchOne($sql); return (string) $value; }
[ "public", "function", "lastInsertId", "(", "$", "tableName", "=", "null", ",", "$", "primaryKey", "=", "null", ",", "$", "idType", "=", "null", ")", "{", "$", "this", "->", "_connect", "(", ")", ";", "if", "(", "$", "this", "->", "_isI5", ")", "{",...
Gets the last ID generated automatically by an IDENTITY/AUTOINCREMENT column. As a convention, on RDBMS brands that support sequences (e.g. Oracle, PostgreSQL, DB2), this method forms the name of a sequence from the arguments and returns the last id generated by that sequence. On RDBMS brands that support IDENTITY/AUTOINCREMENT columns, this method returns the last value generated for such a column, and the table name argument is disregarded. The IDENTITY_VAL_LOCAL() function gives the last generated identity value in the current process, even if it was for a GENERATED column. @param string $tableName OPTIONAL @param string $primaryKey OPTIONAL @param string $idType OPTIONAL used for i5 platform to define sequence/idenity unique value @return string
[ "Gets", "the", "last", "ID", "generated", "automatically", "by", "an", "IDENTITY", "/", "AUTOINCREMENT", "column", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Adapter/Db2.php#L551-L571
train
Return last inserted id
[ 30522, 2270, 3853, 2197, 7076, 8743, 3593, 1006, 1002, 2795, 18442, 1027, 19701, 1010, 1002, 3078, 14839, 1027, 19701, 1010, 1002, 8909, 13874, 1027, 19701, 1007, 1063, 1002, 2023, 1011, 1028, 1035, 7532, 1006, 1007, 1025, 2065, 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...
octobercms/october
modules/cms/classes/Controller.php
Controller.renderContent
public function renderContent($name, $parameters = []) { /** * @event cms.page.beforeRenderContent * Provides an oportunity to manipulate the name of the content file being rendered before it renders * * Example usage: * * Event::listen('cms.page.beforeRenderContent', function ((\Cms\Classes\Controller) $controller, (string) $contentName) { * return "path/to/overriding/location/" . $contentName; * }); * * Or * * $CmsController->bindEvent('page.beforeRenderContent', function ((string) $contentName) { * return "path/to/overriding/location/" . $contentName; * }); * */ if ($event = $this->fireSystemEvent('cms.page.beforeRenderContent', [$name])) { $content = $event; } /* * Load content from theme */ elseif (($content = Content::loadCached($this->theme, $name)) === null) { throw new CmsException(Lang::get('cms::lang.content.not_found_name', ['name'=>$name])); } $fileContent = $content->parsedMarkup; /* * Inject global view variables */ $globalVars = ViewHelper::getGlobalVars(); if (!empty($globalVars)) { $parameters = (array) $parameters + $globalVars; } /* * Parse basic template variables */ if (!empty($parameters)) { $fileContent = TextParser::parse($fileContent, $parameters); } /** * @event cms.page.renderContent * Provides an oportunity to manipulate the output of a content file after being rendered * * Example usage: * * Event::listen('cms.page.renderContent', function ((\Cms\Classes\Controller) $controller, (string) $contentName, (string) &$fileContent) { * return "Overriding content"; * }); * * Or * * $CmsController->bindEvent('page.renderContent', function ((string) $contentName, (string) &$fileContent) { * return "Overriding content"; * }); * */ if ($event = $this->fireSystemEvent('cms.page.renderContent', [$name, &$fileContent])) { return $event; } return $fileContent; }
php
public function renderContent($name, $parameters = []) { /** * @event cms.page.beforeRenderContent * Provides an oportunity to manipulate the name of the content file being rendered before it renders * * Example usage: * * Event::listen('cms.page.beforeRenderContent', function ((\Cms\Classes\Controller) $controller, (string) $contentName) { * return "path/to/overriding/location/" . $contentName; * }); * * Or * * $CmsController->bindEvent('page.beforeRenderContent', function ((string) $contentName) { * return "path/to/overriding/location/" . $contentName; * }); * */ if ($event = $this->fireSystemEvent('cms.page.beforeRenderContent', [$name])) { $content = $event; } /* * Load content from theme */ elseif (($content = Content::loadCached($this->theme, $name)) === null) { throw new CmsException(Lang::get('cms::lang.content.not_found_name', ['name'=>$name])); } $fileContent = $content->parsedMarkup; /* * Inject global view variables */ $globalVars = ViewHelper::getGlobalVars(); if (!empty($globalVars)) { $parameters = (array) $parameters + $globalVars; } /* * Parse basic template variables */ if (!empty($parameters)) { $fileContent = TextParser::parse($fileContent, $parameters); } /** * @event cms.page.renderContent * Provides an oportunity to manipulate the output of a content file after being rendered * * Example usage: * * Event::listen('cms.page.renderContent', function ((\Cms\Classes\Controller) $controller, (string) $contentName, (string) &$fileContent) { * return "Overriding content"; * }); * * Or * * $CmsController->bindEvent('page.renderContent', function ((string) $contentName, (string) &$fileContent) { * return "Overriding content"; * }); * */ if ($event = $this->fireSystemEvent('cms.page.renderContent', [$name, &$fileContent])) { return $event; } return $fileContent; }
[ "public", "function", "renderContent", "(", "$", "name", ",", "$", "parameters", "=", "[", "]", ")", "{", "/**\n * @event cms.page.beforeRenderContent\n * Provides an oportunity to manipulate the name of the content file being rendered before it renders\n *\n ...
Renders a requested content file. The framework uses this method internally. @param string $name The content view to load. @param array $parameters Parameter variables to pass to the view. @return string
[ "Renders", "a", "requested", "content", "file", ".", "The", "framework", "uses", "this", "method", "internally", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/Controller.php#L1130-L1198
train
Renders content from the content file
[ 30522, 2270, 3853, 17552, 8663, 6528, 2102, 1006, 1002, 2171, 1010, 1002, 11709, 1027, 1031, 1033, 1007, 1063, 1013, 1008, 1008, 1008, 1030, 2724, 4642, 2015, 1012, 3931, 1012, 2077, 7389, 4063, 8663, 6528, 2102, 1008, 3640, 2019, 6728, 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...
symfony/symfony
src/Symfony/Bridge/Twig/Extension/CodeExtension.php
CodeExtension.getFileLink
public function getFileLink($file, $line) { if ($fmt = $this->fileLinkFormat) { return \is_string($fmt) ? strtr($fmt, ['%f' => $file, '%l' => $line]) : $fmt->format($file, $line); } return false; }
php
public function getFileLink($file, $line) { if ($fmt = $this->fileLinkFormat) { return \is_string($fmt) ? strtr($fmt, ['%f' => $file, '%l' => $line]) : $fmt->format($file, $line); } return false; }
[ "public", "function", "getFileLink", "(", "$", "file", ",", "$", "line", ")", "{", "if", "(", "$", "fmt", "=", "$", "this", "->", "fileLinkFormat", ")", "{", "return", "\\", "is_string", "(", "$", "fmt", ")", "?", "strtr", "(", "$", "fmt", ",", "...
Returns the link for a given file/line pair. @param string $file An absolute file path @param int $line The line number @return string|false A link or false
[ "Returns", "the", "link", "for", "a", "given", "file", "/", "line", "pair", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bridge/Twig/Extension/CodeExtension.php#L205-L212
train
Get file link
[ 30522, 2270, 3853, 2131, 8873, 2571, 13767, 1006, 1002, 5371, 1010, 1002, 2240, 1007, 1063, 2065, 1006, 1002, 4718, 2102, 1027, 1002, 2023, 1011, 1028, 5371, 13767, 14192, 4017, 1007, 1063, 2709, 1032, 2003, 1035, 5164, 1006, 1002, 4718, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Db2.php
Zend_Db_Statement_Db2.rowCount
public function rowCount() { if (!$this->_stmt) { return false; } $num = @db2_num_rows($this->_stmt); if ($num === false) { return 0; } return $num; }
php
public function rowCount() { if (!$this->_stmt) { return false; } $num = @db2_num_rows($this->_stmt); if ($num === false) { return 0; } return $num; }
[ "public", "function", "rowCount", "(", ")", "{", "if", "(", "!", "$", "this", "->", "_stmt", ")", "{", "return", "false", ";", "}", "$", "num", "=", "@", "db2_num_rows", "(", "$", "this", "->", "_stmt", ")", ";", "if", "(", "$", "num", "===", "...
Returns the number of rows affected by the execution of the last INSERT, DELETE, or UPDATE statement executed by this statement object. @return int The number of rows affected.
[ "Returns", "the", "number", "of", "rows", "affected", "by", "the", "execution", "of", "the", "last", "INSERT", "DELETE", "or", "UPDATE", "statement", "executed", "by", "this", "statement", "object", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Statement/Db2.php#L320-L333
train
Return the number of rows in the result set
[ 30522, 2270, 3853, 5216, 3597, 16671, 1006, 1007, 1063, 2065, 1006, 999, 1002, 2023, 1011, 1028, 1035, 2358, 20492, 1007, 1063, 2709, 6270, 1025, 1065, 1002, 16371, 2213, 1027, 1030, 16962, 2475, 1035, 16371, 2213, 1035, 10281, 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...
getgrav/grav
system/src/Grav/Common/Page/Page.php
Page.filePath
public function filePath($var = null) { if ($var !== null) { // Filename of the page. $this->name = basename($var); // Folder of the page. $this->folder = basename(dirname($var)); // Path to the page. $this->path = dirname($var, 2); } return $this->path . '/' . $this->folder . '/' . ($this->name ?: ''); }
php
public function filePath($var = null) { if ($var !== null) { // Filename of the page. $this->name = basename($var); // Folder of the page. $this->folder = basename(dirname($var)); // Path to the page. $this->path = dirname($var, 2); } return $this->path . '/' . $this->folder . '/' . ($this->name ?: ''); }
[ "public", "function", "filePath", "(", "$", "var", "=", "null", ")", "{", "if", "(", "$", "var", "!==", "null", ")", "{", "// Filename of the page.", "$", "this", "->", "name", "=", "basename", "(", "$", "var", ")", ";", "// Folder of the page.", "$", ...
Gets and sets the path to the .md file for this Page object. @param string $var the file path @return string|null the file path
[ "Gets", "and", "sets", "the", "path", "to", "the", ".", "md", "file", "for", "this", "Page", "object", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L2091-L2103
train
Return the path to the page file
[ 30522, 2270, 3853, 5371, 15069, 1006, 1002, 13075, 1027, 19701, 1007, 1063, 2065, 1006, 1002, 13075, 999, 1027, 1027, 19701, 1007, 1063, 1013, 1013, 5371, 18442, 1997, 1996, 3931, 1012, 1002, 2023, 1011, 1028, 2171, 1027, 2918, 18442, 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/Taxonomy.php
Taxonomy.addTaxonomy
public function addTaxonomy(PageInterface $page, $page_taxonomy = null) { if (!$page_taxonomy) { $page_taxonomy = $page->taxonomy(); } if (empty($page_taxonomy) || !$page->published()) { return; } /** @var Config $config */ $config = $this->grav['config']; if ($config->get('site.taxonomies')) { foreach ((array)$config->get('site.taxonomies') as $taxonomy) { if (isset($page_taxonomy[$taxonomy])) { foreach ((array)$page_taxonomy[$taxonomy] as $item) { $this->taxonomy_map[$taxonomy][(string)$item][$page->path()] = ['slug' => $page->slug()]; } } } } }
php
public function addTaxonomy(PageInterface $page, $page_taxonomy = null) { if (!$page_taxonomy) { $page_taxonomy = $page->taxonomy(); } if (empty($page_taxonomy) || !$page->published()) { return; } /** @var Config $config */ $config = $this->grav['config']; if ($config->get('site.taxonomies')) { foreach ((array)$config->get('site.taxonomies') as $taxonomy) { if (isset($page_taxonomy[$taxonomy])) { foreach ((array)$page_taxonomy[$taxonomy] as $item) { $this->taxonomy_map[$taxonomy][(string)$item][$page->path()] = ['slug' => $page->slug()]; } } } } }
[ "public", "function", "addTaxonomy", "(", "PageInterface", "$", "page", ",", "$", "page_taxonomy", "=", "null", ")", "{", "if", "(", "!", "$", "page_taxonomy", ")", "{", "$", "page_taxonomy", "=", "$", "page", "->", "taxonomy", "(", ")", ";", "}", "if"...
Takes an individual page and processes the taxonomies configured in its header. It then adds those taxonomies to the map @param PageInterface $page the page to process @param array $page_taxonomy
[ "Takes", "an", "individual", "page", "and", "processes", "the", "taxonomies", "configured", "in", "its", "header", ".", "It", "then", "adds", "those", "taxonomies", "to", "the", "map" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Taxonomy.php#L56-L77
train
Add taxonomy to page
[ 30522, 2270, 3853, 5587, 2696, 22500, 16940, 1006, 3931, 18447, 2121, 12172, 1002, 3931, 1010, 1002, 3931, 1035, 25274, 1027, 19701, 1007, 1063, 2065, 1006, 999, 1002, 3931, 1035, 25274, 1007, 1063, 1002, 3931, 1035, 25274, 1027, 1002, 3931...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/InteractsWithPivotTable.php
InteractsWithPivotTable.newPivot
public function newPivot(array $attributes = [], $exists = false) { $pivot = $this->related->newPivot( $this->parent, $attributes, $this->table, $exists, $this->using ); return $pivot->setPivotKeys($this->foreignPivotKey, $this->relatedPivotKey); }
php
public function newPivot(array $attributes = [], $exists = false) { $pivot = $this->related->newPivot( $this->parent, $attributes, $this->table, $exists, $this->using ); return $pivot->setPivotKeys($this->foreignPivotKey, $this->relatedPivotKey); }
[ "public", "function", "newPivot", "(", "array", "$", "attributes", "=", "[", "]", ",", "$", "exists", "=", "false", ")", "{", "$", "pivot", "=", "$", "this", "->", "related", "->", "newPivot", "(", "$", "this", "->", "parent", ",", "$", "attributes",...
Create a new pivot model instance. @param array $attributes @param bool $exists @return \Illuminate\Database\Eloquent\Relations\Pivot
[ "Create", "a", "new", "pivot", "model", "instance", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Relations/Concerns/InteractsWithPivotTable.php#L464-L471
train
Create a new pivot table
[ 30522, 2270, 3853, 2047, 8197, 22994, 1006, 9140, 1002, 12332, 1027, 1031, 1033, 1010, 1002, 6526, 1027, 6270, 1007, 1063, 1002, 14255, 22994, 1027, 1002, 2023, 1011, 1028, 3141, 1011, 1028, 2047, 8197, 22994, 1006, 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...
laravel/framework
src/Illuminate/Queue/Queue.php
Queue.createStringPayload
protected function createStringPayload($job, $queue, $data) { return $this->withCreatePayloadHooks($queue, [ 'displayName' => is_string($job) ? explode('@', $job)[0] : null, 'job' => $job, 'maxTries' => null, 'delay' => null, 'timeout' => null, 'data' => $data, ]); }
php
protected function createStringPayload($job, $queue, $data) { return $this->withCreatePayloadHooks($queue, [ 'displayName' => is_string($job) ? explode('@', $job)[0] : null, 'job' => $job, 'maxTries' => null, 'delay' => null, 'timeout' => null, 'data' => $data, ]); }
[ "protected", "function", "createStringPayload", "(", "$", "job", ",", "$", "queue", ",", "$", "data", ")", "{", "return", "$", "this", "->", "withCreatePayloadHooks", "(", "$", "queue", ",", "[", "'displayName'", "=>", "is_string", "(", "$", "job", ")", ...
Create a typical, string based queue payload array. @param string $job @param string $queue @param mixed $data @return array
[ "Create", "a", "typical", "string", "based", "queue", "payload", "array", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Queue/Queue.php#L200-L210
train
Create payload for string
[ 30522, 5123, 3853, 9005, 18886, 3070, 4502, 8516, 10441, 2094, 1006, 1002, 3105, 1010, 1002, 24240, 1010, 1002, 2951, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 2007, 16748, 3686, 4502, 8516, 10441, 16425, 14659, 2015, 1006, 1002, 24240, 305...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Manager.php
Manager.activatePlugin
public function activatePlugin($pluginName) { $plugins = $this->pluginList->getActivatedPlugins(); if (in_array($pluginName, $plugins)) { // plugin is already activated return; } if (!$this->isPluginInFilesystem($pluginName)) { throw new \Exception("Plugin '$pluginName' cannot be found in the filesystem in plugins/ directory."); } $this->deactivateThemeIfTheme($pluginName); // Load plugin $plugin = $this->loadPlugin($pluginName); if ($plugin === null) { throw new \Exception("The plugin '$pluginName' was found in the filesystem, but could not be loaded.'"); } $this->installPluginIfNecessary($plugin); $plugin->activate(); EventDispatcher::getInstance()->postPendingEventsTo($plugin); $this->pluginsToLoad[] = $pluginName; $this->updatePluginsConfig($this->pluginsToLoad); PiwikConfig::getInstance()->forceSave(); $this->clearCache($pluginName); /** * Event triggered after a plugin has been activated. * * @param string $pluginName The plugin that has been activated. */ Piwik::postEvent('PluginManager.pluginActivated', array($pluginName)); }
php
public function activatePlugin($pluginName) { $plugins = $this->pluginList->getActivatedPlugins(); if (in_array($pluginName, $plugins)) { // plugin is already activated return; } if (!$this->isPluginInFilesystem($pluginName)) { throw new \Exception("Plugin '$pluginName' cannot be found in the filesystem in plugins/ directory."); } $this->deactivateThemeIfTheme($pluginName); // Load plugin $plugin = $this->loadPlugin($pluginName); if ($plugin === null) { throw new \Exception("The plugin '$pluginName' was found in the filesystem, but could not be loaded.'"); } $this->installPluginIfNecessary($plugin); $plugin->activate(); EventDispatcher::getInstance()->postPendingEventsTo($plugin); $this->pluginsToLoad[] = $pluginName; $this->updatePluginsConfig($this->pluginsToLoad); PiwikConfig::getInstance()->forceSave(); $this->clearCache($pluginName); /** * Event triggered after a plugin has been activated. * * @param string $pluginName The plugin that has been activated. */ Piwik::postEvent('PluginManager.pluginActivated', array($pluginName)); }
[ "public", "function", "activatePlugin", "(", "$", "pluginName", ")", "{", "$", "plugins", "=", "$", "this", "->", "pluginList", "->", "getActivatedPlugins", "(", ")", ";", "if", "(", "in_array", "(", "$", "pluginName", ",", "$", "plugins", ")", ")", "{",...
Activate the specified plugin and install (if needed) @param string $pluginName Name of plugin @throws \Exception
[ "Activate", "the", "specified", "plugin", "and", "install", "(", "if", "needed", ")" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Plugin/Manager.php#L635-L671
train
Activate a plugin
[ 30522, 2270, 3853, 20544, 24759, 15916, 2378, 1006, 1002, 13354, 23111, 14074, 1007, 1063, 1002, 13354, 7076, 1027, 1002, 2023, 1011, 1028, 13354, 2378, 9863, 1011, 1028, 2131, 30524, 1065, 2065, 1006, 999, 1002, 2023, 1011, 1028, 2003, 247...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/SettingsProvider.php
SettingsProvider.getMeasurableSettings
public function getMeasurableSettings($pluginName, $idSite, $idType = null) { $plugin = $this->getLoadedAndActivated($pluginName); if ($plugin) { $component = $plugin->findComponent('MeasurableSettings', 'Piwik\\Settings\\Measurable\\MeasurableSettings'); if ($component) { return StaticContainer::getContainer()->make($component, array( 'idSite' => $idSite, 'idMeasurableType' => $idType )); } } }
php
public function getMeasurableSettings($pluginName, $idSite, $idType = null) { $plugin = $this->getLoadedAndActivated($pluginName); if ($plugin) { $component = $plugin->findComponent('MeasurableSettings', 'Piwik\\Settings\\Measurable\\MeasurableSettings'); if ($component) { return StaticContainer::getContainer()->make($component, array( 'idSite' => $idSite, 'idMeasurableType' => $idType )); } } }
[ "public", "function", "getMeasurableSettings", "(", "$", "pluginName", ",", "$", "idSite", ",", "$", "idType", "=", "null", ")", "{", "$", "plugin", "=", "$", "this", "->", "getLoadedAndActivated", "(", "$", "pluginName", ")", ";", "if", "(", "$", "plugi...
@api Get measurable settings for a specific plugin. @param string $pluginName The name of a plugin. @param int $idSite The ID of a site. If a site is about to be created pass idSite = 0. @param string|null $idType If null, idType will be detected automatically if the site already exists. Only needed to set a value when idSite = 0 (this is the case when a site is about) to be created. @return MeasurableSettings|null Returns null if no MeasurableSettings implemented by this plugin or when plugin is not loaded and activated. Returns an instance of the settings otherwise.
[ "@api" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Plugin/SettingsProvider.php#L151-L165
train
Returns theMeasurableSettings component
[ 30522, 2270, 3853, 2131, 4168, 28329, 21678, 8613, 1006, 1002, 13354, 23111, 14074, 1010, 1002, 8909, 28032, 2063, 1010, 1002, 8909, 13874, 1027, 19701, 1007, 1063, 1002, 13354, 2378, 1027, 1002, 2023, 1011, 1028, 2131, 17468, 13832, 6593, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Archive.php
Archive.getArchiveGroupOfPlugin
private function getArchiveGroupOfPlugin($plugin) { $periods = $this->params->getPeriods(); $periodLabel = reset($periods)->getLabel(); if (Rules::shouldProcessReportsAllPlugins($this->params->getIdSites(), $this->params->getSegment(), $periodLabel)) { return self::ARCHIVE_ALL_PLUGINS_FLAG; } return $plugin; }
php
private function getArchiveGroupOfPlugin($plugin) { $periods = $this->params->getPeriods(); $periodLabel = reset($periods)->getLabel(); if (Rules::shouldProcessReportsAllPlugins($this->params->getIdSites(), $this->params->getSegment(), $periodLabel)) { return self::ARCHIVE_ALL_PLUGINS_FLAG; } return $plugin; }
[ "private", "function", "getArchiveGroupOfPlugin", "(", "$", "plugin", ")", "{", "$", "periods", "=", "$", "this", "->", "params", "->", "getPeriods", "(", ")", ";", "$", "periodLabel", "=", "reset", "(", "$", "periods", ")", "->", "getLabel", "(", ")", ...
Returns the archiving group identifier given a plugin. More than one plugin can be called at once when archiving. In such a case we don't want to launch archiving three times for three plugins if doing it once is enough, so getArchiveIds makes sure to get the archive group of all reports. If the period isn't a range, then all plugins' archiving code is executed. If the period is a range, then archiving code is executed individually for each plugin.
[ "Returns", "the", "archiving", "group", "identifier", "given", "a", "plugin", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Archive.php#L797-L807
train
Return archive group of plugin
[ 30522, 2797, 3853, 2131, 2906, 5428, 3726, 17058, 11253, 24759, 15916, 2378, 1006, 1002, 13354, 2378, 1007, 1063, 1002, 6993, 1027, 1002, 2023, 1011, 1028, 11498, 5244, 1011, 1028, 2131, 4842, 3695, 5104, 1006, 1007, 1025, 1002, 2558, 20470...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Relation.php
Relation.noConstraints
public static function noConstraints(Closure $callback) { $previous = static::$constraints; static::$constraints = false; // When resetting the relation where clause, we want to shift the first element // off of the bindings, leaving only the constraints that the developers put // as "extra" on the relationships, and not original relation constraints. try { return call_user_func($callback); } finally { static::$constraints = $previous; } }
php
public static function noConstraints(Closure $callback) { $previous = static::$constraints; static::$constraints = false; // When resetting the relation where clause, we want to shift the first element // off of the bindings, leaving only the constraints that the developers put // as "extra" on the relationships, and not original relation constraints. try { return call_user_func($callback); } finally { static::$constraints = $previous; } }
[ "public", "static", "function", "noConstraints", "(", "Closure", "$", "callback", ")", "{", "$", "previous", "=", "static", "::", "$", "constraints", ";", "static", "::", "$", "constraints", "=", "false", ";", "// When resetting the relation where clause, we want to...
Run a callback with constraints disabled on the relation. @param \Closure $callback @return mixed
[ "Run", "a", "callback", "with", "constraints", "disabled", "on", "the", "relation", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Relations/Relation.php#L80-L94
train
This function does not reset the constraints.
[ 30522, 2270, 10763, 3853, 2053, 8663, 20528, 18447, 2015, 1006, 8503, 1002, 2655, 5963, 1007, 1063, 1002, 3025, 1027, 10763, 1024, 1024, 1002, 14679, 1025, 10763, 1024, 1024, 1002, 14679, 1027, 6270, 1025, 1013, 1013, 2043, 25141, 3436, 199...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/NumberFormatter.php
NumberFormatter.format
public function format($value, $maximumFractionDigits=0, $minimumFractionDigits=0) { if (is_string($value) && trim($value, '%') != $value ) { return $this->formatPercent($value, $maximumFractionDigits, $minimumFractionDigits); } return $this->formatNumber($value, $maximumFractionDigits, $minimumFractionDigits); }
php
public function format($value, $maximumFractionDigits=0, $minimumFractionDigits=0) { if (is_string($value) && trim($value, '%') != $value ) { return $this->formatPercent($value, $maximumFractionDigits, $minimumFractionDigits); } return $this->formatNumber($value, $maximumFractionDigits, $minimumFractionDigits); }
[ "public", "function", "format", "(", "$", "value", ",", "$", "maximumFractionDigits", "=", "0", ",", "$", "minimumFractionDigits", "=", "0", ")", "{", "if", "(", "is_string", "(", "$", "value", ")", "&&", "trim", "(", "$", "value", ",", "'%'", ")", "...
Formats a given number or percent value (if $value starts or ends with a %) @param string|int|float $value @param int $maximumFractionDigits @param int $minimumFractionDigits @return mixed|string
[ "Formats", "a", "given", "number", "or", "percent", "value", "(", "if", "$value", "starts", "or", "ends", "with", "a", "%", ")" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/NumberFormatter.php#L52-L61
train
Format a value to the maximum and minimum fraction digits of the phrase
[ 30522, 2270, 3853, 4289, 1006, 1002, 3643, 1010, 1002, 4555, 27843, 7542, 4305, 23806, 2015, 1027, 1014, 1010, 1002, 6263, 27843, 7542, 4305, 23806, 2015, 1027, 1014, 1007, 1063, 2065, 1006, 2003, 1035, 5164, 1006, 1002, 3643, 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...
matomo-org/matomo
libs/Zend/Cache/Backend/Static.php
Zend_Cache_Backend_Static.getOption
public function getOption($name) { if ($name == 'tag_cache') { return $this->getInnerCache(); } else { if (in_array($name, $this->_options)) { return $this->_options[$name]; } if ($name == 'lifetime') { return parent::getLifetime(); } return null; } }
php
public function getOption($name) { if ($name == 'tag_cache') { return $this->getInnerCache(); } else { if (in_array($name, $this->_options)) { return $this->_options[$name]; } if ($name == 'lifetime') { return parent::getLifetime(); } return null; } }
[ "public", "function", "getOption", "(", "$", "name", ")", "{", "if", "(", "$", "name", "==", "'tag_cache'", ")", "{", "return", "$", "this", "->", "getInnerCache", "(", ")", ";", "}", "else", "{", "if", "(", "in_array", "(", "$", "name", ",", "$", ...
Retrieve any option via interception of the parent's statically held options including the local option for a tag cache. @param string $name @return mixed
[ "Retrieve", "any", "option", "via", "interception", "of", "the", "parent", "s", "statically", "held", "options", "including", "the", "local", "option", "for", "a", "tag", "cache", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Cache/Backend/Static.php#L100-L113
train
Get an option
[ 30522, 2270, 3853, 2131, 7361, 3508, 1006, 1002, 2171, 1007, 1063, 2065, 1006, 1002, 2171, 1027, 1027, 1005, 6415, 1035, 17053, 1005, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 2131, 23111, 2121, 3540, 5403, 1006, 1007, 1025, 1065, 2842, 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/Validation/Concerns/ReplacesAttributes.php
ReplacesAttributes.replaceSame
protected function replaceSame($message, $attribute, $rule, $parameters) { return str_replace(':other', $this->getDisplayableAttribute($parameters[0]), $message); }
php
protected function replaceSame($message, $attribute, $rule, $parameters) { return str_replace(':other', $this->getDisplayableAttribute($parameters[0]), $message); }
[ "protected", "function", "replaceSame", "(", "$", "message", ",", "$", "attribute", ",", "$", "rule", ",", "$", "parameters", ")", "{", "return", "str_replace", "(", "':other'", ",", "$", "this", "->", "getDisplayableAttribute", "(", "$", "parameters", "[", ...
Replace all place-holders for the same rule. @param string $message @param string $attribute @param string $rule @param array $parameters @return string
[ "Replace", "all", "place", "-", "holders", "for", "the", "same", "rule", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Validation/Concerns/ReplacesAttributes.php#L372-L375
train
Replace all occurrences of the rule with the same value.
[ 30522, 5123, 3853, 20736, 14074, 1006, 1002, 4471, 1010, 1002, 17961, 1010, 1002, 3627, 1010, 1002, 11709, 1007, 1063, 2709, 2358, 2099, 1035, 5672, 1006, 1005, 1024, 2060, 1005, 1010, 1002, 2023, 1011, 1028, 2131, 10521, 13068, 3085, 19321...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Catalogue/AbstractOperation.php
AbstractOperation.getResult
public function getResult() { foreach ($this->getDomains() as $domain) { if (!isset($this->messages[$domain])) { $this->processDomain($domain); } } return $this->result; }
php
public function getResult() { foreach ($this->getDomains() as $domain) { if (!isset($this->messages[$domain])) { $this->processDomain($domain); } } return $this->result; }
[ "public", "function", "getResult", "(", ")", "{", "foreach", "(", "$", "this", "->", "getDomains", "(", ")", "as", "$", "domain", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "messages", "[", "$", "domain", "]", ")", ")", "{", "$", ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Translation/Catalogue/AbstractOperation.php#L139-L148
train
Get Result of all Domains
[ 30522, 2270, 3853, 2131, 6072, 11314, 1006, 1007, 1063, 18921, 6776, 1006, 1002, 2023, 1011, 1028, 2131, 9527, 28247, 1006, 1007, 2004, 1002, 5884, 1007, 1063, 2065, 1006, 999, 26354, 3388, 1006, 1002, 2023, 1011, 1028, 7696, 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/Finder/Finder.php
Finder.ignoreDotFiles
public function ignoreDotFiles($ignoreDotFiles) { if ($ignoreDotFiles) { $this->ignore |= static::IGNORE_DOT_FILES; } else { $this->ignore &= ~static::IGNORE_DOT_FILES; } return $this; }
php
public function ignoreDotFiles($ignoreDotFiles) { if ($ignoreDotFiles) { $this->ignore |= static::IGNORE_DOT_FILES; } else { $this->ignore &= ~static::IGNORE_DOT_FILES; } return $this; }
[ "public", "function", "ignoreDotFiles", "(", "$", "ignoreDotFiles", ")", "{", "if", "(", "$", "ignoreDotFiles", ")", "{", "$", "this", "->", "ignore", "|=", "static", "::", "IGNORE_DOT_FILES", ";", "}", "else", "{", "$", "this", "->", "ignore", "&=", "~"...
Excludes "hidden" directories and files (starting with a dot). This option is enabled by default. @param bool $ignoreDotFiles Whether to exclude "hidden" files or not @return $this @see ExcludeDirectoryFilterIterator
[ "Excludes", "hidden", "directories", "and", "files", "(", "starting", "with", "a", "dot", ")", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Finder/Finder.php#L345-L354
train
Set flag to ignore dot files
[ 30522, 2270, 3853, 6439, 4140, 8873, 4244, 1006, 1002, 6439, 4140, 8873, 4244, 1007, 1063, 2065, 1006, 1002, 6439, 4140, 8873, 4244, 1007, 1063, 1002, 2023, 1011, 1028, 8568, 1064, 1027, 10763, 1024, 1024, 8568, 1035, 11089, 1035, 6764, 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/Adapter/Abstract.php
Zend_Db_Adapter_Abstract._quoteIdentifierAs
protected function _quoteIdentifierAs($ident, $alias = null, $auto = false, $as = ' AS ') { if ($ident instanceof Zend_Db_Expr) { $quoted = $ident->__toString(); } elseif ($ident instanceof Zend_Db_Select) { $quoted = '(' . $ident->assemble() . ')'; } else { if (is_string($ident)) { $ident = explode('.', $ident); } if (is_array($ident)) { $segments = array(); foreach ($ident as $segment) { if ($segment instanceof Zend_Db_Expr) { $segments[] = $segment->__toString(); } else { $segments[] = $this->_quoteIdentifier($segment, $auto); } } if ($alias !== null && end($ident) == $alias) { $alias = null; } $quoted = implode('.', $segments); } else { $quoted = $this->_quoteIdentifier($ident, $auto); } } if ($alias !== null) { $quoted .= $as . $this->_quoteIdentifier($alias, $auto); } return $quoted; }
php
protected function _quoteIdentifierAs($ident, $alias = null, $auto = false, $as = ' AS ') { if ($ident instanceof Zend_Db_Expr) { $quoted = $ident->__toString(); } elseif ($ident instanceof Zend_Db_Select) { $quoted = '(' . $ident->assemble() . ')'; } else { if (is_string($ident)) { $ident = explode('.', $ident); } if (is_array($ident)) { $segments = array(); foreach ($ident as $segment) { if ($segment instanceof Zend_Db_Expr) { $segments[] = $segment->__toString(); } else { $segments[] = $this->_quoteIdentifier($segment, $auto); } } if ($alias !== null && end($ident) == $alias) { $alias = null; } $quoted = implode('.', $segments); } else { $quoted = $this->_quoteIdentifier($ident, $auto); } } if ($alias !== null) { $quoted .= $as . $this->_quoteIdentifier($alias, $auto); } return $quoted; }
[ "protected", "function", "_quoteIdentifierAs", "(", "$", "ident", ",", "$", "alias", "=", "null", ",", "$", "auto", "=", "false", ",", "$", "as", "=", "' AS '", ")", "{", "if", "(", "$", "ident", "instanceof", "Zend_Db_Expr", ")", "{", "$", "quoted", ...
Quote an identifier and an optional alias. @param string|array|Zend_Db_Expr $ident The identifier or expression. @param string $alias An optional alias. @param boolean $auto If true, heed the AUTO_QUOTE_IDENTIFIERS config option. @param string $as The string to add between the identifier/expression and the alias. @return string The quoted identifier and alias.
[ "Quote", "an", "identifier", "and", "an", "optional", "alias", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Adapter/Abstract.php#L1004-L1035
train
Quote identifier as
[ 30522, 5123, 3853, 1035, 14686, 5178, 16778, 8873, 24140, 1006, 1002, 8909, 4765, 1010, 1002, 14593, 1027, 19701, 1010, 1002, 8285, 1027, 6270, 1010, 1002, 2004, 1027, 1005, 2004, 1005, 1007, 1063, 2065, 1006, 1002, 8909, 4765, 6013, 11253,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/CardSchemeValidator.php
CardSchemeValidator.validate
public function validate($value, Constraint $constraint) { if (!$constraint instanceof CardScheme) { throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\CardScheme'); } if (null === $value || '' === $value) { return; } if (!is_numeric($value)) { $this->context->buildViolation($constraint->message) ->setParameter('{{ value }}', $this->formatValue($value)) ->setCode(CardScheme::NOT_NUMERIC_ERROR) ->addViolation(); return; } $schemes = array_flip((array) $constraint->schemes); $schemeRegexes = array_intersect_key($this->schemes, $schemes); foreach ($schemeRegexes as $regexes) { foreach ($regexes as $regex) { if (preg_match($regex, $value)) { return; } } } $this->context->buildViolation($constraint->message) ->setParameter('{{ value }}', $this->formatValue($value)) ->setCode(CardScheme::INVALID_FORMAT_ERROR) ->addViolation(); }
php
public function validate($value, Constraint $constraint) { if (!$constraint instanceof CardScheme) { throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\CardScheme'); } if (null === $value || '' === $value) { return; } if (!is_numeric($value)) { $this->context->buildViolation($constraint->message) ->setParameter('{{ value }}', $this->formatValue($value)) ->setCode(CardScheme::NOT_NUMERIC_ERROR) ->addViolation(); return; } $schemes = array_flip((array) $constraint->schemes); $schemeRegexes = array_intersect_key($this->schemes, $schemes); foreach ($schemeRegexes as $regexes) { foreach ($regexes as $regex) { if (preg_match($regex, $value)) { return; } } } $this->context->buildViolation($constraint->message) ->setParameter('{{ value }}', $this->formatValue($value)) ->setCode(CardScheme::INVALID_FORMAT_ERROR) ->addViolation(); }
[ "public", "function", "validate", "(", "$", "value", ",", "Constraint", "$", "constraint", ")", "{", "if", "(", "!", "$", "constraint", "instanceof", "CardScheme", ")", "{", "throw", "new", "UnexpectedTypeException", "(", "$", "constraint", ",", "__NAMESPACE__...
Validates a creditcard belongs to a specified scheme. @param mixed $value @param Constraint $constraint
[ "Validates", "a", "creditcard", "belongs", "to", "a", "specified", "scheme", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Validator/Constraints/CardSchemeValidator.php#L101-L135
train
Checks if the value is a valid card scheme
[ 30522, 2270, 3853, 9398, 3686, 1006, 1002, 3643, 1010, 27142, 1002, 27142, 1007, 30524, 1035, 1012, 1005, 1032, 5329, 5403, 4168, 1005, 1007, 1025, 1065, 2065, 1006, 19701, 1027, 1027, 1027, 1002, 3643, 1064, 1064, 1005, 1005, 1027, 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...
matomo-org/matomo
libs/Zend/Cache/Frontend/Capture.php
Zend_Cache_Frontend_Capture._flush
public function _flush($data) { $id = array_pop($this->_idStack); if ($id === null) { Zend_Cache::throwException('use of _flush() without a start()'); } if ($this->_extension) { $this->save(serialize(array($data, $this->_extension)), $id, $this->_tags); } else { $this->save($data, $id, $this->_tags); } return $data; }
php
public function _flush($data) { $id = array_pop($this->_idStack); if ($id === null) { Zend_Cache::throwException('use of _flush() without a start()'); } if ($this->_extension) { $this->save(serialize(array($data, $this->_extension)), $id, $this->_tags); } else { $this->save($data, $id, $this->_tags); } return $data; }
[ "public", "function", "_flush", "(", "$", "data", ")", "{", "$", "id", "=", "array_pop", "(", "$", "this", "->", "_idStack", ")", ";", "if", "(", "$", "id", "===", "null", ")", "{", "Zend_Cache", "::", "throwException", "(", "'use of _flush() without a s...
callback for output buffering (shouldn't really be called manually) @param string $data Buffered output @return string Data to send to browser
[ "callback", "for", "output", "buffering", "(", "shouldn", "t", "really", "be", "called", "manually", ")" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Cache/Frontend/Capture.php#L75-L87
train
Flushes the cache
[ 30522, 2270, 3853, 1035, 13862, 1006, 1002, 2951, 1007, 1063, 1002, 8909, 1027, 9140, 1035, 3769, 1006, 1002, 2023, 1011, 1028, 1035, 8909, 9153, 3600, 1007, 1025, 2065, 1006, 1002, 8909, 1027, 1027, 1027, 19701, 1007, 1063, 16729, 30524, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Field/HasMany.php
HasMany.buildRelatedForms
protected function buildRelatedForms() { if (is_null($this->form)) { return []; } $model = $this->form->model(); $relation = call_user_func([$model, $this->relationName]); if (!$relation instanceof Relation && !$relation instanceof MorphMany) { throw new \Exception('hasMany field must be a HasMany or MorphMany relation.'); } $forms = []; /* * If redirect from `exception` or `validation error` page. * * Then get form data from session flash. * * Else get data from database. */ if ($values = old($this->column)) { foreach ($values as $key => $data) { if ($data[NestedForm::REMOVE_FLAG_NAME] == 1) { continue; } $model = $relation->getRelated()->replicate()->forceFill($data); $forms[$key] = $this->buildNestedForm($this->column, $this->builder, $model) ->fill($data); } } else { foreach ($this->value as $data) { $key = Arr::get($data, $relation->getRelated()->getKeyName()); $model = $relation->getRelated()->replicate()->forceFill($data); $forms[$key] = $this->buildNestedForm($this->column, $this->builder, $model) ->fill($data); } } return $forms; }
php
protected function buildRelatedForms() { if (is_null($this->form)) { return []; } $model = $this->form->model(); $relation = call_user_func([$model, $this->relationName]); if (!$relation instanceof Relation && !$relation instanceof MorphMany) { throw new \Exception('hasMany field must be a HasMany or MorphMany relation.'); } $forms = []; /* * If redirect from `exception` or `validation error` page. * * Then get form data from session flash. * * Else get data from database. */ if ($values = old($this->column)) { foreach ($values as $key => $data) { if ($data[NestedForm::REMOVE_FLAG_NAME] == 1) { continue; } $model = $relation->getRelated()->replicate()->forceFill($data); $forms[$key] = $this->buildNestedForm($this->column, $this->builder, $model) ->fill($data); } } else { foreach ($this->value as $data) { $key = Arr::get($data, $relation->getRelated()->getKeyName()); $model = $relation->getRelated()->replicate()->forceFill($data); $forms[$key] = $this->buildNestedForm($this->column, $this->builder, $model) ->fill($data); } } return $forms; }
[ "protected", "function", "buildRelatedForms", "(", ")", "{", "if", "(", "is_null", "(", "$", "this", "->", "form", ")", ")", "{", "return", "[", "]", ";", "}", "$", "model", "=", "$", "this", "->", "form", "->", "model", "(", ")", ";", "$", "rela...
Build Nested form for related data. @throws \Exception @return array
[ "Build", "Nested", "form", "for", "related", "data", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Form/Field/HasMany.php#L359-L405
train
Build related forms
[ 30522, 5123, 3853, 3857, 16570, 4383, 22694, 1006, 1007, 1063, 2065, 1006, 2003, 1035, 19701, 1006, 1002, 2023, 1011, 1028, 2433, 1007, 1007, 1063, 2709, 1031, 1033, 1025, 1065, 1002, 2944, 1027, 1002, 2023, 1011, 1028, 2433, 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...
overtrue/wechat
src/Payment/Bill/Client.php
Client.get
public function get(string $date, string $type = 'ALL', array $optional = []) { $params = [ 'appid' => $this->app['config']->app_id, 'bill_date' => $date, 'bill_type' => $type, ] + $optional; $response = $this->requestRaw($this->wrap('pay/downloadbill'), $params); if (0 === strpos($response->getBody()->getContents(), '<xml>')) { return $this->castResponseToType($response, $this->app['config']->get('response_type')); } return StreamResponse::buildFromPsrResponse($response); }
php
public function get(string $date, string $type = 'ALL', array $optional = []) { $params = [ 'appid' => $this->app['config']->app_id, 'bill_date' => $date, 'bill_type' => $type, ] + $optional; $response = $this->requestRaw($this->wrap('pay/downloadbill'), $params); if (0 === strpos($response->getBody()->getContents(), '<xml>')) { return $this->castResponseToType($response, $this->app['config']->get('response_type')); } return StreamResponse::buildFromPsrResponse($response); }
[ "public", "function", "get", "(", "string", "$", "date", ",", "string", "$", "type", "=", "'ALL'", ",", "array", "$", "optional", "=", "[", "]", ")", "{", "$", "params", "=", "[", "'appid'", "=>", "$", "this", "->", "app", "[", "'config'", "]", "...
Download bill history as a table file. @param string $date @param string $type @return \EasyWeChat\Kernel\Http\StreamResponse|\Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
[ "Download", "bill", "history", "as", "a", "table", "file", "." ]
120c72faaa93c270365bc75c73c362d5fd583209
https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/Payment/Bill/Client.php#L29-L44
train
Download bill.
[ 30522, 2270, 3853, 2131, 1006, 5164, 1002, 3058, 1010, 5164, 1002, 2828, 1027, 1005, 2035, 1005, 1010, 9140, 1002, 11887, 1027, 1031, 1033, 1007, 1063, 1002, 11498, 5244, 1027, 1031, 1005, 10439, 3593, 1005, 1027, 1028, 1002, 2023, 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...
laravel/framework
src/Illuminate/Foundation/Support/Providers/EventServiceProvider.php
EventServiceProvider.discoverEvents
public function discoverEvents() { return collect($this->discoverEventsWithin()) ->reject(function ($directory) { return ! is_dir($directory); }) ->reduce(function ($discovered, $directory) { return array_merge_recursive( $discovered, DiscoverEvents::within($directory, base_path()) ); }, []); }
php
public function discoverEvents() { return collect($this->discoverEventsWithin()) ->reject(function ($directory) { return ! is_dir($directory); }) ->reduce(function ($discovered, $directory) { return array_merge_recursive( $discovered, DiscoverEvents::within($directory, base_path()) ); }, []); }
[ "public", "function", "discoverEvents", "(", ")", "{", "return", "collect", "(", "$", "this", "->", "discoverEventsWithin", "(", ")", ")", "->", "reject", "(", "function", "(", "$", "directory", ")", "{", "return", "!", "is_dir", "(", "$", "directory", "...
Discover the events and listeners for the application. @return array
[ "Discover", "the", "events", "and", "listeners", "for", "the", "application", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Foundation/Support/Providers/EventServiceProvider.php#L89-L101
train
Returns all discover events within the base path
[ 30522, 2270, 3853, 7523, 18697, 7666, 1006, 1007, 1063, 2709, 8145, 1006, 1002, 2023, 1011, 1028, 7523, 18697, 7666, 24415, 2378, 1006, 1007, 1007, 1011, 1028, 15454, 1006, 3853, 1006, 1002, 14176, 1007, 1063, 2709, 999, 2003, 1035, 16101, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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...
guzzle/guzzle
src/HandlerStack.php
HandlerStack.unshift
public function unshift(callable $middleware, $name = null) { array_unshift($this->stack, [$middleware, $name]); $this->cached = null; }
php
public function unshift(callable $middleware, $name = null) { array_unshift($this->stack, [$middleware, $name]); $this->cached = null; }
[ "public", "function", "unshift", "(", "callable", "$", "middleware", ",", "$", "name", "=", "null", ")", "{", "array_unshift", "(", "$", "this", "->", "stack", ",", "[", "$", "middleware", ",", "$", "name", "]", ")", ";", "$", "this", "->", "cached",...
Unshift a middleware to the bottom of the stack. @param callable $middleware Middleware function @param string $name Name to register for this middleware.
[ "Unshift", "a", "middleware", "to", "the", "bottom", "of", "the", "stack", "." ]
bf595424e4d442a190582e088985dc835a789071
https://github.com/guzzle/guzzle/blob/bf595424e4d442a190582e088985dc835a789071/src/HandlerStack.php#L127-L131
train
Prepend a middleware to the beginning of the stack
[ 30522, 2270, 3853, 4895, 6182, 6199, 1006, 2655, 3085, 1002, 2690, 8059, 1010, 1002, 2171, 1027, 19701, 1007, 1063, 9140, 1035, 4895, 6182, 6199, 1006, 1002, 2023, 1011, 1028, 9991, 1010, 1031, 1002, 2690, 8059, 1010, 1002, 2171, 1033, 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/Intl/NumberFormatter/NumberFormatter.php
NumberFormatter.getAttribute
public function getAttribute($attr) { return isset($this->attributes[$attr]) ? $this->attributes[$attr] : null; }
php
public function getAttribute($attr) { return isset($this->attributes[$attr]) ? $this->attributes[$attr] : null; }
[ "public", "function", "getAttribute", "(", "$", "attr", ")", "{", "return", "isset", "(", "$", "this", "->", "attributes", "[", "$", "attr", "]", ")", "?", "$", "this", "->", "attributes", "[", "$", "attr", "]", ":", "null", ";", "}" ]
Returns an attribute value. @param int $attr An attribute specifier, one of the numeric attribute constants @return bool|int The attribute value on success or false on error @see http://www.php.net/manual/en/numberformatter.getattribute.php
[ "Returns", "an", "attribute", "value", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php#L392-L395
train
Get attribute value
[ 30522, 2270, 3853, 2131, 19321, 3089, 8569, 2618, 1006, 1002, 2012, 16344, 1007, 1063, 2709, 26354, 3388, 1006, 1002, 2023, 1011, 1028, 12332, 1031, 1002, 2012, 16344, 1033, 1007, 1029, 1002, 2023, 1011, 1028, 12332, 1031, 1002, 2012, 16344...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/CombineAssets.php
CombineAssets.putCache
protected function putCache($cacheKey, array $cacheInfo) { $cacheKey = 'combiner.'.$cacheKey; if (Cache::has($cacheKey)) { return false; } $this->putCacheIndex($cacheKey); Cache::forever($cacheKey, base64_encode(serialize($cacheInfo))); return true; }
php
protected function putCache($cacheKey, array $cacheInfo) { $cacheKey = 'combiner.'.$cacheKey; if (Cache::has($cacheKey)) { return false; } $this->putCacheIndex($cacheKey); Cache::forever($cacheKey, base64_encode(serialize($cacheInfo))); return true; }
[ "protected", "function", "putCache", "(", "$", "cacheKey", ",", "array", "$", "cacheInfo", ")", "{", "$", "cacheKey", "=", "'combiner.'", ".", "$", "cacheKey", ";", "if", "(", "Cache", "::", "has", "(", "$", "cacheKey", ")", ")", "{", "return", "false"...
Stores information about a asset collection against a cache identifier. @param string $cacheKey Cache identifier. @param array $cacheInfo List of asset files. @return bool Successful
[ "Stores", "information", "about", "a", "asset", "collection", "against", "a", "cache", "identifier", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/CombineAssets.php#L762-L773
train
Put cache info into cache
[ 30522, 5123, 3853, 2404, 3540, 5403, 1006, 1002, 17053, 14839, 1010, 9140, 1002, 17053, 2378, 14876, 1007, 1063, 1002, 17053, 14839, 1027, 1005, 11506, 2099, 1012, 1005, 1012, 1002, 17053, 14839, 1025, 2065, 1006, 17053, 1024, 1024, 2038, 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...
symfony/symfony
src/Symfony/Component/Validator/Mapping/Loader/YamlFileLoader.php
YamlFileLoader.parseNodes
protected function parseNodes(array $nodes) { $values = []; foreach ($nodes as $name => $childNodes) { if (is_numeric($name) && \is_array($childNodes) && 1 === \count($childNodes)) { $options = current($childNodes); if (\is_array($options)) { $options = $this->parseNodes($options); } $values[] = $this->newConstraint(key($childNodes), $options); } else { if (\is_array($childNodes)) { $childNodes = $this->parseNodes($childNodes); } $values[$name] = $childNodes; } } return $values; }
php
protected function parseNodes(array $nodes) { $values = []; foreach ($nodes as $name => $childNodes) { if (is_numeric($name) && \is_array($childNodes) && 1 === \count($childNodes)) { $options = current($childNodes); if (\is_array($options)) { $options = $this->parseNodes($options); } $values[] = $this->newConstraint(key($childNodes), $options); } else { if (\is_array($childNodes)) { $childNodes = $this->parseNodes($childNodes); } $values[$name] = $childNodes; } } return $values; }
[ "protected", "function", "parseNodes", "(", "array", "$", "nodes", ")", "{", "$", "values", "=", "[", "]", ";", "foreach", "(", "$", "nodes", "as", "$", "name", "=>", "$", "childNodes", ")", "{", "if", "(", "is_numeric", "(", "$", "name", ")", "&&"...
Parses a collection of YAML nodes. @param array $nodes The YAML nodes @return array An array of values or Constraint instances
[ "Parses", "a", "collection", "of", "YAML", "nodes", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Validator/Mapping/Loader/YamlFileLoader.php#L81-L104
train
Parse nodes into array of constraints
[ 30522, 5123, 3853, 11968, 5054, 19847, 1006, 9140, 1002, 14164, 1007, 1063, 1002, 5300, 1027, 1031, 1033, 1025, 18921, 6776, 1006, 1002, 14164, 2004, 1002, 2171, 1027, 1028, 1002, 2775, 3630, 6155, 1007, 1063, 2065, 1006, 2003, 1035, 16371,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Notification/Manager.php
Manager.getAllNotificationsToDisplay
public static function getAllNotificationsToDisplay() { $notifications = static::getAllNotifications(); uasort($notifications, function ($n1, $n2) { /** @var Notification $n1 */ /** @var Notification $n2 */ if ($n1->getPriority() == $n2->getPriority()) { return 0; } return $n1->getPriority() > $n2->getPriority() ? -1 : 1; }); return $notifications; }
php
public static function getAllNotificationsToDisplay() { $notifications = static::getAllNotifications(); uasort($notifications, function ($n1, $n2) { /** @var Notification $n1 */ /** @var Notification $n2 */ if ($n1->getPriority() == $n2->getPriority()) { return 0; } return $n1->getPriority() > $n2->getPriority() ? -1 : 1; }); return $notifications; }
[ "public", "static", "function", "getAllNotificationsToDisplay", "(", ")", "{", "$", "notifications", "=", "static", "::", "getAllNotifications", "(", ")", ";", "uasort", "(", "$", "notifications", ",", "function", "(", "$", "n1", ",", "$", "n2", ")", "{", ...
Determine all notifications that needs to be displayed. They are sorted by priority. Highest priorities first. @return \ArrayObject
[ "Determine", "all", "notifications", "that", "needs", "to", "be", "displayed", ".", "They", "are", "sorted", "by", "priority", ".", "Highest", "priorities", "first", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Notification/Manager.php#L80-L94
train
Get all notifications to display
[ 30522, 2270, 10763, 3853, 2131, 8095, 17048, 9031, 16033, 10521, 13068, 1006, 1007, 1063, 1002, 26828, 2015, 1027, 10763, 1024, 1024, 2131, 8095, 17048, 9031, 2015, 1006, 1007, 1025, 25423, 21748, 2102, 1006, 1002, 26828, 2015, 1010, 3853, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/UrlGenerator.php
UrlGenerator.route
public function route($name, $parameters = [], $absolute = true) { if (! is_null($route = $this->routes->getByName($name))) { return $this->toRoute($route, $parameters, $absolute); } throw new InvalidArgumentException("Route [{$name}] not defined."); }
php
public function route($name, $parameters = [], $absolute = true) { if (! is_null($route = $this->routes->getByName($name))) { return $this->toRoute($route, $parameters, $absolute); } throw new InvalidArgumentException("Route [{$name}] not defined."); }
[ "public", "function", "route", "(", "$", "name", ",", "$", "parameters", "=", "[", "]", ",", "$", "absolute", "=", "true", ")", "{", "if", "(", "!", "is_null", "(", "$", "route", "=", "$", "this", "->", "routes", "->", "getByName", "(", "$", "nam...
Get the URL to a named route. @param string $name @param mixed $parameters @param bool $absolute @return string @throws \InvalidArgumentException
[ "Get", "the", "URL", "to", "a", "named", "route", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Routing/UrlGenerator.php#L382-L389
train
Generate a route by name
[ 30522, 2270, 3853, 2799, 1006, 1002, 2171, 1010, 1002, 11709, 1027, 1031, 1033, 1010, 1002, 7619, 1027, 2995, 1007, 1063, 2065, 1006, 999, 2003, 1035, 19701, 1006, 1002, 2799, 1027, 1002, 2023, 1011, 1028, 5847, 1011, 1028, 2131, 3762, 18...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Cellmap.php
Cellmap.get_frame_height
public function get_frame_height(Frame $frame) { $key = $frame->get_id(); if (!isset($this->_frames[$key])) { throw new Exception("Frame not found in cellmap"); } $rows = $this->_frames[$key]["rows"]; $h = 0; foreach ($rows as $i) { if (!isset($this->_rows[$i])) { throw new Exception("The row #$i could not be found, please file an issue in the tracker with the HTML code"); } $h += $this->_rows[$i]["height"]; } return $h; }
php
public function get_frame_height(Frame $frame) { $key = $frame->get_id(); if (!isset($this->_frames[$key])) { throw new Exception("Frame not found in cellmap"); } $rows = $this->_frames[$key]["rows"]; $h = 0; foreach ($rows as $i) { if (!isset($this->_rows[$i])) { throw new Exception("The row #$i could not be found, please file an issue in the tracker with the HTML code"); } $h += $this->_rows[$i]["height"]; } return $h; }
[ "public", "function", "get_frame_height", "(", "Frame", "$", "frame", ")", "{", "$", "key", "=", "$", "frame", "->", "get_id", "(", ")", ";", "if", "(", "!", "isset", "(", "$", "this", "->", "_frames", "[", "$", "key", "]", ")", ")", "{", "throw"...
@param Frame $frame @return int @throws Exception @throws Exception
[ "@param", "Frame", "$frame" ]
75f13c700009be21a1965dc2c5b68a8708c22ba2
https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/src/Cellmap.php#L403-L422
train
Returns the height of a frame
[ 30522, 2270, 3853, 2131, 1035, 4853, 1035, 4578, 1006, 4853, 1002, 4853, 1007, 1063, 1002, 3145, 1027, 1002, 4853, 1011, 1028, 2131, 1035, 8909, 1006, 1007, 1025, 2065, 1006, 999, 26354, 3388, 1006, 1002, 2023, 1011, 1028, 1035, 11048, 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/Frame/FrameTree.php
FrameTree.fix_tables
protected function fix_tables() { $xp = new DOMXPath($this->_dom); // Move table caption before the table // FIXME find a better way to deal with it... $captions = $xp->query('//table/caption'); foreach ($captions as $caption) { $table = $caption->parentNode; $table->parentNode->insertBefore($caption, $table); } $firstRows = $xp->query('//table/tr[1]'); /** @var DOMElement $tableChild */ foreach ($firstRows as $tableChild) { $tbody = $this->_dom->createElement('tbody'); $tableNode = $tableChild->parentNode; do { if ($tableChild->nodeName === 'tr') { $tmpNode = $tableChild; $tableChild = $tableChild->nextSibling; $tableNode->removeChild($tmpNode); $tbody->appendChild($tmpNode); } else { if ($tbody->hasChildNodes() === true) { $tableNode->insertBefore($tbody, $tableChild); $tbody = $this->_dom->createElement('tbody'); } $tableChild = $tableChild->nextSibling; } } while ($tableChild); if ($tbody->hasChildNodes() === true) { $tableNode->appendChild($tbody); } } }
php
protected function fix_tables() { $xp = new DOMXPath($this->_dom); // Move table caption before the table // FIXME find a better way to deal with it... $captions = $xp->query('//table/caption'); foreach ($captions as $caption) { $table = $caption->parentNode; $table->parentNode->insertBefore($caption, $table); } $firstRows = $xp->query('//table/tr[1]'); /** @var DOMElement $tableChild */ foreach ($firstRows as $tableChild) { $tbody = $this->_dom->createElement('tbody'); $tableNode = $tableChild->parentNode; do { if ($tableChild->nodeName === 'tr') { $tmpNode = $tableChild; $tableChild = $tableChild->nextSibling; $tableNode->removeChild($tmpNode); $tbody->appendChild($tmpNode); } else { if ($tbody->hasChildNodes() === true) { $tableNode->insertBefore($tbody, $tableChild); $tbody = $this->_dom->createElement('tbody'); } $tableChild = $tableChild->nextSibling; } } while ($tableChild); if ($tbody->hasChildNodes() === true) { $tableNode->appendChild($tbody); } } }
[ "protected", "function", "fix_tables", "(", ")", "{", "$", "xp", "=", "new", "DOMXPath", "(", "$", "this", "->", "_dom", ")", ";", "// Move table caption before the table", "// FIXME find a better way to deal with it...", "$", "captions", "=", "$", "xp", "->", "qu...
Adds missing TBODYs around TR
[ "Adds", "missing", "TBODYs", "around", "TR" ]
75f13c700009be21a1965dc2c5b68a8708c22ba2
https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/src/Frame/FrameTree.php#L156-L191
train
Move table caption before the table table
[ 30522, 5123, 3853, 8081, 1035, 7251, 1006, 1007, 1063, 1002, 26726, 1027, 2047, 14383, 2595, 15069, 1006, 1002, 2023, 1011, 1028, 1035, 14383, 1007, 1025, 1013, 1013, 2693, 2795, 14408, 3258, 2077, 1996, 2795, 1013, 1013, 8081, 4168, 2424, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/ProxyHeaders.php
ProxyHeaders.getHeaders
private static function getHeaders($recognizedHeaders) { $headers = array(); foreach ($recognizedHeaders as $header) { if (isset($_SERVER[$header])) { $headers[] = $header; } } return $headers; }
php
private static function getHeaders($recognizedHeaders) { $headers = array(); foreach ($recognizedHeaders as $header) { if (isset($_SERVER[$header])) { $headers[] = $header; } } return $headers; }
[ "private", "static", "function", "getHeaders", "(", "$", "recognizedHeaders", ")", "{", "$", "headers", "=", "array", "(", ")", ";", "foreach", "(", "$", "recognizedHeaders", "as", "$", "header", ")", "{", "if", "(", "isset", "(", "$", "_SERVER", "[", ...
Get headers present in the HTTP request @param array $recognizedHeaders @return array HTTP headers
[ "Get", "headers", "present", "in", "the", "HTTP", "request" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/ProxyHeaders.php#L49-L60
train
Returns the list of HTTP headers that are present in the server array
[ 30522, 2797, 10763, 3853, 2131, 4974, 2545, 1006, 1002, 3858, 4974, 2545, 1007, 1063, 1002, 20346, 2015, 1027, 9140, 30524, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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.reloadAccess
public function reloadAccess(Auth $auth = null) { $this->resetSites(); if (isset($auth)) { $this->auth = $auth; } if ($this->hasSuperUserAccess()) { $this->makeSureLoginNameIsSet(); return true; } $this->token_auth = null; $this->login = null; // if the Auth wasn't set, we may be in the special case of setSuperUser(), otherwise we fail TODO: docs + review if (!isset($this->auth)) { return false; } // access = array ( idsite => accessIdSite, idsite2 => accessIdSite2) $result = $this->auth->authenticate(); if (!$result->wasAuthenticationSuccessful()) { return false; } $this->login = $result->getIdentity(); $this->token_auth = $result->getTokenAuth(); // case the superUser is logged in if ($result->hasSuperUserAccess()) { $this->setSuperUserAccess(true); } return true; }
php
public function reloadAccess(Auth $auth = null) { $this->resetSites(); if (isset($auth)) { $this->auth = $auth; } if ($this->hasSuperUserAccess()) { $this->makeSureLoginNameIsSet(); return true; } $this->token_auth = null; $this->login = null; // if the Auth wasn't set, we may be in the special case of setSuperUser(), otherwise we fail TODO: docs + review if (!isset($this->auth)) { return false; } // access = array ( idsite => accessIdSite, idsite2 => accessIdSite2) $result = $this->auth->authenticate(); if (!$result->wasAuthenticationSuccessful()) { return false; } $this->login = $result->getIdentity(); $this->token_auth = $result->getTokenAuth(); // case the superUser is logged in if ($result->hasSuperUserAccess()) { $this->setSuperUserAccess(true); } return true; }
[ "public", "function", "reloadAccess", "(", "Auth", "$", "auth", "=", "null", ")", "{", "$", "this", "->", "resetSites", "(", ")", ";", "if", "(", "isset", "(", "$", "auth", ")", ")", "{", "$", "this", "->", "auth", "=", "$", "auth", ";", "}", "...
Loads the access levels for the current user. Calls the authentication method to try to log the user in the system. If the user credentials are not correct we don't load anything. If the login/password is correct the user is either the SuperUser or a normal user. We load the access levels for this user for all the websites. @param null|Auth $auth Auth adapter @return bool true on success, false if reloading access failed (when auth object wasn't specified and user is not enforced to be Super User)
[ "Loads", "the", "access", "levels", "for", "the", "current", "user", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Access.php#L135-L172
train
reloadAccess - reloads the access array
[ 30522, 2270, 3853, 2128, 11066, 6305, 9623, 2015, 1006, 8740, 2705, 1002, 8740, 2705, 1027, 19701, 1007, 1063, 1002, 2023, 1011, 1028, 25141, 28032, 2229, 1006, 1007, 1025, 2065, 1006, 26354, 3388, 1006, 1002, 8740, 2705, 1007, 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...
php-ai/php-ml
src/Classification/Linear/DecisionStump.php
DecisionStump.calculateErrorRate
protected function calculateErrorRate(array $targets, float $threshold, string $operator, array $values): array { $wrong = 0.0; $prob = []; $leftLabel = $this->binaryLabels[0]; $rightLabel = $this->binaryLabels[1]; foreach ($values as $index => $value) { if (Comparison::compare($value, $threshold, $operator)) { $predicted = $leftLabel; } else { $predicted = $rightLabel; } $target = $targets[$index]; if ((string) $predicted != (string) $targets[$index]) { $wrong += $this->weights[$index]; } if (!isset($prob[$predicted][$target])) { $prob[$predicted][$target] = 0; } ++$prob[$predicted][$target]; } // Calculate probabilities: Proportion of labels in each leaf $dist = array_combine($this->binaryLabels, array_fill(0, 2, 0.0)); foreach ($prob as $leaf => $counts) { $leafTotal = (float) array_sum($prob[$leaf]); foreach ($counts as $label => $count) { if ((string) $leaf == (string) $label) { $dist[$leaf] = $count / $leafTotal; } } } return [$wrong / (float) array_sum($this->weights), $dist]; }
php
protected function calculateErrorRate(array $targets, float $threshold, string $operator, array $values): array { $wrong = 0.0; $prob = []; $leftLabel = $this->binaryLabels[0]; $rightLabel = $this->binaryLabels[1]; foreach ($values as $index => $value) { if (Comparison::compare($value, $threshold, $operator)) { $predicted = $leftLabel; } else { $predicted = $rightLabel; } $target = $targets[$index]; if ((string) $predicted != (string) $targets[$index]) { $wrong += $this->weights[$index]; } if (!isset($prob[$predicted][$target])) { $prob[$predicted][$target] = 0; } ++$prob[$predicted][$target]; } // Calculate probabilities: Proportion of labels in each leaf $dist = array_combine($this->binaryLabels, array_fill(0, 2, 0.0)); foreach ($prob as $leaf => $counts) { $leafTotal = (float) array_sum($prob[$leaf]); foreach ($counts as $label => $count) { if ((string) $leaf == (string) $label) { $dist[$leaf] = $count / $leafTotal; } } } return [$wrong / (float) array_sum($this->weights), $dist]; }
[ "protected", "function", "calculateErrorRate", "(", "array", "$", "targets", ",", "float", "$", "threshold", ",", "string", "$", "operator", ",", "array", "$", "values", ")", ":", "array", "{", "$", "wrong", "=", "0.0", ";", "$", "prob", "=", "[", "]",...
Calculates the ratio of wrong predictions based on the new threshold value given as the parameter
[ "Calculates", "the", "ratio", "of", "wrong", "predictions", "based", "on", "the", "new", "threshold", "value", "given", "as", "the", "parameter" ]
f6aa1a59b0525b8fca3d2786d661ab3e70904016
https://github.com/php-ai/php-ml/blob/f6aa1a59b0525b8fca3d2786d661ab3e70904016/src/Classification/Linear/DecisionStump.php#L246-L284
train
Calculates the error rate for each leaf
[ 30522, 5123, 3853, 18422, 2121, 29165, 11657, 1006, 9140, 1002, 7889, 1010, 14257, 1002, 11207, 1010, 5164, 1002, 6872, 1010, 9140, 1002, 5300, 1007, 1024, 9140, 1063, 1002, 3308, 1027, 1014, 1012, 1014, 1025, 1002, 4013, 2497, 1027, 1031, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Console/Scheduling/CacheEventMutex.php
CacheEventMutex.forget
public function forget(Event $event) { $this->cache->store($this->store)->forget($event->mutexName()); }
php
public function forget(Event $event) { $this->cache->store($this->store)->forget($event->mutexName()); }
[ "public", "function", "forget", "(", "Event", "$", "event", ")", "{", "$", "this", "->", "cache", "->", "store", "(", "$", "this", "->", "store", ")", "->", "forget", "(", "$", "event", "->", "mutexName", "(", ")", ")", ";", "}" ]
Clear the event mutex for the given event. @param \Illuminate\Console\Scheduling\Event $event @return void
[ "Clear", "the", "event", "mutex", "for", "the", "given", "event", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Console/Scheduling/CacheEventMutex.php#L64-L67
train
Forget the cache for an event
[ 30522, 2270, 3853, 5293, 1006, 2724, 1002, 2724, 1007, 1063, 1002, 2023, 1011, 1028, 17053, 1011, 1028, 3573, 1006, 1002, 2023, 1011, 1028, 3573, 1007, 1011, 1028, 5293, 1006, 1002, 2724, 1011, 1028, 20101, 2595, 18442, 1006, 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...
getgrav/grav
system/src/Grav/Framework/Form/FormFlash.php
FormFlash.clearFiles
public function clearFiles() { foreach ($this->files as $field => $files) { foreach ($files as $name => $upload) { $this->removeTmpFile($upload['tmp_name'] ?? ''); } } $this->files = []; }
php
public function clearFiles() { foreach ($this->files as $field => $files) { foreach ($files as $name => $upload) { $this->removeTmpFile($upload['tmp_name'] ?? ''); } } $this->files = []; }
[ "public", "function", "clearFiles", "(", ")", "{", "foreach", "(", "$", "this", "->", "files", "as", "$", "field", "=>", "$", "files", ")", "{", "foreach", "(", "$", "files", "as", "$", "name", "=>", "$", "upload", ")", "{", "$", "this", "->", "r...
Clear form flash from all uploaded files.
[ "Clear", "form", "flash", "from", "all", "uploaded", "files", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Framework/Form/FormFlash.php#L323-L332
train
Clear all temporary files
[ 30522, 2270, 3853, 3154, 8873, 4244, 1006, 1007, 1063, 18921, 6776, 1006, 1002, 2023, 1011, 1028, 6764, 2004, 1002, 2492, 1027, 1028, 1002, 6764, 1007, 1063, 18921, 6776, 1006, 1002, 6764, 2004, 1002, 2171, 1027, 1028, 1002, 2039, 11066, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/EventListener/StreamedResponseListener.php
StreamedResponseListener.onKernelResponse
public function onKernelResponse(FilterResponseEvent $event) { if (!$event->isMasterRequest()) { return; } $response = $event->getResponse(); if ($response instanceof StreamedResponse) { $response->send(); } }
php
public function onKernelResponse(FilterResponseEvent $event) { if (!$event->isMasterRequest()) { return; } $response = $event->getResponse(); if ($response instanceof StreamedResponse) { $response->send(); } }
[ "public", "function", "onKernelResponse", "(", "FilterResponseEvent", "$", "event", ")", "{", "if", "(", "!", "$", "event", "->", "isMasterRequest", "(", ")", ")", "{", "return", ";", "}", "$", "response", "=", "$", "event", "->", "getResponse", "(", ")"...
Filters the Response.
[ "Filters", "the", "Response", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/EventListener/StreamedResponseListener.php#L32-L43
train
Called when kernel response is dispatched
[ 30522, 2270, 3853, 2006, 5484, 11877, 6072, 26029, 3366, 1006, 11307, 6072, 26029, 19763, 15338, 1002, 2724, 1007, 1063, 2065, 1006, 999, 1002, 2724, 1011, 1028, 2003, 8706, 2890, 15500, 1006, 1007, 1007, 1063, 2709, 1025, 1065, 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...
symfony/symfony
src/Symfony/Component/Cache/Simple/AbstractCache.php
AbstractCache.deleteMultiple
public function deleteMultiple($keys) { if ($keys instanceof \Traversable) { $keys = iterator_to_array($keys, false); } elseif (!\is_array($keys)) { throw new InvalidArgumentException(sprintf('Cache keys must be array or Traversable, "%s" given', \is_object($keys) ? \get_class($keys) : \gettype($keys))); } return $this->deleteItems($keys); }
php
public function deleteMultiple($keys) { if ($keys instanceof \Traversable) { $keys = iterator_to_array($keys, false); } elseif (!\is_array($keys)) { throw new InvalidArgumentException(sprintf('Cache keys must be array or Traversable, "%s" given', \is_object($keys) ? \get_class($keys) : \gettype($keys))); } return $this->deleteItems($keys); }
[ "public", "function", "deleteMultiple", "(", "$", "keys", ")", "{", "if", "(", "$", "keys", "instanceof", "\\", "Traversable", ")", "{", "$", "keys", "=", "iterator_to_array", "(", "$", "keys", ",", "false", ")", ";", "}", "elseif", "(", "!", "\\", "...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Cache/Simple/AbstractCache.php#L140-L149
train
Delete multiple cache items
[ 30522, 2270, 3853, 3972, 12870, 12274, 7096, 11514, 2571, 1006, 1002, 6309, 1007, 1063, 2065, 1006, 1002, 6309, 6013, 11253, 1032, 29053, 3085, 1007, 1063, 1002, 6309, 1027, 2009, 6906, 4263, 1035, 2000, 1035, 9140, 1006, 1002, 6309, 1010, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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.getResults
public function getResults() { return ! is_null($this->farParent->{$this->localKey}) ? $this->get() : $this->related->newCollection(); }
php
public function getResults() { return ! is_null($this->farParent->{$this->localKey}) ? $this->get() : $this->related->newCollection(); }
[ "public", "function", "getResults", "(", ")", "{", "return", "!", "is_null", "(", "$", "this", "->", "farParent", "->", "{", "$", "this", "->", "localKey", "}", ")", "?", "$", "this", "->", "get", "(", ")", ":", "$", "this", "->", "related", "->", ...
Get the results of the relationship. @return mixed
[ "Get", "the", "results", "of", "the", "relationship", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Relations/HasManyThrough.php#L344-L349
train
Get the results of the related objects
[ 30522, 2270, 3853, 2131, 6072, 11314, 2015, 1006, 1007, 1063, 2709, 999, 2003, 1035, 19701, 1006, 1002, 2023, 1011, 1028, 2521, 19362, 4765, 1011, 1028, 1063, 1002, 2023, 1011, 1028, 2334, 14839, 1065, 1007, 1029, 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
plugins/Actions/Columns/EntryPageUrl.php
EntryPageUrl.onExistingVisit
public function onExistingVisit(Request $request, Visitor $visitor, $action) { $idAction = $visitor->getVisitorColumn('visit_entry_idaction_url'); if (is_null($idAction) && !empty($action)) { $idAction = $action->getIdActionUrlForEntryAndExitIds(); if (!empty($idAction)) { return $idAction; } } return false; }
php
public function onExistingVisit(Request $request, Visitor $visitor, $action) { $idAction = $visitor->getVisitorColumn('visit_entry_idaction_url'); if (is_null($idAction) && !empty($action)) { $idAction = $action->getIdActionUrlForEntryAndExitIds(); if (!empty($idAction)) { return $idAction; } } return false; }
[ "public", "function", "onExistingVisit", "(", "Request", "$", "request", ",", "Visitor", "$", "visitor", ",", "$", "action", ")", "{", "$", "idAction", "=", "$", "visitor", "->", "getVisitorColumn", "(", "'visit_entry_idaction_url'", ")", ";", "if", "(", "is...
/* @param Request $request @param Visitor $visitor @param Action|null $action @return mixed
[ "/", "*" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Actions/Columns/EntryPageUrl.php#L66-L78
train
OnExistingVisit Callback Returns ID Action Url if found
[ 30522, 2270, 3853, 2028, 9048, 16643, 3070, 11365, 4183, 1006, 5227, 1002, 5227, 1010, 10367, 1002, 10367, 1010, 1002, 2895, 1007, 1063, 1002, 16096, 7542, 1027, 1002, 10367, 1011, 1028, 2131, 11365, 15660, 25778, 2819, 2078, 1006, 1005, 30...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Mail/Transport/MandrillTransport.php
MandrillTransport.send
public function send(Swift_Mime_SimpleMessage $message, &$failedRecipients = null) { $this->beforeSendPerformed($message); $this->client->request('POST', 'https://mandrillapp.com/api/1.0/messages/send-raw.json', [ 'form_params' => [ 'key' => $this->key, 'to' => $this->getTo($message), 'raw_message' => $message->toString(), 'async' => true, ], ]); $this->sendPerformed($message); return $this->numberOfRecipients($message); }
php
public function send(Swift_Mime_SimpleMessage $message, &$failedRecipients = null) { $this->beforeSendPerformed($message); $this->client->request('POST', 'https://mandrillapp.com/api/1.0/messages/send-raw.json', [ 'form_params' => [ 'key' => $this->key, 'to' => $this->getTo($message), 'raw_message' => $message->toString(), 'async' => true, ], ]); $this->sendPerformed($message); return $this->numberOfRecipients($message); }
[ "public", "function", "send", "(", "Swift_Mime_SimpleMessage", "$", "message", ",", "&", "$", "failedRecipients", "=", "null", ")", "{", "$", "this", "->", "beforeSendPerformed", "(", "$", "message", ")", ";", "$", "this", "->", "client", "->", "request", ...
{@inheritdoc}
[ "{" ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Mail/Transport/MandrillTransport.php#L40-L56
train
Sends a Swift_Mime_SimpleMessage to the MandrillApp.
[ 30522, 2270, 3853, 4604, 1006, 9170, 1035, 2771, 4168, 1035, 3722, 7834, 3736, 3351, 1002, 4471, 1010, 1004, 1002, 3478, 2890, 6895, 14756, 7666, 1027, 19701, 1007, 1063, 1002, 2023, 1011, 1028, 2077, 5054, 18927, 2121, 29021, 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
libs/Zend/Db/Statement/Pdo.php
Zend_Db_Statement_Pdo.getAttribute
public function getAttribute($key) { try { return $this->_stmt->getAttribute($key); } catch (PDOException $e) { // require_once 'Zend/Db/Statement/Exception.php'; throw new Zend_Db_Statement_Exception($e->getMessage(), $e->getCode(), $e); } }
php
public function getAttribute($key) { try { return $this->_stmt->getAttribute($key); } catch (PDOException $e) { // require_once 'Zend/Db/Statement/Exception.php'; throw new Zend_Db_Statement_Exception($e->getMessage(), $e->getCode(), $e); } }
[ "public", "function", "getAttribute", "(", "$", "key", ")", "{", "try", "{", "return", "$", "this", "->", "_stmt", "->", "getAttribute", "(", "$", "key", ")", ";", "}", "catch", "(", "PDOException", "$", "e", ")", "{", "// require_once 'Zend/Db/Statement/E...
Retrieve a statement attribute. @param integer $key Attribute name. @return mixed Attribute value. @throws Zend_Db_Statement_Exception
[ "Retrieve", "a", "statement", "attribute", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Statement/Pdo.php#L340-L348
train
Get attribute value
[ 30522, 2270, 3853, 2131, 19321, 3089, 8569, 2618, 1006, 1002, 3145, 1007, 1063, 3046, 1063, 2709, 1002, 2023, 1011, 1028, 1035, 2358, 20492, 1011, 1028, 2131, 19321, 3089, 8569, 2618, 1006, 1002, 3145, 1007, 1025, 1065, 4608, 1006, 22851, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Query/Grammars/PostgresGrammar.php
PostgresGrammar.compileUpdate
public function compileUpdate(Builder $query, $values) { $table = $this->wrapTable($query->from); // Each one of the columns in the update statements needs to be wrapped in the // keyword identifiers, also a place-holder needs to be created for each of // the values in the list of bindings so we can make the sets statements. $columns = $this->compileUpdateColumns($query, $values); $from = $this->compileUpdateFrom($query); $where = $this->compileUpdateWheres($query); return trim("update {$table} set {$columns}{$from} {$where}"); }
php
public function compileUpdate(Builder $query, $values) { $table = $this->wrapTable($query->from); // Each one of the columns in the update statements needs to be wrapped in the // keyword identifiers, also a place-holder needs to be created for each of // the values in the list of bindings so we can make the sets statements. $columns = $this->compileUpdateColumns($query, $values); $from = $this->compileUpdateFrom($query); $where = $this->compileUpdateWheres($query); return trim("update {$table} set {$columns}{$from} {$where}"); }
[ "public", "function", "compileUpdate", "(", "Builder", "$", "query", ",", "$", "values", ")", "{", "$", "table", "=", "$", "this", "->", "wrapTable", "(", "$", "query", "->", "from", ")", ";", "// Each one of the columns in the update statements needs to be wrappe...
Compile an update statement into SQL. @param \Illuminate\Database\Query\Builder $query @param array $values @return string
[ "Compile", "an", "update", "statement", "into", "SQL", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Query/Grammars/PostgresGrammar.php#L222-L236
train
Compiles an update statement into SQL
[ 30522, 2270, 3853, 4012, 22090, 6279, 13701, 1006, 12508, 1002, 23032, 1010, 1002, 5300, 1007, 1063, 1002, 2795, 1027, 1002, 2023, 1011, 1028, 10236, 10880, 1006, 1002, 23032, 1011, 1028, 2013, 1007, 1025, 1013, 1013, 2169, 2028, 1997, 1996...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/BeautifyTimeRangeLabels.php
BeautifyTimeRangeLabels.getUnboundedLabel
public function getUnboundedLabel($oldLabel, $lowerBound) { if ($lowerBound < 60) { return sprintf($this->labelSecondsPlural, $lowerBound); } else { // since we're using minutes, we use floor so 1801s+ will be 30m+ and not 31m+ return sprintf($this->labelPlural, "" . floor($lowerBound / 60) . urlencode('+')); } }
php
public function getUnboundedLabel($oldLabel, $lowerBound) { if ($lowerBound < 60) { return sprintf($this->labelSecondsPlural, $lowerBound); } else { // since we're using minutes, we use floor so 1801s+ will be 30m+ and not 31m+ return sprintf($this->labelPlural, "" . floor($lowerBound / 60) . urlencode('+')); } }
[ "public", "function", "getUnboundedLabel", "(", "$", "oldLabel", ",", "$", "lowerBound", ")", "{", "if", "(", "$", "lowerBound", "<", "60", ")", "{", "return", "sprintf", "(", "$", "this", "->", "labelSecondsPlural", ",", "$", "lowerBound", ")", ";", "}"...
Beautifies and returns a range label whose range is unbounded, ie 5+, 10+, etc. If the lower bound of the range is less than 60 the pretty range label will be in seconds. Otherwise, it will be in minutes. @param string $oldLabel The original label value. @param int $lowerBound The lower bound of the range. @return string The pretty range label.
[ "Beautifies", "and", "returns", "a", "range", "label", "whose", "range", "is", "unbounded", "ie", "5", "+", "10", "+", "etc", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/DataTable/Filter/BeautifyTimeRangeLabels.php#L112-L120
train
Returns the unbounded label
[ 30522, 2270, 3853, 2131, 4609, 15494, 2098, 20470, 2884, 1006, 1002, 2214, 20470, 2884, 1010, 1002, 2896, 15494, 1007, 1063, 2065, 1006, 1002, 2896, 15494, 1026, 3438, 1007, 1063, 2709, 9043, 2546, 1006, 1002, 2023, 1011, 1028, 10873, 8586,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Response.php
Response.getMessageFromException
protected function getMessageFromException($e) { // Note: duplicated from FormDatabaseSetup.isAccessDenied // Avoid leaking the username/db name when access denied if ($e->getCode() == 1044 || $e->getCode() == 42000) { return "Error while connecting to the Matomo database - please check your credentials in config/config.ini.php file"; } if (Common::isPhpCliMode()) { return $e->getMessage() . "\n" . $e->getTraceAsString(); } return $e->getMessage(); }
php
protected function getMessageFromException($e) { // Note: duplicated from FormDatabaseSetup.isAccessDenied // Avoid leaking the username/db name when access denied if ($e->getCode() == 1044 || $e->getCode() == 42000) { return "Error while connecting to the Matomo database - please check your credentials in config/config.ini.php file"; } if (Common::isPhpCliMode()) { return $e->getMessage() . "\n" . $e->getTraceAsString(); } return $e->getMessage(); }
[ "protected", "function", "getMessageFromException", "(", "$", "e", ")", "{", "// Note: duplicated from FormDatabaseSetup.isAccessDenied", "// Avoid leaking the username/db name when access denied", "if", "(", "$", "e", "->", "getCode", "(", ")", "==", "1044", "||", "$", "...
Gets the error message to output when a tracking request fails. @param Exception $e @return string
[ "Gets", "the", "error", "message", "to", "output", "when", "a", "tracking", "request", "fails", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Tracker/Response.php#L168-L181
train
Returns the message from an exception
[ 30522, 5123, 3853, 2131, 7834, 3736, 3351, 19699, 8462, 2595, 24422, 1006, 1002, 1041, 1007, 1063, 1013, 1013, 3602, 1024, 24473, 2094, 2013, 2433, 2850, 2696, 15058, 13462, 6279, 1012, 18061, 9468, 7971, 4181, 6340, 1013, 1013, 4468, 24325...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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.invalidJson
protected function invalidJson($request, ValidationException $exception) { return response()->json([ 'message' => $exception->getMessage(), 'errors' => $exception->errors(), ], $exception->status); }
php
protected function invalidJson($request, ValidationException $exception) { return response()->json([ 'message' => $exception->getMessage(), 'errors' => $exception->errors(), ], $exception->status); }
[ "protected", "function", "invalidJson", "(", "$", "request", ",", "ValidationException", "$", "exception", ")", "{", "return", "response", "(", ")", "->", "json", "(", "[", "'message'", "=>", "$", "exception", "->", "getMessage", "(", ")", ",", "'errors'", ...
Convert a validation exception into a JSON response. @param \Illuminate\Http\Request $request @param \Illuminate\Validation\ValidationException $exception @return \Illuminate\Http\JsonResponse
[ "Convert", "a", "validation", "exception", "into", "a", "JSON", "response", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Foundation/Exceptions/Handler.php#L263-L269
train
Return a JSON error response
[ 30522, 5123, 3853, 19528, 22578, 2239, 1006, 1002, 5227, 1010, 27354, 10288, 24422, 1002, 6453, 1007, 1063, 2709, 3433, 1006, 1007, 1011, 1028, 1046, 3385, 1006, 1031, 1005, 4471, 1005, 1027, 1028, 1002, 6453, 1011, 1028, 2131, 7834, 3736, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/NodeVisitor/Scope.php
Scope.has
public function has($key) { if (\array_key_exists($key, $this->data)) { return true; } if (null === $this->parent) { return false; } return $this->parent->has($key); }
php
public function has($key) { if (\array_key_exists($key, $this->data)) { return true; } if (null === $this->parent) { return false; } return $this->parent->has($key); }
[ "public", "function", "has", "(", "$", "key", ")", "{", "if", "(", "\\", "array_key_exists", "(", "$", "key", ",", "$", "this", "->", "data", ")", ")", "{", "return", "true", ";", "}", "if", "(", "null", "===", "$", "this", "->", "parent", ")", ...
Tests if a data is visible from current scope. @param string $key @return bool
[ "Tests", "if", "a", "data", "is", "visible", "from", "current", "scope", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bridge/Twig/NodeVisitor/Scope.php#L78-L89
train
Has the key in the data array?
[ 30522, 2270, 3853, 2038, 1006, 1002, 3145, 1007, 1063, 2065, 1006, 1032, 9140, 1035, 3145, 1035, 6526, 1006, 1002, 3145, 1010, 1002, 2023, 1011, 1028, 2951, 1007, 1007, 1063, 2709, 2995, 1025, 1065, 2065, 1006, 19701, 1027, 1027, 1027, 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/Translation/Loader/CsvFileLoader.php
CsvFileLoader.loadResource
protected function loadResource($resource) { $messages = []; try { $file = new \SplFileObject($resource, 'rb'); } catch (\RuntimeException $e) { throw new NotFoundResourceException(sprintf('Error opening file "%s".', $resource), 0, $e); } $file->setFlags(\SplFileObject::READ_CSV | \SplFileObject::SKIP_EMPTY); $file->setCsvControl($this->delimiter, $this->enclosure, $this->escape); foreach ($file as $data) { if ('#' !== substr($data[0], 0, 1) && isset($data[1]) && 2 === \count($data)) { $messages[$data[0]] = $data[1]; } } return $messages; }
php
protected function loadResource($resource) { $messages = []; try { $file = new \SplFileObject($resource, 'rb'); } catch (\RuntimeException $e) { throw new NotFoundResourceException(sprintf('Error opening file "%s".', $resource), 0, $e); } $file->setFlags(\SplFileObject::READ_CSV | \SplFileObject::SKIP_EMPTY); $file->setCsvControl($this->delimiter, $this->enclosure, $this->escape); foreach ($file as $data) { if ('#' !== substr($data[0], 0, 1) && isset($data[1]) && 2 === \count($data)) { $messages[$data[0]] = $data[1]; } } return $messages; }
[ "protected", "function", "loadResource", "(", "$", "resource", ")", "{", "$", "messages", "=", "[", "]", ";", "try", "{", "$", "file", "=", "new", "\\", "SplFileObject", "(", "$", "resource", ",", "'rb'", ")", ";", "}", "catch", "(", "\\", "RuntimeEx...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Translation/Loader/CsvFileLoader.php#L30-L50
train
Load the messages from a resource
[ 30522, 5123, 3853, 7170, 6072, 8162, 3401, 1006, 1002, 7692, 1007, 1063, 1002, 7696, 1027, 1031, 1033, 1025, 3046, 1063, 1002, 5371, 1027, 2047, 1032, 11867, 10270, 9463, 16429, 20614, 1006, 1002, 7692, 1010, 1005, 21144, 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...
laravel/framework
src/Illuminate/Redis/Connectors/PhpRedisConnector.php
PhpRedisConnector.connect
public function connect(array $config, array $options) { return new PhpRedisConnection($this->createClient(array_merge( $config, $options, Arr::pull($config, 'options', []) ))); }
php
public function connect(array $config, array $options) { return new PhpRedisConnection($this->createClient(array_merge( $config, $options, Arr::pull($config, 'options', []) ))); }
[ "public", "function", "connect", "(", "array", "$", "config", ",", "array", "$", "options", ")", "{", "return", "new", "PhpRedisConnection", "(", "$", "this", "->", "createClient", "(", "array_merge", "(", "$", "config", ",", "$", "options", ",", "Arr", ...
Create a new clustered PhpRedis connection. @param array $config @param array $options @return \Illuminate\Redis\Connections\PhpRedisConnection
[ "Create", "a", "new", "clustered", "PhpRedis", "connection", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Redis/Connectors/PhpRedisConnector.php#L20-L25
train
Connect to the Redis server
[ 30522, 2270, 3853, 7532, 1006, 9140, 1002, 9530, 8873, 2290, 1010, 9140, 1002, 7047, 1007, 1063, 2709, 2047, 25718, 5596, 2483, 8663, 2638, 7542, 1006, 1002, 2023, 1011, 1028, 3443, 20464, 11638, 1006, 9140, 1035, 13590, 1006, 1002, 9530, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/CssSelector/XPath/Extension/NodeExtension.php
NodeExtension.getNodeTranslators
public function getNodeTranslators() { return [ 'Selector' => [$this, 'translateSelector'], 'CombinedSelector' => [$this, 'translateCombinedSelector'], 'Negation' => [$this, 'translateNegation'], 'Function' => [$this, 'translateFunction'], 'Pseudo' => [$this, 'translatePseudo'], 'Attribute' => [$this, 'translateAttribute'], 'Class' => [$this, 'translateClass'], 'Hash' => [$this, 'translateHash'], 'Element' => [$this, 'translateElement'], ]; }
php
public function getNodeTranslators() { return [ 'Selector' => [$this, 'translateSelector'], 'CombinedSelector' => [$this, 'translateCombinedSelector'], 'Negation' => [$this, 'translateNegation'], 'Function' => [$this, 'translateFunction'], 'Pseudo' => [$this, 'translatePseudo'], 'Attribute' => [$this, 'translateAttribute'], 'Class' => [$this, 'translateClass'], 'Hash' => [$this, 'translateHash'], 'Element' => [$this, 'translateElement'], ]; }
[ "public", "function", "getNodeTranslators", "(", ")", "{", "return", "[", "'Selector'", "=>", "[", "$", "this", ",", "'translateSelector'", "]", ",", "'CombinedSelector'", "=>", "[", "$", "this", ",", "'translateCombinedSelector'", "]", ",", "'Negation'", "=>", ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/CssSelector/XPath/Extension/NodeExtension.php#L65-L78
train
Get node translators
[ 30522, 2270, 3853, 2131, 3630, 3207, 6494, 3619, 20051, 5668, 1006, 1007, 1063, 2709, 1031, 1005, 27000, 1005, 1027, 1028, 1031, 1002, 2023, 1010, 1005, 16315, 12260, 16761, 1005, 1033, 1010, 1005, 4117, 11246, 22471, 2953, 1005, 1027, 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...
octobercms/october
modules/cms/ServiceProvider.php
ServiceProvider.register
public function register() { parent::register('cms'); $this->registerComponents(); $this->registerThemeLogging(); $this->registerCombinerEvents(); /* * Backend specific */ if (App::runningInBackend()) { $this->registerBackendNavigation(); $this->registerBackendReportWidgets(); $this->registerBackendPermissions(); $this->registerBackendWidgets(); $this->registerBackendSettings(); } }
php
public function register() { parent::register('cms'); $this->registerComponents(); $this->registerThemeLogging(); $this->registerCombinerEvents(); /* * Backend specific */ if (App::runningInBackend()) { $this->registerBackendNavigation(); $this->registerBackendReportWidgets(); $this->registerBackendPermissions(); $this->registerBackendWidgets(); $this->registerBackendSettings(); } }
[ "public", "function", "register", "(", ")", "{", "parent", "::", "register", "(", "'cms'", ")", ";", "$", "this", "->", "registerComponents", "(", ")", ";", "$", "this", "->", "registerThemeLogging", "(", ")", ";", "$", "this", "->", "registerCombinerEvent...
Register the service provider. @return void
[ "Register", "the", "service", "provider", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/ServiceProvider.php#L25-L43
train
Registers the CMS components and components
[ 30522, 2270, 3853, 4236, 1006, 1007, 1063, 6687, 1024, 1024, 4236, 1006, 1005, 4642, 2015, 1005, 1007, 1025, 1002, 2023, 1011, 1028, 4236, 9006, 29513, 7666, 1006, 1007, 1025, 1002, 2023, 1011, 1028, 4236, 10760, 10199, 8649, 4726, 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...
matomo-org/matomo
core/NumberFormatter.php
NumberFormatter.formatNumber
public function formatNumber($value, $maximumFractionDigits=0, $minimumFractionDigits=0) { $pattern = $this->getPattern($value, 'Intl_NumberFormatNumber'); return $this->formatNumberWithPattern($pattern, $value, $maximumFractionDigits, $minimumFractionDigits); }
php
public function formatNumber($value, $maximumFractionDigits=0, $minimumFractionDigits=0) { $pattern = $this->getPattern($value, 'Intl_NumberFormatNumber'); return $this->formatNumberWithPattern($pattern, $value, $maximumFractionDigits, $minimumFractionDigits); }
[ "public", "function", "formatNumber", "(", "$", "value", ",", "$", "maximumFractionDigits", "=", "0", ",", "$", "minimumFractionDigits", "=", "0", ")", "{", "$", "pattern", "=", "$", "this", "->", "getPattern", "(", "$", "value", ",", "'Intl_NumberFormatNumb...
Formats a given number @see \Piwik\NumberFormatter::format() @param string|int|float $value @param int $maximumFractionDigits @param int $minimumFractionDigits @return mixed|string
[ "Formats", "a", "given", "number" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/NumberFormatter.php#L73-L78
train
Format a number using the Intl NumberFormatNumber class
[ 30522, 2270, 3853, 4289, 19172, 5677, 1006, 1002, 3643, 1010, 1002, 4555, 27843, 7542, 4305, 23806, 2015, 1027, 1014, 1010, 1002, 6263, 27843, 7542, 4305, 23806, 2015, 1027, 1014, 1007, 1063, 1002, 5418, 1027, 1002, 2023, 1011, 1028, 2131, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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.deleteSiteAliasUrls
public function deleteSiteAliasUrls($idsite) { $db = $this->getDb(); $db->query("DELETE FROM " . Common::prefixTable("site_url") . " WHERE idsite = ?", $idsite); }
php
public function deleteSiteAliasUrls($idsite) { $db = $this->getDb(); $db->query("DELETE FROM " . Common::prefixTable("site_url") . " WHERE idsite = ?", $idsite); }
[ "public", "function", "deleteSiteAliasUrls", "(", "$", "idsite", ")", "{", "$", "db", "=", "$", "this", "->", "getDb", "(", ")", ";", "$", "db", "->", "query", "(", "\"DELETE FROM \"", ".", "Common", "::", "prefixTable", "(", "\"site_url\"", ")", ".", ...
Delete all the alias URLs for the given idSite.
[ "Delete", "all", "the", "alias", "URLs", "for", "the", "given", "idSite", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/SitesManager/Model.php#L436-L440
train
Delete all alias URLs for a site
[ 30522, 2270, 3853, 3972, 12870, 28032, 15879, 7951, 3126, 4877, 1006, 1002, 8909, 28032, 2063, 1007, 1063, 1002, 16962, 1027, 1002, 2023, 1011, 1028, 2131, 18939, 1006, 1007, 1025, 1002, 16962, 1011, 1028, 23032, 1006, 1000, 3972, 12870, 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...
getgrav/grav
system/src/Grav/Common/Iterator.php
Iterator.nth
public function nth($key) { $items = array_keys($this->items); return isset($items[$key]) ? $this->offsetGet($items[$key]) : false; }
php
public function nth($key) { $items = array_keys($this->items); return isset($items[$key]) ? $this->offsetGet($items[$key]) : false; }
[ "public", "function", "nth", "(", "$", "key", ")", "{", "$", "items", "=", "array_keys", "(", "$", "this", "->", "items", ")", ";", "return", "isset", "(", "$", "items", "[", "$", "key", "]", ")", "?", "$", "this", "->", "offsetGet", "(", "$", ...
Return nth item. @param int $key @return mixed|bool
[ "Return", "nth", "item", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Iterator.php#L90-L95
train
Get nth item
[ 30522, 2270, 3853, 23961, 2232, 1006, 1002, 3145, 1007, 1063, 1002, 5167, 1027, 9140, 1035, 6309, 1006, 1002, 2023, 1011, 1028, 5167, 1007, 1025, 2709, 26354, 3388, 1006, 1002, 5167, 1031, 1002, 3145, 1033, 1007, 1029, 1002, 2023, 1011, 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/Relations/HasOneOrMany.php
HasOneOrMany.matchOne
public function matchOne(array $models, Collection $results, $relation) { return $this->matchOneOrMany($models, $results, $relation, 'one'); }
php
public function matchOne(array $models, Collection $results, $relation) { return $this->matchOneOrMany($models, $results, $relation, 'one'); }
[ "public", "function", "matchOne", "(", "array", "$", "models", ",", "Collection", "$", "results", ",", "$", "relation", ")", "{", "return", "$", "this", "->", "matchOneOrMany", "(", "$", "models", ",", "$", "results", ",", "$", "relation", ",", "'one'", ...
Match the eagerly loaded results to their single parents. @param array $models @param \Illuminate\Database\Eloquent\Collection $results @param string $relation @return array
[ "Match", "the", "eagerly", "loaded", "results", "to", "their", "single", "parents", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Relations/HasOneOrMany.php#L99-L102
train
Match one or many
[ 30522, 2270, 3853, 2674, 5643, 1006, 9140, 1002, 4275, 1010, 3074, 1002, 3463, 1010, 1002, 7189, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 2674, 5643, 2953, 2386, 2100, 1006, 1002, 4275, 1010, 1002, 3463, 1010, 1002, 7189, 1010, 1005, 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...
overtrue/wechat
src/Payment/Jssdk/Client.php
Client.appConfig
public function appConfig(string $prepayId): array { $params = [ 'appid' => $this->app['config']->app_id, 'partnerid' => $this->app['config']->mch_id, 'prepayid' => $prepayId, 'noncestr' => uniqid(), 'timestamp' => time(), 'package' => 'Sign=WXPay', ]; $params['sign'] = Support\generate_sign($params, $this->app['config']->key); return $params; }
php
public function appConfig(string $prepayId): array { $params = [ 'appid' => $this->app['config']->app_id, 'partnerid' => $this->app['config']->mch_id, 'prepayid' => $prepayId, 'noncestr' => uniqid(), 'timestamp' => time(), 'package' => 'Sign=WXPay', ]; $params['sign'] = Support\generate_sign($params, $this->app['config']->key); return $params; }
[ "public", "function", "appConfig", "(", "string", "$", "prepayId", ")", ":", "array", "{", "$", "params", "=", "[", "'appid'", "=>", "$", "this", "->", "app", "[", "'config'", "]", "->", "app_id", ",", "'partnerid'", "=>", "$", "this", "->", "app", "...
Generate app payment parameters. @param string $prepayId @return array
[ "Generate", "app", "payment", "parameters", "." ]
120c72faaa93c270365bc75c73c362d5fd583209
https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/Payment/Jssdk/Client.php#L83-L97
train
Generate the parameters for the app
[ 30522, 2270, 3853, 10439, 8663, 8873, 2290, 1006, 5164, 1002, 17463, 4710, 3593, 1007, 1024, 9140, 1063, 1002, 11498, 5244, 1027, 1031, 1005, 10439, 3593, 1005, 1027, 1028, 1002, 2023, 1011, 1028, 10439, 1031, 1005, 9530, 8873, 2290, 1005, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Query/Grammars/Grammar.php
Grammar.compileOrders
protected function compileOrders(Builder $query, $orders) { if (! empty($orders)) { return 'order by '.implode(', ', $this->compileOrdersToArray($query, $orders)); } return ''; }
php
protected function compileOrders(Builder $query, $orders) { if (! empty($orders)) { return 'order by '.implode(', ', $this->compileOrdersToArray($query, $orders)); } return ''; }
[ "protected", "function", "compileOrders", "(", "Builder", "$", "query", ",", "$", "orders", ")", "{", "if", "(", "!", "empty", "(", "$", "orders", ")", ")", "{", "return", "'order by '", ".", "implode", "(", "', '", ",", "$", "this", "->", "compileOrde...
Compile the "order by" portions of the query. @param \Illuminate\Database\Query\Builder $query @param array $orders @return string
[ "Compile", "the", "order", "by", "portions", "of", "the", "query", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Query/Grammars/Grammar.php#L717-L724
train
Compiles order by clauses into a string
[ 30522, 5123, 3853, 4012, 22090, 8551, 2545, 1006, 12508, 1002, 23032, 1010, 1002, 4449, 1007, 1063, 2065, 1006, 999, 4064, 1006, 1002, 4449, 1007, 1007, 1063, 2709, 1005, 2344, 2011, 1005, 1012, 17727, 4135, 3207, 1006, 1005, 1010, 1005, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Redis/RedisManager.php
RedisManager.configure
protected function configure(Connection $connection, $name) { $connection->setName($name); if ($this->events && $this->app->bound('events')) { $connection->setEventDispatcher($this->app->make('events')); } return $connection; }
php
protected function configure(Connection $connection, $name) { $connection->setName($name); if ($this->events && $this->app->bound('events')) { $connection->setEventDispatcher($this->app->make('events')); } return $connection; }
[ "protected", "function", "configure", "(", "Connection", "$", "connection", ",", "$", "name", ")", "{", "$", "connection", "->", "setName", "(", "$", "name", ")", ";", "if", "(", "$", "this", "->", "events", "&&", "$", "this", "->", "app", "->", "bou...
Configure the given connection to prepare it for commands. @param \Illuminate\Redis\Connections\Connection $connection @param string $name @return \Illuminate\Redis\Connections\Connection
[ "Configure", "the", "given", "connection", "to", "prepare", "it", "for", "commands", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Redis/RedisManager.php#L130-L139
train
Configure the connection
[ 30522, 5123, 3853, 9530, 8873, 27390, 2063, 1006, 4434, 1002, 4434, 1010, 1002, 2171, 1007, 1063, 1002, 4434, 1011, 1028, 2275, 18442, 1006, 1002, 2171, 1007, 1025, 2065, 1006, 1002, 2023, 1011, 1028, 2824, 1004, 1004, 1002, 2023, 1011, 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...
symfony/symfony
src/Symfony/Component/Form/Extension/Core/Type/DateType.php
DateType.configureOptions
public function configureOptions(OptionsResolver $resolver) { $compound = function (Options $options) { return 'single_text' !== $options['widget']; }; $placeholderDefault = function (Options $options) { return $options['required'] ? null : ''; }; $placeholderNormalizer = function (Options $options, $placeholder) use ($placeholderDefault) { if (\is_array($placeholder)) { $default = $placeholderDefault($options); return array_merge( ['year' => $default, 'month' => $default, 'day' => $default], $placeholder ); } return [ 'year' => $placeholder, 'month' => $placeholder, 'day' => $placeholder, ]; }; $choiceTranslationDomainNormalizer = function (Options $options, $choiceTranslationDomain) { if (\is_array($choiceTranslationDomain)) { $default = false; return array_replace( ['year' => $default, 'month' => $default, 'day' => $default], $choiceTranslationDomain ); } return [ 'year' => $choiceTranslationDomain, 'month' => $choiceTranslationDomain, 'day' => $choiceTranslationDomain, ]; }; $format = function (Options $options) { return 'single_text' === $options['widget'] ? self::HTML5_FORMAT : self::DEFAULT_FORMAT; }; $resolver->setDefaults([ 'years' => range(date('Y') - 5, date('Y') + 5), 'months' => range(1, 12), 'days' => range(1, 31), 'widget' => 'choice', 'input' => 'datetime', 'format' => $format, 'model_timezone' => null, 'view_timezone' => null, 'placeholder' => $placeholderDefault, 'html5' => true, // Don't modify \DateTime classes by reference, we treat // them like immutable value objects 'by_reference' => false, 'error_bubbling' => false, // If initialized with a \DateTime object, FormType initializes // this option to "\DateTime". Since the internal, normalized // representation is not \DateTime, but an array, we need to unset // this option. 'data_class' => null, 'compound' => $compound, 'empty_data' => function (Options $options) { return $options['compound'] ? [] : ''; }, 'choice_translation_domain' => false, 'input_format' => 'Y-m-d', ]); $resolver->setNormalizer('placeholder', $placeholderNormalizer); $resolver->setNormalizer('choice_translation_domain', $choiceTranslationDomainNormalizer); $resolver->setAllowedValues('input', [ 'datetime', 'datetime_immutable', 'string', 'timestamp', 'array', ]); $resolver->setAllowedValues('widget', [ 'single_text', 'text', 'choice', ]); $resolver->setAllowedTypes('format', ['int', 'string']); $resolver->setAllowedTypes('years', 'array'); $resolver->setAllowedTypes('months', 'array'); $resolver->setAllowedTypes('days', 'array'); $resolver->setAllowedTypes('input_format', 'string'); $resolver->setDeprecated('html5', function (Options $options, $html5) { if ($html5 && 'single_text' === $options['widget'] && self::HTML5_FORMAT !== $options['format']) { return sprintf('Using a custom format when the "html5" option of %s is enabled is deprecated since Symfony 4.3 and will lead to an exception in 5.0.', self::class); //throw new LogicException(sprintf('Cannot use the "format" option of %s when the "html5" option is disabled.', self::class)); } return ''; }); }
php
public function configureOptions(OptionsResolver $resolver) { $compound = function (Options $options) { return 'single_text' !== $options['widget']; }; $placeholderDefault = function (Options $options) { return $options['required'] ? null : ''; }; $placeholderNormalizer = function (Options $options, $placeholder) use ($placeholderDefault) { if (\is_array($placeholder)) { $default = $placeholderDefault($options); return array_merge( ['year' => $default, 'month' => $default, 'day' => $default], $placeholder ); } return [ 'year' => $placeholder, 'month' => $placeholder, 'day' => $placeholder, ]; }; $choiceTranslationDomainNormalizer = function (Options $options, $choiceTranslationDomain) { if (\is_array($choiceTranslationDomain)) { $default = false; return array_replace( ['year' => $default, 'month' => $default, 'day' => $default], $choiceTranslationDomain ); } return [ 'year' => $choiceTranslationDomain, 'month' => $choiceTranslationDomain, 'day' => $choiceTranslationDomain, ]; }; $format = function (Options $options) { return 'single_text' === $options['widget'] ? self::HTML5_FORMAT : self::DEFAULT_FORMAT; }; $resolver->setDefaults([ 'years' => range(date('Y') - 5, date('Y') + 5), 'months' => range(1, 12), 'days' => range(1, 31), 'widget' => 'choice', 'input' => 'datetime', 'format' => $format, 'model_timezone' => null, 'view_timezone' => null, 'placeholder' => $placeholderDefault, 'html5' => true, // Don't modify \DateTime classes by reference, we treat // them like immutable value objects 'by_reference' => false, 'error_bubbling' => false, // If initialized with a \DateTime object, FormType initializes // this option to "\DateTime". Since the internal, normalized // representation is not \DateTime, but an array, we need to unset // this option. 'data_class' => null, 'compound' => $compound, 'empty_data' => function (Options $options) { return $options['compound'] ? [] : ''; }, 'choice_translation_domain' => false, 'input_format' => 'Y-m-d', ]); $resolver->setNormalizer('placeholder', $placeholderNormalizer); $resolver->setNormalizer('choice_translation_domain', $choiceTranslationDomainNormalizer); $resolver->setAllowedValues('input', [ 'datetime', 'datetime_immutable', 'string', 'timestamp', 'array', ]); $resolver->setAllowedValues('widget', [ 'single_text', 'text', 'choice', ]); $resolver->setAllowedTypes('format', ['int', 'string']); $resolver->setAllowedTypes('years', 'array'); $resolver->setAllowedTypes('months', 'array'); $resolver->setAllowedTypes('days', 'array'); $resolver->setAllowedTypes('input_format', 'string'); $resolver->setDeprecated('html5', function (Options $options, $html5) { if ($html5 && 'single_text' === $options['widget'] && self::HTML5_FORMAT !== $options['format']) { return sprintf('Using a custom format when the "html5" option of %s is enabled is deprecated since Symfony 4.3 and will lead to an exception in 5.0.', self::class); //throw new LogicException(sprintf('Cannot use the "format" option of %s when the "html5" option is disabled.', self::class)); } return ''; }); }
[ "public", "function", "configureOptions", "(", "OptionsResolver", "$", "resolver", ")", "{", "$", "compound", "=", "function", "(", "Options", "$", "options", ")", "{", "return", "'single_text'", "!==", "$", "options", "[", "'widget'", "]", ";", "}", ";", ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Extension/Core/Type/DateType.php#L213-L319
train
Configures the options for the language level.
[ 30522, 2270, 3853, 9530, 8873, 27390, 8780, 16790, 2015, 1006, 7047, 6072, 4747, 6299, 1002, 10663, 2099, 1007, 1063, 1002, 7328, 1027, 3853, 1006, 7047, 1002, 7047, 1007, 1063, 2709, 1005, 2309, 1035, 3793, 1005, 999, 1027, 1027, 1002, 7...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Mail/Part.php
Zend_Mail_Part.getHeaderField
public function getHeaderField($name, $wantedPart = 0, $firstName = 0) { return Zend_Mime_Decode::splitHeaderField(current($this->getHeader($name, 'array')), $wantedPart, $firstName); }
php
public function getHeaderField($name, $wantedPart = 0, $firstName = 0) { return Zend_Mime_Decode::splitHeaderField(current($this->getHeader($name, 'array')), $wantedPart, $firstName); }
[ "public", "function", "getHeaderField", "(", "$", "name", ",", "$", "wantedPart", "=", "0", ",", "$", "firstName", "=", "0", ")", "{", "return", "Zend_Mime_Decode", "::", "splitHeaderField", "(", "current", "(", "$", "this", "->", "getHeader", "(", "$", ...
Get a specific field from a header like content type or all fields as array If the header occurs more than once, only the value from the first header is returned. Throws a Zend_Mail_Exception if the requested header does not exist. If the specific header field does not exist, returns null. @param string $name name of header, like in getHeader() @param string $wantedPart the wanted part, default is first, if null an array with all parts is returned @param string $firstName key name for the first part @return string|array wanted part or all parts as array($firstName => firstPart, partname => value) @throws Zend_Exception, Zend_Mail_Exception
[ "Get", "a", "specific", "field", "from", "a", "header", "like", "content", "type", "or", "all", "fields", "as", "array" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Mail/Part.php#L400-L402
train
Returns a header field as an array of parts
[ 30522, 2270, 3853, 2131, 4974, 2121, 3790, 1006, 1002, 2171, 1010, 1002, 2359, 19362, 2102, 1027, 1014, 1010, 1002, 2034, 18442, 1027, 1014, 1007, 1063, 2709, 16729, 2094, 1035, 2771, 4168, 1035, 21933, 3207, 1024, 1024, 3975, 4974, 2121, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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.each
public function each(\Closure $closure) { $data = []; foreach ($this->nodes as $i => $node) { $data[] = $closure($this->createSubCrawler($node), $i); } return $data; }
php
public function each(\Closure $closure) { $data = []; foreach ($this->nodes as $i => $node) { $data[] = $closure($this->createSubCrawler($node), $i); } return $data; }
[ "public", "function", "each", "(", "\\", "Closure", "$", "closure", ")", "{", "$", "data", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "nodes", "as", "$", "i", "=>", "$", "node", ")", "{", "$", "data", "[", "]", "=", "$", "closure", ...
Calls an anonymous function on each node of the list. The anonymous function receives the position and the node wrapped in a Crawler instance as arguments. Example: $crawler->filter('h1')->each(function ($node, $i) { return $node->text(); }); @param \Closure $closure An anonymous function @return array An array of values returned by the anonymous function
[ "Calls", "an", "anonymous", "function", "on", "each", "node", "of", "the", "list", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DomCrawler/Crawler.php#L355-L363
train
Get all nodes and return the result as array
[ 30522, 2270, 3853, 2169, 1006, 1032, 8503, 1002, 8503, 1007, 1063, 1002, 2951, 1027, 1031, 1033, 1025, 18921, 6776, 1006, 1002, 2023, 1011, 1028, 14164, 2004, 1002, 1045, 1027, 1028, 1002, 13045, 1007, 1063, 1002, 2951, 1031, 1033, 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...
symfony/symfony
src/Symfony/Component/Intl/Data/Generator/RegionDataGenerator.php
RegionDataGenerator.generateDataForLocale
protected function generateDataForLocale(BundleReaderInterface $reader, $tempDir, $displayLocale) { $localeBundle = $reader->read($tempDir, $displayLocale); // isset() on \ResourceBundle returns true even if the value is null if (isset($localeBundle['Countries']) && null !== $localeBundle['Countries']) { $data = [ 'Version' => $localeBundle['Version'], 'Names' => $this->generateRegionNames($localeBundle), ]; $this->regionCodes = array_merge($this->regionCodes, array_keys($data['Names'])); return $data; } }
php
protected function generateDataForLocale(BundleReaderInterface $reader, $tempDir, $displayLocale) { $localeBundle = $reader->read($tempDir, $displayLocale); // isset() on \ResourceBundle returns true even if the value is null if (isset($localeBundle['Countries']) && null !== $localeBundle['Countries']) { $data = [ 'Version' => $localeBundle['Version'], 'Names' => $this->generateRegionNames($localeBundle), ]; $this->regionCodes = array_merge($this->regionCodes, array_keys($data['Names'])); return $data; } }
[ "protected", "function", "generateDataForLocale", "(", "BundleReaderInterface", "$", "reader", ",", "$", "tempDir", ",", "$", "displayLocale", ")", "{", "$", "localeBundle", "=", "$", "reader", "->", "read", "(", "$", "tempDir", ",", "$", "displayLocale", ")",...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Intl/Data/Generator/RegionDataGenerator.php#L92-L107
train
Generate data for a locale
[ 30522, 5123, 3853, 7013, 6790, 29278, 4135, 9289, 2063, 1006, 14012, 16416, 4063, 18447, 2121, 12172, 1002, 8068, 1010, 1002, 8915, 8737, 4305, 2099, 1010, 1002, 4653, 4135, 9289, 2063, 1007, 1063, 1002, 2334, 15878, 8630, 2571, 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/HttpKernel/EventListener/ValidateRequestListener.php
ValidateRequestListener.onKernelRequest
public function onKernelRequest(GetResponseEvent $event) { if (!$event->isMasterRequest()) { return; } $request = $event->getRequest(); if ($request::getTrustedProxies()) { $request->getClientIps(); } $request->getHost(); }
php
public function onKernelRequest(GetResponseEvent $event) { if (!$event->isMasterRequest()) { return; } $request = $event->getRequest(); if ($request::getTrustedProxies()) { $request->getClientIps(); } $request->getHost(); }
[ "public", "function", "onKernelRequest", "(", "GetResponseEvent", "$", "event", ")", "{", "if", "(", "!", "$", "event", "->", "isMasterRequest", "(", ")", ")", "{", "return", ";", "}", "$", "request", "=", "$", "event", "->", "getRequest", "(", ")", ";...
Performs the validation.
[ "Performs", "the", "validation", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/EventListener/ValidateRequestListener.php#L30-L42
train
Called when kernel request is handled by the kernel.
[ 30522, 2270, 3853, 2006, 5484, 11877, 2890, 15500, 1006, 2131, 6072, 26029, 19763, 15338, 1002, 2724, 1007, 1063, 2065, 1006, 999, 1002, 2724, 1011, 1028, 2003, 8706, 2890, 15500, 1006, 1007, 1007, 1063, 2709, 1025, 1065, 1002, 5227, 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...
matomo-org/matomo
core/Context.php
Context.changeIdSite
public static function changeIdSite($idSite, $callback) { // temporarily set the idSite query parameter so archiving will end up using // the correct site aware caches $originalGetIdSite = isset($_GET['idSite']) ? $_GET['idSite'] : null; $originalPostIdSite = isset($_POST['idSite']) ? $_POST['idSite'] : null; $originalGetIdSites = isset($_GET['idSites']) ? $_GET['idSites'] : null; $originalPostIdSites = isset($_POST['idSites']) ? $_POST['idSites'] : null; $originalTrackerGetIdSite = isset($_GET['idsite']) ? $_GET['idsite'] : null; $originalTrackerPostIdSite = isset($_POST['idsite']) ? $_POST['idsite'] : null; try { $_GET['idSite'] = $_POST['idSite'] = $idSite; if (Tracker::$initTrackerMode) { $_GET['idsite'] = $_POST['idsite'] = $idSite; } // idSites is a deprecated query param that is still in use. since it is deprecated and new // supported code shouldn't rely on it, we can (more) safely unset it here, since we are just // calling downstream matomo code. we unset it because we don't want it interfering w/ // code in $callback(). unset($_GET['idSites']); unset($_POST['idSites']); return $callback(); } finally { self::resetIdSiteParam($_GET, 'idSite', $originalGetIdSite); self::resetIdSiteParam($_POST, 'idSite', $originalPostIdSite); self::resetIdSiteParam($_GET, 'idSites', $originalGetIdSites); self::resetIdSiteParam($_POST, 'idSites', $originalPostIdSites); self::resetIdSiteParam($_GET, 'idsite', $originalTrackerGetIdSite); self::resetIdSiteParam($_POST, 'idsite', $originalTrackerPostIdSite); } }
php
public static function changeIdSite($idSite, $callback) { // temporarily set the idSite query parameter so archiving will end up using // the correct site aware caches $originalGetIdSite = isset($_GET['idSite']) ? $_GET['idSite'] : null; $originalPostIdSite = isset($_POST['idSite']) ? $_POST['idSite'] : null; $originalGetIdSites = isset($_GET['idSites']) ? $_GET['idSites'] : null; $originalPostIdSites = isset($_POST['idSites']) ? $_POST['idSites'] : null; $originalTrackerGetIdSite = isset($_GET['idsite']) ? $_GET['idsite'] : null; $originalTrackerPostIdSite = isset($_POST['idsite']) ? $_POST['idsite'] : null; try { $_GET['idSite'] = $_POST['idSite'] = $idSite; if (Tracker::$initTrackerMode) { $_GET['idsite'] = $_POST['idsite'] = $idSite; } // idSites is a deprecated query param that is still in use. since it is deprecated and new // supported code shouldn't rely on it, we can (more) safely unset it here, since we are just // calling downstream matomo code. we unset it because we don't want it interfering w/ // code in $callback(). unset($_GET['idSites']); unset($_POST['idSites']); return $callback(); } finally { self::resetIdSiteParam($_GET, 'idSite', $originalGetIdSite); self::resetIdSiteParam($_POST, 'idSite', $originalPostIdSite); self::resetIdSiteParam($_GET, 'idSites', $originalGetIdSites); self::resetIdSiteParam($_POST, 'idSites', $originalPostIdSites); self::resetIdSiteParam($_GET, 'idsite', $originalTrackerGetIdSite); self::resetIdSiteParam($_POST, 'idsite', $originalTrackerPostIdSite); } }
[ "public", "static", "function", "changeIdSite", "(", "$", "idSite", ",", "$", "callback", ")", "{", "// temporarily set the idSite query parameter so archiving will end up using", "// the correct site aware caches", "$", "originalGetIdSite", "=", "isset", "(", "$", "_GET", ...
Temporarily overwrites the idSite parameter so all code executed by `$callback()` will use that idSite. Useful when you need to change the idSite context for a chunk of code. For example, if we are archiving for more than one site in sequence, we don't want to use the same caches for both archiving executions. @param string|int $idSite @param callable $callback @return mixed returns result of $callback
[ "Temporarily", "overwrites", "the", "idSite", "parameter", "so", "all", "code", "executed", "by", "$callback", "()", "will", "use", "that", "idSite", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Context.php#L48-L84
train
Change idSite to the new one
[ 30522, 2270, 10763, 3853, 2689, 9821, 4221, 1006, 1002, 8909, 28032, 2063, 1010, 1002, 2655, 5963, 1007, 1063, 1013, 1013, 8184, 2275, 1996, 8909, 28032, 2063, 23032, 16381, 2061, 7905, 14966, 2097, 2203, 2039, 2478, 1013, 1013, 1996, 6149,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Overlay/Controller.php
Controller.index
public function index() { Piwik::checkUserHasViewAccess($this->idSite); $template = '@Overlay/index'; if (Config::getInstance()->General['overlay_disable_framed_mode']) { $template = '@Overlay/index_noframe'; } $view = new View($template); $this->setGeneralVariablesView($view); $view->segment = Request::getRawSegmentFromRequest(); $view->ssl = ProxyHttp::isHttps(); $view->siteUrls = SitesManager\API::getInstance()->getSiteUrlsFromId($this->site->getId()); $this->outputCORSHeaders(); return $view->render(); }
php
public function index() { Piwik::checkUserHasViewAccess($this->idSite); $template = '@Overlay/index'; if (Config::getInstance()->General['overlay_disable_framed_mode']) { $template = '@Overlay/index_noframe'; } $view = new View($template); $this->setGeneralVariablesView($view); $view->segment = Request::getRawSegmentFromRequest(); $view->ssl = ProxyHttp::isHttps(); $view->siteUrls = SitesManager\API::getInstance()->getSiteUrlsFromId($this->site->getId()); $this->outputCORSHeaders(); return $view->render(); }
[ "public", "function", "index", "(", ")", "{", "Piwik", "::", "checkUserHasViewAccess", "(", "$", "this", "->", "idSite", ")", ";", "$", "template", "=", "'@Overlay/index'", ";", "if", "(", "Config", "::", "getInstance", "(", ")", "->", "General", "[", "'...
The index of the plugin
[ "The", "index", "of", "the", "plugin" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Overlay/Controller.php#L42-L61
train
This method renders the index page of the site
[ 30522, 2270, 3853, 5950, 1006, 1007, 1063, 14255, 9148, 2243, 1024, 1024, 4638, 20330, 14949, 8584, 6305, 9623, 2015, 1006, 1002, 2023, 1011, 1028, 8909, 28032, 2063, 1007, 1025, 1002, 23561, 1027, 1005, 1030, 2058, 8485, 1013, 5950, 1005, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Archive.php
Archive.getDoneStringForPlugin
private function getDoneStringForPlugin($plugin, $idSites) { return Rules::getDoneStringFlagFor( $idSites, $this->params->getSegment(), $this->getPeriodLabel(), $plugin ); }
php
private function getDoneStringForPlugin($plugin, $idSites) { return Rules::getDoneStringFlagFor( $idSites, $this->params->getSegment(), $this->getPeriodLabel(), $plugin ); }
[ "private", "function", "getDoneStringForPlugin", "(", "$", "plugin", ",", "$", "idSites", ")", "{", "return", "Rules", "::", "getDoneStringFlagFor", "(", "$", "idSites", ",", "$", "this", "->", "params", "->", "getSegment", "(", ")", ",", "$", "this", "->"...
Returns the done string flag for a plugin using this instance's segment & periods. @param string $plugin @return string
[ "Returns", "the", "done", "string", "flag", "for", "a", "plugin", "using", "this", "instance", "s", "segment", "&", "periods", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Archive.php#L707-L715
train
Returns the done string flag for the given plugin
[ 30522, 2797, 3853, 2131, 5280, 4355, 4892, 29278, 24759, 15916, 2378, 1006, 1002, 13354, 2378, 1010, 1002, 8909, 28032, 2229, 1007, 1063, 2709, 3513, 1024, 1024, 2131, 5280, 4355, 4892, 10258, 8490, 29278, 30524, 5244, 1011, 1028, 4152, 139...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Security/Core/Role/RoleHierarchy.php
RoleHierarchy.getReachableRoleNames
public function getReachableRoleNames(array $roles): array { $reachableRoles = $roles; foreach ($roles as $role) { if (!isset($this->map[$role])) { continue; } foreach ($this->map[$role] as $r) { $reachableRoles[] = $r; } } return $reachableRoles; }
php
public function getReachableRoleNames(array $roles): array { $reachableRoles = $roles; foreach ($roles as $role) { if (!isset($this->map[$role])) { continue; } foreach ($this->map[$role] as $r) { $reachableRoles[] = $r; } } return $reachableRoles; }
[ "public", "function", "getReachableRoleNames", "(", "array", "$", "roles", ")", ":", "array", "{", "$", "reachableRoles", "=", "$", "roles", ";", "foreach", "(", "$", "roles", "as", "$", "role", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "-...
@param string[] $roles @return string[]
[ "@param", "string", "[]", "$roles" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Security/Core/Role/RoleHierarchy.php#L62-L77
train
Returns the role names that are reachable by the given roles
[ 30522, 2270, 3853, 2131, 16416, 7507, 16213, 9890, 18442, 2015, 1006, 9140, 1002, 4395, 1007, 1024, 9140, 1063, 1002, 3362, 3085, 13153, 2229, 1027, 1002, 4395, 1025, 18921, 6776, 1006, 1002, 4395, 2004, 1002, 2535, 1007, 1063, 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...
octobercms/october
modules/backend/widgets/MediaManager.php
MediaManager.thumbnailExists
protected function thumbnailExists($thumbnailParams, $itemPath, $lastModified) { $thumbnailPath = $this->getThumbnailImagePath($thumbnailParams, $itemPath, $lastModified); $fullPath = temp_path(ltrim($thumbnailPath, '/')); if (File::exists($fullPath)) { return $thumbnailPath; } return false; }
php
protected function thumbnailExists($thumbnailParams, $itemPath, $lastModified) { $thumbnailPath = $this->getThumbnailImagePath($thumbnailParams, $itemPath, $lastModified); $fullPath = temp_path(ltrim($thumbnailPath, '/')); if (File::exists($fullPath)) { return $thumbnailPath; } return false; }
[ "protected", "function", "thumbnailExists", "(", "$", "thumbnailParams", ",", "$", "itemPath", ",", "$", "lastModified", ")", "{", "$", "thumbnailPath", "=", "$", "this", "->", "getThumbnailImagePath", "(", "$", "thumbnailParams", ",", "$", "itemPath", ",", "$...
Check if a thumbnail exists @param array|null $thumbnailParams @param string $itemPath @param int $lastModified @return bool
[ "Check", "if", "a", "thumbnail", "exists" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/MediaManager.php#L1217-L1228
train
Check if thumbnail exists
[ 30522, 5123, 3853, 7639, 25464, 10288, 5130, 1006, 1002, 7639, 25464, 28689, 5244, 1010, 1002, 8875, 15069, 1010, 1002, 2197, 5302, 4305, 10451, 1007, 1063, 1002, 7639, 25464, 15069, 1027, 1002, 2023, 1011, 1028, 2131, 2705, 25438, 25464, 9...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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.validateAddress
public static function validateAddress($address, $patternselect = null) { if (null === $patternselect) { $patternselect = static::$validator; } if (is_callable($patternselect)) { return call_user_func($patternselect, $address); } //Reject line breaks in addresses; it's valid RFC5322, but not RFC5321 if (strpos($address, "\n") !== false or strpos($address, "\r") !== false) { return false; } switch ($patternselect) { case 'pcre': //Kept for BC case 'pcre8': /* * A more complex and more permissive version of the RFC5322 regex on which FILTER_VALIDATE_EMAIL * is based. * In addition to the addresses allowed by filter_var, also permits: * * dotless domains: `a@b` * * comments: `1234 @ local(blah) .machine .example` * * quoted elements: `'"test blah"@example.org'` * * numeric TLDs: `a@b.123` * * unbracketed IPv4 literals: `a@192.168.0.1` * * IPv6 literals: 'first.last@[IPv6:a1::]' * Not all of these will necessarily work for sending! * * @see http://squiloople.com/2009/12/20/email-address-validation/ * @copyright 2009-2010 Michael Rushton * Feel free to use and redistribute this code. But please keep this copyright notice. */ return (bool) preg_match( '/^(?!(?>(?1)"?(?>\\\[ -~]|[^"])"?(?1)){255,})(?!(?>(?1)"?(?>\\\[ -~]|[^"])"?(?1)){65,}@)' . '((?>(?>(?>((?>(?>(?>\x0D\x0A)?[\t ])+|(?>[\t ]*\x0D\x0A)?[\t ]+)?)(\((?>(?2)' . '(?>[\x01-\x08\x0B\x0C\x0E-\'*-\[\]-\x7F]|\\\[\x00-\x7F]|(?3)))*(?2)\)))+(?2))|(?2))?)' . '([!#-\'*+\/-9=?^-~-]+|"(?>(?2)(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\x7F]))*' . '(?2)")(?>(?1)\.(?1)(?4))*(?1)@(?!(?1)[a-z0-9-]{64,})(?1)(?>([a-z0-9](?>[a-z0-9-]*[a-z0-9])?)' . '(?>(?1)\.(?!(?1)[a-z0-9-]{64,})(?1)(?5)){0,126}|\[(?:(?>IPv6:(?>([a-f0-9]{1,4})(?>:(?6)){7}' . '|(?!(?:.*[a-f0-9][:\]]){8,})((?6)(?>:(?6)){0,6})?::(?7)?))|(?>(?>IPv6:(?>(?6)(?>:(?6)){5}:' . '|(?!(?:.*[a-f0-9]:){6,})(?8)?::(?>((?6)(?>:(?6)){0,4}):)?))?(25[0-5]|2[0-4][0-9]|1[0-9]{2}' . '|[1-9]?[0-9])(?>\.(?9)){3}))\])(?1)$/isD', $address ); case 'html5': /* * This is the pattern used in the HTML5 spec for validation of 'email' type form input elements. * * @see http://www.whatwg.org/specs/web-apps/current-work/#e-mail-state-(type=email) */ return (bool) preg_match( '/^[a-zA-Z0-9.!#$%&\'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}' . '[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/sD', $address ); case 'php': default: return (bool) filter_var($address, FILTER_VALIDATE_EMAIL); } }
php
public static function validateAddress($address, $patternselect = null) { if (null === $patternselect) { $patternselect = static::$validator; } if (is_callable($patternselect)) { return call_user_func($patternselect, $address); } //Reject line breaks in addresses; it's valid RFC5322, but not RFC5321 if (strpos($address, "\n") !== false or strpos($address, "\r") !== false) { return false; } switch ($patternselect) { case 'pcre': //Kept for BC case 'pcre8': /* * A more complex and more permissive version of the RFC5322 regex on which FILTER_VALIDATE_EMAIL * is based. * In addition to the addresses allowed by filter_var, also permits: * * dotless domains: `a@b` * * comments: `1234 @ local(blah) .machine .example` * * quoted elements: `'"test blah"@example.org'` * * numeric TLDs: `a@b.123` * * unbracketed IPv4 literals: `a@192.168.0.1` * * IPv6 literals: 'first.last@[IPv6:a1::]' * Not all of these will necessarily work for sending! * * @see http://squiloople.com/2009/12/20/email-address-validation/ * @copyright 2009-2010 Michael Rushton * Feel free to use and redistribute this code. But please keep this copyright notice. */ return (bool) preg_match( '/^(?!(?>(?1)"?(?>\\\[ -~]|[^"])"?(?1)){255,})(?!(?>(?1)"?(?>\\\[ -~]|[^"])"?(?1)){65,}@)' . '((?>(?>(?>((?>(?>(?>\x0D\x0A)?[\t ])+|(?>[\t ]*\x0D\x0A)?[\t ]+)?)(\((?>(?2)' . '(?>[\x01-\x08\x0B\x0C\x0E-\'*-\[\]-\x7F]|\\\[\x00-\x7F]|(?3)))*(?2)\)))+(?2))|(?2))?)' . '([!#-\'*+\/-9=?^-~-]+|"(?>(?2)(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\x7F]))*' . '(?2)")(?>(?1)\.(?1)(?4))*(?1)@(?!(?1)[a-z0-9-]{64,})(?1)(?>([a-z0-9](?>[a-z0-9-]*[a-z0-9])?)' . '(?>(?1)\.(?!(?1)[a-z0-9-]{64,})(?1)(?5)){0,126}|\[(?:(?>IPv6:(?>([a-f0-9]{1,4})(?>:(?6)){7}' . '|(?!(?:.*[a-f0-9][:\]]){8,})((?6)(?>:(?6)){0,6})?::(?7)?))|(?>(?>IPv6:(?>(?6)(?>:(?6)){5}:' . '|(?!(?:.*[a-f0-9]:){6,})(?8)?::(?>((?6)(?>:(?6)){0,4}):)?))?(25[0-5]|2[0-4][0-9]|1[0-9]{2}' . '|[1-9]?[0-9])(?>\.(?9)){3}))\])(?1)$/isD', $address ); case 'html5': /* * This is the pattern used in the HTML5 spec for validation of 'email' type form input elements. * * @see http://www.whatwg.org/specs/web-apps/current-work/#e-mail-state-(type=email) */ return (bool) preg_match( '/^[a-zA-Z0-9.!#$%&\'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}' . '[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/sD', $address ); case 'php': default: return (bool) filter_var($address, FILTER_VALIDATE_EMAIL); } }
[ "public", "static", "function", "validateAddress", "(", "$", "address", ",", "$", "patternselect", "=", "null", ")", "{", "if", "(", "null", "===", "$", "patternselect", ")", "{", "$", "patternselect", "=", "static", "::", "$", "validator", ";", "}", "if...
Check that a string looks like an email address. Validation patterns supported: * `auto` Pick best pattern automatically; * `pcre8` Use the squiloople.com pattern, requires PCRE > 8.0; * `pcre` Use old PCRE implementation; * `php` Use PHP built-in FILTER_VALIDATE_EMAIL; * `html5` Use the pattern given by the HTML5 spec for 'email' type form input elements. * `noregex` Don't use a regex: super fast, really dumb. Alternatively you may pass in a callable to inject your own validator, for example: ```php PHPMailer::validateAddress('user@example.com', function($address) { return (strpos($address, '@') !== false); }); ``` You can also set the PHPMailer::$validator static to a callable, allowing built-in methods to use your validator. @param string $address The email address to check @param string|callable $patternselect Which pattern to use @return bool
[ "Check", "that", "a", "string", "looks", "like", "an", "email", "address", ".", "Validation", "patterns", "supported", ":", "*", "auto", "Pick", "best", "pattern", "automatically", ";", "*", "pcre8", "Use", "the", "squiloople", ".", "com", "pattern", "requir...
3d7132341659a8a201adbc3ba11b1e202ee2857c
https://github.com/PHPMailer/PHPMailer/blob/3d7132341659a8a201adbc3ba11b1e202ee2857c/src/PHPMailer.php#L1251-L1309
train
Validate email address
[ 30522, 2270, 10763, 3853, 9398, 3686, 4215, 16200, 4757, 1006, 1002, 4769, 1010, 1002, 7060, 12260, 6593, 1027, 19701, 1007, 1063, 2065, 1006, 19701, 1027, 1027, 1027, 1002, 7060, 12260, 6593, 1007, 1063, 1002, 7060, 12260, 6593, 1027, 1076...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/OutputStyle.php
OutputStyle.writeln
public function writeln($messages, $type = self::OUTPUT_NORMAL) { $this->output->writeln($messages, $type); }
php
public function writeln($messages, $type = self::OUTPUT_NORMAL) { $this->output->writeln($messages, $type); }
[ "public", "function", "writeln", "(", "$", "messages", ",", "$", "type", "=", "self", "::", "OUTPUT_NORMAL", ")", "{", "$", "this", "->", "output", "->", "writeln", "(", "$", "messages", ",", "$", "type", ")", ";", "}" ]
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Console/Style/OutputStyle.php#L62-L65
train
Write a message to the output
[ 30522, 2270, 3853, 4339, 19666, 1006, 1002, 7696, 1010, 1002, 2828, 1027, 2969, 1024, 1024, 6434, 1035, 3671, 1007, 1063, 1002, 2023, 1011, 1028, 6434, 1011, 1028, 4339, 19666, 1006, 1002, 7696, 1010, 1002, 2828, 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...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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/Lists.php
Lists.init
public function init() { $this->fillFromConfig([ 'columns', 'model', 'recordUrl', 'recordOnClick', 'noRecordsMessage', 'showPageNumbers', 'recordsPerPage', 'showSorting', 'defaultSort', 'showCheckboxes', 'showSetup', 'showTree', 'treeExpanded', 'showPagination', 'customViewPath', ]); /* * Configure the list widget */ $this->recordsPerPage = $this->getSession('per_page', $this->recordsPerPage); if ($this->showPagination == 'auto') { $this->showPagination = $this->recordsPerPage && $this->recordsPerPage > 0; } if ($this->customViewPath) { $this->addViewPath($this->customViewPath); } $this->validateModel(); $this->validateTree(); }
php
public function init() { $this->fillFromConfig([ 'columns', 'model', 'recordUrl', 'recordOnClick', 'noRecordsMessage', 'showPageNumbers', 'recordsPerPage', 'showSorting', 'defaultSort', 'showCheckboxes', 'showSetup', 'showTree', 'treeExpanded', 'showPagination', 'customViewPath', ]); /* * Configure the list widget */ $this->recordsPerPage = $this->getSession('per_page', $this->recordsPerPage); if ($this->showPagination == 'auto') { $this->showPagination = $this->recordsPerPage && $this->recordsPerPage > 0; } if ($this->customViewPath) { $this->addViewPath($this->customViewPath); } $this->validateModel(); $this->validateTree(); }
[ "public", "function", "init", "(", ")", "{", "$", "this", "->", "fillFromConfig", "(", "[", "'columns'", ",", "'model'", ",", "'recordUrl'", ",", "'recordOnClick'", ",", "'noRecordsMessage'", ",", "'showPageNumbers'", ",", "'recordsPerPage'", ",", "'showSorting'",...
Initialize the widget, called by the constructor and free from its parameters.
[ "Initialize", "the", "widget", "called", "by", "the", "constructor", "and", "free", "from", "its", "parameters", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/Lists.php#L187-L222
train
Initializes the list widget
[ 30522, 2270, 3853, 1999, 4183, 1006, 1007, 1063, 1002, 2023, 1011, 1028, 6039, 19699, 5358, 8663, 8873, 2290, 1006, 1031, 1005, 7753, 1005, 1010, 1005, 2944, 1005, 1010, 1005, 2501, 3126, 2140, 1005, 1010, 1005, 2501, 2239, 20464, 6799, 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...
walkor/Workerman
Protocols/Http.php
Http.decode
public static function decode($recv_buffer, TcpConnection $connection) { // Init. $_POST = $_GET = $_COOKIE = $_REQUEST = $_SESSION = $_FILES = array(); $GLOBALS['HTTP_RAW_POST_DATA'] = ''; // Clear cache. HttpCache::$header = array('Connection' => 'Connection: keep-alive'); HttpCache::$instance = new HttpCache(); // $_SERVER $_SERVER = array( 'QUERY_STRING' => '', 'REQUEST_METHOD' => '', 'REQUEST_URI' => '', 'SERVER_PROTOCOL' => '', 'SERVER_SOFTWARE' => 'workerman/'.Worker::VERSION, 'SERVER_NAME' => '', 'HTTP_HOST' => '', 'HTTP_USER_AGENT' => '', 'HTTP_ACCEPT' => '', 'HTTP_ACCEPT_LANGUAGE' => '', 'HTTP_ACCEPT_ENCODING' => '', 'HTTP_COOKIE' => '', 'HTTP_CONNECTION' => '', 'CONTENT_TYPE' => '', 'REMOTE_ADDR' => '', 'REMOTE_PORT' => '0', 'REQUEST_TIME' => time() ); // Parse headers. list($http_header, $http_body) = explode("\r\n\r\n", $recv_buffer, 2); $header_data = explode("\r\n", $http_header); list($_SERVER['REQUEST_METHOD'], $_SERVER['REQUEST_URI'], $_SERVER['SERVER_PROTOCOL']) = explode(' ', $header_data[0]); $http_post_boundary = ''; unset($header_data[0]); foreach ($header_data as $content) { // \r\n\r\n if (empty($content)) { continue; } list($key, $value) = explode(':', $content, 2); $key = str_replace('-', '_', strtoupper($key)); $value = trim($value); $_SERVER['HTTP_' . $key] = $value; switch ($key) { // HTTP_HOST case 'HOST': $tmp = explode(':', $value); $_SERVER['SERVER_NAME'] = $tmp[0]; if (isset($tmp[1])) { $_SERVER['SERVER_PORT'] = $tmp[1]; } break; // cookie case 'COOKIE': parse_str(str_replace('; ', '&', $_SERVER['HTTP_COOKIE']), $_COOKIE); break; // content-type case 'CONTENT_TYPE': if (!preg_match('/boundary="?(\S+)"?/', $value, $match)) { if ($pos = strpos($value, ';')) { $_SERVER['CONTENT_TYPE'] = substr($value, 0, $pos); } else { $_SERVER['CONTENT_TYPE'] = $value; } } else { $_SERVER['CONTENT_TYPE'] = 'multipart/form-data'; $http_post_boundary = '--' . $match[1]; } break; case 'CONTENT_LENGTH': $_SERVER['CONTENT_LENGTH'] = $value; break; case 'UPGRADE': if($value=='websocket'){ $connection->protocol = "\\Workerman\\Protocols\\Websocket"; return \Workerman\Protocols\Websocket::input($recv_buffer,$connection); } break; } } if(isset($_SERVER['HTTP_ACCEPT_ENCODING']) && strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== FALSE){ HttpCache::$gzip = true; } // Parse $_POST. if ($_SERVER['REQUEST_METHOD'] === 'POST') { if (isset($_SERVER['CONTENT_TYPE'])) { switch ($_SERVER['CONTENT_TYPE']) { case 'multipart/form-data': self::parseUploadFiles($http_body, $http_post_boundary); break; case 'application/json': $_POST = json_decode($http_body, true); break; case 'application/x-www-form-urlencoded': parse_str($http_body, $_POST); break; } } } // Parse other HTTP action parameters if ($_SERVER['REQUEST_METHOD'] != 'GET' && $_SERVER['REQUEST_METHOD'] != "POST") { $data = array(); if ($_SERVER['CONTENT_TYPE'] === "application/x-www-form-urlencoded") { parse_str($http_body, $data); } elseif ($_SERVER['CONTENT_TYPE'] === "application/json") { $data = json_decode($http_body, true); } $_REQUEST = array_merge($_REQUEST, $data); } // HTTP_RAW_REQUEST_DATA HTTP_RAW_POST_DATA $GLOBALS['HTTP_RAW_REQUEST_DATA'] = $GLOBALS['HTTP_RAW_POST_DATA'] = $http_body; // QUERY_STRING $_SERVER['QUERY_STRING'] = parse_url($_SERVER['REQUEST_URI'], PHP_URL_QUERY); if ($_SERVER['QUERY_STRING']) { // $GET parse_str($_SERVER['QUERY_STRING'], $_GET); } else { $_SERVER['QUERY_STRING'] = ''; } if (is_array($_POST)) { // REQUEST $_REQUEST = array_merge($_GET, $_POST, $_REQUEST); } else { // REQUEST $_REQUEST = array_merge($_GET, $_REQUEST); } // REMOTE_ADDR REMOTE_PORT $_SERVER['REMOTE_ADDR'] = $connection->getRemoteIp(); $_SERVER['REMOTE_PORT'] = $connection->getRemotePort(); return array('get' => $_GET, 'post' => $_POST, 'cookie' => $_COOKIE, 'server' => $_SERVER, 'files' => $_FILES); }
php
public static function decode($recv_buffer, TcpConnection $connection) { // Init. $_POST = $_GET = $_COOKIE = $_REQUEST = $_SESSION = $_FILES = array(); $GLOBALS['HTTP_RAW_POST_DATA'] = ''; // Clear cache. HttpCache::$header = array('Connection' => 'Connection: keep-alive'); HttpCache::$instance = new HttpCache(); // $_SERVER $_SERVER = array( 'QUERY_STRING' => '', 'REQUEST_METHOD' => '', 'REQUEST_URI' => '', 'SERVER_PROTOCOL' => '', 'SERVER_SOFTWARE' => 'workerman/'.Worker::VERSION, 'SERVER_NAME' => '', 'HTTP_HOST' => '', 'HTTP_USER_AGENT' => '', 'HTTP_ACCEPT' => '', 'HTTP_ACCEPT_LANGUAGE' => '', 'HTTP_ACCEPT_ENCODING' => '', 'HTTP_COOKIE' => '', 'HTTP_CONNECTION' => '', 'CONTENT_TYPE' => '', 'REMOTE_ADDR' => '', 'REMOTE_PORT' => '0', 'REQUEST_TIME' => time() ); // Parse headers. list($http_header, $http_body) = explode("\r\n\r\n", $recv_buffer, 2); $header_data = explode("\r\n", $http_header); list($_SERVER['REQUEST_METHOD'], $_SERVER['REQUEST_URI'], $_SERVER['SERVER_PROTOCOL']) = explode(' ', $header_data[0]); $http_post_boundary = ''; unset($header_data[0]); foreach ($header_data as $content) { // \r\n\r\n if (empty($content)) { continue; } list($key, $value) = explode(':', $content, 2); $key = str_replace('-', '_', strtoupper($key)); $value = trim($value); $_SERVER['HTTP_' . $key] = $value; switch ($key) { // HTTP_HOST case 'HOST': $tmp = explode(':', $value); $_SERVER['SERVER_NAME'] = $tmp[0]; if (isset($tmp[1])) { $_SERVER['SERVER_PORT'] = $tmp[1]; } break; // cookie case 'COOKIE': parse_str(str_replace('; ', '&', $_SERVER['HTTP_COOKIE']), $_COOKIE); break; // content-type case 'CONTENT_TYPE': if (!preg_match('/boundary="?(\S+)"?/', $value, $match)) { if ($pos = strpos($value, ';')) { $_SERVER['CONTENT_TYPE'] = substr($value, 0, $pos); } else { $_SERVER['CONTENT_TYPE'] = $value; } } else { $_SERVER['CONTENT_TYPE'] = 'multipart/form-data'; $http_post_boundary = '--' . $match[1]; } break; case 'CONTENT_LENGTH': $_SERVER['CONTENT_LENGTH'] = $value; break; case 'UPGRADE': if($value=='websocket'){ $connection->protocol = "\\Workerman\\Protocols\\Websocket"; return \Workerman\Protocols\Websocket::input($recv_buffer,$connection); } break; } } if(isset($_SERVER['HTTP_ACCEPT_ENCODING']) && strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== FALSE){ HttpCache::$gzip = true; } // Parse $_POST. if ($_SERVER['REQUEST_METHOD'] === 'POST') { if (isset($_SERVER['CONTENT_TYPE'])) { switch ($_SERVER['CONTENT_TYPE']) { case 'multipart/form-data': self::parseUploadFiles($http_body, $http_post_boundary); break; case 'application/json': $_POST = json_decode($http_body, true); break; case 'application/x-www-form-urlencoded': parse_str($http_body, $_POST); break; } } } // Parse other HTTP action parameters if ($_SERVER['REQUEST_METHOD'] != 'GET' && $_SERVER['REQUEST_METHOD'] != "POST") { $data = array(); if ($_SERVER['CONTENT_TYPE'] === "application/x-www-form-urlencoded") { parse_str($http_body, $data); } elseif ($_SERVER['CONTENT_TYPE'] === "application/json") { $data = json_decode($http_body, true); } $_REQUEST = array_merge($_REQUEST, $data); } // HTTP_RAW_REQUEST_DATA HTTP_RAW_POST_DATA $GLOBALS['HTTP_RAW_REQUEST_DATA'] = $GLOBALS['HTTP_RAW_POST_DATA'] = $http_body; // QUERY_STRING $_SERVER['QUERY_STRING'] = parse_url($_SERVER['REQUEST_URI'], PHP_URL_QUERY); if ($_SERVER['QUERY_STRING']) { // $GET parse_str($_SERVER['QUERY_STRING'], $_GET); } else { $_SERVER['QUERY_STRING'] = ''; } if (is_array($_POST)) { // REQUEST $_REQUEST = array_merge($_GET, $_POST, $_REQUEST); } else { // REQUEST $_REQUEST = array_merge($_GET, $_REQUEST); } // REMOTE_ADDR REMOTE_PORT $_SERVER['REMOTE_ADDR'] = $connection->getRemoteIp(); $_SERVER['REMOTE_PORT'] = $connection->getRemotePort(); return array('get' => $_GET, 'post' => $_POST, 'cookie' => $_COOKIE, 'server' => $_SERVER, 'files' => $_FILES); }
[ "public", "static", "function", "decode", "(", "$", "recv_buffer", ",", "TcpConnection", "$", "connection", ")", "{", "// Init.", "$", "_POST", "=", "$", "_GET", "=", "$", "_COOKIE", "=", "$", "_REQUEST", "=", "$", "_SESSION", "=", "$", "_FILES", "=", ...
Parse $_POST、$_GET、$_COOKIE. @param string $recv_buffer @param TcpConnection $connection @return array
[ "Parse", "$_POST、$_GET、$_COOKIE", "." ]
13649907f05014fcfffcfccaef01e63ad3339351
https://github.com/walkor/Workerman/blob/13649907f05014fcfffcfccaef01e63ad3339351/Protocols/Http.php#L86-L226
train
Decode HTTP response
[ 30522, 2270, 10763, 3853, 21933, 3207, 1006, 1002, 28667, 2615, 1035, 17698, 1010, 22975, 15042, 18256, 7542, 1002, 4434, 1007, 1063, 1013, 1013, 1999, 4183, 1012, 1002, 1035, 2695, 1027, 1002, 1035, 2131, 1027, 1002, 1035, 17387, 1027, 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...
symfony/symfony
src/Symfony/Component/Config/Definition/Builder/ExprBuilder.php
ExprBuilder.end
public function end() { if (null === $this->ifPart) { throw new \RuntimeException('You must specify an if part.'); } if (null === $this->thenPart) { throw new \RuntimeException('You must specify a then part.'); } return $this->node; }
php
public function end() { if (null === $this->ifPart) { throw new \RuntimeException('You must specify an if part.'); } if (null === $this->thenPart) { throw new \RuntimeException('You must specify a then part.'); } return $this->node; }
[ "public", "function", "end", "(", ")", "{", "if", "(", "null", "===", "$", "this", "->", "ifPart", ")", "{", "throw", "new", "\\", "RuntimeException", "(", "'You must specify an if part.'", ")", ";", "}", "if", "(", "null", "===", "$", "this", "->", "t...
Returns the related node. @return NodeDefinition|ArrayNodeDefinition|VariableNodeDefinition @throws \RuntimeException
[ "Returns", "the", "related", "node", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Config/Definition/Builder/ExprBuilder.php#L215-L225
train
End the current node
[ 30522, 2270, 3853, 2203, 1006, 1007, 1063, 2065, 1006, 19701, 1027, 1027, 1027, 1002, 2023, 1011, 1028, 2065, 19362, 2102, 1007, 1063, 5466, 2047, 1032, 2448, 7292, 10288, 24422, 1006, 1005, 2017, 2442, 20648, 2019, 2065, 2112, 1012, 1005, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/HttpCache.php
HttpCache.handle
public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true) { // FIXME: catch exceptions and implement a 500 error page here? -> in Varnish, there is a built-in error page mechanism if (HttpKernelInterface::MASTER_REQUEST === $type) { $this->traces = []; // Keep a clone of the original request for surrogates so they can access it. // We must clone here to get a separate instance because the application will modify the request during // the application flow (we know it always does because we do ourselves by setting REMOTE_ADDR to 127.0.0.1 // and adding the X-Forwarded-For header, see HttpCache::forward()). $this->request = clone $request; if (null !== $this->surrogate) { $this->surrogateCacheStrategy = $this->surrogate->createCacheStrategy(); } } $this->traces[$this->getTraceKey($request)] = []; if (!$request->isMethodSafe(false)) { $response = $this->invalidate($request, $catch); } elseif ($request->headers->has('expect') || !$request->isMethodCacheable()) { $response = $this->pass($request, $catch); } elseif ($this->options['allow_reload'] && $request->isNoCache()) { /* If allow_reload is configured and the client requests "Cache-Control: no-cache", reload the cache by fetching a fresh response and caching it (if possible). */ $this->record($request, 'reload'); $response = $this->fetch($request, $catch); } else { $response = $this->lookup($request, $catch); } $this->restoreResponseBody($request, $response); if (HttpKernelInterface::MASTER_REQUEST === $type) { $this->addTraces($response); } if (null !== $this->surrogate) { if (HttpKernelInterface::MASTER_REQUEST === $type) { $this->surrogateCacheStrategy->update($response); } else { $this->surrogateCacheStrategy->add($response); } } $response->prepare($request); $response->isNotModified($request); return $response; }
php
public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true) { // FIXME: catch exceptions and implement a 500 error page here? -> in Varnish, there is a built-in error page mechanism if (HttpKernelInterface::MASTER_REQUEST === $type) { $this->traces = []; // Keep a clone of the original request for surrogates so they can access it. // We must clone here to get a separate instance because the application will modify the request during // the application flow (we know it always does because we do ourselves by setting REMOTE_ADDR to 127.0.0.1 // and adding the X-Forwarded-For header, see HttpCache::forward()). $this->request = clone $request; if (null !== $this->surrogate) { $this->surrogateCacheStrategy = $this->surrogate->createCacheStrategy(); } } $this->traces[$this->getTraceKey($request)] = []; if (!$request->isMethodSafe(false)) { $response = $this->invalidate($request, $catch); } elseif ($request->headers->has('expect') || !$request->isMethodCacheable()) { $response = $this->pass($request, $catch); } elseif ($this->options['allow_reload'] && $request->isNoCache()) { /* If allow_reload is configured and the client requests "Cache-Control: no-cache", reload the cache by fetching a fresh response and caching it (if possible). */ $this->record($request, 'reload'); $response = $this->fetch($request, $catch); } else { $response = $this->lookup($request, $catch); } $this->restoreResponseBody($request, $response); if (HttpKernelInterface::MASTER_REQUEST === $type) { $this->addTraces($response); } if (null !== $this->surrogate) { if (HttpKernelInterface::MASTER_REQUEST === $type) { $this->surrogateCacheStrategy->update($response); } else { $this->surrogateCacheStrategy->add($response); } } $response->prepare($request); $response->isNotModified($request); return $response; }
[ "public", "function", "handle", "(", "Request", "$", "request", ",", "$", "type", "=", "HttpKernelInterface", "::", "MASTER_REQUEST", ",", "$", "catch", "=", "true", ")", "{", "// FIXME: catch exceptions and implement a 500 error page here? -> in Varnish, there is a built-i...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php#L193-L244
train
Handle the request
[ 30522, 2270, 3853, 5047, 1006, 5227, 1002, 5227, 1010, 1002, 2828, 1027, 8299, 5484, 11877, 18447, 2121, 12172, 1024, 1024, 3040, 1035, 5227, 1010, 1002, 4608, 1027, 2995, 1007, 1063, 1013, 1013, 8081, 4168, 1024, 4608, 11790, 1998, 10408, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Installation/Controller.php
Controller.createConfigFile
private function createConfigFile($dbInfos) { $config = Config::getInstance(); // make sure DB sessions are used if the filesystem is NFS if (count($headers = ProxyHeaders::getProxyClientHeaders()) > 0) { $config->General['proxy_client_headers'] = $headers; } if (count($headers = ProxyHeaders::getProxyHostHeaders()) > 0) { $config->General['proxy_host_headers'] = $headers; } if (Common::getRequestVar('clientProtocol', 'http', 'string') == 'https') { $protocol = 'https'; } else { $protocol = ProxyHeaders::getProtocolInformation(); } if (!empty($protocol) && !\Piwik\ProxyHttp::isHttps()) { $config->General['assume_secure_protocol'] = '1'; } $config->General['salt'] = Common::generateUniqId(); $config->General['installation_in_progress'] = 1; $config->database = $dbInfos; if (!DbHelper::isDatabaseConnectionUTF8()) { $config->database['charset'] = 'utf8'; } $config->forceSave(); // re-save the currently viewed language (since we saved the config file, there is now a salt which makes the // existing session cookie invalid) $this->resetLanguageCookie(); }
php
private function createConfigFile($dbInfos) { $config = Config::getInstance(); // make sure DB sessions are used if the filesystem is NFS if (count($headers = ProxyHeaders::getProxyClientHeaders()) > 0) { $config->General['proxy_client_headers'] = $headers; } if (count($headers = ProxyHeaders::getProxyHostHeaders()) > 0) { $config->General['proxy_host_headers'] = $headers; } if (Common::getRequestVar('clientProtocol', 'http', 'string') == 'https') { $protocol = 'https'; } else { $protocol = ProxyHeaders::getProtocolInformation(); } if (!empty($protocol) && !\Piwik\ProxyHttp::isHttps()) { $config->General['assume_secure_protocol'] = '1'; } $config->General['salt'] = Common::generateUniqId(); $config->General['installation_in_progress'] = 1; $config->database = $dbInfos; if (!DbHelper::isDatabaseConnectionUTF8()) { $config->database['charset'] = 'utf8'; } $config->forceSave(); // re-save the currently viewed language (since we saved the config file, there is now a salt which makes the // existing session cookie invalid) $this->resetLanguageCookie(); }
[ "private", "function", "createConfigFile", "(", "$", "dbInfos", ")", "{", "$", "config", "=", "Config", "::", "getInstance", "(", ")", ";", "// make sure DB sessions are used if the filesystem is NFS", "if", "(", "count", "(", "$", "headers", "=", "ProxyHeaders", ...
Write configuration file from session-store
[ "Write", "configuration", "file", "from", "session", "-", "store" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Installation/Controller.php#L550-L586
train
Create the config file
[ 30522, 2797, 3853, 3443, 8663, 8873, 25708, 9463, 1006, 1002, 16962, 2378, 14876, 2015, 1007, 1063, 1002, 9530, 8873, 2290, 1027, 9530, 8873, 2290, 1024, 1024, 2131, 7076, 26897, 1006, 1007, 1025, 1013, 1013, 2191, 2469, 16962, 6521, 2024, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Mysqli.php
Zend_Db_Statement_Mysqli.closeCursor
public function closeCursor() { if ($stmt = $this->_stmt) { $mysqli = $this->_adapter->getConnection(); while ($mysqli->more_results()) { $mysqli->next_result(); } $this->_stmt->free_result(); return $this->_stmt->reset(); } return false; }
php
public function closeCursor() { if ($stmt = $this->_stmt) { $mysqli = $this->_adapter->getConnection(); while ($mysqli->more_results()) { $mysqli->next_result(); } $this->_stmt->free_result(); return $this->_stmt->reset(); } return false; }
[ "public", "function", "closeCursor", "(", ")", "{", "if", "(", "$", "stmt", "=", "$", "this", "->", "_stmt", ")", "{", "$", "mysqli", "=", "$", "this", "->", "_adapter", "->", "getConnection", "(", ")", ";", "while", "(", "$", "mysqli", "->", "more...
Closes the cursor, allowing the statement to be executed again. @return bool
[ "Closes", "the", "cursor", "allowing", "the", "statement", "to", "be", "executed", "again", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Statement/Mysqli.php#L117-L128
train
Close cursor and free all results
[ 30522, 2270, 3853, 2485, 10841, 25301, 2099, 1006, 1007, 1063, 2065, 1006, 1002, 2358, 20492, 1027, 1002, 2023, 1011, 1028, 1035, 2358, 20492, 1007, 1063, 1002, 2026, 2015, 4160, 3669, 1027, 1002, 2023, 1011, 1028, 1035, 15581, 2121, 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...
getgrav/grav
system/src/Grav/Common/Getters.php
Getters.offsetExists
public function offsetExists($offset) { if ($this->gettersVariable) { $var = $this->gettersVariable; return isset($this->{$var}[$offset]); } return isset($this->{$offset}); }
php
public function offsetExists($offset) { if ($this->gettersVariable) { $var = $this->gettersVariable; return isset($this->{$var}[$offset]); } return isset($this->{$offset}); }
[ "public", "function", "offsetExists", "(", "$", "offset", ")", "{", "if", "(", "$", "this", "->", "gettersVariable", ")", "{", "$", "var", "=", "$", "this", "->", "gettersVariable", ";", "return", "isset", "(", "$", "this", "->", "{", "$", "var", "}"...
@param mixed $offset @return bool
[ "@param", "mixed", "$offset" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Getters.php#L71-L80
train
Checks if an offset exists in the array
[ 30522, 2270, 3853, 16396, 10288, 5130, 1006, 1002, 16396, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 2131, 7747, 10755, 19210, 1007, 1063, 1002, 13075, 1027, 1002, 2023, 1011, 1028, 2131, 7747, 10755, 19210, 1025, 2709, 26354, 3388, 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...
php-ai/php-ml
src/DimensionReduction/KernelPCA.php
KernelPCA.calculateKernelMatrix
protected function calculateKernelMatrix(array $data, int $numRows): array { $kernelFunc = $this->getKernel(); $matrix = []; for ($i = 0; $i < $numRows; ++$i) { for ($k = 0; $k < $numRows; ++$k) { if ($i <= $k) { $matrix[$i][$k] = $kernelFunc($data[$i], $data[$k]); } else { $matrix[$i][$k] = $matrix[$k][$i]; } } } return $matrix; }
php
protected function calculateKernelMatrix(array $data, int $numRows): array { $kernelFunc = $this->getKernel(); $matrix = []; for ($i = 0; $i < $numRows; ++$i) { for ($k = 0; $k < $numRows; ++$k) { if ($i <= $k) { $matrix[$i][$k] = $kernelFunc($data[$i], $data[$k]); } else { $matrix[$i][$k] = $matrix[$k][$i]; } } } return $matrix; }
[ "protected", "function", "calculateKernelMatrix", "(", "array", "$", "data", ",", "int", "$", "numRows", ")", ":", "array", "{", "$", "kernelFunc", "=", "$", "this", "->", "getKernel", "(", ")", ";", "$", "matrix", "=", "[", "]", ";", "for", "(", "$"...
Calculates similarity matrix by use of selected kernel function<br> An n-by-m matrix is given and an n-by-n matrix is returned
[ "Calculates", "similarity", "matrix", "by", "use", "of", "selected", "kernel", "function<br", ">", "An", "n", "-", "by", "-", "m", "matrix", "is", "given", "and", "an", "n", "-", "by", "-", "n", "matrix", "is", "returned" ]
f6aa1a59b0525b8fca3d2786d661ab3e70904016
https://github.com/php-ai/php-ml/blob/f6aa1a59b0525b8fca3d2786d661ab3e70904016/src/DimensionReduction/KernelPCA.php#L122-L138
train
Calculate the kernel matrix
[ 30522, 5123, 3853, 18422, 5484, 11877, 18900, 17682, 1006, 9140, 1002, 2951, 1010, 20014, 1002, 16371, 2213, 10524, 2015, 1007, 1024, 9140, 1063, 1002, 16293, 11263, 12273, 1027, 1002, 2023, 1011, 1028, 2131, 5484, 11877, 1006, 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...
laravel/framework
src/Illuminate/Database/Query/Grammars/Grammar.php
Grammar.compileHavingBetween
protected function compileHavingBetween($having) { $between = $having['not'] ? 'not between' : 'between'; $column = $this->wrap($having['column']); $min = $this->parameter(head($having['values'])); $max = $this->parameter(last($having['values'])); return $having['boolean'].' '.$column.' '.$between.' '.$min.' and '.$max; }
php
protected function compileHavingBetween($having) { $between = $having['not'] ? 'not between' : 'between'; $column = $this->wrap($having['column']); $min = $this->parameter(head($having['values'])); $max = $this->parameter(last($having['values'])); return $having['boolean'].' '.$column.' '.$between.' '.$min.' and '.$max; }
[ "protected", "function", "compileHavingBetween", "(", "$", "having", ")", "{", "$", "between", "=", "$", "having", "[", "'not'", "]", "?", "'not between'", ":", "'between'", ";", "$", "column", "=", "$", "this", "->", "wrap", "(", "$", "having", "[", "...
Compile a "between" having clause. @param array $having @return string
[ "Compile", "a", "between", "having", "clause", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Query/Grammars/Grammar.php#L697-L708
train
Compiles having between clause into a single having clause
[ 30522, 5123, 3853, 4012, 22090, 3270, 6455, 20915, 28394, 2078, 1006, 1002, 2383, 1007, 1063, 1002, 2090, 1027, 1002, 2383, 1031, 1005, 2025, 1005, 1033, 1029, 1005, 2025, 2090, 1005, 1024, 1005, 2090, 1005, 1025, 1002, 5930, 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...
getgrav/grav
system/src/Grav/Common/Page/Page.php
Page.raw
public function raw($var = null) { $file = $this->file(); if ($var) { // First update file object. if ($file) { $file->raw($var); } // Reset header and content. $this->modified = time(); $this->id($this->modified() . md5($this->filePath())); $this->header = null; $this->content = null; $this->summary = null; } return $file ? $file->raw() : ''; }
php
public function raw($var = null) { $file = $this->file(); if ($var) { // First update file object. if ($file) { $file->raw($var); } // Reset header and content. $this->modified = time(); $this->id($this->modified() . md5($this->filePath())); $this->header = null; $this->content = null; $this->summary = null; } return $file ? $file->raw() : ''; }
[ "public", "function", "raw", "(", "$", "var", "=", "null", ")", "{", "$", "file", "=", "$", "this", "->", "file", "(", ")", ";", "if", "(", "$", "var", ")", "{", "// First update file object.", "if", "(", "$", "file", ")", "{", "$", "file", "->",...
Gets and Sets the raw data @param string $var Raw content string @return string Raw content string
[ "Gets", "and", "Sets", "the", "raw", "data" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L255-L274
train
Return raw content of file
[ 30522, 2270, 3853, 6315, 1006, 1002, 13075, 1027, 19701, 1007, 1063, 1002, 5371, 1027, 1002, 2023, 1011, 1028, 5371, 1006, 1007, 1025, 2065, 1006, 1002, 13075, 1007, 1063, 1013, 1013, 2034, 10651, 5371, 4874, 1012, 2065, 1006, 1002, 5371, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Social.php
Social.getMainUrl
public function getMainUrl($url) { $social = $this->getSocialNetworkFromDomain($url); foreach ($this->getDefinitions() as $domain => $name) { if ($name == $social) { return $domain; } } return $url; }
php
public function getMainUrl($url) { $social = $this->getSocialNetworkFromDomain($url); foreach ($this->getDefinitions() as $domain => $name) { if ($name == $social) { return $domain; } } return $url; }
[ "public", "function", "getMainUrl", "(", "$", "url", ")", "{", "$", "social", "=", "$", "this", "->", "getSocialNetworkFromDomain", "(", "$", "url", ")", ";", "foreach", "(", "$", "this", "->", "getDefinitions", "(", ")", "as", "$", "domain", "=>", "$"...
Returns the main url of the social network the given url matches @param string $url @return string
[ "Returns", "the", "main", "url", "of", "the", "social", "network", "the", "given", "url", "matches" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Referrers/Social.php#L147-L158
train
Get main url
[ 30522, 2270, 3853, 2131, 24238, 3126, 2140, 1006, 1002, 24471, 2140, 1007, 1063, 1002, 2591, 1027, 1002, 2023, 1011, 1028, 4152, 10085, 4818, 7159, 6198, 19699, 5358, 9527, 8113, 1006, 1002, 24471, 2140, 1007, 1025, 18921, 6776, 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
plugins/SitesManager/API.php
API.checkAndReturnExcludedIps
private function checkAndReturnExcludedIps($excludedIps) { if (empty($excludedIps)) { return ''; } $ips = explode(',', $excludedIps); $ips = array_map('trim', $ips); $ips = array_filter($ips, 'strlen'); foreach ($ips as $ip) { if (!$this->isValidIp($ip)) { throw new Exception(Piwik::translate('SitesManager_ExceptionInvalidIPFormat', array($ip, "1.2.3.4, 1.2.3.*, or 1.2.3.4/5"))); } } $ips = implode(',', $ips); return $ips; }
php
private function checkAndReturnExcludedIps($excludedIps) { if (empty($excludedIps)) { return ''; } $ips = explode(',', $excludedIps); $ips = array_map('trim', $ips); $ips = array_filter($ips, 'strlen'); foreach ($ips as $ip) { if (!$this->isValidIp($ip)) { throw new Exception(Piwik::translate('SitesManager_ExceptionInvalidIPFormat', array($ip, "1.2.3.4, 1.2.3.*, or 1.2.3.4/5"))); } } $ips = implode(',', $ips); return $ips; }
[ "private", "function", "checkAndReturnExcludedIps", "(", "$", "excludedIps", ")", "{", "if", "(", "empty", "(", "$", "excludedIps", ")", ")", "{", "return", "''", ";", "}", "$", "ips", "=", "explode", "(", "','", ",", "$", "excludedIps", ")", ";", "$",...
Checks that the submitted IPs (comma separated list) are valid Returns the cleaned up IPs @param string $excludedIps Comma separated list of IP addresses @throws Exception @return array of IPs
[ "Checks", "that", "the", "submitted", "IPs", "(", "comma", "separated", "list", ")", "are", "valid", "Returns", "the", "cleaned", "up", "IPs" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/SitesManager/API.php#L863-L881
train
Check and return excluded IPs
[ 30522, 2797, 3853, 4638, 5685, 13465, 21737, 2595, 20464, 13936, 11514, 2015, 1006, 1002, 12421, 11514, 2015, 1007, 1063, 2065, 1006, 4064, 1006, 1002, 12421, 11514, 2015, 1007, 1007, 1063, 2709, 1005, 1005, 1025, 1065, 1002, 12997, 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...
slimphp/Slim
Slim/Http/Response.php
Response.withJson
public function withJson($data, $status = null, $encodingOptions = 0) { $response = $this->withBody(new Body(fopen('php://temp', 'r+'))); $response->body->write($json = json_encode($data, $encodingOptions)); // Ensure that the json encoding passed successfully if ($json === false) { throw new RuntimeException(json_last_error_msg(), json_last_error()); } $responseWithJson = $response->withHeader('Content-Type', 'application/json'); if (isset($status)) { return $responseWithJson->withStatus($status); } return $responseWithJson; }
php
public function withJson($data, $status = null, $encodingOptions = 0) { $response = $this->withBody(new Body(fopen('php://temp', 'r+'))); $response->body->write($json = json_encode($data, $encodingOptions)); // Ensure that the json encoding passed successfully if ($json === false) { throw new RuntimeException(json_last_error_msg(), json_last_error()); } $responseWithJson = $response->withHeader('Content-Type', 'application/json'); if (isset($status)) { return $responseWithJson->withStatus($status); } return $responseWithJson; }
[ "public", "function", "withJson", "(", "$", "data", ",", "$", "status", "=", "null", ",", "$", "encodingOptions", "=", "0", ")", "{", "$", "response", "=", "$", "this", "->", "withBody", "(", "new", "Body", "(", "fopen", "(", "'php://temp'", ",", "'r...
Json. Note: This method is not part of the PSR-7 standard. This method prepares the response object to return an HTTP Json response to the client. @param mixed $data The data @param int $status The HTTP status code. @param int $encodingOptions Json encoding options @return static @throws RuntimeException
[ "Json", "." ]
ccef5f7d8bcd469d59cbe64f6210d83764f91543
https://github.com/slimphp/Slim/blob/ccef5f7d8bcd469d59cbe64f6210d83764f91543/Slim/Http/Response.php#L349-L364
train
Return a response with a JSON body
[ 30522, 2270, 3853, 2007, 22578, 2239, 1006, 1002, 2951, 1010, 1002, 3570, 1027, 19701, 1010, 1002, 17181, 7361, 9285, 1027, 1014, 1007, 1063, 1002, 3433, 1027, 1002, 2023, 1011, 1028, 2007, 23684, 1006, 2047, 2303, 1006, 1042, 26915, 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/FileValidator.php
FileValidator.validate
public function validate($value, Constraint $constraint) { if (!$constraint instanceof File) { throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\File'); } if (null === $value || '' === $value) { return; } if ($value instanceof UploadedFile && !$value->isValid()) { switch ($value->getError()) { case UPLOAD_ERR_INI_SIZE: $iniLimitSize = UploadedFile::getMaxFilesize(); if ($constraint->maxSize && $constraint->maxSize < $iniLimitSize) { $limitInBytes = $constraint->maxSize; $binaryFormat = $constraint->binaryFormat; } else { $limitInBytes = $iniLimitSize; $binaryFormat = null === $constraint->binaryFormat ? true : $constraint->binaryFormat; } list($sizeAsString, $limitAsString, $suffix) = $this->factorizeSizes(0, $limitInBytes, $binaryFormat); $this->context->buildViolation($constraint->uploadIniSizeErrorMessage) ->setParameter('{{ limit }}', $limitAsString) ->setParameter('{{ suffix }}', $suffix) ->setCode(UPLOAD_ERR_INI_SIZE) ->addViolation(); return; case UPLOAD_ERR_FORM_SIZE: $this->context->buildViolation($constraint->uploadFormSizeErrorMessage) ->setCode(UPLOAD_ERR_FORM_SIZE) ->addViolation(); return; case UPLOAD_ERR_PARTIAL: $this->context->buildViolation($constraint->uploadPartialErrorMessage) ->setCode(UPLOAD_ERR_PARTIAL) ->addViolation(); return; case UPLOAD_ERR_NO_FILE: $this->context->buildViolation($constraint->uploadNoFileErrorMessage) ->setCode(UPLOAD_ERR_NO_FILE) ->addViolation(); return; case UPLOAD_ERR_NO_TMP_DIR: $this->context->buildViolation($constraint->uploadNoTmpDirErrorMessage) ->setCode(UPLOAD_ERR_NO_TMP_DIR) ->addViolation(); return; case UPLOAD_ERR_CANT_WRITE: $this->context->buildViolation($constraint->uploadCantWriteErrorMessage) ->setCode(UPLOAD_ERR_CANT_WRITE) ->addViolation(); return; case UPLOAD_ERR_EXTENSION: $this->context->buildViolation($constraint->uploadExtensionErrorMessage) ->setCode(UPLOAD_ERR_EXTENSION) ->addViolation(); return; default: $this->context->buildViolation($constraint->uploadErrorMessage) ->setCode($value->getError()) ->addViolation(); return; } } if (!is_scalar($value) && !$value instanceof FileObject && !(\is_object($value) && method_exists($value, '__toString'))) { throw new UnexpectedValueException($value, 'string'); } $path = $value instanceof FileObject ? $value->getPathname() : (string) $value; if (!is_file($path)) { $this->context->buildViolation($constraint->notFoundMessage) ->setParameter('{{ file }}', $this->formatValue($path)) ->setCode(File::NOT_FOUND_ERROR) ->addViolation(); return; } if (!is_readable($path)) { $this->context->buildViolation($constraint->notReadableMessage) ->setParameter('{{ file }}', $this->formatValue($path)) ->setCode(File::NOT_READABLE_ERROR) ->addViolation(); return; } $sizeInBytes = filesize($path); $basename = $value instanceof UploadedFile ? $value->getClientOriginalName() : basename($path); if (0 === $sizeInBytes) { $this->context->buildViolation($constraint->disallowEmptyMessage) ->setParameter('{{ file }}', $this->formatValue($path)) ->setParameter('{{ name }}', $this->formatValue($basename)) ->setCode(File::EMPTY_ERROR) ->addViolation(); return; } if ($constraint->maxSize) { $limitInBytes = $constraint->maxSize; if ($sizeInBytes > $limitInBytes) { list($sizeAsString, $limitAsString, $suffix) = $this->factorizeSizes($sizeInBytes, $limitInBytes, $constraint->binaryFormat); $this->context->buildViolation($constraint->maxSizeMessage) ->setParameter('{{ file }}', $this->formatValue($path)) ->setParameter('{{ size }}', $sizeAsString) ->setParameter('{{ limit }}', $limitAsString) ->setParameter('{{ suffix }}', $suffix) ->setParameter('{{ name }}', $this->formatValue($basename)) ->setCode(File::TOO_LARGE_ERROR) ->addViolation(); return; } } if ($constraint->mimeTypes) { if (!$value instanceof FileObject) { $value = new FileObject($value); } $mimeTypes = (array) $constraint->mimeTypes; $mime = $value->getMimeType(); foreach ($mimeTypes as $mimeType) { if ($mimeType === $mime) { return; } if ($discrete = strstr($mimeType, '/*', true)) { if (strstr($mime, '/', true) === $discrete) { return; } } } $this->context->buildViolation($constraint->mimeTypesMessage) ->setParameter('{{ file }}', $this->formatValue($path)) ->setParameter('{{ type }}', $this->formatValue($mime)) ->setParameter('{{ types }}', $this->formatValues($mimeTypes)) ->setParameter('{{ name }}', $this->formatValue($basename)) ->setCode(File::INVALID_MIME_TYPE_ERROR) ->addViolation(); } }
php
public function validate($value, Constraint $constraint) { if (!$constraint instanceof File) { throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\File'); } if (null === $value || '' === $value) { return; } if ($value instanceof UploadedFile && !$value->isValid()) { switch ($value->getError()) { case UPLOAD_ERR_INI_SIZE: $iniLimitSize = UploadedFile::getMaxFilesize(); if ($constraint->maxSize && $constraint->maxSize < $iniLimitSize) { $limitInBytes = $constraint->maxSize; $binaryFormat = $constraint->binaryFormat; } else { $limitInBytes = $iniLimitSize; $binaryFormat = null === $constraint->binaryFormat ? true : $constraint->binaryFormat; } list($sizeAsString, $limitAsString, $suffix) = $this->factorizeSizes(0, $limitInBytes, $binaryFormat); $this->context->buildViolation($constraint->uploadIniSizeErrorMessage) ->setParameter('{{ limit }}', $limitAsString) ->setParameter('{{ suffix }}', $suffix) ->setCode(UPLOAD_ERR_INI_SIZE) ->addViolation(); return; case UPLOAD_ERR_FORM_SIZE: $this->context->buildViolation($constraint->uploadFormSizeErrorMessage) ->setCode(UPLOAD_ERR_FORM_SIZE) ->addViolation(); return; case UPLOAD_ERR_PARTIAL: $this->context->buildViolation($constraint->uploadPartialErrorMessage) ->setCode(UPLOAD_ERR_PARTIAL) ->addViolation(); return; case UPLOAD_ERR_NO_FILE: $this->context->buildViolation($constraint->uploadNoFileErrorMessage) ->setCode(UPLOAD_ERR_NO_FILE) ->addViolation(); return; case UPLOAD_ERR_NO_TMP_DIR: $this->context->buildViolation($constraint->uploadNoTmpDirErrorMessage) ->setCode(UPLOAD_ERR_NO_TMP_DIR) ->addViolation(); return; case UPLOAD_ERR_CANT_WRITE: $this->context->buildViolation($constraint->uploadCantWriteErrorMessage) ->setCode(UPLOAD_ERR_CANT_WRITE) ->addViolation(); return; case UPLOAD_ERR_EXTENSION: $this->context->buildViolation($constraint->uploadExtensionErrorMessage) ->setCode(UPLOAD_ERR_EXTENSION) ->addViolation(); return; default: $this->context->buildViolation($constraint->uploadErrorMessage) ->setCode($value->getError()) ->addViolation(); return; } } if (!is_scalar($value) && !$value instanceof FileObject && !(\is_object($value) && method_exists($value, '__toString'))) { throw new UnexpectedValueException($value, 'string'); } $path = $value instanceof FileObject ? $value->getPathname() : (string) $value; if (!is_file($path)) { $this->context->buildViolation($constraint->notFoundMessage) ->setParameter('{{ file }}', $this->formatValue($path)) ->setCode(File::NOT_FOUND_ERROR) ->addViolation(); return; } if (!is_readable($path)) { $this->context->buildViolation($constraint->notReadableMessage) ->setParameter('{{ file }}', $this->formatValue($path)) ->setCode(File::NOT_READABLE_ERROR) ->addViolation(); return; } $sizeInBytes = filesize($path); $basename = $value instanceof UploadedFile ? $value->getClientOriginalName() : basename($path); if (0 === $sizeInBytes) { $this->context->buildViolation($constraint->disallowEmptyMessage) ->setParameter('{{ file }}', $this->formatValue($path)) ->setParameter('{{ name }}', $this->formatValue($basename)) ->setCode(File::EMPTY_ERROR) ->addViolation(); return; } if ($constraint->maxSize) { $limitInBytes = $constraint->maxSize; if ($sizeInBytes > $limitInBytes) { list($sizeAsString, $limitAsString, $suffix) = $this->factorizeSizes($sizeInBytes, $limitInBytes, $constraint->binaryFormat); $this->context->buildViolation($constraint->maxSizeMessage) ->setParameter('{{ file }}', $this->formatValue($path)) ->setParameter('{{ size }}', $sizeAsString) ->setParameter('{{ limit }}', $limitAsString) ->setParameter('{{ suffix }}', $suffix) ->setParameter('{{ name }}', $this->formatValue($basename)) ->setCode(File::TOO_LARGE_ERROR) ->addViolation(); return; } } if ($constraint->mimeTypes) { if (!$value instanceof FileObject) { $value = new FileObject($value); } $mimeTypes = (array) $constraint->mimeTypes; $mime = $value->getMimeType(); foreach ($mimeTypes as $mimeType) { if ($mimeType === $mime) { return; } if ($discrete = strstr($mimeType, '/*', true)) { if (strstr($mime, '/', true) === $discrete) { return; } } } $this->context->buildViolation($constraint->mimeTypesMessage) ->setParameter('{{ file }}', $this->formatValue($path)) ->setParameter('{{ type }}', $this->formatValue($mime)) ->setParameter('{{ types }}', $this->formatValues($mimeTypes)) ->setParameter('{{ name }}', $this->formatValue($basename)) ->setCode(File::INVALID_MIME_TYPE_ERROR) ->addViolation(); } }
[ "public", "function", "validate", "(", "$", "value", ",", "Constraint", "$", "constraint", ")", "{", "if", "(", "!", "$", "constraint", "instanceof", "File", ")", "{", "throw", "new", "UnexpectedTypeException", "(", "$", "constraint", ",", "__NAMESPACE__", "...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Validator/Constraints/FileValidator.php#L42-L200
train
Validates a file
[ 30522, 2270, 3853, 9398, 3686, 1006, 1002, 3643, 1010, 27142, 1002, 27142, 1007, 1063, 2065, 1006, 999, 1002, 27142, 6013, 11253, 5371, 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/Support/Collection.php
Collection.concat
public function concat($source) { $result = new static($this); foreach ($source as $item) { $result->push($item); } return $result; }
php
public function concat($source) { $result = new static($this); foreach ($source as $item) { $result->push($item); } return $result; }
[ "public", "function", "concat", "(", "$", "source", ")", "{", "$", "result", "=", "new", "static", "(", "$", "this", ")", ";", "foreach", "(", "$", "source", "as", "$", "item", ")", "{", "$", "result", "->", "push", "(", "$", "item", ")", ";", ...
Push all of the given items onto the collection. @param iterable $source @return static
[ "Push", "all", "of", "the", "given", "items", "onto", "the", "collection", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Support/Collection.php#L1438-L1447
train
Concat this array with the array of items from the source array.
[ 30522, 2270, 3853, 9530, 11266, 1006, 1002, 3120, 1007, 1063, 1002, 2765, 1027, 2047, 10763, 1006, 1002, 2023, 1007, 1025, 18921, 6776, 1006, 1002, 3120, 2004, 1002, 8875, 1007, 1063, 1002, 2765, 1011, 1028, 5245, 1006, 1002, 8875, 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...
octobercms/october
modules/system/classes/UpdateManager.php
UpdateManager.setBuildNumberManually
public function setBuildNumberManually() { $postData = []; if (Config::get('cms.edgeUpdates', false)) { $postData['edge'] = 1; } $result = $this->requestServerData('ping', $postData); $build = (int) array_get($result, 'pong', 420); $this->setBuild($build); return $build; }
php
public function setBuildNumberManually() { $postData = []; if (Config::get('cms.edgeUpdates', false)) { $postData['edge'] = 1; } $result = $this->requestServerData('ping', $postData); $build = (int) array_get($result, 'pong', 420); $this->setBuild($build); return $build; }
[ "public", "function", "setBuildNumberManually", "(", ")", "{", "$", "postData", "=", "[", "]", ";", "if", "(", "Config", "::", "get", "(", "'cms.edgeUpdates'", ",", "false", ")", ")", "{", "$", "postData", "[", "'edge'", "]", "=", "1", ";", "}", "$",...
Asks the gateway for the lastest build number and stores it. @return void
[ "Asks", "the", "gateway", "for", "the", "lastest", "build", "number", "and", "stores", "it", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/UpdateManager.php#L371-L386
train
This method sets the build number to the current build number.
[ 30522, 2270, 3853, 2275, 8569, 4014, 2094, 19172, 23991, 28488, 1006, 1007, 1063, 1002, 2695, 2850, 2696, 1027, 1031, 1033, 1025, 2065, 1006, 9530, 8873, 2290, 1024, 1024, 2131, 1006, 1005, 4642, 2015, 1012, 3341, 6279, 27122, 1005, 1010, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Manager.php
Manager.getLoadedPlugin
public function getLoadedPlugin($name) { if (!isset($this->loadedPlugins[$name]) || is_null($this->loadedPlugins[$name])) { throw new \Exception("The plugin '$name' has not been loaded."); } return $this->loadedPlugins[$name]; }
php
public function getLoadedPlugin($name) { if (!isset($this->loadedPlugins[$name]) || is_null($this->loadedPlugins[$name])) { throw new \Exception("The plugin '$name' has not been loaded."); } return $this->loadedPlugins[$name]; }
[ "public", "function", "getLoadedPlugin", "(", "$", "name", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "loadedPlugins", "[", "$", "name", "]", ")", "||", "is_null", "(", "$", "this", "->", "loadedPlugins", "[", "$", "name", "]", ")", ...
Returns a Plugin object by name. @param string $name The name of the plugin, eg, `'Actions'`. @throws \Exception If the plugin has not been loaded. @return Plugin
[ "Returns", "a", "Plugin", "object", "by", "name", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Plugin/Manager.php#L995-L1001
train
Get the loaded plugin
[ 30522, 2270, 3853, 2131, 17468, 24759, 15916, 2378, 1006, 1002, 2171, 1007, 1063, 2065, 1006, 999, 26354, 3388, 1006, 1002, 2023, 1011, 1028, 8209, 24759, 15916, 7076, 1031, 1002, 2171, 1033, 1007, 1064, 1064, 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/Plugin/WidgetsProvider.php
WidgetsProvider.factory
public function factory($module, $action) { if (empty($module) || empty($action)) { return; } try { if (!$this->pluginManager->isPluginActivated($module)) { return; } $plugin = $this->pluginManager->getLoadedPlugin($module); } catch (\Exception $e) { // we are not allowed to use possible widgets, plugin is not active return; } /** @var Widget[] $widgetContainer */ $widgets = $plugin->findMultipleComponents('Widgets', 'Piwik\\Widget\\Widget'); foreach ($widgets as $widgetClass) { $config = $this->getWidgetConfigForClassName($widgetClass); if ($config->getAction() === $action) { $config->checkIsEnabled(); return StaticContainer::get($widgetClass); } } }
php
public function factory($module, $action) { if (empty($module) || empty($action)) { return; } try { if (!$this->pluginManager->isPluginActivated($module)) { return; } $plugin = $this->pluginManager->getLoadedPlugin($module); } catch (\Exception $e) { // we are not allowed to use possible widgets, plugin is not active return; } /** @var Widget[] $widgetContainer */ $widgets = $plugin->findMultipleComponents('Widgets', 'Piwik\\Widget\\Widget'); foreach ($widgets as $widgetClass) { $config = $this->getWidgetConfigForClassName($widgetClass); if ($config->getAction() === $action) { $config->checkIsEnabled(); return StaticContainer::get($widgetClass); } } }
[ "public", "function", "factory", "(", "$", "module", ",", "$", "action", ")", "{", "if", "(", "empty", "(", "$", "module", ")", "||", "empty", "(", "$", "action", ")", ")", "{", "return", ";", "}", "try", "{", "if", "(", "!", "$", "this", "->",...
Get the widget defined by the given module and action. @param string $module Aka plugin name, eg 'CoreHome' @param string $action An action eg 'renderMe' @return Widget|null @throws \Exception Throws an exception if the widget is not enabled.
[ "Get", "the", "widget", "defined", "by", "the", "given", "module", "and", "action", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Plugin/WidgetsProvider.php#L96-L123
train
Factory method for creating widgets for a module and action
[ 30522, 2270, 3853, 4713, 1006, 1002, 11336, 1010, 1002, 2895, 1007, 1063, 2065, 1006, 4064, 1006, 1002, 11336, 1007, 1064, 1064, 4064, 1006, 1002, 2895, 1007, 1007, 1063, 2709, 1025, 1065, 3046, 1063, 2065, 1006, 999, 1002, 2023, 1011, 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/Support/Collection.php
Collection.except
public function except($keys) { if ($keys instanceof self) { $keys = $keys->all(); } elseif (! is_array($keys)) { $keys = func_get_args(); } return new static(Arr::except($this->items, $keys)); }
php
public function except($keys) { if ($keys instanceof self) { $keys = $keys->all(); } elseif (! is_array($keys)) { $keys = func_get_args(); } return new static(Arr::except($this->items, $keys)); }
[ "public", "function", "except", "(", "$", "keys", ")", "{", "if", "(", "$", "keys", "instanceof", "self", ")", "{", "$", "keys", "=", "$", "keys", "->", "all", "(", ")", ";", "}", "elseif", "(", "!", "is_array", "(", "$", "keys", ")", ")", "{",...
Get all items except for those with the specified keys. @param \Illuminate\Support\Collection|mixed $keys @return static
[ "Get", "all", "items", "except", "for", "those", "with", "the", "specified", "keys", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Support/Collection.php#L529-L538
train
Return a new Collection containing only the items with the given keys.
[ 30522, 2270, 3853, 3272, 1006, 1002, 6309, 1007, 1063, 2065, 1006, 1002, 6309, 6013, 11253, 2969, 1007, 1063, 1002, 6309, 1027, 1002, 6309, 1011, 1028, 2035, 1006, 1007, 1025, 1065, 2842, 10128, 1006, 999, 2003, 1035, 9140, 1006, 1002, 63...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Exporter.php
Exporter.resolve
public function resolve($driver) { if ($driver instanceof Grid\Exporters\AbstractExporter) { return $driver->setGrid($this->grid); } return $this->getExporter($driver); }
php
public function resolve($driver) { if ($driver instanceof Grid\Exporters\AbstractExporter) { return $driver->setGrid($this->grid); } return $this->getExporter($driver); }
[ "public", "function", "resolve", "(", "$", "driver", ")", "{", "if", "(", "$", "driver", "instanceof", "Grid", "\\", "Exporters", "\\", "AbstractExporter", ")", "{", "return", "$", "driver", "->", "setGrid", "(", "$", "this", "->", "grid", ")", ";", "}...
Resolve export driver. @param string $driver @return CsvExporter
[ "Resolve", "export", "driver", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid/Exporter.php#L76-L83
train
Resolve the exporter
[ 30522, 2270, 3853, 10663, 1006, 1002, 4062, 1007, 1063, 2065, 1006, 1002, 4062, 6013, 11253, 8370, 1032, 9167, 2545, 1032, 10061, 10288, 6442, 2121, 1007, 1063, 2709, 1002, 4062, 1011, 1028, 2275, 16523, 3593, 1006, 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...
z-song/laravel-admin
src/Admin.php
Admin.bootstrap
public function bootstrap() { $this->fireBootingCallbacks(); Form::registerBuiltinFields(); Grid::registerColumnDisplayer(); Grid\Filter::registerFilters(); require config('admin.bootstrap', admin_path('bootstrap.php')); $assets = Form::collectFieldAssets(); self::css($assets['css']); self::js($assets['js']); $this->fireBootedCallbacks(); }
php
public function bootstrap() { $this->fireBootingCallbacks(); Form::registerBuiltinFields(); Grid::registerColumnDisplayer(); Grid\Filter::registerFilters(); require config('admin.bootstrap', admin_path('bootstrap.php')); $assets = Form::collectFieldAssets(); self::css($assets['css']); self::js($assets['js']); $this->fireBootedCallbacks(); }
[ "public", "function", "bootstrap", "(", ")", "{", "$", "this", "->", "fireBootingCallbacks", "(", ")", ";", "Form", "::", "registerBuiltinFields", "(", ")", ";", "Grid", "::", "registerColumnDisplayer", "(", ")", ";", "Grid", "\\", "Filter", "::", "registerF...
Bootstrap the admin application.
[ "Bootstrap", "the", "admin", "application", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Admin.php#L321-L339
train
Bootstraps the admin
[ 30522, 2270, 3853, 6879, 6494, 2361, 1006, 1007, 1063, 1002, 2023, 1011, 1028, 2543, 27927, 2075, 9289, 20850, 8684, 2015, 1006, 1007, 1025, 2433, 1024, 1024, 4236, 8569, 4014, 7629, 15155, 1006, 1007, 1025, 8370, 1024, 1024, 30524, 2361, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Extractor/PhpStringTokenParser.php
PhpStringTokenParser.parseDocString
public static function parseDocString($startToken, $str) { // strip last newline (thanks tokenizer for sticking it into the string!) $str = preg_replace('~(\r\n|\n|\r)$~', '', $str); // nowdoc string if (false !== strpos($startToken, '\'')) { return $str; } return self::parseEscapeSequences($str, null); }
php
public static function parseDocString($startToken, $str) { // strip last newline (thanks tokenizer for sticking it into the string!) $str = preg_replace('~(\r\n|\n|\r)$~', '', $str); // nowdoc string if (false !== strpos($startToken, '\'')) { return $str; } return self::parseEscapeSequences($str, null); }
[ "public", "static", "function", "parseDocString", "(", "$", "startToken", ",", "$", "str", ")", "{", "// strip last newline (thanks tokenizer for sticking it into the string!)", "$", "str", "=", "preg_replace", "(", "'~(\\r\\n|\\n|\\r)$~'", ",", "''", ",", "$", "str", ...
Parses a constant doc string. @param string $startToken Doc string start token content (<<<SMTHG) @param string $str String token content @return string Parsed string
[ "Parses", "a", "constant", "doc", "string", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Translation/Extractor/PhpStringTokenParser.php#L130-L141
train
Parse doc string
[ 30522, 2270, 10763, 3853, 11968, 6924, 10085, 3367, 4892, 1006, 1002, 2707, 18715, 2368, 1010, 1002, 2358, 2099, 1007, 1063, 1013, 1013, 6167, 2197, 2047, 4179, 1006, 4283, 19204, 17629, 2005, 13423, 2009, 2046, 1996, 5164, 999, 1007, 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/Db.php
Db.segmentedFetchFirst
public static function segmentedFetchFirst($sql, $first, $last, $step, $params = array()) { $result = false; if ($step > 0) { for ($i = $first; $result === false && $i <= $last; $i += $step) { $result = self::fetchOne($sql, array_merge($params, array($i, $i + $step))); } } else { for ($i = $first; $result === false && $i >= $last; $i += $step) { $result = self::fetchOne($sql, array_merge($params, array($i, $i + $step))); } } return $result; }
php
public static function segmentedFetchFirst($sql, $first, $last, $step, $params = array()) { $result = false; if ($step > 0) { for ($i = $first; $result === false && $i <= $last; $i += $step) { $result = self::fetchOne($sql, array_merge($params, array($i, $i + $step))); } } else { for ($i = $first; $result === false && $i >= $last; $i += $step) { $result = self::fetchOne($sql, array_merge($params, array($i, $i + $step))); } } return $result; }
[ "public", "static", "function", "segmentedFetchFirst", "(", "$", "sql", ",", "$", "first", ",", "$", "last", ",", "$", "step", ",", "$", "params", "=", "array", "(", ")", ")", "{", "$", "result", "=", "false", ";", "if", "(", "$", "step", ">", "0...
Performs a `SELECT` statement on a table one chunk at a time and returns the first successfully fetched value. This function will execute a query on one set of rows in a table. If nothing is fetched, it will execute the query on the next set of rows and so on until the query returns a value. This function will break up a `SELECT into several smaller `SELECT`s and should be used when performing a `SELECT` that can take a long time to finish. Using several smaller `SELECT`s will ensure that the table will not be locked for too long. **Example** // find the most recent visit that is older than a certain date $dateStart = // ... $sql = "SELECT idvisit FROM $logVisit WHERE '$dateStart' > visit_last_action_time AND idvisit <= ? AND idvisit > ? ORDER BY idvisit DESC LIMIT 1"; // since visits return Db::segmentedFetchFirst($sql, $maxIdVisit, 0, -self::$selectSegmentSize); @param string $sql The SQL to perform. The last two conditions of the `WHERE` expression must be as follows: `'id >= ? AND id < ?'` where **id** is the int id of the table. @param int $first The minimum ID to loop from. @param int $last The maximum ID to loop to. @param int $step The maximum number of rows to scan in one query. @param array $params Parameters to bind in the query, eg, `array(param1 => value1, param2 => value2)` @return string
[ "Performs", "a", "SELECT", "statement", "on", "a", "table", "one", "chunk", "at", "a", "time", "and", "returns", "the", "first", "successfully", "fetched", "value", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Db.php#L513-L528
train
Performs a SELECT or SHOW statement on the database.
[ 30522, 2270, 10763, 3853, 6903, 2098, 7959, 10649, 8873, 12096, 1006, 1002, 29296, 1010, 1002, 2034, 1010, 1002, 2197, 1010, 1002, 3357, 1010, 1002, 11498, 5244, 1027, 9140, 1006, 1007, 1007, 1063, 1002, 2765, 1027, 6270, 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...
octobercms/october
modules/backend/widgets/Lists.php
Lists.prepareQuery
public function prepareQuery() { $query = $this->model->newQuery(); $primaryTable = $this->model->getTable(); $selects = [$primaryTable.'.*']; $joins = []; $withs = []; /** * @event backend.list.extendQueryBefore * Provides an opportunity to modify the `$query` object before the List widget applies its scopes to it. * * Example usage: * * Event::listen('backend.list.extendQueryBefore', function($listWidget, $query) { * $query->whereNull('deleted_at'); * }); * * Or * * $listWidget->bindEvent('list.extendQueryBefore', function ($query) { * $query->whereNull('deleted_at'); * }); * */ $this->fireSystemEvent('backend.list.extendQueryBefore', [$query]); /* * Prepare searchable column names */ $primarySearchable = []; $relationSearchable = []; $columnsToSearch = []; if (!empty($this->searchTerm) && ($searchableColumns = $this->getSearchableColumns())) { foreach ($searchableColumns as $column) { /* * Related */ if ($this->isColumnRelated($column)) { $table = $this->model->makeRelation($column->relation)->getTable(); $columnName = isset($column->sqlSelect) ? DbDongle::raw($this->parseTableName($column->sqlSelect, $table)) : $table . '.' . $column->valueFrom; $relationSearchable[$column->relation][] = $columnName; } /* * Primary */ else { $columnName = isset($column->sqlSelect) ? DbDongle::raw($this->parseTableName($column->sqlSelect, $primaryTable)) : DbDongle::cast(Db::getTablePrefix() . $primaryTable . '.' . $column->columnName, 'TEXT'); $primarySearchable[] = $columnName; } } } /* * Prepare related eager loads (withs) and custom selects (joins) */ foreach ($this->getVisibleColumns() as $column) { // If useRelationCount is enabled, eager load the count of the relation into $relation_count if ($column->relation && @$column->config['useRelationCount']) { $query->withCount($column->relation); } if (!$this->isColumnRelated($column) || (!isset($column->sqlSelect) && !isset($column->valueFrom))) { continue; } if (isset($column->valueFrom)) { $withs[] = $column->relation; } $joins[] = $column->relation; } /* * Add eager loads to the query */ if ($withs) { $query->with(array_unique($withs)); } /* * Apply search term */ $query->where(function ($innerQuery) use ($primarySearchable, $relationSearchable, $joins) { /* * Search primary columns */ if (count($primarySearchable) > 0) { $this->applySearchToQuery($innerQuery, $primarySearchable, 'or'); } /* * Search relation columns */ if ($joins) { foreach (array_unique($joins) as $join) { /* * Apply a supplied search term for relation columns and * constrain the query only if there is something to search for */ $columnsToSearch = array_get($relationSearchable, $join, []); if (count($columnsToSearch) > 0) { $innerQuery->orWhereHas($join, function ($_query) use ($columnsToSearch) { $this->applySearchToQuery($_query, $columnsToSearch); }); } } } }); /* * Custom select queries */ foreach ($this->getVisibleColumns() as $column) { if (!isset($column->sqlSelect)) { continue; } $alias = $query->getQuery()->getGrammar()->wrap($column->columnName); /* * Relation column */ if (isset($column->relation)) { // @todo Find a way... $relationType = $this->model->getRelationType($column->relation); if ($relationType == 'morphTo') { throw new ApplicationException('The relationship morphTo is not supported for list columns.'); } $table = $this->model->makeRelation($column->relation)->getTable(); $sqlSelect = $this->parseTableName($column->sqlSelect, $table); /* * Manipulate a count query for the sub query */ $relationObj = $this->model->{$column->relation}(); $countQuery = $relationObj->getRelationExistenceQuery($relationObj->getRelated()->newQueryWithoutScopes(), $query); $joinSql = $this->isColumnRelated($column, true) ? DbDongle::raw("group_concat(" . $sqlSelect . " separator ', ')") : DbDongle::raw($sqlSelect); $joinSql = $countQuery->select($joinSql)->toSql(); $selects[] = Db::raw("(".$joinSql.") as ".$alias); } /* * Primary column */ else { $sqlSelect = $this->parseTableName($column->sqlSelect, $primaryTable); $selects[] = DbDongle::raw($sqlSelect . ' as '. $alias); } } /* * Apply sorting */ if (($sortColumn = $this->getSortColumn()) && !$this->showTree) { if (($column = array_get($this->allColumns, $sortColumn)) && $column->valueFrom) { $sortColumn = $this->isColumnPivot($column) ? 'pivot_' . $column->valueFrom : $column->valueFrom; } // Set the sorting column to $relation_count if useRelationCount enabled if (isset($column->relation) && @$column->config['useRelationCount']) { $sortColumn = $column->relation . '_count'; } $query->orderBy($sortColumn, $this->sortDirection); } /* * Apply filters */ foreach ($this->filterCallbacks as $callback) { $callback($query); } /* * Add custom selects */ $query->addSelect($selects); /** * @event backend.list.extendQuery * Provides an opportunity to modify and / or return the `$query` object after the List widget has applied its scopes to it and before it's used to get the records. * * Example usage: * * Event::listen('backend.list.extendQuery', function($listWidget, $query) { * $newQuery = MyModel::newQuery(); * return $newQuery; * }); * * Or * * $listWidget->bindEvent('list.extendQuery', function ($query) { * $query->whereNull('deleted_at'); * }); * */ if ($event = $this->fireSystemEvent('backend.list.extendQuery', [$query])) { return $event; } return $query; }
php
public function prepareQuery() { $query = $this->model->newQuery(); $primaryTable = $this->model->getTable(); $selects = [$primaryTable.'.*']; $joins = []; $withs = []; /** * @event backend.list.extendQueryBefore * Provides an opportunity to modify the `$query` object before the List widget applies its scopes to it. * * Example usage: * * Event::listen('backend.list.extendQueryBefore', function($listWidget, $query) { * $query->whereNull('deleted_at'); * }); * * Or * * $listWidget->bindEvent('list.extendQueryBefore', function ($query) { * $query->whereNull('deleted_at'); * }); * */ $this->fireSystemEvent('backend.list.extendQueryBefore', [$query]); /* * Prepare searchable column names */ $primarySearchable = []; $relationSearchable = []; $columnsToSearch = []; if (!empty($this->searchTerm) && ($searchableColumns = $this->getSearchableColumns())) { foreach ($searchableColumns as $column) { /* * Related */ if ($this->isColumnRelated($column)) { $table = $this->model->makeRelation($column->relation)->getTable(); $columnName = isset($column->sqlSelect) ? DbDongle::raw($this->parseTableName($column->sqlSelect, $table)) : $table . '.' . $column->valueFrom; $relationSearchable[$column->relation][] = $columnName; } /* * Primary */ else { $columnName = isset($column->sqlSelect) ? DbDongle::raw($this->parseTableName($column->sqlSelect, $primaryTable)) : DbDongle::cast(Db::getTablePrefix() . $primaryTable . '.' . $column->columnName, 'TEXT'); $primarySearchable[] = $columnName; } } } /* * Prepare related eager loads (withs) and custom selects (joins) */ foreach ($this->getVisibleColumns() as $column) { // If useRelationCount is enabled, eager load the count of the relation into $relation_count if ($column->relation && @$column->config['useRelationCount']) { $query->withCount($column->relation); } if (!$this->isColumnRelated($column) || (!isset($column->sqlSelect) && !isset($column->valueFrom))) { continue; } if (isset($column->valueFrom)) { $withs[] = $column->relation; } $joins[] = $column->relation; } /* * Add eager loads to the query */ if ($withs) { $query->with(array_unique($withs)); } /* * Apply search term */ $query->where(function ($innerQuery) use ($primarySearchable, $relationSearchable, $joins) { /* * Search primary columns */ if (count($primarySearchable) > 0) { $this->applySearchToQuery($innerQuery, $primarySearchable, 'or'); } /* * Search relation columns */ if ($joins) { foreach (array_unique($joins) as $join) { /* * Apply a supplied search term for relation columns and * constrain the query only if there is something to search for */ $columnsToSearch = array_get($relationSearchable, $join, []); if (count($columnsToSearch) > 0) { $innerQuery->orWhereHas($join, function ($_query) use ($columnsToSearch) { $this->applySearchToQuery($_query, $columnsToSearch); }); } } } }); /* * Custom select queries */ foreach ($this->getVisibleColumns() as $column) { if (!isset($column->sqlSelect)) { continue; } $alias = $query->getQuery()->getGrammar()->wrap($column->columnName); /* * Relation column */ if (isset($column->relation)) { // @todo Find a way... $relationType = $this->model->getRelationType($column->relation); if ($relationType == 'morphTo') { throw new ApplicationException('The relationship morphTo is not supported for list columns.'); } $table = $this->model->makeRelation($column->relation)->getTable(); $sqlSelect = $this->parseTableName($column->sqlSelect, $table); /* * Manipulate a count query for the sub query */ $relationObj = $this->model->{$column->relation}(); $countQuery = $relationObj->getRelationExistenceQuery($relationObj->getRelated()->newQueryWithoutScopes(), $query); $joinSql = $this->isColumnRelated($column, true) ? DbDongle::raw("group_concat(" . $sqlSelect . " separator ', ')") : DbDongle::raw($sqlSelect); $joinSql = $countQuery->select($joinSql)->toSql(); $selects[] = Db::raw("(".$joinSql.") as ".$alias); } /* * Primary column */ else { $sqlSelect = $this->parseTableName($column->sqlSelect, $primaryTable); $selects[] = DbDongle::raw($sqlSelect . ' as '. $alias); } } /* * Apply sorting */ if (($sortColumn = $this->getSortColumn()) && !$this->showTree) { if (($column = array_get($this->allColumns, $sortColumn)) && $column->valueFrom) { $sortColumn = $this->isColumnPivot($column) ? 'pivot_' . $column->valueFrom : $column->valueFrom; } // Set the sorting column to $relation_count if useRelationCount enabled if (isset($column->relation) && @$column->config['useRelationCount']) { $sortColumn = $column->relation . '_count'; } $query->orderBy($sortColumn, $this->sortDirection); } /* * Apply filters */ foreach ($this->filterCallbacks as $callback) { $callback($query); } /* * Add custom selects */ $query->addSelect($selects); /** * @event backend.list.extendQuery * Provides an opportunity to modify and / or return the `$query` object after the List widget has applied its scopes to it and before it's used to get the records. * * Example usage: * * Event::listen('backend.list.extendQuery', function($listWidget, $query) { * $newQuery = MyModel::newQuery(); * return $newQuery; * }); * * Or * * $listWidget->bindEvent('list.extendQuery', function ($query) { * $query->whereNull('deleted_at'); * }); * */ if ($event = $this->fireSystemEvent('backend.list.extendQuery', [$query])) { return $event; } return $query; }
[ "public", "function", "prepareQuery", "(", ")", "{", "$", "query", "=", "$", "this", "->", "model", "->", "newQuery", "(", ")", ";", "$", "primaryTable", "=", "$", "this", "->", "model", "->", "getTable", "(", ")", ";", "$", "selects", "=", "[", "$...
Applies any filters to the model.
[ "Applies", "any", "filters", "to", "the", "model", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/Lists.php#L346-L567
train
Prepares the query object for the list widget.
[ 30522, 2270, 3853, 7374, 4226, 2854, 1006, 1007, 1063, 1002, 23032, 1027, 1002, 2023, 1011, 1028, 2944, 1011, 1028, 2047, 4226, 2854, 1006, 1007, 1025, 1002, 3078, 10880, 1027, 1002, 2023, 1011, 1028, 2944, 1011, 1028, 2131, 10880, 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...
matomo-org/matomo
libs/Zend/Db/Table/Definition.php
Zend_Db_Table_Definition.setOptions
public function setOptions(Array $options) { foreach ($options as $optionName => $optionValue) { $this->setTableConfig($optionName, $optionValue); } return $this; }
php
public function setOptions(Array $options) { foreach ($options as $optionName => $optionValue) { $this->setTableConfig($optionName, $optionValue); } return $this; }
[ "public", "function", "setOptions", "(", "Array", "$", "options", ")", "{", "foreach", "(", "$", "options", "as", "$", "optionName", "=>", "$", "optionValue", ")", "{", "$", "this", "->", "setTableConfig", "(", "$", "optionName", ",", "$", "optionValue", ...
setOptions() @param array $options @return Zend_Db_Table_Definition
[ "setOptions", "()" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Table/Definition.php#L72-L78
train
Set options for the table
[ 30522, 2270, 3853, 2275, 7361, 9285, 1006, 9140, 1002, 7047, 1007, 1063, 18921, 6776, 1006, 1002, 7047, 2004, 1002, 5724, 18442, 1027, 1028, 1002, 5724, 10175, 5657, 1007, 1063, 1002, 2023, 1011, 1028, 2275, 10880, 8663, 8873, 2290, 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/system/classes/PluginManager.php
PluginManager.bootAll
public function bootAll($force = false) { if ($this->booted && !$force) { return; } foreach ($this->plugins as $plugin) { $this->bootPlugin($plugin); } $this->booted = true; }
php
public function bootAll($force = false) { if ($this->booted && !$force) { return; } foreach ($this->plugins as $plugin) { $this->bootPlugin($plugin); } $this->booted = true; }
[ "public", "function", "bootAll", "(", "$", "force", "=", "false", ")", "{", "if", "(", "$", "this", "->", "booted", "&&", "!", "$", "force", ")", "{", "return", ";", "}", "foreach", "(", "$", "this", "->", "plugins", "as", "$", "plugin", ")", "{"...
Runs the boot() method on all plugins. Can only be called once.
[ "Runs", "the", "boot", "()", "method", "on", "all", "plugins", ".", "Can", "only", "be", "called", "once", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/PluginManager.php#L268-L279
train
Boot all the plugins
[ 30522, 2270, 3853, 9573, 8095, 1006, 1002, 2486, 1027, 6270, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 9573, 2098, 1004, 1004, 999, 1002, 2486, 1007, 1063, 2709, 1025, 1065, 18921, 6776, 1006, 1002, 2023, 1011, 1028, 13354, 7076, 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/Tasks.php
Tasks.custom
protected function custom($objectOrClassName, $methodName, $methodParameter, $time, $priority = self::NORMAL_PRIORITY) { $this->checkIsValidTask($objectOrClassName, $methodName); if (is_string($time)) { $time = Schedule::factory($time); } if (!($time instanceof Schedule)) { throw new \Exception('$time should be an instance of Schedule'); } $this->scheduleTask(new Task($objectOrClassName, $methodName, $methodParameter, $time, $priority)); return $time; }
php
protected function custom($objectOrClassName, $methodName, $methodParameter, $time, $priority = self::NORMAL_PRIORITY) { $this->checkIsValidTask($objectOrClassName, $methodName); if (is_string($time)) { $time = Schedule::factory($time); } if (!($time instanceof Schedule)) { throw new \Exception('$time should be an instance of Schedule'); } $this->scheduleTask(new Task($objectOrClassName, $methodName, $methodParameter, $time, $priority)); return $time; }
[ "protected", "function", "custom", "(", "$", "objectOrClassName", ",", "$", "methodName", ",", "$", "methodParameter", ",", "$", "time", ",", "$", "priority", "=", "self", "::", "NORMAL_PRIORITY", ")", "{", "$", "this", "->", "checkIsValidTask", "(", "$", ...
Schedules the given tasks/method to run depending at the given scheduled time. Unlike the convenient methods such as {@link hourly()} you need to specify the object on which the given method should be called. This can be either an instance of a class or a class name. For more information about these parameters see {@link hourly()} @param string|object $objectOrClassName @param string $methodName @param null|string $methodParameter @param string|Schedule $time @param int $priority @return \Piwik\Scheduler\Schedule\Schedule @throws \Exception If a wrong time format is given. Needs to be either a string such as 'daily', 'weekly', ... or an instance of {@link Piwik\Scheduler\Schedule\Schedule} @api
[ "Schedules", "the", "given", "tasks", "/", "method", "to", "run", "depending", "at", "the", "given", "scheduled", "time", ".", "Unlike", "the", "convenient", "methods", "such", "as", "{", "@link", "hourly", "()", "}", "you", "need", "to", "specify", "the",...
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Plugin/Tasks.php#L122-L137
train
Custom method to add a new task to the queue
[ 30522, 5123, 3853, 7661, 1006, 1002, 4874, 2953, 26266, 18442, 1010, 1002, 4118, 18442, 1010, 1002, 4118, 28689, 22828, 1010, 1002, 2051, 1010, 1002, 9470, 1027, 2969, 1024, 1024, 3671, 1035, 9470, 1007, 1063, 1002, 2023, 1011, 1028, 4638, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Debug/ErrorHandler.php
ErrorHandler.register
public static function register(self $handler = null, $replace = true) { if (null === self::$reservedMemory) { self::$reservedMemory = str_repeat('x', 10240); register_shutdown_function(__CLASS__.'::handleFatalError'); } if ($handlerIsNew = null === $handler) { $handler = new static(); } if (null === $prev = set_error_handler([$handler, 'handleError'])) { restore_error_handler(); // Specifying the error types earlier would expose us to https://bugs.php.net/63206 set_error_handler([$handler, 'handleError'], $handler->thrownErrors | $handler->loggedErrors); $handler->isRoot = true; } if ($handlerIsNew && \is_array($prev) && $prev[0] instanceof self) { $handler = $prev[0]; $replace = false; } if (!$replace && $prev) { restore_error_handler(); $handlerIsRegistered = \is_array($prev) && $handler === $prev[0]; } else { $handlerIsRegistered = true; } if (\is_array($prev = set_exception_handler([$handler, 'handleException'])) && $prev[0] instanceof self) { restore_exception_handler(); if (!$handlerIsRegistered) { $handler = $prev[0]; } elseif ($handler !== $prev[0] && $replace) { set_exception_handler([$handler, 'handleException']); $p = $prev[0]->setExceptionHandler(null); $handler->setExceptionHandler($p); $prev[0]->setExceptionHandler($p); } } else { $handler->setExceptionHandler($prev); } $handler->throwAt(E_ALL & $handler->thrownErrors, true); return $handler; }
php
public static function register(self $handler = null, $replace = true) { if (null === self::$reservedMemory) { self::$reservedMemory = str_repeat('x', 10240); register_shutdown_function(__CLASS__.'::handleFatalError'); } if ($handlerIsNew = null === $handler) { $handler = new static(); } if (null === $prev = set_error_handler([$handler, 'handleError'])) { restore_error_handler(); // Specifying the error types earlier would expose us to https://bugs.php.net/63206 set_error_handler([$handler, 'handleError'], $handler->thrownErrors | $handler->loggedErrors); $handler->isRoot = true; } if ($handlerIsNew && \is_array($prev) && $prev[0] instanceof self) { $handler = $prev[0]; $replace = false; } if (!$replace && $prev) { restore_error_handler(); $handlerIsRegistered = \is_array($prev) && $handler === $prev[0]; } else { $handlerIsRegistered = true; } if (\is_array($prev = set_exception_handler([$handler, 'handleException'])) && $prev[0] instanceof self) { restore_exception_handler(); if (!$handlerIsRegistered) { $handler = $prev[0]; } elseif ($handler !== $prev[0] && $replace) { set_exception_handler([$handler, 'handleException']); $p = $prev[0]->setExceptionHandler(null); $handler->setExceptionHandler($p); $prev[0]->setExceptionHandler($p); } } else { $handler->setExceptionHandler($prev); } $handler->throwAt(E_ALL & $handler->thrownErrors, true); return $handler; }
[ "public", "static", "function", "register", "(", "self", "$", "handler", "=", "null", ",", "$", "replace", "=", "true", ")", "{", "if", "(", "null", "===", "self", "::", "$", "reservedMemory", ")", "{", "self", "::", "$", "reservedMemory", "=", "str_re...
Registers the error handler. @param self|null $handler The handler to register @param bool $replace Whether to replace or not any existing handler @return self The registered error handler
[ "Registers", "the", "error", "handler", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Debug/ErrorHandler.php#L115-L160
train
Registers the error handler
[ 30522, 2270, 10763, 3853, 4236, 1006, 2969, 1002, 28213, 1027, 19701, 1010, 1002, 5672, 1027, 2995, 1007, 1063, 2065, 1006, 19701, 1027, 1027, 1027, 2969, 1024, 1024, 1002, 9235, 4168, 5302, 2854, 1007, 1063, 2969, 1024, 1024, 1002, 9235, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/AppVariable.php
AppVariable.getUser
public function getUser() { if (null === $tokenStorage = $this->tokenStorage) { throw new \RuntimeException('The "app.user" variable is not available.'); } if (!$token = $tokenStorage->getToken()) { return; } $user = $token->getUser(); if (\is_object($user)) { return $user; } }
php
public function getUser() { if (null === $tokenStorage = $this->tokenStorage) { throw new \RuntimeException('The "app.user" variable is not available.'); } if (!$token = $tokenStorage->getToken()) { return; } $user = $token->getUser(); if (\is_object($user)) { return $user; } }
[ "public", "function", "getUser", "(", ")", "{", "if", "(", "null", "===", "$", "tokenStorage", "=", "$", "this", "->", "tokenStorage", ")", "{", "throw", "new", "\\", "RuntimeException", "(", "'The \"app.user\" variable is not available.'", ")", ";", "}", "if"...
Returns the current user. @return mixed @see TokenInterface::getUser()
[ "Returns", "the", "current", "user", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bridge/Twig/AppVariable.php#L75-L89
train
Get the user from the token storage
[ 30522, 2270, 3853, 2131, 20330, 1006, 1007, 1063, 2065, 1006, 19701, 1027, 1027, 1027, 1002, 19204, 23809, 4270, 1027, 1002, 2023, 1011, 1028, 19204, 23809, 4270, 1007, 1063, 5466, 2047, 1032, 2448, 7292, 10288, 24422, 1006, 1005, 1996, 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...