repo stringclasses 21 values | path stringlengths 10 105 | func_name stringlengths 6 64 | original_string stringlengths 105 15.6k | language stringclasses 1 value | code stringlengths 105 15.6k | code_tokens listlengths 29 2.15k | docstring stringlengths 11 2.85k | docstring_tokens listlengths 1 290 | sha stringclasses 21 values | url stringlengths 100 194 | partition stringclasses 1 value | summary stringlengths 8 319 | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
laravel/framework | src/Illuminate/Foundation/Console/ServeCommand.php | ServeCommand.serverCommand | protected function serverCommand()
{
return sprintf('%s -S %s:%s %s',
ProcessUtils::escapeArgument((new PhpExecutableFinder)->find(false)),
$this->host(),
$this->port(),
ProcessUtils::escapeArgument(base_path('server.php'))
);
} | php | protected function serverCommand()
{
return sprintf('%s -S %s:%s %s',
ProcessUtils::escapeArgument((new PhpExecutableFinder)->find(false)),
$this->host(),
$this->port(),
ProcessUtils::escapeArgument(base_path('server.php'))
);
} | [
"protected",
"function",
"serverCommand",
"(",
")",
"{",
"return",
"sprintf",
"(",
"'%s -S %s:%s %s'",
",",
"ProcessUtils",
"::",
"escapeArgument",
"(",
"(",
"new",
"PhpExecutableFinder",
")",
"->",
"find",
"(",
"false",
")",
")",
",",
"$",
"this",
"->",
"ho... | Get the full server command.
@return string | [
"Get",
"the",
"full",
"server",
"command",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Foundation/Console/ServeCommand.php#L62-L70 | train | Return the command to run the server | [
30522,
5123,
3853,
8241,
9006,
2386,
2094,
1006,
1007,
1063,
2709,
9043,
2546,
1006,
1005,
1003,
1055,
1011,
1055,
1003,
1055,
1024,
1003,
1055,
1003,
1055,
1005,
1010,
2832,
21823,
4877,
1024,
1024,
4019,
2906,
22850,
4765,
1006,
1006,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/HTML/QuickForm2/Rule/Each.php | HTML_QuickForm2_Rule_Each.setConfig | public function setConfig($config)
{
if (!$config instanceof HTML_QuickForm2_Rule) {
throw new HTML_QuickForm2_InvalidArgumentException(
'Each Rule requires a template Rule to validate with, ' .
preg_replace('/\s+/', ' ', var_export($config, true)) . ' given'
);
} elseif ($config instanceof HTML_QuickForm2_Rule_Required) {
throw new HTML_QuickForm2_InvalidArgumentException(
'Cannot use "required" Rule as a template'
);
}
return parent::setConfig($config);
} | php | public function setConfig($config)
{
if (!$config instanceof HTML_QuickForm2_Rule) {
throw new HTML_QuickForm2_InvalidArgumentException(
'Each Rule requires a template Rule to validate with, ' .
preg_replace('/\s+/', ' ', var_export($config, true)) . ' given'
);
} elseif ($config instanceof HTML_QuickForm2_Rule_Required) {
throw new HTML_QuickForm2_InvalidArgumentException(
'Cannot use "required" Rule as a template'
);
}
return parent::setConfig($config);
} | [
"public",
"function",
"setConfig",
"(",
"$",
"config",
")",
"{",
"if",
"(",
"!",
"$",
"config",
"instanceof",
"HTML_QuickForm2_Rule",
")",
"{",
"throw",
"new",
"HTML_QuickForm2_InvalidArgumentException",
"(",
"'Each Rule requires a template Rule to validate with, '",
".",... | Sets the template Rule to use for actual validation
We do not allow using Required rules here, they are able to validate
containers themselves without the help of Each rule.
@param HTML_QuickForm2_Rule Template Rule
@return HTML_QuickForm2_Rule
@throws HTML_QuickForm2_InvalidArgumentException if $config is either not
an instance of Rule or is an instance of Rule_Required | [
"Sets",
"the",
"template",
"Rule",
"to",
"use",
"for",
"actual",
"validation"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/HTML/QuickForm2/Rule/Each.php#L104-L117 | train | Set the config for the validation process | [
30522,
2270,
3853,
2275,
8663,
8873,
2290,
1006,
1002,
9530,
8873,
2290,
1007,
1063,
2065,
1006,
999,
1002,
9530,
8873,
2290,
6013,
11253,
16129,
1035,
4248,
14192,
2475,
1035,
3627,
1007,
1063,
5466,
2047,
16129,
1035,
4248,
14192,
2475,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Session.php | Session.getFlashCookieObject | public function getFlashCookieObject($name)
{
if (isset($_COOKIE[$name])) {
$object = json_decode($_COOKIE[$name]);
setcookie($name, '', time() - 3600, '/');
return $object;
}
return null;
} | php | public function getFlashCookieObject($name)
{
if (isset($_COOKIE[$name])) {
$object = json_decode($_COOKIE[$name]);
setcookie($name, '', time() - 3600, '/');
return $object;
}
return null;
} | [
"public",
"function",
"getFlashCookieObject",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"_COOKIE",
"[",
"$",
"name",
"]",
")",
")",
"{",
"$",
"object",
"=",
"json_decode",
"(",
"$",
"_COOKIE",
"[",
"$",
"name",
"]",
")",
";",
"setco... | Return object and remove it from the cookie.
@param string $name
@return mixed|null | [
"Return",
"object",
"and",
"remove",
"it",
"from",
"the",
"cookie",
"."
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Session.php#L156-L165 | train | Get Flash Cookie Object | [
30522,
2270,
3853,
2131,
10258,
11823,
3597,
23212,
8780,
2497,
20614,
1006,
1002,
2171,
1007,
1063,
2065,
1006,
26354,
3388,
1006,
1002,
1035,
17387,
1031,
1002,
2171,
1033,
1007,
1007,
1063,
1002,
4874,
1027,
1046,
3385,
1035,
21933,
3207... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
php-ai/php-ml | src/DimensionReduction/LDA.php | LDA.fit | public function fit(array $data, array $classes): array
{
$this->labels = $this->getLabels($classes);
$this->means = $this->calculateMeans($data, $classes);
$sW = $this->calculateClassVar($data, $classes);
$sB = $this->calculateClassCov();
$S = $sW->inverse()->multiply($sB);
$this->eigenDecomposition($S->toArray());
$this->fit = true;
return $this->reduce($data);
} | php | public function fit(array $data, array $classes): array
{
$this->labels = $this->getLabels($classes);
$this->means = $this->calculateMeans($data, $classes);
$sW = $this->calculateClassVar($data, $classes);
$sB = $this->calculateClassCov();
$S = $sW->inverse()->multiply($sB);
$this->eigenDecomposition($S->toArray());
$this->fit = true;
return $this->reduce($data);
} | [
"public",
"function",
"fit",
"(",
"array",
"$",
"data",
",",
"array",
"$",
"classes",
")",
":",
"array",
"{",
"$",
"this",
"->",
"labels",
"=",
"$",
"this",
"->",
"getLabels",
"(",
"$",
"classes",
")",
";",
"$",
"this",
"->",
"means",
"=",
"$",
"... | Trains the algorithm to transform the given data to a lower dimensional space. | [
"Trains",
"the",
"algorithm",
"to",
"transform",
"the",
"given",
"data",
"to",
"a",
"lower",
"dimensional",
"space",
"."
] | f6aa1a59b0525b8fca3d2786d661ab3e70904016 | https://github.com/php-ai/php-ml/blob/f6aa1a59b0525b8fca3d2786d661ab3e70904016/src/DimensionReduction/LDA.php#L78-L92 | train | Fits the algorithm to the given data and returns the result as a tree of nodes | [
30522,
2270,
3853,
4906,
1006,
9140,
1002,
2951,
1010,
9140,
1002,
4280,
1007,
1024,
9140,
1063,
1002,
2023,
1011,
1028,
10873,
1027,
1002,
2023,
1011,
1028,
2131,
20470,
9050,
1006,
1002,
4280,
1007,
1025,
1002,
2023,
1011,
1028,
2965,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/HTML/QuickForm2/Rule/Length.php | HTML_QuickForm2_Rule_Length.validateOwner | protected function validateOwner()
{
if (0 == ($valueLength = strlen($this->owner->getValue()))) {
return true;
}
$allowedLength = $this->getConfig();
if (is_scalar($allowedLength)) {
return $valueLength == $allowedLength;
} else {
return (empty($allowedLength['min']) || $valueLength >= $allowedLength['min']) &&
(empty($allowedLength['max']) || $valueLength <= $allowedLength['max']);
}
} | php | protected function validateOwner()
{
if (0 == ($valueLength = strlen($this->owner->getValue()))) {
return true;
}
$allowedLength = $this->getConfig();
if (is_scalar($allowedLength)) {
return $valueLength == $allowedLength;
} else {
return (empty($allowedLength['min']) || $valueLength >= $allowedLength['min']) &&
(empty($allowedLength['max']) || $valueLength <= $allowedLength['max']);
}
} | [
"protected",
"function",
"validateOwner",
"(",
")",
"{",
"if",
"(",
"0",
"==",
"(",
"$",
"valueLength",
"=",
"strlen",
"(",
"$",
"this",
"->",
"owner",
"->",
"getValue",
"(",
")",
")",
")",
")",
"{",
"return",
"true",
";",
"}",
"$",
"allowedLength",
... | Validates the owner element
@return bool whether length of the element's value is within allowed range | [
"Validates",
"the",
"owner",
"element"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/HTML/QuickForm2/Rule/Length.php#L85-L98 | train | Validate owner value | [
30522,
5123,
3853,
9398,
3686,
12384,
2121,
1006,
1007,
1063,
2065,
1006,
1014,
1027,
1027,
1006,
1002,
3643,
7770,
13512,
2232,
1027,
2358,
20927,
2078,
1006,
1002,
2023,
1011,
1028,
3954,
1011,
1028,
2131,
10175,
5657,
1006,
1007,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Finder/Iterator/MultiplePcreFilterIterator.php | MultiplePcreFilterIterator.isRegex | protected function isRegex($str)
{
if (preg_match('/^(.{3,}?)[imsxuADU]*$/', $str, $m)) {
$start = substr($m[1], 0, 1);
$end = substr($m[1], -1);
if ($start === $end) {
return !preg_match('/[*?[:alnum:] \\\\]/', $start);
}
foreach ([['{', '}'], ['(', ')'], ['[', ']'], ['<', '>']] as $delimiters) {
if ($start === $delimiters[0] && $end === $delimiters[1]) {
return true;
}
}
}
return false;
} | php | protected function isRegex($str)
{
if (preg_match('/^(.{3,}?)[imsxuADU]*$/', $str, $m)) {
$start = substr($m[1], 0, 1);
$end = substr($m[1], -1);
if ($start === $end) {
return !preg_match('/[*?[:alnum:] \\\\]/', $start);
}
foreach ([['{', '}'], ['(', ')'], ['[', ']'], ['<', '>']] as $delimiters) {
if ($start === $delimiters[0] && $end === $delimiters[1]) {
return true;
}
}
}
return false;
} | [
"protected",
"function",
"isRegex",
"(",
"$",
"str",
")",
"{",
"if",
"(",
"preg_match",
"(",
"'/^(.{3,}?)[imsxuADU]*$/'",
",",
"$",
"str",
",",
"$",
"m",
")",
")",
"{",
"$",
"start",
"=",
"substr",
"(",
"$",
"m",
"[",
"1",
"]",
",",
"0",
",",
"1"... | Checks whether the string is a regex.
@param string $str
@return bool Whether the given string is a regex | [
"Checks",
"whether",
"the",
"string",
"is",
"a",
"regex",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Finder/Iterator/MultiplePcreFilterIterator.php#L84-L102 | train | Is regex string | [
30522,
5123,
3853,
2003,
2890,
3351,
2595,
1006,
1002,
2358,
2099,
1007,
1063,
2065,
1006,
3653,
2290,
1035,
2674,
1006,
1005,
1013,
1034,
1006,
1012,
1063,
1017,
1010,
1065,
1029,
1007,
1031,
10047,
2015,
2595,
6692,
8566,
1033,
1008,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
dompdf/dompdf | src/Helpers.php | Helpers.cmyk_to_rgb | public static function cmyk_to_rgb($c, $m = null, $y = null, $k = null)
{
if (is_array($c)) {
list($c, $m, $y, $k) = $c;
}
$c *= 255;
$m *= 255;
$y *= 255;
$k *= 255;
$r = (1 - round(2.55 * ($c + $k)));
$g = (1 - round(2.55 * ($m + $k)));
$b = (1 - round(2.55 * ($y + $k)));
if ($r < 0) {
$r = 0;
}
if ($g < 0) {
$g = 0;
}
if ($b < 0) {
$b = 0;
}
return array(
$r, $g, $b,
"r" => $r, "g" => $g, "b" => $b
);
} | php | public static function cmyk_to_rgb($c, $m = null, $y = null, $k = null)
{
if (is_array($c)) {
list($c, $m, $y, $k) = $c;
}
$c *= 255;
$m *= 255;
$y *= 255;
$k *= 255;
$r = (1 - round(2.55 * ($c + $k)));
$g = (1 - round(2.55 * ($m + $k)));
$b = (1 - round(2.55 * ($y + $k)));
if ($r < 0) {
$r = 0;
}
if ($g < 0) {
$g = 0;
}
if ($b < 0) {
$b = 0;
}
return array(
$r, $g, $b,
"r" => $r, "g" => $g, "b" => $b
);
} | [
"public",
"static",
"function",
"cmyk_to_rgb",
"(",
"$",
"c",
",",
"$",
"m",
"=",
"null",
",",
"$",
"y",
"=",
"null",
",",
"$",
"k",
"=",
"null",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"c",
")",
")",
"{",
"list",
"(",
"$",
"c",
",",
"$"... | Converts a CMYK color to RGB
@param float|float[] $c
@param float $m
@param float $y
@param float $k
@return float[] | [
"Converts",
"a",
"CMYK",
"color",
"to",
"RGB"
] | 75f13c700009be21a1965dc2c5b68a8708c22ba2 | https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/src/Helpers.php#L551-L580 | train | cmyk_to_rgb - Convert color from cmyk to rgb | [
30522,
2270,
10763,
3853,
4642,
15922,
1035,
2000,
1035,
1054,
18259,
1006,
1002,
1039,
1010,
1002,
1049,
1027,
19701,
1010,
1002,
1061,
1027,
19701,
1010,
1002,
1047,
1027,
19701,
1007,
1063,
2065,
1006,
2003,
1035,
9140,
1006,
1002,
1039,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/DataArray.php | DataArray.doSumActionsMetrics | protected function doSumActionsMetrics($newRowToAdd, &$oldRowToUpdate)
{
// Pre 1.2 format: string indexed rows are returned from the DB
// Left here for Backward compatibility with plugins doing custom SQL queries using these metrics as string
if (!isset($newRowToAdd[Metrics::INDEX_NB_VISITS])) {
$oldRowToUpdate[Metrics::INDEX_NB_VISITS] += $newRowToAdd['nb_visits'];
$oldRowToUpdate[Metrics::INDEX_NB_ACTIONS] += $newRowToAdd['nb_actions'];
$oldRowToUpdate[Metrics::INDEX_NB_UNIQ_VISITORS] += $newRowToAdd['nb_uniq_visitors'];
return;
}
// Edge case fail safe
if (!isset($oldRowToUpdate[Metrics::INDEX_NB_VISITS])) {
return;
}
$oldRowToUpdate[Metrics::INDEX_NB_VISITS] += $newRowToAdd[Metrics::INDEX_NB_VISITS];
if (array_key_exists(Metrics::INDEX_NB_ACTIONS, $newRowToAdd)) {
$oldRowToUpdate[Metrics::INDEX_NB_ACTIONS] += $newRowToAdd[Metrics::INDEX_NB_ACTIONS];
}
if (array_key_exists(Metrics::INDEX_PAGE_NB_HITS, $newRowToAdd)) {
if (!array_key_exists(Metrics::INDEX_PAGE_NB_HITS, $oldRowToUpdate)) {
$oldRowToUpdate[Metrics::INDEX_PAGE_NB_HITS] = 0;
}
$oldRowToUpdate[Metrics::INDEX_PAGE_NB_HITS] += $newRowToAdd[Metrics::INDEX_PAGE_NB_HITS];
}
$oldRowToUpdate[Metrics::INDEX_NB_UNIQ_VISITORS] += $newRowToAdd[Metrics::INDEX_NB_UNIQ_VISITORS];
} | php | protected function doSumActionsMetrics($newRowToAdd, &$oldRowToUpdate)
{
// Pre 1.2 format: string indexed rows are returned from the DB
// Left here for Backward compatibility with plugins doing custom SQL queries using these metrics as string
if (!isset($newRowToAdd[Metrics::INDEX_NB_VISITS])) {
$oldRowToUpdate[Metrics::INDEX_NB_VISITS] += $newRowToAdd['nb_visits'];
$oldRowToUpdate[Metrics::INDEX_NB_ACTIONS] += $newRowToAdd['nb_actions'];
$oldRowToUpdate[Metrics::INDEX_NB_UNIQ_VISITORS] += $newRowToAdd['nb_uniq_visitors'];
return;
}
// Edge case fail safe
if (!isset($oldRowToUpdate[Metrics::INDEX_NB_VISITS])) {
return;
}
$oldRowToUpdate[Metrics::INDEX_NB_VISITS] += $newRowToAdd[Metrics::INDEX_NB_VISITS];
if (array_key_exists(Metrics::INDEX_NB_ACTIONS, $newRowToAdd)) {
$oldRowToUpdate[Metrics::INDEX_NB_ACTIONS] += $newRowToAdd[Metrics::INDEX_NB_ACTIONS];
}
if (array_key_exists(Metrics::INDEX_PAGE_NB_HITS, $newRowToAdd)) {
if (!array_key_exists(Metrics::INDEX_PAGE_NB_HITS, $oldRowToUpdate)) {
$oldRowToUpdate[Metrics::INDEX_PAGE_NB_HITS] = 0;
}
$oldRowToUpdate[Metrics::INDEX_PAGE_NB_HITS] += $newRowToAdd[Metrics::INDEX_PAGE_NB_HITS];
}
$oldRowToUpdate[Metrics::INDEX_NB_UNIQ_VISITORS] += $newRowToAdd[Metrics::INDEX_NB_UNIQ_VISITORS];
} | [
"protected",
"function",
"doSumActionsMetrics",
"(",
"$",
"newRowToAdd",
",",
"&",
"$",
"oldRowToUpdate",
")",
"{",
"// Pre 1.2 format: string indexed rows are returned from the DB",
"// Left here for Backward compatibility with plugins doing custom SQL queries using these metrics as strin... | Adds the given row $newRowToAdd to the existing $oldRowToUpdate passed by reference
The rows are php arrays Name => value
@param array $newRowToAdd
@param array $oldRowToUpdate
@param bool $onlyMetricsAvailableInActionsTable
@return void | [
"Adds",
"the",
"given",
"row",
"$newRowToAdd",
"to",
"the",
"existing",
"$oldRowToUpdate",
"passed",
"by",
"reference",
"The",
"rows",
"are",
"php",
"arrays",
"Name",
"=",
">",
"value"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/DataArray.php#L140-L167 | train | Sums actions metrics | [
30522,
5123,
3853,
9998,
12248,
22014,
12589,
2015,
1006,
1002,
2047,
10524,
3406,
4215,
2094,
1010,
1004,
1002,
2214,
10524,
24826,
17299,
3686,
1007,
1063,
1013,
1013,
3653,
1015,
1012,
1016,
4289,
1024,
5164,
25331,
10281,
2024,
2513,
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/Log/Logger.php | Logger.writeLog | protected function writeLog($level, $message, $context)
{
$this->fireLogEvent($level, $message = $this->formatMessage($message), $context);
$this->logger->{$level}($message, $context);
} | php | protected function writeLog($level, $message, $context)
{
$this->fireLogEvent($level, $message = $this->formatMessage($message), $context);
$this->logger->{$level}($message, $context);
} | [
"protected",
"function",
"writeLog",
"(",
"$",
"level",
",",
"$",
"message",
",",
"$",
"context",
")",
"{",
"$",
"this",
"->",
"fireLogEvent",
"(",
"$",
"level",
",",
"$",
"message",
"=",
"$",
"this",
"->",
"formatMessage",
"(",
"$",
"message",
")",
... | Write a message to the log.
@param string $level
@param string $message
@param array $context
@return void | [
"Write",
"a",
"message",
"to",
"the",
"log",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Log/Logger.php#L172-L177 | train | Write log to the log file | [
30522,
5123,
3853,
4339,
21197,
1006,
1002,
2504,
1010,
1002,
4471,
1010,
1002,
6123,
1007,
1063,
1002,
2023,
1011,
1028,
2543,
21197,
18697,
3372,
1006,
1002,
2504,
1010,
1002,
4471,
1027,
1002,
2023,
1011,
1028,
4289,
7834,
3736,
3351,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Validator/Context/ExecutionContextFactory.php | ExecutionContextFactory.createContext | public function createContext(ValidatorInterface $validator, $root)
{
return new ExecutionContext(
$validator,
$root,
$this->translator,
$this->translationDomain
);
} | php | public function createContext(ValidatorInterface $validator, $root)
{
return new ExecutionContext(
$validator,
$root,
$this->translator,
$this->translationDomain
);
} | [
"public",
"function",
"createContext",
"(",
"ValidatorInterface",
"$",
"validator",
",",
"$",
"root",
")",
"{",
"return",
"new",
"ExecutionContext",
"(",
"$",
"validator",
",",
"$",
"root",
",",
"$",
"this",
"->",
"translator",
",",
"$",
"this",
"->",
"tra... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Validator/Context/ExecutionContextFactory.php#L51-L59 | train | Create ExecutionContext for the given Validator and Root | [
30522,
2270,
3853,
3443,
8663,
18209,
1006,
9398,
8844,
18447,
2121,
12172,
1002,
9398,
8844,
1010,
1002,
7117,
1007,
1063,
2709,
2047,
7781,
8663,
18209,
1006,
1002,
9398,
8844,
1010,
1002,
7117,
1010,
1002,
2023,
1011,
1028,
11403,
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... |
octobercms/october | modules/cms/classes/Router.php | Router.findByUrl | public function findByUrl($url)
{
$this->url = $url;
$url = RouterHelper::normalizeUrl($url);
/**
* @event cms.router.beforeRoute
* Fires before the CMS Router handles a route
*
* Example usage:
*
* Event::listen('cms.router.beforeRoute', function ((string) $url, (\Cms\Classes\Router) $thisRouterInstance) {
* return \Cms\Classes\Page::loadCached('trick-theme-code', 'page-file-name');
* });
*
*/
$apiResult = Event::fire('cms.router.beforeRoute', [$url, $this], true);
if ($apiResult !== null) {
return $apiResult;
}
for ($pass = 1; $pass <= 2; $pass++) {
$fileName = null;
$urlList = [];
$cacheable = Config::get('cms.enableRoutesCache');
if ($cacheable) {
$fileName = $this->getCachedUrlFileName($url, $urlList);
if (is_array($fileName)) {
list($fileName, $this->parameters) = $fileName;
}
}
/*
* Find the page by URL and cache the route
*/
if (!$fileName) {
$router = $this->getRouterObject();
if ($router->match($url)) {
$this->parameters = $router->getParameters();
$fileName = $router->matchedRoute();
if ($cacheable) {
if (!$urlList || !is_array($urlList)) {
$urlList = [];
}
$urlList[$url] = !empty($this->parameters)
? [$fileName, $this->parameters]
: $fileName;
$key = $this->getUrlListCacheKey();
Cache::put(
$key,
base64_encode(serialize($urlList)),
Config::get('cms.urlCacheTtl', 1)
);
}
}
}
/*
* Return the page
*/
if ($fileName) {
if (($page = Page::loadCached($this->theme, $fileName)) === null) {
/*
* If the page was not found on the disk, clear the URL cache
* and repeat the routing process.
*/
if ($pass == 1) {
$this->clearCache();
continue;
}
return null;
}
return $page;
}
return null;
}
} | php | public function findByUrl($url)
{
$this->url = $url;
$url = RouterHelper::normalizeUrl($url);
/**
* @event cms.router.beforeRoute
* Fires before the CMS Router handles a route
*
* Example usage:
*
* Event::listen('cms.router.beforeRoute', function ((string) $url, (\Cms\Classes\Router) $thisRouterInstance) {
* return \Cms\Classes\Page::loadCached('trick-theme-code', 'page-file-name');
* });
*
*/
$apiResult = Event::fire('cms.router.beforeRoute', [$url, $this], true);
if ($apiResult !== null) {
return $apiResult;
}
for ($pass = 1; $pass <= 2; $pass++) {
$fileName = null;
$urlList = [];
$cacheable = Config::get('cms.enableRoutesCache');
if ($cacheable) {
$fileName = $this->getCachedUrlFileName($url, $urlList);
if (is_array($fileName)) {
list($fileName, $this->parameters) = $fileName;
}
}
/*
* Find the page by URL and cache the route
*/
if (!$fileName) {
$router = $this->getRouterObject();
if ($router->match($url)) {
$this->parameters = $router->getParameters();
$fileName = $router->matchedRoute();
if ($cacheable) {
if (!$urlList || !is_array($urlList)) {
$urlList = [];
}
$urlList[$url] = !empty($this->parameters)
? [$fileName, $this->parameters]
: $fileName;
$key = $this->getUrlListCacheKey();
Cache::put(
$key,
base64_encode(serialize($urlList)),
Config::get('cms.urlCacheTtl', 1)
);
}
}
}
/*
* Return the page
*/
if ($fileName) {
if (($page = Page::loadCached($this->theme, $fileName)) === null) {
/*
* If the page was not found on the disk, clear the URL cache
* and repeat the routing process.
*/
if ($pass == 1) {
$this->clearCache();
continue;
}
return null;
}
return $page;
}
return null;
}
} | [
"public",
"function",
"findByUrl",
"(",
"$",
"url",
")",
"{",
"$",
"this",
"->",
"url",
"=",
"$",
"url",
";",
"$",
"url",
"=",
"RouterHelper",
"::",
"normalizeUrl",
"(",
"$",
"url",
")",
";",
"/**\n * @event cms.router.beforeRoute\n * Fires befor... | Finds a page by its URL. Returns the page object and sets the $parameters property.
@param string $url The requested URL string.
@return \Cms\Classes\Page Returns \Cms\Classes\Page object or null if the page cannot be found. | [
"Finds",
"a",
"page",
"by",
"its",
"URL",
".",
"Returns",
"the",
"page",
"object",
"and",
"sets",
"the",
"$parameters",
"property",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/Router.php#L77-L161 | train | Find a page by URL | [
30522,
2270,
3853,
2424,
3762,
3126,
2140,
1006,
1002,
24471,
2140,
1007,
1063,
1002,
2023,
1011,
1028,
24471,
2140,
1027,
1002,
24471,
2140,
1025,
1002,
24471,
2140,
1027,
2799,
25032,
2884,
4842,
1024,
1024,
3671,
4697,
3126,
2140,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getgrav/grav | system/src/Grav/Common/Themes.php | Themes.autoloadTheme | protected function autoloadTheme($class)
{
$prefix = 'Grav\\Theme\\';
if (false !== strpos($class, $prefix)) {
// Remove prefix from class
$class = substr($class, strlen($prefix));
$locator = $this->grav['locator'];
// First try lowercase version of the classname.
$path = strtolower($class);
$file = $locator("themes://{$path}/theme.php") ?: $locator("themes://{$path}/{$path}.php");
if ($file) {
return include_once $file;
}
// Replace namespace tokens to directory separators
$path = $this->grav['inflector']->hyphenize($class);
$file = $locator("themes://{$path}/theme.php") ?: $locator("themes://{$path}/{$path}.php");
// Load class
if ($file) {
return include_once $file;
}
// Try Old style theme classes
$path = strtolower(preg_replace('#\\\|_(?!.+\\\)#', '/', $class));
$file = $locator("themes://{$path}/theme.php") ?: $locator("themes://{$path}/{$path}.php");
// Load class
if ($file) {
return include_once $file;
}
}
return false;
} | php | protected function autoloadTheme($class)
{
$prefix = 'Grav\\Theme\\';
if (false !== strpos($class, $prefix)) {
// Remove prefix from class
$class = substr($class, strlen($prefix));
$locator = $this->grav['locator'];
// First try lowercase version of the classname.
$path = strtolower($class);
$file = $locator("themes://{$path}/theme.php") ?: $locator("themes://{$path}/{$path}.php");
if ($file) {
return include_once $file;
}
// Replace namespace tokens to directory separators
$path = $this->grav['inflector']->hyphenize($class);
$file = $locator("themes://{$path}/theme.php") ?: $locator("themes://{$path}/{$path}.php");
// Load class
if ($file) {
return include_once $file;
}
// Try Old style theme classes
$path = strtolower(preg_replace('#\\\|_(?!.+\\\)#', '/', $class));
$file = $locator("themes://{$path}/theme.php") ?: $locator("themes://{$path}/{$path}.php");
// Load class
if ($file) {
return include_once $file;
}
}
return false;
} | [
"protected",
"function",
"autoloadTheme",
"(",
"$",
"class",
")",
"{",
"$",
"prefix",
"=",
"'Grav\\\\Theme\\\\'",
";",
"if",
"(",
"false",
"!==",
"strpos",
"(",
"$",
"class",
",",
"$",
"prefix",
")",
")",
"{",
"// Remove prefix from class",
"$",
"class",
"... | Autoload theme classes for inheritance
@param string $class Class name
@return mixed false FALSE if unable to load $class; Class name if
$class is successfully loaded | [
"Autoload",
"theme",
"classes",
"for",
"inheritance"
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Themes.php#L323-L359 | train | Autoload theme classes | [
30522,
5123,
3853,
8285,
11066,
10760,
4168,
1006,
1002,
2465,
1007,
1063,
1002,
17576,
1027,
1005,
24665,
11431,
1032,
1032,
4323,
1032,
1032,
1005,
1025,
2065,
1006,
6270,
999,
1027,
1027,
2358,
14536,
2891,
1006,
1002,
2465,
1010,
1002,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Workflow/Workflow.php | Workflow.getEnabledTransitions | public function getEnabledTransitions($subject)
{
$enabledTransitions = [];
$marking = $this->getMarking($subject);
foreach ($this->definition->getTransitions() as $transition) {
$transitionBlockerList = $this->buildTransitionBlockerListForTransition($subject, $marking, $transition);
if ($transitionBlockerList->isEmpty()) {
$enabledTransitions[] = $transition;
}
}
return $enabledTransitions;
} | php | public function getEnabledTransitions($subject)
{
$enabledTransitions = [];
$marking = $this->getMarking($subject);
foreach ($this->definition->getTransitions() as $transition) {
$transitionBlockerList = $this->buildTransitionBlockerListForTransition($subject, $marking, $transition);
if ($transitionBlockerList->isEmpty()) {
$enabledTransitions[] = $transition;
}
}
return $enabledTransitions;
} | [
"public",
"function",
"getEnabledTransitions",
"(",
"$",
"subject",
")",
"{",
"$",
"enabledTransitions",
"=",
"[",
"]",
";",
"$",
"marking",
"=",
"$",
"this",
"->",
"getMarking",
"(",
"$",
"subject",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"definiti... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Workflow/Workflow.php#L206-L219 | train | Get enabled transitions for a subject | [
30522,
2270,
3853,
2131,
8189,
23242,
6494,
3619,
22753,
2015,
1006,
1002,
3395,
1007,
1063,
1002,
9124,
6494,
3619,
22753,
2015,
1027,
1031,
1033,
1025,
1002,
10060,
1027,
1002,
2023,
1011,
1028,
2131,
10665,
2075,
1006,
1002,
3395,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/cms/classes/ComponentManager.php | ComponentManager.loadComponents | protected function loadComponents()
{
/*
* Load module components
*/
foreach ($this->callbacks as $callback) {
$callback($this);
}
/*
* Load plugin components
*/
$pluginManager = PluginManager::instance();
$plugins = $pluginManager->getPlugins();
foreach ($plugins as $plugin) {
$components = $plugin->registerComponents();
if (!is_array($components)) {
continue;
}
foreach ($components as $className => $code) {
$this->registerComponent($className, $code, $plugin);
}
}
} | php | protected function loadComponents()
{
/*
* Load module components
*/
foreach ($this->callbacks as $callback) {
$callback($this);
}
/*
* Load plugin components
*/
$pluginManager = PluginManager::instance();
$plugins = $pluginManager->getPlugins();
foreach ($plugins as $plugin) {
$components = $plugin->registerComponents();
if (!is_array($components)) {
continue;
}
foreach ($components as $className => $code) {
$this->registerComponent($className, $code, $plugin);
}
}
} | [
"protected",
"function",
"loadComponents",
"(",
")",
"{",
"/*\n * Load module components\n */",
"foreach",
"(",
"$",
"this",
"->",
"callbacks",
"as",
"$",
"callback",
")",
"{",
"$",
"callback",
"(",
"$",
"this",
")",
";",
"}",
"/*\n * Load ... | Scans each plugin an loads it's components.
@return void | [
"Scans",
"each",
"plugin",
"an",
"loads",
"it",
"s",
"components",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/ComponentManager.php#L47-L72 | train | Load module components | [
30522,
5123,
3853,
7170,
9006,
29513,
7666,
1006,
1007,
1063,
1013,
1008,
1008,
7170,
11336,
6177,
1008,
1013,
18921,
6776,
1006,
1002,
2023,
1011,
1028,
2655,
12221,
2004,
1002,
2655,
5963,
1007,
1063,
1002,
2655,
5963,
1006,
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/HttpKernel/HttpCache/Store.php | Store.cleanup | public function cleanup()
{
// unlock everything
foreach ($this->locks as $lock) {
flock($lock, LOCK_UN);
fclose($lock);
}
$this->locks = [];
} | php | public function cleanup()
{
// unlock everything
foreach ($this->locks as $lock) {
flock($lock, LOCK_UN);
fclose($lock);
}
$this->locks = [];
} | [
"public",
"function",
"cleanup",
"(",
")",
"{",
"// unlock everything",
"foreach",
"(",
"$",
"this",
"->",
"locks",
"as",
"$",
"lock",
")",
"{",
"flock",
"(",
"$",
"lock",
",",
"LOCK_UN",
")",
";",
"fclose",
"(",
"$",
"lock",
")",
";",
"}",
"$",
"t... | Cleanups storage. | [
"Cleanups",
"storage",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/HttpCache/Store.php#L47-L56 | train | Cleanups the cache | [
30522,
2270,
3853,
27686,
1006,
1007,
1063,
1013,
1013,
19829,
2673,
18921,
6776,
1006,
1002,
2023,
1011,
1028,
11223,
2004,
1002,
5843,
1007,
1063,
19311,
1006,
1002,
5843,
1010,
5843,
1035,
4895,
1007,
1025,
4429,
10483,
2063,
1006,
1002,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Serializer/Mapping/Loader/AnnotationLoader.php | AnnotationLoader.loadClassMetadata | public function loadClassMetadata(ClassMetadataInterface $classMetadata)
{
$reflectionClass = $classMetadata->getReflectionClass();
$className = $reflectionClass->name;
$loaded = false;
$attributesMetadata = $classMetadata->getAttributesMetadata();
foreach ($this->reader->getClassAnnotations($reflectionClass) as $annotation) {
if ($annotation instanceof DiscriminatorMap) {
$classMetadata->setClassDiscriminatorMapping(new ClassDiscriminatorMapping(
$annotation->getTypeProperty(),
$annotation->getMapping()
));
}
}
foreach ($reflectionClass->getProperties() as $property) {
if (!isset($attributesMetadata[$property->name])) {
$attributesMetadata[$property->name] = new AttributeMetadata($property->name);
$classMetadata->addAttributeMetadata($attributesMetadata[$property->name]);
}
if ($property->getDeclaringClass()->name === $className) {
foreach ($this->reader->getPropertyAnnotations($property) as $annotation) {
if ($annotation instanceof Groups) {
foreach ($annotation->getGroups() as $group) {
$attributesMetadata[$property->name]->addGroup($group);
}
} elseif ($annotation instanceof MaxDepth) {
$attributesMetadata[$property->name]->setMaxDepth($annotation->getMaxDepth());
} elseif ($annotation instanceof SerializedName) {
$attributesMetadata[$property->name]->setSerializedName($annotation->getSerializedName());
}
$loaded = true;
}
}
}
foreach ($reflectionClass->getMethods() as $method) {
if ($method->getDeclaringClass()->name !== $className) {
continue;
}
$accessorOrMutator = preg_match('/^(get|is|has|set)(.+)$/i', $method->name, $matches);
if ($accessorOrMutator) {
$attributeName = lcfirst($matches[2]);
if (isset($attributesMetadata[$attributeName])) {
$attributeMetadata = $attributesMetadata[$attributeName];
} else {
$attributesMetadata[$attributeName] = $attributeMetadata = new AttributeMetadata($attributeName);
$classMetadata->addAttributeMetadata($attributeMetadata);
}
}
foreach ($this->reader->getMethodAnnotations($method) as $annotation) {
if ($annotation instanceof Groups) {
if (!$accessorOrMutator) {
throw new MappingException(sprintf('Groups on "%s::%s" cannot be added. Groups can only be added on methods beginning with "get", "is", "has" or "set".', $className, $method->name));
}
foreach ($annotation->getGroups() as $group) {
$attributeMetadata->addGroup($group);
}
} elseif ($annotation instanceof MaxDepth) {
if (!$accessorOrMutator) {
throw new MappingException(sprintf('MaxDepth on "%s::%s" cannot be added. MaxDepth can only be added on methods beginning with "get", "is", "has" or "set".', $className, $method->name));
}
$attributeMetadata->setMaxDepth($annotation->getMaxDepth());
} elseif ($annotation instanceof SerializedName) {
if (!$accessorOrMutator) {
throw new MappingException(sprintf('SerializedName on "%s::%s" cannot be added. SerializedName can only be added on methods beginning with "get", "is", "has" or "set".', $className, $method->name));
}
$attributeMetadata->setSerializedName($annotation->getSerializedName());
}
$loaded = true;
}
}
return $loaded;
} | php | public function loadClassMetadata(ClassMetadataInterface $classMetadata)
{
$reflectionClass = $classMetadata->getReflectionClass();
$className = $reflectionClass->name;
$loaded = false;
$attributesMetadata = $classMetadata->getAttributesMetadata();
foreach ($this->reader->getClassAnnotations($reflectionClass) as $annotation) {
if ($annotation instanceof DiscriminatorMap) {
$classMetadata->setClassDiscriminatorMapping(new ClassDiscriminatorMapping(
$annotation->getTypeProperty(),
$annotation->getMapping()
));
}
}
foreach ($reflectionClass->getProperties() as $property) {
if (!isset($attributesMetadata[$property->name])) {
$attributesMetadata[$property->name] = new AttributeMetadata($property->name);
$classMetadata->addAttributeMetadata($attributesMetadata[$property->name]);
}
if ($property->getDeclaringClass()->name === $className) {
foreach ($this->reader->getPropertyAnnotations($property) as $annotation) {
if ($annotation instanceof Groups) {
foreach ($annotation->getGroups() as $group) {
$attributesMetadata[$property->name]->addGroup($group);
}
} elseif ($annotation instanceof MaxDepth) {
$attributesMetadata[$property->name]->setMaxDepth($annotation->getMaxDepth());
} elseif ($annotation instanceof SerializedName) {
$attributesMetadata[$property->name]->setSerializedName($annotation->getSerializedName());
}
$loaded = true;
}
}
}
foreach ($reflectionClass->getMethods() as $method) {
if ($method->getDeclaringClass()->name !== $className) {
continue;
}
$accessorOrMutator = preg_match('/^(get|is|has|set)(.+)$/i', $method->name, $matches);
if ($accessorOrMutator) {
$attributeName = lcfirst($matches[2]);
if (isset($attributesMetadata[$attributeName])) {
$attributeMetadata = $attributesMetadata[$attributeName];
} else {
$attributesMetadata[$attributeName] = $attributeMetadata = new AttributeMetadata($attributeName);
$classMetadata->addAttributeMetadata($attributeMetadata);
}
}
foreach ($this->reader->getMethodAnnotations($method) as $annotation) {
if ($annotation instanceof Groups) {
if (!$accessorOrMutator) {
throw new MappingException(sprintf('Groups on "%s::%s" cannot be added. Groups can only be added on methods beginning with "get", "is", "has" or "set".', $className, $method->name));
}
foreach ($annotation->getGroups() as $group) {
$attributeMetadata->addGroup($group);
}
} elseif ($annotation instanceof MaxDepth) {
if (!$accessorOrMutator) {
throw new MappingException(sprintf('MaxDepth on "%s::%s" cannot be added. MaxDepth can only be added on methods beginning with "get", "is", "has" or "set".', $className, $method->name));
}
$attributeMetadata->setMaxDepth($annotation->getMaxDepth());
} elseif ($annotation instanceof SerializedName) {
if (!$accessorOrMutator) {
throw new MappingException(sprintf('SerializedName on "%s::%s" cannot be added. SerializedName can only be added on methods beginning with "get", "is", "has" or "set".', $className, $method->name));
}
$attributeMetadata->setSerializedName($annotation->getSerializedName());
}
$loaded = true;
}
}
return $loaded;
} | [
"public",
"function",
"loadClassMetadata",
"(",
"ClassMetadataInterface",
"$",
"classMetadata",
")",
"{",
"$",
"reflectionClass",
"=",
"$",
"classMetadata",
"->",
"getReflectionClass",
"(",
")",
";",
"$",
"className",
"=",
"$",
"reflectionClass",
"->",
"name",
";"... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Serializer/Mapping/Loader/AnnotationLoader.php#L41-L126 | train | Load class metadata | [
30522,
2270,
3853,
7170,
26266,
11368,
8447,
2696,
1006,
2465,
11368,
8447,
18249,
3334,
12172,
1002,
2465,
11368,
8447,
2696,
1007,
1063,
1002,
9185,
26266,
1027,
1002,
2465,
11368,
8447,
2696,
1011,
1028,
2131,
2890,
21031,
7542,
26266,
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... |
guzzle/guzzle | src/Handler/CurlFactory.php | CurlFactory.finish | public static function finish(
callable $handler,
EasyHandle $easy,
CurlFactoryInterface $factory
) {
if (isset($easy->options['on_stats'])) {
self::invokeStats($easy);
}
if (!$easy->response || $easy->errno) {
return self::finishError($handler, $easy, $factory);
}
// Return the response if it is present and there is no error.
$factory->release($easy);
// Rewind the body of the response if possible.
$body = $easy->response->getBody();
if ($body->isSeekable()) {
$body->rewind();
}
return new FulfilledPromise($easy->response);
} | php | public static function finish(
callable $handler,
EasyHandle $easy,
CurlFactoryInterface $factory
) {
if (isset($easy->options['on_stats'])) {
self::invokeStats($easy);
}
if (!$easy->response || $easy->errno) {
return self::finishError($handler, $easy, $factory);
}
// Return the response if it is present and there is no error.
$factory->release($easy);
// Rewind the body of the response if possible.
$body = $easy->response->getBody();
if ($body->isSeekable()) {
$body->rewind();
}
return new FulfilledPromise($easy->response);
} | [
"public",
"static",
"function",
"finish",
"(",
"callable",
"$",
"handler",
",",
"EasyHandle",
"$",
"easy",
",",
"CurlFactoryInterface",
"$",
"factory",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"easy",
"->",
"options",
"[",
"'on_stats'",
"]",
")",
")",
"{"... | Completes a cURL transaction, either returning a response promise or a
rejected promise.
@param callable $handler
@param EasyHandle $easy
@param CurlFactoryInterface $factory Dictates how the handle is released
@return \GuzzleHttp\Promise\PromiseInterface | [
"Completes",
"a",
"cURL",
"transaction",
"either",
"returning",
"a",
"response",
"promise",
"or",
"a",
"rejected",
"promise",
"."
] | bf595424e4d442a190582e088985dc835a789071 | https://github.com/guzzle/guzzle/blob/bf595424e4d442a190582e088985dc835a789071/src/Handler/CurlFactory.php#L95-L118 | train | Finish the request | [
30522,
2270,
10763,
3853,
3926,
1006,
2655,
3085,
1002,
28213,
1010,
3733,
11774,
2571,
1002,
3733,
1010,
15390,
21450,
18447,
2121,
12172,
1002,
4713,
1007,
1063,
2065,
1006,
26354,
3388,
1006,
1002,
3733,
1011,
1028,
7047,
1031,
1005,
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... |
octobercms/october | modules/backend/widgets/Lists.php | Lists.evalTextTypeValue | protected function evalTextTypeValue($record, $column, $value)
{
if (is_array($value) && count($value) == count($value, COUNT_RECURSIVE)) {
$value = implode(', ', $value);
}
if (is_string($column->format) && !empty($column->format)) {
$value = sprintf($column->format, $value);
}
return htmlentities($value, ENT_QUOTES, 'UTF-8', false);
} | php | protected function evalTextTypeValue($record, $column, $value)
{
if (is_array($value) && count($value) == count($value, COUNT_RECURSIVE)) {
$value = implode(', ', $value);
}
if (is_string($column->format) && !empty($column->format)) {
$value = sprintf($column->format, $value);
}
return htmlentities($value, ENT_QUOTES, 'UTF-8', false);
} | [
"protected",
"function",
"evalTextTypeValue",
"(",
"$",
"record",
",",
"$",
"column",
",",
"$",
"value",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"value",
")",
"&&",
"count",
"(",
"$",
"value",
")",
"==",
"count",
"(",
"$",
"value",
",",
"COUNT_REC... | Process as text, escape the value | [
"Process",
"as",
"text",
"escape",
"the",
"value"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/Lists.php#L1147-L1158 | train | Evaluate the value of a text type column | [
30522,
5123,
3853,
9345,
7096,
10288,
15353,
5051,
10175,
5657,
1006,
1002,
2501,
1010,
1002,
5930,
1010,
1002,
3643,
1007,
1063,
2065,
1006,
2003,
1035,
9140,
1006,
1002,
3643,
1007,
1004,
1004,
4175,
1006,
1002,
3643,
1007,
1027,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/XmlDescriptor.php | XmlDescriptor.describeContainerAlias | protected function describeContainerAlias(Alias $alias, array $options = [], ContainerBuilder $builder = null)
{
$dom = new \DOMDocument('1.0', 'UTF-8');
$dom->appendChild($dom->importNode($this->getContainerAliasDocument($alias, isset($options['id']) ? $options['id'] : null)->childNodes->item(0), true));
if (!$builder) {
return $this->writeDocument($dom);
}
$dom->appendChild($dom->importNode($this->getContainerDefinitionDocument($builder->getDefinition((string) $alias), (string) $alias)->childNodes->item(0), true));
$this->writeDocument($dom);
} | php | protected function describeContainerAlias(Alias $alias, array $options = [], ContainerBuilder $builder = null)
{
$dom = new \DOMDocument('1.0', 'UTF-8');
$dom->appendChild($dom->importNode($this->getContainerAliasDocument($alias, isset($options['id']) ? $options['id'] : null)->childNodes->item(0), true));
if (!$builder) {
return $this->writeDocument($dom);
}
$dom->appendChild($dom->importNode($this->getContainerDefinitionDocument($builder->getDefinition((string) $alias), (string) $alias)->childNodes->item(0), true));
$this->writeDocument($dom);
} | [
"protected",
"function",
"describeContainerAlias",
"(",
"Alias",
"$",
"alias",
",",
"array",
"$",
"options",
"=",
"[",
"]",
",",
"ContainerBuilder",
"$",
"builder",
"=",
"null",
")",
"{",
"$",
"dom",
"=",
"new",
"\\",
"DOMDocument",
"(",
"'1.0'",
",",
"'... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/XmlDescriptor.php#L97-L109 | train | Describes a container alias | [
30522,
5123,
3853,
6235,
8663,
18249,
21673,
7951,
1006,
14593,
1002,
14593,
1010,
9140,
1002,
7047,
1027,
1031,
1033,
1010,
11661,
8569,
23891,
2099,
1002,
12508,
1027,
19701,
1007,
1063,
1002,
14383,
1027,
2047,
1032,
14383,
3527,
24894,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/BaseNode.php | BaseNode.getPath | public function getPath()
{
if (null !== $this->parent) {
return $this->parent->getPath().$this->pathSeparator.$this->name;
}
return $this->name;
} | php | public function getPath()
{
if (null !== $this->parent) {
return $this->parent->getPath().$this->pathSeparator.$this->name;
}
return $this->name;
} | [
"public",
"function",
"getPath",
"(",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"this",
"->",
"parent",
")",
"{",
"return",
"$",
"this",
"->",
"parent",
"->",
"getPath",
"(",
")",
".",
"$",
"this",
"->",
"pathSeparator",
".",
"$",
"this",
"->",
"nam... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Config/Definition/BaseNode.php#L276-L283 | train | Get path of this file | [
30522,
2270,
3853,
2131,
15069,
1006,
1007,
1063,
2065,
1006,
19701,
999,
1027,
1027,
1002,
2023,
1011,
1028,
6687,
1007,
1063,
2709,
1002,
2023,
1011,
1028,
6687,
1011,
1028,
2131,
15069,
1006,
1007,
1012,
1002,
2023,
1011,
1028,
10425,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
guzzle/guzzle | src/Cookie/CookieJar.php | CookieJar.fromArray | public static function fromArray(array $cookies, $domain)
{
$cookieJar = new self();
foreach ($cookies as $name => $value) {
$cookieJar->setCookie(new SetCookie([
'Domain' => $domain,
'Name' => $name,
'Value' => $value,
'Discard' => true
]));
}
return $cookieJar;
} | php | public static function fromArray(array $cookies, $domain)
{
$cookieJar = new self();
foreach ($cookies as $name => $value) {
$cookieJar->setCookie(new SetCookie([
'Domain' => $domain,
'Name' => $name,
'Value' => $value,
'Discard' => true
]));
}
return $cookieJar;
} | [
"public",
"static",
"function",
"fromArray",
"(",
"array",
"$",
"cookies",
",",
"$",
"domain",
")",
"{",
"$",
"cookieJar",
"=",
"new",
"self",
"(",
")",
";",
"foreach",
"(",
"$",
"cookies",
"as",
"$",
"name",
"=>",
"$",
"value",
")",
"{",
"$",
"coo... | Create a new Cookie jar from an associative array and domain.
@param array $cookies Cookies to create the jar from
@param string $domain Domain to set the cookies to
@return self | [
"Create",
"a",
"new",
"Cookie",
"jar",
"from",
"an",
"associative",
"array",
"and",
"domain",
"."
] | bf595424e4d442a190582e088985dc835a789071 | https://github.com/guzzle/guzzle/blob/bf595424e4d442a190582e088985dc835a789071/src/Cookie/CookieJar.php#L45-L58 | train | Create a new SetCookieJar from an array | [
30522,
2270,
10763,
3853,
2013,
2906,
9447,
1006,
9140,
1002,
16324,
1010,
1002,
5884,
1007,
1063,
1002,
17387,
16084,
1027,
2047,
2969,
1006,
1007,
1025,
18921,
6776,
1006,
1002,
16324,
2004,
1002,
2171,
1027,
1028,
1002,
3643,
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... |
symfony/symfony | src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php | ChoiceType.addSubForms | private function addSubForms(FormBuilderInterface $builder, array $choiceViews, array $options)
{
foreach ($choiceViews as $name => $choiceView) {
// Flatten groups
if (\is_array($choiceView)) {
$this->addSubForms($builder, $choiceView, $options);
continue;
}
if ($choiceView instanceof ChoiceGroupView) {
$this->addSubForms($builder, $choiceView->choices, $options);
continue;
}
$this->addSubForm($builder, $name, $choiceView, $options);
}
} | php | private function addSubForms(FormBuilderInterface $builder, array $choiceViews, array $options)
{
foreach ($choiceViews as $name => $choiceView) {
// Flatten groups
if (\is_array($choiceView)) {
$this->addSubForms($builder, $choiceView, $options);
continue;
}
if ($choiceView instanceof ChoiceGroupView) {
$this->addSubForms($builder, $choiceView->choices, $options);
continue;
}
$this->addSubForm($builder, $name, $choiceView, $options);
}
} | [
"private",
"function",
"addSubForms",
"(",
"FormBuilderInterface",
"$",
"builder",
",",
"array",
"$",
"choiceViews",
",",
"array",
"$",
"options",
")",
"{",
"foreach",
"(",
"$",
"choiceViews",
"as",
"$",
"name",
"=>",
"$",
"choiceView",
")",
"{",
"// Flatten... | Adds the sub fields for an expanded choice field. | [
"Adds",
"the",
"sub",
"fields",
"for",
"an",
"expanded",
"choice",
"field",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php#L347-L363 | train | Add SubForms to FormBuilder | [
30522,
2797,
3853,
9909,
12083,
22694,
1006,
2433,
8569,
23891,
6657,
3334,
12172,
1002,
12508,
1010,
9140,
1002,
3601,
8584,
2015,
1010,
9140,
1002,
7047,
1007,
1063,
18921,
6776,
1006,
1002,
3601,
8584,
2015,
2004,
1002,
2171,
1027,
1028,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getgrav/grav | system/src/Grav/Common/Iterator.php | Iterator.sort | public function sort(callable $callback = null, $desc = false)
{
if (!$callback || !\is_callable($callback)) {
return $this;
}
$items = $this->items;
uasort($items, $callback);
return !$desc ? $items : array_reverse($items, true);
} | php | public function sort(callable $callback = null, $desc = false)
{
if (!$callback || !\is_callable($callback)) {
return $this;
}
$items = $this->items;
uasort($items, $callback);
return !$desc ? $items : array_reverse($items, true);
} | [
"public",
"function",
"sort",
"(",
"callable",
"$",
"callback",
"=",
"null",
",",
"$",
"desc",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"$",
"callback",
"||",
"!",
"\\",
"is_callable",
"(",
"$",
"callback",
")",
")",
"{",
"return",
"$",
"this",
";",... | Sorts elements from the list and returns a copy of the list in the proper order
@param callable|null $callback
@param bool $desc
@return $this|array
@internal param bool $asc | [
"Sorts",
"elements",
"from",
"the",
"list",
"and",
"returns",
"a",
"copy",
"of",
"the",
"list",
"in",
"the",
"proper",
"order"
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Iterator.php#L254-L264 | train | Sort the array by priority | [
30522,
2270,
3853,
4066,
1006,
2655,
3085,
1002,
2655,
5963,
1027,
19701,
1010,
1002,
4078,
2278,
1027,
6270,
1007,
1063,
2065,
1006,
999,
1002,
2655,
5963,
1064,
1064,
999,
1032,
2003,
1035,
2655,
3085,
1006,
1002,
2655,
5963,
1007,
1007... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Translation/Extractor/PhpExtractor.php | PhpExtractor.getValue | private function getValue(\Iterator $tokenIterator)
{
$message = '';
$docToken = '';
$docPart = '';
for (; $tokenIterator->valid(); $tokenIterator->next()) {
$t = $tokenIterator->current();
if ('.' === $t) {
// Concatenate with next token
continue;
}
if (!isset($t[1])) {
break;
}
switch ($t[0]) {
case T_START_HEREDOC:
$docToken = $t[1];
break;
case T_ENCAPSED_AND_WHITESPACE:
case T_CONSTANT_ENCAPSED_STRING:
if ('' === $docToken) {
$message .= PhpStringTokenParser::parse($t[1]);
} else {
$docPart = $t[1];
}
break;
case T_END_HEREDOC:
$message .= PhpStringTokenParser::parseDocString($docToken, $docPart);
$docToken = '';
$docPart = '';
break;
case T_WHITESPACE:
break;
default:
break 2;
}
}
return $message;
} | php | private function getValue(\Iterator $tokenIterator)
{
$message = '';
$docToken = '';
$docPart = '';
for (; $tokenIterator->valid(); $tokenIterator->next()) {
$t = $tokenIterator->current();
if ('.' === $t) {
// Concatenate with next token
continue;
}
if (!isset($t[1])) {
break;
}
switch ($t[0]) {
case T_START_HEREDOC:
$docToken = $t[1];
break;
case T_ENCAPSED_AND_WHITESPACE:
case T_CONSTANT_ENCAPSED_STRING:
if ('' === $docToken) {
$message .= PhpStringTokenParser::parse($t[1]);
} else {
$docPart = $t[1];
}
break;
case T_END_HEREDOC:
$message .= PhpStringTokenParser::parseDocString($docToken, $docPart);
$docToken = '';
$docPart = '';
break;
case T_WHITESPACE:
break;
default:
break 2;
}
}
return $message;
} | [
"private",
"function",
"getValue",
"(",
"\\",
"Iterator",
"$",
"tokenIterator",
")",
"{",
"$",
"message",
"=",
"''",
";",
"$",
"docToken",
"=",
"''",
";",
"$",
"docPart",
"=",
"''",
";",
"for",
"(",
";",
"$",
"tokenIterator",
"->",
"valid",
"(",
")",... | Extracts the message from the iterator while the tokens
match allowed message tokens. | [
"Extracts",
"the",
"message",
"from",
"the",
"iterator",
"while",
"the",
"tokens",
"match",
"allowed",
"message",
"tokens",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Translation/Extractor/PhpExtractor.php#L152-L193 | train | Returns the value of the iterator | [
30522,
2797,
3853,
2131,
10175,
5657,
1006,
1032,
2009,
6906,
4263,
1002,
19204,
21646,
8844,
1007,
1063,
1002,
4471,
1027,
1005,
1005,
1025,
1002,
9986,
18715,
2368,
1027,
1005,
1005,
1025,
1002,
9986,
19362,
2102,
1027,
1005,
1005,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Database/Schema/Builder.php | Builder.getColumnListing | public function getColumnListing($table)
{
$results = $this->connection->selectFromWriteConnection($this->grammar->compileColumnListing(
$this->connection->getTablePrefix().$table
));
return $this->connection->getPostProcessor()->processColumnListing($results);
} | php | public function getColumnListing($table)
{
$results = $this->connection->selectFromWriteConnection($this->grammar->compileColumnListing(
$this->connection->getTablePrefix().$table
));
return $this->connection->getPostProcessor()->processColumnListing($results);
} | [
"public",
"function",
"getColumnListing",
"(",
"$",
"table",
")",
"{",
"$",
"results",
"=",
"$",
"this",
"->",
"connection",
"->",
"selectFromWriteConnection",
"(",
"$",
"this",
"->",
"grammar",
"->",
"compileColumnListing",
"(",
"$",
"this",
"->",
"connection... | Get the column listing for a given table.
@param string $table
@return array | [
"Get",
"the",
"column",
"listing",
"for",
"a",
"given",
"table",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Schema/Builder.php#L133-L140 | train | Returns a column listing of a table. | [
30522,
2270,
3853,
2131,
25778,
2819,
20554,
2923,
2075,
1006,
1002,
2795,
1007,
1063,
1002,
3463,
1027,
1002,
2023,
1011,
1028,
4434,
1011,
1028,
7276,
19699,
5358,
26373,
8663,
2638,
7542,
1006,
1002,
2023,
1011,
1028,
8035,
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... |
getgrav/grav | system/src/Grav/Common/Uri.php | Uri.paths | public function paths($id = null)
{
if ($id !== null) {
return $this->paths[$id];
}
return $this->paths;
} | php | public function paths($id = null)
{
if ($id !== null) {
return $this->paths[$id];
}
return $this->paths;
} | [
"public",
"function",
"paths",
"(",
"$",
"id",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"id",
"!==",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"paths",
"[",
"$",
"id",
"]",
";",
"}",
"return",
"$",
"this",
"->",
"paths",
";",
"}"
] | Return URI path.
@param string $id
@return string|string[] | [
"Return",
"URI",
"path",
"."
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Uri.php#L219-L226 | train | Get all paths | [
30522,
2270,
3853,
10425,
1006,
1002,
8909,
1027,
19701,
1007,
1063,
2065,
1006,
1002,
8909,
999,
1027,
1027,
19701,
1007,
1063,
2709,
1002,
2023,
1011,
1028,
10425,
1031,
1002,
8909,
1033,
1025,
1065,
2709,
1002,
2023,
1011,
1028,
10425,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Config/Definition/Builder/TreeBuilder.php | TreeBuilder.buildTree | public function buildTree()
{
$this->assertTreeHasRootNode();
if (null !== $this->tree) {
return $this->tree;
}
return $this->tree = $this->root->getNode(true);
} | php | public function buildTree()
{
$this->assertTreeHasRootNode();
if (null !== $this->tree) {
return $this->tree;
}
return $this->tree = $this->root->getNode(true);
} | [
"public",
"function",
"buildTree",
"(",
")",
"{",
"$",
"this",
"->",
"assertTreeHasRootNode",
"(",
")",
";",
"if",
"(",
"null",
"!==",
"$",
"this",
"->",
"tree",
")",
"{",
"return",
"$",
"this",
"->",
"tree",
";",
"}",
"return",
"$",
"this",
"->",
... | Builds the tree.
@return NodeInterface
@throws \RuntimeException | [
"Builds",
"the",
"tree",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Config/Definition/Builder/TreeBuilder.php#L78-L86 | train | Build tree of root node | [
30522,
2270,
3853,
3857,
13334,
1006,
1007,
1063,
1002,
2023,
1011,
1028,
20865,
13334,
14949,
3217,
4140,
3630,
3207,
1006,
1007,
1025,
2065,
1006,
19701,
999,
1027,
1027,
1002,
2023,
1011,
1028,
3392,
1007,
1063,
2709,
1002,
2023,
1011,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/HttpFoundation/Request.php | Request.normalizeQueryString | public static function normalizeQueryString($qs)
{
if ('' == $qs) {
return '';
}
parse_str($qs, $qs);
ksort($qs);
return http_build_query($qs, '', '&', PHP_QUERY_RFC3986);
} | php | public static function normalizeQueryString($qs)
{
if ('' == $qs) {
return '';
}
parse_str($qs, $qs);
ksort($qs);
return http_build_query($qs, '', '&', PHP_QUERY_RFC3986);
} | [
"public",
"static",
"function",
"normalizeQueryString",
"(",
"$",
"qs",
")",
"{",
"if",
"(",
"''",
"==",
"$",
"qs",
")",
"{",
"return",
"''",
";",
"}",
"parse_str",
"(",
"$",
"qs",
",",
"$",
"qs",
")",
";",
"ksort",
"(",
"$",
"qs",
")",
";",
"r... | Normalizes a query string.
It builds a normalized query string, where keys/value pairs are alphabetized,
have consistent escaping and unneeded delimiters are removed.
@param string $qs Query string
@return string A normalized query string for the Request | [
"Normalizes",
"a",
"query",
"string",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpFoundation/Request.php#L629-L639 | train | Normalize a query string to a string | [
30522,
2270,
10763,
3853,
3671,
4697,
4226,
24769,
18886,
3070,
1006,
1002,
1053,
2015,
1007,
1063,
2065,
1006,
1005,
1005,
1027,
1027,
1002,
1053,
2015,
1007,
1063,
2709,
1005,
1005,
1025,
1065,
11968,
3366,
1035,
2358,
2099,
1006,
1002,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
overtrue/wechat | src/Kernel/Traits/ResponseCastable.php | ResponseCastable.castResponseToType | protected function castResponseToType(ResponseInterface $response, $type = null)
{
$response = Response::buildFromPsrResponse($response);
$response->getBody()->rewind();
switch ($type ?? 'array') {
case 'collection':
return $response->toCollection();
case 'array':
return $response->toArray();
case 'object':
return $response->toObject();
case 'raw':
return $response;
default:
if (!is_subclass_of($type, Arrayable::class)) {
throw new InvalidConfigException(sprintf(
'Config key "response_type" classname must be an instanceof %s',
Arrayable::class
));
}
return new $type($response);
}
} | php | protected function castResponseToType(ResponseInterface $response, $type = null)
{
$response = Response::buildFromPsrResponse($response);
$response->getBody()->rewind();
switch ($type ?? 'array') {
case 'collection':
return $response->toCollection();
case 'array':
return $response->toArray();
case 'object':
return $response->toObject();
case 'raw':
return $response;
default:
if (!is_subclass_of($type, Arrayable::class)) {
throw new InvalidConfigException(sprintf(
'Config key "response_type" classname must be an instanceof %s',
Arrayable::class
));
}
return new $type($response);
}
} | [
"protected",
"function",
"castResponseToType",
"(",
"ResponseInterface",
"$",
"response",
",",
"$",
"type",
"=",
"null",
")",
"{",
"$",
"response",
"=",
"Response",
"::",
"buildFromPsrResponse",
"(",
"$",
"response",
")",
";",
"$",
"response",
"->",
"getBody",... | @param \Psr\Http\Message\ResponseInterface $response
@param string|null $type
@return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
@throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException | [
"@param",
"\\",
"Psr",
"\\",
"Http",
"\\",
"Message",
"\\",
"ResponseInterface",
"$response",
"@param",
"string|null",
"$type"
] | 120c72faaa93c270365bc75c73c362d5fd583209 | https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/Kernel/Traits/ResponseCastable.php#L36-L60 | train | Casts the response to the specified type | [
30522,
5123,
3853,
3459,
6072,
26029,
13462,
26305,
1006,
3433,
18447,
2121,
12172,
1002,
3433,
1010,
1002,
2828,
1027,
19701,
1007,
1063,
30524,
1024,
2709,
1002,
3433,
1011,
1028,
2000,
26895,
18491,
1006,
1007,
1025,
2553,
1005,
9140,
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/Payment/Order/Client.php | Client.query | protected function query(array $params)
{
$params['appid'] = $this->app['config']->app_id;
return $this->request($this->wrap('pay/orderquery'), $params);
} | php | protected function query(array $params)
{
$params['appid'] = $this->app['config']->app_id;
return $this->request($this->wrap('pay/orderquery'), $params);
} | [
"protected",
"function",
"query",
"(",
"array",
"$",
"params",
")",
"{",
"$",
"params",
"[",
"'appid'",
"]",
"=",
"$",
"this",
"->",
"app",
"[",
"'config'",
"]",
"->",
"app_id",
";",
"return",
"$",
"this",
"->",
"request",
"(",
"$",
"this",
"->",
"... | @param array $params
@return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string
@throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException | [
"@param",
"array",
"$params"
] | 120c72faaa93c270365bc75c73c362d5fd583209 | https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/Payment/Order/Client.php#L79-L84 | train | Query the order | [
30522,
5123,
3853,
23032,
1006,
9140,
1002,
11498,
5244,
1007,
1063,
1002,
11498,
5244,
1031,
1005,
10439,
3593,
1005,
1033,
1027,
1002,
2023,
1011,
1028,
10439,
1031,
1005,
9530,
8873,
2290,
1005,
1033,
1011,
1028,
10439,
1035,
8909,
30524... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
PHPMailer/PHPMailer | src/PHPMailer.php | PHPMailer.addCustomHeader | public function addCustomHeader($name, $value = null)
{
if (null === $value) {
// Value passed in as name:value
$this->CustomHeader[] = explode(':', $name, 2);
} else {
$this->CustomHeader[] = [$name, $value];
}
} | php | public function addCustomHeader($name, $value = null)
{
if (null === $value) {
// Value passed in as name:value
$this->CustomHeader[] = explode(':', $name, 2);
} else {
$this->CustomHeader[] = [$name, $value];
}
} | [
"public",
"function",
"addCustomHeader",
"(",
"$",
"name",
",",
"$",
"value",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"value",
")",
"{",
"// Value passed in as name:value",
"$",
"this",
"->",
"CustomHeader",
"[",
"]",
"=",
"explode",
"(",
"... | Add a custom header.
$name value can be overloaded to contain
both header name and value (name:value).
@param string $name Custom header name
@param string|null $value Header value | [
"Add",
"a",
"custom",
"header",
".",
"$name",
"value",
"can",
"be",
"overloaded",
"to",
"contain",
"both",
"header",
"name",
"and",
"value",
"(",
"name",
":",
"value",
")",
"."
] | 3d7132341659a8a201adbc3ba11b1e202ee2857c | https://github.com/PHPMailer/PHPMailer/blob/3d7132341659a8a201adbc3ba11b1e202ee2857c/src/PHPMailer.php#L3733-L3741 | train | Add custom header | [
30522,
2270,
3853,
5587,
7874,
20389,
4974,
2121,
1006,
1002,
2171,
1010,
1002,
3643,
1027,
19701,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
1027,
1002,
3643,
1007,
1063,
1013,
1013,
3643,
2979,
1999,
2004,
2171,
1024,
3643,
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... |
walkor/Workerman | Worker.php | Worker.init | protected static function init()
{
set_error_handler(function($code, $msg, $file, $line){
Worker::safeEcho("$msg in file $file on line $line\n");
});
// Start file.
$backtrace = debug_backtrace();
static::$_startFile = $backtrace[count($backtrace) - 1]['file'];
$unique_prefix = str_replace('/', '_', static::$_startFile);
// Pid file.
if (empty(static::$pidFile)) {
static::$pidFile = __DIR__ . "/../$unique_prefix.pid";
}
// Log file.
if (empty(static::$logFile)) {
static::$logFile = __DIR__ . '/../workerman.log';
}
$log_file = (string)static::$logFile;
if (!is_file($log_file)) {
touch($log_file);
chmod($log_file, 0622);
}
// State.
static::$_status = static::STATUS_STARTING;
// For statistics.
static::$_globalStatistics['start_timestamp'] = time();
static::$_statisticsFile = sys_get_temp_dir() . "/$unique_prefix.status";
// Process title.
static::setProcessTitle('WorkerMan: master process start_file=' . static::$_startFile);
// Init data for worker id.
static::initId();
// Timer init.
Timer::init();
} | php | protected static function init()
{
set_error_handler(function($code, $msg, $file, $line){
Worker::safeEcho("$msg in file $file on line $line\n");
});
// Start file.
$backtrace = debug_backtrace();
static::$_startFile = $backtrace[count($backtrace) - 1]['file'];
$unique_prefix = str_replace('/', '_', static::$_startFile);
// Pid file.
if (empty(static::$pidFile)) {
static::$pidFile = __DIR__ . "/../$unique_prefix.pid";
}
// Log file.
if (empty(static::$logFile)) {
static::$logFile = __DIR__ . '/../workerman.log';
}
$log_file = (string)static::$logFile;
if (!is_file($log_file)) {
touch($log_file);
chmod($log_file, 0622);
}
// State.
static::$_status = static::STATUS_STARTING;
// For statistics.
static::$_globalStatistics['start_timestamp'] = time();
static::$_statisticsFile = sys_get_temp_dir() . "/$unique_prefix.status";
// Process title.
static::setProcessTitle('WorkerMan: master process start_file=' . static::$_startFile);
// Init data for worker id.
static::initId();
// Timer init.
Timer::init();
} | [
"protected",
"static",
"function",
"init",
"(",
")",
"{",
"set_error_handler",
"(",
"function",
"(",
"$",
"code",
",",
"$",
"msg",
",",
"$",
"file",
",",
"$",
"line",
")",
"{",
"Worker",
"::",
"safeEcho",
"(",
"\"$msg in file $file on line $line\\n\"",
")",
... | Init.
@return void | [
"Init",
"."
] | 13649907f05014fcfffcfccaef01e63ad3339351 | https://github.com/walkor/Workerman/blob/13649907f05014fcfffcfccaef01e63ad3339351/Worker.php#L535-L578 | train | Initializes the worker manager | [
30522,
5123,
10763,
3853,
1999,
4183,
1006,
1007,
1063,
2275,
1035,
7561,
1035,
28213,
1006,
3853,
1006,
1002,
3642,
1010,
1002,
5796,
2290,
1010,
1002,
5371,
1010,
1002,
2240,
1007,
1063,
7309,
1024,
1024,
3647,
15937,
2080,
1006,
1000,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Live/Visitor.php | Visitor.cleanVisitorDetails | public static function cleanVisitorDetails($visitorDetails)
{
if (Piwik::isUserIsAnonymous()) {
$toUnset = array(
'idvisitor',
'user_id',
'location_ip',
'config_id'
);
foreach ($toUnset as $keyName) {
if (isset($visitorDetails[$keyName])) {
unset($visitorDetails[$keyName]);
}
}
}
return $visitorDetails;
} | php | public static function cleanVisitorDetails($visitorDetails)
{
if (Piwik::isUserIsAnonymous()) {
$toUnset = array(
'idvisitor',
'user_id',
'location_ip',
'config_id'
);
foreach ($toUnset as $keyName) {
if (isset($visitorDetails[$keyName])) {
unset($visitorDetails[$keyName]);
}
}
}
return $visitorDetails;
} | [
"public",
"static",
"function",
"cleanVisitorDetails",
"(",
"$",
"visitorDetails",
")",
"{",
"if",
"(",
"Piwik",
"::",
"isUserIsAnonymous",
"(",
")",
")",
"{",
"$",
"toUnset",
"=",
"array",
"(",
"'idvisitor'",
",",
"'user_id'",
",",
"'location_ip'",
",",
"'c... | Removes fields that the user should only access if they are Super User or admin (cookie, IP,
md5 config "fingerprint" hash)
@param array $visitorDetails
@return array | [
"Removes",
"fields",
"that",
"the",
"user",
"should",
"only",
"access",
"if",
"they",
"are",
"Super",
"User",
"or",
"admin",
"(",
"cookie",
"IP",
"md5",
"config",
"fingerprint",
"hash",
")"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Live/Visitor.php#L155-L173 | train | Removes all visitor details that are not related to a user | [
30522,
2270,
10763,
3853,
4550,
11365,
15660,
3207,
22081,
1006,
1002,
10367,
3207,
22081,
1007,
1063,
2065,
1006,
14255,
9148,
2243,
1024,
1024,
2003,
20330,
29196,
16585,
27711,
1006,
1007,
1007,
1063,
1002,
2000,
4609,
13462,
1027,
9140,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/WebProfilerBundle/Profiler/TemplateManager.php | TemplateManager.templateExists | protected function templateExists($template)
{
$loader = $this->twig->getLoader();
if ($loader instanceof ExistsLoaderInterface) {
return $loader->exists($template);
}
try {
if ($loader instanceof SourceContextLoaderInterface || method_exists($loader, 'getSourceContext')) {
$loader->getSourceContext($template);
} else {
$loader->getSource($template);
}
return true;
} catch (LoaderError $e) {
}
return false;
} | php | protected function templateExists($template)
{
$loader = $this->twig->getLoader();
if ($loader instanceof ExistsLoaderInterface) {
return $loader->exists($template);
}
try {
if ($loader instanceof SourceContextLoaderInterface || method_exists($loader, 'getSourceContext')) {
$loader->getSourceContext($template);
} else {
$loader->getSource($template);
}
return true;
} catch (LoaderError $e) {
}
return false;
} | [
"protected",
"function",
"templateExists",
"(",
"$",
"template",
")",
"{",
"$",
"loader",
"=",
"$",
"this",
"->",
"twig",
"->",
"getLoader",
"(",
")",
";",
"if",
"(",
"$",
"loader",
"instanceof",
"ExistsLoaderInterface",
")",
"{",
"return",
"$",
"loader",
... | to be removed when the minimum required version of Twig is >= 2.0 | [
"to",
"be",
"removed",
"when",
"the",
"minimum",
"required",
"version",
"of",
"Twig",
"is",
">",
"=",
"2",
".",
"0"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/WebProfilerBundle/Profiler/TemplateManager.php#L100-L119 | train | Checks if a template exists | [
30522,
5123,
3853,
23561,
10288,
5130,
1006,
1002,
23561,
1007,
1063,
1002,
7170,
2121,
1027,
1002,
2023,
1011,
1028,
1056,
16279,
1011,
1028,
2131,
11066,
2121,
1006,
1007,
1025,
2065,
1006,
1002,
7170,
2121,
6013,
11253,
6526,
11066,
2328... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Console/Gpm/UninstallCommand.php | UninstallCommand.packageExists | private function packageExists($slug, $package)
{
$path = Grav::instance()['locator']->findResource($package->package_type . '://' . $slug);
Installer::isValidDestination($path);
return Installer::lastErrorCode();
} | php | private function packageExists($slug, $package)
{
$path = Grav::instance()['locator']->findResource($package->package_type . '://' . $slug);
Installer::isValidDestination($path);
return Installer::lastErrorCode();
} | [
"private",
"function",
"packageExists",
"(",
"$",
"slug",
",",
"$",
"package",
")",
"{",
"$",
"path",
"=",
"Grav",
"::",
"instance",
"(",
")",
"[",
"'locator'",
"]",
"->",
"findResource",
"(",
"$",
"package",
"->",
"package_type",
".",
"'://'",
".",
"$... | Check if package exists
@param string $slug
@param Package $package
@return int | [
"Check",
"if",
"package",
"exists"
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Console/Gpm/UninstallCommand.php#L289-L294 | train | Check if package exists | [
30522,
2797,
3853,
7427,
10288,
5130,
1006,
1002,
23667,
1010,
1002,
7427,
1007,
1063,
1002,
4130,
1027,
24665,
11431,
1024,
1024,
6013,
1006,
1007,
1031,
1005,
8840,
11266,
2953,
1005,
1033,
1011,
1028,
2424,
6072,
8162,
3401,
1006,
1002,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Database/Eloquent/Relations/MorphTo.php | MorphTo.associate | public function associate($model)
{
$this->parent->setAttribute(
$this->foreignKey, $model instanceof Model ? $model->getKey() : null
);
$this->parent->setAttribute(
$this->morphType, $model instanceof Model ? $model->getMorphClass() : null
);
return $this->parent->setRelation($this->relationName, $model);
} | php | public function associate($model)
{
$this->parent->setAttribute(
$this->foreignKey, $model instanceof Model ? $model->getKey() : null
);
$this->parent->setAttribute(
$this->morphType, $model instanceof Model ? $model->getMorphClass() : null
);
return $this->parent->setRelation($this->relationName, $model);
} | [
"public",
"function",
"associate",
"(",
"$",
"model",
")",
"{",
"$",
"this",
"->",
"parent",
"->",
"setAttribute",
"(",
"$",
"this",
"->",
"foreignKey",
",",
"$",
"model",
"instanceof",
"Model",
"?",
"$",
"model",
"->",
"getKey",
"(",
")",
":",
"null",... | Associate the model instance to the given parent.
@param \Illuminate\Database\Eloquent\Model $model
@return \Illuminate\Database\Eloquent\Model | [
"Associate",
"the",
"model",
"instance",
"to",
"the",
"given",
"parent",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Relations/MorphTo.php#L186-L197 | train | Associate a model with the parent model | [
30522,
2270,
3853,
5482,
1006,
1002,
2944,
1007,
1063,
1002,
2023,
1011,
1028,
6687,
1011,
1028,
2275,
19321,
3089,
8569,
2618,
1006,
1002,
2023,
1011,
1028,
3097,
14839,
1010,
1002,
2944,
6013,
11253,
2944,
1029,
1002,
2944,
1011,
1028,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/Zend/Mail/Part.php | Zend_Mail_Part.countParts | public function countParts()
{
if ($this->_countParts) {
return $this->_countParts;
}
$this->_countParts = count($this->_parts);
if ($this->_countParts) {
return $this->_countParts;
}
if ($this->_mail && $this->_mail->hasFetchPart) {
// TODO: fetch part
// return
}
$this->_cacheContent();
$this->_countParts = count($this->_parts);
return $this->_countParts;
} | php | public function countParts()
{
if ($this->_countParts) {
return $this->_countParts;
}
$this->_countParts = count($this->_parts);
if ($this->_countParts) {
return $this->_countParts;
}
if ($this->_mail && $this->_mail->hasFetchPart) {
// TODO: fetch part
// return
}
$this->_cacheContent();
$this->_countParts = count($this->_parts);
return $this->_countParts;
} | [
"public",
"function",
"countParts",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_countParts",
")",
"{",
"return",
"$",
"this",
"->",
"_countParts",
";",
"}",
"$",
"this",
"->",
"_countParts",
"=",
"count",
"(",
"$",
"this",
"->",
"_parts",
")",
";"... | Count parts of a multipart part
@return int number of sub-parts | [
"Count",
"parts",
"of",
"a",
"multipart",
"part"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Mail/Part.php#L276-L296 | train | Count parts of the message | [
30522,
2270,
3853,
4175,
26950,
1006,
1007,
1063,
2065,
1006,
1002,
2023,
1011,
1028,
1035,
4175,
26950,
1007,
1063,
2709,
1002,
2023,
1011,
1028,
1035,
4175,
26950,
1025,
1065,
1002,
2023,
1011,
1028,
1035,
4175,
26950,
1027,
4175,
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/Bundle/FrameworkBundle/Command/WorkflowDumpCommand.php | WorkflowDumpCommand.execute | protected function execute(InputInterface $input, OutputInterface $output)
{
$container = $this->getApplication()->getKernel()->getContainer();
$serviceId = $input->getArgument('name');
if ($container->has('workflow.'.$serviceId)) {
$workflow = $container->get('workflow.'.$serviceId);
$type = 'workflow';
} elseif ($container->has('state_machine.'.$serviceId)) {
$workflow = $container->get('state_machine.'.$serviceId);
$type = 'state_machine';
} else {
throw new InvalidArgumentException(sprintf('No service found for "workflow.%1$s" nor "state_machine.%1$s".', $serviceId));
}
if ('puml' === $input->getOption('dump-format')) {
$transitionType = 'workflow' === $type ? PlantUmlDumper::WORKFLOW_TRANSITION : PlantUmlDumper::STATEMACHINE_TRANSITION;
$dumper = new PlantUmlDumper($transitionType);
} elseif ('workflow' === $type) {
$dumper = new GraphvizDumper();
} else {
$dumper = new StateMachineGraphvizDumper();
}
$marking = new Marking();
foreach ($input->getArgument('marking') as $place) {
$marking->mark($place);
}
$options = [
'name' => $serviceId,
'nofooter' => true,
'graph' => [
'label' => $input->getOption('label'),
],
];
$output->writeln($dumper->dump($workflow->getDefinition(), $marking, $options));
} | php | protected function execute(InputInterface $input, OutputInterface $output)
{
$container = $this->getApplication()->getKernel()->getContainer();
$serviceId = $input->getArgument('name');
if ($container->has('workflow.'.$serviceId)) {
$workflow = $container->get('workflow.'.$serviceId);
$type = 'workflow';
} elseif ($container->has('state_machine.'.$serviceId)) {
$workflow = $container->get('state_machine.'.$serviceId);
$type = 'state_machine';
} else {
throw new InvalidArgumentException(sprintf('No service found for "workflow.%1$s" nor "state_machine.%1$s".', $serviceId));
}
if ('puml' === $input->getOption('dump-format')) {
$transitionType = 'workflow' === $type ? PlantUmlDumper::WORKFLOW_TRANSITION : PlantUmlDumper::STATEMACHINE_TRANSITION;
$dumper = new PlantUmlDumper($transitionType);
} elseif ('workflow' === $type) {
$dumper = new GraphvizDumper();
} else {
$dumper = new StateMachineGraphvizDumper();
}
$marking = new Marking();
foreach ($input->getArgument('marking') as $place) {
$marking->mark($place);
}
$options = [
'name' => $serviceId,
'nofooter' => true,
'graph' => [
'label' => $input->getOption('label'),
],
];
$output->writeln($dumper->dump($workflow->getDefinition(), $marking, $options));
} | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"$",
"container",
"=",
"$",
"this",
"->",
"getApplication",
"(",
")",
"->",
"getKernel",
"(",
")",
"->",
"getContainer",
"(",
")",
";"... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/FrameworkBundle/Command/WorkflowDumpCommand.php#L62-L100 | train | Dump the workflow definition | [
30522,
5123,
3853,
15389,
1006,
7953,
18447,
2121,
12172,
1002,
7953,
1010,
6434,
18447,
2121,
12172,
1002,
6434,
1007,
1063,
1002,
11661,
1027,
1002,
2023,
1011,
1028,
2131,
29098,
19341,
3508,
1006,
1007,
1011,
1028,
2131,
5484,
11877,
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/models/ImportModel.php | ImportModel.getImportFilePath | public function getImportFilePath($sessionKey = null)
{
$file = $this
->import_file()
->withDeferred($sessionKey)
->orderBy('id', 'desc')
->first()
;
if (!$file) {
return null;
}
return $file->getLocalPath();
} | php | public function getImportFilePath($sessionKey = null)
{
$file = $this
->import_file()
->withDeferred($sessionKey)
->orderBy('id', 'desc')
->first()
;
if (!$file) {
return null;
}
return $file->getLocalPath();
} | [
"public",
"function",
"getImportFilePath",
"(",
"$",
"sessionKey",
"=",
"null",
")",
"{",
"$",
"file",
"=",
"$",
"this",
"->",
"import_file",
"(",
")",
"->",
"withDeferred",
"(",
"$",
"sessionKey",
")",
"->",
"orderBy",
"(",
"'id'",
",",
"'desc'",
")",
... | Returns an attached imported file local path, if available.
@return string | [
"Returns",
"an",
"attached",
"imported",
"file",
"local",
"path",
"if",
"available",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/models/ImportModel.php#L193-L207 | train | Get Import File Path | [
30522,
2270,
3853,
2131,
5714,
6442,
8873,
2571,
15069,
1006,
1002,
5219,
14839,
1027,
19701,
1007,
1063,
1002,
5371,
1027,
1002,
2023,
1011,
1028,
12324,
1035,
5371,
1006,
1007,
1011,
1028,
2007,
3207,
7512,
5596,
1006,
1002,
5219,
14839,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Auth/SessionGuard.php | SessionGuard.setUser | public function setUser(AuthenticatableContract $user)
{
$this->user = $user;
$this->loggedOut = false;
$this->fireAuthenticatedEvent($user);
return $this;
} | php | public function setUser(AuthenticatableContract $user)
{
$this->user = $user;
$this->loggedOut = false;
$this->fireAuthenticatedEvent($user);
return $this;
} | [
"public",
"function",
"setUser",
"(",
"AuthenticatableContract",
"$",
"user",
")",
"{",
"$",
"this",
"->",
"user",
"=",
"$",
"user",
";",
"$",
"this",
"->",
"loggedOut",
"=",
"false",
";",
"$",
"this",
"->",
"fireAuthenticatedEvent",
"(",
"$",
"user",
")... | Set the current user.
@param \Illuminate\Contracts\Auth\Authenticatable $user
@return $this | [
"Set",
"the",
"current",
"user",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Auth/SessionGuard.php#L768-L777 | train | Set the user | [
30522,
2270,
3853,
2275,
20330,
1006,
14469,
27892,
8663,
6494,
6593,
1002,
5310,
1007,
1063,
1002,
2023,
1011,
1028,
5310,
1027,
1002,
5310,
1025,
1002,
2023,
1011,
1028,
26618,
5833,
1027,
6270,
1025,
1002,
2023,
1011,
1028,
2543,
4887,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/DomCrawler/Crawler.php | Crawler.extract | public function extract($attributes)
{
$attributes = (array) $attributes;
$count = \count($attributes);
$data = [];
foreach ($this->nodes as $node) {
$elements = [];
foreach ($attributes as $attribute) {
if ('_text' === $attribute) {
$elements[] = $node->nodeValue;
} elseif ('_name' === $attribute) {
$elements[] = $node->nodeName;
} else {
$elements[] = $node->getAttribute($attribute);
}
}
$data[] = 1 === $count ? $elements[0] : $elements;
}
return $data;
} | php | public function extract($attributes)
{
$attributes = (array) $attributes;
$count = \count($attributes);
$data = [];
foreach ($this->nodes as $node) {
$elements = [];
foreach ($attributes as $attribute) {
if ('_text' === $attribute) {
$elements[] = $node->nodeValue;
} elseif ('_name' === $attribute) {
$elements[] = $node->nodeName;
} else {
$elements[] = $node->getAttribute($attribute);
}
}
$data[] = 1 === $count ? $elements[0] : $elements;
}
return $data;
} | [
"public",
"function",
"extract",
"(",
"$",
"attributes",
")",
"{",
"$",
"attributes",
"=",
"(",
"array",
")",
"$",
"attributes",
";",
"$",
"count",
"=",
"\\",
"count",
"(",
"$",
"attributes",
")",
";",
"$",
"data",
"=",
"[",
"]",
";",
"foreach",
"(... | Extracts information from the list of nodes.
You can extract attributes or/and the node value (_text).
Example:
$crawler->filter('h1 a')->extract(['_text', 'href']);
@param array $attributes An array of attributes
@return array An array of extracted values | [
"Extracts",
"information",
"from",
"the",
"list",
"of",
"nodes",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DomCrawler/Crawler.php#L662-L684 | train | Extract the attributes from the nodes | [
30522,
2270,
3853,
14817,
1006,
1002,
12332,
1007,
1063,
1002,
12332,
1027,
1006,
9140,
1007,
1002,
12332,
1025,
1002,
4175,
1027,
1032,
4175,
1006,
1002,
12332,
1007,
1025,
1002,
2951,
1027,
1031,
1033,
1025,
18921,
6776,
1006,
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... |
matomo-org/matomo | core/CronArchive.php | CronArchive.request | private function request($url)
{
$url = $this->makeRequestUrl($url);
try {
$cliMulti = $this->makeCliMulti();
$responses = $cliMulti->request(array($url));
$response = !empty($responses) ? array_shift($responses) : null;
} catch (Exception $e) {
return $this->logNetworkError($url, $e->getMessage());
}
if ($this->checkResponse($response, $url)) {
return $response;
}
return false;
} | php | private function request($url)
{
$url = $this->makeRequestUrl($url);
try {
$cliMulti = $this->makeCliMulti();
$responses = $cliMulti->request(array($url));
$response = !empty($responses) ? array_shift($responses) : null;
} catch (Exception $e) {
return $this->logNetworkError($url, $e->getMessage());
}
if ($this->checkResponse($response, $url)) {
return $response;
}
return false;
} | [
"private",
"function",
"request",
"(",
"$",
"url",
")",
"{",
"$",
"url",
"=",
"$",
"this",
"->",
"makeRequestUrl",
"(",
"$",
"url",
")",
";",
"try",
"{",
"$",
"cliMulti",
"=",
"$",
"this",
"->",
"makeCliMulti",
"(",
")",
";",
"$",
"responses",
"=",... | Issues a request to $url eg. "?module=API&method=API.getDefaultMetricTranslations&format=original&serialize=1"
@param string $url
@return string | [
"Issues",
"a",
"request",
"to",
"$url",
"eg",
".",
"?module",
"=",
"API&method",
"=",
"API",
".",
"getDefaultMetricTranslations&format",
"=",
"original&serialize",
"=",
"1"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/CronArchive.php#L1100-L1116 | train | Request to the given url and return the response | [
30522,
2797,
3853,
5227,
1006,
1002,
24471,
2140,
1007,
1063,
1002,
24471,
2140,
1027,
1002,
2023,
1011,
1028,
9338,
2063,
15500,
3126,
2140,
1006,
1002,
24471,
2140,
1007,
1025,
3046,
1063,
1002,
18856,
5714,
11314,
2072,
1027,
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/Marshaller/DefaultMarshaller.php | DefaultMarshaller.unmarshall | public function unmarshall(string $value)
{
if ('b:0;' === $value) {
return false;
}
if ('N;' === $value) {
return null;
}
static $igbinaryNull;
if ($value === ($igbinaryNull ?? $igbinaryNull = \extension_loaded('igbinary') ? igbinary_serialize(null) : false)) {
return null;
}
$unserializeCallbackHandler = ini_set('unserialize_callback_func', __CLASS__.'::handleUnserializeCallback');
try {
if (':' === ($value[1] ?? ':')) {
if (false !== $value = unserialize($value)) {
return $value;
}
} elseif (false === $igbinaryNull) {
throw new \RuntimeException('Failed to unserialize values, did you forget to install the "igbinary" extension?');
} elseif (null !== $value = igbinary_unserialize($value)) {
return $value;
}
throw new \DomainException(error_get_last() ? error_get_last()['message'] : 'Failed to unserialize values.');
} catch (\Error $e) {
throw new \ErrorException($e->getMessage(), $e->getCode(), E_ERROR, $e->getFile(), $e->getLine());
} finally {
ini_set('unserialize_callback_func', $unserializeCallbackHandler);
}
} | php | public function unmarshall(string $value)
{
if ('b:0;' === $value) {
return false;
}
if ('N;' === $value) {
return null;
}
static $igbinaryNull;
if ($value === ($igbinaryNull ?? $igbinaryNull = \extension_loaded('igbinary') ? igbinary_serialize(null) : false)) {
return null;
}
$unserializeCallbackHandler = ini_set('unserialize_callback_func', __CLASS__.'::handleUnserializeCallback');
try {
if (':' === ($value[1] ?? ':')) {
if (false !== $value = unserialize($value)) {
return $value;
}
} elseif (false === $igbinaryNull) {
throw new \RuntimeException('Failed to unserialize values, did you forget to install the "igbinary" extension?');
} elseif (null !== $value = igbinary_unserialize($value)) {
return $value;
}
throw new \DomainException(error_get_last() ? error_get_last()['message'] : 'Failed to unserialize values.');
} catch (\Error $e) {
throw new \ErrorException($e->getMessage(), $e->getCode(), E_ERROR, $e->getFile(), $e->getLine());
} finally {
ini_set('unserialize_callback_func', $unserializeCallbackHandler);
}
} | [
"public",
"function",
"unmarshall",
"(",
"string",
"$",
"value",
")",
"{",
"if",
"(",
"'b:0;'",
"===",
"$",
"value",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"'N;'",
"===",
"$",
"value",
")",
"{",
"return",
"null",
";",
"}",
"static",
"$",... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Cache/Marshaller/DefaultMarshaller.php#L60-L90 | train | Unmarshall a string value | [
30522,
2270,
3853,
4895,
7849,
7377,
3363,
1006,
5164,
1002,
3643,
1007,
1063,
2065,
1006,
1005,
1038,
1024,
1014,
1025,
1005,
1027,
1027,
1027,
1002,
3643,
1007,
1063,
2709,
6270,
1025,
1065,
2065,
1006,
1005,
1050,
1025,
1005,
1027,
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... |
laravel/framework | src/Illuminate/Foundation/Console/EventListCommand.php | EventListCommand.handle | public function handle()
{
$events = $this->getEvents();
if (empty($events)) {
return $this->error("Your application doesn't have any events matching the given criteria.");
}
$this->table(['Event', 'Listeners'], $events);
} | php | public function handle()
{
$events = $this->getEvents();
if (empty($events)) {
return $this->error("Your application doesn't have any events matching the given criteria.");
}
$this->table(['Event', 'Listeners'], $events);
} | [
"public",
"function",
"handle",
"(",
")",
"{",
"$",
"events",
"=",
"$",
"this",
"->",
"getEvents",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"events",
")",
")",
"{",
"return",
"$",
"this",
"->",
"error",
"(",
"\"Your application doesn't have any event... | Execute the console command.
@return mixed | [
"Execute",
"the",
"console",
"command",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Foundation/Console/EventListCommand.php#L30-L39 | train | Handle the event | [
30522,
2270,
3853,
5047,
1006,
1007,
1063,
1002,
2824,
1027,
1002,
2023,
1011,
1028,
2131,
18697,
7666,
1006,
1007,
1025,
2065,
1006,
4064,
1006,
30524,
1996,
2445,
9181,
1012,
1000,
1007,
1025,
1065,
1002,
2023,
1011,
1028,
2795,
1006,
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/Queue/SqsQueue.php | SqsQueue.later | public function later($delay, $job, $data = '', $queue = null)
{
return $this->sqs->sendMessage([
'QueueUrl' => $this->getQueue($queue),
'MessageBody' => $this->createPayload($job, $queue ?: $this->default, $data),
'DelaySeconds' => $this->secondsUntil($delay),
])->get('MessageId');
} | php | public function later($delay, $job, $data = '', $queue = null)
{
return $this->sqs->sendMessage([
'QueueUrl' => $this->getQueue($queue),
'MessageBody' => $this->createPayload($job, $queue ?: $this->default, $data),
'DelaySeconds' => $this->secondsUntil($delay),
])->get('MessageId');
} | [
"public",
"function",
"later",
"(",
"$",
"delay",
",",
"$",
"job",
",",
"$",
"data",
"=",
"''",
",",
"$",
"queue",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"sqs",
"->",
"sendMessage",
"(",
"[",
"'QueueUrl'",
"=>",
"$",
"this",
"->",
"g... | Push a new job onto the queue after a delay.
@param \DateTimeInterface|\DateInterval|int $delay
@param string $job
@param mixed $data
@param string $queue
@return mixed | [
"Push",
"a",
"new",
"job",
"onto",
"the",
"queue",
"after",
"a",
"delay",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Queue/SqsQueue.php#L102-L109 | train | Send a message to the queue after a delay | [
30522,
2270,
3853,
2101,
1006,
1002,
8536,
1010,
1002,
3105,
1010,
1002,
2951,
1027,
1005,
1005,
1010,
1002,
24240,
1027,
19701,
1007,
1063,
2709,
1002,
2023,
1011,
1028,
5490,
2015,
1011,
1028,
4604,
7834,
3736,
3351,
1006,
1031,
1005,
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... |
getgrav/grav | system/src/Grav/Framework/Flex/Storage/SimpleStorage.php | SimpleStorage.hasKey | public function hasKey(string $key): bool
{
if (null === $this->data) {
$this->buildIndex();
}
return $key && strpos($key, '@@') === false && isset($this->data[$key]);
} | php | public function hasKey(string $key): bool
{
if (null === $this->data) {
$this->buildIndex();
}
return $key && strpos($key, '@@') === false && isset($this->data[$key]);
} | [
"public",
"function",
"hasKey",
"(",
"string",
"$",
"key",
")",
":",
"bool",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"data",
")",
"{",
"$",
"this",
"->",
"buildIndex",
"(",
")",
";",
"}",
"return",
"$",
"key",
"&&",
"strpos",
"(",
"$",
... | {@inheritdoc}
@see FlexStorageInterface::hasKey() | [
"{"
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Framework/Flex/Storage/SimpleStorage.php#L72-L79 | train | Has key? | [
30522,
2270,
3853,
2038,
14839,
1006,
5164,
1002,
3145,
1007,
1024,
22017,
2140,
1063,
2065,
1006,
19701,
1027,
1027,
1027,
1002,
2023,
1011,
1028,
2951,
1007,
1063,
1002,
2023,
1011,
1028,
3857,
22254,
10288,
1006,
1007,
1025,
1065,
2709,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
dompdf/dompdf | src/Adapter/PDFLib.php | PDFLib.open_object | public function open_object()
{
$this->_pdf->suspend_page("");
$ret = $this->_pdf->begin_template($this->_width, $this->_height);
$this->_pdf->save();
$this->_objs[$ret] = array("start_page" => $this->_page_number);
return $ret;
} | php | public function open_object()
{
$this->_pdf->suspend_page("");
$ret = $this->_pdf->begin_template($this->_width, $this->_height);
$this->_pdf->save();
$this->_objs[$ret] = array("start_page" => $this->_page_number);
return $ret;
} | [
"public",
"function",
"open_object",
"(",
")",
"{",
"$",
"this",
"->",
"_pdf",
"->",
"suspend_page",
"(",
"\"\"",
")",
";",
"$",
"ret",
"=",
"$",
"this",
"->",
"_pdf",
"->",
"begin_template",
"(",
"$",
"this",
"->",
"_width",
",",
"$",
"this",
"->",
... | Opens a new 'object' (template in PDFLib-speak)
While an object is open, all drawing actions are recorded to the
object instead of being drawn on the current page. Objects can
be added later to a specific page or to several pages.
The return value is an integer ID for the new object.
@see PDFLib::close_object()
@see PDFLib::add_object()
@return int | [
"Opens",
"a",
"new",
"object",
"(",
"template",
"in",
"PDFLib",
"-",
"speak",
")"
] | 75f13c700009be21a1965dc2c5b68a8708c22ba2 | https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/src/Adapter/PDFLib.php#L338-L346 | train | Open the template | [
30522,
2270,
3853,
2330,
1035,
4874,
1006,
1007,
1063,
1002,
2023,
1011,
1028,
1035,
11135,
1011,
1028,
28324,
1035,
3931,
1006,
1000,
1000,
1007,
1025,
1002,
2128,
2102,
1027,
1002,
2023,
1011,
1028,
1035,
11135,
1011,
1028,
4088,
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/PropertyInfo/Extractor/ReflectionExtractor.php | ReflectionExtractor.getAccessorMethod | private function getAccessorMethod(string $class, string $property): ?array
{
$ucProperty = ucfirst($property);
foreach ($this->accessorPrefixes as $prefix) {
try {
$reflectionMethod = new \ReflectionMethod($class, $prefix.$ucProperty);
if ($reflectionMethod->isStatic()) {
continue;
}
if (0 === $reflectionMethod->getNumberOfRequiredParameters()) {
return [$reflectionMethod, $prefix];
}
} catch (\ReflectionException $e) {
// Return null if the property doesn't exist
}
}
return null;
} | php | private function getAccessorMethod(string $class, string $property): ?array
{
$ucProperty = ucfirst($property);
foreach ($this->accessorPrefixes as $prefix) {
try {
$reflectionMethod = new \ReflectionMethod($class, $prefix.$ucProperty);
if ($reflectionMethod->isStatic()) {
continue;
}
if (0 === $reflectionMethod->getNumberOfRequiredParameters()) {
return [$reflectionMethod, $prefix];
}
} catch (\ReflectionException $e) {
// Return null if the property doesn't exist
}
}
return null;
} | [
"private",
"function",
"getAccessorMethod",
"(",
"string",
"$",
"class",
",",
"string",
"$",
"property",
")",
":",
"?",
"array",
"{",
"$",
"ucProperty",
"=",
"ucfirst",
"(",
"$",
"property",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"accessorPrefixes",
... | Gets the accessor method.
Returns an array with a the instance of \ReflectionMethod as first key
and the prefix of the method as second or null if not found. | [
"Gets",
"the",
"accessor",
"method",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php#L375-L395 | train | Returns the reflection method that is used by the class. | [
30522,
2797,
3853,
2131,
6305,
9623,
21748,
11368,
6806,
2094,
1006,
5164,
1002,
2465,
1010,
5164,
1002,
3200,
1007,
1024,
1029,
9140,
1063,
1002,
15384,
21572,
4842,
3723,
1027,
15384,
8873,
12096,
1006,
1002,
3200,
1007,
1025,
18921,
6776... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Database/Eloquent/Builder.php | Builder.find | public function find($id, $columns = ['*'])
{
if (is_array($id) || $id instanceof Arrayable) {
return $this->findMany($id, $columns);
}
return $this->whereKey($id)->first($columns);
} | php | public function find($id, $columns = ['*'])
{
if (is_array($id) || $id instanceof Arrayable) {
return $this->findMany($id, $columns);
}
return $this->whereKey($id)->first($columns);
} | [
"public",
"function",
"find",
"(",
"$",
"id",
",",
"$",
"columns",
"=",
"[",
"'*'",
"]",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"id",
")",
"||",
"$",
"id",
"instanceof",
"Arrayable",
")",
"{",
"return",
"$",
"this",
"->",
"findMany",
"(",
"$"... | Find a model by its primary key.
@param mixed $id
@param array $columns
@return \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Collection|static[]|static|null | [
"Find",
"a",
"model",
"by",
"its",
"primary",
"key",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Builder.php#L323-L330 | train | Find a record by its primary key or array of fields | [
30522,
2270,
3853,
2424,
1006,
1002,
8909,
1010,
1002,
7753,
1027,
1031,
1005,
1008,
1005,
1033,
1007,
1063,
2065,
1006,
2003,
1035,
9140,
1006,
1002,
8909,
1007,
1064,
1064,
1002,
8909,
6013,
11253,
9140,
3085,
1007,
1063,
2709,
1002,
20... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/backend/classes/NavigationManager.php | NavigationManager.isSideMenuItemActive | public function isSideMenuItemActive($item)
{
if ($this->contextSideMenuItemCode === true) {
$this->contextSideMenuItemCode = null;
return true;
}
return $this->contextOwner == $item->owner && $this->contextSideMenuItemCode == $item->code;
} | php | public function isSideMenuItemActive($item)
{
if ($this->contextSideMenuItemCode === true) {
$this->contextSideMenuItemCode = null;
return true;
}
return $this->contextOwner == $item->owner && $this->contextSideMenuItemCode == $item->code;
} | [
"public",
"function",
"isSideMenuItemActive",
"(",
"$",
"item",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"contextSideMenuItemCode",
"===",
"true",
")",
"{",
"$",
"this",
"->",
"contextSideMenuItemCode",
"=",
"null",
";",
"return",
"true",
";",
"}",
"return",
... | Determines if a side menu item is active.
@param mixed $item Specifies the item object.
@return boolean Returns true if the side item is active. | [
"Determines",
"if",
"a",
"side",
"menu",
"item",
"is",
"active",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/classes/NavigationManager.php#L435-L443 | train | Checks if a side menu item is active | [
30522,
2270,
3853,
26354,
5178,
3549,
14663,
14545,
15277,
1006,
1002,
8875,
1007,
1063,
2065,
1006,
1002,
2023,
1011,
1028,
18046,
5178,
3549,
14663,
6633,
16044,
1027,
1027,
1027,
2995,
1007,
1063,
1002,
2023,
1011,
1028,
18046,
5178,
354... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/PhpUnit/DeprecationErrorHandler/Deprecation.php | Deprecation.isLegacy | public function isLegacy($utilPrefix)
{
$test = $utilPrefix.'Test';
$class = $this->originatingClass();
$method = $this->originatingMethod();
return 0 === strpos($method, 'testLegacy')
|| 0 === strpos($method, 'provideLegacy')
|| 0 === strpos($method, 'getLegacy')
|| strpos($class, '\Legacy')
|| \in_array('legacy', $test::getGroups($class, $method), true);
} | php | public function isLegacy($utilPrefix)
{
$test = $utilPrefix.'Test';
$class = $this->originatingClass();
$method = $this->originatingMethod();
return 0 === strpos($method, 'testLegacy')
|| 0 === strpos($method, 'provideLegacy')
|| 0 === strpos($method, 'getLegacy')
|| strpos($class, '\Legacy')
|| \in_array('legacy', $test::getGroups($class, $method), true);
} | [
"public",
"function",
"isLegacy",
"(",
"$",
"utilPrefix",
")",
"{",
"$",
"test",
"=",
"$",
"utilPrefix",
".",
"'Test'",
";",
"$",
"class",
"=",
"$",
"this",
"->",
"originatingClass",
"(",
")",
";",
"$",
"method",
"=",
"$",
"this",
"->",
"originatingMet... | @param string $utilPrefix
@return bool | [
"@param",
"string",
"$utilPrefix"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/Deprecation.php#L146-L157 | train | return true if the class implements the legacy method | [
30522,
2270,
3853,
8842,
3654,
5666,
1006,
1002,
21183,
4014,
28139,
8873,
2595,
1007,
1063,
1002,
3231,
1027,
1002,
21183,
4014,
28139,
8873,
2595,
1012,
1005,
3231,
1005,
1025,
1002,
2465,
30524,
1027,
1027,
1027,
2358,
14536,
2891,
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/Routing/RouteCollectionBuilder.php | RouteCollectionBuilder.import | public function import($resource, $prefix = '/', $type = null)
{
/** @var RouteCollection[] $collections */
$collections = $this->load($resource, $type);
// create a builder from the RouteCollection
$builder = $this->createBuilder();
foreach ($collections as $collection) {
if (null === $collection) {
continue;
}
foreach ($collection->all() as $name => $route) {
$builder->addRoute($route, $name);
}
foreach ($collection->getResources() as $resource) {
$builder->addResource($resource);
}
}
// mount into this builder
$this->mount($prefix, $builder);
return $builder;
} | php | public function import($resource, $prefix = '/', $type = null)
{
/** @var RouteCollection[] $collections */
$collections = $this->load($resource, $type);
// create a builder from the RouteCollection
$builder = $this->createBuilder();
foreach ($collections as $collection) {
if (null === $collection) {
continue;
}
foreach ($collection->all() as $name => $route) {
$builder->addRoute($route, $name);
}
foreach ($collection->getResources() as $resource) {
$builder->addResource($resource);
}
}
// mount into this builder
$this->mount($prefix, $builder);
return $builder;
} | [
"public",
"function",
"import",
"(",
"$",
"resource",
",",
"$",
"prefix",
"=",
"'/'",
",",
"$",
"type",
"=",
"null",
")",
"{",
"/** @var RouteCollection[] $collections */",
"$",
"collections",
"=",
"$",
"this",
"->",
"load",
"(",
"$",
"resource",
",",
"$",... | Import an external routing resource and returns the RouteCollectionBuilder.
$routes->import('blog.yml', '/blog');
@param mixed $resource
@param string|null $prefix
@param string $type
@return self
@throws LoaderLoadException | [
"Import",
"an",
"external",
"routing",
"resource",
"and",
"returns",
"the",
"RouteCollectionBuilder",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Routing/RouteCollectionBuilder.php#L59-L85 | train | Import routes from a resource | [
30522,
2270,
3853,
12324,
1006,
1002,
7692,
1010,
1002,
17576,
1027,
1005,
1013,
1005,
1010,
1002,
2828,
1027,
19701,
1007,
1063,
1013,
1008,
1008,
1030,
13075,
2799,
26895,
18491,
1031,
1033,
1002,
6407,
1008,
1013,
1002,
6407,
1027,
1002,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getgrav/grav | system/src/Grav/Common/Config/CompiledLanguages.php | CompiledLanguages.loadFile | protected function loadFile($name, $filename)
{
$file = CompiledYamlFile::instance($filename);
if (preg_match('|languages\.yaml$|', $filename)) {
$this->object->mergeRecursive((array) $file->content());
} else {
$this->object->mergeRecursive([$name => $file->content()]);
}
$file->free();
} | php | protected function loadFile($name, $filename)
{
$file = CompiledYamlFile::instance($filename);
if (preg_match('|languages\.yaml$|', $filename)) {
$this->object->mergeRecursive((array) $file->content());
} else {
$this->object->mergeRecursive([$name => $file->content()]);
}
$file->free();
} | [
"protected",
"function",
"loadFile",
"(",
"$",
"name",
",",
"$",
"filename",
")",
"{",
"$",
"file",
"=",
"CompiledYamlFile",
"::",
"instance",
"(",
"$",
"filename",
")",
";",
"if",
"(",
"preg_match",
"(",
"'|languages\\.yaml$|'",
",",
"$",
"filename",
")",... | Load single configuration file and append it to the correct position.
@param string $name Name of the position.
@param string $filename File to be loaded. | [
"Load",
"single",
"configuration",
"file",
"and",
"append",
"it",
"to",
"the",
"correct",
"position",
"."
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Config/CompiledLanguages.php#L57-L66 | train | Load a language file into the object | [
30522,
5123,
3853,
7170,
8873,
2571,
1006,
1002,
2171,
1010,
1002,
5371,
18442,
1007,
1063,
1002,
5371,
1027,
9227,
14852,
10270,
9463,
1024,
1024,
6013,
1006,
1002,
5371,
18442,
1007,
1025,
2065,
1006,
3653,
2290,
1035,
2674,
1006,
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... |
z-song/laravel-admin | src/Form/Builder.php | Builder.getAction | public function getAction()
{
if ($this->action) {
return $this->action;
}
if ($this->isMode(static::MODE_EDIT)) {
return $this->form->resource().'/'.$this->id;
}
if ($this->isMode(static::MODE_CREATE)) {
return $this->form->resource(-1);
}
return '';
} | php | public function getAction()
{
if ($this->action) {
return $this->action;
}
if ($this->isMode(static::MODE_EDIT)) {
return $this->form->resource().'/'.$this->id;
}
if ($this->isMode(static::MODE_CREATE)) {
return $this->form->resource(-1);
}
return '';
} | [
"public",
"function",
"getAction",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"action",
")",
"{",
"return",
"$",
"this",
"->",
"action",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"isMode",
"(",
"static",
"::",
"MODE_EDIT",
")",
")",
"{",
"return",
... | Get Form action.
@return string | [
"Get",
"Form",
"action",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Form/Builder.php#L273-L288 | train | Get Action - String | [
30522,
2270,
3853,
2131,
18908,
3258,
1006,
1007,
1063,
2065,
1006,
1002,
2023,
1011,
1028,
2895,
1007,
1063,
2709,
1002,
2023,
1011,
1028,
2895,
1025,
1065,
2065,
1006,
1002,
2023,
1011,
1028,
2003,
5302,
3207,
1006,
10763,
1024,
1024,
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/Console/Scheduling/CacheSchedulingMutex.php | CacheSchedulingMutex.create | public function create(Event $event, DateTimeInterface $time)
{
return $this->cache->store($this->store)->add(
$event->mutexName().$time->format('Hi'), true, 3600
);
} | php | public function create(Event $event, DateTimeInterface $time)
{
return $this->cache->store($this->store)->add(
$event->mutexName().$time->format('Hi'), true, 3600
);
} | [
"public",
"function",
"create",
"(",
"Event",
"$",
"event",
",",
"DateTimeInterface",
"$",
"time",
")",
"{",
"return",
"$",
"this",
"->",
"cache",
"->",
"store",
"(",
"$",
"this",
"->",
"store",
")",
"->",
"add",
"(",
"$",
"event",
"->",
"mutexName",
... | Attempt to obtain a scheduling mutex for the given event.
@param \Illuminate\Console\Scheduling\Event $event
@param \DateTimeInterface $time
@return bool | [
"Attempt",
"to",
"obtain",
"a",
"scheduling",
"mutex",
"for",
"the",
"given",
"event",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Console/Scheduling/CacheSchedulingMutex.php#L42-L47 | train | Create a new entry in the cache | [
30522,
2270,
3853,
3443,
1006,
2724,
1002,
2724,
1010,
3058,
7292,
18447,
2121,
12172,
1002,
2051,
1007,
1063,
2709,
1002,
2023,
1011,
1028,
17053,
1011,
1028,
3573,
1006,
1002,
2023,
1011,
1028,
3573,
1007,
1011,
1028,
5587,
1006,
1002,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getgrav/grav | system/src/Grav/Common/Page/Page.php | Page.filter | public function filter()
{
$blueprints = $this->blueprints();
$values = $blueprints->filter($this->toArray());
if ($values && isset($values['header'])) {
$this->header($values['header']);
}
} | php | public function filter()
{
$blueprints = $this->blueprints();
$values = $blueprints->filter($this->toArray());
if ($values && isset($values['header'])) {
$this->header($values['header']);
}
} | [
"public",
"function",
"filter",
"(",
")",
"{",
"$",
"blueprints",
"=",
"$",
"this",
"->",
"blueprints",
"(",
")",
";",
"$",
"values",
"=",
"$",
"blueprints",
"->",
"filter",
"(",
"$",
"this",
"->",
"toArray",
"(",
")",
")",
";",
"if",
"(",
"$",
"... | Filter page header from illegal contents. | [
"Filter",
"page",
"header",
"from",
"illegal",
"contents",
"."
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L1138-L1145 | train | Filter the header array by the blueprints | [
30522,
2270,
3853,
11307,
1006,
1007,
1063,
1002,
2630,
16550,
2015,
1027,
1002,
2023,
1011,
1028,
2630,
16550,
2015,
1006,
1007,
1025,
1002,
5300,
1027,
1002,
2630,
16550,
2015,
1011,
1028,
11307,
1006,
1002,
2023,
1011,
1028,
2000,
2906,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
z-song/laravel-admin | src/Show/Field.php | Field.callExtendedField | protected function callExtendedField($abstract, $arguments = [])
{
if ($abstract instanceof \Closure) {
return $this->as($abstract);
}
if (is_string($abstract) && class_exists($abstract)) {
/** @var AbstractField $extend */
$extend = new $abstract();
}
if ($abstract instanceof AbstractField) {
/** @var AbstractField $extend */
$extend = $abstract;
}
if (!isset($extend)) {
admin_warning("[$abstract] is not a valid Show field.");
return $this;
}
if (!$extend->escape) {
$this->unescape();
}
$field = $this;
return $this->as(function ($value) use ($extend, $field, $arguments) {
if (!$extend->border) {
$field->border = false;
}
$extend->setValue($value)->setModel($this);
return $extend->render(...$arguments);
});
} | php | protected function callExtendedField($abstract, $arguments = [])
{
if ($abstract instanceof \Closure) {
return $this->as($abstract);
}
if (is_string($abstract) && class_exists($abstract)) {
/** @var AbstractField $extend */
$extend = new $abstract();
}
if ($abstract instanceof AbstractField) {
/** @var AbstractField $extend */
$extend = $abstract;
}
if (!isset($extend)) {
admin_warning("[$abstract] is not a valid Show field.");
return $this;
}
if (!$extend->escape) {
$this->unescape();
}
$field = $this;
return $this->as(function ($value) use ($extend, $field, $arguments) {
if (!$extend->border) {
$field->border = false;
}
$extend->setValue($value)->setModel($this);
return $extend->render(...$arguments);
});
} | [
"protected",
"function",
"callExtendedField",
"(",
"$",
"abstract",
",",
"$",
"arguments",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"$",
"abstract",
"instanceof",
"\\",
"Closure",
")",
"{",
"return",
"$",
"this",
"->",
"as",
"(",
"$",
"abstract",
")",
";",
... | Call extended field.
@param string|AbstractField|\Closure $abstract
@param array $arguments
@return Field | [
"Call",
"extended",
"field",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Show/Field.php#L477-L514 | train | Call extended field | [
30522,
5123,
3853,
2655,
10288,
6528,
5732,
3790,
1006,
1002,
10061,
1010,
1002,
9918,
1027,
1031,
1033,
1007,
1063,
2065,
1006,
1002,
10061,
6013,
11253,
1032,
8503,
1007,
1063,
2709,
1002,
2023,
1011,
1028,
2004,
1006,
1002,
10061,
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 | core/DataTable/Row.php | Row.sumRow | public function sumRow(Row $rowToSum, $enableCopyMetadata = true, $aggregationOperations = false)
{
foreach ($rowToSum as $columnToSumName => $columnToSumValue) {
if (!$this->isSummableColumn($columnToSumName)) {
continue;
}
$thisColumnValue = $this->getColumn($columnToSumName);
$operation = 'sum';
if (is_array($aggregationOperations) && isset($aggregationOperations[$columnToSumName])) {
if (is_string($aggregationOperations[$columnToSumName])) {
$operation = strtolower($aggregationOperations[$columnToSumName]);
} elseif (is_callable($aggregationOperations[$columnToSumName])) {
$operation = $aggregationOperations[$columnToSumName];
}
}
// max_actions is a core metric that is generated in ArchiveProcess_Day. Therefore, it can be
// present in any data table and is not part of the $aggregationOperations mechanism.
if ($columnToSumName == Metrics::INDEX_MAX_ACTIONS) {
$operation = 'max';
}
if (empty($operation)) {
throw new Exception("Unknown aggregation operation for column $columnToSumName.");
}
$newValue = $this->getColumnValuesMerged($operation, $thisColumnValue, $columnToSumValue, $this, $rowToSum, $columnToSumName);
$this->setColumn($columnToSumName, $newValue);
}
if ($enableCopyMetadata) {
$this->sumRowMetadata($rowToSum, $aggregationOperations);
}
} | php | public function sumRow(Row $rowToSum, $enableCopyMetadata = true, $aggregationOperations = false)
{
foreach ($rowToSum as $columnToSumName => $columnToSumValue) {
if (!$this->isSummableColumn($columnToSumName)) {
continue;
}
$thisColumnValue = $this->getColumn($columnToSumName);
$operation = 'sum';
if (is_array($aggregationOperations) && isset($aggregationOperations[$columnToSumName])) {
if (is_string($aggregationOperations[$columnToSumName])) {
$operation = strtolower($aggregationOperations[$columnToSumName]);
} elseif (is_callable($aggregationOperations[$columnToSumName])) {
$operation = $aggregationOperations[$columnToSumName];
}
}
// max_actions is a core metric that is generated in ArchiveProcess_Day. Therefore, it can be
// present in any data table and is not part of the $aggregationOperations mechanism.
if ($columnToSumName == Metrics::INDEX_MAX_ACTIONS) {
$operation = 'max';
}
if (empty($operation)) {
throw new Exception("Unknown aggregation operation for column $columnToSumName.");
}
$newValue = $this->getColumnValuesMerged($operation, $thisColumnValue, $columnToSumValue, $this, $rowToSum, $columnToSumName);
$this->setColumn($columnToSumName, $newValue);
}
if ($enableCopyMetadata) {
$this->sumRowMetadata($rowToSum, $aggregationOperations);
}
} | [
"public",
"function",
"sumRow",
"(",
"Row",
"$",
"rowToSum",
",",
"$",
"enableCopyMetadata",
"=",
"true",
",",
"$",
"aggregationOperations",
"=",
"false",
")",
"{",
"foreach",
"(",
"$",
"rowToSum",
"as",
"$",
"columnToSumName",
"=>",
"$",
"columnToSumValue",
... | Sums the given `$rowToSum` columns values to the existing row column values.
Only the int or float values will be summed. Label columns will be ignored
even if they have a numeric value.
Columns in `$rowToSum` that don't exist in `$this` are added to `$this`.
@param \Piwik\DataTable\Row $rowToSum The row to sum to this row.
@param bool $enableCopyMetadata Whether metadata should be copied or not.
@param array|bool $aggregationOperations for columns that should not be summed, determine which
aggregation should be used (min, max). format:
`array('column name' => 'function name')`
@throws Exception | [
"Sums",
"the",
"given",
"$rowToSum",
"columns",
"values",
"to",
"the",
"existing",
"row",
"column",
"values",
".",
"Only",
"the",
"int",
"or",
"float",
"values",
"will",
"be",
"summed",
".",
"Label",
"columns",
"will",
"be",
"ignored",
"even",
"if",
"they"... | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/DataTable/Row.php#L454-L489 | train | Sums a row of data into the current row. | [
30522,
2270,
3853,
7680,
10524,
1006,
5216,
1002,
5216,
13122,
2819,
1010,
1002,
9585,
3597,
7685,
11368,
8447,
2696,
1027,
2995,
1010,
1002,
28041,
25918,
10708,
1027,
6270,
1007,
1063,
18921,
6776,
1006,
1002,
5216,
13122,
2819,
2004,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/DomCrawler/Crawler.php | Crawler.filter | public function filter($selector)
{
$converter = $this->createCssSelectorConverter();
// The CssSelector already prefixes the selector with descendant-or-self::
return $this->filterRelativeXPath($converter->toXPath($selector));
} | php | public function filter($selector)
{
$converter = $this->createCssSelectorConverter();
// The CssSelector already prefixes the selector with descendant-or-self::
return $this->filterRelativeXPath($converter->toXPath($selector));
} | [
"public",
"function",
"filter",
"(",
"$",
"selector",
")",
"{",
"$",
"converter",
"=",
"$",
"this",
"->",
"createCssSelectorConverter",
"(",
")",
";",
"// The CssSelector already prefixes the selector with descendant-or-self::",
"return",
"$",
"this",
"->",
"filterRelat... | Filters the list of nodes with a CSS selector.
This method only works if you have installed the CssSelector Symfony Component.
@param string $selector A CSS selector
@return self
@throws \RuntimeException if the CssSelector Component is not available | [
"Filters",
"the",
"list",
"of",
"nodes",
"with",
"a",
"CSS",
"selector",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DomCrawler/Crawler.php#L721-L727 | train | Returns a filtered selector | [
30522,
2270,
3853,
11307,
1006,
1002,
27000,
1007,
1063,
1002,
10463,
2121,
1027,
1002,
2023,
1011,
1028,
3443,
6169,
21218,
22471,
2953,
8663,
16874,
2121,
1006,
1007,
1025,
1013,
1013,
1996,
20116,
21218,
22471,
2953,
2525,
17576,
2229,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Translation/DataCollectorTranslator.php | DataCollectorTranslator.getFallbackLocales | public function getFallbackLocales()
{
if ($this->translator instanceof Translator || method_exists($this->translator, 'getFallbackLocales')) {
return $this->translator->getFallbackLocales();
}
return [];
} | php | public function getFallbackLocales()
{
if ($this->translator instanceof Translator || method_exists($this->translator, 'getFallbackLocales')) {
return $this->translator->getFallbackLocales();
}
return [];
} | [
"public",
"function",
"getFallbackLocales",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"translator",
"instanceof",
"Translator",
"||",
"method_exists",
"(",
"$",
"this",
"->",
"translator",
",",
"'getFallbackLocales'",
")",
")",
"{",
"return",
"$",
"this",
... | Gets the fallback locales.
@return array The fallback locales | [
"Gets",
"the",
"fallback",
"locales",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Translation/DataCollectorTranslator.php#L119-L126 | train | Get fallback locales | [
30522,
2270,
3853,
2131,
13976,
5963,
4135,
9289,
2229,
1006,
1007,
30524,
1010,
1005,
2131,
13976,
5963,
4135,
9289,
2229,
1005,
1007,
1007,
1063,
2709,
1002,
2023,
1011,
1028,
11403,
1011,
1028,
2131,
13976,
5963,
4135,
9289,
2229,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/cms/classes/CodeParser.php | CodeParser.getCachedFileInfo | protected function getCachedFileInfo()
{
$cached = $this->getCachedInfo();
if ($cached !== null && array_key_exists($this->filePath, $cached)) {
return $cached[$this->filePath];
}
return null;
} | php | protected function getCachedFileInfo()
{
$cached = $this->getCachedInfo();
if ($cached !== null && array_key_exists($this->filePath, $cached)) {
return $cached[$this->filePath];
}
return null;
} | [
"protected",
"function",
"getCachedFileInfo",
"(",
")",
"{",
"$",
"cached",
"=",
"$",
"this",
"->",
"getCachedInfo",
"(",
")",
";",
"if",
"(",
"$",
"cached",
"!==",
"null",
"&&",
"array_key_exists",
"(",
"$",
"this",
"->",
"filePath",
",",
"$",
"cached",... | Returns information about a cached file
@return integer | [
"Returns",
"information",
"about",
"a",
"cached",
"file"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/CodeParser.php#L268-L277 | train | Get cached file info | [
30522,
5123,
3853,
2131,
3540,
7690,
8873,
19856,
14876,
1006,
1007,
1063,
1002,
17053,
2094,
1027,
1002,
2023,
1011,
1028,
2131,
3540,
7690,
2378,
14876,
1006,
1007,
1025,
2065,
1006,
1002,
17053,
2094,
999,
1027,
1027,
19701,
1004,
1004,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Auth/SessionGuard.php | SessionGuard.login | public function login(AuthenticatableContract $user, $remember = false)
{
$this->updateSession($user->getAuthIdentifier());
// If the user should be permanently "remembered" by the application we will
// queue a permanent cookie that contains the encrypted copy of the user
// identifier. We will then decrypt this later to retrieve the users.
if ($remember) {
$this->ensureRememberTokenIsSet($user);
$this->queueRecallerCookie($user);
}
// If we have an event dispatcher instance set we will fire an event so that
// any listeners will hook into the authentication events and run actions
// based on the login and logout events fired from the guard instances.
$this->fireLoginEvent($user, $remember);
$this->setUser($user);
} | php | public function login(AuthenticatableContract $user, $remember = false)
{
$this->updateSession($user->getAuthIdentifier());
// If the user should be permanently "remembered" by the application we will
// queue a permanent cookie that contains the encrypted copy of the user
// identifier. We will then decrypt this later to retrieve the users.
if ($remember) {
$this->ensureRememberTokenIsSet($user);
$this->queueRecallerCookie($user);
}
// If we have an event dispatcher instance set we will fire an event so that
// any listeners will hook into the authentication events and run actions
// based on the login and logout events fired from the guard instances.
$this->fireLoginEvent($user, $remember);
$this->setUser($user);
} | [
"public",
"function",
"login",
"(",
"AuthenticatableContract",
"$",
"user",
",",
"$",
"remember",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"updateSession",
"(",
"$",
"user",
"->",
"getAuthIdentifier",
"(",
")",
")",
";",
"// If the user should be permanently \... | Log a user into the application.
@param \Illuminate\Contracts\Auth\Authenticatable $user
@param bool $remember
@return void | [
"Log",
"a",
"user",
"into",
"the",
"application",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Auth/SessionGuard.php#L405-L424 | train | Log in the user | [
30522,
2270,
3853,
8833,
2378,
1006,
14469,
27892,
8663,
6494,
6593,
1002,
5310,
1010,
1002,
3342,
1027,
6270,
1007,
1063,
1002,
2023,
1011,
1028,
14409,
7971,
3258,
1006,
1002,
5310,
1011,
1028,
2131,
4887,
15222,
16454,
18095,
1006,
1007,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Database/Eloquent/Relations/MorphPivot.php | MorphPivot.setKeysForSaveQuery | protected function setKeysForSaveQuery(Builder $query)
{
$query->where($this->morphType, $this->morphClass);
return parent::setKeysForSaveQuery($query);
} | php | protected function setKeysForSaveQuery(Builder $query)
{
$query->where($this->morphType, $this->morphClass);
return parent::setKeysForSaveQuery($query);
} | [
"protected",
"function",
"setKeysForSaveQuery",
"(",
"Builder",
"$",
"query",
")",
"{",
"$",
"query",
"->",
"where",
"(",
"$",
"this",
"->",
"morphType",
",",
"$",
"this",
"->",
"morphClass",
")",
";",
"return",
"parent",
"::",
"setKeysForSaveQuery",
"(",
... | Set the keys for a save update query.
@param \Illuminate\Database\Eloquent\Builder $query
@return \Illuminate\Database\Eloquent\Builder | [
"Set",
"the",
"keys",
"for",
"a",
"save",
"update",
"query",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Relations/MorphPivot.php#L34-L39 | train | Set keys for save query | [
30522,
5123,
3853,
2275,
14839,
22747,
5668,
10696,
4226,
2854,
1006,
12508,
1002,
23032,
1007,
1063,
1002,
23032,
1011,
1028,
2073,
1006,
1002,
2023,
1011,
1028,
22822,
8458,
13874,
1010,
1002,
2023,
1011,
1028,
22822,
8458,
26266,
1007,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Serializer/Mapping/Loader/XmlFileLoader.php | XmlFileLoader.parseFile | private function parseFile($file)
{
try {
$dom = XmlUtils::loadFile($file, __DIR__.'/schema/dic/serializer-mapping/serializer-mapping-1.0.xsd');
} catch (\Exception $e) {
throw new MappingException($e->getMessage(), $e->getCode(), $e);
}
return simplexml_import_dom($dom);
} | php | private function parseFile($file)
{
try {
$dom = XmlUtils::loadFile($file, __DIR__.'/schema/dic/serializer-mapping/serializer-mapping-1.0.xsd');
} catch (\Exception $e) {
throw new MappingException($e->getMessage(), $e->getCode(), $e);
}
return simplexml_import_dom($dom);
} | [
"private",
"function",
"parseFile",
"(",
"$",
"file",
")",
"{",
"try",
"{",
"$",
"dom",
"=",
"XmlUtils",
"::",
"loadFile",
"(",
"$",
"file",
",",
"__DIR__",
".",
"'/schema/dic/serializer-mapping/serializer-mapping-1.0.xsd'",
")",
";",
"}",
"catch",
"(",
"\\",
... | Parses a XML File.
@param string $file Path of file
@return \SimpleXMLElement
@throws MappingException | [
"Parses",
"a",
"XML",
"File",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Serializer/Mapping/Loader/XmlFileLoader.php#L117-L126 | train | Parse a XML file | [
30522,
2797,
3853,
11968,
20106,
9463,
1006,
1002,
5371,
1007,
1063,
3046,
1063,
1002,
14383,
1027,
20950,
21823,
4877,
1024,
1024,
7170,
8873,
2571,
1006,
1002,
5371,
1010,
1035,
1035,
16101,
1035,
1035,
1012,
1005,
1013,
8040,
28433,
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... |
symfony/symfony | src/Symfony/Bundle/WebProfilerBundle/DependencyInjection/WebProfilerExtension.php | WebProfilerExtension.load | public function load(array $configs, ContainerBuilder $container)
{
$configuration = $this->getConfiguration($configs, $container);
$config = $this->processConfiguration($configuration, $configs);
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('profiler.xml');
if ($config['toolbar'] || $config['intercept_redirects']) {
$loader->load('toolbar.xml');
$container->getDefinition('web_profiler.debug_toolbar')->replaceArgument(4, $config['excluded_ajax_paths']);
$container->setParameter('web_profiler.debug_toolbar.intercept_redirects', $config['intercept_redirects']);
$container->setParameter('web_profiler.debug_toolbar.mode', $config['toolbar'] ? WebDebugToolbarListener::ENABLED : WebDebugToolbarListener::DISABLED);
}
if (Kernel::VERSION_ID >= 40008 || (Kernel::VERSION_ID >= 30408 && Kernel::VERSION_ID < 40000)) {
$container->getDefinition('debug.file_link_formatter')
->replaceArgument(3, new ServiceClosureArgument(new Reference('debug.file_link_formatter.url_format')));
}
} | php | public function load(array $configs, ContainerBuilder $container)
{
$configuration = $this->getConfiguration($configs, $container);
$config = $this->processConfiguration($configuration, $configs);
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('profiler.xml');
if ($config['toolbar'] || $config['intercept_redirects']) {
$loader->load('toolbar.xml');
$container->getDefinition('web_profiler.debug_toolbar')->replaceArgument(4, $config['excluded_ajax_paths']);
$container->setParameter('web_profiler.debug_toolbar.intercept_redirects', $config['intercept_redirects']);
$container->setParameter('web_profiler.debug_toolbar.mode', $config['toolbar'] ? WebDebugToolbarListener::ENABLED : WebDebugToolbarListener::DISABLED);
}
if (Kernel::VERSION_ID >= 40008 || (Kernel::VERSION_ID >= 30408 && Kernel::VERSION_ID < 40000)) {
$container->getDefinition('debug.file_link_formatter')
->replaceArgument(3, new ServiceClosureArgument(new Reference('debug.file_link_formatter.url_format')));
}
} | [
"public",
"function",
"load",
"(",
"array",
"$",
"configs",
",",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"configuration",
"=",
"$",
"this",
"->",
"getConfiguration",
"(",
"$",
"configs",
",",
"$",
"container",
")",
";",
"$",
"config",
"=",
"... | Loads the web profiler configuration.
@param array $configs An array of configuration settings
@param ContainerBuilder $container A ContainerBuilder instance | [
"Loads",
"the",
"web",
"profiler",
"configuration",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/WebProfilerBundle/DependencyInjection/WebProfilerExtension.php#L43-L62 | train | Load the configuration and the parameters | [
30522,
2270,
3853,
7170,
1006,
9140,
1002,
9530,
8873,
5620,
1010,
11661,
8569,
23891,
2099,
1002,
11661,
1007,
1063,
1002,
9563,
1027,
1002,
2023,
1011,
1028,
2131,
8663,
30524,
11066,
2121,
1006,
1002,
11661,
1010,
2047,
5371,
4135,
11266... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/EnvironmentDetector.php | EnvironmentDetector.detect | public function detect(Closure $callback, $consoleArgs = null)
{
if ($consoleArgs) {
return $this->detectConsoleEnvironment($callback, $consoleArgs);
}
return $this->detectWebEnvironment($callback);
} | php | public function detect(Closure $callback, $consoleArgs = null)
{
if ($consoleArgs) {
return $this->detectConsoleEnvironment($callback, $consoleArgs);
}
return $this->detectWebEnvironment($callback);
} | [
"public",
"function",
"detect",
"(",
"Closure",
"$",
"callback",
",",
"$",
"consoleArgs",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"consoleArgs",
")",
"{",
"return",
"$",
"this",
"->",
"detectConsoleEnvironment",
"(",
"$",
"callback",
",",
"$",
"consoleArgs"... | Detect the application's current environment.
@param \Closure $callback
@param array|null $consoleArgs
@return string | [
"Detect",
"the",
"application",
"s",
"current",
"environment",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Foundation/EnvironmentDetector.php#L18-L25 | train | Detects the current environment | [
30522,
2270,
3853,
11487,
1006,
8503,
1002,
2655,
5963,
1010,
1002,
10122,
2906,
5620,
1027,
19701,
1007,
1063,
2065,
1006,
1002,
10122,
2906,
5620,
1007,
1063,
2709,
1002,
2023,
1011,
1028,
11487,
8663,
19454,
12129,
21663,
2239,
3672,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterMappingsPass.php | RegisterMappingsPass.process | public function process(ContainerBuilder $container)
{
if (!$this->enabled($container)) {
return;
}
$mappingDriverDef = $this->getDriver($container);
$chainDriverDefService = $this->getChainDriverServiceName($container);
// Definition for a Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain
$chainDriverDef = $container->getDefinition($chainDriverDefService);
foreach ($this->namespaces as $namespace) {
$chainDriverDef->addMethodCall('addDriver', [$mappingDriverDef, $namespace]);
}
if (!\count($this->aliasMap)) {
return;
}
$configurationServiceName = $this->getConfigurationServiceName($container);
// Definition of the Doctrine\...\Configuration class specific to the Doctrine flavour.
$configurationServiceDefinition = $container->getDefinition($configurationServiceName);
foreach ($this->aliasMap as $alias => $namespace) {
$configurationServiceDefinition->addMethodCall($this->registerAliasMethodName, [$alias, $namespace]);
}
} | php | public function process(ContainerBuilder $container)
{
if (!$this->enabled($container)) {
return;
}
$mappingDriverDef = $this->getDriver($container);
$chainDriverDefService = $this->getChainDriverServiceName($container);
// Definition for a Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain
$chainDriverDef = $container->getDefinition($chainDriverDefService);
foreach ($this->namespaces as $namespace) {
$chainDriverDef->addMethodCall('addDriver', [$mappingDriverDef, $namespace]);
}
if (!\count($this->aliasMap)) {
return;
}
$configurationServiceName = $this->getConfigurationServiceName($container);
// Definition of the Doctrine\...\Configuration class specific to the Doctrine flavour.
$configurationServiceDefinition = $container->getDefinition($configurationServiceName);
foreach ($this->aliasMap as $alias => $namespace) {
$configurationServiceDefinition->addMethodCall($this->registerAliasMethodName, [$alias, $namespace]);
}
} | [
"public",
"function",
"process",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"enabled",
"(",
"$",
"container",
")",
")",
"{",
"return",
";",
"}",
"$",
"mappingDriverDef",
"=",
"$",
"this",
"->",
"getDriver",
... | Register mappings and alias with the metadata drivers. | [
"Register",
"mappings",
"and",
"alias",
"with",
"the",
"metadata",
"drivers",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterMappingsPass.php#L138-L162 | train | Adds the mapping driver and alias map to the chain driver. | [
30522,
2270,
3853,
2832,
1006,
11661,
8569,
23891,
2099,
1002,
11661,
1007,
1063,
2065,
1006,
999,
1002,
2023,
1011,
1028,
9124,
1006,
1002,
11661,
1007,
1007,
1063,
2709,
1025,
1065,
1002,
12375,
23663,
25547,
2546,
1027,
1002,
2023,
1011,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/HttpClient/Response/MockResponse.php | MockResponse.readResponse | private static function readResponse(self $response, array $options, ResponseInterface $mock, int &$offset)
{
$onProgress = $options['on_progress'] ?? static function () {};
// populate info related to headers
$info = $mock->getInfo() ?: [];
$response->info['http_code'] = ($info['http_code'] ?? 0) ?: $mock->getStatusCode(false) ?: 200;
$response->addResponseHeaders($info['response_headers'] ?? [], $response->info, $response->headers);
$dlSize = isset($response->headers['content-encoding']) ? 0 : (int) ($response->headers['content-length'][0] ?? 0);
$response->info = [
'start_time' => $response->info['start_time'],
'user_data' => $response->info['user_data'],
'http_code' => $response->info['http_code'],
] + $info + $response->info;
if (isset($response->info['total_time'])) {
$response->info['total_time'] = microtime(true) - $response->info['start_time'];
}
// "notify" headers arrival
$onProgress(0, $dlSize, $response->info);
// cast response body to activity list
$body = $mock instanceof self ? $mock->body : $mock->getContent(false);
if (!\is_string($body)) {
foreach ($body as $chunk) {
if ('' === $chunk = (string) $chunk) {
// simulate a timeout
$response->body[] = new ErrorChunk($offset);
} else {
$response->body[] = $chunk;
$offset += \strlen($chunk);
// "notify" download progress
$onProgress($offset, $dlSize, $response->info);
}
}
} elseif ('' !== $body) {
$response->body[] = $body;
$offset = \strlen($body);
}
if (isset($response->info['total_time'])) {
$response->info['total_time'] = microtime(true) - $response->info['start_time'];
}
// "notify" completion
$onProgress($offset, $dlSize, $response->info);
if ($dlSize && $offset !== $dlSize) {
throw new TransportException(sprintf('Transfer closed with %s bytes remaining to read.', $dlSize - $offset));
}
} | php | private static function readResponse(self $response, array $options, ResponseInterface $mock, int &$offset)
{
$onProgress = $options['on_progress'] ?? static function () {};
// populate info related to headers
$info = $mock->getInfo() ?: [];
$response->info['http_code'] = ($info['http_code'] ?? 0) ?: $mock->getStatusCode(false) ?: 200;
$response->addResponseHeaders($info['response_headers'] ?? [], $response->info, $response->headers);
$dlSize = isset($response->headers['content-encoding']) ? 0 : (int) ($response->headers['content-length'][0] ?? 0);
$response->info = [
'start_time' => $response->info['start_time'],
'user_data' => $response->info['user_data'],
'http_code' => $response->info['http_code'],
] + $info + $response->info;
if (isset($response->info['total_time'])) {
$response->info['total_time'] = microtime(true) - $response->info['start_time'];
}
// "notify" headers arrival
$onProgress(0, $dlSize, $response->info);
// cast response body to activity list
$body = $mock instanceof self ? $mock->body : $mock->getContent(false);
if (!\is_string($body)) {
foreach ($body as $chunk) {
if ('' === $chunk = (string) $chunk) {
// simulate a timeout
$response->body[] = new ErrorChunk($offset);
} else {
$response->body[] = $chunk;
$offset += \strlen($chunk);
// "notify" download progress
$onProgress($offset, $dlSize, $response->info);
}
}
} elseif ('' !== $body) {
$response->body[] = $body;
$offset = \strlen($body);
}
if (isset($response->info['total_time'])) {
$response->info['total_time'] = microtime(true) - $response->info['start_time'];
}
// "notify" completion
$onProgress($offset, $dlSize, $response->info);
if ($dlSize && $offset !== $dlSize) {
throw new TransportException(sprintf('Transfer closed with %s bytes remaining to read.', $dlSize - $offset));
}
} | [
"private",
"static",
"function",
"readResponse",
"(",
"self",
"$",
"response",
",",
"array",
"$",
"options",
",",
"ResponseInterface",
"$",
"mock",
",",
"int",
"&",
"$",
"offset",
")",
"{",
"$",
"onProgress",
"=",
"$",
"options",
"[",
"'on_progress'",
"]",... | Simulates reading the response. | [
"Simulates",
"reading",
"the",
"response",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpClient/Response/MockResponse.php#L237-L290 | train | Read the response and add it to activity list | [
30522,
2797,
10763,
3853,
3191,
6072,
26029,
3366,
1006,
2969,
1002,
3433,
1010,
9140,
1002,
7047,
1010,
3433,
18447,
2121,
12172,
1002,
12934,
1010,
20014,
1004,
1002,
16396,
1007,
1063,
1002,
2006,
21572,
17603,
4757,
1027,
1002,
7047,
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/HttpFoundation/Session/Storage/Handler/MemcachedSessionHandler.php | MemcachedSessionHandler.doDestroy | protected function doDestroy($sessionId)
{
$result = $this->memcached->delete($this->prefix.$sessionId);
return $result || \Memcached::RES_NOTFOUND == $this->memcached->getResultCode();
} | php | protected function doDestroy($sessionId)
{
$result = $this->memcached->delete($this->prefix.$sessionId);
return $result || \Memcached::RES_NOTFOUND == $this->memcached->getResultCode();
} | [
"protected",
"function",
"doDestroy",
"(",
"$",
"sessionId",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"memcached",
"->",
"delete",
"(",
"$",
"this",
"->",
"prefix",
".",
"$",
"sessionId",
")",
";",
"return",
"$",
"result",
"||",
"\\",
"Memcache... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcachedSessionHandler.php#L97-L102 | train | Destroy session - do destroy if session is not found | [
30522,
5123,
3853,
26489,
4355,
13238,
1006,
1002,
5219,
3593,
1007,
1063,
1002,
2765,
1027,
1002,
2023,
1011,
1028,
2033,
12458,
15395,
2094,
1011,
1028,
3972,
12870,
1006,
1002,
2023,
1011,
1028,
17576,
1012,
1002,
5219,
3593,
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/Form/Extension/Core/Type/LocaleType.php | LocaleType.loadChoiceList | public function loadChoiceList($value = null)
{
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use the "choice_loader" option instead.', __METHOD__), E_USER_DEPRECATED);
if (null !== $this->choiceList) {
return $this->choiceList;
}
return $this->choiceList = new ArrayChoiceList(array_flip(Locales::getNames()), $value);
} | php | public function loadChoiceList($value = null)
{
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use the "choice_loader" option instead.', __METHOD__), E_USER_DEPRECATED);
if (null !== $this->choiceList) {
return $this->choiceList;
}
return $this->choiceList = new ArrayChoiceList(array_flip(Locales::getNames()), $value);
} | [
"public",
"function",
"loadChoiceList",
"(",
"$",
"value",
"=",
"null",
")",
"{",
"@",
"trigger_error",
"(",
"sprintf",
"(",
"'The \"%s()\" method is deprecated since Symfony 4.1, use the \"choice_loader\" option instead.'",
",",
"__METHOD__",
")",
",",
"E_USER_DEPRECATED",
... | {@inheritdoc}
@deprecated since Symfony 4.1 | [
"{",
"@inheritdoc",
"}"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Extension/Core/Type/LocaleType.php#L78-L87 | train | Load the choice list | [
30522,
2270,
3853,
7170,
9905,
6610,
9863,
1006,
1002,
3643,
1027,
19701,
1007,
1063,
1030,
9495,
1035,
7561,
1006,
9043,
2546,
1006,
1005,
1996,
1000,
1003,
1055,
1006,
1007,
1000,
4118,
2003,
2139,
28139,
12921,
2144,
25353,
2213,
14876,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Translation/Translator.php | Translator.translate | public function translate($translationId, $args = array(), $language = null)
{
$args = is_array($args) ? $args : array($args);
if (strpos($translationId, "_") !== false) {
list($plugin, $key) = explode("_", $translationId, 2);
$language = is_string($language) ? $language : $this->currentLanguage;
$translationId = $this->getTranslation($translationId, $language, $plugin, $key);
}
if (count($args) == 0) {
return str_replace('%%', '%', $translationId);
}
return vsprintf($translationId, $args);
} | php | public function translate($translationId, $args = array(), $language = null)
{
$args = is_array($args) ? $args : array($args);
if (strpos($translationId, "_") !== false) {
list($plugin, $key) = explode("_", $translationId, 2);
$language = is_string($language) ? $language : $this->currentLanguage;
$translationId = $this->getTranslation($translationId, $language, $plugin, $key);
}
if (count($args) == 0) {
return str_replace('%%', '%', $translationId);
}
return vsprintf($translationId, $args);
} | [
"public",
"function",
"translate",
"(",
"$",
"translationId",
",",
"$",
"args",
"=",
"array",
"(",
")",
",",
"$",
"language",
"=",
"null",
")",
"{",
"$",
"args",
"=",
"is_array",
"(",
"$",
"args",
")",
"?",
"$",
"args",
":",
"array",
"(",
"$",
"a... | Returns an internationalized string using a translation ID. If a translation
cannot be found for the ID, the ID 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",
"ID",
".",
"If",
"a",
"translation",
"cannot",
"be",
"found",
"for",
"the",
"ID",
"the",
"ID",
"is",
"returned",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Translation/Translator.php#L75-L90 | train | Devuelve un translation de una peticion | [
30522,
2270,
3853,
17637,
1006,
1002,
5449,
3593,
1010,
1002,
12098,
5620,
1027,
9140,
1006,
1007,
1010,
1002,
2653,
1027,
19701,
1007,
1063,
1002,
12098,
5620,
1027,
2003,
1035,
9140,
1006,
1002,
12098,
5620,
1007,
1029,
1002,
12098,
5620,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getgrav/grav | system/src/Grav/Common/Data/Validation.php | Validation.typeCheckboxes | public static function typeCheckboxes($value, array $params, array $field)
{
// Set multiple: true so checkboxes can easily use min/max counts to control number of options required
$field['multiple'] = true;
return self::typeArray((array) $value, $params, $field);
} | php | public static function typeCheckboxes($value, array $params, array $field)
{
// Set multiple: true so checkboxes can easily use min/max counts to control number of options required
$field['multiple'] = true;
return self::typeArray((array) $value, $params, $field);
} | [
"public",
"static",
"function",
"typeCheckboxes",
"(",
"$",
"value",
",",
"array",
"$",
"params",
",",
"array",
"$",
"field",
")",
"{",
"// Set multiple: true so checkboxes can easily use min/max counts to control number of options required",
"$",
"field",
"[",
"'multiple'"... | Custom input: checkbox list
@param mixed $value Value to be validated.
@param array $params Validation parameters.
@param array $field Blueprint for the field.
@return bool True if validation succeeded. | [
"Custom",
"input",
":",
"checkbox",
"list"
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Data/Validation.php#L240-L246 | train | Type checkboxes | [
30522,
2270,
10763,
3853,
2828,
5403,
3600,
8758,
2229,
1006,
1002,
3643,
1010,
9140,
1002,
11498,
5244,
1010,
9140,
1002,
2492,
1007,
1063,
1013,
1013,
2275,
3674,
1024,
2995,
2061,
4638,
8758,
2229,
2064,
4089,
2224,
8117,
1013,
4098,
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... |
symfony/symfony | src/Symfony/Component/HttpFoundation/JsonResponse.php | JsonResponse.setData | public function setData($data = [])
{
try {
$data = json_encode($data, $this->encodingOptions);
} catch (\Exception $e) {
if ('Exception' === \get_class($e) && 0 === strpos($e->getMessage(), 'Failed calling ')) {
throw $e->getPrevious() ?: $e;
}
throw $e;
}
if (JSON_ERROR_NONE !== json_last_error()) {
throw new \InvalidArgumentException(json_last_error_msg());
}
return $this->setJson($data);
} | php | public function setData($data = [])
{
try {
$data = json_encode($data, $this->encodingOptions);
} catch (\Exception $e) {
if ('Exception' === \get_class($e) && 0 === strpos($e->getMessage(), 'Failed calling ')) {
throw $e->getPrevious() ?: $e;
}
throw $e;
}
if (JSON_ERROR_NONE !== json_last_error()) {
throw new \InvalidArgumentException(json_last_error_msg());
}
return $this->setJson($data);
} | [
"public",
"function",
"setData",
"(",
"$",
"data",
"=",
"[",
"]",
")",
"{",
"try",
"{",
"$",
"data",
"=",
"json_encode",
"(",
"$",
"data",
",",
"$",
"this",
"->",
"encodingOptions",
")",
";",
"}",
"catch",
"(",
"\\",
"Exception",
"$",
"e",
")",
"... | Sets the data to be sent as JSON.
@param mixed $data
@return $this
@throws \InvalidArgumentException | [
"Sets",
"the",
"data",
"to",
"be",
"sent",
"as",
"JSON",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpFoundation/JsonResponse.php#L140-L156 | train | Set the data in the json format | [
30522,
2270,
3853,
2275,
2850,
2696,
1006,
1002,
2951,
1027,
1031,
1033,
1007,
1063,
3046,
1063,
1002,
2951,
1027,
1046,
3385,
1035,
4372,
16044,
1006,
1002,
2951,
1010,
1002,
2023,
1011,
1028,
17181,
7361,
9285,
1007,
1025,
1065,
4608,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/HttpFoundation/ResponseHeaderBag.php | ResponseHeaderBag.replace | public function replace(array $headers = [])
{
$this->headerNames = [];
parent::replace($headers);
if (!isset($this->headers['cache-control'])) {
$this->set('Cache-Control', '');
}
if (!isset($this->headers['date'])) {
$this->initDate();
}
} | php | public function replace(array $headers = [])
{
$this->headerNames = [];
parent::replace($headers);
if (!isset($this->headers['cache-control'])) {
$this->set('Cache-Control', '');
}
if (!isset($this->headers['date'])) {
$this->initDate();
}
} | [
"public",
"function",
"replace",
"(",
"array",
"$",
"headers",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"headerNames",
"=",
"[",
"]",
";",
"parent",
"::",
"replace",
"(",
"$",
"headers",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpFoundation/ResponseHeaderBag.php#L73-L86 | train | Replace the headers with the values in the array | [
30522,
2270,
3853,
5672,
1006,
9140,
1002,
20346,
2015,
1027,
1031,
1033,
1007,
1063,
1002,
2023,
1011,
1028,
20346,
18442,
2015,
1027,
1031,
1033,
1025,
6687,
1024,
1024,
5672,
1006,
1002,
20346,
2015,
1007,
1025,
2065,
1006,
999,
26354,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Routing/MiddlewareNameResolver.php | MiddlewareNameResolver.parseMiddlewareGroup | protected static function parseMiddlewareGroup($name, $map, $middlewareGroups)
{
$results = [];
foreach ($middlewareGroups[$name] as $middleware) {
// If the middleware is another middleware group we will pull in the group and
// merge its middleware into the results. This allows groups to conveniently
// reference other groups without needing to repeat all their middlewares.
if (isset($middlewareGroups[$middleware])) {
$results = array_merge($results, static::parseMiddlewareGroup(
$middleware, $map, $middlewareGroups
));
continue;
}
[$middleware, $parameters] = array_pad(
explode(':', $middleware, 2), 2, null
);
// If this middleware is actually a route middleware, we will extract the full
// class name out of the middleware list now. Then we'll add the parameters
// back onto this class' name so the pipeline will properly extract them.
if (isset($map[$middleware])) {
$middleware = $map[$middleware];
}
$results[] = $middleware.($parameters ? ':'.$parameters : '');
}
return $results;
} | php | protected static function parseMiddlewareGroup($name, $map, $middlewareGroups)
{
$results = [];
foreach ($middlewareGroups[$name] as $middleware) {
// If the middleware is another middleware group we will pull in the group and
// merge its middleware into the results. This allows groups to conveniently
// reference other groups without needing to repeat all their middlewares.
if (isset($middlewareGroups[$middleware])) {
$results = array_merge($results, static::parseMiddlewareGroup(
$middleware, $map, $middlewareGroups
));
continue;
}
[$middleware, $parameters] = array_pad(
explode(':', $middleware, 2), 2, null
);
// If this middleware is actually a route middleware, we will extract the full
// class name out of the middleware list now. Then we'll add the parameters
// back onto this class' name so the pipeline will properly extract them.
if (isset($map[$middleware])) {
$middleware = $map[$middleware];
}
$results[] = $middleware.($parameters ? ':'.$parameters : '');
}
return $results;
} | [
"protected",
"static",
"function",
"parseMiddlewareGroup",
"(",
"$",
"name",
",",
"$",
"map",
",",
"$",
"middlewareGroups",
")",
"{",
"$",
"results",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"middlewareGroups",
"[",
"$",
"name",
"]",
"as",
"$",
"middlewa... | Parse the middleware group and format it for usage.
@param string $name
@param array $map
@param array $middlewareGroups
@return array | [
"Parse",
"the",
"middleware",
"group",
"and",
"format",
"it",
"for",
"usage",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Routing/MiddlewareNameResolver.php#L53-L84 | train | Parse the middleware group | [
30522,
5123,
10763,
3853,
11968,
3366,
4328,
20338,
8059,
17058,
1006,
1002,
2171,
1010,
1002,
4949,
1010,
1002,
2690,
8059,
17058,
2015,
1007,
1063,
1002,
3463,
1027,
1031,
1033,
1025,
18921,
6776,
1006,
1002,
2690,
8059,
17058,
2015,
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... |
matomo-org/matomo | plugins/CustomVariables/API.php | API.getCustomVariables | public function getCustomVariables($idSite, $period, $date, $segment = false, $expanded = false, $_leavePiwikCoreVariables = false, $flat = false)
{
Piwik::checkUserHasViewAccess($idSite);
$dataTable = $this->getDataTable($idSite, $period, $date, $segment, $expanded, $flat, $idSubtable = null);
if ($dataTable instanceof DataTable
&& !$_leavePiwikCoreVariables
) {
$mapping = self::getReservedCustomVariableKeys();
foreach ($mapping as $name) {
$row = $dataTable->getRowFromLabel($name);
if ($row) {
$dataTable->deleteRow($dataTable->getRowIdFromLabel($name));
}
}
}
if ($flat) {
$dataTable->filterSubtables('Piwik\Plugins\CustomVariables\DataTable\Filter\CustomVariablesValuesFromNameId');
} else {
$dataTable->filter('AddSegmentByLabel', array('customVariableName'));
}
return $dataTable;
} | php | public function getCustomVariables($idSite, $period, $date, $segment = false, $expanded = false, $_leavePiwikCoreVariables = false, $flat = false)
{
Piwik::checkUserHasViewAccess($idSite);
$dataTable = $this->getDataTable($idSite, $period, $date, $segment, $expanded, $flat, $idSubtable = null);
if ($dataTable instanceof DataTable
&& !$_leavePiwikCoreVariables
) {
$mapping = self::getReservedCustomVariableKeys();
foreach ($mapping as $name) {
$row = $dataTable->getRowFromLabel($name);
if ($row) {
$dataTable->deleteRow($dataTable->getRowIdFromLabel($name));
}
}
}
if ($flat) {
$dataTable->filterSubtables('Piwik\Plugins\CustomVariables\DataTable\Filter\CustomVariablesValuesFromNameId');
} else {
$dataTable->filter('AddSegmentByLabel', array('customVariableName'));
}
return $dataTable;
} | [
"public",
"function",
"getCustomVariables",
"(",
"$",
"idSite",
",",
"$",
"period",
",",
"$",
"date",
",",
"$",
"segment",
"=",
"false",
",",
"$",
"expanded",
"=",
"false",
",",
"$",
"_leavePiwikCoreVariables",
"=",
"false",
",",
"$",
"flat",
"=",
"false... | @param int $idSite
@param string $period
@param Date $date
@param string|bool $segment
@param bool $expanded
@param bool $_leavePiwikCoreVariables
@param bool $flat
@return DataTable|DataTable\Map | [
"@param",
"int",
"$idSite",
"@param",
"string",
"$period",
"@param",
"Date",
"$date",
"@param",
"string|bool",
"$segment",
"@param",
"bool",
"$expanded",
"@param",
"bool",
"$_leavePiwikCoreVariables",
"@param",
"bool",
"$flat"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/CustomVariables/API.php#L61-L87 | train | Get the DataTable of the custom variables | [
30522,
2270,
3853,
2131,
7874,
20389,
10755,
19210,
2015,
1006,
1002,
8909,
28032,
2063,
1010,
1002,
2558,
1010,
1002,
3058,
1010,
1002,
6903,
1027,
6270,
1010,
1002,
4423,
1027,
6270,
1010,
1002,
1035,
2681,
8197,
9148,
2243,
17345,
10755,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/VarDumper/Cloner/AbstractCloner.php | AbstractCloner.castObject | protected function castObject(Stub $stub, $isNested)
{
$obj = $stub->value;
$class = $stub->class;
if (isset($class[15]) && "\0" === $class[15] && 0 === strpos($class, "class@anonymous\x00")) {
$stub->class = get_parent_class($class).'@anonymous';
}
if (isset($this->classInfo[$class])) {
list($i, $parents, $hasDebugInfo, $fileInfo) = $this->classInfo[$class];
} else {
$i = 2;
$parents = [$class];
$hasDebugInfo = method_exists($class, '__debugInfo');
foreach (class_parents($class) as $p) {
$parents[] = $p;
++$i;
}
foreach (class_implements($class) as $p) {
$parents[] = $p;
++$i;
}
$parents[] = '*';
$r = new \ReflectionClass($class);
$fileInfo = $r->isInternal() || $r->isSubclassOf(Stub::class) ? [] : [
'file' => $r->getFileName(),
'line' => $r->getStartLine(),
];
$this->classInfo[$class] = [$i, $parents, $hasDebugInfo, $fileInfo];
}
$stub->attr += $fileInfo;
$a = Caster::castObject($obj, $class, $hasDebugInfo);
try {
while ($i--) {
if (!empty($this->casters[$p = $parents[$i]])) {
foreach ($this->casters[$p] as $callback) {
$a = $callback($obj, $a, $stub, $isNested, $this->filter);
}
}
}
} catch (\Exception $e) {
$a = [(Stub::TYPE_OBJECT === $stub->type ? Caster::PREFIX_VIRTUAL : '').'⚠' => new ThrowingCasterException($e)] + $a;
}
return $a;
} | php | protected function castObject(Stub $stub, $isNested)
{
$obj = $stub->value;
$class = $stub->class;
if (isset($class[15]) && "\0" === $class[15] && 0 === strpos($class, "class@anonymous\x00")) {
$stub->class = get_parent_class($class).'@anonymous';
}
if (isset($this->classInfo[$class])) {
list($i, $parents, $hasDebugInfo, $fileInfo) = $this->classInfo[$class];
} else {
$i = 2;
$parents = [$class];
$hasDebugInfo = method_exists($class, '__debugInfo');
foreach (class_parents($class) as $p) {
$parents[] = $p;
++$i;
}
foreach (class_implements($class) as $p) {
$parents[] = $p;
++$i;
}
$parents[] = '*';
$r = new \ReflectionClass($class);
$fileInfo = $r->isInternal() || $r->isSubclassOf(Stub::class) ? [] : [
'file' => $r->getFileName(),
'line' => $r->getStartLine(),
];
$this->classInfo[$class] = [$i, $parents, $hasDebugInfo, $fileInfo];
}
$stub->attr += $fileInfo;
$a = Caster::castObject($obj, $class, $hasDebugInfo);
try {
while ($i--) {
if (!empty($this->casters[$p = $parents[$i]])) {
foreach ($this->casters[$p] as $callback) {
$a = $callback($obj, $a, $stub, $isNested, $this->filter);
}
}
}
} catch (\Exception $e) {
$a = [(Stub::TYPE_OBJECT === $stub->type ? Caster::PREFIX_VIRTUAL : '').'⚠' => new ThrowingCasterException($e)] + $a;
}
return $a;
} | [
"protected",
"function",
"castObject",
"(",
"Stub",
"$",
"stub",
",",
"$",
"isNested",
")",
"{",
"$",
"obj",
"=",
"$",
"stub",
"->",
"value",
";",
"$",
"class",
"=",
"$",
"stub",
"->",
"class",
";",
"if",
"(",
"isset",
"(",
"$",
"class",
"[",
"15... | Casts an object to an array representation.
@param Stub $stub The Stub for the casted object
@param bool $isNested True if the object is nested in the dumped structure
@return array The object casted as array | [
"Casts",
"an",
"object",
"to",
"an",
"array",
"representation",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/VarDumper/Cloner/AbstractCloner.php#L284-L334 | train | Casts an object to its class | [
30522,
5123,
3853,
3459,
16429,
20614,
1006,
24646,
2497,
1002,
24646,
2497,
1010,
1002,
3475,
17944,
1007,
1063,
1002,
27885,
3501,
1027,
1002,
24646,
2497,
1011,
1028,
3643,
1025,
1002,
2465,
1027,
1002,
24646,
2497,
1011,
1028,
2465,
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... |
matomo-org/matomo | core/Plugin/Manager.php | Manager.installLoadedPlugins | public function installLoadedPlugins()
{
Log::debug("Loaded plugins: " . implode(", ", array_keys($this->getLoadedPlugins())));
foreach ($this->getLoadedPlugins() as $plugin) {
$this->installPluginIfNecessary($plugin);
}
} | php | public function installLoadedPlugins()
{
Log::debug("Loaded plugins: " . implode(", ", array_keys($this->getLoadedPlugins())));
foreach ($this->getLoadedPlugins() as $plugin) {
$this->installPluginIfNecessary($plugin);
}
} | [
"public",
"function",
"installLoadedPlugins",
"(",
")",
"{",
"Log",
"::",
"debug",
"(",
"\"Loaded plugins: \"",
".",
"implode",
"(",
"\", \"",
",",
"array_keys",
"(",
"$",
"this",
"->",
"getLoadedPlugins",
"(",
")",
")",
")",
")",
";",
"foreach",
"(",
"$",... | Install loaded plugins
@throws
@return array Error messages of plugin install fails | [
"Install",
"loaded",
"plugins"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Plugin/Manager.php#L620-L627 | train | Install all loaded plugins | [
30522,
2270,
3853,
16500,
17468,
24759,
15916,
7076,
1006,
1007,
1063,
8833,
1024,
1024,
2139,
8569,
2290,
1006,
1000,
8209,
13354,
7076,
1024,
1000,
1012,
17727,
4135,
3207,
1006,
1000,
1010,
1000,
1010,
9140,
1035,
6309,
1006,
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... |
matomo-org/matomo | core/Site.php | Site.getCurrencySymbolFor | public static function getCurrencySymbolFor($idsite)
{
$currencyCode = self::getCurrencyFor($idsite);
$key = 'Intl_CurrencySymbol_' . $currencyCode;
$symbol = Piwik::translate($key);
if ($key === $symbol) {
return $currencyCode;
}
return $symbol;
} | php | public static function getCurrencySymbolFor($idsite)
{
$currencyCode = self::getCurrencyFor($idsite);
$key = 'Intl_CurrencySymbol_' . $currencyCode;
$symbol = Piwik::translate($key);
if ($key === $symbol) {
return $currencyCode;
}
return $symbol;
} | [
"public",
"static",
"function",
"getCurrencySymbolFor",
"(",
"$",
"idsite",
")",
"{",
"$",
"currencyCode",
"=",
"self",
"::",
"getCurrencyFor",
"(",
"$",
"idsite",
")",
";",
"$",
"key",
"=",
"'Intl_CurrencySymbol_'",
".",
"$",
"currencyCode",
";",
"$",
"symb... | Returns the currency of the site with the specified ID.
@param int $idsite The site ID.
@return string | [
"Returns",
"the",
"currency",
"of",
"the",
"site",
"with",
"the",
"specified",
"ID",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Site.php#L620-L631 | train | Returns the currency symbol for the given ID. | [
30522,
30524,
1002,
3145,
1027,
1005,
20014,
2140,
1035,
9598,
6508,
13344,
2140,
1035,
1005,
1012,
1002,
9598,
16044,
1025,
1002,
6454,
1027,
14255,
9148,
2243,
1024,
1024,
17637,
1006,
1002,
3145,
1007,
1025,
2065,
1006,
1002,
3145,
1027,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/Zend/Db/Adapter/Pdo/Abstract.php | Zend_Db_Adapter_Pdo_Abstract.exec | public function exec($sql)
{
if ($sql instanceof Zend_Db_Select) {
$sql = $sql->assemble();
}
try {
$affected = $this->getConnection()->exec($sql);
if ($affected === false) {
$errorInfo = $this->getConnection()->errorInfo();
/**
* @see Zend_Db_Adapter_Exception
*/
// require_once 'Zend/Db/Adapter/Exception.php';
throw new Zend_Db_Adapter_Exception($errorInfo[2]);
}
return $affected;
} catch (PDOException $e) {
/**
* @see Zend_Db_Adapter_Exception
*/
// require_once 'Zend/Db/Adapter/Exception.php';
throw new Zend_Db_Adapter_Exception($e->getMessage(), $e->getCode(), $e);
}
} | php | public function exec($sql)
{
if ($sql instanceof Zend_Db_Select) {
$sql = $sql->assemble();
}
try {
$affected = $this->getConnection()->exec($sql);
if ($affected === false) {
$errorInfo = $this->getConnection()->errorInfo();
/**
* @see Zend_Db_Adapter_Exception
*/
// require_once 'Zend/Db/Adapter/Exception.php';
throw new Zend_Db_Adapter_Exception($errorInfo[2]);
}
return $affected;
} catch (PDOException $e) {
/**
* @see Zend_Db_Adapter_Exception
*/
// require_once 'Zend/Db/Adapter/Exception.php';
throw new Zend_Db_Adapter_Exception($e->getMessage(), $e->getCode(), $e);
}
} | [
"public",
"function",
"exec",
"(",
"$",
"sql",
")",
"{",
"if",
"(",
"$",
"sql",
"instanceof",
"Zend_Db_Select",
")",
"{",
"$",
"sql",
"=",
"$",
"sql",
"->",
"assemble",
"(",
")",
";",
"}",
"try",
"{",
"$",
"affected",
"=",
"$",
"this",
"->",
"get... | Executes an SQL statement and return the number of affected rows
@param mixed $sql The SQL statement with placeholders.
May be a string or Zend_Db_Select.
@return integer Number of rows that were modified
or deleted by the SQL statement | [
"Executes",
"an",
"SQL",
"statement",
"and",
"return",
"the",
"number",
"of",
"affected",
"rows"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Adapter/Pdo/Abstract.php#L256-L282 | train | Execute a statement and return the number of affected rows | [
30522,
2270,
3853,
4654,
8586,
1006,
1002,
29296,
1007,
1063,
2065,
1006,
1002,
29296,
6013,
11253,
16729,
2094,
1035,
16962,
1035,
7276,
1007,
1063,
1002,
29296,
1027,
1002,
29296,
1011,
1028,
21365,
1006,
1007,
1025,
1065,
3046,
1063,
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/Adapter/GD.php | GD.get_font_height | public function get_font_height($font, $size)
{
$size = $this->_upscale($size) * self::FONT_SCALE;
$height = $this->get_font_height_actual($font, $size);
return $this->_downscale($height);
} | php | public function get_font_height($font, $size)
{
$size = $this->_upscale($size) * self::FONT_SCALE;
$height = $this->get_font_height_actual($font, $size);
return $this->_downscale($height);
} | [
"public",
"function",
"get_font_height",
"(",
"$",
"font",
",",
"$",
"size",
")",
"{",
"$",
"size",
"=",
"$",
"this",
"->",
"_upscale",
"(",
"$",
"size",
")",
"*",
"self",
"::",
"FONT_SCALE",
";",
"$",
"height",
"=",
"$",
"this",
"->",
"get_font_heig... | Calculates font height, in points
@param string $font
@param float $size
@return float | [
"Calculates",
"font",
"height",
"in",
"points"
] | 75f13c700009be21a1965dc2c5b68a8708c22ba2 | https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/src/Adapter/GD.php#L911-L918 | train | Return the actual font height for a given font and size | [
30522,
2270,
3853,
2131,
1035,
15489,
1035,
4578,
1006,
1002,
15489,
1010,
1002,
2946,
1007,
1063,
1002,
2946,
1027,
1002,
2023,
1011,
1028,
1035,
28276,
1006,
1002,
2946,
1007,
1008,
2969,
1024,
1024,
15489,
1035,
4094,
1025,
1002,
4578,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/DomCrawler/Crawler.php | Crawler.nextAll | public function nextAll()
{
if (!$this->nodes) {
throw new \InvalidArgumentException('The current node list is empty.');
}
return $this->createSubCrawler($this->sibling($this->getNode(0)));
} | php | public function nextAll()
{
if (!$this->nodes) {
throw new \InvalidArgumentException('The current node list is empty.');
}
return $this->createSubCrawler($this->sibling($this->getNode(0)));
} | [
"public",
"function",
"nextAll",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"nodes",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'The current node list is empty.'",
")",
";",
"}",
"return",
"$",
"this",
"->",
"createSubCrawler",
... | Returns the next siblings nodes of the current selection.
@return self
@throws \InvalidArgumentException When current node is empty | [
"Returns",
"the",
"next",
"siblings",
"nodes",
"of",
"the",
"current",
"selection",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DomCrawler/Crawler.php#L442-L449 | train | Get next sibling node list | [
30522,
2270,
3853,
2279,
8095,
1006,
1007,
1063,
2065,
1006,
999,
1002,
2023,
1011,
1028,
14164,
1007,
1063,
5466,
2047,
1032,
19528,
2906,
22850,
15781,
2595,
24422,
1006,
1005,
1996,
2783,
13045,
2862,
2003,
4064,
1012,
1005,
1007,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/Zend/Cache/Frontend/File.php | Zend_Cache_Frontend_File.load | public function load($id, $doNotTestCacheValidity = false, $doNotUnserialize = false)
{
if (!$doNotTestCacheValidity) {
if ($this->test($id)) {
return parent::load($id, true, $doNotUnserialize);
}
return false;
}
return parent::load($id, true, $doNotUnserialize);
} | php | public function load($id, $doNotTestCacheValidity = false, $doNotUnserialize = false)
{
if (!$doNotTestCacheValidity) {
if ($this->test($id)) {
return parent::load($id, true, $doNotUnserialize);
}
return false;
}
return parent::load($id, true, $doNotUnserialize);
} | [
"public",
"function",
"load",
"(",
"$",
"id",
",",
"$",
"doNotTestCacheValidity",
"=",
"false",
",",
"$",
"doNotUnserialize",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"$",
"doNotTestCacheValidity",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"test",
"(",
"$... | Test if a cache is available for the given id and (if yes) return it (false else)
@param string $id Cache id
@param boolean $doNotTestCacheValidity If set to true, the cache validity won't be tested
@param boolean $doNotUnserialize Do not serialize (even if automatic_serialization is true) => for internal use
@return mixed|false Cached datas | [
"Test",
"if",
"a",
"cache",
"is",
"available",
"for",
"the",
"given",
"id",
"and",
"(",
"if",
"yes",
")",
"return",
"it",
"(",
"false",
"else",
")"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Cache/Frontend/File.php#L175-L184 | train | Load an xsd from the cache | [
30522,
2270,
3853,
7170,
1006,
1002,
8909,
1010,
1002,
2123,
28495,
3367,
3540,
16179,
11475,
25469,
1027,
6270,
1010,
1002,
2123,
4140,
4609,
8043,
4818,
4697,
1027,
6270,
1007,
1063,
2065,
1006,
999,
1002,
2123,
28495,
3367,
3540,
16179,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
dompdf/dompdf | src/Frame.php | Frame.ws_trim | protected function ws_trim()
{
if ($this->ws_keep()) {
return;
}
if (self::$_ws_state === self::WS_SPACE) {
$node = $this->_node;
if ($node->nodeName === "#text" && !empty($node->nodeValue)) {
$node->nodeValue = preg_replace("/[ \t\r\n\f]+/u", " ", trim($node->nodeValue));
self::$_ws_state = self::WS_TEXT;
}
}
} | php | protected function ws_trim()
{
if ($this->ws_keep()) {
return;
}
if (self::$_ws_state === self::WS_SPACE) {
$node = $this->_node;
if ($node->nodeName === "#text" && !empty($node->nodeValue)) {
$node->nodeValue = preg_replace("/[ \t\r\n\f]+/u", " ", trim($node->nodeValue));
self::$_ws_state = self::WS_TEXT;
}
}
} | [
"protected",
"function",
"ws_trim",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"ws_keep",
"(",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"self",
"::",
"$",
"_ws_state",
"===",
"self",
"::",
"WS_SPACE",
")",
"{",
"$",
"node",
"=",
"$",
"this... | WIP : preprocessing to remove all the unused whitespace | [
"WIP",
":",
"preprocessing",
"to",
"remove",
"all",
"the",
"unused",
"whitespace"
] | 75f13c700009be21a1965dc2c5b68a8708c22ba2 | https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/src/Frame.php#L220-L234 | train | Trims whitespace from the node | [
30522,
5123,
3853,
1059,
2015,
1035,
12241,
1006,
1007,
1063,
2065,
1006,
1002,
2023,
1011,
1028,
1059,
2015,
1035,
2562,
1006,
1007,
1007,
1063,
2709,
1025,
1065,
2065,
1006,
2969,
1024,
1024,
1002,
1035,
1059,
2015,
1035,
2110,
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/Live/API.php | API.getFirstVisitForVisitorId | public function getFirstVisitForVisitorId($idSite, $visitorId)
{
Piwik::checkUserHasSomeViewAccess();
if (empty($visitorId)) {
return new DataTable();
}
$model = new Model();
$data = $model->queryLogVisits($idSite, false, false, false, 0, 1, $visitorId, false, 'ASC');
$dataTable = $this->makeVisitorTableFromArray($data);
$this->addFilterToCleanVisitors($dataTable, $idSite, false, true);
return $dataTable;
} | php | public function getFirstVisitForVisitorId($idSite, $visitorId)
{
Piwik::checkUserHasSomeViewAccess();
if (empty($visitorId)) {
return new DataTable();
}
$model = new Model();
$data = $model->queryLogVisits($idSite, false, false, false, 0, 1, $visitorId, false, 'ASC');
$dataTable = $this->makeVisitorTableFromArray($data);
$this->addFilterToCleanVisitors($dataTable, $idSite, false, true);
return $dataTable;
} | [
"public",
"function",
"getFirstVisitForVisitorId",
"(",
"$",
"idSite",
",",
"$",
"visitorId",
")",
"{",
"Piwik",
"::",
"checkUserHasSomeViewAccess",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"visitorId",
")",
")",
"{",
"return",
"new",
"DataTable",
"(",
... | Returns the very first visit for the given visitorId
@internal
@param $idSite
@param $visitorId
@return DataTable | [
"Returns",
"the",
"very",
"first",
"visit",
"for",
"the",
"given",
"visitorId"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Live/API.php#L314-L328 | train | Get the first visit for a given visitorId | [
30522,
2270,
3853,
2131,
8873,
12096,
11365,
4183,
29278,
11365,
15660,
3593,
1006,
1002,
8909,
28032,
2063,
1010,
1002,
10367,
3593,
1007,
1063,
14255,
9148,
2243,
1024,
1024,
4638,
20330,
14949,
14045,
8584,
6305,
9623,
2015,
1006,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Routing/Loader/XmlFileLoader.php | XmlFileLoader.parseImport | protected function parseImport(RouteCollection $collection, \DOMElement $node, $path, $file)
{
if ('' === $resource = $node->getAttribute('resource')) {
throw new \InvalidArgumentException(sprintf('The <import> element in file "%s" must have a "resource" attribute.', $path));
}
$type = $node->getAttribute('type');
$prefix = $node->getAttribute('prefix');
$host = $node->hasAttribute('host') ? $node->getAttribute('host') : null;
$schemes = $node->hasAttribute('schemes') ? preg_split('/[\s,\|]++/', $node->getAttribute('schemes'), -1, PREG_SPLIT_NO_EMPTY) : null;
$methods = $node->hasAttribute('methods') ? preg_split('/[\s,\|]++/', $node->getAttribute('methods'), -1, PREG_SPLIT_NO_EMPTY) : null;
$trailingSlashOnRoot = $node->hasAttribute('trailing-slash-on-root') ? XmlUtils::phpize($node->getAttribute('trailing-slash-on-root')) : true;
list($defaults, $requirements, $options, $condition, /* $paths */, $prefixes) = $this->parseConfigs($node, $path);
if ('' !== $prefix && $prefixes) {
throw new \InvalidArgumentException(sprintf('The <route> element in file "%s" must not have both a "prefix" attribute and <prefix> child nodes.', $path));
}
$this->setCurrentDir(\dirname($path));
/** @var RouteCollection[] $imported */
$imported = $this->import($resource, ('' !== $type ? $type : null), false, $file);
if (!\is_array($imported)) {
$imported = [$imported];
}
foreach ($imported as $subCollection) {
/* @var $subCollection RouteCollection */
if ('' !== $prefix || !$prefixes) {
$subCollection->addPrefix($prefix);
if (!$trailingSlashOnRoot) {
$rootPath = (new Route(trim(trim($prefix), '/').'/'))->getPath();
foreach ($subCollection->all() as $route) {
if ($route->getPath() === $rootPath) {
$route->setPath(rtrim($rootPath, '/'));
}
}
}
} else {
foreach ($prefixes as $locale => $localePrefix) {
$prefixes[$locale] = trim(trim($localePrefix), '/');
}
foreach ($subCollection->all() as $name => $route) {
if (null === $locale = $route->getDefault('_locale')) {
$subCollection->remove($name);
foreach ($prefixes as $locale => $localePrefix) {
$localizedRoute = clone $route;
$localizedRoute->setPath($localePrefix.(!$trailingSlashOnRoot && '/' === $route->getPath() ? '' : $route->getPath()));
$localizedRoute->setDefault('_locale', $locale);
$localizedRoute->setDefault('_canonical_route', $name);
$subCollection->add($name.'.'.$locale, $localizedRoute);
}
} elseif (!isset($prefixes[$locale])) {
throw new \InvalidArgumentException(sprintf('Route "%s" with locale "%s" is missing a corresponding prefix when imported in "%s".', $name, $locale, $path));
} else {
$route->setPath($prefixes[$locale].(!$trailingSlashOnRoot && '/' === $route->getPath() ? '' : $route->getPath()));
$subCollection->add($name, $route);
}
}
}
if (null !== $host) {
$subCollection->setHost($host);
}
if (null !== $condition) {
$subCollection->setCondition($condition);
}
if (null !== $schemes) {
$subCollection->setSchemes($schemes);
}
if (null !== $methods) {
$subCollection->setMethods($methods);
}
$subCollection->addDefaults($defaults);
$subCollection->addRequirements($requirements);
$subCollection->addOptions($options);
if ($namePrefix = $node->getAttribute('name-prefix')) {
$subCollection->addNamePrefix($namePrefix);
}
$collection->addCollection($subCollection);
}
} | php | protected function parseImport(RouteCollection $collection, \DOMElement $node, $path, $file)
{
if ('' === $resource = $node->getAttribute('resource')) {
throw new \InvalidArgumentException(sprintf('The <import> element in file "%s" must have a "resource" attribute.', $path));
}
$type = $node->getAttribute('type');
$prefix = $node->getAttribute('prefix');
$host = $node->hasAttribute('host') ? $node->getAttribute('host') : null;
$schemes = $node->hasAttribute('schemes') ? preg_split('/[\s,\|]++/', $node->getAttribute('schemes'), -1, PREG_SPLIT_NO_EMPTY) : null;
$methods = $node->hasAttribute('methods') ? preg_split('/[\s,\|]++/', $node->getAttribute('methods'), -1, PREG_SPLIT_NO_EMPTY) : null;
$trailingSlashOnRoot = $node->hasAttribute('trailing-slash-on-root') ? XmlUtils::phpize($node->getAttribute('trailing-slash-on-root')) : true;
list($defaults, $requirements, $options, $condition, /* $paths */, $prefixes) = $this->parseConfigs($node, $path);
if ('' !== $prefix && $prefixes) {
throw new \InvalidArgumentException(sprintf('The <route> element in file "%s" must not have both a "prefix" attribute and <prefix> child nodes.', $path));
}
$this->setCurrentDir(\dirname($path));
/** @var RouteCollection[] $imported */
$imported = $this->import($resource, ('' !== $type ? $type : null), false, $file);
if (!\is_array($imported)) {
$imported = [$imported];
}
foreach ($imported as $subCollection) {
/* @var $subCollection RouteCollection */
if ('' !== $prefix || !$prefixes) {
$subCollection->addPrefix($prefix);
if (!$trailingSlashOnRoot) {
$rootPath = (new Route(trim(trim($prefix), '/').'/'))->getPath();
foreach ($subCollection->all() as $route) {
if ($route->getPath() === $rootPath) {
$route->setPath(rtrim($rootPath, '/'));
}
}
}
} else {
foreach ($prefixes as $locale => $localePrefix) {
$prefixes[$locale] = trim(trim($localePrefix), '/');
}
foreach ($subCollection->all() as $name => $route) {
if (null === $locale = $route->getDefault('_locale')) {
$subCollection->remove($name);
foreach ($prefixes as $locale => $localePrefix) {
$localizedRoute = clone $route;
$localizedRoute->setPath($localePrefix.(!$trailingSlashOnRoot && '/' === $route->getPath() ? '' : $route->getPath()));
$localizedRoute->setDefault('_locale', $locale);
$localizedRoute->setDefault('_canonical_route', $name);
$subCollection->add($name.'.'.$locale, $localizedRoute);
}
} elseif (!isset($prefixes[$locale])) {
throw new \InvalidArgumentException(sprintf('Route "%s" with locale "%s" is missing a corresponding prefix when imported in "%s".', $name, $locale, $path));
} else {
$route->setPath($prefixes[$locale].(!$trailingSlashOnRoot && '/' === $route->getPath() ? '' : $route->getPath()));
$subCollection->add($name, $route);
}
}
}
if (null !== $host) {
$subCollection->setHost($host);
}
if (null !== $condition) {
$subCollection->setCondition($condition);
}
if (null !== $schemes) {
$subCollection->setSchemes($schemes);
}
if (null !== $methods) {
$subCollection->setMethods($methods);
}
$subCollection->addDefaults($defaults);
$subCollection->addRequirements($requirements);
$subCollection->addOptions($options);
if ($namePrefix = $node->getAttribute('name-prefix')) {
$subCollection->addNamePrefix($namePrefix);
}
$collection->addCollection($subCollection);
}
} | [
"protected",
"function",
"parseImport",
"(",
"RouteCollection",
"$",
"collection",
",",
"\\",
"DOMElement",
"$",
"node",
",",
"$",
"path",
",",
"$",
"file",
")",
"{",
"if",
"(",
"''",
"===",
"$",
"resource",
"=",
"$",
"node",
"->",
"getAttribute",
"(",
... | Parses an import and adds the routes in the resource to the RouteCollection.
@param RouteCollection $collection RouteCollection instance
@param \DOMElement $node Element to parse that represents a Route
@param string $path Full path of the XML file being processed
@param string $file Loaded file name
@throws \InvalidArgumentException When the XML is invalid | [
"Parses",
"an",
"import",
"and",
"adds",
"the",
"routes",
"in",
"the",
"resource",
"to",
"the",
"RouteCollection",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Routing/Loader/XmlFileLoader.php#L150-L235 | train | Parse import element | [
30522,
5123,
3853,
11968,
20240,
8737,
11589,
1006,
2799,
26895,
18491,
1002,
3074,
1010,
1032,
8514,
16930,
4765,
1002,
13045,
1010,
1002,
4130,
1010,
1002,
5371,
1007,
1063,
2065,
1006,
1005,
1005,
1027,
1027,
1027,
1002,
7692,
1027,
1002... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Session/DatabaseSessionHandler.php | DatabaseSessionHandler.getDefaultPayload | protected function getDefaultPayload($data)
{
$payload = [
'payload' => base64_encode($data),
'last_activity' => $this->currentTime(),
];
if (! $this->container) {
return $payload;
}
return tap($payload, function (&$payload) {
$this->addUserInformation($payload)
->addRequestInformation($payload);
});
} | php | protected function getDefaultPayload($data)
{
$payload = [
'payload' => base64_encode($data),
'last_activity' => $this->currentTime(),
];
if (! $this->container) {
return $payload;
}
return tap($payload, function (&$payload) {
$this->addUserInformation($payload)
->addRequestInformation($payload);
});
} | [
"protected",
"function",
"getDefaultPayload",
"(",
"$",
"data",
")",
"{",
"$",
"payload",
"=",
"[",
"'payload'",
"=>",
"base64_encode",
"(",
"$",
"data",
")",
",",
"'last_activity'",
"=>",
"$",
"this",
"->",
"currentTime",
"(",
")",
",",
"]",
";",
"if",
... | Get the default payload for the session.
@param string $data
@return array | [
"Get",
"the",
"default",
"payload",
"for",
"the",
"session",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Session/DatabaseSessionHandler.php#L174-L189 | train | Get default payload | [
30522,
5123,
3853,
2131,
3207,
7011,
11314,
4502,
8516,
10441,
2094,
1006,
1002,
2951,
1007,
1063,
1002,
18093,
1027,
1031,
1005,
18093,
1005,
1027,
1028,
2918,
21084,
1035,
4372,
16044,
1006,
1002,
2951,
1007,
1010,
1005,
2197,
1035,
4023,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/GeoIPAutoUpdater.php | GeoIPAutoUpdater.catchGeoIPError | public static function catchGeoIPError($errno, $errstr, $errfile, $errline)
{
self::$unzipPhpError = array($errno, $errstr, $errfile, $errline);
} | php | public static function catchGeoIPError($errno, $errstr, $errfile, $errline)
{
self::$unzipPhpError = array($errno, $errstr, $errfile, $errline);
} | [
"public",
"static",
"function",
"catchGeoIPError",
"(",
"$",
"errno",
",",
"$",
"errstr",
",",
"$",
"errfile",
",",
"$",
"errline",
")",
"{",
"self",
"::",
"$",
"unzipPhpError",
"=",
"array",
"(",
"$",
"errno",
",",
"$",
"errstr",
",",
"$",
"errfile",
... | Custom PHP error handler used to catch any PHP errors that occur when
testing a downloaded GeoIP file.
If we download a file that is supposed to be a GeoIP database, we need to make
sure it is one. This is done simply by attempting to use it. If this fails, it
will most of the time fail as a PHP error, which we catch w/ this function
after it is passed to set_error_handler.
The PHP error is stored in self::$unzipPhpError.
@param int $errno
@param string $errstr
@param string $errfile
@param int $errline | [
"Custom",
"PHP",
"error",
"handler",
"used",
"to",
"catch",
"any",
"PHP",
"errors",
"that",
"occur",
"when",
"testing",
"a",
"downloaded",
"GeoIP",
"file",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/UserCountry/GeoIPAutoUpdater.php#L644-L647 | train | Catches a GeoIP error and sets the parent class to the parent class | [
30522,
2270,
10763,
3853,
4608,
3351,
10448,
4842,
29165,
1006,
1002,
9413,
19139,
1010,
1002,
9413,
12096,
2099,
1010,
1002,
9413,
12881,
9463,
1010,
1002,
9413,
19403,
2063,
1007,
1063,
2969,
1024,
1024,
1002,
4895,
5831,
9397,
22269,
212... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/User/FlexUser/User.php | User.file | public function file(FileInterface $storage = null)
{
if (null !== $storage) {
$this->_storage = $storage;
}
return $this->_storage;
} | php | public function file(FileInterface $storage = null)
{
if (null !== $storage) {
$this->_storage = $storage;
}
return $this->_storage;
} | [
"public",
"function",
"file",
"(",
"FileInterface",
"$",
"storage",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"storage",
")",
"{",
"$",
"this",
"->",
"_storage",
"=",
"$",
"storage",
";",
"}",
"return",
"$",
"this",
"->",
"_storage",
";",... | Set or get the data storage.
@param FileInterface $storage Optionally enter a new storage.
@return FileInterface | [
"Set",
"or",
"get",
"the",
"data",
"storage",
"."
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/User/FlexUser/User.php#L404-L411 | train | Get the file | [
30522,
2270,
3853,
5371,
1006,
5371,
18447,
2121,
12172,
1002,
5527,
1027,
19701,
1007,
1063,
2065,
1006,
19701,
999,
1027,
1027,
1002,
5527,
1007,
1063,
1002,
2023,
1011,
1028,
1035,
5527,
1027,
1002,
5527,
1025,
1065,
2709,
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/Finder/Iterator/RecursiveDirectoryIterator.php | RecursiveDirectoryIterator.current | public function current()
{
// the logic here avoids redoing the same work in all iterations
if (null === $subPathname = $this->subPath) {
$subPathname = $this->subPath = (string) $this->getSubPath();
}
if ('' !== $subPathname) {
$subPathname .= $this->directorySeparator;
}
$subPathname .= $this->getFilename();
return new SplFileInfo($this->rootPath.$this->directorySeparator.$subPathname, $this->subPath, $subPathname);
} | php | public function current()
{
// the logic here avoids redoing the same work in all iterations
if (null === $subPathname = $this->subPath) {
$subPathname = $this->subPath = (string) $this->getSubPath();
}
if ('' !== $subPathname) {
$subPathname .= $this->directorySeparator;
}
$subPathname .= $this->getFilename();
return new SplFileInfo($this->rootPath.$this->directorySeparator.$subPathname, $this->subPath, $subPathname);
} | [
"public",
"function",
"current",
"(",
")",
"{",
"// the logic here avoids redoing the same work in all iterations",
"if",
"(",
"null",
"===",
"$",
"subPathname",
"=",
"$",
"this",
"->",
"subPath",
")",
"{",
"$",
"subPathname",
"=",
"$",
"this",
"->",
"subPath",
... | Return an instance of SplFileInfo with support for relative paths.
@return SplFileInfo File information | [
"Return",
"an",
"instance",
"of",
"SplFileInfo",
"with",
"support",
"for",
"relative",
"paths",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Finder/Iterator/RecursiveDirectoryIterator.php#L61-L74 | train | Return the current file | [
30522,
2270,
3853,
2783,
1006,
1007,
1063,
1013,
1013,
1996,
7961,
2182,
26777,
2417,
28765,
2290,
1996,
2168,
2147,
1999,
2035,
27758,
2015,
2065,
1006,
19701,
1027,
1027,
1027,
1002,
4942,
15069,
18442,
1027,
1002,
2023,
1011,
1028,
4942,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Math/Statistic/Correlation.php | Correlation.pearson | public static function pearson(array $x, array $y): float
{
if (count($x) !== count($y)) {
throw new InvalidArgumentException('Size of given arrays does not match');
}
$count = count($x);
$meanX = Mean::arithmetic($x);
$meanY = Mean::arithmetic($y);
$axb = 0;
$a2 = 0;
$b2 = 0;
for ($i = 0; $i < $count; ++$i) {
$a = $x[$i] - $meanX;
$b = $y[$i] - $meanY;
$axb += ($a * $b);
$a2 += $a ** 2;
$b2 += $b ** 2;
}
return $axb / ($a2 * $b2) ** .5;
} | php | public static function pearson(array $x, array $y): float
{
if (count($x) !== count($y)) {
throw new InvalidArgumentException('Size of given arrays does not match');
}
$count = count($x);
$meanX = Mean::arithmetic($x);
$meanY = Mean::arithmetic($y);
$axb = 0;
$a2 = 0;
$b2 = 0;
for ($i = 0; $i < $count; ++$i) {
$a = $x[$i] - $meanX;
$b = $y[$i] - $meanY;
$axb += ($a * $b);
$a2 += $a ** 2;
$b2 += $b ** 2;
}
return $axb / ($a2 * $b2) ** .5;
} | [
"public",
"static",
"function",
"pearson",
"(",
"array",
"$",
"x",
",",
"array",
"$",
"y",
")",
":",
"float",
"{",
"if",
"(",
"count",
"(",
"$",
"x",
")",
"!==",
"count",
"(",
"$",
"y",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"("... | @param int[]|float[] $x
@param int[]|float[] $y
@throws InvalidArgumentException | [
"@param",
"int",
"[]",
"|float",
"[]",
"$x",
"@param",
"int",
"[]",
"|float",
"[]",
"$y"
] | f6aa1a59b0525b8fca3d2786d661ab3e70904016 | https://github.com/php-ai/php-ml/blob/f6aa1a59b0525b8fca3d2786d661ab3e70904016/src/Math/Statistic/Correlation.php#L17-L40 | train | Returns the pearson probability of given x and y | [
30522,
2270,
10763,
3853,
12874,
1006,
9140,
1002,
1060,
1010,
9140,
1002,
1061,
1007,
1024,
14257,
1063,
2065,
1006,
4175,
1006,
1002,
1060,
1007,
999,
1027,
1027,
4175,
1006,
1002,
1061,
1007,
1007,
1063,
5466,
2047,
19528,
2906,
22850,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/HttpKernel.php | HttpKernel.handle | public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true)
{
$request->headers->set('X-Php-Ob-Level', ob_get_level());
try {
return $this->handleRaw($request, $type);
} catch (\Exception $e) {
if ($e instanceof RequestExceptionInterface) {
$e = new BadRequestHttpException($e->getMessage(), $e);
}
if (false === $catch) {
$this->finishRequest($request, $type);
throw $e;
}
return $this->handleException($e, $request, $type);
}
} | php | public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true)
{
$request->headers->set('X-Php-Ob-Level', ob_get_level());
try {
return $this->handleRaw($request, $type);
} catch (\Exception $e) {
if ($e instanceof RequestExceptionInterface) {
$e = new BadRequestHttpException($e->getMessage(), $e);
}
if (false === $catch) {
$this->finishRequest($request, $type);
throw $e;
}
return $this->handleException($e, $request, $type);
}
} | [
"public",
"function",
"handle",
"(",
"Request",
"$",
"request",
",",
"$",
"type",
"=",
"HttpKernelInterface",
"::",
"MASTER_REQUEST",
",",
"$",
"catch",
"=",
"true",
")",
"{",
"$",
"request",
"->",
"headers",
"->",
"set",
"(",
"'X-Php-Ob-Level'",
",",
"ob_... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/HttpKernel.php#L63-L81 | train | Handle the request | [
30522,
2270,
3853,
5047,
1006,
5227,
1002,
5227,
1010,
1002,
2828,
1027,
8299,
5484,
11877,
18447,
2121,
12172,
1024,
1024,
3040,
1035,
5227,
1010,
1002,
4608,
1027,
2995,
1007,
1063,
1002,
5227,
1011,
1028,
20346,
2015,
1011,
1028,
2275,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/Profiler.php | Profiler.displayDbProfileReport | public static function displayDbProfileReport()
{
$profiler = Db::get()->getProfiler();
if (!$profiler->getEnabled()) {
// To display the profiler you should enable enable_sql_profiler on your config/config.ini.php file
return;
}
$infoIndexedByQuery = array();
foreach ($profiler->getQueryProfiles() as $query) {
if (isset($infoIndexedByQuery[$query->getQuery()])) {
$existing = $infoIndexedByQuery[$query->getQuery()];
} else {
$existing = array('count' => 0, 'sumTimeMs' => 0);
}
$new = array('count' => $existing['count'] + 1,
'sumTimeMs' => $existing['count'] + $query->getElapsedSecs() * 1000);
$infoIndexedByQuery[$query->getQuery()] = $new;
}
uasort($infoIndexedByQuery, 'self::sortTimeDesc');
$str = '<hr /><strong>SQL Profiler</strong><hr /><strong>Summary</strong><br/>';
$totalTime = $profiler->getTotalElapsedSecs();
$queryCount = $profiler->getTotalNumQueries();
$longestTime = 0;
$longestQuery = null;
foreach ($profiler->getQueryProfiles() as $query) {
if ($query->getElapsedSecs() > $longestTime) {
$longestTime = $query->getElapsedSecs();
$longestQuery = $query->getQuery();
}
}
$str .= 'Executed ' . $queryCount . ' queries in ' . round($totalTime, 3) . ' seconds';
$str .= '(Average query length: ' . round($totalTime / $queryCount, 3) . ' seconds)';
$str .= '<br />Queries per second: ' . round($queryCount / $totalTime, 1);
$str .= '<br />Longest query length: ' . round($longestTime, 3) . " seconds (<code>$longestQuery</code>)";
Log::debug($str);
self::getSqlProfilingQueryBreakdownOutput($infoIndexedByQuery);
} | php | public static function displayDbProfileReport()
{
$profiler = Db::get()->getProfiler();
if (!$profiler->getEnabled()) {
// To display the profiler you should enable enable_sql_profiler on your config/config.ini.php file
return;
}
$infoIndexedByQuery = array();
foreach ($profiler->getQueryProfiles() as $query) {
if (isset($infoIndexedByQuery[$query->getQuery()])) {
$existing = $infoIndexedByQuery[$query->getQuery()];
} else {
$existing = array('count' => 0, 'sumTimeMs' => 0);
}
$new = array('count' => $existing['count'] + 1,
'sumTimeMs' => $existing['count'] + $query->getElapsedSecs() * 1000);
$infoIndexedByQuery[$query->getQuery()] = $new;
}
uasort($infoIndexedByQuery, 'self::sortTimeDesc');
$str = '<hr /><strong>SQL Profiler</strong><hr /><strong>Summary</strong><br/>';
$totalTime = $profiler->getTotalElapsedSecs();
$queryCount = $profiler->getTotalNumQueries();
$longestTime = 0;
$longestQuery = null;
foreach ($profiler->getQueryProfiles() as $query) {
if ($query->getElapsedSecs() > $longestTime) {
$longestTime = $query->getElapsedSecs();
$longestQuery = $query->getQuery();
}
}
$str .= 'Executed ' . $queryCount . ' queries in ' . round($totalTime, 3) . ' seconds';
$str .= '(Average query length: ' . round($totalTime / $queryCount, 3) . ' seconds)';
$str .= '<br />Queries per second: ' . round($queryCount / $totalTime, 1);
$str .= '<br />Longest query length: ' . round($longestTime, 3) . " seconds (<code>$longestQuery</code>)";
Log::debug($str);
self::getSqlProfilingQueryBreakdownOutput($infoIndexedByQuery);
} | [
"public",
"static",
"function",
"displayDbProfileReport",
"(",
")",
"{",
"$",
"profiler",
"=",
"Db",
"::",
"get",
"(",
")",
"->",
"getProfiler",
"(",
")",
";",
"if",
"(",
"!",
"$",
"profiler",
"->",
"getEnabled",
"(",
")",
")",
"{",
"// To display the pr... | Outputs SQL Profiling reports from Zend
@throws \Exception | [
"Outputs",
"SQL",
"Profiling",
"reports",
"from",
"Zend"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Profiler.php#L59-L99 | train | Display SQL profiler report | [
30522,
2270,
10763,
3853,
4653,
18939,
21572,
8873,
3917,
13699,
11589,
1006,
1007,
1063,
1002,
6337,
2099,
1027,
16962,
1024,
1024,
2131,
1006,
1007,
1011,
1028,
2131,
21572,
8873,
3917,
1006,
1007,
1025,
2065,
1006,
999,
1002,
6337,
2099,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/MailManager.php | MailManager.loadRegisteredTemplates | public function loadRegisteredTemplates()
{
foreach ($this->callbacks as $callback) {
$callback($this);
}
$plugins = PluginManager::instance()->getPlugins();
foreach ($plugins as $pluginId => $pluginObj) {
$layouts = $pluginObj->registerMailLayouts();
if (is_array($layouts)) {
$this->registerMailLayouts($layouts);
}
$templates = $pluginObj->registerMailTemplates();
if (is_array($templates)) {
$this->registerMailTemplates($templates);
}
$partials = $pluginObj->registerMailPartials();
if (is_array($partials)) {
$this->registerMailPartials($partials);
}
}
} | php | public function loadRegisteredTemplates()
{
foreach ($this->callbacks as $callback) {
$callback($this);
}
$plugins = PluginManager::instance()->getPlugins();
foreach ($plugins as $pluginId => $pluginObj) {
$layouts = $pluginObj->registerMailLayouts();
if (is_array($layouts)) {
$this->registerMailLayouts($layouts);
}
$templates = $pluginObj->registerMailTemplates();
if (is_array($templates)) {
$this->registerMailTemplates($templates);
}
$partials = $pluginObj->registerMailPartials();
if (is_array($partials)) {
$this->registerMailPartials($partials);
}
}
} | [
"public",
"function",
"loadRegisteredTemplates",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"callbacks",
"as",
"$",
"callback",
")",
"{",
"$",
"callback",
"(",
"$",
"this",
")",
";",
"}",
"$",
"plugins",
"=",
"PluginManager",
"::",
"instance",
"("... | Loads registered mail templates from modules and plugins
@return void | [
"Loads",
"registered",
"mail",
"templates",
"from",
"modules",
"and",
"plugins"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/MailManager.php#L335-L358 | train | Load all registered mail templates from plugins | [
30522,
2270,
3853,
7170,
2890,
24063,
6850,
18532,
15725,
2015,
1006,
1007,
1063,
18921,
6776,
1006,
1002,
2023,
1011,
1028,
2655,
12221,
2004,
1002,
2655,
5963,
1007,
1063,
1002,
2655,
5963,
1006,
1002,
2023,
1007,
1025,
1065,
1002,
13354,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/HttpKernelBrowser.php | HttpKernelBrowser.filterRequest | protected function filterRequest(DomRequest $request)
{
$httpRequest = Request::create($request->getUri(), $request->getMethod(), $request->getParameters(), $request->getCookies(), $request->getFiles(), $request->getServer(), $request->getContent());
foreach ($this->filterFiles($httpRequest->files->all()) as $key => $value) {
$httpRequest->files->set($key, $value);
}
return $httpRequest;
} | php | protected function filterRequest(DomRequest $request)
{
$httpRequest = Request::create($request->getUri(), $request->getMethod(), $request->getParameters(), $request->getCookies(), $request->getFiles(), $request->getServer(), $request->getContent());
foreach ($this->filterFiles($httpRequest->files->all()) as $key => $value) {
$httpRequest->files->set($key, $value);
}
return $httpRequest;
} | [
"protected",
"function",
"filterRequest",
"(",
"DomRequest",
"$",
"request",
")",
"{",
"$",
"httpRequest",
"=",
"Request",
"::",
"create",
"(",
"$",
"request",
"->",
"getUri",
"(",
")",
",",
"$",
"request",
"->",
"getMethod",
"(",
")",
",",
"$",
"request... | Converts the BrowserKit request to a HttpKernel request.
@return Request A Request instance | [
"Converts",
"the",
"BrowserKit",
"request",
"to",
"a",
"HttpKernel",
"request",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/HttpKernelBrowser.php#L136-L145 | train | Filter a DomRequest to keep only the files that are in the request | [
30522,
5123,
3853,
11307,
2890,
15500,
1006,
14383,
2890,
15500,
1002,
5227,
1007,
1063,
1002,
8299,
2890,
15500,
1027,
5227,
1024,
1024,
3443,
1006,
1002,
5227,
1011,
1028,
2131,
9496,
1006,
1007,
1010,
1002,
5227,
1011,
1028,
2131,
11368,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.loop | public function loop()
{
while (1) {
if(DIRECTORY_SEPARATOR === '/') {
// Calls signal handlers for pending signals
pcntl_signal_dispatch();
}
$read = $this->_readFds;
$write = $this->_writeFds;
$except = $this->_exceptFds;
// Waiting read/write/signal/timeout events.
set_error_handler(function(){});
$ret = stream_select($read, $write, $except, 0, $this->_selectTimeout);
restore_error_handler();
if (!$this->_scheduler->isEmpty()) {
$this->tick();
}
if (!$ret) {
continue;
}
if ($read) {
foreach ($read as $fd) {
$fd_key = (int)$fd;
if (isset($this->_allEvents[$fd_key][self::EV_READ])) {
call_user_func_array($this->_allEvents[$fd_key][self::EV_READ][0],
array($this->_allEvents[$fd_key][self::EV_READ][1]));
}
}
}
if ($write) {
foreach ($write as $fd) {
$fd_key = (int)$fd;
if (isset($this->_allEvents[$fd_key][self::EV_WRITE])) {
call_user_func_array($this->_allEvents[$fd_key][self::EV_WRITE][0],
array($this->_allEvents[$fd_key][self::EV_WRITE][1]));
}
}
}
if($except) {
foreach($except as $fd) {
$fd_key = (int) $fd;
if(isset($this->_allEvents[$fd_key][self::EV_EXCEPT])) {
call_user_func_array($this->_allEvents[$fd_key][self::EV_EXCEPT][0],
array($this->_allEvents[$fd_key][self::EV_EXCEPT][1]));
}
}
}
}
} | php | public function loop()
{
while (1) {
if(DIRECTORY_SEPARATOR === '/') {
// Calls signal handlers for pending signals
pcntl_signal_dispatch();
}
$read = $this->_readFds;
$write = $this->_writeFds;
$except = $this->_exceptFds;
// Waiting read/write/signal/timeout events.
set_error_handler(function(){});
$ret = stream_select($read, $write, $except, 0, $this->_selectTimeout);
restore_error_handler();
if (!$this->_scheduler->isEmpty()) {
$this->tick();
}
if (!$ret) {
continue;
}
if ($read) {
foreach ($read as $fd) {
$fd_key = (int)$fd;
if (isset($this->_allEvents[$fd_key][self::EV_READ])) {
call_user_func_array($this->_allEvents[$fd_key][self::EV_READ][0],
array($this->_allEvents[$fd_key][self::EV_READ][1]));
}
}
}
if ($write) {
foreach ($write as $fd) {
$fd_key = (int)$fd;
if (isset($this->_allEvents[$fd_key][self::EV_WRITE])) {
call_user_func_array($this->_allEvents[$fd_key][self::EV_WRITE][0],
array($this->_allEvents[$fd_key][self::EV_WRITE][1]));
}
}
}
if($except) {
foreach($except as $fd) {
$fd_key = (int) $fd;
if(isset($this->_allEvents[$fd_key][self::EV_EXCEPT])) {
call_user_func_array($this->_allEvents[$fd_key][self::EV_EXCEPT][0],
array($this->_allEvents[$fd_key][self::EV_EXCEPT][1]));
}
}
}
}
} | [
"public",
"function",
"loop",
"(",
")",
"{",
"while",
"(",
"1",
")",
"{",
"if",
"(",
"DIRECTORY_SEPARATOR",
"===",
"'/'",
")",
"{",
"// Calls signal handlers for pending signals",
"pcntl_signal_dispatch",
"(",
")",
";",
"}",
"$",
"read",
"=",
"$",
"this",
"-... | {@inheritdoc} | [
"{"
] | 13649907f05014fcfffcfccaef01e63ad3339351 | https://github.com/walkor/Workerman/blob/13649907f05014fcfffcfccaef01e63ad3339351/Events/Select.php#L263-L319 | train | Loop through all events | [
30522,
2270,
3853,
7077,
1006,
1007,
1063,
2096,
1006,
1015,
1007,
1063,
2065,
1006,
14176,
1035,
19802,
25879,
2953,
1027,
1027,
1027,
1005,
1013,
1005,
1007,
1063,
1013,
1013,
4455,
4742,
28213,
2015,
2005,
14223,
7755,
7473,
3372,
2140,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
opencart/opencart | upload/catalog/controller/event/activity.php | ControllerEventActivity.addOrderHistory | public function addOrderHistory(&$route, &$args) {
if ($this->config->get('config_customer_activity')) {
// If last order status id is 0 and new order status is not then record as new order
$this->load->model('checkout/order');
$order_info = $this->model_checkout_order->getOrder($args[0]);
if ($order_info && !$order_info['order_status_id'] && $args[1]) {
$this->load->model('account/activity');
if ($order_info['customer_id']) {
$activity_data = array(
'customer_id' => $order_info['customer_id'],
'name' => $order_info['firstname'] . ' ' . $order_info['lastname'],
'order_id' => $args[0]
);
$this->model_account_activity->addActivity('order_account', $activity_data);
} else {
$activity_data = array(
'name' => $order_info['firstname'] . ' ' . $order_info['lastname'],
'order_id' => $args[0]
);
$this->model_account_activity->addActivity('order_guest', $activity_data);
}
}
}
} | php | public function addOrderHistory(&$route, &$args) {
if ($this->config->get('config_customer_activity')) {
// If last order status id is 0 and new order status is not then record as new order
$this->load->model('checkout/order');
$order_info = $this->model_checkout_order->getOrder($args[0]);
if ($order_info && !$order_info['order_status_id'] && $args[1]) {
$this->load->model('account/activity');
if ($order_info['customer_id']) {
$activity_data = array(
'customer_id' => $order_info['customer_id'],
'name' => $order_info['firstname'] . ' ' . $order_info['lastname'],
'order_id' => $args[0]
);
$this->model_account_activity->addActivity('order_account', $activity_data);
} else {
$activity_data = array(
'name' => $order_info['firstname'] . ' ' . $order_info['lastname'],
'order_id' => $args[0]
);
$this->model_account_activity->addActivity('order_guest', $activity_data);
}
}
}
} | [
"public",
"function",
"addOrderHistory",
"(",
"&",
"$",
"route",
",",
"&",
"$",
"args",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"config",
"->",
"get",
"(",
"'config_customer_activity'",
")",
")",
"{",
"// If last order status id is 0 and new order status is not th... | catalog/model/checkout/order/addOrderHistory/before | [
"catalog",
"/",
"model",
"/",
"checkout",
"/",
"order",
"/",
"addOrderHistory",
"/",
"before"
] | e7933b56ba05aafb3655c6b490c9733cd18b5c69 | https://github.com/opencart/opencart/blob/e7933b56ba05aafb3655c6b490c9733cd18b5c69/upload/catalog/controller/event/activity.php#L213-L241 | train | Add order history | [
30522,
2270,
3853,
5587,
8551,
2121,
24158,
7062,
1006,
1004,
1002,
2799,
1010,
1004,
1002,
12098,
5620,
1007,
1063,
2065,
1006,
1002,
2023,
1011,
1028,
9530,
8873,
2290,
1011,
1028,
2131,
1006,
1005,
9530,
8873,
2290,
1035,
8013,
1035,
4... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Menu/MenuAdmin.php | MenuAdmin.addPlatformItem | public function addPlatformItem($menuName, $url, $order = 50, $tooltip = false)
{
$this->addItem('CorePluginsAdmin_MenuPlatform', $menuName, $url, $order, $tooltip);
} | php | public function addPlatformItem($menuName, $url, $order = 50, $tooltip = false)
{
$this->addItem('CorePluginsAdmin_MenuPlatform', $menuName, $url, $order, $tooltip);
} | [
"public",
"function",
"addPlatformItem",
"(",
"$",
"menuName",
",",
"$",
"url",
",",
"$",
"order",
"=",
"50",
",",
"$",
"tooltip",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"addItem",
"(",
"'CorePluginsAdmin_MenuPlatform'",
",",
"$",
"menuName",
",",
"$... | See {@link add()}. Adds a new menu item to the platform section of the admin menu.
@param string $menuName
@param array $url
@param int $order
@param bool|string $tooltip
@api
@since 2.5.0 | [
"See",
"{"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Menu/MenuAdmin.php#L76-L79 | train | Add Platform menu item | [
30522,
2270,
3853,
5587,
24759,
4017,
14192,
4221,
2213,
1006,
1002,
12183,
18442,
1010,
1002,
24471,
2140,
1010,
1002,
2344,
1027,
2753,
1010,
1002,
6994,
25101,
1027,
6270,
1007,
1063,
1002,
2023,
1011,
1028,
5587,
4221,
2213,
1006,
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/Zend/Db/Statement/Pdo.php | Zend_Db_Statement_Pdo.rowCount | public function rowCount()
{
try {
return $this->_stmt->rowCount();
} catch (PDOException $e) {
// require_once 'Zend/Db/Statement/Exception.php';
throw new Zend_Db_Statement_Exception($e->getMessage(), $e->getCode(), $e);
}
} | php | public function rowCount()
{
try {
return $this->_stmt->rowCount();
} catch (PDOException $e) {
// require_once 'Zend/Db/Statement/Exception.php';
throw new Zend_Db_Statement_Exception($e->getMessage(), $e->getCode(), $e);
}
} | [
"public",
"function",
"rowCount",
"(",
")",
"{",
"try",
"{",
"return",
"$",
"this",
"->",
"_stmt",
"->",
"rowCount",
"(",
")",
";",
"}",
"catch",
"(",
"PDOException",
"$",
"e",
")",
"{",
"// require_once 'Zend/Db/Statement/Exception.php';",
"throw",
"new",
"... | Returns the number of rows affected by the execution of the
last INSERT, DELETE, or UPDATE statement executed by this
statement object.
@return int The number of rows affected.
@throws Zend_Db_Statement_Exception | [
"Returns",
"the",
"number",
"of",
"rows",
"affected",
"by",
"the",
"execution",
"of",
"the",
"last",
"INSERT",
"DELETE",
"or",
"UPDATE",
"statement",
"executed",
"by",
"this",
"statement",
"object",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Statement/Pdo.php#L393-L401 | train | Return the number of rows in the result set | [
30522,
2270,
3853,
5216,
3597,
16671,
1006,
1007,
1063,
3046,
1063,
2709,
1002,
2023,
1011,
1028,
1035,
2358,
20492,
1011,
1028,
5216,
3597,
16671,
1006,
1007,
1025,
1065,
4608,
1006,
22851,
8913,
2595,
24422,
1002,
1041,
1007,
1063,
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... |
getgrav/grav | system/src/Grav/Common/Page/Page.php | Page.id | public function id($var = null)
{
if ($var !== null) {
// store unique per language
$active_lang = Grav::instance()['language']->getLanguage() ?: '';
$id = $active_lang . $var;
$this->id = $id;
}
return $this->id;
} | php | public function id($var = null)
{
if ($var !== null) {
// store unique per language
$active_lang = Grav::instance()['language']->getLanguage() ?: '';
$id = $active_lang . $var;
$this->id = $id;
}
return $this->id;
} | [
"public",
"function",
"id",
"(",
"$",
"var",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"var",
"!==",
"null",
")",
"{",
"// store unique per language",
"$",
"active_lang",
"=",
"Grav",
"::",
"instance",
"(",
")",
"[",
"'language'",
"]",
"->",
"getLanguage",
... | Gets and sets the identifier for this Page object.
@param string $var the identifier
@return string the identifier | [
"Gets",
"and",
"sets",
"the",
"identifier",
"for",
"this",
"Page",
"object",
"."
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L2002-L2012 | train | store unique id | [
30522,
2270,
3853,
8909,
1006,
1002,
13075,
1027,
19701,
1007,
1063,
2065,
1006,
1002,
13075,
999,
1027,
1027,
19701,
1007,
1063,
1013,
1013,
3573,
4310,
2566,
2653,
1002,
3161,
1035,
11374,
1027,
24665,
11431,
1024,
1024,
6013,
1006,
1007,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.