repo
stringclasses
21 values
path
stringlengths
10
100
func_name
stringlengths
6
71
original_string
stringlengths
115
97k
language
stringclasses
1 value
code
stringlengths
115
97k
code_tokens
listlengths
27
7.5k
docstring
stringlengths
6
1.88k
docstring_tokens
listlengths
1
177
sha
stringclasses
21 values
url
stringlengths
100
189
partition
stringclasses
1 value
summary
stringlengths
9
340
input_ids
listlengths
502
502
token_type_ids
listlengths
502
502
attention_mask
listlengths
502
502
labels
listlengths
502
502
matomo-org/matomo
plugins/PrivacyManager/ReportsPurger.php
ReportsPurger.shouldReportBePurged
public static function shouldReportBePurged($reportDateYear, $reportDateMonth, $toRemoveDate) { $toRemoveYear = (int)$toRemoveDate->toString('Y'); $toRemoveMonth = (int)$toRemoveDate->toString('m'); return $reportDateYear < $toRemoveYear || ($reportDateYear == $toRemoveYear && $reportDateMonth <= $toRemoveMonth); }
php
public static function shouldReportBePurged($reportDateYear, $reportDateMonth, $toRemoveDate) { $toRemoveYear = (int)$toRemoveDate->toString('Y'); $toRemoveMonth = (int)$toRemoveDate->toString('m'); return $reportDateYear < $toRemoveYear || ($reportDateYear == $toRemoveYear && $reportDateMonth <= $toRemoveMonth); }
[ "public", "static", "function", "shouldReportBePurged", "(", "$", "reportDateYear", ",", "$", "reportDateMonth", ",", "$", "toRemoveDate", ")", "{", "$", "toRemoveYear", "=", "(", "int", ")", "$", "toRemoveDate", "->", "toString", "(", "'Y'", ")", ";", "$", ...
Returns true if a report with the given year & month should be purged or not. @param int $reportDateYear The year of the report in question. @param int $reportDateMonth The month of the report in question. @param Date $toRemoveDate The date a report must be older than in order to be purged. @return bool
[ "Returns", "true", "if", "a", "report", "with", "the", "given", "year", "&", "month", "should", "be", "purged", "or", "not", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/PrivacyManager/ReportsPurger.php#L250-L257
train
Checks if a report should be purged
[ 30522, 2270, 10763, 3853, 2323, 2890, 6442, 4783, 5311, 5999, 1006, 1002, 3189, 13701, 29100, 1010, 1002, 3189, 13701, 9629, 2232, 1010, 1002, 9538, 5302, 28614, 2618, 1007, 1063, 1002, 9538, 5302, 12417, 14644, 1027, 1006, 20014, 1007, 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...
dompdf/dompdf
src/Css/Style.php
Style.get_font_size
function get_font_size() { if ($this->__font_size_calculated) { return $this->_props["font_size"]; } if (!isset($this->_props["font_size"])) { $fs = self::$_defaults["font_size"]; } else { $fs = $this->_props["font_size"]; } if (!isset($this->_parent_font_size)) { $this->_parent_font_size = self::$default_font_size; } switch ((string)$fs) { case "xx-small": case "x-small": case "small": case "medium": case "large": case "x-large": case "xx-large": $fs = self::$default_font_size * self::$font_size_keywords[$fs]; break; case "smaller": $fs = 8 / 9 * $this->_parent_font_size; break; case "larger": $fs = 6 / 5 * $this->_parent_font_size; break; default: break; } // Ensure relative sizes resolve to something if (($i = mb_strpos($fs, "em")) !== false) { $fs = (float)mb_substr($fs, 0, $i) * $this->_parent_font_size; } else if (($i = mb_strpos($fs, "ex")) !== false) { $fs = (float)mb_substr($fs, 0, $i) * $this->_parent_font_size; } else { $fs = (float)$this->length_in_pt($fs); } //see __set and __get, on all assignments clear cache! $this->_prop_cache["font_size"] = null; $this->_props["font_size"] = $fs; $this->__font_size_calculated = true; return $this->_props["font_size"]; }
php
function get_font_size() { if ($this->__font_size_calculated) { return $this->_props["font_size"]; } if (!isset($this->_props["font_size"])) { $fs = self::$_defaults["font_size"]; } else { $fs = $this->_props["font_size"]; } if (!isset($this->_parent_font_size)) { $this->_parent_font_size = self::$default_font_size; } switch ((string)$fs) { case "xx-small": case "x-small": case "small": case "medium": case "large": case "x-large": case "xx-large": $fs = self::$default_font_size * self::$font_size_keywords[$fs]; break; case "smaller": $fs = 8 / 9 * $this->_parent_font_size; break; case "larger": $fs = 6 / 5 * $this->_parent_font_size; break; default: break; } // Ensure relative sizes resolve to something if (($i = mb_strpos($fs, "em")) !== false) { $fs = (float)mb_substr($fs, 0, $i) * $this->_parent_font_size; } else if (($i = mb_strpos($fs, "ex")) !== false) { $fs = (float)mb_substr($fs, 0, $i) * $this->_parent_font_size; } else { $fs = (float)$this->length_in_pt($fs); } //see __set and __get, on all assignments clear cache! $this->_prop_cache["font_size"] = null; $this->_props["font_size"] = $fs; $this->__font_size_calculated = true; return $this->_props["font_size"]; }
[ "function", "get_font_size", "(", ")", "{", "if", "(", "$", "this", "->", "__font_size_calculated", ")", "{", "return", "$", "this", "->", "_props", "[", "\"font_size\"", "]", ";", "}", "if", "(", "!", "isset", "(", "$", "this", "->", "_props", "[", ...
Returns the resolved font size, in points @link http://www.w3.org/TR/CSS21/fonts.html#propdef-font-size @return float
[ "Returns", "the", "resolved", "font", "size", "in", "points" ]
75f13c700009be21a1965dc2c5b68a8708c22ba2
https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/src/Css/Style.php#L1007-L1062
train
Return the font size
[ 30522, 3853, 2131, 1035, 15489, 1035, 2946, 1006, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 1035, 1035, 15489, 1035, 2946, 1035, 10174, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 1035, 24387, 1031, 1000, 15489, 1035, 2946, 1000, 1033, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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.getWidgetContainerConfigs
public function getWidgetContainerConfigs() { $configs = array(); $widgetContainerConfigs = $this->getAllWidgetContainerConfigClassNames(); foreach ($widgetContainerConfigs as $widgetClass) { $configs[] = StaticContainer::get($widgetClass); } return $configs; }
php
public function getWidgetContainerConfigs() { $configs = array(); $widgetContainerConfigs = $this->getAllWidgetContainerConfigClassNames(); foreach ($widgetContainerConfigs as $widgetClass) { $configs[] = StaticContainer::get($widgetClass); } return $configs; }
[ "public", "function", "getWidgetContainerConfigs", "(", ")", "{", "$", "configs", "=", "array", "(", ")", ";", "$", "widgetContainerConfigs", "=", "$", "this", "->", "getAllWidgetContainerConfigClassNames", "(", ")", ";", "foreach", "(", "$", "widgetContainerConfi...
Get all existing widget container configs. @return WidgetContainerConfig[]
[ "Get", "all", "existing", "widget", "container", "configs", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Plugin/WidgetsProvider.php#L76-L86
train
Get all WidgetContainerConfigs
[ 30522, 2270, 3853, 2131, 9148, 24291, 8663, 18249, 2121, 8663, 8873, 5620, 1006, 1007, 1063, 1002, 9530, 8873, 5620, 1027, 9140, 1006, 1007, 1025, 1002, 15536, 24291, 8663, 18249, 2121, 8663, 8873, 5620, 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/Annotations/AnnotationList.php
AnnotationList.canUserModifyOrDelete
public static function canUserModifyOrDelete($idSite, $annotation) { // user can save if user is admin or if has view access, is not anonymous & is user who wrote note $canEdit = Piwik::isUserHasWriteAccess($idSite) || (!Piwik::isUserIsAnonymous() && Piwik::getCurrentUserLogin() == $annotation['user']); return $canEdit; }
php
public static function canUserModifyOrDelete($idSite, $annotation) { // user can save if user is admin or if has view access, is not anonymous & is user who wrote note $canEdit = Piwik::isUserHasWriteAccess($idSite) || (!Piwik::isUserIsAnonymous() && Piwik::getCurrentUserLogin() == $annotation['user']); return $canEdit; }
[ "public", "static", "function", "canUserModifyOrDelete", "(", "$", "idSite", ",", "$", "annotation", ")", "{", "// user can save if user is admin or if has view access, is not anonymous & is user who wrote note", "$", "canEdit", "=", "Piwik", "::", "isUserHasWriteAccess", "(", ...
Returns true if the current user can modify or delete a specific annotation. A user can modify/delete a note if the user has write access for the site OR the user has view access, is not the anonymous user and is the user that created the note in question. @param int $idSite The site ID the annotation belongs to. @param array $annotation The annotation. @return bool
[ "Returns", "true", "if", "the", "current", "user", "can", "modify", "or", "delete", "a", "specific", "annotation", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Annotations/AnnotationList.php#L389-L396
train
Can user modify or delete
[ 30522, 2270, 10763, 3853, 2064, 20330, 5302, 4305, 12031, 8551, 12260, 2618, 1006, 1002, 8909, 28032, 2063, 1010, 1002, 5754, 17287, 3508, 1007, 1063, 1013, 1013, 5310, 2064, 3828, 2065, 5310, 2003, 4748, 10020, 2030, 2065, 2038, 3193, 3229...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/DependencyInjection/ContainerBuilder.php
ContainerBuilder.getAlias
public function getAlias($id) { $id = (string) $id; if (!isset($this->aliasDefinitions[$id])) { throw new InvalidArgumentException(sprintf('The service alias "%s" does not exist.', $id)); } return $this->aliasDefinitions[$id]; }
php
public function getAlias($id) { $id = (string) $id; if (!isset($this->aliasDefinitions[$id])) { throw new InvalidArgumentException(sprintf('The service alias "%s" does not exist.', $id)); } return $this->aliasDefinitions[$id]; }
[ "public", "function", "getAlias", "(", "$", "id", ")", "{", "$", "id", "=", "(", "string", ")", "$", "id", ";", "if", "(", "!", "isset", "(", "$", "this", "->", "aliasDefinitions", "[", "$", "id", "]", ")", ")", "{", "throw", "new", "InvalidArgum...
Gets an alias. @param string $id The service identifier @return Alias An Alias instance @throws InvalidArgumentException if the alias does not exist
[ "Gets", "an", "alias", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DependencyInjection/ContainerBuilder.php#L900-L909
train
Get alias definition
[ 30522, 2270, 3853, 2131, 22786, 2015, 1006, 1002, 8909, 1007, 1063, 1002, 8909, 1027, 1006, 5164, 1007, 1002, 8909, 1025, 2065, 1006, 999, 26354, 3388, 1006, 1002, 2023, 1011, 1028, 14593, 3207, 16294, 22753, 2015, 1031, 1002, 8909, 1033, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Guess/Guess.php
Guess.getBestGuess
public static function getBestGuess(array $guesses) { $result = null; $maxConfidence = -1; foreach ($guesses as $guess) { if ($maxConfidence < $confidence = $guess->getConfidence()) { $maxConfidence = $confidence; $result = $guess; } } return $result; }
php
public static function getBestGuess(array $guesses) { $result = null; $maxConfidence = -1; foreach ($guesses as $guess) { if ($maxConfidence < $confidence = $guess->getConfidence()) { $maxConfidence = $confidence; $result = $guess; } } return $result; }
[ "public", "static", "function", "getBestGuess", "(", "array", "$", "guesses", ")", "{", "$", "result", "=", "null", ";", "$", "maxConfidence", "=", "-", "1", ";", "foreach", "(", "$", "guesses", "as", "$", "guess", ")", "{", "if", "(", "$", "maxConfi...
Returns the guess most likely to be correct from a list of guesses. If there are multiple guesses with the same, highest confidence, the returned guess is any of them. @param Guess[] $guesses An array of guesses @return self|null
[ "Returns", "the", "guess", "most", "likely", "to", "be", "correct", "from", "a", "list", "of", "guesses", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Guess/Guess.php#L67-L80
train
Returns the best guess
[ 30522, 2270, 10763, 3853, 2131, 12681, 2102, 22967, 2015, 1006, 9140, 1002, 3984, 2229, 1007, 1063, 1002, 2765, 1027, 19701, 1025, 1002, 4098, 8663, 20740, 5897, 1027, 1011, 1015, 1025, 18921, 6776, 1006, 1002, 3984, 2229, 2004, 1002, 3984,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Framework/Flex/FlexObject.php
FlexObject.filterElements
protected function filterElements(array &$elements): void { if (!empty($elements['storage_key'])) { $this->_storage['storage_key'] = trim($elements['storage_key']); } if (!empty($elements['storage_timestamp'])) { $this->_storage['storage_timestamp'] = (int)$elements['storage_timestamp']; } unset ($elements['storage_key'], $elements['storage_timestamp'], $elements['_post_entries_save']); }
php
protected function filterElements(array &$elements): void { if (!empty($elements['storage_key'])) { $this->_storage['storage_key'] = trim($elements['storage_key']); } if (!empty($elements['storage_timestamp'])) { $this->_storage['storage_timestamp'] = (int)$elements['storage_timestamp']; } unset ($elements['storage_key'], $elements['storage_timestamp'], $elements['_post_entries_save']); }
[ "protected", "function", "filterElements", "(", "array", "&", "$", "elements", ")", ":", "void", "{", "if", "(", "!", "empty", "(", "$", "elements", "[", "'storage_key'", "]", ")", ")", "{", "$", "this", "->", "_storage", "[", "'storage_key'", "]", "="...
Filter data coming to constructor or $this->update() request. NOTE: The incoming data can be an arbitrary array so do not assume anything from its content. @param array $elements
[ "Filter", "data", "coming", "to", "constructor", "or", "$this", "-", ">", "update", "()", "request", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Framework/Flex/FlexObject.php#L844-L854
train
Filter elements to keep the original storage key and timestamp
[ 30522, 5123, 3853, 11307, 12260, 8163, 1006, 9140, 1004, 1002, 3787, 1007, 1024, 11675, 1063, 2065, 1006, 999, 4064, 1006, 1002, 3787, 1031, 1005, 5527, 1035, 3145, 1005, 1033, 1007, 1007, 1063, 1002, 2023, 1011, 1028, 1035, 5527, 1031, 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...
z-song/laravel-admin
src/Form/Field.php
Field.resetElementClassName
public function resetElementClassName(string $className, string $resetClassName) { if (($key = array_search($className, $this->getElementClass())) !== false) { $this->elementClass[$key] = $resetClassName; } return $this; }
php
public function resetElementClassName(string $className, string $resetClassName) { if (($key = array_search($className, $this->getElementClass())) !== false) { $this->elementClass[$key] = $resetClassName; } return $this; }
[ "public", "function", "resetElementClassName", "(", "string", "$", "className", ",", "string", "$", "resetClassName", ")", "{", "if", "(", "(", "$", "key", "=", "array_search", "(", "$", "className", ",", "$", "this", "->", "getElementClass", "(", ")", ")"...
reset field className. @param string $className @param string $resetClassName @return $this
[ "reset", "field", "className", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Form/Field.php#L1062-L1069
train
Reset the element class name
[ 30522, 2270, 3853, 25141, 12260, 3672, 26266, 18442, 1006, 5164, 1002, 2465, 18442, 1010, 5164, 1002, 25141, 26266, 18442, 1007, 1063, 2065, 1006, 1006, 1002, 3145, 1027, 9140, 1035, 3945, 1006, 1002, 2465, 18442, 1010, 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...
overtrue/wechat
src/Kernel/Clauses/Clause.php
Clause.interceptWhereClause
protected function interceptWhereClause($payload) { foreach ($this->clauses['where'] as $item) { list($key, $value) = $item; if (isset($payload[$key]) && $payload[$key] !== $value) { return true; } } }
php
protected function interceptWhereClause($payload) { foreach ($this->clauses['where'] as $item) { list($key, $value) = $item; if (isset($payload[$key]) && $payload[$key] !== $value) { return true; } } }
[ "protected", "function", "interceptWhereClause", "(", "$", "payload", ")", "{", "foreach", "(", "$", "this", "->", "clauses", "[", "'where'", "]", "as", "$", "item", ")", "{", "list", "(", "$", "key", ",", "$", "value", ")", "=", "$", "item", ";", ...
@param mixed $payload @return bool
[ "@param", "mixed", "$payload" ]
120c72faaa93c270365bc75c73c362d5fd583209
https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/Kernel/Clauses/Clause.php#L56-L64
train
Intercepts where clause
[ 30522, 5123, 3853, 19115, 2860, 5886, 8586, 28128, 2063, 1006, 1002, 18093, 1007, 1063, 18921, 6776, 1006, 1002, 2023, 1011, 1028, 24059, 1031, 1005, 2073, 1005, 1033, 2004, 1002, 8875, 1007, 1063, 2862, 1006, 1002, 3145, 1010, 1002, 3643, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/UserCountry/LocationProvider/GeoIp.php
GeoIp.getRegionNames
public static function getRegionNames() { if (is_null(self::$regionNames)) { $GEOIP_REGION_NAME = array(); require_once PIWIK_INCLUDE_PATH . '/libs/MaxMindGeoIP/geoipregionvars.php'; self::$regionNames = $GEOIP_REGION_NAME; } return self::$regionNames; }
php
public static function getRegionNames() { if (is_null(self::$regionNames)) { $GEOIP_REGION_NAME = array(); require_once PIWIK_INCLUDE_PATH . '/libs/MaxMindGeoIP/geoipregionvars.php'; self::$regionNames = $GEOIP_REGION_NAME; } return self::$regionNames; }
[ "public", "static", "function", "getRegionNames", "(", ")", "{", "if", "(", "is_null", "(", "self", "::", "$", "regionNames", ")", ")", "{", "$", "GEOIP_REGION_NAME", "=", "array", "(", ")", ";", "require_once", "PIWIK_INCLUDE_PATH", ".", "'/libs/MaxMindGeoIP/...
Returns an array of region names mapped by country code & region code. @return array
[ "Returns", "an", "array", "of", "region", "names", "mapped", "by", "country", "code", "&", "region", "code", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/UserCountry/LocationProvider/GeoIp.php#L166-L175
train
Get all region names
[ 30522, 2270, 10763, 3853, 2131, 23784, 18442, 2015, 1006, 1007, 1063, 2065, 1006, 2003, 1035, 19701, 1006, 2969, 1024, 1024, 1002, 2555, 18442, 2015, 1007, 1007, 1063, 1002, 20248, 11514, 1035, 2555, 1035, 2171, 1027, 9140, 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...
matomo-org/matomo
plugins/GeoIp2/GeoIP2AutoUpdater.php
GeoIP2AutoUpdater.getSchedulePeriod
public static function getSchedulePeriod() { $period = Option::get(self::SCHEDULE_PERIOD_OPTION_NAME); if ($period === false) { $period = self::SCHEDULE_PERIOD_MONTHLY; } return $period; }
php
public static function getSchedulePeriod() { $period = Option::get(self::SCHEDULE_PERIOD_OPTION_NAME); if ($period === false) { $period = self::SCHEDULE_PERIOD_MONTHLY; } return $period; }
[ "public", "static", "function", "getSchedulePeriod", "(", ")", "{", "$", "period", "=", "Option", "::", "get", "(", "self", "::", "SCHEDULE_PERIOD_OPTION_NAME", ")", ";", "if", "(", "$", "period", "===", "false", ")", "{", "$", "period", "=", "self", "::...
Returns the configured update period, either 'week' or 'month'. Defaults to 'month'. @return string
[ "Returns", "the", "configured", "update", "period", "either", "week", "or", "month", ".", "Defaults", "to", "month", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/GeoIp2/GeoIP2AutoUpdater.php#L416-L423
train
Get the scheduler period
[ 30522, 2270, 10763, 3853, 4152, 7690, 9307, 4842, 3695, 2094, 1006, 1007, 1063, 1002, 2558, 1027, 5724, 1024, 1024, 2131, 1006, 2969, 1024, 1024, 6134, 1035, 2558, 1035, 5724, 1035, 2171, 1007, 1025, 2065, 1006, 1002, 2558, 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...
matomo-org/matomo
plugins/Goals/API.php
API.getGoalSpecificDataTable
protected function getGoalSpecificDataTable($recordName, $idSite, $period, $date, $segment, $idGoal) { Piwik::checkUserHasViewAccess($idSite); $archive = Archive::build($idSite, $period, $date, $segment); // check for the special goal ids $realGoalId = $idGoal != true ? false : self::convertSpecialGoalIds($idGoal); // get the data table $dataTable = $archive->getDataTable(Archiver::getRecordName($recordName, $realGoalId), $idSubtable = null); $dataTable->queueFilter('ReplaceColumnNames'); return $dataTable; }
php
protected function getGoalSpecificDataTable($recordName, $idSite, $period, $date, $segment, $idGoal) { Piwik::checkUserHasViewAccess($idSite); $archive = Archive::build($idSite, $period, $date, $segment); // check for the special goal ids $realGoalId = $idGoal != true ? false : self::convertSpecialGoalIds($idGoal); // get the data table $dataTable = $archive->getDataTable(Archiver::getRecordName($recordName, $realGoalId), $idSubtable = null); $dataTable->queueFilter('ReplaceColumnNames'); return $dataTable; }
[ "protected", "function", "getGoalSpecificDataTable", "(", "$", "recordName", ",", "$", "idSite", ",", "$", "period", ",", "$", "date", ",", "$", "segment", ",", "$", "idGoal", ")", "{", "Piwik", "::", "checkUserHasViewAccess", "(", "$", "idSite", ")", ";",...
Utility method that retrieve an archived DataTable for a specific site, date range, segment and goal. If not goal is specified, this method will retrieve and sum the data for every goal. @param string $recordName The archive entry name. @param int|string $idSite The site(s) to select data for. @param string $period The period type. @param string $date The date type. @param string $segment The segment. @param int|bool $idGoal The id of the goal to get data for. If this is set to false, data for every goal that belongs to $idSite is returned. @return false|DataTable
[ "Utility", "method", "that", "retrieve", "an", "archived", "DataTable", "for", "a", "specific", "site", "date", "range", "segment", "and", "goal", ".", "If", "not", "goal", "is", "specified", "this", "method", "will", "retrieve", "and", "sum", "the", "data",...
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Goals/API.php#L646-L660
train
Get the data table for a specific goal and site
[ 30522, 5123, 3853, 2131, 3995, 9777, 5051, 6895, 8873, 19797, 6790, 10880, 1006, 1002, 2501, 18442, 1010, 1002, 8909, 28032, 2063, 1010, 1002, 2558, 1010, 1002, 3058, 1010, 1002, 6903, 1010, 1002, 8909, 3995, 2389, 1007, 1063, 14255, 9148, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Bundle/FrameworkBundle/Command/EventDispatcherDebugCommand.php
EventDispatcherDebugCommand.execute
protected function execute(InputInterface $input, OutputInterface $output) { $io = new SymfonyStyle($input, $output); $options = []; if ($event = $input->getArgument('event')) { if (!$this->dispatcher->hasListeners($event)) { $io->getErrorStyle()->warning(sprintf('The event "%s" does not have any registered listeners.', $event)); return; } $options = ['event' => $event]; } $helper = new DescriptorHelper(); $options['format'] = $input->getOption('format'); $options['raw_text'] = $input->getOption('raw'); $options['output'] = $io; $helper->describe($io, $this->dispatcher, $options); }
php
protected function execute(InputInterface $input, OutputInterface $output) { $io = new SymfonyStyle($input, $output); $options = []; if ($event = $input->getArgument('event')) { if (!$this->dispatcher->hasListeners($event)) { $io->getErrorStyle()->warning(sprintf('The event "%s" does not have any registered listeners.', $event)); return; } $options = ['event' => $event]; } $helper = new DescriptorHelper(); $options['format'] = $input->getOption('format'); $options['raw_text'] = $input->getOption('raw'); $options['output'] = $io; $helper->describe($io, $this->dispatcher, $options); }
[ "protected", "function", "execute", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "$", "io", "=", "new", "SymfonyStyle", "(", "$", "input", ",", "$", "output", ")", ";", "$", "options", "=", "[", "]", ";", "if", ...
{@inheritdoc} @throws \LogicException
[ "{", "@inheritdoc", "}" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/FrameworkBundle/Command/EventDispatcherDebugCommand.php#L72-L92
train
Describe the language
[ 30522, 5123, 3853, 15389, 1006, 7953, 18447, 2121, 12172, 1002, 7953, 1010, 6434, 18447, 2121, 12172, 1002, 6434, 1007, 1063, 1002, 22834, 1027, 2047, 25353, 2213, 14876, 4890, 21756, 2571, 1006, 1002, 7953, 1010, 1002, 6434, 1007, 1025, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/HttpKernel/HttpCache/Store.php
Store.getCacheKey
private function getCacheKey(Request $request) { if (isset($this->keyCache[$request])) { return $this->keyCache[$request]; } return $this->keyCache[$request] = $this->generateCacheKey($request); }
php
private function getCacheKey(Request $request) { if (isset($this->keyCache[$request])) { return $this->keyCache[$request]; } return $this->keyCache[$request] = $this->generateCacheKey($request); }
[ "private", "function", "getCacheKey", "(", "Request", "$", "request", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "keyCache", "[", "$", "request", "]", ")", ")", "{", "return", "$", "this", "->", "keyCache", "[", "$", "request", "]", ";", ...
Returns a cache key for the given Request. @return string A key for the given Request
[ "Returns", "a", "cache", "key", "for", "the", "given", "Request", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/HttpCache/Store.php#L438-L445
train
Generate a cache key for the request
[ 30522, 2797, 3853, 2131, 3540, 5403, 14839, 1006, 5227, 1002, 5227, 1007, 1063, 2065, 1006, 26354, 3388, 1006, 1002, 2023, 1011, 1028, 3145, 3540, 5403, 1031, 1002, 5227, 1033, 1007, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 3145, 3540, 5...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Foundation/Console/Kernel.php
Kernel.command
public function command($signature, Closure $callback) { $command = new ClosureCommand($signature, $callback); Artisan::starting(function ($artisan) use ($command) { $artisan->add($command); }); return $command; }
php
public function command($signature, Closure $callback) { $command = new ClosureCommand($signature, $callback); Artisan::starting(function ($artisan) use ($command) { $artisan->add($command); }); return $command; }
[ "public", "function", "command", "(", "$", "signature", ",", "Closure", "$", "callback", ")", "{", "$", "command", "=", "new", "ClosureCommand", "(", "$", "signature", ",", "$", "callback", ")", ";", "Artisan", "::", "starting", "(", "function", "(", "$"...
Register a Closure based command with the application. @param string $signature @param \Closure $callback @return \Illuminate\Foundation\Console\ClosureCommand
[ "Register", "a", "Closure", "based", "command", "with", "the", "application", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Foundation/Console/Kernel.php#L192-L201
train
Add a ClosureCommand to the current environment
[ 30522, 2270, 3853, 3094, 1006, 1002, 8085, 1010, 8503, 1002, 2655, 5963, 1007, 1063, 1002, 3094, 1027, 2047, 8503, 9006, 2386, 2094, 1006, 1002, 8085, 1010, 1002, 2655, 5963, 1007, 1025, 2396, 29196, 1024, 1024, 3225, 1006, 3853, 1006, 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/Classification/NaiveBayes.php
NaiveBayes.sampleProbability
private function sampleProbability(array $sample, int $feature, string $label): float { if (!isset($sample[$feature])) { throw new InvalidArgumentException('Missing feature. All samples must have equal number of features'); } $value = $sample[$feature]; if ($this->dataType[$label][$feature] == self::NOMINAL) { if (!isset($this->discreteProb[$label][$feature][$value]) || $this->discreteProb[$label][$feature][$value] == 0) { return self::EPSILON; } return $this->discreteProb[$label][$feature][$value]; } $std = $this->std[$label][$feature]; $mean = $this->mean[$label][$feature]; // Calculate the probability density by use of normal/Gaussian distribution // Ref: https://en.wikipedia.org/wiki/Normal_distribution // // In order to avoid numerical errors because of small or zero values, // some libraries adopt taking log of calculations such as // scikit-learn did. // (See : https://github.com/scikit-learn/scikit-learn/blob/master/sklearn/naive_bayes.py) $pdf = -0.5 * log(2.0 * M_PI * $std * $std); $pdf -= 0.5 * (($value - $mean) ** 2) / ($std * $std); return $pdf; }
php
private function sampleProbability(array $sample, int $feature, string $label): float { if (!isset($sample[$feature])) { throw new InvalidArgumentException('Missing feature. All samples must have equal number of features'); } $value = $sample[$feature]; if ($this->dataType[$label][$feature] == self::NOMINAL) { if (!isset($this->discreteProb[$label][$feature][$value]) || $this->discreteProb[$label][$feature][$value] == 0) { return self::EPSILON; } return $this->discreteProb[$label][$feature][$value]; } $std = $this->std[$label][$feature]; $mean = $this->mean[$label][$feature]; // Calculate the probability density by use of normal/Gaussian distribution // Ref: https://en.wikipedia.org/wiki/Normal_distribution // // In order to avoid numerical errors because of small or zero values, // some libraries adopt taking log of calculations such as // scikit-learn did. // (See : https://github.com/scikit-learn/scikit-learn/blob/master/sklearn/naive_bayes.py) $pdf = -0.5 * log(2.0 * M_PI * $std * $std); $pdf -= 0.5 * (($value - $mean) ** 2) / ($std * $std); return $pdf; }
[ "private", "function", "sampleProbability", "(", "array", "$", "sample", ",", "int", "$", "feature", ",", "string", "$", "label", ")", ":", "float", "{", "if", "(", "!", "isset", "(", "$", "sample", "[", "$", "feature", "]", ")", ")", "{", "throw", ...
Calculates the probability P(label|sample_n)
[ "Calculates", "the", "probability", "P", "(", "label|sample_n", ")" ]
f6aa1a59b0525b8fca3d2786d661ab3e70904016
https://github.com/php-ai/php-ml/blob/f6aa1a59b0525b8fca3d2786d661ab3e70904016/src/Classification/NaiveBayes.php#L139-L168
train
Calculates the probability density of a feature
[ 30522, 2797, 3853, 7099, 21572, 3676, 8553, 1006, 9140, 1002, 7099, 1010, 20014, 1002, 3444, 1010, 5164, 1002, 3830, 1007, 1024, 14257, 1063, 2065, 1006, 999, 26354, 3388, 1006, 1002, 7099, 1031, 1002, 3444, 1033, 1007, 1007, 1063, 5466, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Process/Process.php
Process.fromShellCommandline
public static function fromShellCommandline(string $command, string $cwd = null, array $env = null, $input = null, ?float $timeout = 60) { $process = new static([], $cwd, $env, $input, $timeout); $process->commandline = $command; return $process; }
php
public static function fromShellCommandline(string $command, string $cwd = null, array $env = null, $input = null, ?float $timeout = 60) { $process = new static([], $cwd, $env, $input, $timeout); $process->commandline = $command; return $process; }
[ "public", "static", "function", "fromShellCommandline", "(", "string", "$", "command", ",", "string", "$", "cwd", "=", "null", ",", "array", "$", "env", "=", "null", ",", "$", "input", "=", "null", ",", "?", "float", "$", "timeout", "=", "60", ")", "...
Creates a Process instance as a command-line to be run in a shell wrapper. Command-lines are parsed by the shell of your OS (/bin/sh on Unix-like, cmd.exe on Windows.) This allows using e.g. pipes or conditional execution. In this mode, signals are sent to the shell wrapper and not to your commands. In order to inject dynamic values into command-lines, we strongly recommend using placeholders. This will save escaping values, which is not portable nor secure anyway: $process = Process::fromShellCommandline('my_command "$MY_VAR"'); $process->run(null, ['MY_VAR' => $theValue]); @param string $command The command line to pass to the shell of the OS @param string|null $cwd The working directory or null to use the working dir of the current PHP process @param array|null $env The environment variables or null to use the same environment as the current PHP process @param mixed|null $input The input as stream resource, scalar or \Traversable, or null for no input @param int|float|null $timeout The timeout in seconds or null to disable @throws RuntimeException When proc_open is not installed
[ "Creates", "a", "Process", "instance", "as", "a", "command", "-", "line", "to", "be", "run", "in", "a", "shell", "wrapper", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Process/Process.php#L191-L197
train
Create a new process from a shell commandline
[ 30522, 2270, 10763, 3853, 2013, 4095, 5349, 9006, 2386, 19422, 3170, 1006, 5164, 1002, 3094, 1010, 5164, 1002, 19296, 2094, 1027, 19701, 1010, 9140, 1002, 4372, 2615, 1027, 19701, 1010, 1002, 7953, 1027, 19701, 1010, 1029, 14257, 1002, 2051...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/SqlServerGrammar.php
SqlServerGrammar.compileAnsiOffset
protected function compileAnsiOffset(Builder $query, $components) { // An ORDER BY clause is required to make this offset query work, so if one does // not exist we'll just create a dummy clause to trick the database and so it // does not complain about the queries for not having an "order by" clause. if (empty($components['orders'])) { $components['orders'] = 'order by (select 0)'; } // We need to add the row number to the query so we can compare it to the offset // and limit values given for the statements. So we will add an expression to // the "select" that will give back the row numbers on each of the records. $components['columns'] .= $this->compileOver($components['orders']); unset($components['orders']); // Next we need to calculate the constraints that should be placed on the query // to get the right offset and limit from our query but if there is no limit // set we will just handle the offset only since that is all that matters. $sql = $this->concatenate($components); return $this->compileTableExpression($sql, $query); }
php
protected function compileAnsiOffset(Builder $query, $components) { // An ORDER BY clause is required to make this offset query work, so if one does // not exist we'll just create a dummy clause to trick the database and so it // does not complain about the queries for not having an "order by" clause. if (empty($components['orders'])) { $components['orders'] = 'order by (select 0)'; } // We need to add the row number to the query so we can compare it to the offset // and limit values given for the statements. So we will add an expression to // the "select" that will give back the row numbers on each of the records. $components['columns'] .= $this->compileOver($components['orders']); unset($components['orders']); // Next we need to calculate the constraints that should be placed on the query // to get the right offset and limit from our query but if there is no limit // set we will just handle the offset only since that is all that matters. $sql = $this->concatenate($components); return $this->compileTableExpression($sql, $query); }
[ "protected", "function", "compileAnsiOffset", "(", "Builder", "$", "query", ",", "$", "components", ")", "{", "// An ORDER BY clause is required to make this offset query work, so if one does", "// not exist we'll just create a dummy clause to trick the database and so it", "// does not ...
Create a full ANSI offset clause for the query. @param \Illuminate\Database\Query\Builder $query @param array $components @return string
[ "Create", "a", "full", "ANSI", "offset", "clause", "for", "the", "query", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Query/Grammars/SqlServerGrammar.php#L167-L189
train
Compiles an ansi offset query
[ 30522, 5123, 3853, 4012, 22090, 6962, 3695, 21807, 3388, 1006, 12508, 1002, 23032, 1010, 1002, 6177, 1007, 1063, 1013, 1013, 2019, 2344, 2011, 11075, 2003, 3223, 2000, 2191, 2023, 16396, 23032, 2147, 1010, 2061, 2065, 2028, 2515, 1013, 1013...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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.getServerVersion
public function getServerVersion() { $this->_connect(); $server_info = db2_server_info($this->_connection); if ($server_info !== false) { $version = $server_info->DBMS_VER; if ($this->_isI5) { $version = (int) substr($version, 0, 2) . '.' . (int) substr($version, 2, 2) . '.' . (int) substr($version, 4); } return $version; } else { return null; } }
php
public function getServerVersion() { $this->_connect(); $server_info = db2_server_info($this->_connection); if ($server_info !== false) { $version = $server_info->DBMS_VER; if ($this->_isI5) { $version = (int) substr($version, 0, 2) . '.' . (int) substr($version, 2, 2) . '.' . (int) substr($version, 4); } return $version; } else { return null; } }
[ "public", "function", "getServerVersion", "(", ")", "{", "$", "this", "->", "_connect", "(", ")", ";", "$", "server_info", "=", "db2_server_info", "(", "$", "this", "->", "_connection", ")", ";", "if", "(", "$", "server_info", "!==", "false", ")", "{", ...
Retrieve server version in PHP style @return string
[ "Retrieve", "server", "version", "in", "PHP", "style" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Adapter/Db2.php#L726-L739
train
Get Server Version
[ 30522, 2270, 3853, 4152, 2121, 6299, 27774, 1006, 1007, 1063, 1002, 2023, 1011, 1028, 1035, 7532, 1006, 1007, 1025, 1002, 8241, 1035, 18558, 1027, 16962, 2475, 1035, 8241, 1035, 18558, 1006, 1002, 2023, 1011, 1028, 1035, 4434, 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...
matomo-org/matomo
plugins/Goals/API.php
API.enrichItemsTableWithViewMetrics
protected function enrichItemsTableWithViewMetrics($dataTable, $recordName, $idSite, $period, $date, $segment) { // Enrich the datatable with Product/Categories views, and conversion rates $customVariables = \Piwik\Plugins\CustomVariables\API::getInstance()->getCustomVariables($idSite, $period, $date, $segment, $expanded = false, $_leavePiwikCoreVariables = true); $mapping = array( 'Goals_ItemsSku' => '_pks', 'Goals_ItemsName' => '_pkn', 'Goals_ItemsCategory' => '_pkc', ); $reportToNotDefinedString = array( 'Goals_ItemsSku' => Piwik::translate('General_NotDefined', Piwik::translate('Goals_ProductSKU')), // Note: this should never happen 'Goals_ItemsName' => Piwik::translate('General_NotDefined', Piwik::translate('Goals_ProductName')), 'Goals_ItemsCategory' => Piwik::translate('General_NotDefined', Piwik::translate('Goals_ProductCategory')) ); $notDefinedStringPretty = $reportToNotDefinedString[$recordName]; $customVarNameToLookFor = $mapping[$recordName]; // Handle case where date=last30&period=day if ($customVariables instanceof DataTable\Map) { $customVariableDatatables = $customVariables->getDataTables(); $dataTables = $dataTable->getDataTables(); foreach ($customVariableDatatables as $key => $customVariableTableForDate) { $dataTableForDate = isset($dataTables[$key]) ? $dataTables[$key] : new DataTable(); // we do not enter the IF // if case idSite=1,3 AND period=day&date=datefrom,dateto, if ($customVariableTableForDate instanceof DataTable && $customVariableTableForDate->getMetadata(Archive\DataTableFactory::TABLE_METADATA_PERIOD_INDEX) ) { $dateRewrite = $customVariableTableForDate->getMetadata(Archive\DataTableFactory::TABLE_METADATA_PERIOD_INDEX)->getDateStart()->toString(); $row = $customVariableTableForDate->getRowFromLabel($customVarNameToLookFor); if ($row) { $idSubtable = $row->getIdSubDataTable(); $this->enrichItemsDataTableWithItemsViewMetrics($dataTableForDate, $idSite, $period, $dateRewrite, $segment, $idSubtable); } $dataTable->addTable($dataTableForDate, $key); } $this->renameNotDefinedRow($dataTableForDate, $notDefinedStringPretty); } } elseif ($customVariables instanceof DataTable) { $row = $customVariables->getRowFromLabel($customVarNameToLookFor); if ($row) { $idSubtable = $row->getIdSubDataTable(); $this->enrichItemsDataTableWithItemsViewMetrics($dataTable, $idSite, $period, $date, $segment, $idSubtable); } $this->renameNotDefinedRow($dataTable, $notDefinedStringPretty); } }
php
protected function enrichItemsTableWithViewMetrics($dataTable, $recordName, $idSite, $period, $date, $segment) { // Enrich the datatable with Product/Categories views, and conversion rates $customVariables = \Piwik\Plugins\CustomVariables\API::getInstance()->getCustomVariables($idSite, $period, $date, $segment, $expanded = false, $_leavePiwikCoreVariables = true); $mapping = array( 'Goals_ItemsSku' => '_pks', 'Goals_ItemsName' => '_pkn', 'Goals_ItemsCategory' => '_pkc', ); $reportToNotDefinedString = array( 'Goals_ItemsSku' => Piwik::translate('General_NotDefined', Piwik::translate('Goals_ProductSKU')), // Note: this should never happen 'Goals_ItemsName' => Piwik::translate('General_NotDefined', Piwik::translate('Goals_ProductName')), 'Goals_ItemsCategory' => Piwik::translate('General_NotDefined', Piwik::translate('Goals_ProductCategory')) ); $notDefinedStringPretty = $reportToNotDefinedString[$recordName]; $customVarNameToLookFor = $mapping[$recordName]; // Handle case where date=last30&period=day if ($customVariables instanceof DataTable\Map) { $customVariableDatatables = $customVariables->getDataTables(); $dataTables = $dataTable->getDataTables(); foreach ($customVariableDatatables as $key => $customVariableTableForDate) { $dataTableForDate = isset($dataTables[$key]) ? $dataTables[$key] : new DataTable(); // we do not enter the IF // if case idSite=1,3 AND period=day&date=datefrom,dateto, if ($customVariableTableForDate instanceof DataTable && $customVariableTableForDate->getMetadata(Archive\DataTableFactory::TABLE_METADATA_PERIOD_INDEX) ) { $dateRewrite = $customVariableTableForDate->getMetadata(Archive\DataTableFactory::TABLE_METADATA_PERIOD_INDEX)->getDateStart()->toString(); $row = $customVariableTableForDate->getRowFromLabel($customVarNameToLookFor); if ($row) { $idSubtable = $row->getIdSubDataTable(); $this->enrichItemsDataTableWithItemsViewMetrics($dataTableForDate, $idSite, $period, $dateRewrite, $segment, $idSubtable); } $dataTable->addTable($dataTableForDate, $key); } $this->renameNotDefinedRow($dataTableForDate, $notDefinedStringPretty); } } elseif ($customVariables instanceof DataTable) { $row = $customVariables->getRowFromLabel($customVarNameToLookFor); if ($row) { $idSubtable = $row->getIdSubDataTable(); $this->enrichItemsDataTableWithItemsViewMetrics($dataTable, $idSite, $period, $date, $segment, $idSubtable); } $this->renameNotDefinedRow($dataTable, $notDefinedStringPretty); } }
[ "protected", "function", "enrichItemsTableWithViewMetrics", "(", "$", "dataTable", ",", "$", "recordName", ",", "$", "idSite", ",", "$", "period", ",", "$", "date", ",", "$", "segment", ")", "{", "// Enrich the datatable with Product/Categories views, and conversion rat...
Enhances the dataTable with Items attributes found in the Custom Variables report. @param $dataTable @param $recordName @param $idSite @param $period @param $date @param $segment
[ "Enhances", "the", "dataTable", "with", "Items", "attributes", "found", "in", "the", "Custom", "Variables", "report", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Goals/API.php#L720-L768
train
Enriches the datatable with the data table metrics for the items table
[ 30522, 5123, 3853, 4372, 13149, 4221, 5244, 10880, 24415, 8584, 12589, 2015, 1006, 1002, 2951, 10880, 1010, 1002, 2501, 18442, 1010, 1002, 8909, 28032, 2063, 1010, 1002, 2558, 1010, 1002, 3058, 1010, 1002, 6903, 1007, 1063, 1013, 1013, 4372...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/MergeOperation.php
MergeOperation.processDomain
protected function processDomain($domain) { $this->messages[$domain] = [ 'all' => [], 'new' => [], 'obsolete' => [], ]; $intlDomain = $domain.MessageCatalogueInterface::INTL_DOMAIN_SUFFIX; foreach ($this->source->all($domain) as $id => $message) { $this->messages[$domain]['all'][$id] = $message; $this->result->add([$id => $message], $this->source->defines($id, $intlDomain) ? $intlDomain : $domain); if (null !== $keyMetadata = $this->source->getMetadata($id, $domain)) { $this->result->setMetadata($id, $keyMetadata, $domain); } } foreach ($this->target->all($domain) as $id => $message) { if (!$this->source->has($id, $domain)) { $this->messages[$domain]['all'][$id] = $message; $this->messages[$domain]['new'][$id] = $message; $this->result->add([$id => $message], $this->target->defines($id, $intlDomain) ? $intlDomain : $domain); if (null !== $keyMetadata = $this->target->getMetadata($id, $domain)) { $this->result->setMetadata($id, $keyMetadata, $domain); } } } }
php
protected function processDomain($domain) { $this->messages[$domain] = [ 'all' => [], 'new' => [], 'obsolete' => [], ]; $intlDomain = $domain.MessageCatalogueInterface::INTL_DOMAIN_SUFFIX; foreach ($this->source->all($domain) as $id => $message) { $this->messages[$domain]['all'][$id] = $message; $this->result->add([$id => $message], $this->source->defines($id, $intlDomain) ? $intlDomain : $domain); if (null !== $keyMetadata = $this->source->getMetadata($id, $domain)) { $this->result->setMetadata($id, $keyMetadata, $domain); } } foreach ($this->target->all($domain) as $id => $message) { if (!$this->source->has($id, $domain)) { $this->messages[$domain]['all'][$id] = $message; $this->messages[$domain]['new'][$id] = $message; $this->result->add([$id => $message], $this->target->defines($id, $intlDomain) ? $intlDomain : $domain); if (null !== $keyMetadata = $this->target->getMetadata($id, $domain)) { $this->result->setMetadata($id, $keyMetadata, $domain); } } } }
[ "protected", "function", "processDomain", "(", "$", "domain", ")", "{", "$", "this", "->", "messages", "[", "$", "domain", "]", "=", "[", "'all'", "=>", "[", "]", ",", "'new'", "=>", "[", "]", ",", "'obsolete'", "=>", "[", "]", ",", "]", ";", "$"...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Translation/Catalogue/MergeOperation.php#L30-L57
train
Process all messages in the domain
[ 30522, 5123, 3853, 2832, 9527, 8113, 1006, 1002, 5884, 1007, 1063, 1002, 2023, 1011, 1028, 7696, 1031, 1002, 5884, 1033, 1027, 1031, 1005, 2035, 1005, 1027, 1028, 1031, 1033, 1010, 1005, 2047, 1005, 1027, 1028, 1031, 1033, 1010, 1005, 158...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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
build/Burgomaster.php
Burgomaster.debug
public function debug($message) { $prefix = date('c') . ': '; if ($this->sections) { $prefix .= '[' . end($this->sections) . '] '; } fwrite(STDERR, $prefix . $message . "\n"); }
php
public function debug($message) { $prefix = date('c') . ': '; if ($this->sections) { $prefix .= '[' . end($this->sections) . '] '; } fwrite(STDERR, $prefix . $message . "\n"); }
[ "public", "function", "debug", "(", "$", "message", ")", "{", "$", "prefix", "=", "date", "(", "'c'", ")", ".", "': '", ";", "if", "(", "$", "this", "->", "sections", ")", "{", "$", "prefix", ".=", "'['", ".", "end", "(", "$", "this", "->", "se...
Prints a debug message to STDERR bound to the current section. @param string $message Message to echo to STDERR
[ "Prints", "a", "debug", "message", "to", "STDERR", "bound", "to", "the", "current", "section", "." ]
bf595424e4d442a190582e088985dc835a789071
https://github.com/guzzle/guzzle/blob/bf595424e4d442a190582e088985dc835a789071/build/Burgomaster.php#L107-L116
train
Debug message to STDERR
[ 30522, 2270, 3853, 2139, 8569, 2290, 1006, 1002, 4471, 1007, 1063, 1002, 17576, 1027, 3058, 1006, 1005, 1039, 1005, 1007, 1012, 1005, 1024, 1005, 1025, 2065, 1006, 1002, 2023, 1011, 1028, 5433, 1007, 1063, 1002, 17576, 1012, 1027, 1005, 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
plugins/CoreHome/Controller.php
Controller.getRowEvolutionGraph
public function getRowEvolutionGraph($fetch = false, $rowEvolution = null) { if (empty($rowEvolution)) { $label = Common::getRequestVar('label', '', 'string'); $isMultiRowEvolution = strpos($label, ',') !== false; $rowEvolution = $this->makeRowEvolution($isMultiRowEvolution, $graphType = 'graphEvolution'); $rowEvolution->useAvailableMetrics(); } $view = $rowEvolution->getRowEvolutionGraph(); return $this->renderView($view); }
php
public function getRowEvolutionGraph($fetch = false, $rowEvolution = null) { if (empty($rowEvolution)) { $label = Common::getRequestVar('label', '', 'string'); $isMultiRowEvolution = strpos($label, ',') !== false; $rowEvolution = $this->makeRowEvolution($isMultiRowEvolution, $graphType = 'graphEvolution'); $rowEvolution->useAvailableMetrics(); } $view = $rowEvolution->getRowEvolutionGraph(); return $this->renderView($view); }
[ "public", "function", "getRowEvolutionGraph", "(", "$", "fetch", "=", "false", ",", "$", "rowEvolution", "=", "null", ")", "{", "if", "(", "empty", "(", "$", "rowEvolution", ")", ")", "{", "$", "label", "=", "Common", "::", "getRequestVar", "(", "'label'...
Generic method to get an evolution graph or a sparkline for the row evolution popover
[ "Generic", "method", "to", "get", "an", "evolution", "graph", "or", "a", "sparkline", "for", "the", "row", "evolution", "popover" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/CoreHome/Controller.php#L224-L236
train
Returns the row evolution graph
[ 30522, 2270, 3853, 2131, 10524, 6777, 4747, 13700, 14413, 1006, 1002, 18584, 1027, 6270, 1010, 1002, 20538, 6767, 7630, 3508, 1027, 19701, 1007, 1063, 2065, 1006, 4064, 1006, 1002, 20538, 6767, 7630, 3508, 1007, 1007, 1063, 1002, 3830, 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...
octobercms/october
modules/backend/formwidgets/RichEditor.php
RichEditor.prepareVars
public function prepareVars() { $this->vars['field'] = $this->formField; $this->vars['editorLang'] = $this->getValidEditorLang(); $this->vars['fullPage'] = $this->fullPage; $this->vars['stretch'] = $this->formField->stretch; $this->vars['size'] = $this->formField->size; $this->vars['readOnly'] = $this->readOnly; $this->vars['name'] = $this->getFieldName(); $this->vars['value'] = $this->getLoadValue(); $this->vars['toolbarButtons'] = $this->evalToolbarButtons(); $this->vars['globalToolbarButtons'] = EditorSetting::getConfigured('html_toolbar_buttons'); $this->vars['allowEmptyTags'] = EditorSetting::getConfigured('html_allow_empty_tags'); $this->vars['allowTags'] = EditorSetting::getConfigured('html_allow_tags'); $this->vars['noWrapTags'] = EditorSetting::getConfigured('html_no_wrap_tags'); $this->vars['removeTags'] = EditorSetting::getConfigured('html_remove_tags'); $this->vars['lineBreakerTags'] = EditorSetting::getConfigured('html_line_breaker_tags'); $this->vars['imageStyles'] = EditorSetting::getConfiguredStyles('html_style_image'); $this->vars['linkStyles'] = EditorSetting::getConfiguredStyles('html_style_link'); $this->vars['paragraphStyles'] = EditorSetting::getConfiguredStyles('html_style_paragraph'); $this->vars['tableStyles'] = EditorSetting::getConfiguredStyles('html_style_table'); $this->vars['tableCellStyles'] = EditorSetting::getConfiguredStyles('html_style_table_cell'); }
php
public function prepareVars() { $this->vars['field'] = $this->formField; $this->vars['editorLang'] = $this->getValidEditorLang(); $this->vars['fullPage'] = $this->fullPage; $this->vars['stretch'] = $this->formField->stretch; $this->vars['size'] = $this->formField->size; $this->vars['readOnly'] = $this->readOnly; $this->vars['name'] = $this->getFieldName(); $this->vars['value'] = $this->getLoadValue(); $this->vars['toolbarButtons'] = $this->evalToolbarButtons(); $this->vars['globalToolbarButtons'] = EditorSetting::getConfigured('html_toolbar_buttons'); $this->vars['allowEmptyTags'] = EditorSetting::getConfigured('html_allow_empty_tags'); $this->vars['allowTags'] = EditorSetting::getConfigured('html_allow_tags'); $this->vars['noWrapTags'] = EditorSetting::getConfigured('html_no_wrap_tags'); $this->vars['removeTags'] = EditorSetting::getConfigured('html_remove_tags'); $this->vars['lineBreakerTags'] = EditorSetting::getConfigured('html_line_breaker_tags'); $this->vars['imageStyles'] = EditorSetting::getConfiguredStyles('html_style_image'); $this->vars['linkStyles'] = EditorSetting::getConfiguredStyles('html_style_link'); $this->vars['paragraphStyles'] = EditorSetting::getConfiguredStyles('html_style_paragraph'); $this->vars['tableStyles'] = EditorSetting::getConfiguredStyles('html_style_table'); $this->vars['tableCellStyles'] = EditorSetting::getConfiguredStyles('html_style_table_cell'); }
[ "public", "function", "prepareVars", "(", ")", "{", "$", "this", "->", "vars", "[", "'field'", "]", "=", "$", "this", "->", "formField", ";", "$", "this", "->", "vars", "[", "'editorLang'", "]", "=", "$", "this", "->", "getValidEditorLang", "(", ")", ...
Prepares the list data
[ "Prepares", "the", "list", "data" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/formwidgets/RichEditor.php#L76-L100
train
Prepare the form field variables
[ 30522, 2270, 3853, 7374, 10755, 2015, 1006, 1007, 1063, 1002, 2023, 1011, 1028, 13075, 2015, 1031, 1005, 2492, 1005, 1033, 1027, 1002, 2023, 1011, 1028, 2433, 3790, 1025, 1002, 2023, 1011, 1028, 13075, 2015, 1031, 1005, 3559, 25023, 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
libs/HTML/Common2.php
HTML_Common2.setAttribute
public function setAttribute($name, $value = null) { $name = strtolower($name); if (is_null($value)) { $value = $name; } if (in_array($name, $this->watchedAttributes)) { $this->onAttributeChange($name, $value); } else { $this->attributes[$name] = (string)$value; } return $this; }
php
public function setAttribute($name, $value = null) { $name = strtolower($name); if (is_null($value)) { $value = $name; } if (in_array($name, $this->watchedAttributes)) { $this->onAttributeChange($name, $value); } else { $this->attributes[$name] = (string)$value; } return $this; }
[ "public", "function", "setAttribute", "(", "$", "name", ",", "$", "value", "=", "null", ")", "{", "$", "name", "=", "strtolower", "(", "$", "name", ")", ";", "if", "(", "is_null", "(", "$", "value", ")", ")", "{", "$", "value", "=", "$", "name", ...
Sets the value of the attribute @param string Attribute name @param string Attribute value (will be set to $name if omitted) @return HTML_Common2
[ "Sets", "the", "value", "of", "the", "attribute" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/HTML/Common2.php#L242-L254
train
Set attribute value
[ 30522, 2270, 3853, 2275, 19321, 3089, 8569, 2618, 1006, 1002, 2171, 1010, 1002, 3643, 1027, 19701, 1007, 1063, 1002, 2171, 1027, 2358, 5339, 12898, 13777, 1006, 1002, 2171, 1007, 1025, 2065, 1006, 2003, 1035, 19701, 1006, 1002, 3643, 1007, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Notifications/Channels/MailChannel.php
MailChannel.addSender
protected function addSender($mailMessage, $message) { if (! empty($message->from)) { $mailMessage->from($message->from[0], Arr::get($message->from, 1)); } if (! empty($message->replyTo)) { foreach ($message->replyTo as $replyTo) { $mailMessage->replyTo($replyTo[0], Arr::get($replyTo, 1)); } } }
php
protected function addSender($mailMessage, $message) { if (! empty($message->from)) { $mailMessage->from($message->from[0], Arr::get($message->from, 1)); } if (! empty($message->replyTo)) { foreach ($message->replyTo as $replyTo) { $mailMessage->replyTo($replyTo[0], Arr::get($replyTo, 1)); } } }
[ "protected", "function", "addSender", "(", "$", "mailMessage", ",", "$", "message", ")", "{", "if", "(", "!", "empty", "(", "$", "message", "->", "from", ")", ")", "{", "$", "mailMessage", "->", "from", "(", "$", "message", "->", "from", "[", "0", ...
Add the "from" and "reply to" addresses to the message. @param \Illuminate\Mail\Message $mailMessage @param \Illuminate\Notifications\Messages\MailMessage $message @return void
[ "Add", "the", "from", "and", "reply", "to", "addresses", "to", "the", "message", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Notifications/Channels/MailChannel.php#L177-L188
train
Adds the sender and replyTo addresses to the message.
[ 30522, 5123, 3853, 9909, 10497, 2121, 1006, 1002, 5653, 7834, 3736, 3351, 1010, 1002, 4471, 1007, 1063, 2065, 1006, 999, 4064, 1006, 1002, 4471, 1011, 1028, 2013, 1007, 1007, 1063, 1002, 5653, 7834, 3736, 3351, 1011, 1028, 2013, 1006, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Db/Adapter/Pdo/Abstract.php
Zend_Db_Adapter_Pdo_Abstract.lastInsertId
public function lastInsertId($tableName = null, $primaryKey = null) { $this->_connect(); return $this->_connection->lastInsertId(); }
php
public function lastInsertId($tableName = null, $primaryKey = null) { $this->_connect(); return $this->_connection->lastInsertId(); }
[ "public", "function", "lastInsertId", "(", "$", "tableName", "=", "null", ",", "$", "primaryKey", "=", "null", ")", "{", "$", "this", "->", "_connect", "(", ")", ";", "return", "$", "this", "->", "_connection", "->", "lastInsertId", "(", ")", ";", "}" ...
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. On RDBMS brands that don't support sequences, $tableName and $primaryKey are ignored. @param string $tableName OPTIONAL Name of table. @param string $primaryKey OPTIONAL Name of primary key column. @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/Pdo/Abstract.php#L206-L210
train
Returns the last ID of the current table
[ 30522, 2270, 3853, 2197, 7076, 8743, 3593, 1006, 1002, 2795, 18442, 1027, 19701, 1010, 1002, 3078, 14839, 1027, 19701, 1007, 1063, 1002, 2023, 1011, 1028, 1035, 7532, 1006, 1007, 1025, 2709, 1002, 2023, 1011, 1028, 1035, 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...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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/Authentication/Provider/RememberMeAuthenticationProvider.php
RememberMeAuthenticationProvider.authenticate
public function authenticate(TokenInterface $token) { if (!$this->supports($token)) { throw new AuthenticationException('The token is not supported by this authentication provider.'); } if ($this->secret !== $token->getSecret()) { throw new BadCredentialsException('The presented secret does not match.'); } $user = $token->getUser(); $this->userChecker->checkPreAuth($user); $this->userChecker->checkPostAuth($user); $authenticatedToken = new RememberMeToken($user, $this->providerKey, $this->secret); $authenticatedToken->setAttributes($token->getAttributes()); return $authenticatedToken; }
php
public function authenticate(TokenInterface $token) { if (!$this->supports($token)) { throw new AuthenticationException('The token is not supported by this authentication provider.'); } if ($this->secret !== $token->getSecret()) { throw new BadCredentialsException('The presented secret does not match.'); } $user = $token->getUser(); $this->userChecker->checkPreAuth($user); $this->userChecker->checkPostAuth($user); $authenticatedToken = new RememberMeToken($user, $this->providerKey, $this->secret); $authenticatedToken->setAttributes($token->getAttributes()); return $authenticatedToken; }
[ "public", "function", "authenticate", "(", "TokenInterface", "$", "token", ")", "{", "if", "(", "!", "$", "this", "->", "supports", "(", "$", "token", ")", ")", "{", "throw", "new", "AuthenticationException", "(", "'The token is not supported by this authenticatio...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Security/Core/Authentication/Provider/RememberMeAuthenticationProvider.php#L41-L59
train
Authenticate a token
[ 30522, 2270, 3853, 14469, 3686, 1006, 19204, 18447, 2121, 12172, 1002, 19204, 1007, 1063, 2065, 1006, 999, 1002, 2023, 1011, 1028, 6753, 1006, 1002, 19204, 1007, 1007, 1063, 5466, 2047, 27280, 10288, 24422, 1006, 1005, 1996, 19204, 2003, 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
plugins/Actions/API.php
API.getFilterPageDatatableSearch
protected function getFilterPageDatatableSearch($callBackParameters, $search, $actionType, $table = false, $searchTree = false) { if ($searchTree === false) { // build the query parts that are searched inside the tree if ($actionType == Action::TYPE_PAGE_TITLE) { $searchedString = Common::unsanitizeInputValue($search); } else { $idSite = $callBackParameters[1]; try { $searchedString = PageUrl::excludeQueryParametersFromUrl($search, $idSite); } catch (Exception $e) { $searchedString = $search; } } ArchivingHelper::reloadConfig(); $searchTree = ArchivingHelper::getActionExplodedNames($searchedString, $actionType); } if ($table === false) { // fetch the data table $table = call_user_func_array('\Piwik\Archive::createDataTableFromArchive', $callBackParameters); if ($table instanceof DataTable\Map) { // search an array of tables, e.g. when using date=last30 // note that if the root is an array, we filter all children // if an array occurs inside the nested table, we only look for the first match (see below) $dataTableMap = $table->getEmptyClone(); foreach ($table->getDataTables() as $label => $subTable) { $newSubTable = $this->doFilterPageDatatableSearch($callBackParameters, $subTable, $searchTree); $dataTableMap->addTable($newSubTable, $label); } return $dataTableMap; } } return $this->doFilterPageDatatableSearch($callBackParameters, $table, $searchTree); }
php
protected function getFilterPageDatatableSearch($callBackParameters, $search, $actionType, $table = false, $searchTree = false) { if ($searchTree === false) { // build the query parts that are searched inside the tree if ($actionType == Action::TYPE_PAGE_TITLE) { $searchedString = Common::unsanitizeInputValue($search); } else { $idSite = $callBackParameters[1]; try { $searchedString = PageUrl::excludeQueryParametersFromUrl($search, $idSite); } catch (Exception $e) { $searchedString = $search; } } ArchivingHelper::reloadConfig(); $searchTree = ArchivingHelper::getActionExplodedNames($searchedString, $actionType); } if ($table === false) { // fetch the data table $table = call_user_func_array('\Piwik\Archive::createDataTableFromArchive', $callBackParameters); if ($table instanceof DataTable\Map) { // search an array of tables, e.g. when using date=last30 // note that if the root is an array, we filter all children // if an array occurs inside the nested table, we only look for the first match (see below) $dataTableMap = $table->getEmptyClone(); foreach ($table->getDataTables() as $label => $subTable) { $newSubTable = $this->doFilterPageDatatableSearch($callBackParameters, $subTable, $searchTree); $dataTableMap->addTable($newSubTable, $label); } return $dataTableMap; } } return $this->doFilterPageDatatableSearch($callBackParameters, $table, $searchTree); }
[ "protected", "function", "getFilterPageDatatableSearch", "(", "$", "callBackParameters", ",", "$", "search", ",", "$", "actionType", ",", "$", "table", "=", "false", ",", "$", "searchTree", "=", "false", ")", "{", "if", "(", "$", "searchTree", "===", "false"...
Will search in the DataTable for a Label matching the searched string and return only the matching row, or an empty datatable
[ "Will", "search", "in", "the", "DataTable", "for", "a", "Label", "matching", "the", "searched", "string", "and", "return", "only", "the", "matching", "row", "or", "an", "empty", "datatable" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Actions/API.php#L398-L438
train
Returns the datatable that matches the search string
[ 30522, 5123, 3853, 2131, 8873, 21928, 13704, 2850, 29336, 3085, 17310, 11140, 1006, 1002, 2655, 5963, 28689, 22828, 2015, 1010, 1002, 3945, 1010, 1002, 2895, 13874, 1010, 1002, 2795, 1027, 6270, 1010, 1002, 3945, 13334, 1027, 6270, 1007, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/PrivacyManager/Controller.php
Controller.getPurgeSettingsFromRequest
private function getPurgeSettingsFromRequest() { $settings = array(); // delete logs settings $settings['delete_logs_enable'] = Common::getRequestVar("enableDeleteLogs", 0); $settings['delete_logs_schedule_lowest_interval'] = Common::getRequestVar("deleteLowestInterval", 7); $settings['delete_logs_older_than'] = ((int)Common::getRequestVar("deleteLogsOlderThan", 180) < 1) ? 1 : Common::getRequestVar("deleteOlderThan", 180); // delete reports settings $settings['delete_reports_enable'] = Common::getRequestVar("enableDeleteReports", 0); $deleteReportsOlderThan = Common::getRequestVar("deleteReportsOlderThan", 3); $settings['delete_reports_older_than'] = $deleteReportsOlderThan < 2 ? 2 : $deleteReportsOlderThan; $settings['delete_reports_keep_basic_metrics'] = Common::getRequestVar("keepBasic", 0); $settings['delete_reports_keep_day_reports'] = Common::getRequestVar("keepDay", 0); $settings['delete_reports_keep_week_reports'] = Common::getRequestVar("keepWeek", 0); $settings['delete_reports_keep_month_reports'] = Common::getRequestVar("keepMonth", 0); $settings['delete_reports_keep_year_reports'] = Common::getRequestVar("keepYear", 0); $settings['delete_reports_keep_range_reports'] = Common::getRequestVar("keepRange", 0); $settings['delete_reports_keep_segment_reports'] = Common::getRequestVar("keepSegments", 0); $settings['delete_logs_max_rows_per_query'] = PiwikConfig::getInstance()->Deletelogs['delete_logs_max_rows_per_query']; return $settings; }
php
private function getPurgeSettingsFromRequest() { $settings = array(); // delete logs settings $settings['delete_logs_enable'] = Common::getRequestVar("enableDeleteLogs", 0); $settings['delete_logs_schedule_lowest_interval'] = Common::getRequestVar("deleteLowestInterval", 7); $settings['delete_logs_older_than'] = ((int)Common::getRequestVar("deleteLogsOlderThan", 180) < 1) ? 1 : Common::getRequestVar("deleteOlderThan", 180); // delete reports settings $settings['delete_reports_enable'] = Common::getRequestVar("enableDeleteReports", 0); $deleteReportsOlderThan = Common::getRequestVar("deleteReportsOlderThan", 3); $settings['delete_reports_older_than'] = $deleteReportsOlderThan < 2 ? 2 : $deleteReportsOlderThan; $settings['delete_reports_keep_basic_metrics'] = Common::getRequestVar("keepBasic", 0); $settings['delete_reports_keep_day_reports'] = Common::getRequestVar("keepDay", 0); $settings['delete_reports_keep_week_reports'] = Common::getRequestVar("keepWeek", 0); $settings['delete_reports_keep_month_reports'] = Common::getRequestVar("keepMonth", 0); $settings['delete_reports_keep_year_reports'] = Common::getRequestVar("keepYear", 0); $settings['delete_reports_keep_range_reports'] = Common::getRequestVar("keepRange", 0); $settings['delete_reports_keep_segment_reports'] = Common::getRequestVar("keepSegments", 0); $settings['delete_logs_max_rows_per_query'] = PiwikConfig::getInstance()->Deletelogs['delete_logs_max_rows_per_query']; return $settings; }
[ "private", "function", "getPurgeSettingsFromRequest", "(", ")", "{", "$", "settings", "=", "array", "(", ")", ";", "// delete logs settings", "$", "settings", "[", "'delete_logs_enable'", "]", "=", "Common", "::", "getRequestVar", "(", "\"enableDeleteLogs\"", ",", ...
Utility function. Gets the delete logs/reports settings from the request and uses them to populate config arrays. @return array An array containing the data deletion settings.
[ "Utility", "function", ".", "Gets", "the", "delete", "logs", "/", "reports", "settings", "from", "the", "request", "and", "uses", "them", "to", "populate", "config", "arrays", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/PrivacyManager/Controller.php#L48-L72
train
Returns the settings from the request
[ 30522, 2797, 3853, 2131, 5311, 8449, 18319, 3070, 22747, 21716, 2890, 15500, 1006, 1007, 1063, 1002, 10906, 1027, 9140, 1006, 1007, 1025, 1013, 1013, 3972, 12870, 15664, 10906, 1002, 10906, 1031, 1005, 3972, 12870, 1035, 15664, 1035, 9585, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/CmsCompoundObject.php
CmsCompoundObject.getTwigNodeTree
public function getTwigNodeTree($markup = false) { $loader = new TwigLoader(); $twig = new Twig_Environment($loader, []); $twig->addExtension(new CmsTwigExtension()); $twig->addExtension(new SystemTwigExtension); $stream = $twig->tokenize(new Twig_Source($markup === false ? $this->markup : $markup, 'getTwigNodeTree')); return $twig->parse($stream); }
php
public function getTwigNodeTree($markup = false) { $loader = new TwigLoader(); $twig = new Twig_Environment($loader, []); $twig->addExtension(new CmsTwigExtension()); $twig->addExtension(new SystemTwigExtension); $stream = $twig->tokenize(new Twig_Source($markup === false ? $this->markup : $markup, 'getTwigNodeTree')); return $twig->parse($stream); }
[ "public", "function", "getTwigNodeTree", "(", "$", "markup", "=", "false", ")", "{", "$", "loader", "=", "new", "TwigLoader", "(", ")", ";", "$", "twig", "=", "new", "Twig_Environment", "(", "$", "loader", ",", "[", "]", ")", ";", "$", "twig", "->", ...
Returns Twig node tree generated from the object's markup. This method is used by the system internally and shouldn't participate in the front-end request processing. @link http://twig.sensiolabs.org/doc/internals.html Twig internals @param mixed $markup Specifies the markup content. Use FALSE to load the content from the markup section. @return Twig_Node_Module A node tree
[ "Returns", "Twig", "node", "tree", "generated", "from", "the", "object", "s", "markup", ".", "This", "method", "is", "used", "by", "the", "system", "internally", "and", "shouldn", "t", "participate", "in", "the", "front", "-", "end", "request", "processing",...
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/CmsCompoundObject.php#L410-L419
train
Returns Twig node tree
[ 30522, 2270, 3853, 2131, 2102, 16279, 3630, 3207, 13334, 1006, 1002, 2928, 6279, 1027, 6270, 1007, 1063, 1002, 7170, 2121, 1027, 2047, 1056, 16279, 11066, 2121, 1006, 1007, 1025, 1002, 1056, 16279, 1027, 2047, 1056, 16279, 1035, 4044, 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/Statement/Oracle.php
Zend_Db_Statement_Oracle.fetchColumn
public function fetchColumn($col = 0) { if (!$this->_stmt) { return false; } if (!oci_fetch($this->_stmt)) { // if no error, there is simply no record if (!$error = oci_error($this->_stmt)) { return false; } /** * @see Zend_Db_Adapter_Oracle_Exception */ // require_once 'Zend/Db/Statement/Oracle/Exception.php'; throw new Zend_Db_Statement_Oracle_Exception($error); } $data = oci_result($this->_stmt, $col+1); //1-based if ($data === false) { /** * @see Zend_Db_Adapter_Oracle_Exception */ // require_once 'Zend/Db/Statement/Oracle/Exception.php'; throw new Zend_Db_Statement_Oracle_Exception(oci_error($this->_stmt)); } if ($this->getLobAsString()) { // instanceof doesn't allow '-', we must use a temporary string $type = 'OCI-Lob'; if ($data instanceof $type) { $data = $data->read($data->size()); } } return $data; }
php
public function fetchColumn($col = 0) { if (!$this->_stmt) { return false; } if (!oci_fetch($this->_stmt)) { // if no error, there is simply no record if (!$error = oci_error($this->_stmt)) { return false; } /** * @see Zend_Db_Adapter_Oracle_Exception */ // require_once 'Zend/Db/Statement/Oracle/Exception.php'; throw new Zend_Db_Statement_Oracle_Exception($error); } $data = oci_result($this->_stmt, $col+1); //1-based if ($data === false) { /** * @see Zend_Db_Adapter_Oracle_Exception */ // require_once 'Zend/Db/Statement/Oracle/Exception.php'; throw new Zend_Db_Statement_Oracle_Exception(oci_error($this->_stmt)); } if ($this->getLobAsString()) { // instanceof doesn't allow '-', we must use a temporary string $type = 'OCI-Lob'; if ($data instanceof $type) { $data = $data->read($data->size()); } } return $data; }
[ "public", "function", "fetchColumn", "(", "$", "col", "=", "0", ")", "{", "if", "(", "!", "$", "this", "->", "_stmt", ")", "{", "return", "false", ";", "}", "if", "(", "!", "oci_fetch", "(", "$", "this", "->", "_stmt", ")", ")", "{", "// if no er...
Returns a single column from the next row of a result set. @param int $col OPTIONAL Position of the column to fetch. @return string @throws Zend_Db_Statement_Exception
[ "Returns", "a", "single", "column", "from", "the", "next", "row", "of", "a", "result", "set", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Statement/Oracle.php#L461-L497
train
Fetch a column from the result set
[ 30522, 2270, 3853, 18584, 25778, 2819, 2078, 1006, 1002, 8902, 1027, 1014, 1007, 1063, 2065, 1006, 999, 1002, 2023, 1011, 1028, 1035, 2358, 20492, 1007, 1063, 2709, 6270, 1025, 1065, 2065, 1006, 999, 1051, 6895, 1035, 18584, 1006, 1002, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Bridge/Twig/Extension/CodeExtension.php
CodeExtension.fileExcerpt
public function fileExcerpt($file, $line, $srcContext = 3) { if (is_file($file) && is_readable($file)) { // highlight_file could throw warnings // see https://bugs.php.net/bug.php?id=25725 $code = @highlight_file($file, true); // remove main code/span tags $code = preg_replace('#^<code.*?>\s*<span.*?>(.*)</span>\s*</code>#s', '\\1', $code); // split multiline spans $code = preg_replace_callback('#<span ([^>]++)>((?:[^<]*+<br \/>)++[^<]*+)</span>#', function ($m) { return "<span $m[1]>".str_replace('<br />', "</span><br /><span $m[1]>", $m[2]).'</span>'; }, $code); $content = explode('<br />', $code); $lines = []; if (0 > $srcContext) { $srcContext = \count($content); } for ($i = max($line - $srcContext, 1), $max = min($line + $srcContext, \count($content)); $i <= $max; ++$i) { $lines[] = '<li'.($i == $line ? ' class="selected"' : '').'><a class="anchor" name="line'.$i.'"></a><code>'.self::fixCodeMarkup($content[$i - 1]).'</code></li>'; } return '<ol start="'.max($line - $srcContext, 1).'">'.implode("\n", $lines).'</ol>'; } return null; }
php
public function fileExcerpt($file, $line, $srcContext = 3) { if (is_file($file) && is_readable($file)) { // highlight_file could throw warnings // see https://bugs.php.net/bug.php?id=25725 $code = @highlight_file($file, true); // remove main code/span tags $code = preg_replace('#^<code.*?>\s*<span.*?>(.*)</span>\s*</code>#s', '\\1', $code); // split multiline spans $code = preg_replace_callback('#<span ([^>]++)>((?:[^<]*+<br \/>)++[^<]*+)</span>#', function ($m) { return "<span $m[1]>".str_replace('<br />', "</span><br /><span $m[1]>", $m[2]).'</span>'; }, $code); $content = explode('<br />', $code); $lines = []; if (0 > $srcContext) { $srcContext = \count($content); } for ($i = max($line - $srcContext, 1), $max = min($line + $srcContext, \count($content)); $i <= $max; ++$i) { $lines[] = '<li'.($i == $line ? ' class="selected"' : '').'><a class="anchor" name="line'.$i.'"></a><code>'.self::fixCodeMarkup($content[$i - 1]).'</code></li>'; } return '<ol start="'.max($line - $srcContext, 1).'">'.implode("\n", $lines).'</ol>'; } return null; }
[ "public", "function", "fileExcerpt", "(", "$", "file", ",", "$", "line", ",", "$", "srcContext", "=", "3", ")", "{", "if", "(", "is_file", "(", "$", "file", ")", "&&", "is_readable", "(", "$", "file", ")", ")", "{", "// highlight_file could throw warning...
Returns an excerpt of a code file around the given line number. @param string $file A file path @param int $line The selected line number @param int $srcContext The number of displayed lines around or -1 for the whole file @return string An HTML string
[ "Returns", "an", "excerpt", "of", "a", "code", "file", "around", "the", "given", "line", "number", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bridge/Twig/Extension/CodeExtension.php#L136-L163
train
Highlights a file and returns the excerpt
[ 30522, 2270, 3853, 5371, 10288, 17119, 13876, 1006, 1002, 5371, 1010, 1002, 2240, 1010, 1002, 5034, 21408, 10111, 18413, 1027, 1017, 1007, 1063, 30524, 1007, 1007, 1063, 1013, 1013, 12944, 1035, 5371, 2071, 5466, 16234, 1013, 1013, 2156, 16...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/SEO/Metric/DomainAge.php
DomainAge.getAgeWhoIs
private function getAgeWhoIs($domain) { $data = $this->getUrl('https://www.who.is/whois/' . urlencode($domain)); preg_match('#(?:Creation Date|Created On|created|Registered on)\.*:\s*([ \ta-z0-9\/\-:\.]+)#si', $data, $p); if (!empty($p[1])) { $value = strtotime(trim($p[1])); if ($value === false) { return 0; } return $value; } return 0; }
php
private function getAgeWhoIs($domain) { $data = $this->getUrl('https://www.who.is/whois/' . urlencode($domain)); preg_match('#(?:Creation Date|Created On|created|Registered on)\.*:\s*([ \ta-z0-9\/\-:\.]+)#si', $data, $p); if (!empty($p[1])) { $value = strtotime(trim($p[1])); if ($value === false) { return 0; } return $value; } return 0; }
[ "private", "function", "getAgeWhoIs", "(", "$", "domain", ")", "{", "$", "data", "=", "$", "this", "->", "getUrl", "(", "'https://www.who.is/whois/'", ".", "urlencode", "(", "$", "domain", ")", ")", ";", "preg_match", "(", "'#(?:Creation Date|Created On|created|...
Returns the domain age who.is lists for the current url @param string $domain @return int
[ "Returns", "the", "domain", "age", "who", ".", "is", "lists", "for", "the", "current", "url" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/SEO/Metric/DomainAge.php#L91-L103
train
Get age who is
[ 30522, 2797, 3853, 2131, 4270, 2860, 6806, 2483, 1006, 1002, 5884, 1007, 1063, 1002, 2951, 1027, 1002, 2023, 1011, 1028, 2131, 3126, 2140, 1006, 1005, 16770, 1024, 1013, 1013, 7479, 1012, 2040, 1012, 2003, 1013, 2040, 2483, 1013, 1005, 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...
octobercms/october
modules/backend/widgets/Filter.php
Filter.renderScopeElement
public function renderScopeElement($scope) { $params = ['scope' => $scope]; switch ($scope->type) { case 'date': if ($scope->value && $scope->value instanceof Carbon) { $params['dateStr'] = Backend::dateTime($scope->value, ['formatAlias' => 'dateMin']); $params['date'] = $scope->value->format('Y-m-d H:i:s'); } break; case 'daterange': if ($scope->value && is_array($scope->value) && count($scope->value) === 2 && $scope->value[0] && $scope->value[0] instanceof Carbon && $scope->value[1] && $scope->value[1] instanceof Carbon ) { $after = $scope->value[0]->format('Y-m-d H:i:s'); $before = $scope->value[1]->format('Y-m-d H:i:s'); if(strcasecmp($after, '0000-00-00 00:00:00') > 0) { $params['afterStr'] = Backend::dateTime($scope->value[0], ['formatAlias' => 'dateMin']); $params['after'] = $after; } else { $params['afterStr'] = '∞'; $params['after'] = null; } if(strcasecmp($before, '2999-12-31 23:59:59') < 0) { $params['beforeStr'] = Backend::dateTime($scope->value[1], ['formatAlias' => 'dateMin']); $params['before'] = $before; } else { $params['beforeStr'] = '∞'; $params['before'] = null; } } break; case 'number': if (is_numeric($scope->value)) { $params['number'] = $scope->value; } break; case 'numberrange': if ($scope->value && is_array($scope->value) && count($scope->value) === 2 && $scope->value[0] && $scope->value[1] ) { $min = $scope->value[0]; $max = $scope->value[1]; $params['minStr'] = $min ?: ''; $params['min'] = $min ?: null; $params['maxStr'] = $max ?: '∞'; $params['max'] = $max ?: null; } break; case 'text': $params['value'] = $scope->value; $params['size'] = array_get($scope->config, 'size', 10); break; } return $this->makePartial('scope_'.$scope->type, $params); }
php
public function renderScopeElement($scope) { $params = ['scope' => $scope]; switch ($scope->type) { case 'date': if ($scope->value && $scope->value instanceof Carbon) { $params['dateStr'] = Backend::dateTime($scope->value, ['formatAlias' => 'dateMin']); $params['date'] = $scope->value->format('Y-m-d H:i:s'); } break; case 'daterange': if ($scope->value && is_array($scope->value) && count($scope->value) === 2 && $scope->value[0] && $scope->value[0] instanceof Carbon && $scope->value[1] && $scope->value[1] instanceof Carbon ) { $after = $scope->value[0]->format('Y-m-d H:i:s'); $before = $scope->value[1]->format('Y-m-d H:i:s'); if(strcasecmp($after, '0000-00-00 00:00:00') > 0) { $params['afterStr'] = Backend::dateTime($scope->value[0], ['formatAlias' => 'dateMin']); $params['after'] = $after; } else { $params['afterStr'] = '∞'; $params['after'] = null; } if(strcasecmp($before, '2999-12-31 23:59:59') < 0) { $params['beforeStr'] = Backend::dateTime($scope->value[1], ['formatAlias' => 'dateMin']); $params['before'] = $before; } else { $params['beforeStr'] = '∞'; $params['before'] = null; } } break; case 'number': if (is_numeric($scope->value)) { $params['number'] = $scope->value; } break; case 'numberrange': if ($scope->value && is_array($scope->value) && count($scope->value) === 2 && $scope->value[0] && $scope->value[1] ) { $min = $scope->value[0]; $max = $scope->value[1]; $params['minStr'] = $min ?: ''; $params['min'] = $min ?: null; $params['maxStr'] = $max ?: '∞'; $params['max'] = $max ?: null; } break; case 'text': $params['value'] = $scope->value; $params['size'] = array_get($scope->config, 'size', 10); break; } return $this->makePartial('scope_'.$scope->type, $params); }
[ "public", "function", "renderScopeElement", "(", "$", "scope", ")", "{", "$", "params", "=", "[", "'scope'", "=>", "$", "scope", "]", ";", "switch", "(", "$", "scope", "->", "type", ")", "{", "case", "'date'", ":", "if", "(", "$", "scope", "->", "v...
Renders the HTML element for a scope
[ "Renders", "the", "HTML", "element", "for", "a", "scope" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/Filter.php#L99-L171
train
Render the scope element
[ 30522, 2270, 3853, 17552, 26127, 12260, 3672, 1006, 1002, 9531, 1007, 1063, 1002, 11498, 5244, 1027, 1031, 1005, 9531, 1005, 1027, 1028, 1002, 9531, 1033, 1025, 6942, 1006, 1002, 9531, 1011, 1028, 2828, 1007, 1063, 2553, 1005, 3058, 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
plugins/API/ProcessedReport.php
ProcessedReport.getReportMetadata
public function getReportMetadata($idSite, $period = false, $date = false, $hideMetricsDoc = false, $showSubtableReports = false) { Piwik::checkUserHasViewAccess($idSite); // as they cache key contains a lot of information there would be an even better cache result by caching parts of // this huge method separately but that makes it also more complicated. leaving it like this for now. $key = $this->buildReportMetadataCacheKey($idSite, $period, $date, $hideMetricsDoc, $showSubtableReports); $key = CacheId::pluginAware($key); $cache = PiwikCache::getTransientCache(); if ($cache->contains($key)) { return $cache->fetch($key); } $parameters = array('idSite' => $idSite, 'period' => $period, 'date' => $date); $availableReports = array(); foreach ($this->reportsProvider->getAllReports() as $report) { $report->configureReportMetadata($availableReports, $parameters); } foreach ($availableReports as &$availableReport) { if ($hideMetricsDoc) { unset($availableReport['metricsDocumentation']); } } /** * Triggered after all available reports are collected. * * This event can be used to modify the report metadata of reports in other plugins. You * could, for example, add custom metrics to every report or remove reports from the list * of available reports. * * @param array &$availableReports List of all report metadata. Read the {@hook API.getReportMetadata} * docs to see what this array contains. * @param array $parameters Contains the values of the sites and period we are * getting reports for. Some report depend on this data. * For example, Goals reports depend on the site IDs being * request. Contains the following information: * * - **idSite**: The site ID we are getting reports for. * - **period**: The period type, eg, `'day'`, `'week'`, `'month'`, * `'year'`, `'range'`. * - **date**: A string date within the period or a date range, eg, * `'2013-01-01'` or `'2012-01-01,2013-01-01'`. */ Piwik::postEvent('API.getReportMetadata.end', array(&$availableReports, $parameters)); // Sort results to ensure consistent order usort($availableReports, array($this, 'sortReports')); $knownMetrics = array_merge(Metrics::getDefaultMetrics(), Metrics::getDefaultProcessedMetrics()); $columnsToKeep = $this->getColumnsToKeep(); $columnsToRemove = $this->getColumnsToRemove(); foreach ($availableReports as &$availableReport) { $availableReport['category'] = Piwik::translate($availableReport['category']); $availableReport['subcategory'] = Piwik::translate($availableReport['subcategory']); // Ensure all metrics have a translation $metrics = $availableReport['metrics']; $cleanedMetrics = array(); // TODO we can remove this once we remove the getReportMetadata event, leaving it here for backwards compatibility foreach ($metrics as $metricId => $metricTranslation) { // When simply the column name was given, ie 'metric' => array( 'nb_visits' ) // $metricTranslation is in this case nb_visits. We look for a known translation. if (is_numeric($metricId) && isset($knownMetrics[$metricTranslation]) ) { $metricId = $metricTranslation; $metricTranslation = $knownMetrics[$metricTranslation]; } $cleanedMetrics[$metricId] = $metricTranslation; } $availableReport['metrics'] = $cleanedMetrics; // if hide/show columns specified, hide/show metrics & docs $availableReport['metrics'] = $this->hideShowMetricsWithParams($availableReport['metrics'], $columnsToRemove, $columnsToKeep); if (isset($availableReport['processedMetrics'])) { $availableReport['processedMetrics'] = $this->hideShowMetricsWithParams($availableReport['processedMetrics'], $columnsToRemove, $columnsToKeep); } if (isset($availableReport['metricsDocumentation'])) { $availableReport['metricsDocumentation'] = $this->hideShowMetricsWithParams($availableReport['metricsDocumentation'], $columnsToRemove, $columnsToKeep); } // Remove array elements that are false (to clean up API output) foreach ($availableReport as $attributeName => $attributeValue) { if (empty($attributeValue)) { unset($availableReport[$attributeName]); } } // when there are per goal metrics, don't display conversion_rate since it can differ from per goal sum // TODO we should remove this once we remove the getReportMetadata event, leaving it here for backwards compatibility if (isset($availableReport['metricsGoal'])) { unset($availableReport['processedMetrics']['conversion_rate']); unset($availableReport['metricsGoal']['conversion_rate']); } // Processing a uniqueId for each report, // can be used by UIs as a key to match a given report $uniqueId = $availableReport['module'] . '_' . $availableReport['action']; if (!empty($availableReport['parameters'])) { foreach ($availableReport['parameters'] as $key => $value) { $value = urlencode($value); $value = str_replace('%', '', $value); $uniqueId .= '_' . $key . '--' . $value; } } $availableReport['uniqueId'] = $uniqueId; // Order is used to order reports internally, but not meant to be used outside unset($availableReport['order']); } // remove subtable reports if (!$showSubtableReports) { foreach ($availableReports as $idx => $report) { if (isset($report['isSubtableReport']) && $report['isSubtableReport']) { unset($availableReports[$idx]); } } } $actualReports = array_values($availableReports); $cache->save($key, $actualReports); return $actualReports; // make sure array has contiguous key values }
php
public function getReportMetadata($idSite, $period = false, $date = false, $hideMetricsDoc = false, $showSubtableReports = false) { Piwik::checkUserHasViewAccess($idSite); // as they cache key contains a lot of information there would be an even better cache result by caching parts of // this huge method separately but that makes it also more complicated. leaving it like this for now. $key = $this->buildReportMetadataCacheKey($idSite, $period, $date, $hideMetricsDoc, $showSubtableReports); $key = CacheId::pluginAware($key); $cache = PiwikCache::getTransientCache(); if ($cache->contains($key)) { return $cache->fetch($key); } $parameters = array('idSite' => $idSite, 'period' => $period, 'date' => $date); $availableReports = array(); foreach ($this->reportsProvider->getAllReports() as $report) { $report->configureReportMetadata($availableReports, $parameters); } foreach ($availableReports as &$availableReport) { if ($hideMetricsDoc) { unset($availableReport['metricsDocumentation']); } } /** * Triggered after all available reports are collected. * * This event can be used to modify the report metadata of reports in other plugins. You * could, for example, add custom metrics to every report or remove reports from the list * of available reports. * * @param array &$availableReports List of all report metadata. Read the {@hook API.getReportMetadata} * docs to see what this array contains. * @param array $parameters Contains the values of the sites and period we are * getting reports for. Some report depend on this data. * For example, Goals reports depend on the site IDs being * request. Contains the following information: * * - **idSite**: The site ID we are getting reports for. * - **period**: The period type, eg, `'day'`, `'week'`, `'month'`, * `'year'`, `'range'`. * - **date**: A string date within the period or a date range, eg, * `'2013-01-01'` or `'2012-01-01,2013-01-01'`. */ Piwik::postEvent('API.getReportMetadata.end', array(&$availableReports, $parameters)); // Sort results to ensure consistent order usort($availableReports, array($this, 'sortReports')); $knownMetrics = array_merge(Metrics::getDefaultMetrics(), Metrics::getDefaultProcessedMetrics()); $columnsToKeep = $this->getColumnsToKeep(); $columnsToRemove = $this->getColumnsToRemove(); foreach ($availableReports as &$availableReport) { $availableReport['category'] = Piwik::translate($availableReport['category']); $availableReport['subcategory'] = Piwik::translate($availableReport['subcategory']); // Ensure all metrics have a translation $metrics = $availableReport['metrics']; $cleanedMetrics = array(); // TODO we can remove this once we remove the getReportMetadata event, leaving it here for backwards compatibility foreach ($metrics as $metricId => $metricTranslation) { // When simply the column name was given, ie 'metric' => array( 'nb_visits' ) // $metricTranslation is in this case nb_visits. We look for a known translation. if (is_numeric($metricId) && isset($knownMetrics[$metricTranslation]) ) { $metricId = $metricTranslation; $metricTranslation = $knownMetrics[$metricTranslation]; } $cleanedMetrics[$metricId] = $metricTranslation; } $availableReport['metrics'] = $cleanedMetrics; // if hide/show columns specified, hide/show metrics & docs $availableReport['metrics'] = $this->hideShowMetricsWithParams($availableReport['metrics'], $columnsToRemove, $columnsToKeep); if (isset($availableReport['processedMetrics'])) { $availableReport['processedMetrics'] = $this->hideShowMetricsWithParams($availableReport['processedMetrics'], $columnsToRemove, $columnsToKeep); } if (isset($availableReport['metricsDocumentation'])) { $availableReport['metricsDocumentation'] = $this->hideShowMetricsWithParams($availableReport['metricsDocumentation'], $columnsToRemove, $columnsToKeep); } // Remove array elements that are false (to clean up API output) foreach ($availableReport as $attributeName => $attributeValue) { if (empty($attributeValue)) { unset($availableReport[$attributeName]); } } // when there are per goal metrics, don't display conversion_rate since it can differ from per goal sum // TODO we should remove this once we remove the getReportMetadata event, leaving it here for backwards compatibility if (isset($availableReport['metricsGoal'])) { unset($availableReport['processedMetrics']['conversion_rate']); unset($availableReport['metricsGoal']['conversion_rate']); } // Processing a uniqueId for each report, // can be used by UIs as a key to match a given report $uniqueId = $availableReport['module'] . '_' . $availableReport['action']; if (!empty($availableReport['parameters'])) { foreach ($availableReport['parameters'] as $key => $value) { $value = urlencode($value); $value = str_replace('%', '', $value); $uniqueId .= '_' . $key . '--' . $value; } } $availableReport['uniqueId'] = $uniqueId; // Order is used to order reports internally, but not meant to be used outside unset($availableReport['order']); } // remove subtable reports if (!$showSubtableReports) { foreach ($availableReports as $idx => $report) { if (isset($report['isSubtableReport']) && $report['isSubtableReport']) { unset($availableReports[$idx]); } } } $actualReports = array_values($availableReports); $cache->save($key, $actualReports); return $actualReports; // make sure array has contiguous key values }
[ "public", "function", "getReportMetadata", "(", "$", "idSite", ",", "$", "period", "=", "false", ",", "$", "date", "=", "false", ",", "$", "hideMetricsDoc", "=", "false", ",", "$", "showSubtableReports", "=", "false", ")", "{", "Piwik", "::", "checkUserHas...
Triggers a hook to ask plugins for available Reports. Returns metadata information about each report (category, name, dimension, metrics, etc.) @param int $idSite @param bool|string $period @param bool|Date $date @param bool $hideMetricsDoc @param bool $showSubtableReports @return array
[ "Triggers", "a", "hook", "to", "ask", "plugins", "for", "available", "Reports", ".", "Returns", "metadata", "information", "about", "each", "report", "(", "category", "name", "dimension", "metrics", "etc", ".", ")" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/API/ProcessedReport.php#L173-L303
train
Returns the report metadata for the specified site and period.
[ 30522, 2270, 3853, 2131, 2890, 6442, 11368, 8447, 2696, 1006, 1002, 8909, 28032, 2063, 1010, 1002, 2558, 1027, 6270, 1010, 1002, 3058, 1027, 6270, 1010, 1002, 5342, 12589, 16150, 10085, 1027, 6270, 1010, 1002, 3065, 12083, 10880, 2890, 2537...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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
Events/Ev.php
Ev.add
public function add($fd, $flag, $func, $args = null) { $callback = function ($event, $socket) use ($fd, $func) { try { call_user_func($func, $fd); } catch (\Exception $e) { Worker::log($e); exit(250); } catch (\Error $e) { Worker::log($e); exit(250); } }; switch ($flag) { case self::EV_SIGNAL: $event = new \EvSignal($fd, $callback); $this->_eventSignal[$fd] = $event; return true; case self::EV_TIMER: case self::EV_TIMER_ONCE: $repeat = $flag == self::EV_TIMER_ONCE ? 0 : $fd; $param = array($func, (array)$args, $flag, $fd, self::$_timerId); $event = new \EvTimer($fd, $repeat, array($this, 'timerCallback'), $param); $this->_eventTimer[self::$_timerId] = $event; return self::$_timerId++; default : $fd_key = (int)$fd; $real_flag = $flag === self::EV_READ ? \Ev::READ : \Ev::WRITE; $event = new \EvIo($fd, $real_flag, $callback); $this->_allEvents[$fd_key][$flag] = $event; return true; } }
php
public function add($fd, $flag, $func, $args = null) { $callback = function ($event, $socket) use ($fd, $func) { try { call_user_func($func, $fd); } catch (\Exception $e) { Worker::log($e); exit(250); } catch (\Error $e) { Worker::log($e); exit(250); } }; switch ($flag) { case self::EV_SIGNAL: $event = new \EvSignal($fd, $callback); $this->_eventSignal[$fd] = $event; return true; case self::EV_TIMER: case self::EV_TIMER_ONCE: $repeat = $flag == self::EV_TIMER_ONCE ? 0 : $fd; $param = array($func, (array)$args, $flag, $fd, self::$_timerId); $event = new \EvTimer($fd, $repeat, array($this, 'timerCallback'), $param); $this->_eventTimer[self::$_timerId] = $event; return self::$_timerId++; default : $fd_key = (int)$fd; $real_flag = $flag === self::EV_READ ? \Ev::READ : \Ev::WRITE; $event = new \EvIo($fd, $real_flag, $callback); $this->_allEvents[$fd_key][$flag] = $event; return true; } }
[ "public", "function", "add", "(", "$", "fd", ",", "$", "flag", ",", "$", "func", ",", "$", "args", "=", "null", ")", "{", "$", "callback", "=", "function", "(", "$", "event", ",", "$", "socket", ")", "use", "(", "$", "fd", ",", "$", "func", "...
Add a timer. {@inheritdoc}
[ "Add", "a", "timer", ".", "{" ]
13649907f05014fcfffcfccaef01e63ad3339351
https://github.com/walkor/Workerman/blob/13649907f05014fcfffcfccaef01e63ad3339351/Events/Ev.php#L55-L88
train
Adds an event to the event queue
[ 30522, 2270, 3853, 5587, 1006, 1002, 1042, 2094, 1010, 1002, 5210, 1010, 1002, 4569, 2278, 1010, 1002, 12098, 5620, 1027, 19701, 1007, 1063, 1002, 2655, 5963, 1027, 3853, 1006, 1002, 2724, 1010, 1002, 22278, 1007, 2224, 1006, 1002, 1042, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Visualization/Sparkline.php
Sparkline.setSparklineColors
private function setSparklineColors($sparkline) { $colors = Common::getRequestVar('colors', false, 'json'); if (empty($colors)) { // quick fix so row evolution sparklines will have color in widgetize's iframes $colors = array( 'backgroundColor' => '#ffffff', 'lineColor' => '#162C4A', 'minPointColor' => '#ff7f7f', 'maxPointColor' => '#75BF7C', 'lastPointColor' => '#55AAFF', 'fillColor' => '#ffffff' ); } if (strtolower($colors['backgroundColor']) !== '#ffffff') { $sparkline->setBackgroundColorHex($colors['backgroundColor']); } else { $sparkline->deactivateBackgroundColor(); } $sparkline->setLineColorHex($colors['lineColor']); if (strtolower($colors['fillColor'] !== "#ffffff")) { $sparkline->setFillColorHex($colors['fillColor']); } else { $sparkline->deactivateFillColor(); } if (strtolower($colors['minPointColor'] !== "#ffffff")) { $sparkline->addPoint("minimum", 5, $colors['minPointColor']); } if (strtolower($colors['maxPointColor'] !== "#ffffff")) { $sparkline->addPoint("maximum", 5, $colors['maxPointColor']); } if (strtolower($colors['lastPointColor'] !== "#ffffff")) { $sparkline->addPoint("last", 5, $colors['lastPointColor']); } }
php
private function setSparklineColors($sparkline) { $colors = Common::getRequestVar('colors', false, 'json'); if (empty($colors)) { // quick fix so row evolution sparklines will have color in widgetize's iframes $colors = array( 'backgroundColor' => '#ffffff', 'lineColor' => '#162C4A', 'minPointColor' => '#ff7f7f', 'maxPointColor' => '#75BF7C', 'lastPointColor' => '#55AAFF', 'fillColor' => '#ffffff' ); } if (strtolower($colors['backgroundColor']) !== '#ffffff') { $sparkline->setBackgroundColorHex($colors['backgroundColor']); } else { $sparkline->deactivateBackgroundColor(); } $sparkline->setLineColorHex($colors['lineColor']); if (strtolower($colors['fillColor'] !== "#ffffff")) { $sparkline->setFillColorHex($colors['fillColor']); } else { $sparkline->deactivateFillColor(); } if (strtolower($colors['minPointColor'] !== "#ffffff")) { $sparkline->addPoint("minimum", 5, $colors['minPointColor']); } if (strtolower($colors['maxPointColor'] !== "#ffffff")) { $sparkline->addPoint("maximum", 5, $colors['maxPointColor']); } if (strtolower($colors['lastPointColor'] !== "#ffffff")) { $sparkline->addPoint("last", 5, $colors['lastPointColor']); } }
[ "private", "function", "setSparklineColors", "(", "$", "sparkline", ")", "{", "$", "colors", "=", "Common", "::", "getRequestVar", "(", "'colors'", ",", "false", ",", "'json'", ")", ";", "if", "(", "empty", "(", "$", "colors", ")", ")", "{", "// quick fi...
Sets the sparkline colors @param \Davaxi\Sparkline $sparkline
[ "Sets", "the", "sparkline", "colors" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Visualization/Sparkline.php#L155-L189
train
Set sparkline colors
[ 30522, 2797, 3853, 4520, 14432, 4179, 18717, 2015, 1006, 1002, 12125, 4179, 1007, 1063, 1002, 6087, 1027, 2691, 1024, 1024, 2131, 2890, 15500, 10755, 1006, 1005, 6087, 1005, 1010, 6270, 1010, 1005, 1046, 3385, 1005, 1007, 1025, 2065, 1006, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Yaml/Unescaper.php
Unescaper.utf8chr
private static function utf8chr(int $c): string { if (0x80 > $c %= 0x200000) { return \chr($c); } if (0x800 > $c) { return \chr(0xC0 | $c >> 6).\chr(0x80 | $c & 0x3F); } if (0x10000 > $c) { return \chr(0xE0 | $c >> 12).\chr(0x80 | $c >> 6 & 0x3F).\chr(0x80 | $c & 0x3F); } return \chr(0xF0 | $c >> 18).\chr(0x80 | $c >> 12 & 0x3F).\chr(0x80 | $c >> 6 & 0x3F).\chr(0x80 | $c & 0x3F); }
php
private static function utf8chr(int $c): string { if (0x80 > $c %= 0x200000) { return \chr($c); } if (0x800 > $c) { return \chr(0xC0 | $c >> 6).\chr(0x80 | $c & 0x3F); } if (0x10000 > $c) { return \chr(0xE0 | $c >> 12).\chr(0x80 | $c >> 6 & 0x3F).\chr(0x80 | $c & 0x3F); } return \chr(0xF0 | $c >> 18).\chr(0x80 | $c >> 12 & 0x3F).\chr(0x80 | $c >> 6 & 0x3F).\chr(0x80 | $c & 0x3F); }
[ "private", "static", "function", "utf8chr", "(", "int", "$", "c", ")", ":", "string", "{", "if", "(", "0x80", ">", "$", "c", "%=", "0x200000", ")", "{", "return", "\\", "chr", "(", "$", "c", ")", ";", "}", "if", "(", "0x800", ">", "$", "c", "...
Get the UTF-8 character for the given code point.
[ "Get", "the", "UTF", "-", "8", "character", "for", "the", "given", "code", "point", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Yaml/Unescaper.php#L124-L137
train
UTF - 8 = > UTF - 8
[ 30522, 2797, 10763, 3853, 21183, 2546, 2620, 2818, 2099, 1006, 20014, 1002, 1039, 1007, 1024, 5164, 1063, 2065, 1006, 1014, 2595, 30524, 2692, 1064, 1002, 1039, 1028, 1028, 1020, 1007, 1012, 1032, 10381, 2099, 1006, 1014, 2595, 17914, 1064,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Db/Adapter/Pdo/Mssql.php
Zend_Db_Adapter_Pdo_Mssql.limit
public function limit($sql, $count, $offset = 0) { $count = intval($count); if ($count <= 0) { /** @see Zend_Db_Adapter_Exception */ // require_once 'Zend/Db/Adapter/Exception.php'; throw new Zend_Db_Adapter_Exception("LIMIT argument count=$count is not valid"); } $offset = intval($offset); if ($offset < 0) { /** @see Zend_Db_Adapter_Exception */ // require_once 'Zend/Db/Adapter/Exception.php'; throw new Zend_Db_Adapter_Exception("LIMIT argument offset=$offset is not valid"); } $sql = preg_replace( '/^SELECT\s+(DISTINCT\s)?/i', 'SELECT $1TOP ' . ($count+$offset) . ' ', $sql ); if ($offset > 0) { $orderby = stristr($sql, 'ORDER BY'); if ($orderby !== false) { $orderParts = explode(',', substr($orderby, 8)); $pregReplaceCount = null; $orderbyInverseParts = array(); foreach ($orderParts as $orderPart) { $orderPart = rtrim($orderPart); $inv = preg_replace('/\s+desc$/i', ' ASC', $orderPart, 1, $pregReplaceCount); if ($pregReplaceCount) { $orderbyInverseParts[] = $inv; continue; } $inv = preg_replace('/\s+asc$/i', ' DESC', $orderPart, 1, $pregReplaceCount); if ($pregReplaceCount) { $orderbyInverseParts[] = $inv; continue; } else { $orderbyInverseParts[] = $orderPart . ' DESC'; } } $orderbyInverse = 'ORDER BY ' . implode(', ', $orderbyInverseParts); } $sql = 'SELECT * FROM (SELECT TOP ' . $count . ' * FROM (' . $sql . ') AS inner_tbl'; if ($orderby !== false) { $sql .= ' ' . $orderbyInverse . ' '; } $sql .= ') AS outer_tbl'; if ($orderby !== false) { $sql .= ' ' . $orderby; } } return $sql; }
php
public function limit($sql, $count, $offset = 0) { $count = intval($count); if ($count <= 0) { /** @see Zend_Db_Adapter_Exception */ // require_once 'Zend/Db/Adapter/Exception.php'; throw new Zend_Db_Adapter_Exception("LIMIT argument count=$count is not valid"); } $offset = intval($offset); if ($offset < 0) { /** @see Zend_Db_Adapter_Exception */ // require_once 'Zend/Db/Adapter/Exception.php'; throw new Zend_Db_Adapter_Exception("LIMIT argument offset=$offset is not valid"); } $sql = preg_replace( '/^SELECT\s+(DISTINCT\s)?/i', 'SELECT $1TOP ' . ($count+$offset) . ' ', $sql ); if ($offset > 0) { $orderby = stristr($sql, 'ORDER BY'); if ($orderby !== false) { $orderParts = explode(',', substr($orderby, 8)); $pregReplaceCount = null; $orderbyInverseParts = array(); foreach ($orderParts as $orderPart) { $orderPart = rtrim($orderPart); $inv = preg_replace('/\s+desc$/i', ' ASC', $orderPart, 1, $pregReplaceCount); if ($pregReplaceCount) { $orderbyInverseParts[] = $inv; continue; } $inv = preg_replace('/\s+asc$/i', ' DESC', $orderPart, 1, $pregReplaceCount); if ($pregReplaceCount) { $orderbyInverseParts[] = $inv; continue; } else { $orderbyInverseParts[] = $orderPart . ' DESC'; } } $orderbyInverse = 'ORDER BY ' . implode(', ', $orderbyInverseParts); } $sql = 'SELECT * FROM (SELECT TOP ' . $count . ' * FROM (' . $sql . ') AS inner_tbl'; if ($orderby !== false) { $sql .= ' ' . $orderbyInverse . ' '; } $sql .= ') AS outer_tbl'; if ($orderby !== false) { $sql .= ' ' . $orderby; } } return $sql; }
[ "public", "function", "limit", "(", "$", "sql", ",", "$", "count", ",", "$", "offset", "=", "0", ")", "{", "$", "count", "=", "intval", "(", "$", "count", ")", ";", "if", "(", "$", "count", "<=", "0", ")", "{", "/** @see Zend_Db_Adapter_Exception */"...
Adds an adapter-specific LIMIT clause to the SELECT statement. @link http://lists.bestpractical.com/pipermail/rt-devel/2005-June/007339.html @param string $sql @param integer $count @param integer $offset OPTIONAL @throws Zend_Db_Adapter_Exception @return string
[ "Adds", "an", "adapter", "-", "specific", "LIMIT", "clause", "to", "the", "SELECT", "statement", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Adapter/Pdo/Mssql.php#L317-L379
train
Limit result set
[ 30522, 2270, 3853, 5787, 1006, 1002, 29296, 1010, 1002, 4175, 1010, 1002, 16396, 1027, 1014, 1007, 1063, 1002, 4175, 1027, 20014, 10175, 1006, 1002, 4175, 1007, 1025, 2065, 1006, 1002, 4175, 1026, 1027, 1014, 1007, 1063, 1013, 1008, 1008, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Helpers/LogViewer.php
LogViewer.objectTail
public function objectTail($filepath, $lines = 1, $desc = true) { $data = $this->tail($filepath, $lines); $tailed_log = explode(PHP_EOL, $data); $line_objects = []; foreach ($tailed_log as $line) { $line_objects[] = $this->parse($line); } return $desc ? $line_objects : array_reverse($line_objects); }
php
public function objectTail($filepath, $lines = 1, $desc = true) { $data = $this->tail($filepath, $lines); $tailed_log = explode(PHP_EOL, $data); $line_objects = []; foreach ($tailed_log as $line) { $line_objects[] = $this->parse($line); } return $desc ? $line_objects : array_reverse($line_objects); }
[ "public", "function", "objectTail", "(", "$", "filepath", ",", "$", "lines", "=", "1", ",", "$", "desc", "=", "true", ")", "{", "$", "data", "=", "$", "this", "->", "tail", "(", "$", "filepath", ",", "$", "lines", ")", ";", "$", "tailed_log", "="...
Get the objects of a tailed file @param string $filepath @param int $lines @param bool $desc @return array
[ "Get", "the", "objects", "of", "a", "tailed", "file" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Helpers/LogViewer.php#L24-L35
train
Tail the log file and return the objects
[ 30522, 2270, 3853, 4874, 14162, 1006, 1002, 5371, 15069, 1010, 1002, 3210, 1027, 1015, 1010, 1002, 4078, 2278, 1027, 2995, 1007, 1063, 1002, 2951, 1027, 1002, 2023, 1011, 1028, 5725, 1006, 1002, 5371, 15069, 1010, 1002, 3210, 1007, 1025, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Workflow/Workflow.php
Workflow.getMarking
public function getMarking($subject) { $marking = $this->markingStore->getMarking($subject); if (!$marking instanceof Marking) { throw new LogicException(sprintf('The value returned by the MarkingStore is not an instance of "%s" for workflow "%s".', Marking::class, $this->name)); } // check if the subject is already in the workflow if (!$marking->getPlaces()) { if (!$this->definition->getInitialPlaces()) { throw new LogicException(sprintf('The Marking is empty and there is no initial place for workflow "%s".', $this->name)); } foreach ($this->definition->getInitialPlaces() as $place) { $marking->mark($place); } // update the subject with the new marking $this->markingStore->setMarking($subject, $marking); $this->entered($subject, null, $marking); } // check that the subject has a known place $places = $this->definition->getPlaces(); foreach ($marking->getPlaces() as $placeName => $nbToken) { if (!isset($places[$placeName])) { $message = sprintf('Place "%s" is not valid for workflow "%s".', $placeName, $this->name); if (!$places) { $message .= ' It seems you forgot to add places to the current workflow.'; } throw new LogicException($message); } } return $marking; }
php
public function getMarking($subject) { $marking = $this->markingStore->getMarking($subject); if (!$marking instanceof Marking) { throw new LogicException(sprintf('The value returned by the MarkingStore is not an instance of "%s" for workflow "%s".', Marking::class, $this->name)); } // check if the subject is already in the workflow if (!$marking->getPlaces()) { if (!$this->definition->getInitialPlaces()) { throw new LogicException(sprintf('The Marking is empty and there is no initial place for workflow "%s".', $this->name)); } foreach ($this->definition->getInitialPlaces() as $place) { $marking->mark($place); } // update the subject with the new marking $this->markingStore->setMarking($subject, $marking); $this->entered($subject, null, $marking); } // check that the subject has a known place $places = $this->definition->getPlaces(); foreach ($marking->getPlaces() as $placeName => $nbToken) { if (!isset($places[$placeName])) { $message = sprintf('Place "%s" is not valid for workflow "%s".', $placeName, $this->name); if (!$places) { $message .= ' It seems you forgot to add places to the current workflow.'; } throw new LogicException($message); } } return $marking; }
[ "public", "function", "getMarking", "(", "$", "subject", ")", "{", "$", "marking", "=", "$", "this", "->", "markingStore", "->", "getMarking", "(", "$", "subject", ")", ";", "if", "(", "!", "$", "marking", "instanceof", "Marking", ")", "{", "throw", "n...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Workflow/Workflow.php#L53-L90
train
Get the marking for the subject
[ 30522, 2270, 3853, 2131, 10665, 2075, 1006, 1002, 3395, 1007, 1063, 1002, 10060, 1027, 1002, 2023, 1011, 1028, 13967, 19277, 1011, 1028, 2131, 10665, 2075, 1006, 1002, 3395, 1007, 1025, 2065, 1006, 999, 1002, 10060, 6013, 11253, 10060, 1007...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/LanguagesManager/TranslationWriter/Writer.php
Writer.getTranslations
public function getTranslations($lang) { $path = $this->getTranslationPathBaseDirectory('lang', $lang); if (!is_readable($path)) { return array(); } $data = file_get_contents($path); $translations = json_decode($data, true); return $translations; }
php
public function getTranslations($lang) { $path = $this->getTranslationPathBaseDirectory('lang', $lang); if (!is_readable($path)) { return array(); } $data = file_get_contents($path); $translations = json_decode($data, true); return $translations; }
[ "public", "function", "getTranslations", "(", "$", "lang", ")", "{", "$", "path", "=", "$", "this", "->", "getTranslationPathBaseDirectory", "(", "'lang'", ",", "$", "lang", ")", ";", "if", "(", "!", "is_readable", "(", "$", "path", ")", ")", "{", "ret...
Get translations from file @param string $lang ISO 639-1 alpha-2 language code @throws Exception @return array Array of translations ( plugin => ( key => translated string ) )
[ "Get", "translations", "from", "file" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/LanguagesManager/TranslationWriter/Writer.php#L152-L164
train
Get translations for a lang
[ 30522, 2270, 3853, 2131, 6494, 3619, 13490, 2015, 1006, 1002, 11374, 1007, 1063, 1002, 4130, 1027, 1002, 2023, 1011, 1028, 2131, 6494, 3619, 13490, 15069, 15058, 4305, 2890, 16761, 2100, 1006, 1005, 11374, 1005, 1010, 1002, 11374, 1007, 102...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Config/Definition/Dumper/XmlReferenceDumper.php
XmlReferenceDumper.writeValue
private function writeValue($value): string { if ('%%%%not_defined%%%%' === $value) { return ''; } if (\is_string($value) || is_numeric($value)) { return $value; } if (false === $value) { return 'false'; } if (true === $value) { return 'true'; } if (null === $value) { return 'null'; } if (empty($value)) { return ''; } if (\is_array($value)) { return implode(',', $value); } }
php
private function writeValue($value): string { if ('%%%%not_defined%%%%' === $value) { return ''; } if (\is_string($value) || is_numeric($value)) { return $value; } if (false === $value) { return 'false'; } if (true === $value) { return 'true'; } if (null === $value) { return 'null'; } if (empty($value)) { return ''; } if (\is_array($value)) { return implode(',', $value); } }
[ "private", "function", "writeValue", "(", "$", "value", ")", ":", "string", "{", "if", "(", "'%%%%not_defined%%%%'", "===", "$", "value", ")", "{", "return", "''", ";", "}", "if", "(", "\\", "is_string", "(", "$", "value", ")", "||", "is_numeric", "(",...
Renders the string conversion of the value. @param mixed $value
[ "Renders", "the", "string", "conversion", "of", "the", "value", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Config/Definition/Dumper/XmlReferenceDumper.php#L270-L299
train
Write the value to the language
[ 30522, 2797, 3853, 4339, 10175, 5657, 1006, 1002, 3643, 1007, 1024, 5164, 1063, 2065, 1006, 1005, 1003, 1003, 1003, 1003, 2025, 1035, 4225, 1003, 1003, 1003, 1003, 1005, 1027, 1027, 1027, 1002, 3643, 1007, 1063, 2709, 1005, 1005, 1025, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php
ReflectionExtractor.getProperties
public function getProperties($class, array $context = []) { try { $reflectionClass = new \ReflectionClass($class); } catch (\ReflectionException $e) { return; } $propertyFlags = 0; $methodFlags = 0; if ($this->accessFlags & self::ALLOW_PUBLIC) { $propertyFlags = $propertyFlags | \ReflectionProperty::IS_PUBLIC; $methodFlags = $methodFlags | \ReflectionMethod::IS_PUBLIC; } if ($this->accessFlags & self::ALLOW_PRIVATE) { $propertyFlags = $propertyFlags | \ReflectionProperty::IS_PRIVATE; $methodFlags = $methodFlags | \ReflectionMethod::IS_PRIVATE; } if ($this->accessFlags & self::ALLOW_PROTECTED) { $propertyFlags = $propertyFlags | \ReflectionProperty::IS_PROTECTED; $methodFlags = $methodFlags | \ReflectionMethod::IS_PROTECTED; } $reflectionProperties = $reflectionClass->getProperties(); $properties = []; foreach ($reflectionProperties as $reflectionProperty) { if ($reflectionProperty->getModifiers() & $propertyFlags) { $properties[$reflectionProperty->name] = $reflectionProperty->name; } } foreach ($reflectionClass->getMethods($methodFlags) as $reflectionMethod) { if ($reflectionMethod->isStatic()) { continue; } $propertyName = $this->getPropertyName($reflectionMethod->name, $reflectionProperties); if (!$propertyName || isset($properties[$propertyName])) { continue; } if (!$reflectionClass->hasProperty($propertyName) && !preg_match('/^[A-Z]{2,}/', $propertyName)) { $propertyName = lcfirst($propertyName); } $properties[$propertyName] = $propertyName; } return $properties ? array_values($properties) : null; }
php
public function getProperties($class, array $context = []) { try { $reflectionClass = new \ReflectionClass($class); } catch (\ReflectionException $e) { return; } $propertyFlags = 0; $methodFlags = 0; if ($this->accessFlags & self::ALLOW_PUBLIC) { $propertyFlags = $propertyFlags | \ReflectionProperty::IS_PUBLIC; $methodFlags = $methodFlags | \ReflectionMethod::IS_PUBLIC; } if ($this->accessFlags & self::ALLOW_PRIVATE) { $propertyFlags = $propertyFlags | \ReflectionProperty::IS_PRIVATE; $methodFlags = $methodFlags | \ReflectionMethod::IS_PRIVATE; } if ($this->accessFlags & self::ALLOW_PROTECTED) { $propertyFlags = $propertyFlags | \ReflectionProperty::IS_PROTECTED; $methodFlags = $methodFlags | \ReflectionMethod::IS_PROTECTED; } $reflectionProperties = $reflectionClass->getProperties(); $properties = []; foreach ($reflectionProperties as $reflectionProperty) { if ($reflectionProperty->getModifiers() & $propertyFlags) { $properties[$reflectionProperty->name] = $reflectionProperty->name; } } foreach ($reflectionClass->getMethods($methodFlags) as $reflectionMethod) { if ($reflectionMethod->isStatic()) { continue; } $propertyName = $this->getPropertyName($reflectionMethod->name, $reflectionProperties); if (!$propertyName || isset($properties[$propertyName])) { continue; } if (!$reflectionClass->hasProperty($propertyName) && !preg_match('/^[A-Z]{2,}/', $propertyName)) { $propertyName = lcfirst($propertyName); } $properties[$propertyName] = $propertyName; } return $properties ? array_values($properties) : null; }
[ "public", "function", "getProperties", "(", "$", "class", ",", "array", "$", "context", "=", "[", "]", ")", "{", "try", "{", "$", "reflectionClass", "=", "new", "\\", "ReflectionClass", "(", "$", "class", ")", ";", "}", "catch", "(", "\\", "ReflectionE...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php#L78-L129
train
Get all the properties of a class
[ 30522, 2270, 3853, 2131, 21572, 4842, 7368, 1006, 1002, 2465, 1010, 9140, 1002, 6123, 1027, 1031, 1033, 1007, 1063, 3046, 1063, 1002, 9185, 26266, 1027, 2047, 30524, 3229, 10258, 26454, 1004, 2969, 1024, 1024, 3499, 1035, 2270, 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...
overtrue/wechat
src/OfficialAccount/User/TagClient.php
TagClient.update
public function update(int $tagId, string $name) { $params = [ 'tag' => [ 'id' => $tagId, 'name' => $name, ], ]; return $this->httpPostJson('cgi-bin/tags/update', $params); }
php
public function update(int $tagId, string $name) { $params = [ 'tag' => [ 'id' => $tagId, 'name' => $name, ], ]; return $this->httpPostJson('cgi-bin/tags/update', $params); }
[ "public", "function", "update", "(", "int", "$", "tagId", ",", "string", "$", "name", ")", "{", "$", "params", "=", "[", "'tag'", "=>", "[", "'id'", "=>", "$", "tagId", ",", "'name'", "=>", "$", "name", ",", "]", ",", "]", ";", "return", "$", "...
Update a tag name. @param int $tagId @param string $name @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
[ "Update", "a", "tag", "name", "." ]
120c72faaa93c270365bc75c73c362d5fd583209
https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/OfficialAccount/User/TagClient.php#L63-L73
train
Update a tag
[ 30522, 2270, 3853, 10651, 1006, 20014, 1002, 6415, 3593, 1010, 5164, 1002, 2171, 1007, 1063, 1002, 11498, 5244, 1027, 1031, 1005, 6415, 1005, 1027, 1028, 1031, 1005, 8909, 1005, 1027, 1028, 1002, 6415, 3593, 1010, 1005, 2171, 1005, 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/Form/Extension/Core/DataTransformer/IntegerToLocalizedStringTransformer.php
IntegerToLocalizedStringTransformer.reverseTransform
public function reverseTransform($value) { $decimalSeparator = $this->getNumberFormatter()->getSymbol(\NumberFormatter::DECIMAL_SEPARATOR_SYMBOL); if (\is_string($value) && false !== strpos($value, $decimalSeparator)) { throw new TransformationFailedException(sprintf('The value "%s" is not a valid integer.', $value)); } $result = parent::reverseTransform($value); return null !== $result ? (int) $result : null; }
php
public function reverseTransform($value) { $decimalSeparator = $this->getNumberFormatter()->getSymbol(\NumberFormatter::DECIMAL_SEPARATOR_SYMBOL); if (\is_string($value) && false !== strpos($value, $decimalSeparator)) { throw new TransformationFailedException(sprintf('The value "%s" is not a valid integer.', $value)); } $result = parent::reverseTransform($value); return null !== $result ? (int) $result : null; }
[ "public", "function", "reverseTransform", "(", "$", "value", ")", "{", "$", "decimalSeparator", "=", "$", "this", "->", "getNumberFormatter", "(", ")", "->", "getSymbol", "(", "\\", "NumberFormatter", "::", "DECIMAL_SEPARATOR_SYMBOL", ")", ";", "if", "(", "\\"...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Extension/Core/DataTransformer/IntegerToLocalizedStringTransformer.php#L45-L56
train
Transforms a locale - dependent integer into a locale - dependent integer.
[ 30522, 2270, 3853, 7901, 6494, 3619, 14192, 1006, 1002, 3643, 1007, 1063, 1002, 26066, 3366, 28689, 4263, 1027, 1002, 2023, 1011, 1028, 2131, 19172, 5677, 14192, 20097, 1006, 1007, 1011, 1028, 4152, 24335, 14956, 1006, 1032, 2193, 14192, 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/Language/Language.php
Language.getFallbackPageExtensions
public function getFallbackPageExtensions($file_ext = null) { if (empty($this->page_extensions)) { if (!$file_ext) { $file_ext = CONTENT_EXT; } if ($this->enabled()) { $valid_lang_extensions = []; foreach ($this->languages as $lang) { $valid_lang_extensions[] = '.' . $lang . $file_ext; } if ($this->active) { $active_extension = '.' . $this->active . $file_ext; $key = \array_search($active_extension, $valid_lang_extensions, true); // Default behavior is to find any language other than active if ($this->config->get('system.languages.pages_fallback_only')) { $slice = \array_slice($valid_lang_extensions, 0, $key+1); $valid_lang_extensions = array_reverse($slice); } else { unset($valid_lang_extensions[$key]); array_unshift($valid_lang_extensions, $active_extension); } } $valid_lang_extensions[] = $file_ext; $this->page_extensions = $valid_lang_extensions; } else { $this->page_extensions = (array)$file_ext; } } return $this->page_extensions; }
php
public function getFallbackPageExtensions($file_ext = null) { if (empty($this->page_extensions)) { if (!$file_ext) { $file_ext = CONTENT_EXT; } if ($this->enabled()) { $valid_lang_extensions = []; foreach ($this->languages as $lang) { $valid_lang_extensions[] = '.' . $lang . $file_ext; } if ($this->active) { $active_extension = '.' . $this->active . $file_ext; $key = \array_search($active_extension, $valid_lang_extensions, true); // Default behavior is to find any language other than active if ($this->config->get('system.languages.pages_fallback_only')) { $slice = \array_slice($valid_lang_extensions, 0, $key+1); $valid_lang_extensions = array_reverse($slice); } else { unset($valid_lang_extensions[$key]); array_unshift($valid_lang_extensions, $active_extension); } } $valid_lang_extensions[] = $file_ext; $this->page_extensions = $valid_lang_extensions; } else { $this->page_extensions = (array)$file_ext; } } return $this->page_extensions; }
[ "public", "function", "getFallbackPageExtensions", "(", "$", "file_ext", "=", "null", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "page_extensions", ")", ")", "{", "if", "(", "!", "$", "file_ext", ")", "{", "$", "file_ext", "=", "CONTENT_EXT", ...
Gets an array of valid extensions with active first, then fallback extensions @param string|null $file_ext @return array
[ "Gets", "an", "array", "of", "valid", "extensions", "with", "active", "first", "then", "fallback", "extensions" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Language/Language.php#L286-L320
train
Get the list of page extensions that are not in the fallback language
[ 30522, 2270, 3853, 2131, 13976, 5963, 13704, 10288, 29048, 2015, 1006, 1002, 5371, 1035, 4654, 2102, 1027, 19701, 1007, 1063, 2065, 1006, 4064, 1006, 1002, 2023, 1011, 1028, 3931, 1035, 14305, 1007, 1007, 1063, 2065, 1006, 999, 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...
getgrav/grav
system/src/Grav/Common/Twig/TwigExtension.php
TwigExtension.readFileFunc
public function readFileFunc($filepath) { /** @var UniformResourceLocator $locator */ $locator = $this->grav['locator']; if ($locator->isStream($filepath)) { $filepath = $locator->findResource($filepath); } if ($filepath && file_exists($filepath)) { return file_get_contents($filepath); } return false; }
php
public function readFileFunc($filepath) { /** @var UniformResourceLocator $locator */ $locator = $this->grav['locator']; if ($locator->isStream($filepath)) { $filepath = $locator->findResource($filepath); } if ($filepath && file_exists($filepath)) { return file_get_contents($filepath); } return false; }
[ "public", "function", "readFileFunc", "(", "$", "filepath", ")", "{", "/** @var UniformResourceLocator $locator */", "$", "locator", "=", "$", "this", "->", "grav", "[", "'locator'", "]", ";", "if", "(", "$", "locator", "->", "isStream", "(", "$", "filepath", ...
Simple function to read a file based on a filepath and output it @param string $filepath @return bool|string
[ "Simple", "function", "to", "read", "a", "file", "based", "on", "a", "filepath", "and", "output", "it" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Twig/TwigExtension.php#L1180-L1194
train
Read file content
[ 30522, 2270, 3853, 3191, 8873, 2571, 11263, 12273, 1006, 1002, 5371, 15069, 1007, 1063, 1013, 1008, 1008, 1030, 13075, 6375, 6072, 8162, 29109, 24755, 4263, 1002, 8840, 11266, 2953, 1008, 1013, 1002, 8840, 11266, 2953, 1027, 1002, 2023, 101...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Console/Terminal.php
Terminal.getWidth
public function getWidth() { $width = getenv('COLUMNS'); if (false !== $width) { return (int) trim($width); } if (null === self::$width) { self::initDimensions(); } return self::$width ?: 80; }
php
public function getWidth() { $width = getenv('COLUMNS'); if (false !== $width) { return (int) trim($width); } if (null === self::$width) { self::initDimensions(); } return self::$width ?: 80; }
[ "public", "function", "getWidth", "(", ")", "{", "$", "width", "=", "getenv", "(", "'COLUMNS'", ")", ";", "if", "(", "false", "!==", "$", "width", ")", "{", "return", "(", "int", ")", "trim", "(", "$", "width", ")", ";", "}", "if", "(", "null", ...
Gets the terminal width. @return int
[ "Gets", "the", "terminal", "width", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Console/Terminal.php#L24-L36
train
Get the width of the terminal.
[ 30522, 2270, 3853, 2131, 9148, 11927, 2232, 1006, 1007, 1063, 1002, 9381, 1027, 2131, 2368, 2615, 1006, 1005, 7753, 1005, 1007, 1025, 2065, 1006, 6270, 999, 1027, 1027, 1002, 9381, 1007, 1063, 2709, 1006, 20014, 1007, 12241, 1006, 1002, 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...
octobercms/october
modules/cms/classes/Controller.php
Controller.renderPartial
public function renderPartial($name, $parameters = [], $throwException = true) { $vars = $this->vars; $this->vars = array_merge($this->vars, $parameters); /* * Alias @ symbol for :: */ if (substr($name, 0, 1) == '@') { $name = '::' . substr($name, 1); } /** * @event cms.page.beforeRenderPartial * Provides an oportunity to manipulate the name of the partial being rendered before it renders * * Example usage: * * Event::listen('cms.page.beforeRenderPartial', function ((\Cms\Classes\Controller) $controller, (string) $partialName) { * return "path/to/overriding/location/" . $partialName; * }); * * Or * * $CmsController->bindEvent('page.beforeRenderPartial', function ((string) $partialName) { * return "path/to/overriding/location/" . $partialName; * }); * */ if ($event = $this->fireSystemEvent('cms.page.beforeRenderPartial', [$name])) { $partial = $event; } /* * Process Component partial */ elseif (strpos($name, '::') !== false) { list($componentAlias, $partialName) = explode('::', $name); /* * Component alias not supplied */ if (!strlen($componentAlias)) { if ($this->componentContext !== null) { $componentObj = $this->componentContext; } elseif (($componentObj = $this->findComponentByPartial($partialName)) === null) { if ($throwException) { throw new CmsException(Lang::get('cms::lang.partial.not_found_name', ['name'=>$partialName])); } return false; } } /* * Component alias is supplied */ elseif (($componentObj = $this->findComponentByName($componentAlias)) === null) { if ($throwException) { throw new CmsException(Lang::get('cms::lang.component.not_found', ['name'=>$componentAlias])); } return false; } $partial = null; $this->componentContext = $componentObj; /* * Check if the theme has an override */ if (strpos($partialName, '/') === false) { $partial = ComponentPartial::loadOverrideCached($this->theme, $componentObj, $partialName); } /* * Check the component partial */ if ($partial === null) { $partial = ComponentPartial::loadCached($componentObj, $partialName); } if ($partial === null) { if ($throwException) { throw new CmsException(Lang::get('cms::lang.partial.not_found_name', ['name'=>$name])); } return false; } /* * Set context for self access */ $this->vars['__SELF__'] = $componentObj; } /* * Process theme partial */ elseif (($partial = Partial::loadCached($this->theme, $name)) === null) { if ($throwException) { throw new CmsException(Lang::get('cms::lang.partial.not_found_name', ['name'=>$name])); } return false; } /* * Run functions for CMS partials only (Cms\Classes\Partial) */ if ($partial instanceof Partial) { $this->partialStack->stackPartial(); $manager = ComponentManager::instance(); foreach ($partial->settings['components'] as $component => $properties) { // Do not inject the viewBag component to the environment. // Not sure if they're needed there by the requirements, // but there were problems with array-typed properties used by Static Pages // snippets and setComponentPropertiesFromParams(). --ab if ($component == 'viewBag') { continue; } list($name, $alias) = strpos($component, ' ') ? explode(' ', $component) : [$component, $component]; if (!$componentObj = $manager->makeComponent($name, $this->pageObj, $properties)) { throw new CmsException(Lang::get('cms::lang.component.not_found', ['name'=>$name])); } $componentObj->alias = $alias; $parameters[$alias] = $partial->components[$alias] = $componentObj; $this->partialStack->addComponent($alias, $componentObj); $this->setComponentPropertiesFromParams($componentObj, $parameters); $componentObj->init(); } CmsException::mask($this->page, 300); $parser = new CodeParser($partial); $partialObj = $parser->source($this->page, $this->layout, $this); CmsException::unmask(); CmsException::mask($partial, 300); $partialObj->onStart(); $partial->runComponents(); $partialObj->onEnd(); CmsException::unmask(); } /* * Render the partial */ CmsException::mask($partial, 400); $this->loader->setObject($partial); $template = $this->twig->loadTemplate($partial->getFilePath()); $partialContent = $template->render(array_merge($this->vars, $parameters)); CmsException::unmask(); if ($partial instanceof Partial) { $this->partialStack->unstackPartial(); } $this->vars = $vars; /** * @event cms.page.renderPartial * Provides an oportunity to manipulate the output of a partial after being rendered * * Example usage: * * Event::listen('cms.page.renderPartial', function ((\Cms\Classes\Controller) $controller, (string) $partialName, (string) &$partialContent) { * return "Overriding content"; * }); * * Or * * $CmsController->bindEvent('page.renderPartial', function ((string) $partialName, (string) &$partialContent) { * return "Overriding content"; * }); * */ if ($event = $this->fireSystemEvent('cms.page.renderPartial', [$name, &$partialContent])) { return $event; } return $partialContent; }
php
public function renderPartial($name, $parameters = [], $throwException = true) { $vars = $this->vars; $this->vars = array_merge($this->vars, $parameters); /* * Alias @ symbol for :: */ if (substr($name, 0, 1) == '@') { $name = '::' . substr($name, 1); } /** * @event cms.page.beforeRenderPartial * Provides an oportunity to manipulate the name of the partial being rendered before it renders * * Example usage: * * Event::listen('cms.page.beforeRenderPartial', function ((\Cms\Classes\Controller) $controller, (string) $partialName) { * return "path/to/overriding/location/" . $partialName; * }); * * Or * * $CmsController->bindEvent('page.beforeRenderPartial', function ((string) $partialName) { * return "path/to/overriding/location/" . $partialName; * }); * */ if ($event = $this->fireSystemEvent('cms.page.beforeRenderPartial', [$name])) { $partial = $event; } /* * Process Component partial */ elseif (strpos($name, '::') !== false) { list($componentAlias, $partialName) = explode('::', $name); /* * Component alias not supplied */ if (!strlen($componentAlias)) { if ($this->componentContext !== null) { $componentObj = $this->componentContext; } elseif (($componentObj = $this->findComponentByPartial($partialName)) === null) { if ($throwException) { throw new CmsException(Lang::get('cms::lang.partial.not_found_name', ['name'=>$partialName])); } return false; } } /* * Component alias is supplied */ elseif (($componentObj = $this->findComponentByName($componentAlias)) === null) { if ($throwException) { throw new CmsException(Lang::get('cms::lang.component.not_found', ['name'=>$componentAlias])); } return false; } $partial = null; $this->componentContext = $componentObj; /* * Check if the theme has an override */ if (strpos($partialName, '/') === false) { $partial = ComponentPartial::loadOverrideCached($this->theme, $componentObj, $partialName); } /* * Check the component partial */ if ($partial === null) { $partial = ComponentPartial::loadCached($componentObj, $partialName); } if ($partial === null) { if ($throwException) { throw new CmsException(Lang::get('cms::lang.partial.not_found_name', ['name'=>$name])); } return false; } /* * Set context for self access */ $this->vars['__SELF__'] = $componentObj; } /* * Process theme partial */ elseif (($partial = Partial::loadCached($this->theme, $name)) === null) { if ($throwException) { throw new CmsException(Lang::get('cms::lang.partial.not_found_name', ['name'=>$name])); } return false; } /* * Run functions for CMS partials only (Cms\Classes\Partial) */ if ($partial instanceof Partial) { $this->partialStack->stackPartial(); $manager = ComponentManager::instance(); foreach ($partial->settings['components'] as $component => $properties) { // Do not inject the viewBag component to the environment. // Not sure if they're needed there by the requirements, // but there were problems with array-typed properties used by Static Pages // snippets and setComponentPropertiesFromParams(). --ab if ($component == 'viewBag') { continue; } list($name, $alias) = strpos($component, ' ') ? explode(' ', $component) : [$component, $component]; if (!$componentObj = $manager->makeComponent($name, $this->pageObj, $properties)) { throw new CmsException(Lang::get('cms::lang.component.not_found', ['name'=>$name])); } $componentObj->alias = $alias; $parameters[$alias] = $partial->components[$alias] = $componentObj; $this->partialStack->addComponent($alias, $componentObj); $this->setComponentPropertiesFromParams($componentObj, $parameters); $componentObj->init(); } CmsException::mask($this->page, 300); $parser = new CodeParser($partial); $partialObj = $parser->source($this->page, $this->layout, $this); CmsException::unmask(); CmsException::mask($partial, 300); $partialObj->onStart(); $partial->runComponents(); $partialObj->onEnd(); CmsException::unmask(); } /* * Render the partial */ CmsException::mask($partial, 400); $this->loader->setObject($partial); $template = $this->twig->loadTemplate($partial->getFilePath()); $partialContent = $template->render(array_merge($this->vars, $parameters)); CmsException::unmask(); if ($partial instanceof Partial) { $this->partialStack->unstackPartial(); } $this->vars = $vars; /** * @event cms.page.renderPartial * Provides an oportunity to manipulate the output of a partial after being rendered * * Example usage: * * Event::listen('cms.page.renderPartial', function ((\Cms\Classes\Controller) $controller, (string) $partialName, (string) &$partialContent) { * return "Overriding content"; * }); * * Or * * $CmsController->bindEvent('page.renderPartial', function ((string) $partialName, (string) &$partialContent) { * return "Overriding content"; * }); * */ if ($event = $this->fireSystemEvent('cms.page.renderPartial', [$name, &$partialContent])) { return $event; } return $partialContent; }
[ "public", "function", "renderPartial", "(", "$", "name", ",", "$", "parameters", "=", "[", "]", ",", "$", "throwException", "=", "true", ")", "{", "$", "vars", "=", "$", "this", "->", "vars", ";", "$", "this", "->", "vars", "=", "array_merge", "(", ...
Renders a requested partial. The framework uses this method internally. @param string $name The view to load. @param array $parameters Parameter variables to pass to the view. @param bool $throwException Throw an exception if the partial is not found. @return mixed Partial contents or false if not throwing an exception.
[ "Renders", "a", "requested", "partial", ".", "The", "framework", "uses", "this", "method", "internally", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/Controller.php#L932-L1121
train
Renders a partial
[ 30522, 2270, 3853, 17552, 19362, 20925, 1006, 1002, 2171, 1010, 1002, 11709, 1027, 1031, 1033, 1010, 1002, 5466, 10288, 24422, 1027, 2995, 1007, 1063, 1002, 13075, 2015, 1027, 1002, 2023, 1011, 1028, 13075, 2015, 1025, 1002, 2023, 1011, 102...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/HttpFoundation/Session/Storage/MockArraySessionStorage.php
MockArraySessionStorage.save
public function save() { if (!$this->started || $this->closed) { throw new \RuntimeException('Trying to save a session that was not started yet or was already closed'); } // nothing to do since we don't persist the session data $this->closed = false; $this->started = false; }
php
public function save() { if (!$this->started || $this->closed) { throw new \RuntimeException('Trying to save a session that was not started yet or was already closed'); } // nothing to do since we don't persist the session data $this->closed = false; $this->started = false; }
[ "public", "function", "save", "(", ")", "{", "if", "(", "!", "$", "this", "->", "started", "||", "$", "this", "->", "closed", ")", "{", "throw", "new", "\\", "RuntimeException", "(", "'Trying to save a session that was not started yet or was already closed'", ")",...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpFoundation/Session/Storage/MockArraySessionStorage.php#L148-L156
train
Saves the session data
[ 30522, 2270, 3853, 3828, 1006, 1007, 1063, 2065, 1006, 999, 1002, 2023, 1011, 1028, 2318, 1064, 1064, 1002, 2023, 1011, 1028, 2701, 1007, 1063, 5466, 2047, 1032, 2448, 7292, 10288, 24422, 1006, 1005, 2667, 2000, 3828, 1037, 5219, 2008, 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...
octobercms/october
modules/backend/widgets/Form.php
Form.getSessionKey
public function getSessionKey() { if ($this->sessionKey) { return $this->sessionKey; } if (post('_session_key')) { return $this->sessionKey = post('_session_key'); } return $this->sessionKey = FormHelper::getSessionKey(); }
php
public function getSessionKey() { if ($this->sessionKey) { return $this->sessionKey; } if (post('_session_key')) { return $this->sessionKey = post('_session_key'); } return $this->sessionKey = FormHelper::getSessionKey(); }
[ "public", "function", "getSessionKey", "(", ")", "{", "if", "(", "$", "this", "->", "sessionKey", ")", "{", "return", "$", "this", "->", "sessionKey", ";", "}", "if", "(", "post", "(", "'_session_key'", ")", ")", "{", "return", "$", "this", "->", "se...
Returns the active session key. @return \Illuminate\Routing\Route|mixed|string
[ "Returns", "the", "active", "session", "key", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/Form.php#L1293-L1304
train
Get Session Key
[ 30522, 2270, 3853, 4152, 7971, 3258, 14839, 1006, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 5219, 14839, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 5219, 14839, 1025, 1065, 2065, 1006, 2695, 1006, 1005, 1035, 5219, 1035, 3145, 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/Support/Optional.php
Optional.__isset
public function __isset($name) { if (is_object($this->value)) { return isset($this->value->{$name}); } if (is_array($this->value) || $this->value instanceof ArrayObject) { return isset($this->value[$name]); } return false; }
php
public function __isset($name) { if (is_object($this->value)) { return isset($this->value->{$name}); } if (is_array($this->value) || $this->value instanceof ArrayObject) { return isset($this->value[$name]); } return false; }
[ "public", "function", "__isset", "(", "$", "name", ")", "{", "if", "(", "is_object", "(", "$", "this", "->", "value", ")", ")", "{", "return", "isset", "(", "$", "this", "->", "value", "->", "{", "$", "name", "}", ")", ";", "}", "if", "(", "is_...
Dynamically check a property exists on the underlying object. @param mixed $name @return bool
[ "Dynamically", "check", "a", "property", "exists", "on", "the", "underlying", "object", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Support/Optional.php#L51-L62
train
Method to check if a value is set
[ 30522, 2270, 3853, 1035, 1035, 26354, 3388, 1006, 1002, 2171, 1007, 1063, 2065, 1006, 2003, 1035, 4874, 1006, 1002, 2023, 1011, 1028, 3643, 1007, 1007, 1063, 2709, 26354, 3388, 1006, 1002, 2023, 1011, 1028, 3643, 1011, 1028, 1063, 1002, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Translation/DataCollectorTranslator.php
DataCollectorTranslator.transChoice
public function transChoice($id, $number, array $parameters = [], $domain = null, $locale = null) { if ($this->translator instanceof TranslatorInterface) { $trans = $this->translator->trans($id, ['%count%' => $number] + $parameters, $domain, $locale); } $trans = $this->translator->transChoice($id, $number, $parameters, $domain, $locale); $this->collectMessage($locale, $domain, $id, $trans, ['%count%' => $number] + $parameters); return $trans; }
php
public function transChoice($id, $number, array $parameters = [], $domain = null, $locale = null) { if ($this->translator instanceof TranslatorInterface) { $trans = $this->translator->trans($id, ['%count%' => $number] + $parameters, $domain, $locale); } $trans = $this->translator->transChoice($id, $number, $parameters, $domain, $locale); $this->collectMessage($locale, $domain, $id, $trans, ['%count%' => $number] + $parameters); return $trans; }
[ "public", "function", "transChoice", "(", "$", "id", ",", "$", "number", ",", "array", "$", "parameters", "=", "[", "]", ",", "$", "domain", "=", "null", ",", "$", "locale", "=", "null", ")", "{", "if", "(", "$", "this", "->", "translator", "instan...
{@inheritdoc} @deprecated since Symfony 4.2, use the trans() method instead with a %count% parameter
[ "{", "@inheritdoc", "}" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Translation/DataCollectorTranslator.php#L67-L78
train
Devuelve el valor de una transacion
[ 30522, 2270, 3853, 9099, 9905, 6610, 1006, 1002, 8909, 1010, 1002, 2193, 1010, 9140, 1002, 11709, 1027, 1031, 1033, 1010, 1002, 5884, 1027, 19701, 1010, 1002, 2334, 2063, 1027, 19701, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 11403, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/UsersManager/Controller.php
Controller.userSettings
public function userSettings() { Piwik::checkUserIsNotAnonymous(); $view = new View('@UsersManager/userSettings'); $userLogin = Piwik::getCurrentUserLogin(); $user = Request::processRequest('UsersManager.getUser', array('userLogin' => $userLogin)); $view->userEmail = $user['email']; $view->userTokenAuth = Piwik::getCurrentUserTokenAuth(); $view->ignoreSalt = $this->getIgnoreCookieSalt(); $userPreferences = new UserPreferences(); $defaultReport = $userPreferences->getDefaultReport(); if ($defaultReport === false) { $defaultReport = $userPreferences->getDefaultWebsiteId(); } $view->defaultReport = $defaultReport; if ($defaultReport == 'MultiSites') { $defaultSiteId = $userPreferences->getDefaultWebsiteId(); $reportOptionsValue = $defaultSiteId; $view->defaultReportIdSite = $defaultSiteId; $view->defaultReportSiteName = Site::getNameFor($defaultSiteId); } else { $reportOptionsValue = $defaultReport; $view->defaultReportIdSite = $defaultReport; $view->defaultReportSiteName = Site::getNameFor($defaultReport); } $view->defaultReportOptions = array( array('key' => 'MultiSites', 'value' => Piwik::translate('General_AllWebsitesDashboard')), array('key' => $reportOptionsValue, 'value' => Piwik::translate('General_DashboardForASpecificWebsite')), ); $view->defaultDate = $this->getDefaultDateForUser($userLogin); $view->availableDefaultDates = $this->getDefaultDates(); $languages = APILanguagesManager::getInstance()->getAvailableLanguageNames(); $languageOptions = array(); foreach ($languages as $language) { $languageOptions[] = array( 'key' => $language['code'], 'value' => $language['name'] ); } $view->languageOptions = $languageOptions; $view->currentLanguageCode = LanguagesManager::getLanguageCodeForCurrentUser(); $view->currentTimeformat = (int) LanguagesManager::uses12HourClockForCurrentUser(); $view->ignoreCookieSet = IgnoreCookie::isIgnoreCookieFound(); $view->piwikHost = Url::getCurrentHost(); $this->setBasicVariablesView($view); $view->timeFormats = array( '1' => Piwik::translate('General_12HourClock'), '0' => Piwik::translate('General_24HourClock') ); return $view->render(); }
php
public function userSettings() { Piwik::checkUserIsNotAnonymous(); $view = new View('@UsersManager/userSettings'); $userLogin = Piwik::getCurrentUserLogin(); $user = Request::processRequest('UsersManager.getUser', array('userLogin' => $userLogin)); $view->userEmail = $user['email']; $view->userTokenAuth = Piwik::getCurrentUserTokenAuth(); $view->ignoreSalt = $this->getIgnoreCookieSalt(); $userPreferences = new UserPreferences(); $defaultReport = $userPreferences->getDefaultReport(); if ($defaultReport === false) { $defaultReport = $userPreferences->getDefaultWebsiteId(); } $view->defaultReport = $defaultReport; if ($defaultReport == 'MultiSites') { $defaultSiteId = $userPreferences->getDefaultWebsiteId(); $reportOptionsValue = $defaultSiteId; $view->defaultReportIdSite = $defaultSiteId; $view->defaultReportSiteName = Site::getNameFor($defaultSiteId); } else { $reportOptionsValue = $defaultReport; $view->defaultReportIdSite = $defaultReport; $view->defaultReportSiteName = Site::getNameFor($defaultReport); } $view->defaultReportOptions = array( array('key' => 'MultiSites', 'value' => Piwik::translate('General_AllWebsitesDashboard')), array('key' => $reportOptionsValue, 'value' => Piwik::translate('General_DashboardForASpecificWebsite')), ); $view->defaultDate = $this->getDefaultDateForUser($userLogin); $view->availableDefaultDates = $this->getDefaultDates(); $languages = APILanguagesManager::getInstance()->getAvailableLanguageNames(); $languageOptions = array(); foreach ($languages as $language) { $languageOptions[] = array( 'key' => $language['code'], 'value' => $language['name'] ); } $view->languageOptions = $languageOptions; $view->currentLanguageCode = LanguagesManager::getLanguageCodeForCurrentUser(); $view->currentTimeformat = (int) LanguagesManager::uses12HourClockForCurrentUser(); $view->ignoreCookieSet = IgnoreCookie::isIgnoreCookieFound(); $view->piwikHost = Url::getCurrentHost(); $this->setBasicVariablesView($view); $view->timeFormats = array( '1' => Piwik::translate('General_12HourClock'), '0' => Piwik::translate('General_24HourClock') ); return $view->render(); }
[ "public", "function", "userSettings", "(", ")", "{", "Piwik", "::", "checkUserIsNotAnonymous", "(", ")", ";", "$", "view", "=", "new", "View", "(", "'@UsersManager/userSettings'", ")", ";", "$", "userLogin", "=", "Piwik", "::", "getCurrentUserLogin", "(", ")",...
The "User Settings" admin UI screen view
[ "The", "User", "Settings", "admin", "UI", "screen", "view" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/UsersManager/Controller.php#L174-L238
train
Displays the user settings page
[ 30522, 2270, 3853, 5198, 18319, 3070, 2015, 1006, 1007, 1063, 14255, 9148, 2243, 1024, 1024, 4638, 20330, 2483, 17048, 6761, 4890, 27711, 1006, 1007, 1025, 1002, 3193, 1027, 2047, 3193, 1006, 1005, 1030, 5198, 24805, 4590, 1013, 5198, 18319...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Psr7/AbstractUri.php
AbstractUri.getBaseUrl
protected function getBaseUrl() { $uri = ''; $scheme = $this->getScheme(); if ($scheme !== '') { $uri .= $scheme . ':'; } $authority = $this->getAuthority(); if ($authority !== '' || $scheme === 'file') { $uri .= '//' . $authority; } return $uri; }
php
protected function getBaseUrl() { $uri = ''; $scheme = $this->getScheme(); if ($scheme !== '') { $uri .= $scheme . ':'; } $authority = $this->getAuthority(); if ($authority !== '' || $scheme === 'file') { $uri .= '//' . $authority; } return $uri; }
[ "protected", "function", "getBaseUrl", "(", ")", "{", "$", "uri", "=", "''", ";", "$", "scheme", "=", "$", "this", "->", "getScheme", "(", ")", ";", "if", "(", "$", "scheme", "!==", "''", ")", "{", "$", "uri", ".=", "$", "scheme", ".", "':'", "...
Return the fully qualified base URL ( like http://getgrav.org ). Note that this method never includes a trailing / @return string
[ "Return", "the", "fully", "qualified", "base", "URL", "(", "like", "http", ":", "//", "getgrav", ".", "org", ")", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Framework/Psr7/AbstractUri.php#L300-L315
train
Get Base Url
[ 30522, 5123, 3853, 2131, 15058, 3126, 2140, 1006, 1007, 1063, 1002, 24471, 2072, 1027, 1005, 1005, 1025, 1002, 5679, 1027, 1002, 2023, 1011, 1028, 4152, 5403, 4168, 1006, 1007, 1025, 2065, 1006, 1002, 5679, 999, 1027, 1027, 1005, 1005, 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/Database/Query/Builder.php
Builder.runPaginationCountQuery
protected function runPaginationCountQuery($columns = ['*']) { $without = $this->unions ? ['orders', 'limit', 'offset'] : ['columns', 'orders', 'limit', 'offset']; return $this->cloneWithout($without) ->cloneWithoutBindings($this->unions ? ['order'] : ['select', 'order']) ->setAggregate('count', $this->withoutSelectAliases($columns)) ->get()->all(); }
php
protected function runPaginationCountQuery($columns = ['*']) { $without = $this->unions ? ['orders', 'limit', 'offset'] : ['columns', 'orders', 'limit', 'offset']; return $this->cloneWithout($without) ->cloneWithoutBindings($this->unions ? ['order'] : ['select', 'order']) ->setAggregate('count', $this->withoutSelectAliases($columns)) ->get()->all(); }
[ "protected", "function", "runPaginationCountQuery", "(", "$", "columns", "=", "[", "'*'", "]", ")", "{", "$", "without", "=", "$", "this", "->", "unions", "?", "[", "'orders'", ",", "'limit'", ",", "'offset'", "]", ":", "[", "'columns'", ",", "'orders'",...
Run a pagination count query. @param array $columns @return array
[ "Run", "a", "pagination", "count", "query", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Query/Builder.php#L2204-L2212
train
Runs the count query
[ 30522, 5123, 3853, 2448, 4502, 20876, 3508, 3597, 16671, 4226, 2854, 1006, 1002, 7753, 1027, 1031, 1005, 1008, 1005, 1033, 1007, 1063, 1002, 2302, 1027, 1002, 2023, 1011, 1028, 9209, 1029, 1031, 1005, 4449, 1005, 1010, 1005, 5787, 1005, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/backend/behaviors/ListController.php
ListController.extendListColumns
public static function extendListColumns($callback) { $calledClass = self::getCalledExtensionClass(); Event::listen('backend.list.extendColumns', function ($widget) use ($calledClass, $callback) { if (!is_a($widget->getController(), $calledClass)) { return; } call_user_func_array($callback, [$widget, $widget->model]); }); }
php
public static function extendListColumns($callback) { $calledClass = self::getCalledExtensionClass(); Event::listen('backend.list.extendColumns', function ($widget) use ($calledClass, $callback) { if (!is_a($widget->getController(), $calledClass)) { return; } call_user_func_array($callback, [$widget, $widget->model]); }); }
[ "public", "static", "function", "extendListColumns", "(", "$", "callback", ")", "{", "$", "calledClass", "=", "self", "::", "getCalledExtensionClass", "(", ")", ";", "Event", "::", "listen", "(", "'backend.list.extendColumns'", ",", "function", "(", "$", "widget...
Static helper for extending list columns. @param callable $callback @return void
[ "Static", "helper", "for", "extending", "list", "columns", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/behaviors/ListController.php#L552-L561
train
Extend list columns
[ 30522, 2270, 10763, 3853, 7949, 9863, 25778, 2819, 3619, 1006, 1002, 2655, 5963, 1007, 1063, 1002, 2170, 26266, 1027, 2969, 1024, 1024, 2131, 9289, 3709, 10288, 29048, 26266, 1006, 1007, 1025, 2724, 1024, 1024, 4952, 1006, 1005, 2067, 10497...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/UserCountry/API.php
API.getLocationFromIP
public function getLocationFromIP($ip, $provider = false) { Piwik::checkUserHasSomeViewAccess(); if (empty($provider)) { $provider = LocationProvider::getCurrentProviderId(); } $oProvider = LocationProvider::getProviderById($provider); if (empty($oProvider)) { throw new Exception("Cannot find the '$provider' provider. It is either an invalid provider " . "ID or the ID of a provider that is not working."); } $location = $oProvider->getLocation(array('ip' => $ip)); if (empty($location)) { throw new Exception("Could not geolocate '$ip'!"); } $location['ip'] = $ip; return $location; }
php
public function getLocationFromIP($ip, $provider = false) { Piwik::checkUserHasSomeViewAccess(); if (empty($provider)) { $provider = LocationProvider::getCurrentProviderId(); } $oProvider = LocationProvider::getProviderById($provider); if (empty($oProvider)) { throw new Exception("Cannot find the '$provider' provider. It is either an invalid provider " . "ID or the ID of a provider that is not working."); } $location = $oProvider->getLocation(array('ip' => $ip)); if (empty($location)) { throw new Exception("Could not geolocate '$ip'!"); } $location['ip'] = $ip; return $location; }
[ "public", "function", "getLocationFromIP", "(", "$", "ip", ",", "$", "provider", "=", "false", ")", "{", "Piwik", "::", "checkUserHasSomeViewAccess", "(", ")", ";", "if", "(", "empty", "(", "$", "provider", ")", ")", "{", "$", "provider", "=", "LocationP...
Uses a location provider to find/guess the location of an IP address. See LocationProvider::getLocation to see the details of the result of this function. @param string $ip The IP address. @param bool|string $provider The ID of the provider to use or false to use the currently configured one. @throws Exception @return array|false
[ "Uses", "a", "location", "provider", "to", "find", "/", "guess", "the", "location", "of", "an", "IP", "address", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/UserCountry/API.php#L361-L381
train
Get a location from the specified IP
[ 30522, 2270, 3853, 2131, 4135, 10719, 19699, 20936, 2361, 1006, 1002, 12997, 1010, 1002, 10802, 1027, 6270, 1007, 1063, 14255, 9148, 2243, 1024, 1024, 4638, 20330, 14949, 14045, 8584, 6305, 9623, 2015, 1006, 1007, 1025, 2065, 1006, 4064, 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...
octobercms/october
modules/backend/widgets/Lists.php
Lists.getRowClass
public function getRowClass($record) { $value = ''; /** * @event backend.list.injectRowClass * Provides opportunity to inject a custom CSS row class * * If a value is returned from this event, it will be used as the value for the row class. * `$value` is passed by reference so modifying the variable in place is also supported. Example usage: * * Event::listen('backend.list.injectRowClass', function($listWidget, $record, &$value) { * $value .= '-modified'; * }); * * Or * * $listWidget->bindEvent('list.injectRowClass', function ($record, $value) { * return 'strike'; * }); * */ if ($response = $this->fireSystemEvent('backend.list.injectRowClass', [$record, &$value])) { $value = $response; } return $value; }
php
public function getRowClass($record) { $value = ''; /** * @event backend.list.injectRowClass * Provides opportunity to inject a custom CSS row class * * If a value is returned from this event, it will be used as the value for the row class. * `$value` is passed by reference so modifying the variable in place is also supported. Example usage: * * Event::listen('backend.list.injectRowClass', function($listWidget, $record, &$value) { * $value .= '-modified'; * }); * * Or * * $listWidget->bindEvent('list.injectRowClass', function ($record, $value) { * return 'strike'; * }); * */ if ($response = $this->fireSystemEvent('backend.list.injectRowClass', [$record, &$value])) { $value = $response; } return $value; }
[ "public", "function", "getRowClass", "(", "$", "record", ")", "{", "$", "value", "=", "''", ";", "/**\n * @event backend.list.injectRowClass\n * Provides opportunity to inject a custom CSS row class\n *\n * If a value is returned from this event, it will be ...
Adds a custom CSS class string to a record row @param Model $record Populated model @return string
[ "Adds", "a", "custom", "CSS", "class", "string", "to", "a", "record", "row" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/Lists.php#L1089-L1116
train
Get the row class for the record
[ 30522, 2270, 3853, 2131, 10524, 26266, 1006, 1002, 2501, 1007, 1063, 1002, 3643, 1027, 1005, 1005, 1025, 1013, 1008, 1008, 1008, 1030, 2724, 2067, 10497, 1012, 2862, 1012, 1999, 20614, 10524, 26266, 1008, 3640, 4495, 2000, 1999, 20614, 1037...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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.prepareAssets
protected function prepareAssets(array $assets) { if (!is_array($assets)) { $assets = [$assets]; } /* * Split assets in to groups. */ $combineJs = []; $combineCss = []; foreach ($assets as $asset) { /* * Allow aliases to go through without an extension */ if (substr($asset, 0, 1) == '@') { $combineJs[] = $asset; $combineCss[] = $asset; continue; } $extension = File::extension($asset); if (in_array($extension, self::$jsExtensions)) { $combineJs[] = $asset; continue; } if (in_array($extension, self::$cssExtensions)) { $combineCss[] = $asset; continue; } } /* * Determine which group of assets to combine. */ if (count($combineCss) > count($combineJs)) { $extension = 'css'; $assets = $combineCss; } else { $extension = 'js'; $assets = $combineJs; } /* * Apply registered aliases */ if ($aliasMap = $this->getAliases($extension)) { foreach ($assets as $key => $asset) { if (substr($asset, 0, 1) !== '@') { continue; } $_asset = substr($asset, 1); if (isset($aliasMap[$_asset])) { $assets[$key] = $aliasMap[$_asset]; } } } return [$assets, $extension]; }
php
protected function prepareAssets(array $assets) { if (!is_array($assets)) { $assets = [$assets]; } /* * Split assets in to groups. */ $combineJs = []; $combineCss = []; foreach ($assets as $asset) { /* * Allow aliases to go through without an extension */ if (substr($asset, 0, 1) == '@') { $combineJs[] = $asset; $combineCss[] = $asset; continue; } $extension = File::extension($asset); if (in_array($extension, self::$jsExtensions)) { $combineJs[] = $asset; continue; } if (in_array($extension, self::$cssExtensions)) { $combineCss[] = $asset; continue; } } /* * Determine which group of assets to combine. */ if (count($combineCss) > count($combineJs)) { $extension = 'css'; $assets = $combineCss; } else { $extension = 'js'; $assets = $combineJs; } /* * Apply registered aliases */ if ($aliasMap = $this->getAliases($extension)) { foreach ($assets as $key => $asset) { if (substr($asset, 0, 1) !== '@') { continue; } $_asset = substr($asset, 1); if (isset($aliasMap[$_asset])) { $assets[$key] = $aliasMap[$_asset]; } } } return [$assets, $extension]; }
[ "protected", "function", "prepareAssets", "(", "array", "$", "assets", ")", "{", "if", "(", "!", "is_array", "(", "$", "assets", ")", ")", "{", "$", "assets", "=", "[", "$", "assets", "]", ";", "}", "/*\n * Split assets in to groups.\n */", "...
Prepares an array of assets by normalizing the collection and processing aliases. @param array $assets @return array
[ "Prepares", "an", "array", "of", "assets", "by", "normalizing", "the", "collection", "and", "processing", "aliases", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/CombineAssets.php#L285-L349
train
Prepares assets array
[ 30522, 5123, 3853, 7374, 27241, 3215, 1006, 9140, 1002, 7045, 1007, 1063, 2065, 1006, 999, 2003, 1035, 9140, 1006, 1002, 7045, 1007, 1007, 1063, 1002, 7045, 1027, 1031, 1002, 7045, 1033, 1025, 1065, 1013, 1008, 1008, 3975, 7045, 1999, 200...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Cache.php
Cache.setKey
public function setKey($key) { $this->key = $key; $this->driver->setNamespace($this->key); }
php
public function setKey($key) { $this->key = $key; $this->driver->setNamespace($this->key); }
[ "public", "function", "setKey", "(", "$", "key", ")", "{", "$", "this", "->", "key", "=", "$", "key", ";", "$", "this", "->", "driver", "->", "setNamespace", "(", "$", "this", "->", "key", ")", ";", "}" ]
Setter method to set key (Advanced)
[ "Setter", "method", "to", "set", "key", "(", "Advanced", ")" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Cache.php#L405-L409
train
Set the key for the current namespace
[ 30522, 2270, 3853, 2275, 14839, 1006, 1002, 3145, 1007, 1063, 1002, 2023, 1011, 1028, 3145, 1027, 1002, 3145, 1025, 1002, 2023, 1011, 1028, 4062, 1011, 1028, 2275, 18442, 23058, 1006, 1002, 2023, 1011, 1028, 3145, 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...
laravel/framework
src/Illuminate/Log/LogManager.php
LogManager.prepareHandler
protected function prepareHandler(HandlerInterface $handler, array $config = []) { if (! isset($config['formatter'])) { $handler->setFormatter($this->formatter()); } elseif ($config['formatter'] !== 'default') { $handler->setFormatter($this->app->make($config['formatter'], $config['formatter_with'] ?? [])); } return $handler; }
php
protected function prepareHandler(HandlerInterface $handler, array $config = []) { if (! isset($config['formatter'])) { $handler->setFormatter($this->formatter()); } elseif ($config['formatter'] !== 'default') { $handler->setFormatter($this->app->make($config['formatter'], $config['formatter_with'] ?? [])); } return $handler; }
[ "protected", "function", "prepareHandler", "(", "HandlerInterface", "$", "handler", ",", "array", "$", "config", "=", "[", "]", ")", "{", "if", "(", "!", "isset", "(", "$", "config", "[", "'formatter'", "]", ")", ")", "{", "$", "handler", "->", "setFor...
Prepare the handler for usage by Monolog. @param \Monolog\Handler\HandlerInterface $handler @param array $config @return \Monolog\Handler\HandlerInterface
[ "Prepare", "the", "handler", "for", "usage", "by", "Monolog", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Log/LogManager.php#L366-L375
train
Prepare handler for use in the app
[ 30522, 5123, 3853, 7374, 11774, 3917, 1006, 28213, 18447, 2121, 12172, 1002, 28213, 1010, 9140, 1002, 9530, 8873, 2290, 1027, 1031, 1033, 1007, 1063, 2065, 1006, 999, 26354, 3388, 1006, 1002, 9530, 8873, 2290, 1031, 1005, 4289, 3334, 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/Http/Concerns/InteractsWithInput.php
InteractsWithInput.hasAny
public function hasAny($keys) { $keys = is_array($keys) ? $keys : func_get_args(); $input = $this->all(); foreach ($keys as $key) { if (Arr::has($input, $key)) { return true; } } return false; }
php
public function hasAny($keys) { $keys = is_array($keys) ? $keys : func_get_args(); $input = $this->all(); foreach ($keys as $key) { if (Arr::has($input, $key)) { return true; } } return false; }
[ "public", "function", "hasAny", "(", "$", "keys", ")", "{", "$", "keys", "=", "is_array", "(", "$", "keys", ")", "?", "$", "keys", ":", "func_get_args", "(", ")", ";", "$", "input", "=", "$", "this", "->", "all", "(", ")", ";", "foreach", "(", ...
Determine if the request contains any of the given inputs. @param string|array $keys @return bool
[ "Determine", "if", "the", "request", "contains", "any", "of", "the", "given", "inputs", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Http/Concerns/InteractsWithInput.php#L100-L113
train
Has Any key in the array
[ 30522, 2270, 3853, 17000, 2100, 1006, 1002, 6309, 1007, 1063, 1002, 6309, 1027, 2003, 1035, 9140, 1006, 1002, 6309, 1007, 1029, 1002, 6309, 1024, 4569, 2278, 1035, 2131, 1035, 12098, 5620, 1006, 1007, 1025, 1002, 7953, 1027, 1002, 2023, 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/Foundation/Auth/Access/AuthorizesRequests.php
AuthorizesRequests.authorizeForUser
public function authorizeForUser($user, $ability, $arguments = []) { [$ability, $arguments] = $this->parseAbilityAndArguments($ability, $arguments); return app(Gate::class)->forUser($user)->authorize($ability, $arguments); }
php
public function authorizeForUser($user, $ability, $arguments = []) { [$ability, $arguments] = $this->parseAbilityAndArguments($ability, $arguments); return app(Gate::class)->forUser($user)->authorize($ability, $arguments); }
[ "public", "function", "authorizeForUser", "(", "$", "user", ",", "$", "ability", ",", "$", "arguments", "=", "[", "]", ")", "{", "[", "$", "ability", ",", "$", "arguments", "]", "=", "$", "this", "->", "parseAbilityAndArguments", "(", "$", "ability", "...
Authorize a given action for a user. @param \Illuminate\Contracts\Auth\Authenticatable|mixed $user @param mixed $ability @param mixed|array $arguments @return \Illuminate\Auth\Access\Response @throws \Illuminate\Auth\Access\AuthorizationException
[ "Authorize", "a", "given", "action", "for", "a", "user", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Foundation/Auth/Access/AuthorizesRequests.php#L36-L41
train
Authorize a user to the given ability
[ 30522, 2270, 3853, 3166, 4697, 29278, 20330, 1006, 1002, 5310, 1010, 1002, 3754, 1010, 1002, 9918, 1027, 1031, 1033, 1007, 1063, 1031, 1002, 3754, 1010, 1002, 9918, 1033, 1027, 1002, 2023, 1011, 1028, 11968, 17310, 8553, 13832, 10623, 27417...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Adapter/AbstractAdapter.php
AbstractAdapter.createSystemCache
public static function createSystemCache($namespace, $defaultLifetime, $version, $directory, LoggerInterface $logger = null) { $opcache = new PhpFilesAdapter($namespace, $defaultLifetime, $directory, true); if (null !== $logger) { $opcache->setLogger($logger); } if (!self::$apcuSupported = self::$apcuSupported ?? ApcuAdapter::isSupported()) { return $opcache; } $apcu = new ApcuAdapter($namespace, (int) $defaultLifetime / 5, $version); if ('cli' === \PHP_SAPI && !filter_var(ini_get('apc.enable_cli'), FILTER_VALIDATE_BOOLEAN)) { $apcu->setLogger(new NullLogger()); } elseif (null !== $logger) { $apcu->setLogger($logger); } return new ChainAdapter([$apcu, $opcache]); }
php
public static function createSystemCache($namespace, $defaultLifetime, $version, $directory, LoggerInterface $logger = null) { $opcache = new PhpFilesAdapter($namespace, $defaultLifetime, $directory, true); if (null !== $logger) { $opcache->setLogger($logger); } if (!self::$apcuSupported = self::$apcuSupported ?? ApcuAdapter::isSupported()) { return $opcache; } $apcu = new ApcuAdapter($namespace, (int) $defaultLifetime / 5, $version); if ('cli' === \PHP_SAPI && !filter_var(ini_get('apc.enable_cli'), FILTER_VALIDATE_BOOLEAN)) { $apcu->setLogger(new NullLogger()); } elseif (null !== $logger) { $apcu->setLogger($logger); } return new ChainAdapter([$apcu, $opcache]); }
[ "public", "static", "function", "createSystemCache", "(", "$", "namespace", ",", "$", "defaultLifetime", ",", "$", "version", ",", "$", "directory", ",", "LoggerInterface", "$", "logger", "=", "null", ")", "{", "$", "opcache", "=", "new", "PhpFilesAdapter", ...
Returns the best possible adapter that your runtime supports. Using ApcuAdapter makes system caches compatible with read-only filesystems. @param string $namespace @param int $defaultLifetime @param string $version @param string $directory @param LoggerInterface|null $logger @return AdapterInterface
[ "Returns", "the", "best", "possible", "adapter", "that", "your", "runtime", "supports", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Cache/Adapter/AbstractAdapter.php#L105-L124
train
Create the system cache
[ 30522, 2270, 10763, 3853, 9005, 27268, 6633, 3540, 5403, 1006, 1002, 3415, 15327, 1010, 1002, 12398, 15509, 7292, 1010, 1002, 2544, 1010, 1002, 14176, 1010, 8833, 4590, 18447, 2121, 12172, 1002, 8833, 4590, 1027, 19701, 1007, 1063, 1002, 67...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/View/Compilers/BladeCompiler.php
BladeCompiler.parseToken
protected function parseToken($token) { [$id, $content] = $token; if ($id == T_INLINE_HTML) { foreach ($this->compilers as $type) { $content = $this->{"compile{$type}"}($content); } } return $content; }
php
protected function parseToken($token) { [$id, $content] = $token; if ($id == T_INLINE_HTML) { foreach ($this->compilers as $type) { $content = $this->{"compile{$type}"}($content); } } return $content; }
[ "protected", "function", "parseToken", "(", "$", "token", ")", "{", "[", "$", "id", ",", "$", "content", "]", "=", "$", "token", ";", "if", "(", "$", "id", "==", "T_INLINE_HTML", ")", "{", "foreach", "(", "$", "this", "->", "compilers", "as", "$", ...
Parse the tokens from the template. @param array $token @return string
[ "Parse", "the", "tokens", "from", "the", "template", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/View/Compilers/BladeCompiler.php#L307-L318
train
Parse the token and return the content
[ 30522, 5123, 3853, 11968, 13462, 11045, 2078, 1006, 1002, 19204, 1007, 1063, 1031, 1002, 8909, 1010, 1002, 4180, 1033, 1027, 1002, 19204, 1025, 2065, 1006, 1002, 8909, 1027, 1027, 1056, 1035, 23881, 1035, 16129, 1007, 1063, 18921, 6776, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/CoreConsole/Commands/CoreArchiver.php
CoreArchiver.makeArchiver
public static function makeArchiver($url, InputInterface $input) { $archiver = new CronArchive(); $archiver->disableScheduledTasks = $input->getOption('disable-scheduled-tasks'); $archiver->acceptInvalidSSLCertificate = $input->getOption("accept-invalid-ssl-certificate"); $archiver->shouldArchiveAllSites = (bool) $input->getOption("force-all-websites"); $archiver->shouldStartProfiler = (bool) $input->getOption("xhprof"); $archiver->shouldArchiveSpecifiedSites = self::getSitesListOption($input, "force-idsites"); $archiver->shouldSkipSpecifiedSites = self::getSitesListOption($input, "skip-idsites"); $archiver->forceTimeoutPeriod = $input->getOption("force-timeout-for-periods"); $archiver->shouldArchiveAllPeriodsSince = $input->getOption("force-all-periods"); $archiver->restrictToDateRange = $input->getOption("force-date-range"); $archiver->phpCliConfigurationOptions = $input->getOption("php-cli-options"); $restrictToPeriods = $input->getOption("force-periods"); $restrictToPeriods = explode(',', $restrictToPeriods); $archiver->restrictToPeriods = array_map('trim', $restrictToPeriods); $archiver->dateLastForced = $input->getOption('force-date-last-n'); $archiver->concurrentRequestsPerWebsite = $input->getOption('concurrent-requests-per-website'); $archiver->maxConcurrentArchivers = $input->getOption('concurrent-archivers'); $archiver->disableSegmentsArchiving = $input->getOption('skip-all-segments'); $segmentIds = $input->getOption('force-idsegments'); $segmentIds = explode(',', $segmentIds); $segmentIds = array_map('trim', $segmentIds); $archiver->setSegmentsToForceFromSegmentIds($segmentIds); $archiver->setUrlToPiwik($url); return $archiver; }
php
public static function makeArchiver($url, InputInterface $input) { $archiver = new CronArchive(); $archiver->disableScheduledTasks = $input->getOption('disable-scheduled-tasks'); $archiver->acceptInvalidSSLCertificate = $input->getOption("accept-invalid-ssl-certificate"); $archiver->shouldArchiveAllSites = (bool) $input->getOption("force-all-websites"); $archiver->shouldStartProfiler = (bool) $input->getOption("xhprof"); $archiver->shouldArchiveSpecifiedSites = self::getSitesListOption($input, "force-idsites"); $archiver->shouldSkipSpecifiedSites = self::getSitesListOption($input, "skip-idsites"); $archiver->forceTimeoutPeriod = $input->getOption("force-timeout-for-periods"); $archiver->shouldArchiveAllPeriodsSince = $input->getOption("force-all-periods"); $archiver->restrictToDateRange = $input->getOption("force-date-range"); $archiver->phpCliConfigurationOptions = $input->getOption("php-cli-options"); $restrictToPeriods = $input->getOption("force-periods"); $restrictToPeriods = explode(',', $restrictToPeriods); $archiver->restrictToPeriods = array_map('trim', $restrictToPeriods); $archiver->dateLastForced = $input->getOption('force-date-last-n'); $archiver->concurrentRequestsPerWebsite = $input->getOption('concurrent-requests-per-website'); $archiver->maxConcurrentArchivers = $input->getOption('concurrent-archivers'); $archiver->disableSegmentsArchiving = $input->getOption('skip-all-segments'); $segmentIds = $input->getOption('force-idsegments'); $segmentIds = explode(',', $segmentIds); $segmentIds = array_map('trim', $segmentIds); $archiver->setSegmentsToForceFromSegmentIds($segmentIds); $archiver->setUrlToPiwik($url); return $archiver; }
[ "public", "static", "function", "makeArchiver", "(", "$", "url", ",", "InputInterface", "$", "input", ")", "{", "$", "archiver", "=", "new", "CronArchive", "(", ")", ";", "$", "archiver", "->", "disableScheduledTasks", "=", "$", "input", "->", "getOption", ...
also used by another console command
[ "also", "used", "by", "another", "console", "command" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/CoreConsole/Commands/CoreArchiver.php#L31-L64
train
Creates an archiver for the given URL and Input
[ 30522, 2270, 10763, 3853, 2191, 2906, 5428, 6299, 1006, 1002, 24471, 2140, 1010, 7953, 18447, 2121, 12172, 1002, 7953, 1007, 1063, 1002, 8756, 2099, 1027, 2047, 13675, 7856, 11140, 3512, 1006, 1007, 1025, 1002, 8756, 2099, 1011, 1028, 4487,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Db/Adapter/Mysqli.php
Zend_Db_Adapter_Mysqli.limit
public function limit($sql, $count, $offset = 0) { $count = intval($count); if ($count <= 0) { /** * @see Zend_Db_Adapter_Mysqli_Exception */ // require_once 'Zend/Db/Adapter/Mysqli/Exception.php'; throw new Zend_Db_Adapter_Mysqli_Exception("LIMIT argument count=$count is not valid"); } $offset = intval($offset); if ($offset < 0) { /** * @see Zend_Db_Adapter_Mysqli_Exception */ // require_once 'Zend/Db/Adapter/Mysqli/Exception.php'; throw new Zend_Db_Adapter_Mysqli_Exception("LIMIT argument offset=$offset is not valid"); } $sql .= " LIMIT $count"; if ($offset > 0) { $sql .= " OFFSET $offset"; } return $sql; }
php
public function limit($sql, $count, $offset = 0) { $count = intval($count); if ($count <= 0) { /** * @see Zend_Db_Adapter_Mysqli_Exception */ // require_once 'Zend/Db/Adapter/Mysqli/Exception.php'; throw new Zend_Db_Adapter_Mysqli_Exception("LIMIT argument count=$count is not valid"); } $offset = intval($offset); if ($offset < 0) { /** * @see Zend_Db_Adapter_Mysqli_Exception */ // require_once 'Zend/Db/Adapter/Mysqli/Exception.php'; throw new Zend_Db_Adapter_Mysqli_Exception("LIMIT argument offset=$offset is not valid"); } $sql .= " LIMIT $count"; if ($offset > 0) { $sql .= " OFFSET $offset"; } return $sql; }
[ "public", "function", "limit", "(", "$", "sql", ",", "$", "count", ",", "$", "offset", "=", "0", ")", "{", "$", "count", "=", "intval", "(", "$", "count", ")", ";", "if", "(", "$", "count", "<=", "0", ")", "{", "/**\n * @see Zend_Db_Adapt...
Adds an adapter-specific LIMIT clause to the SELECT statement. @param string $sql @param int $count @param int $offset OPTIONAL @return string
[ "Adds", "an", "adapter", "-", "specific", "LIMIT", "clause", "to", "the", "SELECT", "statement", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Adapter/Mysqli.php#L526-L552
train
Limit statement to specific count and offset
[ 30522, 2270, 3853, 5787, 1006, 1002, 29296, 1010, 1002, 4175, 1010, 1002, 16396, 1027, 1014, 1007, 1063, 1002, 4175, 1027, 20014, 10175, 1006, 1002, 4175, 1007, 1025, 2065, 1006, 1002, 4175, 1026, 1027, 1014, 1007, 1063, 1013, 1008, 1008, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/GPM/Response.php
Response.getCurl
private static function getCurl() { $args = func_get_args(); $args = count($args) > 1 ? $args : array_shift($args); $uri = $args[0]; $options = $args[1] ?? []; $callback = $args[2] ?? null; $ch = curl_init($uri); $response = static::curlExecFollow($ch, $options, $callback); $errno = curl_errno($ch); if ($errno) { $code = curl_getinfo($ch, CURLINFO_HTTP_CODE); $error_message = curl_strerror($errno) . "\n" . curl_error($ch); switch ($code) { case '404': throw new \RuntimeException('Page not found'); case '401': throw new \RuntimeException('Invalid LICENSE'); default: throw new \RuntimeException("Error while trying to download (code: $code): $uri \nMessage: $error_message"); } } curl_close($ch); return $response; }
php
private static function getCurl() { $args = func_get_args(); $args = count($args) > 1 ? $args : array_shift($args); $uri = $args[0]; $options = $args[1] ?? []; $callback = $args[2] ?? null; $ch = curl_init($uri); $response = static::curlExecFollow($ch, $options, $callback); $errno = curl_errno($ch); if ($errno) { $code = curl_getinfo($ch, CURLINFO_HTTP_CODE); $error_message = curl_strerror($errno) . "\n" . curl_error($ch); switch ($code) { case '404': throw new \RuntimeException('Page not found'); case '401': throw new \RuntimeException('Invalid LICENSE'); default: throw new \RuntimeException("Error while trying to download (code: $code): $uri \nMessage: $error_message"); } } curl_close($ch); return $response; }
[ "private", "static", "function", "getCurl", "(", ")", "{", "$", "args", "=", "func_get_args", "(", ")", ";", "$", "args", "=", "count", "(", "$", "args", ")", ">", "1", "?", "$", "args", ":", "array_shift", "(", "$", "args", ")", ";", "$", "uri",...
Starts a HTTP request via cURL @return string The response of the request
[ "Starts", "a", "HTTP", "request", "via", "cURL" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/GPM/Response.php#L328-L359
train
Get the curl resource
[ 30522, 2797, 10763, 3853, 2131, 10841, 12190, 1006, 1007, 1063, 1002, 12098, 5620, 1027, 4569, 2278, 1035, 2131, 1035, 12098, 5620, 1006, 1007, 1025, 1002, 12098, 5620, 1027, 4175, 1006, 1002, 12098, 5620, 1007, 1028, 1015, 1029, 1002, 1209...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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
Worker.php
Worker.setProcessTitle
protected static function setProcessTitle($title) { set_error_handler(function(){}); // >=php 5.5 if (function_exists('cli_set_process_title')) { cli_set_process_title($title); } // Need proctitle when php<=5.5 . elseif (extension_loaded('proctitle') && function_exists('setproctitle')) { setproctitle($title); } restore_error_handler(); }
php
protected static function setProcessTitle($title) { set_error_handler(function(){}); // >=php 5.5 if (function_exists('cli_set_process_title')) { cli_set_process_title($title); } // Need proctitle when php<=5.5 . elseif (extension_loaded('proctitle') && function_exists('setproctitle')) { setproctitle($title); } restore_error_handler(); }
[ "protected", "static", "function", "setProcessTitle", "(", "$", "title", ")", "{", "set_error_handler", "(", "function", "(", ")", "{", "}", ")", ";", "// >=php 5.5", "if", "(", "function_exists", "(", "'cli_set_process_title'", ")", ")", "{", "cli_set_process_t...
Set process name. @param string $title @return void
[ "Set", "process", "name", "." ]
13649907f05014fcfffcfccaef01e63ad3339351
https://github.com/walkor/Workerman/blob/13649907f05014fcfffcfccaef01e63ad3339351/Worker.php#L1550-L1561
train
Set process title
[ 30522, 5123, 10763, 3853, 2275, 21572, 9623, 16643, 9286, 1006, 1002, 2516, 1007, 1063, 2275, 1035, 7561, 1035, 28213, 1006, 3853, 1006, 1007, 1063, 1065, 1007, 1025, 1013, 1013, 1028, 1027, 25718, 1019, 1012, 1019, 2065, 1006, 3853, 1035, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Intl/Data/Generator/CurrencyDataGenerator.php
CurrencyDataGenerator.generateDataForRoot
protected function generateDataForRoot(BundleReaderInterface $reader, $tempDir) { $rootBundle = $reader->read($tempDir, 'root'); return [ 'Version' => $rootBundle['Version'], 'Names' => $this->generateSymbolNamePairs($rootBundle), ]; }
php
protected function generateDataForRoot(BundleReaderInterface $reader, $tempDir) { $rootBundle = $reader->read($tempDir, 'root'); return [ 'Version' => $rootBundle['Version'], 'Names' => $this->generateSymbolNamePairs($rootBundle), ]; }
[ "protected", "function", "generateDataForRoot", "(", "BundleReaderInterface", "$", "reader", ",", "$", "tempDir", ")", "{", "$", "rootBundle", "=", "$", "reader", "->", "read", "(", "$", "tempDir", ",", "'root'", ")", ";", "return", "[", "'Version'", "=>", ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Intl/Data/Generator/CurrencyDataGenerator.php#L115-L123
train
Generate data for root bundle
[ 30522, 5123, 3853, 7013, 6790, 29278, 3217, 4140, 1006, 14012, 16416, 4063, 18447, 2121, 12172, 1002, 8068, 1010, 1002, 8915, 8737, 4305, 2099, 1007, 1063, 1002, 7117, 27265, 2571, 1027, 1002, 8068, 1011, 1028, 3191, 1006, 1002, 8915, 8737,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Broadcasting/Broadcasters/Broadcaster.php
Broadcaster.resolveExplicitBindingIfPossible
protected function resolveExplicitBindingIfPossible($key, $value) { $binder = $this->binder(); if ($binder && $binder->getBindingCallback($key)) { return call_user_func($binder->getBindingCallback($key), $value); } return $value; }
php
protected function resolveExplicitBindingIfPossible($key, $value) { $binder = $this->binder(); if ($binder && $binder->getBindingCallback($key)) { return call_user_func($binder->getBindingCallback($key), $value); } return $value; }
[ "protected", "function", "resolveExplicitBindingIfPossible", "(", "$", "key", ",", "$", "value", ")", "{", "$", "binder", "=", "$", "this", "->", "binder", "(", ")", ";", "if", "(", "$", "binder", "&&", "$", "binder", "->", "getBindingCallback", "(", "$"...
Resolve an explicit parameter binding if applicable. @param string $key @param mixed $value @return mixed
[ "Resolve", "an", "explicit", "parameter", "binding", "if", "applicable", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Broadcasting/Broadcasters/Broadcaster.php#L179-L188
train
Resolve an explicit binding if possible
[ 30522, 5123, 3853, 10663, 10288, 24759, 28775, 2102, 8428, 4667, 10128, 6873, 18719, 3468, 1006, 1002, 3145, 1010, 1002, 3643, 1007, 1063, 1002, 14187, 2121, 1027, 1002, 2023, 1011, 1028, 14187, 2121, 1006, 1007, 1025, 2065, 1006, 1002, 141...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/controllers/Files.php
Files.getThumbUrl
public static function getThumbUrl($file, $width, $height, $options) { return Backend::url('backend/files/thumb/' . self::getUniqueCode($file)) . '/' . $width . '/' . $height . '/' . $options['mode'] . '/' . $options['extension']; }
php
public static function getThumbUrl($file, $width, $height, $options) { return Backend::url('backend/files/thumb/' . self::getUniqueCode($file)) . '/' . $width . '/' . $height . '/' . $options['mode'] . '/' . $options['extension']; }
[ "public", "static", "function", "getThumbUrl", "(", "$", "file", ",", "$", "width", ",", "$", "height", ",", "$", "options", ")", "{", "return", "Backend", "::", "url", "(", "'backend/files/thumb/'", ".", "self", "::", "getUniqueCode", "(", "$", "file", ...
Returns the URL for downloading a system file. @param $file System\Models\File @param $width int @param $height int @param $options array @return string
[ "Returns", "the", "URL", "for", "downloading", "a", "system", "file", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/controllers/Files.php#L72-L75
train
Get thumb url
[ 30522, 2270, 10763, 3853, 2131, 2705, 25438, 3126, 2140, 1006, 1002, 5371, 1010, 1002, 9381, 1010, 1002, 4578, 1010, 1002, 7047, 1007, 1063, 2709, 2067, 10497, 30524, 2067, 10497, 1013, 6764, 1013, 7639, 1013, 1005, 1012, 2969, 1024, 1024, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/HttpFoundation/Request.php
Request.prepareRequestUri
protected function prepareRequestUri() { $requestUri = ''; if ('1' == $this->server->get('IIS_WasUrlRewritten') && '' != $this->server->get('UNENCODED_URL')) { // IIS7 with URL Rewrite: make sure we get the unencoded URL (double slash problem) $requestUri = $this->server->get('UNENCODED_URL'); $this->server->remove('UNENCODED_URL'); $this->server->remove('IIS_WasUrlRewritten'); } elseif ($this->server->has('REQUEST_URI')) { $requestUri = $this->server->get('REQUEST_URI'); if ('' !== $requestUri && '/' === $requestUri[0]) { // To only use path and query remove the fragment. if (false !== $pos = strpos($requestUri, '#')) { $requestUri = substr($requestUri, 0, $pos); } } else { // HTTP proxy reqs setup request URI with scheme and host [and port] + the URL path, // only use URL path. $uriComponents = parse_url($requestUri); if (isset($uriComponents['path'])) { $requestUri = $uriComponents['path']; } if (isset($uriComponents['query'])) { $requestUri .= '?'.$uriComponents['query']; } } } elseif ($this->server->has('ORIG_PATH_INFO')) { // IIS 5.0, PHP as CGI $requestUri = $this->server->get('ORIG_PATH_INFO'); if ('' != $this->server->get('QUERY_STRING')) { $requestUri .= '?'.$this->server->get('QUERY_STRING'); } $this->server->remove('ORIG_PATH_INFO'); } // normalize the request URI to ease creating sub-requests from this request $this->server->set('REQUEST_URI', $requestUri); return $requestUri; }
php
protected function prepareRequestUri() { $requestUri = ''; if ('1' == $this->server->get('IIS_WasUrlRewritten') && '' != $this->server->get('UNENCODED_URL')) { // IIS7 with URL Rewrite: make sure we get the unencoded URL (double slash problem) $requestUri = $this->server->get('UNENCODED_URL'); $this->server->remove('UNENCODED_URL'); $this->server->remove('IIS_WasUrlRewritten'); } elseif ($this->server->has('REQUEST_URI')) { $requestUri = $this->server->get('REQUEST_URI'); if ('' !== $requestUri && '/' === $requestUri[0]) { // To only use path and query remove the fragment. if (false !== $pos = strpos($requestUri, '#')) { $requestUri = substr($requestUri, 0, $pos); } } else { // HTTP proxy reqs setup request URI with scheme and host [and port] + the URL path, // only use URL path. $uriComponents = parse_url($requestUri); if (isset($uriComponents['path'])) { $requestUri = $uriComponents['path']; } if (isset($uriComponents['query'])) { $requestUri .= '?'.$uriComponents['query']; } } } elseif ($this->server->has('ORIG_PATH_INFO')) { // IIS 5.0, PHP as CGI $requestUri = $this->server->get('ORIG_PATH_INFO'); if ('' != $this->server->get('QUERY_STRING')) { $requestUri .= '?'.$this->server->get('QUERY_STRING'); } $this->server->remove('ORIG_PATH_INFO'); } // normalize the request URI to ease creating sub-requests from this request $this->server->set('REQUEST_URI', $requestUri); return $requestUri; }
[ "protected", "function", "prepareRequestUri", "(", ")", "{", "$", "requestUri", "=", "''", ";", "if", "(", "'1'", "==", "$", "this", "->", "server", "->", "get", "(", "'IIS_WasUrlRewritten'", ")", "&&", "''", "!=", "$", "this", "->", "server", "->", "g...
/* The following methods are derived from code of the Zend Framework (1.10dev - 2010-01-24) Code subject to the new BSD license (http://framework.zend.com/license/new-bsd). Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
[ "/", "*", "The", "following", "methods", "are", "derived", "from", "code", "of", "the", "Zend", "Framework", "(", "1", ".", "10dev", "-", "2010", "-", "01", "-", "24", ")" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpFoundation/Request.php#L1705-L1748
train
Prepare request URI
[ 30522, 5123, 3853, 7374, 2890, 15500, 9496, 1006, 1007, 1063, 1002, 5227, 9496, 1027, 1005, 1005, 1025, 2065, 1006, 1005, 1015, 1005, 1027, 1027, 1002, 2023, 1011, 1028, 8241, 1011, 1028, 2131, 1006, 1005, 2462, 2015, 1035, 2001, 3126, 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...
laravel/framework
src/Illuminate/Database/Query/Grammars/SqlServerGrammar.php
SqlServerGrammar.compileSelect
public function compileSelect(Builder $query) { if (! $query->offset) { return parent::compileSelect($query); } // If an offset is present on the query, we will need to wrap the query in // a big "ANSI" offset syntax block. This is very nasty compared to the // other database systems but is necessary for implementing features. if (is_null($query->columns)) { $query->columns = ['*']; } return $this->compileAnsiOffset( $query, $this->compileComponents($query) ); }
php
public function compileSelect(Builder $query) { if (! $query->offset) { return parent::compileSelect($query); } // If an offset is present on the query, we will need to wrap the query in // a big "ANSI" offset syntax block. This is very nasty compared to the // other database systems but is necessary for implementing features. if (is_null($query->columns)) { $query->columns = ['*']; } return $this->compileAnsiOffset( $query, $this->compileComponents($query) ); }
[ "public", "function", "compileSelect", "(", "Builder", "$", "query", ")", "{", "if", "(", "!", "$", "query", "->", "offset", ")", "{", "return", "parent", "::", "compileSelect", "(", "$", "query", ")", ";", "}", "// If an offset is present on the query, we wil...
Compile a select query into SQL. @param \Illuminate\Database\Query\Builder $query @return string
[ "Compile", "a", "select", "query", "into", "SQL", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Query/Grammars/SqlServerGrammar.php#L27-L43
train
Compiles a select statement into a string
[ 30522, 2270, 3853, 4012, 22090, 11246, 22471, 1006, 12508, 1002, 23032, 1007, 1063, 2065, 1006, 999, 1002, 23032, 1011, 1028, 16396, 1007, 1063, 2709, 6687, 1024, 1024, 4012, 22090, 11246, 22471, 1006, 1002, 23032, 1007, 1025, 1065, 1013, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/backend/behaviors/ReorderController.php
ReorderController.getRecords
protected function getRecords() { $records = null; $model = $this->controller->reorderGetModel(); $query = $model->newQuery(); $this->controller->reorderExtendQuery($query); if ($this->sortMode == 'simple') { $records = $query ->orderBy($model->getSortOrderColumn()) ->get() ; } elseif ($this->sortMode == 'nested') { $records = $query->getNested(); } return $records; }
php
protected function getRecords() { $records = null; $model = $this->controller->reorderGetModel(); $query = $model->newQuery(); $this->controller->reorderExtendQuery($query); if ($this->sortMode == 'simple') { $records = $query ->orderBy($model->getSortOrderColumn()) ->get() ; } elseif ($this->sortMode == 'nested') { $records = $query->getNested(); } return $records; }
[ "protected", "function", "getRecords", "(", ")", "{", "$", "records", "=", "null", ";", "$", "model", "=", "$", "this", "->", "controller", "->", "reorderGetModel", "(", ")", ";", "$", "query", "=", "$", "model", "->", "newQuery", "(", ")", ";", "$",...
Returns all the records from the supplied model. @return Collection
[ "Returns", "all", "the", "records", "from", "the", "supplied", "model", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/behaviors/ReorderController.php#L230-L249
train
Get records from the model
[ 30522, 5123, 3853, 2131, 2890, 27108, 5104, 1006, 1007, 1063, 1002, 2636, 1027, 19701, 1025, 1002, 2944, 1027, 1002, 2023, 1011, 1028, 11486, 1011, 1028, 2128, 8551, 2121, 18150, 5302, 9247, 1006, 1007, 1025, 1002, 23032, 1027, 1002, 2944, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Goals/Model.php
Model.deleteGoalConversions
public function deleteGoalConversions($idSite, $idGoal) { $table = Common::prefixTable("log_conversion"); Db::deleteAllRows($table, "WHERE idgoal = ? AND idsite = ?", "idvisit", 100000, array($idGoal, $idSite)); }
php
public function deleteGoalConversions($idSite, $idGoal) { $table = Common::prefixTable("log_conversion"); Db::deleteAllRows($table, "WHERE idgoal = ? AND idsite = ?", "idvisit", 100000, array($idGoal, $idSite)); }
[ "public", "function", "deleteGoalConversions", "(", "$", "idSite", ",", "$", "idGoal", ")", "{", "$", "table", "=", "Common", "::", "prefixTable", "(", "\"log_conversion\"", ")", ";", "Db", "::", "deleteAllRows", "(", "$", "table", ",", "\"WHERE idgoal = ? AND...
actually this should be in a log_conversion model
[ "actually", "this", "should", "be", "in", "a", "log_conversion", "model" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Goals/Model.php#L60-L65
train
Deletes all conversions for a site and goal
[ 30522, 2270, 3853, 3972, 12870, 3995, 2389, 8663, 27774, 2015, 1006, 1002, 8909, 28032, 2063, 1010, 1002, 8909, 3995, 2389, 1007, 1063, 1002, 2795, 1027, 2691, 1024, 1024, 17576, 10880, 1006, 1000, 8833, 1035, 7584, 1000, 1007, 1025, 16962,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/DependencyInjection/Compiler/DefinitionErrorExceptionPass.php
DefinitionErrorExceptionPass.processValue
protected function processValue($value, $isRoot = false) { if (!$value instanceof Definition || !$value->hasErrors()) { return parent::processValue($value, $isRoot); } if ($isRoot && !$value->isPublic()) { $graph = $this->container->getCompiler()->getServiceReferenceGraph(); $runtimeException = false; foreach ($graph->getNode($this->currentId)->getInEdges() as $edge) { if (!$edge->getValue() instanceof Reference || ContainerInterface::RUNTIME_EXCEPTION_ON_INVALID_REFERENCE !== $edge->getValue()->getInvalidBehavior()) { $runtimeException = false; break; } $runtimeException = true; } if ($runtimeException) { return parent::processValue($value, $isRoot); } } // only show the first error so the user can focus on it $errors = $value->getErrors(); $message = reset($errors); throw new RuntimeException($message); }
php
protected function processValue($value, $isRoot = false) { if (!$value instanceof Definition || !$value->hasErrors()) { return parent::processValue($value, $isRoot); } if ($isRoot && !$value->isPublic()) { $graph = $this->container->getCompiler()->getServiceReferenceGraph(); $runtimeException = false; foreach ($graph->getNode($this->currentId)->getInEdges() as $edge) { if (!$edge->getValue() instanceof Reference || ContainerInterface::RUNTIME_EXCEPTION_ON_INVALID_REFERENCE !== $edge->getValue()->getInvalidBehavior()) { $runtimeException = false; break; } $runtimeException = true; } if ($runtimeException) { return parent::processValue($value, $isRoot); } } // only show the first error so the user can focus on it $errors = $value->getErrors(); $message = reset($errors); throw new RuntimeException($message); }
[ "protected", "function", "processValue", "(", "$", "value", ",", "$", "isRoot", "=", "false", ")", "{", "if", "(", "!", "$", "value", "instanceof", "Definition", "||", "!", "$", "value", "->", "hasErrors", "(", ")", ")", "{", "return", "parent", "::", ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DependencyInjection/Compiler/DefinitionErrorExceptionPass.php#L29-L55
train
Process value of type Definition
[ 30522, 5123, 3853, 2832, 10175, 5657, 1006, 1002, 3643, 1010, 1002, 2003, 3217, 4140, 1027, 6270, 1007, 1063, 2065, 1006, 999, 1002, 3643, 6013, 11253, 6210, 1064, 1064, 999, 1002, 3643, 1011, 1028, 2038, 2121, 29165, 2015, 1006, 1007, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/UserCountry/LocationProvider/GeoIp/Pecl.php
Pecl.isWorking
public function isWorking() { // if no no location database is available, this implementation is not setup correctly if (!self::isLocationDatabaseAvailable()) { $dbDir = dirname(geoip_db_filename(GEOIP_COUNTRY_EDITION)) . '/'; $quotedDir = "'$dbDir'"; // check if the directory the PECL module is looking for exists if (!is_dir($dbDir)) { return Piwik::translate('UserCountry_PeclGeoIPNoDBDir', array($quotedDir, "'geoip.custom_directory'")); } // check if the user named the city database GeoLiteCity.dat if (file_exists($dbDir . 'GeoLiteCity.dat')) { return Piwik::translate('UserCountry_PeclGeoLiteError', array($quotedDir, "'GeoLiteCity.dat'", "'GeoIPCity.dat'")); } return Piwik::translate('UserCountry_CannotFindPeclGeoIPDb', array($quotedDir, "'GeoIP.dat'", "'GeoIPCity.dat'")); } return parent::isWorking(); }
php
public function isWorking() { // if no no location database is available, this implementation is not setup correctly if (!self::isLocationDatabaseAvailable()) { $dbDir = dirname(geoip_db_filename(GEOIP_COUNTRY_EDITION)) . '/'; $quotedDir = "'$dbDir'"; // check if the directory the PECL module is looking for exists if (!is_dir($dbDir)) { return Piwik::translate('UserCountry_PeclGeoIPNoDBDir', array($quotedDir, "'geoip.custom_directory'")); } // check if the user named the city database GeoLiteCity.dat if (file_exists($dbDir . 'GeoLiteCity.dat')) { return Piwik::translate('UserCountry_PeclGeoLiteError', array($quotedDir, "'GeoLiteCity.dat'", "'GeoIPCity.dat'")); } return Piwik::translate('UserCountry_CannotFindPeclGeoIPDb', array($quotedDir, "'GeoIP.dat'", "'GeoIPCity.dat'")); } return parent::isWorking(); }
[ "public", "function", "isWorking", "(", ")", "{", "// if no no location database is available, this implementation is not setup correctly", "if", "(", "!", "self", "::", "isLocationDatabaseAvailable", "(", ")", ")", "{", "$", "dbDir", "=", "dirname", "(", "geoip_db_filena...
Returns true if the PECL module that is installed can be successfully used to get the location of an IP address. @return bool
[ "Returns", "true", "if", "the", "PECL", "module", "that", "is", "installed", "can", "be", "successfully", "used", "to", "get", "the", "location", "of", "an", "IP", "address", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/UserCountry/LocationProvider/GeoIp/Pecl.php#L122-L145
train
Returns true if the location database is available and false if not
[ 30522, 2270, 3853, 2003, 21398, 1006, 1007, 1063, 1013, 1013, 2065, 2053, 2053, 3295, 7809, 2003, 2800, 1010, 2023, 7375, 2003, 2025, 16437, 11178, 2065, 1006, 999, 2969, 1024, 1024, 2003, 4135, 10719, 2850, 2696, 15058, 12462, 11733, 3468,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Scheduler/Job.php
Job.run
public function run() { // If the truthTest failed, don't run if ($this->truthTest !== true) { return false; } // If overlapping, don't run if ($this->isOverlapping()) { return false; } // Write lock file if necessary $this->createLockFile(); // Call before if required if (is_callable($this->before)) { call_user_func($this->before); } // If command is callable... if (is_callable($this->command)) { $this->output = $this->exec(); } else { $args = \is_string($this->args) ? $this->args : implode(' ', $this->args); $command = $this->command . ' ' . $args; $process = new Process($command); $this->process = $process; if ($this->runInBackground()) { $process->start(); } else { $process->run(); $this->finalize(); } } return true; }
php
public function run() { // If the truthTest failed, don't run if ($this->truthTest !== true) { return false; } // If overlapping, don't run if ($this->isOverlapping()) { return false; } // Write lock file if necessary $this->createLockFile(); // Call before if required if (is_callable($this->before)) { call_user_func($this->before); } // If command is callable... if (is_callable($this->command)) { $this->output = $this->exec(); } else { $args = \is_string($this->args) ? $this->args : implode(' ', $this->args); $command = $this->command . ' ' . $args; $process = new Process($command); $this->process = $process; if ($this->runInBackground()) { $process->start(); } else { $process->run(); $this->finalize(); } } return true; }
[ "public", "function", "run", "(", ")", "{", "// If the truthTest failed, don't run", "if", "(", "$", "this", "->", "truthTest", "!==", "true", ")", "{", "return", "false", ";", "}", "// If overlapping, don't run", "if", "(", "$", "this", "->", "isOverlapping", ...
Run the job. @return bool
[ "Run", "the", "job", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Scheduler/Job.php#L277-L316
train
Runs the command
[ 30522, 2270, 3853, 2448, 1006, 1007, 1063, 1013, 1013, 2065, 1996, 3606, 22199, 3478, 1010, 2123, 1005, 1056, 2448, 2065, 1006, 1002, 2023, 1011, 1028, 3606, 22199, 999, 1027, 1027, 2995, 1007, 1063, 2709, 6270, 1025, 1065, 1013, 1013, 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
libs/Zend/Db/Statement.php
Zend_Db_Statement._fetchBound
public function _fetchBound($row) { foreach ($row as $key => $value) { // bindColumn() takes 1-based integer positions // but fetch() returns 0-based integer indexes if (is_int($key)) { $key++; } // set results only to variables that were bound previously if (isset($this->_bindColumn[$key])) { $this->_bindColumn[$key] = $value; } } return true; }
php
public function _fetchBound($row) { foreach ($row as $key => $value) { // bindColumn() takes 1-based integer positions // but fetch() returns 0-based integer indexes if (is_int($key)) { $key++; } // set results only to variables that were bound previously if (isset($this->_bindColumn[$key])) { $this->_bindColumn[$key] = $value; } } return true; }
[ "public", "function", "_fetchBound", "(", "$", "row", ")", "{", "foreach", "(", "$", "row", "as", "$", "key", "=>", "$", "value", ")", "{", "// bindColumn() takes 1-based integer positions", "// but fetch() returns 0-based integer indexes", "if", "(", "is_int", "(",...
Helper function to map retrieved row to bound column variables @param array $row @return bool True
[ "Helper", "function", "to", "map", "retrieved", "row", "to", "bound", "column", "variables" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Statement.php#L449-L463
train
Fetch the bound values from the query
[ 30522, 2270, 3853, 1035, 18584, 15494, 1006, 1002, 5216, 1007, 1063, 18921, 6776, 1006, 1002, 5216, 2004, 1002, 3145, 1027, 1028, 1002, 3643, 1007, 1063, 1013, 1013, 14187, 25778, 2819, 2078, 1006, 1007, 3138, 1015, 1011, 2241, 16109, 4460,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/OfficialAccount/Material/Client.php
Client.list
public function list(string $type, int $offset = 0, int $count = 20) { $params = [ 'type' => $type, 'offset' => $offset, 'count' => $count, ]; return $this->httpPostJson('cgi-bin/material/batchget_material', $params); }
php
public function list(string $type, int $offset = 0, int $count = 20) { $params = [ 'type' => $type, 'offset' => $offset, 'count' => $count, ]; return $this->httpPostJson('cgi-bin/material/batchget_material', $params); }
[ "public", "function", "list", "(", "string", "$", "type", ",", "int", "$", "offset", "=", "0", ",", "int", "$", "count", "=", "20", ")", "{", "$", "params", "=", "[", "'type'", "=>", "$", "type", ",", "'offset'", "=>", "$", "offset", ",", "'count...
List materials. example: { "total_count": TOTAL_COUNT, "item_count": ITEM_COUNT, "item": [{ "media_id": MEDIA_ID, "name": NAME, "update_time": UPDATE_TIME }, // more... ] } @param string $type @param int $offset @param int $count @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
[ "List", "materials", "." ]
120c72faaa93c270365bc75c73c362d5fd583209
https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/OfficialAccount/Material/Client.php#L225-L234
train
List Materials
[ 30522, 2270, 3853, 2862, 1006, 5164, 1002, 2828, 1010, 20014, 1002, 16396, 1027, 1014, 1010, 20014, 1002, 4175, 1027, 2322, 1007, 1063, 1002, 11498, 5244, 1027, 1031, 1005, 2828, 1005, 1027, 1028, 1002, 2828, 1010, 1005, 16396, 1005, 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...
dompdf/dompdf
src/FontMetrics.php
FontMetrics.getFont
public function getFont($familyRaw, $subtypeRaw = "normal") { static $cache = array(); if (isset($cache[$familyRaw][$subtypeRaw])) { return $cache[$familyRaw][$subtypeRaw]; } /* Allow calling for various fonts in search path. Therefore not immediately * return replacement on non match. * Only when called with NULL try replacement. * When this is also missing there is really trouble. * If only the subtype fails, nevertheless return failure. * Only on checking the fallback font, check various subtypes on same font. */ $subtype = strtolower($subtypeRaw); if ($familyRaw) { $family = str_replace(array("'", '"'), "", strtolower($familyRaw)); if (isset($this->fontLookup[$family][$subtype])) { return $cache[$familyRaw][$subtypeRaw] = $this->fontLookup[$family][$subtype]; } return null; } $family = "serif"; if (isset($this->fontLookup[$family][$subtype])) { return $cache[$familyRaw][$subtypeRaw] = $this->fontLookup[$family][$subtype]; } if (!isset($this->fontLookup[$family])) { return null; } $family = $this->fontLookup[$family]; foreach ($family as $sub => $font) { if (strpos($subtype, $sub) !== false) { return $cache[$familyRaw][$subtypeRaw] = $font; } } if ($subtype !== "normal") { foreach ($family as $sub => $font) { if ($sub !== "normal") { return $cache[$familyRaw][$subtypeRaw] = $font; } } } $subtype = "normal"; if (isset($family[$subtype])) { return $cache[$familyRaw][$subtypeRaw] = $family[$subtype]; } return null; }
php
public function getFont($familyRaw, $subtypeRaw = "normal") { static $cache = array(); if (isset($cache[$familyRaw][$subtypeRaw])) { return $cache[$familyRaw][$subtypeRaw]; } /* Allow calling for various fonts in search path. Therefore not immediately * return replacement on non match. * Only when called with NULL try replacement. * When this is also missing there is really trouble. * If only the subtype fails, nevertheless return failure. * Only on checking the fallback font, check various subtypes on same font. */ $subtype = strtolower($subtypeRaw); if ($familyRaw) { $family = str_replace(array("'", '"'), "", strtolower($familyRaw)); if (isset($this->fontLookup[$family][$subtype])) { return $cache[$familyRaw][$subtypeRaw] = $this->fontLookup[$family][$subtype]; } return null; } $family = "serif"; if (isset($this->fontLookup[$family][$subtype])) { return $cache[$familyRaw][$subtypeRaw] = $this->fontLookup[$family][$subtype]; } if (!isset($this->fontLookup[$family])) { return null; } $family = $this->fontLookup[$family]; foreach ($family as $sub => $font) { if (strpos($subtype, $sub) !== false) { return $cache[$familyRaw][$subtypeRaw] = $font; } } if ($subtype !== "normal") { foreach ($family as $sub => $font) { if ($sub !== "normal") { return $cache[$familyRaw][$subtypeRaw] = $font; } } } $subtype = "normal"; if (isset($family[$subtype])) { return $cache[$familyRaw][$subtypeRaw] = $family[$subtype]; } return null; }
[ "public", "function", "getFont", "(", "$", "familyRaw", ",", "$", "subtypeRaw", "=", "\"normal\"", ")", "{", "static", "$", "cache", "=", "array", "(", ")", ";", "if", "(", "isset", "(", "$", "cache", "[", "$", "familyRaw", "]", "[", "$", "subtypeRaw...
Resolves a font family & subtype into an actual font file Subtype can be one of 'normal', 'bold', 'italic' or 'bold_italic'. If the particular font family has no suitable font file, the default font ({@link Options::defaultFont}) is used. The font file returned is the absolute pathname to the font file on the system. @param string $familyRaw @param string $subtypeRaw @return string
[ "Resolves", "a", "font", "family", "&", "subtype", "into", "an", "actual", "font", "file", "Subtype", "can", "be", "one", "of", "normal", "bold", "italic", "or", "bold_italic", ".", "If", "the", "particular", "font", "family", "has", "no", "suitable", "fon...
75f13c700009be21a1965dc2c5b68a8708c22ba2
https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/src/FontMetrics.php#L336-L397
train
Returns font object
[ 30522, 2270, 3853, 2131, 14876, 3372, 1006, 1002, 2155, 2527, 2860, 1010, 1002, 4942, 13874, 2527, 2860, 1027, 1000, 3671, 1000, 1007, 1063, 10763, 1002, 17053, 1027, 9140, 1006, 1007, 1025, 2065, 1006, 26354, 3388, 1006, 1002, 17053, 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...
PHPMailer/PHPMailer
src/PHPMailer.php
PHPMailer.encodeString
public function encodeString($str, $encoding = self::ENCODING_BASE64) { $encoded = ''; switch (strtolower($encoding)) { case static::ENCODING_BASE64: $encoded = chunk_split( base64_encode($str), static::STD_LINE_LENGTH, static::$LE ); break; case static::ENCODING_7BIT: case static::ENCODING_8BIT: $encoded = static::normalizeBreaks($str); // Make sure it ends with a line break if (substr($encoded, -(strlen(static::$LE))) != static::$LE) { $encoded .= static::$LE; } break; case static::ENCODING_BINARY: $encoded = $str; break; case static::ENCODING_QUOTED_PRINTABLE: $encoded = $this->encodeQP($str); break; default: $this->setError($this->lang('encoding') . $encoding); break; } return $encoded; }
php
public function encodeString($str, $encoding = self::ENCODING_BASE64) { $encoded = ''; switch (strtolower($encoding)) { case static::ENCODING_BASE64: $encoded = chunk_split( base64_encode($str), static::STD_LINE_LENGTH, static::$LE ); break; case static::ENCODING_7BIT: case static::ENCODING_8BIT: $encoded = static::normalizeBreaks($str); // Make sure it ends with a line break if (substr($encoded, -(strlen(static::$LE))) != static::$LE) { $encoded .= static::$LE; } break; case static::ENCODING_BINARY: $encoded = $str; break; case static::ENCODING_QUOTED_PRINTABLE: $encoded = $this->encodeQP($str); break; default: $this->setError($this->lang('encoding') . $encoding); break; } return $encoded; }
[ "public", "function", "encodeString", "(", "$", "str", ",", "$", "encoding", "=", "self", "::", "ENCODING_BASE64", ")", "{", "$", "encoded", "=", "''", ";", "switch", "(", "strtolower", "(", "$", "encoding", ")", ")", "{", "case", "static", "::", "ENCO...
Encode a string in requested format. Returns an empty string on failure. @param string $str The text to encode @param string $encoding The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable' @return string
[ "Encode", "a", "string", "in", "requested", "format", ".", "Returns", "an", "empty", "string", "on", "failure", "." ]
3d7132341659a8a201adbc3ba11b1e202ee2857c
https://github.com/PHPMailer/PHPMailer/blob/3d7132341659a8a201adbc3ba11b1e202ee2857c/src/PHPMailer.php#L3048-L3079
train
Encode a string
[ 30522, 2270, 3853, 4372, 23237, 18886, 3070, 1006, 1002, 2358, 2099, 1010, 1002, 17181, 1027, 2969, 1024, 1024, 17181, 1035, 2918, 21084, 1007, 1063, 1002, 12359, 1027, 1005, 1005, 1025, 6942, 1006, 2358, 5339, 12898, 13777, 1006, 1002, 171...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Cache/RedisTaggedCache.php
RedisTaggedCache.decrement
public function decrement($key, $value = 1) { $this->pushStandardKeys($this->tags->getNamespace(), $key); parent::decrement($key, $value); }
php
public function decrement($key, $value = 1) { $this->pushStandardKeys($this->tags->getNamespace(), $key); parent::decrement($key, $value); }
[ "public", "function", "decrement", "(", "$", "key", ",", "$", "value", "=", "1", ")", "{", "$", "this", "->", "pushStandardKeys", "(", "$", "this", "->", "tags", "->", "getNamespace", "(", ")", ",", "$", "key", ")", ";", "parent", "::", "decrement", ...
Decrement the value of an item in the cache. @param string $key @param mixed $value @return void
[ "Decrement", "the", "value", "of", "an", "item", "in", "the", "cache", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Cache/RedisTaggedCache.php#L60-L65
train
Decrement the value of a tag
[ 30522, 2270, 3853, 11703, 28578, 4765, 1006, 1002, 3145, 1010, 1002, 3643, 1027, 1015, 1007, 1063, 1002, 2023, 1011, 1028, 5245, 21515, 4232, 14839, 2015, 1006, 1002, 2023, 1011, 1028, 22073, 1011, 1028, 2131, 18442, 23058, 1006, 1007, 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...
symfony/symfony
src/Symfony/Component/HttpFoundation/BinaryFileResponse.php
BinaryFileResponse.setAutoEtag
public function setAutoEtag() { $this->setEtag(base64_encode(hash_file('sha256', $this->file->getPathname(), true))); return $this; }
php
public function setAutoEtag() { $this->setEtag(base64_encode(hash_file('sha256', $this->file->getPathname(), true))); return $this; }
[ "public", "function", "setAutoEtag", "(", ")", "{", "$", "this", "->", "setEtag", "(", "base64_encode", "(", "hash_file", "(", "'sha256'", ",", "$", "this", "->", "file", "->", "getPathname", "(", ")", ",", "true", ")", ")", ")", ";", "return", "$", ...
Automatically sets the ETag header according to the checksum of the file.
[ "Automatically", "sets", "the", "ETag", "header", "according", "to", "the", "checksum", "of", "the", "file", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpFoundation/BinaryFileResponse.php#L140-L145
train
Set auto - etag
[ 30522, 2270, 3853, 2275, 4887, 3406, 12928, 2290, 1006, 1007, 1063, 1002, 2023, 1011, 1028, 2275, 12928, 2290, 1006, 2918, 21084, 1035, 4372, 16044, 1006, 23325, 1035, 5371, 1006, 1005, 21146, 17788, 2575, 1005, 1010, 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...
walkor/Workerman
Events/Select.php
Select.tick
protected function tick() { while (!$this->_scheduler->isEmpty()) { $scheduler_data = $this->_scheduler->top(); $timer_id = $scheduler_data['data']; $next_run_time = -$scheduler_data['priority']; $time_now = microtime(true); $this->_selectTimeout = ($next_run_time - $time_now) * 1000000; if ($this->_selectTimeout <= 0) { $this->_scheduler->extract(); if (!isset($this->_eventTimer[$timer_id])) { continue; } // [func, args, flag, timer_interval] $task_data = $this->_eventTimer[$timer_id]; if ($task_data[2] === self::EV_TIMER) { $next_run_time = $time_now + $task_data[3]; $this->_scheduler->insert($timer_id, -$next_run_time); } call_user_func_array($task_data[0], $task_data[1]); if (isset($this->_eventTimer[$timer_id]) && $task_data[2] === self::EV_TIMER_ONCE) { $this->del($timer_id, self::EV_TIMER_ONCE); } continue; } return; } $this->_selectTimeout = 100000000; }
php
protected function tick() { while (!$this->_scheduler->isEmpty()) { $scheduler_data = $this->_scheduler->top(); $timer_id = $scheduler_data['data']; $next_run_time = -$scheduler_data['priority']; $time_now = microtime(true); $this->_selectTimeout = ($next_run_time - $time_now) * 1000000; if ($this->_selectTimeout <= 0) { $this->_scheduler->extract(); if (!isset($this->_eventTimer[$timer_id])) { continue; } // [func, args, flag, timer_interval] $task_data = $this->_eventTimer[$timer_id]; if ($task_data[2] === self::EV_TIMER) { $next_run_time = $time_now + $task_data[3]; $this->_scheduler->insert($timer_id, -$next_run_time); } call_user_func_array($task_data[0], $task_data[1]); if (isset($this->_eventTimer[$timer_id]) && $task_data[2] === self::EV_TIMER_ONCE) { $this->del($timer_id, self::EV_TIMER_ONCE); } continue; } return; } $this->_selectTimeout = 100000000; }
[ "protected", "function", "tick", "(", ")", "{", "while", "(", "!", "$", "this", "->", "_scheduler", "->", "isEmpty", "(", ")", ")", "{", "$", "scheduler_data", "=", "$", "this", "->", "_scheduler", "->", "top", "(", ")", ";", "$", "timer_id", "=", ...
Tick for timer. @return void
[ "Tick", "for", "timer", "." ]
13649907f05014fcfffcfccaef01e63ad3339351
https://github.com/walkor/Workerman/blob/13649907f05014fcfffcfccaef01e63ad3339351/Events/Select.php#L218-L248
train
tick the scheduler
[ 30522, 5123, 3853, 16356, 1006, 1007, 1063, 2096, 1006, 999, 1002, 2023, 1011, 1028, 1035, 6134, 2099, 1011, 1028, 2003, 6633, 13876, 2100, 1006, 1007, 1007, 1063, 1002, 6134, 2099, 1035, 2951, 1027, 1002, 2023, 1011, 1028, 1035, 6134, 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/Piwik.php
Piwik.translate
public static function translate($translationId, $args = array(), $language = null) { /** @var Translator $translator */ $translator = StaticContainer::get('Piwik\Translation\Translator'); return $translator->translate($translationId, $args, $language); }
php
public static function translate($translationId, $args = array(), $language = null) { /** @var Translator $translator */ $translator = StaticContainer::get('Piwik\Translation\Translator'); return $translator->translate($translationId, $args, $language); }
[ "public", "static", "function", "translate", "(", "$", "translationId", ",", "$", "args", "=", "array", "(", ")", ",", "$", "language", "=", "null", ")", "{", "/** @var Translator $translator */", "$", "translator", "=", "StaticContainer", "::", "get", "(", ...
Returns an internationalized string using a translation token. If a translation cannot be found for the token, the token is returned. @param string $translationId Translation ID, eg, `'General_Date'`. @param array|string|int $args `sprintf` arguments to be applied to the internationalized string. @param string|null $language Optionally force the language. @return string The translated string or `$translationId`. @api
[ "Returns", "an", "internationalized", "string", "using", "a", "translation", "token", ".", "If", "a", "translation", "cannot", "be", "found", "for", "the", "token", "the", "token", "is", "returned", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Piwik.php#L820-L826
train
Translates a translation string
[ 30522, 2270, 10763, 3853, 17637, 1006, 1002, 5449, 3593, 1010, 1002, 12098, 5620, 1027, 9140, 1006, 1007, 1010, 1002, 2653, 1027, 19701, 1007, 1063, 1013, 1008, 1008, 1030, 13075, 11403, 1002, 11403, 1008, 1013, 1002, 11403, 1027, 10763, 86...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
dompdf/dompdf
src/Css/Style.php
Style.set_background_color
function set_background_color($color) { $col = $this->munge_color($color); if (is_null($col)) { return; //$col = self::$_defaults["background_color"]; } //see __set and __get, on all assignments clear cache, not needed on direct set through __set $this->_prop_cache["background_color"] = null; $this->_props["background_color"] = is_array($col) ? $col["hex"] : $col; }
php
function set_background_color($color) { $col = $this->munge_color($color); if (is_null($col)) { return; //$col = self::$_defaults["background_color"]; } //see __set and __get, on all assignments clear cache, not needed on direct set through __set $this->_prop_cache["background_color"] = null; $this->_props["background_color"] = is_array($col) ? $col["hex"] : $col; }
[ "function", "set_background_color", "(", "$", "color", ")", "{", "$", "col", "=", "$", "this", "->", "munge_color", "(", "$", "color", ")", ";", "if", "(", "is_null", "(", "$", "col", ")", ")", "{", "return", ";", "//$col = self::$_defaults[\"background_co...
Sets the background color @link http://www.w3.org/TR/CSS21/colors.html#propdef-background-color @param string $color
[ "Sets", "the", "background", "color" ]
75f13c700009be21a1965dc2c5b68a8708c22ba2
https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/src/Css/Style.php#L1825-L1837
train
set background color
[ 30522, 3853, 2275, 1035, 4281, 1035, 3609, 1006, 1002, 3609, 1007, 1063, 1002, 8902, 1027, 1002, 2023, 1011, 1028, 14163, 15465, 1035, 3609, 1006, 1002, 3609, 1007, 1025, 2065, 1006, 2003, 1035, 19701, 1006, 1002, 8902, 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...
laravel/framework
src/Illuminate/Validation/DatabasePresenceVerifier.php
DatabasePresenceVerifier.addConditions
protected function addConditions($query, $conditions) { foreach ($conditions as $key => $value) { if ($value instanceof Closure) { $query->where(function ($query) use ($value) { $value($query); }); } else { $this->addWhere($query, $key, $value); } } return $query; }
php
protected function addConditions($query, $conditions) { foreach ($conditions as $key => $value) { if ($value instanceof Closure) { $query->where(function ($query) use ($value) { $value($query); }); } else { $this->addWhere($query, $key, $value); } } return $query; }
[ "protected", "function", "addConditions", "(", "$", "query", ",", "$", "conditions", ")", "{", "foreach", "(", "$", "conditions", "as", "$", "key", "=>", "$", "value", ")", "{", "if", "(", "$", "value", "instanceof", "Closure", ")", "{", "$", "query", ...
Add the given conditions to the query. @param \Illuminate\Database\Query\Builder $query @param array $conditions @return \Illuminate\Database\Query\Builder
[ "Add", "the", "given", "conditions", "to", "the", "query", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Validation/DatabasePresenceVerifier.php#L81-L94
train
Adds conditions to the query
[ 30522, 5123, 3853, 5587, 8663, 20562, 2015, 1006, 1002, 23032, 1010, 1002, 3785, 1007, 1063, 18921, 6776, 1006, 1002, 3785, 2004, 1002, 3145, 1027, 1028, 1002, 3643, 1007, 1063, 2065, 1006, 1002, 3643, 6013, 11253, 8503, 1007, 1063, 1002, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Intl/DateFormatter/IntlDateFormatter.php
IntlDateFormatter.setTimeZone
public function setTimeZone($timeZone) { if ($timeZone instanceof \IntlTimeZone) { $timeZone = $timeZone->getID(); } if ($timeZone instanceof \DateTimeZone) { $timeZone = $timeZone->getName(); // DateTimeZone returns the GMT offset timezones without the leading GMT, while our parsing requires it. if (!empty($timeZone) && ('+' === $timeZone[0] || '-' === $timeZone[0])) { $timeZone = 'GMT'.$timeZone; } } return $this->setTimeZoneId($timeZone); }
php
public function setTimeZone($timeZone) { if ($timeZone instanceof \IntlTimeZone) { $timeZone = $timeZone->getID(); } if ($timeZone instanceof \DateTimeZone) { $timeZone = $timeZone->getName(); // DateTimeZone returns the GMT offset timezones without the leading GMT, while our parsing requires it. if (!empty($timeZone) && ('+' === $timeZone[0] || '-' === $timeZone[0])) { $timeZone = 'GMT'.$timeZone; } } return $this->setTimeZoneId($timeZone); }
[ "public", "function", "setTimeZone", "(", "$", "timeZone", ")", "{", "if", "(", "$", "timeZone", "instanceof", "\\", "IntlTimeZone", ")", "{", "$", "timeZone", "=", "$", "timeZone", "->", "getID", "(", ")", ";", "}", "if", "(", "$", "timeZone", "instan...
This method was added in PHP 5.5 as replacement for `setTimeZoneId()`. @param \IntlTimeZone|\DateTimeZone|string|null $timeZone @return bool true on success or false on failure @see http://www.php.net/manual/en/intldateformatter.settimezone.php
[ "This", "method", "was", "added", "in", "PHP", "5", ".", "5", "as", "replacement", "for", "setTimeZoneId", "()", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Intl/DateFormatter/IntlDateFormatter.php#L561-L577
train
Set TimeZone - ID - NAME - NAME
[ 30522, 2270, 3853, 2275, 7292, 15975, 1006, 1002, 2051, 15975, 1007, 1063, 2065, 1006, 1002, 2051, 15975, 6013, 11253, 1032, 20014, 7096, 14428, 15975, 1007, 1063, 1002, 2051, 15975, 1027, 1002, 2051, 15975, 1011, 1028, 2131, 3593, 1006, 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/Database/Eloquent/Concerns/HasAttributes.php
HasAttributes.getArrayAttributeByKey
protected function getArrayAttributeByKey($key) { return isset($this->attributes[$key]) ? $this->fromJson($this->attributes[$key]) : []; }
php
protected function getArrayAttributeByKey($key) { return isset($this->attributes[$key]) ? $this->fromJson($this->attributes[$key]) : []; }
[ "protected", "function", "getArrayAttributeByKey", "(", "$", "key", ")", "{", "return", "isset", "(", "$", "this", "->", "attributes", "[", "$", "key", "]", ")", "?", "$", "this", "->", "fromJson", "(", "$", "this", "->", "attributes", "[", "$", "key",...
Get an array attribute or return an empty array if it is not set. @param string $key @return array
[ "Get", "an", "array", "attribute", "or", "return", "an", "empty", "array", "if", "it", "is", "not", "set", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php#L665-L669
train
Get array attribute by key
[ 30522, 5123, 3853, 2131, 2906, 29539, 4779, 3089, 8569, 2618, 3762, 14839, 1006, 1002, 3145, 1007, 1063, 2709, 26354, 3388, 1006, 1002, 2023, 1011, 1028, 12332, 1031, 1002, 3145, 1033, 1007, 1029, 1002, 2023, 1011, 1028, 2013, 22578, 2239, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/ChainCache.php
ChainCache.get
public function get($key, $default = null) { $miss = null !== $default && \is_object($default) ? $default : $this->miss; foreach ($this->caches as $i => $cache) { $value = $cache->get($key, $miss); if ($miss !== $value) { while (0 <= --$i) { $this->caches[$i]->set($key, $value, $this->defaultLifetime); } return $value; } } return $default; }
php
public function get($key, $default = null) { $miss = null !== $default && \is_object($default) ? $default : $this->miss; foreach ($this->caches as $i => $cache) { $value = $cache->get($key, $miss); if ($miss !== $value) { while (0 <= --$i) { $this->caches[$i]->set($key, $value, $this->defaultLifetime); } return $value; } } return $default; }
[ "public", "function", "get", "(", "$", "key", ",", "$", "default", "=", "null", ")", "{", "$", "miss", "=", "null", "!==", "$", "default", "&&", "\\", "is_object", "(", "$", "default", ")", "?", "$", "default", ":", "$", "this", "->", "miss", ";"...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Cache/Simple/ChainCache.php#L64-L81
train
Get value from cache
[ 30522, 2270, 3853, 2131, 1006, 1002, 3145, 1010, 1002, 12398, 1027, 19701, 1007, 1063, 1002, 3335, 1027, 19701, 999, 1027, 1027, 1002, 12398, 1004, 1004, 1032, 2003, 1035, 4874, 1006, 1002, 12398, 1007, 1029, 1002, 12398, 1024, 1002, 2023, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Adapter/RedisTagAwareAdapter.php
RedisTagAwareAdapter.doInvalidate
protected function doInvalidate(array $tagIds): bool { if (!$this->redisServerSupportSPOP()) { return false; } // Pop all tag info at once to avoid race conditions $tagIdSets = $this->pipeline(static function () use ($tagIds) { foreach ($tagIds as $tagId) { // Client: Predis or PHP Redis 3.1.3+ (https://github.com/phpredis/phpredis/commit/d2e203a6) // Server: Redis 3.2 or higher (https://redis.io/commands/spop) yield 'sPop' => [$tagId, self::POP_MAX_LIMIT]; } }); // Flatten generator result from pipeline, ignore keys (tag ids) $ids = \array_unique(\array_merge(...\iterator_to_array($tagIdSets, false))); // Delete cache in chunks to avoid overloading the connection foreach (\array_chunk($ids, self::BULK_DELETE_LIMIT) as $chunkIds) { $this->doDelete($chunkIds); } return true; }
php
protected function doInvalidate(array $tagIds): bool { if (!$this->redisServerSupportSPOP()) { return false; } // Pop all tag info at once to avoid race conditions $tagIdSets = $this->pipeline(static function () use ($tagIds) { foreach ($tagIds as $tagId) { // Client: Predis or PHP Redis 3.1.3+ (https://github.com/phpredis/phpredis/commit/d2e203a6) // Server: Redis 3.2 or higher (https://redis.io/commands/spop) yield 'sPop' => [$tagId, self::POP_MAX_LIMIT]; } }); // Flatten generator result from pipeline, ignore keys (tag ids) $ids = \array_unique(\array_merge(...\iterator_to_array($tagIdSets, false))); // Delete cache in chunks to avoid overloading the connection foreach (\array_chunk($ids, self::BULK_DELETE_LIMIT) as $chunkIds) { $this->doDelete($chunkIds); } return true; }
[ "protected", "function", "doInvalidate", "(", "array", "$", "tagIds", ")", ":", "bool", "{", "if", "(", "!", "$", "this", "->", "redisServerSupportSPOP", "(", ")", ")", "{", "return", "false", ";", "}", "// Pop all tag info at once to avoid race conditions", "$"...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Cache/Adapter/RedisTagAwareAdapter.php#L165-L189
train
Invalidate cache by tag ids
[ 30522, 5123, 3853, 24341, 10175, 8524, 2618, 1006, 9140, 1002, 6415, 9821, 1007, 1024, 22017, 2140, 1063, 2065, 1006, 999, 1002, 2023, 1011, 1028, 2417, 23491, 2099, 14028, 6279, 25378, 16340, 1006, 1007, 1007, 1063, 2709, 6270, 1025, 1065,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/Uri.php
Uri.param
public function param($id) { if (isset($this->params[$id])) { return html_entity_decode(rawurldecode($this->params[$id])); } return false; }
php
public function param($id) { if (isset($this->params[$id])) { return html_entity_decode(rawurldecode($this->params[$id])); } return false; }
[ "public", "function", "param", "(", "$", "id", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "params", "[", "$", "id", "]", ")", ")", "{", "return", "html_entity_decode", "(", "rawurldecode", "(", "$", "this", "->", "params", "[", "$", "id"...
Get URI parameter. @param string $id @return bool|string
[ "Get", "URI", "parameter", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Uri.php#L306-L313
train
Get the parameter value
[ 30522, 2270, 3853, 11498, 2213, 1006, 1002, 8909, 1007, 1063, 2065, 1006, 26354, 3388, 1006, 1002, 2023, 1011, 1028, 11498, 5244, 1031, 1002, 8909, 1033, 1007, 1007, 1063, 2709, 16129, 1035, 9178, 1035, 21933, 3207, 1006, 6315, 3126, 17920,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/Routing/Matcher/Dumper/CompiledUrlMatcherDumper.php
CompiledUrlMatcherDumper.groupStaticRoutes
private function groupStaticRoutes(RouteCollection $collection): array { $staticRoutes = $dynamicRegex = []; $dynamicRoutes = new RouteCollection(); foreach ($collection->all() as $name => $route) { $compiledRoute = $route->compile(); $staticPrefix = rtrim($compiledRoute->getStaticPrefix(), '/'); $hostRegex = $compiledRoute->getHostRegex(); $regex = $compiledRoute->getRegex(); if ($hasTrailingSlash = '/' !== $route->getPath()) { $pos = strrpos($regex, '$'); $hasTrailingSlash = '/' === $regex[$pos - 1]; $regex = substr_replace($regex, '/?$', $pos - $hasTrailingSlash, 1 + $hasTrailingSlash); } if (!$compiledRoute->getPathVariables()) { $host = !$compiledRoute->getHostVariables() ? $route->getHost() : ''; $url = $route->getPath(); if ($hasTrailingSlash) { $url = substr($url, 0, -1); } foreach ($dynamicRegex as list($hostRx, $rx, $prefix)) { if (('' === $prefix || 0 === strpos($url, $prefix)) && preg_match($rx, $url) && (!$host || !$hostRx || preg_match($hostRx, $host))) { $dynamicRegex[] = [$hostRegex, $regex, $staticPrefix]; $dynamicRoutes->add($name, $route); continue 2; } } $staticRoutes[$url][$name] = [$route, $hasTrailingSlash]; } else { $dynamicRegex[] = [$hostRegex, $regex, $staticPrefix]; $dynamicRoutes->add($name, $route); } } return [$staticRoutes, $dynamicRoutes]; }
php
private function groupStaticRoutes(RouteCollection $collection): array { $staticRoutes = $dynamicRegex = []; $dynamicRoutes = new RouteCollection(); foreach ($collection->all() as $name => $route) { $compiledRoute = $route->compile(); $staticPrefix = rtrim($compiledRoute->getStaticPrefix(), '/'); $hostRegex = $compiledRoute->getHostRegex(); $regex = $compiledRoute->getRegex(); if ($hasTrailingSlash = '/' !== $route->getPath()) { $pos = strrpos($regex, '$'); $hasTrailingSlash = '/' === $regex[$pos - 1]; $regex = substr_replace($regex, '/?$', $pos - $hasTrailingSlash, 1 + $hasTrailingSlash); } if (!$compiledRoute->getPathVariables()) { $host = !$compiledRoute->getHostVariables() ? $route->getHost() : ''; $url = $route->getPath(); if ($hasTrailingSlash) { $url = substr($url, 0, -1); } foreach ($dynamicRegex as list($hostRx, $rx, $prefix)) { if (('' === $prefix || 0 === strpos($url, $prefix)) && preg_match($rx, $url) && (!$host || !$hostRx || preg_match($hostRx, $host))) { $dynamicRegex[] = [$hostRegex, $regex, $staticPrefix]; $dynamicRoutes->add($name, $route); continue 2; } } $staticRoutes[$url][$name] = [$route, $hasTrailingSlash]; } else { $dynamicRegex[] = [$hostRegex, $regex, $staticPrefix]; $dynamicRoutes->add($name, $route); } } return [$staticRoutes, $dynamicRoutes]; }
[ "private", "function", "groupStaticRoutes", "(", "RouteCollection", "$", "collection", ")", ":", "array", "{", "$", "staticRoutes", "=", "$", "dynamicRegex", "=", "[", "]", ";", "$", "dynamicRoutes", "=", "new", "RouteCollection", "(", ")", ";", "foreach", "...
Splits static routes from dynamic routes, so that they can be matched first, using a simple switch.
[ "Splits", "static", "routes", "from", "dynamic", "routes", "so", "that", "they", "can", "be", "matched", "first", "using", "a", "simple", "switch", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Routing/Matcher/Dumper/CompiledUrlMatcherDumper.php#L167-L205
train
Groups static routes into static routes and dynamic routes
[ 30522, 2797, 3853, 2967, 29336, 2594, 22494, 4570, 1006, 2799, 26895, 18491, 1002, 3074, 1007, 1024, 9140, 1063, 1002, 10763, 22494, 4570, 1027, 1002, 8790, 2890, 3351, 2595, 1027, 1031, 1033, 1025, 1002, 8790, 22494, 4570, 1027, 2047, 2799...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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.php
Form.handleFileSort
protected function handleFileSort(array $input = []) { if (!array_key_exists(Field::FILE_SORT_FLAG, $input)) { return $input; } $sorts = array_filter($input[Field::FILE_SORT_FLAG]); if (empty($sorts)) { return $input; } foreach ($sorts as $column => $order) { $input[$column] = $order; } request()->replace($input); return $input; }
php
protected function handleFileSort(array $input = []) { if (!array_key_exists(Field::FILE_SORT_FLAG, $input)) { return $input; } $sorts = array_filter($input[Field::FILE_SORT_FLAG]); if (empty($sorts)) { return $input; } foreach ($sorts as $column => $order) { $input[$column] = $order; } request()->replace($input); return $input; }
[ "protected", "function", "handleFileSort", "(", "array", "$", "input", "=", "[", "]", ")", "{", "if", "(", "!", "array_key_exists", "(", "Field", "::", "FILE_SORT_FLAG", ",", "$", "input", ")", ")", "{", "return", "$", "input", ";", "}", "$", "sorts", ...
@param array $input @return array
[ "@param", "array", "$input" ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Form.php#L698-L717
train
Handle file sort
[ 30522, 5123, 3853, 5047, 8873, 4244, 11589, 1006, 9140, 1002, 7953, 1027, 1031, 1033, 1007, 1063, 2065, 1006, 999, 9140, 1035, 3145, 1035, 6526, 1006, 2492, 1024, 1024, 5371, 1035, 4066, 1035, 5210, 1010, 1002, 7953, 1007, 1007, 1063, 270...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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/formwidgets/FileUpload.php
FileUpload.getPromptText
protected function getPromptText() { if ($this->prompt === null) { $isMulti = ends_with($this->getDisplayMode(), 'multi'); $this->prompt = $isMulti ? 'backend::lang.fileupload.upload_file' : 'backend::lang.fileupload.default_prompt'; } return str_replace('%s', '<i class="icon-upload"></i>', e(trans($this->prompt))); }
php
protected function getPromptText() { if ($this->prompt === null) { $isMulti = ends_with($this->getDisplayMode(), 'multi'); $this->prompt = $isMulti ? 'backend::lang.fileupload.upload_file' : 'backend::lang.fileupload.default_prompt'; } return str_replace('%s', '<i class="icon-upload"></i>', e(trans($this->prompt))); }
[ "protected", "function", "getPromptText", "(", ")", "{", "if", "(", "$", "this", "->", "prompt", "===", "null", ")", "{", "$", "isMulti", "=", "ends_with", "(", "$", "this", "->", "getDisplayMode", "(", ")", ",", "'multi'", ")", ";", "$", "this", "->...
Returns the escaped and translated prompt text to display according to the type. @return string
[ "Returns", "the", "escaped", "and", "translated", "prompt", "text", "to", "display", "according", "to", "the", "type", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/formwidgets/FileUpload.php#L186-L196
train
Get the text for the prompt
[ 30522, 5123, 3853, 2131, 21572, 27718, 18209, 1006, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 25732, 1027, 1027, 1027, 19701, 1007, 1063, 1002, 2003, 12274, 7096, 2072, 1027, 4515, 1035, 2007, 1006, 1002, 2023, 1011, 1028, 2131, 10521...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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...