repo stringclasses 21 values | path stringlengths 10 100 | func_name stringlengths 6 71 | original_string stringlengths 115 97k | language stringclasses 1 value | code stringlengths 115 97k | code_tokens listlengths 27 7.5k | docstring stringlengths 6 1.88k | docstring_tokens listlengths 1 177 | sha stringclasses 21 values | url stringlengths 100 189 | partition stringclasses 1 value | summary stringlengths 9 340 | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
symfony/symfony | src/Symfony/Component/DependencyInjection/Definition.php | Definition.setDeprecated | public function setDeprecated($status = true, $template = null)
{
if (null !== $template) {
if (preg_match('#[\r\n]|\*/#', $template)) {
throw new InvalidArgumentException('Invalid characters found in deprecation template.');
}
if (false === strpos($template, '%service_id%')) {
throw new InvalidArgumentException('The deprecation template must contain the "%service_id%" placeholder.');
}
$this->deprecationTemplate = $template;
}
$this->changes['deprecated'] = true;
$this->deprecated = (bool) $status;
return $this;
} | php | public function setDeprecated($status = true, $template = null)
{
if (null !== $template) {
if (preg_match('#[\r\n]|\*/#', $template)) {
throw new InvalidArgumentException('Invalid characters found in deprecation template.');
}
if (false === strpos($template, '%service_id%')) {
throw new InvalidArgumentException('The deprecation template must contain the "%service_id%" placeholder.');
}
$this->deprecationTemplate = $template;
}
$this->changes['deprecated'] = true;
$this->deprecated = (bool) $status;
return $this;
} | [
"public",
"function",
"setDeprecated",
"(",
"$",
"status",
"=",
"true",
",",
"$",
"template",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"template",
")",
"{",
"if",
"(",
"preg_match",
"(",
"'#[\\r\\n]|\\*/#'",
",",
"$",
"template",
")",
")",... | Whether this definition is deprecated, that means it should not be called
anymore.
@param bool $status
@param string $template Template message to use if the definition is deprecated
@return $this
@throws InvalidArgumentException when the message template is invalid | [
"Whether",
"this",
"definition",
"is",
"deprecated",
"that",
"means",
"it",
"should",
"not",
"be",
"called",
"anymore",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DependencyInjection/Definition.php#L741-L760 | train | Set deprecation status | [
30522,
2270,
3853,
2275,
3207,
28139,
12921,
1006,
1002,
3570,
1027,
2995,
1010,
1002,
23561,
1027,
19701,
1007,
1063,
2065,
1006,
19701,
999,
1027,
1027,
1002,
23561,
1007,
1063,
2065,
1006,
3653,
2290,
1035,
2674,
1006,
1005,
1001,
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... |
dompdf/dompdf | src/Dompdf.php | Dompdf.setPaper | public function setPaper($size, $orientation = "portrait")
{
$this->paperSize = $size;
$this->paperOrientation = $orientation;
return $this;
} | php | public function setPaper($size, $orientation = "portrait")
{
$this->paperSize = $size;
$this->paperOrientation = $orientation;
return $this;
} | [
"public",
"function",
"setPaper",
"(",
"$",
"size",
",",
"$",
"orientation",
"=",
"\"portrait\"",
")",
"{",
"$",
"this",
"->",
"paperSize",
"=",
"$",
"size",
";",
"$",
"this",
"->",
"paperOrientation",
"=",
"$",
"orientation",
";",
"return",
"$",
"this",... | Sets the paper size & orientation
@param string|array $size 'letter', 'legal', 'A4', etc. {@link Dompdf\Adapter\CPDF::$PAPER_SIZES}
@param string $orientation 'portrait' or 'landscape'
@return $this | [
"Sets",
"the",
"paper",
"size",
"&",
"orientation"
] | 75f13c700009be21a1965dc2c5b68a8708c22ba2 | https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/src/Dompdf.php#L1042-L1047 | train | Set Paper Size and Orientation | [
30522,
2270,
3853,
2275,
23298,
1006,
1002,
2946,
1010,
1002,
10296,
1027,
1000,
6533,
1000,
1007,
1063,
1002,
2023,
1011,
1028,
4981,
4697,
1027,
1002,
2946,
1025,
1002,
2023,
1011,
1028,
3259,
10050,
19304,
1027,
1002,
10296,
1025,
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... |
symfony/symfony | src/Symfony/Component/Form/Form.php | Form.setParent | public function setParent(FormInterface $parent = null)
{
if ($this->submitted) {
throw new AlreadySubmittedException('You cannot set the parent of a submitted form');
}
if (null !== $parent && '' === $this->name) {
throw new LogicException('A form with an empty name cannot have a parent form.');
}
$this->parent = $parent;
return $this;
} | php | public function setParent(FormInterface $parent = null)
{
if ($this->submitted) {
throw new AlreadySubmittedException('You cannot set the parent of a submitted form');
}
if (null !== $parent && '' === $this->name) {
throw new LogicException('A form with an empty name cannot have a parent form.');
}
$this->parent = $parent;
return $this;
} | [
"public",
"function",
"setParent",
"(",
"FormInterface",
"$",
"parent",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"submitted",
")",
"{",
"throw",
"new",
"AlreadySubmittedException",
"(",
"'You cannot set the parent of a submitted form'",
")",
";",
"}",
... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Form.php#L266-L279 | train | Set the parent form | [
30522,
2270,
3853,
2275,
19362,
4765,
1006,
2433,
18447,
2121,
12172,
1002,
6687,
1027,
19701,
1007,
1063,
2065,
1006,
1002,
2023,
1011,
1028,
7864,
1007,
1063,
5466,
2047,
2525,
6342,
25526,
27100,
3207,
2595,
24422,
1006,
1005,
2017,
3685... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getgrav/grav | system/src/Grav/Common/Utils.php | Utils.convertSize | public static function convertSize($bytes, $to, $decimal_places = 1)
{
$formulas = array(
'K' => number_format($bytes / 1024, $decimal_places),
'M' => number_format($bytes / 1048576, $decimal_places),
'G' => number_format($bytes / 1073741824, $decimal_places)
);
return $formulas[$to] ?? 0;
} | php | public static function convertSize($bytes, $to, $decimal_places = 1)
{
$formulas = array(
'K' => number_format($bytes / 1024, $decimal_places),
'M' => number_format($bytes / 1048576, $decimal_places),
'G' => number_format($bytes / 1073741824, $decimal_places)
);
return $formulas[$to] ?? 0;
} | [
"public",
"static",
"function",
"convertSize",
"(",
"$",
"bytes",
",",
"$",
"to",
",",
"$",
"decimal_places",
"=",
"1",
")",
"{",
"$",
"formulas",
"=",
"array",
"(",
"'K'",
"=>",
"number_format",
"(",
"$",
"bytes",
"/",
"1024",
",",
"$",
"decimal_place... | Convert bytes to the unit specified by the $to parameter.
@param int $bytes The filesize in Bytes.
@param string $to The unit type to convert to. Accepts K, M, or G for Kilobytes, Megabytes, or Gigabytes, respectively.
@param int $decimal_places The number of decimal places to return.
@return int Returns only the number of units, not the type letter. Returns 0 if the $to unit type is out of scope. | [
"Convert",
"bytes",
"to",
"the",
"unit",
"specified",
"by",
"the",
"$to",
"parameter",
"."
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Utils.php#L1373-L1381 | train | Convert size from bytes to number format | [
30522,
2270,
10763,
3853,
19884,
4697,
1006,
1002,
27507,
1010,
1002,
2000,
1010,
1002,
26066,
1035,
3182,
1027,
1015,
1007,
1063,
1002,
25814,
1027,
9140,
1006,
1005,
1047,
1005,
1027,
1028,
2193,
1035,
4289,
1006,
1002,
27507,
1013,
9402,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/PrivacyManager/Controller.php | Controller.executeDataPurge | public function executeDataPurge()
{
$this->checkDataPurgeAdminSettingsIsEnabled();
Piwik::checkUserHasSuperUserAccess();
$this->checkTokenInUrl();
// if the request isn't a POST, redirect to index
if ($_SERVER["REQUEST_METHOD"] != "POST"
&& !Common::isPhpCliMode()
) {
$this->redirectToIndex('PrivacyManager', 'privacySettings');
return;
}
$settings = PrivacyManager::getPurgeDataSettings();
if ($settings['delete_logs_enable']) {
/** @var LogDataPurger $logDataPurger */
$logDataPurger = StaticContainer::get('Piwik\Plugins\PrivacyManager\LogDataPurger');
$logDataPurger->purgeData($settings['delete_logs_older_than'], true);
}
if ($settings['delete_reports_enable']) {
$reportsPurger = ReportsPurger::make($settings, PrivacyManager::getAllMetricsToKeep());
$reportsPurger->purgeData(true);
}
} | php | public function executeDataPurge()
{
$this->checkDataPurgeAdminSettingsIsEnabled();
Piwik::checkUserHasSuperUserAccess();
$this->checkTokenInUrl();
// if the request isn't a POST, redirect to index
if ($_SERVER["REQUEST_METHOD"] != "POST"
&& !Common::isPhpCliMode()
) {
$this->redirectToIndex('PrivacyManager', 'privacySettings');
return;
}
$settings = PrivacyManager::getPurgeDataSettings();
if ($settings['delete_logs_enable']) {
/** @var LogDataPurger $logDataPurger */
$logDataPurger = StaticContainer::get('Piwik\Plugins\PrivacyManager\LogDataPurger');
$logDataPurger->purgeData($settings['delete_logs_older_than'], true);
}
if ($settings['delete_reports_enable']) {
$reportsPurger = ReportsPurger::make($settings, PrivacyManager::getAllMetricsToKeep());
$reportsPurger->purgeData(true);
}
} | [
"public",
"function",
"executeDataPurge",
"(",
")",
"{",
"$",
"this",
"->",
"checkDataPurgeAdminSettingsIsEnabled",
"(",
")",
";",
"Piwik",
"::",
"checkUserHasSuperUserAccess",
"(",
")",
";",
"$",
"this",
"->",
"checkTokenInUrl",
"(",
")",
";",
"// if the request ... | Executes a data purge, deleting raw data and report data using the current config
options. Echo's the result of getDatabaseSize after purging. | [
"Executes",
"a",
"data",
"purge",
"deleting",
"raw",
"data",
"and",
"report",
"data",
"using",
"the",
"current",
"config",
"options",
".",
"Echo",
"s",
"the",
"result",
"of",
"getDatabaseSize",
"after",
"purging",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/PrivacyManager/Controller.php#L217-L242 | train | Purges data from the privacy settings | [
30522,
2270,
3853,
6472,
6790,
30524,
18715,
18595,
11231,
12190,
1006,
1007,
1025,
1013,
1013,
2065,
1996,
5227,
3475,
1005,
1056,
1037,
2695,
1010,
2417,
7442,
6593,
2000,
5950,
2065,
1006,
1002,
1035,
8241,
1031,
1000,
5227,
1035,
4118,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Cache/RedisStore.php | RedisStore.tags | public function tags($names)
{
return new RedisTaggedCache(
$this, new TagSet($this, is_array($names) ? $names : func_get_args())
);
} | php | public function tags($names)
{
return new RedisTaggedCache(
$this, new TagSet($this, is_array($names) ? $names : func_get_args())
);
} | [
"public",
"function",
"tags",
"(",
"$",
"names",
")",
"{",
"return",
"new",
"RedisTaggedCache",
"(",
"$",
"this",
",",
"new",
"TagSet",
"(",
"$",
"this",
",",
"is_array",
"(",
"$",
"names",
")",
"?",
"$",
"names",
":",
"func_get_args",
"(",
")",
")",... | Begin executing a new tags operation.
@param array|mixed $names
@return \Illuminate\Cache\RedisTaggedCache | [
"Begin",
"executing",
"a",
"new",
"tags",
"operation",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Cache/RedisStore.php#L228-L233 | train | Create a cache with the given tags | [
30522,
2270,
3853,
22073,
1006,
1002,
3415,
1007,
1063,
2709,
2047,
2417,
11921,
15567,
3540,
5403,
1006,
1002,
2023,
1010,
2047,
22073,
3388,
1006,
1002,
2023,
1010,
2003,
1035,
9140,
1006,
1002,
3415,
1007,
1029,
1002,
3415,
1024,
4569,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.isAccepted | protected function isAccepted($string)
{
// should at least not match one rule to exclude
foreach ($this->noMatchRegexps as $regex) {
if (preg_match($regex, $string)) {
return false;
}
}
// should at least match one rule
if ($this->matchRegexps) {
foreach ($this->matchRegexps as $regex) {
if (preg_match($regex, $string)) {
return true;
}
}
return false;
}
// If there is no match rules, the file is accepted
return true;
} | php | protected function isAccepted($string)
{
// should at least not match one rule to exclude
foreach ($this->noMatchRegexps as $regex) {
if (preg_match($regex, $string)) {
return false;
}
}
// should at least match one rule
if ($this->matchRegexps) {
foreach ($this->matchRegexps as $regex) {
if (preg_match($regex, $string)) {
return true;
}
}
return false;
}
// If there is no match rules, the file is accepted
return true;
} | [
"protected",
"function",
"isAccepted",
"(",
"$",
"string",
")",
"{",
"// should at least not match one rule to exclude",
"foreach",
"(",
"$",
"this",
"->",
"noMatchRegexps",
"as",
"$",
"regex",
")",
"{",
"if",
"(",
"preg_match",
"(",
"$",
"regex",
",",
"$",
"s... | Checks whether the string is accepted by the regex filters.
If there is no regexps defined in the class, this method will accept the string.
Such case can be handled by child classes before calling the method if they want to
apply a different behavior.
@param string $string The string to be matched against filters
@return bool | [
"Checks",
"whether",
"the",
"string",
"is",
"accepted",
"by",
"the",
"regex",
"filters",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Finder/Iterator/MultiplePcreFilterIterator.php#L53-L75 | train | Check if the string is accepted by the filter | [
30522,
5123,
3853,
18061,
9468,
23606,
2098,
1006,
1002,
5164,
1007,
1063,
1013,
1013,
2323,
2012,
2560,
2025,
2674,
2028,
3627,
2000,
23329,
18921,
6776,
1006,
1002,
2023,
1011,
1028,
2053,
18900,
2818,
2890,
3351,
2595,
4523,
2004,
1002,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Console/Question/ChoiceQuestion.php | ChoiceQuestion.setErrorMessage | public function setErrorMessage($errorMessage)
{
$this->errorMessage = $errorMessage;
$this->setValidator($this->getDefaultValidator());
return $this;
} | php | public function setErrorMessage($errorMessage)
{
$this->errorMessage = $errorMessage;
$this->setValidator($this->getDefaultValidator());
return $this;
} | [
"public",
"function",
"setErrorMessage",
"(",
"$",
"errorMessage",
")",
"{",
"$",
"this",
"->",
"errorMessage",
"=",
"$",
"errorMessage",
";",
"$",
"this",
"->",
"setValidator",
"(",
"$",
"this",
"->",
"getDefaultValidator",
"(",
")",
")",
";",
"return",
"... | Sets the error message for invalid values.
The error message has a string placeholder (%s) for the invalid value.
@param string $errorMessage
@return $this | [
"Sets",
"the",
"error",
"message",
"for",
"invalid",
"values",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Console/Question/ChoiceQuestion.php#L116-L122 | train | Set error message | [
30522,
2270,
3853,
2275,
2121,
29165,
7834,
3736,
3351,
1006,
1002,
7561,
7834,
3736,
3351,
1007,
1063,
1002,
2023,
1011,
1028,
7561,
7834,
3736,
3351,
1027,
1002,
7561,
7834,
3736,
3351,
1025,
1002,
2023,
1011,
1028,
2275,
10175,
8524,
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... |
laravel/framework | src/Illuminate/Console/Scheduling/ScheduleFinishCommand.php | ScheduleFinishCommand.handle | public function handle()
{
collect($this->schedule->events())->filter(function ($value) {
return $value->mutexName() == $this->argument('id');
})->each->callAfterCallbacks($this->laravel);
} | php | public function handle()
{
collect($this->schedule->events())->filter(function ($value) {
return $value->mutexName() == $this->argument('id');
})->each->callAfterCallbacks($this->laravel);
} | [
"public",
"function",
"handle",
"(",
")",
"{",
"collect",
"(",
"$",
"this",
"->",
"schedule",
"->",
"events",
"(",
")",
")",
"->",
"filter",
"(",
"function",
"(",
"$",
"value",
")",
"{",
"return",
"$",
"value",
"->",
"mutexName",
"(",
")",
"==",
"$... | Execute the console command.
@return void | [
"Execute",
"the",
"console",
"command",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Console/Scheduling/ScheduleFinishCommand.php#L55-L60 | train | Handle the event. | [
30522,
2270,
3853,
5047,
1006,
1007,
1063,
8145,
1006,
1002,
2023,
1011,
1028,
6134,
1011,
1028,
2824,
1006,
1007,
1007,
1011,
1028,
11307,
1006,
3853,
1006,
1002,
3643,
1007,
1063,
2709,
1002,
3643,
1011,
1028,
20101,
2595,
18442,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/DependencyInjection/Loader/Configurator/AbstractServiceConfigurator.php | AbstractServiceConfigurator.set | final public function set(string $id, string $class = null): ServiceConfigurator
{
$this->__destruct();
return $this->parent->set($id, $class);
} | php | final public function set(string $id, string $class = null): ServiceConfigurator
{
$this->__destruct();
return $this->parent->set($id, $class);
} | [
"final",
"public",
"function",
"set",
"(",
"string",
"$",
"id",
",",
"string",
"$",
"class",
"=",
"null",
")",
":",
"ServiceConfigurator",
"{",
"$",
"this",
"->",
"__destruct",
"(",
")",
";",
"return",
"$",
"this",
"->",
"parent",
"->",
"set",
"(",
"... | Registers a service. | [
"Registers",
"a",
"service",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DependencyInjection/Loader/Configurator/AbstractServiceConfigurator.php#L45-L50 | train | Set the id and class of the node | [
30522,
2345,
2270,
30524,
1007,
1025,
1065,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/table/ServerEventDataSource.php | ServerEventDataSource.searchRecords | public function searchRecords($query, $offset, $count)
{
return $this->fireEvent('data.searchRecords', [$query, $offset, $count], true);
} | php | public function searchRecords($query, $offset, $count)
{
return $this->fireEvent('data.searchRecords', [$query, $offset, $count], true);
} | [
"public",
"function",
"searchRecords",
"(",
"$",
"query",
",",
"$",
"offset",
",",
"$",
"count",
")",
"{",
"return",
"$",
"this",
"->",
"fireEvent",
"(",
"'data.searchRecords'",
",",
"[",
"$",
"query",
",",
"$",
"offset",
",",
"$",
"count",
"]",
",",
... | Identical to getRecords except provided with a search query. | [
"Identical",
"to",
"getRecords",
"except",
"provided",
"with",
"a",
"search",
"query",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/table/ServerEventDataSource.php#L25-L28 | train | Search records in the recordset | [
30522,
2270,
3853,
3945,
2890,
27108,
5104,
1006,
1002,
23032,
1010,
1002,
16396,
1010,
1002,
4175,
1007,
1063,
2709,
1002,
2023,
1011,
1028,
2543,
18697,
3372,
1006,
1005,
2951,
1012,
3945,
2890,
27108,
5104,
1005,
1010,
1031,
1002,
23032,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/CachePoolPruneCommand.php | CachePoolPruneCommand.execute | protected function execute(InputInterface $input, OutputInterface $output)
{
$io = new SymfonyStyle($input, $output);
foreach ($this->pools as $name => $pool) {
$io->comment(sprintf('Pruning cache pool: <info>%s</info>', $name));
$pool->prune();
}
$io->success('Successfully pruned cache pool(s).');
} | php | protected function execute(InputInterface $input, OutputInterface $output)
{
$io = new SymfonyStyle($input, $output);
foreach ($this->pools as $name => $pool) {
$io->comment(sprintf('Pruning cache pool: <info>%s</info>', $name));
$pool->prune();
}
$io->success('Successfully pruned cache pool(s).');
} | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"$",
"io",
"=",
"new",
"SymfonyStyle",
"(",
"$",
"input",
",",
"$",
"output",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"pools",
... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/FrameworkBundle/Command/CachePoolPruneCommand.php#L60-L70 | train | Prunes cache pools | [
30522,
5123,
3853,
15389,
1006,
7953,
18447,
2121,
12172,
1002,
7953,
1010,
6434,
18447,
2121,
12172,
1002,
6434,
1007,
1063,
1002,
22834,
1027,
2047,
25353,
2213,
14876,
4890,
21756,
2571,
1006,
1002,
7953,
1010,
1002,
6434,
1007,
1025,
18... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Database/Seeder.php | Seeder.resolve | protected function resolve($class)
{
if (isset($this->container)) {
$instance = $this->container->make($class);
$instance->setContainer($this->container);
} else {
$instance = new $class;
}
if (isset($this->command)) {
$instance->setCommand($this->command);
}
return $instance;
} | php | protected function resolve($class)
{
if (isset($this->container)) {
$instance = $this->container->make($class);
$instance->setContainer($this->container);
} else {
$instance = new $class;
}
if (isset($this->command)) {
$instance->setCommand($this->command);
}
return $instance;
} | [
"protected",
"function",
"resolve",
"(",
"$",
"class",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"container",
")",
")",
"{",
"$",
"instance",
"=",
"$",
"this",
"->",
"container",
"->",
"make",
"(",
"$",
"class",
")",
";",
"$",
"instance... | Resolve an instance of the given seeder class.
@param string $class
@return \Illuminate\Database\Seeder | [
"Resolve",
"an",
"instance",
"of",
"the",
"given",
"seeder",
"class",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Seeder.php#L65-L80 | train | Resolves the class and returns the instance. | [
30522,
5123,
3853,
10663,
1006,
1002,
2465,
1007,
1063,
2065,
1006,
26354,
3388,
1006,
1002,
2023,
1011,
1028,
11661,
1007,
1007,
1063,
1002,
6013,
1027,
1002,
2023,
1011,
1028,
11661,
1011,
1028,
2191,
1006,
1002,
2465,
1007,
1025,
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... |
dompdf/dompdf | src/Adapter/PDFLib.php | PDFLib.page_line | public function page_line($x1, $y1, $x2, $y2, $color, $width, $style = array())
{
$_t = 'line';
$this->_page_text[] = compact('_t', 'x1', 'y1', 'x2', 'y2', 'color', 'width', 'style');
} | php | public function page_line($x1, $y1, $x2, $y2, $color, $width, $style = array())
{
$_t = 'line';
$this->_page_text[] = compact('_t', 'x1', 'y1', 'x2', 'y2', 'color', 'width', 'style');
} | [
"public",
"function",
"page_line",
"(",
"$",
"x1",
",",
"$",
"y1",
",",
"$",
"x2",
",",
"$",
"y2",
",",
"$",
"color",
",",
"$",
"width",
",",
"$",
"style",
"=",
"array",
"(",
")",
")",
"{",
"$",
"_t",
"=",
"'line'",
";",
"$",
"this",
"->",
... | Draw line at the specified coordinates on every page.
See {@link Style::munge_color()} for the format of the colour array.
@param float $x1
@param float $y1
@param float $x2
@param float $y2
@param array $color
@param float $width
@param array $style optional | [
"Draw",
"line",
"at",
"the",
"specified",
"coordinates",
"on",
"every",
"page",
"."
] | 75f13c700009be21a1965dc2c5b68a8708c22ba2 | https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/src/Adapter/PDFLib.php#L889-L893 | train | Page Line - related stuff | [
30522,
2270,
3853,
3931,
1035,
2240,
1006,
1002,
1060,
2487,
1010,
1002,
1061,
2487,
1010,
1002,
1060,
2475,
1010,
1002,
1061,
2475,
1010,
1002,
3609,
1010,
1002,
9381,
1010,
1002,
2806,
1027,
9140,
1006,
1007,
1007,
1063,
1002,
1035,
105... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.addRoute | public function addRoute(Route $route, $name = null)
{
if (null === $name) {
// used as a flag to know which routes will need a name later
$name = '_unnamed_route_'.spl_object_hash($route);
}
$this->routes[$name] = $route;
return $this;
} | php | public function addRoute(Route $route, $name = null)
{
if (null === $name) {
// used as a flag to know which routes will need a name later
$name = '_unnamed_route_'.spl_object_hash($route);
}
$this->routes[$name] = $route;
return $this;
} | [
"public",
"function",
"addRoute",
"(",
"Route",
"$",
"route",
",",
"$",
"name",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"name",
")",
"{",
"// used as a flag to know which routes will need a name later",
"$",
"name",
"=",
"'_unnamed_route_'",
".",
... | Adds a Route object to the builder.
@param Route $route
@param string|null $name
@return $this | [
"Adds",
"a",
"Route",
"object",
"to",
"the",
"builder",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Routing/RouteCollectionBuilder.php#L135-L145 | train | Add a route to the list of routes | [
30522,
2270,
3853,
5587,
22494,
2618,
1006,
2799,
1002,
2799,
1010,
1002,
2171,
1027,
19701,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
1027,
1002,
2171,
1007,
1063,
1013,
1013,
2109,
2004,
1037,
5210,
2000,
2113,
2029,
5847,
2097,
2342,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Tab.php | Tab.getTabs | public function getTabs()
{
// If there is no active tab, then active the first.
if ($this->tabs->filter(function ($tab) {
return $tab['active'];
})->isEmpty()) {
$first = $this->tabs->first();
$first['active'] = true;
$this->tabs->offsetSet(0, $first);
}
return $this->tabs;
} | php | public function getTabs()
{
// If there is no active tab, then active the first.
if ($this->tabs->filter(function ($tab) {
return $tab['active'];
})->isEmpty()) {
$first = $this->tabs->first();
$first['active'] = true;
$this->tabs->offsetSet(0, $first);
}
return $this->tabs;
} | [
"public",
"function",
"getTabs",
"(",
")",
"{",
"// If there is no active tab, then active the first.",
"if",
"(",
"$",
"this",
"->",
"tabs",
"->",
"filter",
"(",
"function",
"(",
"$",
"tab",
")",
"{",
"return",
"$",
"tab",
"[",
"'active'",
"]",
";",
"}",
... | Get all tabs.
@return Collection | [
"Get",
"all",
"tabs",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Form/Tab.php#L104-L117 | train | Get all tabs | [
30522,
2270,
3853,
2131,
2696,
5910,
1006,
1007,
1063,
1013,
1013,
2065,
2045,
2003,
2053,
3161,
21628,
1010,
2059,
3161,
1996,
2034,
1012,
2065,
30524,
1002,
21628,
1031,
1005,
3161,
1005,
1033,
1025,
1065,
1007,
1011,
1028,
2003,
6633,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Renderer.php | HTML_QuickForm2_Renderer.register | final public static function register($type, $className, $includeFile = null)
{
$type = strtolower($type);
if (!empty(self::$_types[$type])) {
throw new HTML_QuickForm2_InvalidArgumentException(
"Renderer type '$type' is already registered"
);
}
self::$_types[$type] = array($className, $includeFile);
if (empty(self::$_pluginClasses[$type])) {
self::$_pluginClasses[$type] = array();
}
} | php | final public static function register($type, $className, $includeFile = null)
{
$type = strtolower($type);
if (!empty(self::$_types[$type])) {
throw new HTML_QuickForm2_InvalidArgumentException(
"Renderer type '$type' is already registered"
);
}
self::$_types[$type] = array($className, $includeFile);
if (empty(self::$_pluginClasses[$type])) {
self::$_pluginClasses[$type] = array();
}
} | [
"final",
"public",
"static",
"function",
"register",
"(",
"$",
"type",
",",
"$",
"className",
",",
"$",
"includeFile",
"=",
"null",
")",
"{",
"$",
"type",
"=",
"strtolower",
"(",
"$",
"type",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"self",
"::",
"$... | Registers a new renderer type
@param string Type name (treated case-insensitively)
@param string Class name
@param string File containing the class, leave empty if class already loaded
@throws HTML_QuickForm2_InvalidArgumentException if type already registered | [
"Registers",
"a",
"new",
"renderer",
"type"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/HTML/QuickForm2/Renderer.php#L158-L170 | train | Registers a renderer type | [
30522,
2345,
2270,
10763,
3853,
4236,
1006,
1002,
2828,
1010,
1002,
2465,
18442,
1010,
1002,
2421,
8873,
2571,
1027,
19701,
1007,
1063,
1002,
2828,
1027,
2358,
5339,
12898,
13777,
1006,
1002,
2828,
1007,
1025,
2065,
1006,
999,
4064,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/VisitTime/API.php | API.getByDayOfWeek | public function getByDayOfWeek($idSite, $period, $date, $segment = false)
{
Piwik::checkUserHasViewAccess($idSite);
// metrics to query
$metrics = Metrics::getVisitsMetricNames();
unset($metrics[Metrics::INDEX_MAX_ACTIONS]);
// disabled for multiple dates
if (Period::isMultiplePeriod($date, $period)) {
throw new Exception("VisitTime.getByDayOfWeek does not support multiple dates.");
}
// get metric data for every day within the supplied period
$oPeriod = Period\Factory::makePeriodFromQueryParams(Site::getTimezoneFor($idSite), $period, $date);
$dateRange = $oPeriod->getDateStart()->toString() . ',' . $oPeriod->getDateEnd()->toString();
$archive = Archive::build($idSite, 'day', $dateRange, $segment);
// disabled for multiple sites
if (count($archive->getParams()->getIdSites()) > 1) {
throw new Exception("VisitTime.getByDayOfWeek does not support multiple sites.");
}
$dataTable = $archive->getDataTableFromNumeric($metrics)->mergeChildren();
// if there's no data for this report, don't bother w/ anything else
if ($dataTable->getRowsCount() == 0) {
return $dataTable;
}
// group by the day of the week (see below for dayOfWeekFromDate function)
$dataTable->filter('GroupBy', array('label', __NAMESPACE__ . '\dayOfWeekFromDate'));
// create new datatable w/ empty rows, then add calculated datatable
$rows = array();
foreach (array(1, 2, 3, 4, 5, 6, 7) as $day) {
$rows[] = array('label' => $day, 'nb_visits' => 0);
}
$result = new DataTable();
$result->addRowsFromSimpleArray($rows);
$result->addDataTable($dataTable);
// set day of week integer as metadata
$result->filter('ColumnCallbackAddMetadata', array('label', 'day_of_week'));
// translate labels
$result->filter('ColumnCallbackReplace', array('label', __NAMESPACE__ . '\translateDayOfWeek'));
// set datatable metadata for period start & finish
$result->setMetadata('date_start', $oPeriod->getDateStart());
$result->setMetadata('date_end', $oPeriod->getDateEnd());
return $result;
} | php | public function getByDayOfWeek($idSite, $period, $date, $segment = false)
{
Piwik::checkUserHasViewAccess($idSite);
// metrics to query
$metrics = Metrics::getVisitsMetricNames();
unset($metrics[Metrics::INDEX_MAX_ACTIONS]);
// disabled for multiple dates
if (Period::isMultiplePeriod($date, $period)) {
throw new Exception("VisitTime.getByDayOfWeek does not support multiple dates.");
}
// get metric data for every day within the supplied period
$oPeriod = Period\Factory::makePeriodFromQueryParams(Site::getTimezoneFor($idSite), $period, $date);
$dateRange = $oPeriod->getDateStart()->toString() . ',' . $oPeriod->getDateEnd()->toString();
$archive = Archive::build($idSite, 'day', $dateRange, $segment);
// disabled for multiple sites
if (count($archive->getParams()->getIdSites()) > 1) {
throw new Exception("VisitTime.getByDayOfWeek does not support multiple sites.");
}
$dataTable = $archive->getDataTableFromNumeric($metrics)->mergeChildren();
// if there's no data for this report, don't bother w/ anything else
if ($dataTable->getRowsCount() == 0) {
return $dataTable;
}
// group by the day of the week (see below for dayOfWeekFromDate function)
$dataTable->filter('GroupBy', array('label', __NAMESPACE__ . '\dayOfWeekFromDate'));
// create new datatable w/ empty rows, then add calculated datatable
$rows = array();
foreach (array(1, 2, 3, 4, 5, 6, 7) as $day) {
$rows[] = array('label' => $day, 'nb_visits' => 0);
}
$result = new DataTable();
$result->addRowsFromSimpleArray($rows);
$result->addDataTable($dataTable);
// set day of week integer as metadata
$result->filter('ColumnCallbackAddMetadata', array('label', 'day_of_week'));
// translate labels
$result->filter('ColumnCallbackReplace', array('label', __NAMESPACE__ . '\translateDayOfWeek'));
// set datatable metadata for period start & finish
$result->setMetadata('date_start', $oPeriod->getDateStart());
$result->setMetadata('date_end', $oPeriod->getDateEnd());
return $result;
} | [
"public",
"function",
"getByDayOfWeek",
"(",
"$",
"idSite",
",",
"$",
"period",
",",
"$",
"date",
",",
"$",
"segment",
"=",
"false",
")",
"{",
"Piwik",
"::",
"checkUserHasViewAccess",
"(",
"$",
"idSite",
")",
";",
"// metrics to query",
"$",
"metrics",
"="... | Returns datatable describing the number of visits for each day of the week.
@param string $idSite The site ID. Cannot refer to multiple sites.
@param string $period The period type: day, week, year, range...
@param string $date The start date of the period. Cannot refer to multiple dates.
@param bool|string $segment The segment.
@throws Exception
@return DataTable | [
"Returns",
"datatable",
"describing",
"the",
"number",
"of",
"visits",
"for",
"each",
"day",
"of",
"the",
"week",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/VisitTime/API.php#L79-L133 | train | Returns the datatable for every visits of the week | [
30522,
2270,
3853,
2131,
3762,
10259,
11253,
28075,
1006,
1002,
8909,
28032,
2063,
1010,
1002,
2558,
1010,
1002,
3058,
1010,
1002,
6903,
1027,
6270,
1007,
1063,
14255,
9148,
2243,
1024,
1024,
4638,
20330,
14949,
8584,
6305,
9623,
2015,
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... |
slimphp/Slim | Slim/Http/Headers.php | Headers.add | public function add($key, $value)
{
$oldValues = $this->get($key, []);
$newValues = is_array($value) ? $value : [$value];
$this->set($key, array_merge($oldValues, array_values($newValues)));
} | php | public function add($key, $value)
{
$oldValues = $this->get($key, []);
$newValues = is_array($value) ? $value : [$value];
$this->set($key, array_merge($oldValues, array_values($newValues)));
} | [
"public",
"function",
"add",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"$",
"oldValues",
"=",
"$",
"this",
"->",
"get",
"(",
"$",
"key",
",",
"[",
"]",
")",
";",
"$",
"newValues",
"=",
"is_array",
"(",
"$",
"value",
")",
"?",
"$",
"value",
... | {@inheritdoc} | [
"{"
] | ccef5f7d8bcd469d59cbe64f6210d83764f91543 | https://github.com/slimphp/Slim/blob/ccef5f7d8bcd469d59cbe64f6210d83764f91543/Slim/Http/Headers.php#L165-L170 | train | Add a new entry to the array | [
30522,
2270,
3853,
5587,
1006,
1002,
3145,
1010,
1002,
3643,
1007,
1063,
1002,
2214,
10175,
15808,
1027,
1002,
2023,
1011,
1028,
2131,
1006,
1002,
3145,
1010,
1031,
1033,
1007,
1025,
1002,
2047,
10175,
15808,
1027,
2003,
1035,
9140,
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... |
laravel/framework | src/Illuminate/Queue/BeanstalkdQueue.php | BeanstalkdQueue.later | public function later($delay, $job, $data = '', $queue = null)
{
$pheanstalk = $this->pheanstalk->useTube($this->getQueue($queue));
return $pheanstalk->put(
$this->createPayload($job, $this->getQueue($queue), $data),
Pheanstalk::DEFAULT_PRIORITY,
$this->secondsUntil($delay),
$this->timeToRun
);
} | php | public function later($delay, $job, $data = '', $queue = null)
{
$pheanstalk = $this->pheanstalk->useTube($this->getQueue($queue));
return $pheanstalk->put(
$this->createPayload($job, $this->getQueue($queue), $data),
Pheanstalk::DEFAULT_PRIORITY,
$this->secondsUntil($delay),
$this->timeToRun
);
} | [
"public",
"function",
"later",
"(",
"$",
"delay",
",",
"$",
"job",
",",
"$",
"data",
"=",
"''",
",",
"$",
"queue",
"=",
"null",
")",
"{",
"$",
"pheanstalk",
"=",
"$",
"this",
"->",
"pheanstalk",
"->",
"useTube",
"(",
"$",
"this",
"->",
"getQueue",
... | 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/BeanstalkdQueue.php#L107-L117 | train | Runs a job in the next timeout | [
30522,
2270,
3853,
2101,
1006,
1002,
8536,
1010,
1002,
3105,
1010,
1002,
2951,
1027,
1005,
1005,
1010,
1002,
24240,
1027,
19701,
1007,
1063,
1002,
6887,
11219,
9153,
13687,
1027,
1002,
2023,
1011,
1028,
6887,
11219,
9153,
13687,
1011,
1028,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/MobileMessaging/API.php | API.setSMSAPICredential | public function setSMSAPICredential($provider, $credentials = array())
{
$this->checkCredentialManagementRights();
$smsProviderInstance = SMSProvider::factory($provider);
$smsProviderInstance->verifyCredential($credentials);
$settings = $this->getCredentialManagerSettings();
$settings[MobileMessaging::PROVIDER_OPTION] = $provider;
$settings[MobileMessaging::API_KEY_OPTION] = $credentials;
$this->setCredentialManagerSettings($settings);
return true;
} | php | public function setSMSAPICredential($provider, $credentials = array())
{
$this->checkCredentialManagementRights();
$smsProviderInstance = SMSProvider::factory($provider);
$smsProviderInstance->verifyCredential($credentials);
$settings = $this->getCredentialManagerSettings();
$settings[MobileMessaging::PROVIDER_OPTION] = $provider;
$settings[MobileMessaging::API_KEY_OPTION] = $credentials;
$this->setCredentialManagerSettings($settings);
return true;
} | [
"public",
"function",
"setSMSAPICredential",
"(",
"$",
"provider",
",",
"$",
"credentials",
"=",
"array",
"(",
")",
")",
"{",
"$",
"this",
"->",
"checkCredentialManagementRights",
"(",
")",
";",
"$",
"smsProviderInstance",
"=",
"SMSProvider",
"::",
"factory",
... | set the SMS API credential
@param string $provider SMS API provider
@param array $credentials array with data like API Key or username
@return bool true if SMS API credential were validated and saved, false otherwise | [
"set",
"the",
"SMS",
"API",
"credential"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/MobileMessaging/API.php#L82-L97 | train | Set SMS API Credential | [
30522,
2270,
3853,
4520,
5244,
9331,
2594,
5596,
24271,
1006,
1002,
10802,
1010,
1002,
22496,
1027,
9140,
1006,
1007,
1007,
1063,
1002,
2023,
1011,
1028,
4638,
16748,
16454,
4818,
24805,
20511,
15950,
2015,
1006,
1007,
1025,
1002,
22434,
21... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/DependencyInjection/Loader/Configurator/ParametersConfigurator.php | ParametersConfigurator.set | final public function set(string $name, $value)
{
$this->container->setParameter($name, static::processValue($value, true));
return $this;
} | php | final public function set(string $name, $value)
{
$this->container->setParameter($name, static::processValue($value, true));
return $this;
} | [
"final",
"public",
"function",
"set",
"(",
"string",
"$",
"name",
",",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"container",
"->",
"setParameter",
"(",
"$",
"name",
",",
"static",
"::",
"processValue",
"(",
"$",
"value",
",",
"true",
")",
")",
";",... | Creates a parameter.
@return $this | [
"Creates",
"a",
"parameter",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DependencyInjection/Loader/Configurator/ParametersConfigurator.php#L35-L40 | train | Set a parameter value | [
30522,
2345,
2270,
3853,
2275,
1006,
5164,
1002,
2171,
1010,
1002,
3643,
1007,
1063,
1002,
2023,
1011,
1028,
11661,
1011,
1028,
2275,
28689,
22828,
1006,
1002,
2171,
1010,
10763,
1024,
1024,
2832,
10175,
5657,
1006,
1002,
3643,
1010,
2995,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Access/Gate.php | Gate.any | public function any($abilities, $arguments = [])
{
return collect($abilities)->contains(function ($ability) use ($arguments) {
return $this->check($ability, $arguments);
});
} | php | public function any($abilities, $arguments = [])
{
return collect($abilities)->contains(function ($ability) use ($arguments) {
return $this->check($ability, $arguments);
});
} | [
"public",
"function",
"any",
"(",
"$",
"abilities",
",",
"$",
"arguments",
"=",
"[",
"]",
")",
"{",
"return",
"collect",
"(",
"$",
"abilities",
")",
"->",
"contains",
"(",
"function",
"(",
"$",
"ability",
")",
"use",
"(",
"$",
"arguments",
")",
"{",
... | Determine if any one of the given abilities should be granted for the current user.
@param iterable|string $abilities
@param array|mixed $arguments
@return bool | [
"Determine",
"if",
"any",
"one",
"of",
"the",
"given",
"abilities",
"should",
"be",
"granted",
"for",
"the",
"current",
"user",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Auth/Access/Gate.php#L291-L296 | train | Checks if any of the given abilities are met | [
30522,
2270,
3853,
2151,
1006,
1002,
7590,
1010,
1002,
9918,
1027,
1031,
1033,
1007,
1063,
2709,
8145,
1006,
1002,
7590,
1007,
1011,
1028,
3397,
1006,
3853,
1006,
1002,
3754,
1007,
2224,
1006,
1002,
9918,
1007,
1063,
2709,
1002,
2023,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Security/Guard/Provider/GuardAuthenticationProvider.php | GuardAuthenticationProvider.authenticate | public function authenticate(TokenInterface $token)
{
if (!$token instanceof GuardTokenInterface) {
throw new \InvalidArgumentException('GuardAuthenticationProvider only supports GuardTokenInterface.');
}
if (!$token instanceof PreAuthenticationGuardToken) {
/*
* The listener *only* passes PreAuthenticationGuardToken instances.
* This means that an authenticated token (e.g. PostAuthenticationGuardToken)
* is being passed here, which happens if that token becomes
* "not authenticated" (e.g. happens if the user changes between
* requests). In this case, the user should be logged out, so
* we will return an AnonymousToken to accomplish that.
*/
// this should never happen - but technically, the token is
// authenticated... so it could just be returned
if ($token->isAuthenticated()) {
return $token;
}
// this AccountStatusException causes the user to be logged out
throw new AuthenticationExpiredException();
}
$guardAuthenticator = $this->findOriginatingAuthenticator($token);
if (null === $guardAuthenticator) {
throw new AuthenticationException(sprintf('Token with provider key "%s" did not originate from any of the guard authenticators of provider "%s".', $token->getGuardProviderKey(), $this->providerKey));
}
return $this->authenticateViaGuard($guardAuthenticator, $token);
} | php | public function authenticate(TokenInterface $token)
{
if (!$token instanceof GuardTokenInterface) {
throw new \InvalidArgumentException('GuardAuthenticationProvider only supports GuardTokenInterface.');
}
if (!$token instanceof PreAuthenticationGuardToken) {
/*
* The listener *only* passes PreAuthenticationGuardToken instances.
* This means that an authenticated token (e.g. PostAuthenticationGuardToken)
* is being passed here, which happens if that token becomes
* "not authenticated" (e.g. happens if the user changes between
* requests). In this case, the user should be logged out, so
* we will return an AnonymousToken to accomplish that.
*/
// this should never happen - but technically, the token is
// authenticated... so it could just be returned
if ($token->isAuthenticated()) {
return $token;
}
// this AccountStatusException causes the user to be logged out
throw new AuthenticationExpiredException();
}
$guardAuthenticator = $this->findOriginatingAuthenticator($token);
if (null === $guardAuthenticator) {
throw new AuthenticationException(sprintf('Token with provider key "%s" did not originate from any of the guard authenticators of provider "%s".', $token->getGuardProviderKey(), $this->providerKey));
}
return $this->authenticateViaGuard($guardAuthenticator, $token);
} | [
"public",
"function",
"authenticate",
"(",
"TokenInterface",
"$",
"token",
")",
"{",
"if",
"(",
"!",
"$",
"token",
"instanceof",
"GuardTokenInterface",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'GuardAuthenticationProvider only supports GuardToke... | Finds the correct authenticator for the token and calls it.
@param GuardTokenInterface $token
@return TokenInterface | [
"Finds",
"the",
"correct",
"authenticator",
"for",
"the",
"token",
"and",
"calls",
"it",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Security/Guard/Provider/GuardAuthenticationProvider.php#L64-L97 | train | Authenticate a token | [
30522,
2270,
3853,
14469,
3686,
1006,
19204,
18447,
2121,
12172,
1002,
19204,
1007,
1063,
2065,
1006,
999,
1002,
19204,
6013,
11253,
3457,
18715,
18595,
10111,
12881,
10732,
1007,
1063,
5466,
2047,
1032,
19528,
2906,
22850,
15781,
2595,
24422... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/backend/formwidgets/RichEditor.php | RichEditor.getPageLinkTypes | protected function getPageLinkTypes()
{
$result = [];
$apiResult = Event::fire('backend.richeditor.listTypes');
if (is_array($apiResult)) {
foreach ($apiResult as $typeList) {
if (!is_array($typeList)) {
continue;
}
foreach ($typeList as $typeCode => $typeName) {
$result[$typeCode] = $typeName;
}
}
}
return $result;
} | php | protected function getPageLinkTypes()
{
$result = [];
$apiResult = Event::fire('backend.richeditor.listTypes');
if (is_array($apiResult)) {
foreach ($apiResult as $typeList) {
if (!is_array($typeList)) {
continue;
}
foreach ($typeList as $typeCode => $typeName) {
$result[$typeCode] = $typeName;
}
}
}
return $result;
} | [
"protected",
"function",
"getPageLinkTypes",
"(",
")",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"$",
"apiResult",
"=",
"Event",
"::",
"fire",
"(",
"'backend.richeditor.listTypes'",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"apiResult",
")",
")",
"{",
"fo... | Returns a list of registered page link types.
This is reserved functionality for separating the links by type.
@return array Returns an array of registered page link types | [
"Returns",
"a",
"list",
"of",
"registered",
"page",
"link",
"types",
".",
"This",
"is",
"reserved",
"functionality",
"for",
"separating",
"the",
"links",
"by",
"type",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/formwidgets/RichEditor.php#L163-L181 | train | Get page link types | [
30522,
5123,
3853,
2131,
13704,
13767,
13874,
2015,
1006,
1007,
1063,
1002,
2765,
1027,
1031,
1033,
1025,
1002,
17928,
6072,
11314,
1027,
2724,
1024,
1024,
2543,
1006,
1005,
2067,
10497,
1012,
4138,
2098,
15660,
1012,
2862,
13874,
2015,
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... |
laravel/framework | src/Illuminate/Filesystem/FilesystemAdapter.php | FilesystemAdapter.assertExists | public function assertExists($path)
{
$paths = Arr::wrap($path);
foreach ($paths as $path) {
PHPUnit::assertTrue(
$this->exists($path), "Unable to find a file at path [{$path}]."
);
}
return $this;
} | php | public function assertExists($path)
{
$paths = Arr::wrap($path);
foreach ($paths as $path) {
PHPUnit::assertTrue(
$this->exists($path), "Unable to find a file at path [{$path}]."
);
}
return $this;
} | [
"public",
"function",
"assertExists",
"(",
"$",
"path",
")",
"{",
"$",
"paths",
"=",
"Arr",
"::",
"wrap",
"(",
"$",
"path",
")",
";",
"foreach",
"(",
"$",
"paths",
"as",
"$",
"path",
")",
"{",
"PHPUnit",
"::",
"assertTrue",
"(",
"$",
"this",
"->",
... | Assert that the given file exists.
@param string|array $path
@return $this | [
"Assert",
"that",
"the",
"given",
"file",
"exists",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Filesystem/FilesystemAdapter.php#L57-L68 | train | Assert that a file exists in the current directory | [
30522,
2270,
3853,
20865,
10288,
5130,
1006,
1002,
4130,
1007,
1063,
1002,
10425,
1027,
12098,
2099,
1024,
1024,
10236,
1006,
1002,
4130,
1007,
1025,
18921,
6776,
1006,
1002,
10425,
2004,
1002,
4130,
1007,
1063,
25718,
19496,
2102,
1024,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/Filesystem.php | Filesystem.unlinkRecursive | public static function unlinkRecursive($dir, $deleteRootToo, \Closure $beforeUnlink = null)
{
if (!$dh = @opendir($dir)) {
return;
}
while (false !== ($obj = readdir($dh))) {
if ($obj == '.' || $obj == '..') {
continue;
}
$path = $dir . '/' . $obj;
if ($beforeUnlink) {
$beforeUnlink($path);
}
if (!@unlink($path)) {
self::unlinkRecursive($path, true);
}
}
closedir($dh);
if ($deleteRootToo) {
@rmdir($dir);
}
return;
} | php | public static function unlinkRecursive($dir, $deleteRootToo, \Closure $beforeUnlink = null)
{
if (!$dh = @opendir($dir)) {
return;
}
while (false !== ($obj = readdir($dh))) {
if ($obj == '.' || $obj == '..') {
continue;
}
$path = $dir . '/' . $obj;
if ($beforeUnlink) {
$beforeUnlink($path);
}
if (!@unlink($path)) {
self::unlinkRecursive($path, true);
}
}
closedir($dh);
if ($deleteRootToo) {
@rmdir($dir);
}
return;
} | [
"public",
"static",
"function",
"unlinkRecursive",
"(",
"$",
"dir",
",",
"$",
"deleteRootToo",
",",
"\\",
"Closure",
"$",
"beforeUnlink",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"dh",
"=",
"@",
"opendir",
"(",
"$",
"dir",
")",
")",
"{",
"return",... | Recursively deletes a directory.
@param string $dir Path of the directory to delete.
@param boolean $deleteRootToo If true, `$dir` is deleted, otherwise just its contents.
@param \Closure|false $beforeUnlink An optional closure to execute on a file path before unlinking.
@api | [
"Recursively",
"deletes",
"a",
"directory",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Filesystem.php#L206-L230 | train | Unlink recursive. | [
30522,
2270,
10763,
3853,
4895,
13767,
2890,
10841,
2869,
3512,
1006,
1002,
16101,
1010,
1002,
3972,
15141,
17206,
3406,
2080,
1010,
1032,
8503,
1002,
2077,
4609,
13767,
1027,
19701,
1007,
1063,
2065,
1006,
999,
1002,
28144,
1027,
1030,
233... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/SecurityBundle/DependencyInjection/MainConfiguration.php | MainConfiguration.getConfigTreeBuilder | public function getConfigTreeBuilder()
{
$tb = new TreeBuilder('security');
$rootNode = $tb->getRootNode();
$rootNode
->beforeNormalization()
->ifTrue(function ($v) {
if (!isset($v['access_decision_manager'])) {
return true;
}
if (!isset($v['access_decision_manager']['strategy']) && !isset($v['access_decision_manager']['service'])) {
return true;
}
return false;
})
->then(function ($v) {
$v['access_decision_manager']['strategy'] = AccessDecisionManager::STRATEGY_AFFIRMATIVE;
return $v;
})
->end()
->children()
->scalarNode('access_denied_url')->defaultNull()->example('/foo/error403')->end()
->enumNode('session_fixation_strategy')
->values([SessionAuthenticationStrategy::NONE, SessionAuthenticationStrategy::MIGRATE, SessionAuthenticationStrategy::INVALIDATE])
->defaultValue(SessionAuthenticationStrategy::MIGRATE)
->end()
->booleanNode('hide_user_not_found')->defaultTrue()->end()
->booleanNode('always_authenticate_before_granting')->defaultFalse()->end()
->booleanNode('erase_credentials')->defaultTrue()->end()
->arrayNode('access_decision_manager')
->addDefaultsIfNotSet()
->children()
->enumNode('strategy')
->values([AccessDecisionManager::STRATEGY_AFFIRMATIVE, AccessDecisionManager::STRATEGY_CONSENSUS, AccessDecisionManager::STRATEGY_UNANIMOUS])
->end()
->scalarNode('service')->end()
->booleanNode('allow_if_all_abstain')->defaultFalse()->end()
->booleanNode('allow_if_equal_granted_denied')->defaultTrue()->end()
->end()
->validate()
->ifTrue(function ($v) { return isset($v['strategy']) && isset($v['service']); })
->thenInvalid('"strategy" and "service" cannot be used together.')
->end()
->end()
->end()
;
$this->addEncodersSection($rootNode);
$this->addProvidersSection($rootNode);
$this->addFirewallsSection($rootNode, $this->factories);
$this->addAccessControlSection($rootNode);
$this->addRoleHierarchySection($rootNode);
return $tb;
} | php | public function getConfigTreeBuilder()
{
$tb = new TreeBuilder('security');
$rootNode = $tb->getRootNode();
$rootNode
->beforeNormalization()
->ifTrue(function ($v) {
if (!isset($v['access_decision_manager'])) {
return true;
}
if (!isset($v['access_decision_manager']['strategy']) && !isset($v['access_decision_manager']['service'])) {
return true;
}
return false;
})
->then(function ($v) {
$v['access_decision_manager']['strategy'] = AccessDecisionManager::STRATEGY_AFFIRMATIVE;
return $v;
})
->end()
->children()
->scalarNode('access_denied_url')->defaultNull()->example('/foo/error403')->end()
->enumNode('session_fixation_strategy')
->values([SessionAuthenticationStrategy::NONE, SessionAuthenticationStrategy::MIGRATE, SessionAuthenticationStrategy::INVALIDATE])
->defaultValue(SessionAuthenticationStrategy::MIGRATE)
->end()
->booleanNode('hide_user_not_found')->defaultTrue()->end()
->booleanNode('always_authenticate_before_granting')->defaultFalse()->end()
->booleanNode('erase_credentials')->defaultTrue()->end()
->arrayNode('access_decision_manager')
->addDefaultsIfNotSet()
->children()
->enumNode('strategy')
->values([AccessDecisionManager::STRATEGY_AFFIRMATIVE, AccessDecisionManager::STRATEGY_CONSENSUS, AccessDecisionManager::STRATEGY_UNANIMOUS])
->end()
->scalarNode('service')->end()
->booleanNode('allow_if_all_abstain')->defaultFalse()->end()
->booleanNode('allow_if_equal_granted_denied')->defaultTrue()->end()
->end()
->validate()
->ifTrue(function ($v) { return isset($v['strategy']) && isset($v['service']); })
->thenInvalid('"strategy" and "service" cannot be used together.')
->end()
->end()
->end()
;
$this->addEncodersSection($rootNode);
$this->addProvidersSection($rootNode);
$this->addFirewallsSection($rootNode, $this->factories);
$this->addAccessControlSection($rootNode);
$this->addRoleHierarchySection($rootNode);
return $tb;
} | [
"public",
"function",
"getConfigTreeBuilder",
"(",
")",
"{",
"$",
"tb",
"=",
"new",
"TreeBuilder",
"(",
"'security'",
")",
";",
"$",
"rootNode",
"=",
"$",
"tb",
"->",
"getRootNode",
"(",
")",
";",
"$",
"rootNode",
"->",
"beforeNormalization",
"(",
")",
"... | Generates the configuration tree builder.
@return TreeBuilder The tree builder | [
"Generates",
"the",
"configuration",
"tree",
"builder",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/SecurityBundle/DependencyInjection/MainConfiguration.php#L44-L102 | train | Returns the TreeBuilder object | [
30522,
2270,
3853,
2131,
8663,
8873,
13512,
9910,
8569,
23891,
2099,
1006,
1007,
1063,
1002,
26419,
1027,
2047,
3392,
8569,
23891,
2099,
1006,
1005,
3036,
1005,
1007,
1025,
1002,
7117,
3630,
3207,
1027,
1002,
26419,
1011,
1028,
2131,
3217,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.listComponentDetails | public function listComponentDetails()
{
if ($this->detailsCache !== null) {
return $this->detailsCache;
}
$details = [];
foreach ($this->listComponents() as $componentAlias => $componentClass) {
$details[$componentAlias] = $this->makeComponent($componentClass)->componentDetails();
}
return $this->detailsCache = $details;
} | php | public function listComponentDetails()
{
if ($this->detailsCache !== null) {
return $this->detailsCache;
}
$details = [];
foreach ($this->listComponents() as $componentAlias => $componentClass) {
$details[$componentAlias] = $this->makeComponent($componentClass)->componentDetails();
}
return $this->detailsCache = $details;
} | [
"public",
"function",
"listComponentDetails",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"detailsCache",
"!==",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"detailsCache",
";",
"}",
"$",
"details",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
... | Returns an array of all component detail definitions.
@return array Array keys are component codes, values are the details defined in the component. | [
"Returns",
"an",
"array",
"of",
"all",
"component",
"detail",
"definitions",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/ComponentManager.php#L139-L151 | train | Returns all the components details. | [
30522,
2270,
3853,
2862,
9006,
29513,
3372,
3207,
22081,
1006,
1007,
1063,
2065,
1006,
1002,
2023,
1011,
1028,
4751,
3540,
5403,
999,
1027,
1027,
19701,
1007,
1063,
2709,
1002,
2023,
1011,
1028,
4751,
3540,
5403,
1025,
1065,
1002,
4751,
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... |
barryvdh/laravel-debugbar | src/LaravelDebugbar.php | LaravelDebugbar.addThrowable | public function addThrowable($e)
{
if ($this->hasCollector('exceptions')) {
/** @var \DebugBar\DataCollector\ExceptionsCollector $collector */
$collector = $this->getCollector('exceptions');
$collector->addThrowable($e);
}
} | php | public function addThrowable($e)
{
if ($this->hasCollector('exceptions')) {
/** @var \DebugBar\DataCollector\ExceptionsCollector $collector */
$collector = $this->getCollector('exceptions');
$collector->addThrowable($e);
}
} | [
"public",
"function",
"addThrowable",
"(",
"$",
"e",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasCollector",
"(",
"'exceptions'",
")",
")",
"{",
"/** @var \\DebugBar\\DataCollector\\ExceptionsCollector $collector */",
"$",
"collector",
"=",
"$",
"this",
"->",
"get... | Adds an exception to be profiled in the debug bar
@param Exception $e | [
"Adds",
"an",
"exception",
"to",
"be",
"profiled",
"in",
"the",
"debug",
"bar"
] | 2d195779ea4f809f69764a795e2ec371dbb76a96 | https://github.com/barryvdh/laravel-debugbar/blob/2d195779ea4f809f69764a795e2ec371dbb76a96/src/LaravelDebugbar.php#L587-L594 | train | Add Throwable to ExceptionCollector | [
30522,
2270,
3853,
5587,
2705,
10524,
3085,
1006,
1002,
1041,
1007,
1063,
2065,
1006,
1002,
2023,
1011,
1028,
2038,
26895,
22471,
2953,
1006,
1005,
11790,
1005,
1007,
1007,
1063,
1013,
1008,
1008,
1030,
13075,
1032,
2139,
8569,
18259,
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... |
symfony/symfony | src/Symfony/Component/Finder/Iterator/DateRangeFilterIterator.php | DateRangeFilterIterator.accept | public function accept()
{
$fileinfo = $this->current();
if (!file_exists($fileinfo->getPathname())) {
return false;
}
$filedate = $fileinfo->getMTime();
foreach ($this->comparators as $compare) {
if (!$compare->test($filedate)) {
return false;
}
}
return true;
} | php | public function accept()
{
$fileinfo = $this->current();
if (!file_exists($fileinfo->getPathname())) {
return false;
}
$filedate = $fileinfo->getMTime();
foreach ($this->comparators as $compare) {
if (!$compare->test($filedate)) {
return false;
}
}
return true;
} | [
"public",
"function",
"accept",
"(",
")",
"{",
"$",
"fileinfo",
"=",
"$",
"this",
"->",
"current",
"(",
")",
";",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"fileinfo",
"->",
"getPathname",
"(",
")",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
... | Filters the iterator values.
@return bool true if the value should be kept, false otherwise | [
"Filters",
"the",
"iterator",
"values",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Finder/Iterator/DateRangeFilterIterator.php#L41-L57 | train | Accept a file | [
30522,
2270,
3853,
5138,
1006,
1007,
1063,
1002,
5371,
2378,
14876,
1027,
1002,
2023,
1011,
1028,
2783,
1006,
1007,
1025,
2065,
1006,
999,
5371,
1035,
6526,
1006,
1002,
5371,
2378,
14876,
1011,
1028,
2131,
15069,
18442,
1006,
1007,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php | HtmlDumper.style | protected function style($style, $value, $attr = [])
{
if ('' === $value) {
return '';
}
$v = esc($value);
if ('ref' === $style) {
if (empty($attr['count'])) {
return sprintf('<a class=sf-dump-ref>%s</a>', $v);
}
$r = ('#' !== $v[0] ? 1 - ('@' !== $v[0]) : 2).substr($value, 1);
return sprintf('<a class=sf-dump-ref href=#%s-ref%s title="%d occurrences">%s</a>', $this->dumpId, $r, 1 + $attr['count'], $v);
}
if ('const' === $style && isset($attr['value'])) {
$style .= sprintf(' title="%s"', esc(is_scalar($attr['value']) ? $attr['value'] : json_encode($attr['value'])));
} elseif ('public' === $style) {
$style .= sprintf(' title="%s"', empty($attr['dynamic']) ? 'Public property' : 'Runtime added dynamic property');
} elseif ('str' === $style && 1 < $attr['length']) {
$style .= sprintf(' title="%d%s characters"', $attr['length'], $attr['binary'] ? ' binary or non-UTF-8' : '');
} elseif ('note' === $style && false !== $c = strrpos($v, '\\')) {
if (isset($attr['file']) && $link = $this->getSourceLink($attr['file'], isset($attr['line']) ? $attr['line'] : 0)) {
$link = sprintf('<a href="%s" rel="noopener noreferrer">^</a>', esc($this->utf8Encode($link)));
} else {
$link = '';
}
return sprintf('<abbr title="%s" class=sf-dump-%s>%s</abbr>%s', $v, $style, substr($v, $c + 1), $link);
} elseif ('protected' === $style) {
$style .= ' title="Protected property"';
} elseif ('meta' === $style && isset($attr['title'])) {
$style .= sprintf(' title="%s"', esc($this->utf8Encode($attr['title'])));
} elseif ('private' === $style) {
$style .= sprintf(' title="Private property defined in class: `%s`"', esc($this->utf8Encode($attr['class'])));
}
$map = static::$controlCharsMap;
if (isset($attr['ellipsis'])) {
$class = 'sf-dump-ellipsis';
if (isset($attr['ellipsis-type'])) {
$class = sprintf('"%s sf-dump-ellipsis-%s"', $class, $attr['ellipsis-type']);
}
$label = esc(substr($value, -$attr['ellipsis']));
$style = str_replace(' title="', " title=\"$v\n", $style);
$v = sprintf('<span class=%s>%s</span>', $class, substr($v, 0, -\strlen($label)));
if (!empty($attr['ellipsis-tail'])) {
$tail = \strlen(esc(substr($value, -$attr['ellipsis'], $attr['ellipsis-tail'])));
$v .= sprintf('<span class=sf-dump-ellipsis>%s</span>%s', substr($label, 0, $tail), substr($label, $tail));
} else {
$v .= $label;
}
}
$v = "<span class=sf-dump-{$style}>".preg_replace_callback(static::$controlCharsRx, function ($c) use ($map) {
$s = $b = '<span class="sf-dump-default';
$c = $c[$i = 0];
if ($ns = "\r" === $c[$i] || "\n" === $c[$i]) {
$s .= ' sf-dump-ns';
}
$s .= '">';
do {
if (("\r" === $c[$i] || "\n" === $c[$i]) !== $ns) {
$s .= '</span>'.$b;
if ($ns = !$ns) {
$s .= ' sf-dump-ns';
}
$s .= '">';
}
$s .= isset($map[$c[$i]]) ? $map[$c[$i]] : sprintf('\x%02X', \ord($c[$i]));
} while (isset($c[++$i]));
return $s.'</span>';
}, $v).'</span>';
if (isset($attr['file']) && $href = $this->getSourceLink($attr['file'], isset($attr['line']) ? $attr['line'] : 0)) {
$attr['href'] = $href;
}
if (isset($attr['href'])) {
$target = isset($attr['file']) ? '' : ' target="_blank"';
$v = sprintf('<a href="%s"%s rel="noopener noreferrer">%s</a>', esc($this->utf8Encode($attr['href'])), $target, $v);
}
if (isset($attr['lang'])) {
$v = sprintf('<code class="%s">%s</code>', esc($attr['lang']), $v);
}
return $v;
} | php | protected function style($style, $value, $attr = [])
{
if ('' === $value) {
return '';
}
$v = esc($value);
if ('ref' === $style) {
if (empty($attr['count'])) {
return sprintf('<a class=sf-dump-ref>%s</a>', $v);
}
$r = ('#' !== $v[0] ? 1 - ('@' !== $v[0]) : 2).substr($value, 1);
return sprintf('<a class=sf-dump-ref href=#%s-ref%s title="%d occurrences">%s</a>', $this->dumpId, $r, 1 + $attr['count'], $v);
}
if ('const' === $style && isset($attr['value'])) {
$style .= sprintf(' title="%s"', esc(is_scalar($attr['value']) ? $attr['value'] : json_encode($attr['value'])));
} elseif ('public' === $style) {
$style .= sprintf(' title="%s"', empty($attr['dynamic']) ? 'Public property' : 'Runtime added dynamic property');
} elseif ('str' === $style && 1 < $attr['length']) {
$style .= sprintf(' title="%d%s characters"', $attr['length'], $attr['binary'] ? ' binary or non-UTF-8' : '');
} elseif ('note' === $style && false !== $c = strrpos($v, '\\')) {
if (isset($attr['file']) && $link = $this->getSourceLink($attr['file'], isset($attr['line']) ? $attr['line'] : 0)) {
$link = sprintf('<a href="%s" rel="noopener noreferrer">^</a>', esc($this->utf8Encode($link)));
} else {
$link = '';
}
return sprintf('<abbr title="%s" class=sf-dump-%s>%s</abbr>%s', $v, $style, substr($v, $c + 1), $link);
} elseif ('protected' === $style) {
$style .= ' title="Protected property"';
} elseif ('meta' === $style && isset($attr['title'])) {
$style .= sprintf(' title="%s"', esc($this->utf8Encode($attr['title'])));
} elseif ('private' === $style) {
$style .= sprintf(' title="Private property defined in class: `%s`"', esc($this->utf8Encode($attr['class'])));
}
$map = static::$controlCharsMap;
if (isset($attr['ellipsis'])) {
$class = 'sf-dump-ellipsis';
if (isset($attr['ellipsis-type'])) {
$class = sprintf('"%s sf-dump-ellipsis-%s"', $class, $attr['ellipsis-type']);
}
$label = esc(substr($value, -$attr['ellipsis']));
$style = str_replace(' title="', " title=\"$v\n", $style);
$v = sprintf('<span class=%s>%s</span>', $class, substr($v, 0, -\strlen($label)));
if (!empty($attr['ellipsis-tail'])) {
$tail = \strlen(esc(substr($value, -$attr['ellipsis'], $attr['ellipsis-tail'])));
$v .= sprintf('<span class=sf-dump-ellipsis>%s</span>%s', substr($label, 0, $tail), substr($label, $tail));
} else {
$v .= $label;
}
}
$v = "<span class=sf-dump-{$style}>".preg_replace_callback(static::$controlCharsRx, function ($c) use ($map) {
$s = $b = '<span class="sf-dump-default';
$c = $c[$i = 0];
if ($ns = "\r" === $c[$i] || "\n" === $c[$i]) {
$s .= ' sf-dump-ns';
}
$s .= '">';
do {
if (("\r" === $c[$i] || "\n" === $c[$i]) !== $ns) {
$s .= '</span>'.$b;
if ($ns = !$ns) {
$s .= ' sf-dump-ns';
}
$s .= '">';
}
$s .= isset($map[$c[$i]]) ? $map[$c[$i]] : sprintf('\x%02X', \ord($c[$i]));
} while (isset($c[++$i]));
return $s.'</span>';
}, $v).'</span>';
if (isset($attr['file']) && $href = $this->getSourceLink($attr['file'], isset($attr['line']) ? $attr['line'] : 0)) {
$attr['href'] = $href;
}
if (isset($attr['href'])) {
$target = isset($attr['file']) ? '' : ' target="_blank"';
$v = sprintf('<a href="%s"%s rel="noopener noreferrer">%s</a>', esc($this->utf8Encode($attr['href'])), $target, $v);
}
if (isset($attr['lang'])) {
$v = sprintf('<code class="%s">%s</code>', esc($attr['lang']), $v);
}
return $v;
} | [
"protected",
"function",
"style",
"(",
"$",
"style",
",",
"$",
"value",
",",
"$",
"attr",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"''",
"===",
"$",
"value",
")",
"{",
"return",
"''",
";",
"}",
"$",
"v",
"=",
"esc",
"(",
"$",
"value",
")",
";",
... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php#L831-L922 | train | Returns the dump style | [
30522,
5123,
3853,
2806,
1006,
1002,
2806,
1010,
1002,
3643,
1010,
1002,
2012,
16344,
1027,
1031,
1033,
1007,
1063,
2065,
1006,
1005,
1005,
1027,
1027,
1027,
1002,
3643,
1007,
1063,
2709,
1005,
1005,
1025,
1065,
1002,
1058,
1027,
9686,
22... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/Tracker/Request.php | Request.getVisitorIdForThirdPartyCookie | public function getVisitorIdForThirdPartyCookie()
{
$found = false;
// For 3rd party cookies, priority is on re-using the existing 3rd party cookie value
if (!$found) {
$useThirdPartyCookie = $this->shouldUseThirdPartyCookie();
if ($useThirdPartyCookie) {
$idVisitor = $this->getThirdPartyCookieVisitorId();
if(!empty($idVisitor)) {
$found = true;
}
}
}
// If a third party cookie was not found, we default to the first party cookie
if (!$found) {
$idVisitor = Common::getRequestVar('_id', '', 'string', $this->params);
$found = strlen($idVisitor) >= Tracker::LENGTH_HEX_ID_STRING;
}
if ($found) {
return $this->getVisitorIdAsBinary($idVisitor);
}
return false;
} | php | public function getVisitorIdForThirdPartyCookie()
{
$found = false;
// For 3rd party cookies, priority is on re-using the existing 3rd party cookie value
if (!$found) {
$useThirdPartyCookie = $this->shouldUseThirdPartyCookie();
if ($useThirdPartyCookie) {
$idVisitor = $this->getThirdPartyCookieVisitorId();
if(!empty($idVisitor)) {
$found = true;
}
}
}
// If a third party cookie was not found, we default to the first party cookie
if (!$found) {
$idVisitor = Common::getRequestVar('_id', '', 'string', $this->params);
$found = strlen($idVisitor) >= Tracker::LENGTH_HEX_ID_STRING;
}
if ($found) {
return $this->getVisitorIdAsBinary($idVisitor);
}
return false;
} | [
"public",
"function",
"getVisitorIdForThirdPartyCookie",
"(",
")",
"{",
"$",
"found",
"=",
"false",
";",
"// For 3rd party cookies, priority is on re-using the existing 3rd party cookie value",
"if",
"(",
"!",
"$",
"found",
")",
"{",
"$",
"useThirdPartyCookie",
"=",
"$",
... | When creating a third party cookie, we want to ensure that the original value set in this 3rd party cookie
sticks and is not overwritten later. | [
"When",
"creating",
"a",
"third",
"party",
"cookie",
"we",
"want",
"to",
"ensure",
"that",
"the",
"original",
"value",
"set",
"in",
"this",
"3rd",
"party",
"cookie",
"sticks",
"and",
"is",
"not",
"overwritten",
"later",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Tracker/Request.php#L780-L806 | train | Returns the visitor ID for third party cookies | [
30522,
2270,
3853,
2131,
11365,
15660,
3593,
15628,
4313,
18927,
23871,
3597,
23212,
2063,
1006,
1007,
1063,
1002,
2179,
1027,
6270,
1025,
1013,
1013,
2005,
3822,
2283,
16324,
1010,
9470,
2003,
2006,
2128,
1011,
2478,
1996,
4493,
3822,
2283... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.fetch | public function fetch($style = null, $cursor = null, $offset = null)
{
if ($style === null) {
$style = $this->_fetchMode;
}
try {
return $this->_stmt->fetch($style, $cursor, $offset);
} catch (PDOException $e) {
// require_once 'Zend/Db/Statement/Exception.php';
throw new Zend_Db_Statement_Exception($e->getMessage(), $e->getCode(), $e);
}
} | php | public function fetch($style = null, $cursor = null, $offset = null)
{
if ($style === null) {
$style = $this->_fetchMode;
}
try {
return $this->_stmt->fetch($style, $cursor, $offset);
} catch (PDOException $e) {
// require_once 'Zend/Db/Statement/Exception.php';
throw new Zend_Db_Statement_Exception($e->getMessage(), $e->getCode(), $e);
}
} | [
"public",
"function",
"fetch",
"(",
"$",
"style",
"=",
"null",
",",
"$",
"cursor",
"=",
"null",
",",
"$",
"offset",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"style",
"===",
"null",
")",
"{",
"$",
"style",
"=",
"$",
"this",
"->",
"_fetchMode",
";",
... | Fetches a row from the result set.
@param int $style OPTIONAL Fetch mode for this fetch operation.
@param int $cursor OPTIONAL Absolute, relative, or other.
@param int $offset OPTIONAL Number for absolute or relative cursors.
@return mixed Array, object, or scalar depending on fetch mode.
@throws Zend_Db_Statement_Exception | [
"Fetches",
"a",
"row",
"from",
"the",
"result",
"set",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Statement/Pdo.php#L247-L258 | train | Fetch a result set | [
30522,
2270,
3853,
18584,
1006,
1002,
2806,
1027,
19701,
1010,
1002,
12731,
25301,
2099,
1027,
19701,
1010,
1002,
16396,
1027,
19701,
1007,
1063,
2065,
1006,
1002,
2806,
1027,
1027,
1027,
19701,
1007,
1063,
1002,
2806,
1027,
1002,
2023,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php | ReflectionExtractor.getMutatorMethod | private function getMutatorMethod(string $class, string $property): ?array
{
$ucProperty = ucfirst($property);
$ucSingulars = (array) Inflector::singularize($ucProperty);
foreach ($this->mutatorPrefixes as $prefix) {
$names = [$ucProperty];
if (\in_array($prefix, $this->arrayMutatorPrefixes)) {
$names = array_merge($names, $ucSingulars);
}
foreach ($names as $name) {
try {
$reflectionMethod = new \ReflectionMethod($class, $prefix.$name);
if ($reflectionMethod->isStatic()) {
continue;
}
// Parameter can be optional to allow things like: method(array $foo = null)
if ($reflectionMethod->getNumberOfParameters() >= 1) {
return [$reflectionMethod, $prefix];
}
} catch (\ReflectionException $e) {
// Try the next prefix if the method doesn't exist
}
}
}
return null;
} | php | private function getMutatorMethod(string $class, string $property): ?array
{
$ucProperty = ucfirst($property);
$ucSingulars = (array) Inflector::singularize($ucProperty);
foreach ($this->mutatorPrefixes as $prefix) {
$names = [$ucProperty];
if (\in_array($prefix, $this->arrayMutatorPrefixes)) {
$names = array_merge($names, $ucSingulars);
}
foreach ($names as $name) {
try {
$reflectionMethod = new \ReflectionMethod($class, $prefix.$name);
if ($reflectionMethod->isStatic()) {
continue;
}
// Parameter can be optional to allow things like: method(array $foo = null)
if ($reflectionMethod->getNumberOfParameters() >= 1) {
return [$reflectionMethod, $prefix];
}
} catch (\ReflectionException $e) {
// Try the next prefix if the method doesn't exist
}
}
}
return null;
} | [
"private",
"function",
"getMutatorMethod",
"(",
"string",
"$",
"class",
",",
"string",
"$",
"property",
")",
":",
"?",
"array",
"{",
"$",
"ucProperty",
"=",
"ucfirst",
"(",
"$",
"property",
")",
";",
"$",
"ucSingulars",
"=",
"(",
"array",
")",
"Inflector... | 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. | [
"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",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php#L401-L430 | train | Get mutator method | [
30522,
2797,
3853,
2131,
28120,
8844,
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,
1002,
15384,
7741... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Storage/Writable/Maildir.php | Zend_Mail_Storage_Writable_Maildir.removeMessage | public function removeMessage($id)
{
$filename = $this->_getFileData($id, 'filename');
if ($this->_quota) {
$size = filesize($filename);
}
if (!@unlink($filename)) {
/**
* @see Zend_Mail_Storage_Exception
*/
// require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('cannot remove message');
}
unset($this->_files[$id - 1]);
// remove the gap
$this->_files = array_values($this->_files);
if ($this->_quota) {
$this->_addQuotaEntry(0 - (int)$size, -1);
}
} | php | public function removeMessage($id)
{
$filename = $this->_getFileData($id, 'filename');
if ($this->_quota) {
$size = filesize($filename);
}
if (!@unlink($filename)) {
/**
* @see Zend_Mail_Storage_Exception
*/
// require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('cannot remove message');
}
unset($this->_files[$id - 1]);
// remove the gap
$this->_files = array_values($this->_files);
if ($this->_quota) {
$this->_addQuotaEntry(0 - (int)$size, -1);
}
} | [
"public",
"function",
"removeMessage",
"(",
"$",
"id",
")",
"{",
"$",
"filename",
"=",
"$",
"this",
"->",
"_getFileData",
"(",
"$",
"id",
",",
"'filename'",
")",
";",
"if",
"(",
"$",
"this",
"->",
"_quota",
")",
"{",
"$",
"size",
"=",
"filesize",
"... | stub for not supported message deletion
@return null
@throws Zend_Mail_Storage_Exception | [
"stub",
"for",
"not",
"supported",
"message",
"deletion"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Mail/Storage/Writable/Maildir.php#L790-L811 | train | Remove a message from the queue | [
30522,
2270,
3853,
6366,
7834,
3736,
3351,
1006,
1002,
8909,
1007,
1063,
1002,
5371,
18442,
1027,
1002,
2023,
1011,
1028,
1035,
2131,
8873,
3709,
6790,
1006,
1002,
8909,
1010,
1005,
5371,
18442,
1005,
1007,
1025,
2065,
1006,
1002,
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... |
symfony/symfony | src/Symfony/Component/Security/Guard/GuardAuthenticatorHandler.php | GuardAuthenticatorHandler.handleAuthenticationFailure | public function handleAuthenticationFailure(AuthenticationException $authenticationException, Request $request, AuthenticatorInterface $guardAuthenticator, string $providerKey): ?Response
{
$response = $guardAuthenticator->onAuthenticationFailure($request, $authenticationException);
if ($response instanceof Response || null === $response) {
// returning null is ok, it means they want the request to continue
return $response;
}
throw new \UnexpectedValueException(sprintf('The %s::onAuthenticationFailure method must return null or a Response object. You returned %s.', \get_class($guardAuthenticator), \is_object($response) ? \get_class($response) : \gettype($response)));
} | php | public function handleAuthenticationFailure(AuthenticationException $authenticationException, Request $request, AuthenticatorInterface $guardAuthenticator, string $providerKey): ?Response
{
$response = $guardAuthenticator->onAuthenticationFailure($request, $authenticationException);
if ($response instanceof Response || null === $response) {
// returning null is ok, it means they want the request to continue
return $response;
}
throw new \UnexpectedValueException(sprintf('The %s::onAuthenticationFailure method must return null or a Response object. You returned %s.', \get_class($guardAuthenticator), \is_object($response) ? \get_class($response) : \gettype($response)));
} | [
"public",
"function",
"handleAuthenticationFailure",
"(",
"AuthenticationException",
"$",
"authenticationException",
",",
"Request",
"$",
"request",
",",
"AuthenticatorInterface",
"$",
"guardAuthenticator",
",",
"string",
"$",
"providerKey",
")",
":",
"?",
"Response",
"... | Handles an authentication failure and returns the Response for the
GuardAuthenticator. | [
"Handles",
"an",
"authentication",
"failure",
"and",
"returns",
"the",
"Response",
"for",
"the",
"GuardAuthenticator",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Security/Guard/GuardAuthenticatorHandler.php#L103-L112 | train | Handle an authentication failure | [
30522,
2270,
3853,
5047,
4887,
10760,
16778,
10719,
7011,
4014,
5397,
1006,
27280,
10288,
24422,
1002,
27280,
10288,
24422,
1010,
5227,
1002,
5227,
1010,
14469,
8844,
18447,
2121,
12172,
1002,
3457,
4887,
10760,
16778,
11266,
2953,
1010,
5164... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/POP3.php | POP3.popBeforeSmtp | public static function popBeforeSmtp(
$host,
$port = false,
$timeout = false,
$username = '',
$password = '',
$debug_level = 0
) {
$pop = new self();
return $pop->authorise($host, $port, $timeout, $username, $password, $debug_level);
} | php | public static function popBeforeSmtp(
$host,
$port = false,
$timeout = false,
$username = '',
$password = '',
$debug_level = 0
) {
$pop = new self();
return $pop->authorise($host, $port, $timeout, $username, $password, $debug_level);
} | [
"public",
"static",
"function",
"popBeforeSmtp",
"(",
"$",
"host",
",",
"$",
"port",
"=",
"false",
",",
"$",
"timeout",
"=",
"false",
",",
"$",
"username",
"=",
"''",
",",
"$",
"password",
"=",
"''",
",",
"$",
"debug_level",
"=",
"0",
")",
"{",
"$"... | Simple static wrapper for all-in-one POP before SMTP.
@param string $host The hostname to connect to
@param int|bool $port The port number to connect to
@param int|bool $timeout The timeout value
@param string $username
@param string $password
@param int $debug_level
@return bool | [
"Simple",
"static",
"wrapper",
"for",
"all",
"-",
"in",
"-",
"one",
"POP",
"before",
"SMTP",
"."
] | 3d7132341659a8a201adbc3ba11b1e202ee2857c | https://github.com/PHPMailer/PHPMailer/blob/3d7132341659a8a201adbc3ba11b1e202ee2857c/src/POP3.php#L145-L156 | train | Pop before SMTP | [
30522,
2270,
10763,
3853,
3769,
4783,
29278,
2229,
20492,
2361,
1006,
1002,
3677,
1010,
1002,
3417,
1027,
6270,
1010,
1002,
2051,
5833,
1027,
6270,
1010,
1002,
5310,
18442,
1027,
1005,
1005,
1010,
1002,
20786,
1027,
1005,
1005,
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/Validator/DependencyInjection/AddAutoMappingConfigurationPass.php | AddAutoMappingConfigurationPass.process | public function process(ContainerBuilder $container)
{
if (!$container->hasParameter('validator.auto_mapping') || !$container->hasDefinition($this->validatorBuilderService)) {
return;
}
$config = $container->getParameter('validator.auto_mapping');
$globalNamespaces = [];
$servicesToNamespaces = [];
foreach ($config as $namespace => $value) {
if ([] === $value['services']) {
$globalNamespaces[] = $namespace;
continue;
}
foreach ($value['services'] as $service) {
$servicesToNamespaces[$service][] = $namespace;
}
}
$validatorBuilder = $container->getDefinition($this->validatorBuilderService);
foreach ($container->findTaggedServiceIds($this->tag) as $id => $tags) {
$regexp = $this->getRegexp(array_merge($globalNamespaces, $servicesToNamespaces[$id] ?? []));
$container->getDefinition($id)->setArgument('$classValidatorRegexp', $regexp);
$validatorBuilder->addMethodCall('addLoader', [new Reference($id)]);
}
$container->getParameterBag()->remove('validator.auto_mapping');
} | php | public function process(ContainerBuilder $container)
{
if (!$container->hasParameter('validator.auto_mapping') || !$container->hasDefinition($this->validatorBuilderService)) {
return;
}
$config = $container->getParameter('validator.auto_mapping');
$globalNamespaces = [];
$servicesToNamespaces = [];
foreach ($config as $namespace => $value) {
if ([] === $value['services']) {
$globalNamespaces[] = $namespace;
continue;
}
foreach ($value['services'] as $service) {
$servicesToNamespaces[$service][] = $namespace;
}
}
$validatorBuilder = $container->getDefinition($this->validatorBuilderService);
foreach ($container->findTaggedServiceIds($this->tag) as $id => $tags) {
$regexp = $this->getRegexp(array_merge($globalNamespaces, $servicesToNamespaces[$id] ?? []));
$container->getDefinition($id)->setArgument('$classValidatorRegexp', $regexp);
$validatorBuilder->addMethodCall('addLoader', [new Reference($id)]);
}
$container->getParameterBag()->remove('validator.auto_mapping');
} | [
"public",
"function",
"process",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"if",
"(",
"!",
"$",
"container",
"->",
"hasParameter",
"(",
"'validator.auto_mapping'",
")",
"||",
"!",
"$",
"container",
"->",
"hasDefinition",
"(",
"$",
"this",
"->",
"v... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Validator/DependencyInjection/AddAutoMappingConfigurationPass.php#L37-L68 | train | Adds the validator loader to the auto mapping parameter | [
30522,
2270,
3853,
2832,
1006,
11661,
8569,
23891,
2099,
1002,
11661,
1007,
1063,
2065,
1006,
999,
1002,
11661,
1011,
1028,
2038,
28689,
22828,
1006,
1005,
9398,
8844,
1012,
8285,
1035,
12375,
1005,
1007,
1064,
1064,
999,
1002,
11661,
1011,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
z-song/laravel-admin | src/Show.php | Show.handleGetMutatorField | protected function handleGetMutatorField($method, $label)
{
if (is_null($this->model)) {
return false;
}
if ($this->model->hasGetMutator($method)) {
return $this->addField($method, $label);
}
return false;
} | php | protected function handleGetMutatorField($method, $label)
{
if (is_null($this->model)) {
return false;
}
if ($this->model->hasGetMutator($method)) {
return $this->addField($method, $label);
}
return false;
} | [
"protected",
"function",
"handleGetMutatorField",
"(",
"$",
"method",
",",
"$",
"label",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"model",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"model",
"->",
"hasGet... | Handle the get mutator field.
@param string $method
@param string $label
@return bool|Field | [
"Handle",
"the",
"get",
"mutator",
"field",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Show.php#L406-L417 | train | Handle GetMutatorField | [
30522,
30524,
1028,
2038,
18150,
28120,
8844,
1006,
1002,
4118,
1007,
1007,
1063,
2709,
1002,
2023,
1011,
1028,
5587,
3790,
1006,
1002,
4118,
1010,
1002,
3830,
1007,
1025,
1065,
2709,
6270,
1025,
1065,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/FrameReflower/AbstractFrameReflower.php | AbstractFrameReflower._parse_quotes | protected function _parse_quotes()
{
// Matches quote types
$re = '/(\'[^\']*\')|(\"[^\"]*\")/';
$quotes = $this->_frame->get_style()->quotes;
// split on spaces, except within quotes
if (!preg_match_all($re, "$quotes", $matches, PREG_SET_ORDER)) {
return null;
}
$quotes_array = array();
foreach ($matches as $_quote) {
$quotes_array[] = $this->_parse_string($_quote[0], true);
}
if (empty($quotes_array)) {
$quotes_array = array('"', '"');
}
return array_chunk($quotes_array, 2);
} | php | protected function _parse_quotes()
{
// Matches quote types
$re = '/(\'[^\']*\')|(\"[^\"]*\")/';
$quotes = $this->_frame->get_style()->quotes;
// split on spaces, except within quotes
if (!preg_match_all($re, "$quotes", $matches, PREG_SET_ORDER)) {
return null;
}
$quotes_array = array();
foreach ($matches as $_quote) {
$quotes_array[] = $this->_parse_string($_quote[0], true);
}
if (empty($quotes_array)) {
$quotes_array = array('"', '"');
}
return array_chunk($quotes_array, 2);
} | [
"protected",
"function",
"_parse_quotes",
"(",
")",
"{",
"// Matches quote types",
"$",
"re",
"=",
"'/(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")/'",
";",
"$",
"quotes",
"=",
"$",
"this",
"->",
"_frame",
"->",
"get_style",
"(",
")",
"->",
"quotes",
";",
"// split on spaces... | Parses a CSS "quotes" property
@return array|null An array of pairs of quotes | [
"Parses",
"a",
"CSS",
"quotes",
"property"
] | 75f13c700009be21a1965dc2c5b68a8708c22ba2 | https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/src/FrameReflower/AbstractFrameReflower.php#L324-L346 | train | Parse quotes from the frame | [
30522,
5123,
3853,
1035,
11968,
3366,
1035,
16614,
1006,
1007,
1063,
1013,
1013,
3503,
14686,
4127,
1002,
2128,
1027,
1005,
1013,
1006,
1032,
1005,
1031,
1034,
1032,
1005,
1033,
1008,
1032,
1005,
1007,
1064,
1006,
1032,
1000,
1031,
1034,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Middleware.php | Middleware.cookies | public static function cookies()
{
return function (callable $handler) {
return function ($request, array $options) use ($handler) {
if (empty($options['cookies'])) {
return $handler($request, $options);
} elseif (!($options['cookies'] instanceof CookieJarInterface)) {
throw new \InvalidArgumentException('cookies must be an instance of GuzzleHttp\Cookie\CookieJarInterface');
}
$cookieJar = $options['cookies'];
$request = $cookieJar->withCookieHeader($request);
return $handler($request, $options)
->then(
function ($response) use ($cookieJar, $request) {
$cookieJar->extractCookies($request, $response);
return $response;
}
);
};
};
} | php | public static function cookies()
{
return function (callable $handler) {
return function ($request, array $options) use ($handler) {
if (empty($options['cookies'])) {
return $handler($request, $options);
} elseif (!($options['cookies'] instanceof CookieJarInterface)) {
throw new \InvalidArgumentException('cookies must be an instance of GuzzleHttp\Cookie\CookieJarInterface');
}
$cookieJar = $options['cookies'];
$request = $cookieJar->withCookieHeader($request);
return $handler($request, $options)
->then(
function ($response) use ($cookieJar, $request) {
$cookieJar->extractCookies($request, $response);
return $response;
}
);
};
};
} | [
"public",
"static",
"function",
"cookies",
"(",
")",
"{",
"return",
"function",
"(",
"callable",
"$",
"handler",
")",
"{",
"return",
"function",
"(",
"$",
"request",
",",
"array",
"$",
"options",
")",
"use",
"(",
"$",
"handler",
")",
"{",
"if",
"(",
... | Middleware that adds cookies to requests.
The options array must be set to a CookieJarInterface in order to use
cookies. This is typically handled for you by a client.
@return callable Returns a function that accepts the next handler. | [
"Middleware",
"that",
"adds",
"cookies",
"to",
"requests",
"."
] | bf595424e4d442a190582e088985dc835a789071 | https://github.com/guzzle/guzzle/blob/bf595424e4d442a190582e088985dc835a789071/src/Middleware.php#L25-L45 | train | Returns a middleware that extracts cookies from the request | [
30522,
2270,
10763,
3853,
16324,
1006,
1007,
1063,
2709,
3853,
1006,
2655,
3085,
1002,
28213,
1007,
1063,
2709,
3853,
1006,
1002,
5227,
1010,
9140,
1002,
7047,
1007,
2224,
1006,
1002,
28213,
1007,
1063,
2065,
1006,
4064,
1006,
1002,
7047,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getgrav/grav | system/src/Grav/Framework/Collection/AbstractIndexCollection.php | AbstractIndexCollection.shuffle | public function shuffle()
{
$keys = $this->getKeys();
shuffle($keys);
return $this->createFrom(array_replace(array_flip($keys), $this->entries));
} | php | public function shuffle()
{
$keys = $this->getKeys();
shuffle($keys);
return $this->createFrom(array_replace(array_flip($keys), $this->entries));
} | [
"public",
"function",
"shuffle",
"(",
")",
"{",
"$",
"keys",
"=",
"$",
"this",
"->",
"getKeys",
"(",
")",
";",
"shuffle",
"(",
"$",
"keys",
")",
";",
"return",
"$",
"this",
"->",
"createFrom",
"(",
"array_replace",
"(",
"array_flip",
"(",
"$",
"keys"... | Shuffle items.
@return static | [
"Shuffle",
"items",
"."
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Framework/Collection/AbstractIndexCollection.php#L371-L377 | train | Shuffle the array and return a new array with the keys of the array | [
30522,
2270,
3853,
23046,
1006,
1007,
1063,
1002,
6309,
1027,
1002,
2023,
1011,
1028,
2131,
14839,
2015,
1006,
1007,
1025,
23046,
1006,
1002,
6309,
1007,
1025,
2709,
1002,
2023,
1011,
1028,
3443,
19699,
5358,
1006,
9140,
1035,
5672,
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/ThemeManager.php | ThemeManager.deleteTheme | public function deleteTheme($theme)
{
if (!$theme) {
return false;
}
if (is_string($theme)) {
$theme = CmsTheme::load($theme);
}
if ($theme->isActiveTheme()) {
throw new ApplicationException(trans('cms::lang.theme.delete_active_theme_failed'));
}
/*
* Delete from file system
*/
$themePath = $theme->getPath();
if (File::isDirectory($themePath)) {
File::deleteDirectory($themePath);
}
/*
* Set uninstalled
*/
if ($themeCode = $this->findByDirName($theme->getDirName())) {
$this->setUninstalled($themeCode);
}
} | php | public function deleteTheme($theme)
{
if (!$theme) {
return false;
}
if (is_string($theme)) {
$theme = CmsTheme::load($theme);
}
if ($theme->isActiveTheme()) {
throw new ApplicationException(trans('cms::lang.theme.delete_active_theme_failed'));
}
/*
* Delete from file system
*/
$themePath = $theme->getPath();
if (File::isDirectory($themePath)) {
File::deleteDirectory($themePath);
}
/*
* Set uninstalled
*/
if ($themeCode = $this->findByDirName($theme->getDirName())) {
$this->setUninstalled($themeCode);
}
} | [
"public",
"function",
"deleteTheme",
"(",
"$",
"theme",
")",
"{",
"if",
"(",
"!",
"$",
"theme",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"is_string",
"(",
"$",
"theme",
")",
")",
"{",
"$",
"theme",
"=",
"CmsTheme",
"::",
"load",
"(",
"$"... | Completely delete a theme from the system.
@param string $theme Theme code/namespace
@return void | [
"Completely",
"delete",
"a",
"theme",
"from",
"the",
"system",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/ThemeManager.php#L96-L124 | train | Delete a theme | [
30522,
2270,
3853,
3972,
12870,
10760,
4168,
1006,
1002,
4323,
1007,
1063,
2065,
1006,
999,
1002,
4323,
1007,
1063,
2709,
6270,
1025,
1065,
2065,
1006,
2003,
1035,
5164,
1006,
1002,
4323,
1007,
1007,
1063,
1002,
4323,
1027,
4642,
3367,
29... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Support/Traits/ForwardsCalls.php | ForwardsCalls.forwardCallTo | protected function forwardCallTo($object, $method, $parameters)
{
try {
return $object->{$method}(...$parameters);
} catch (Error | BadMethodCallException $e) {
$pattern = '~^Call to undefined method (?P<class>[^:]+)::(?P<method>[^\(]+)\(\)$~';
if (! preg_match($pattern, $e->getMessage(), $matches)) {
throw $e;
}
if ($matches['class'] != get_class($object) ||
$matches['method'] != $method) {
throw $e;
}
static::throwBadMethodCallException($method);
}
} | php | protected function forwardCallTo($object, $method, $parameters)
{
try {
return $object->{$method}(...$parameters);
} catch (Error | BadMethodCallException $e) {
$pattern = '~^Call to undefined method (?P<class>[^:]+)::(?P<method>[^\(]+)\(\)$~';
if (! preg_match($pattern, $e->getMessage(), $matches)) {
throw $e;
}
if ($matches['class'] != get_class($object) ||
$matches['method'] != $method) {
throw $e;
}
static::throwBadMethodCallException($method);
}
} | [
"protected",
"function",
"forwardCallTo",
"(",
"$",
"object",
",",
"$",
"method",
",",
"$",
"parameters",
")",
"{",
"try",
"{",
"return",
"$",
"object",
"->",
"{",
"$",
"method",
"}",
"(",
"...",
"$",
"parameters",
")",
";",
"}",
"catch",
"(",
"Error... | Forward a method call to the given object.
@param mixed $object
@param string $method
@param array $parameters
@return mixed
@throws \BadMethodCallException | [
"Forward",
"a",
"method",
"call",
"to",
"the",
"given",
"object",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Support/Traits/ForwardsCalls.php#L20-L38 | train | Forward call to method | [
30522,
5123,
3853,
2830,
9289,
23223,
1006,
1002,
4874,
1010,
1002,
4118,
1010,
1002,
11709,
1007,
1063,
3046,
1063,
2709,
1002,
4874,
1011,
1028,
1063,
1002,
4118,
1065,
1006,
1012,
1012,
1012,
1002,
11709,
1007,
1025,
1065,
4608,
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... |
z-song/laravel-admin | src/Grid/Tools.php | Tools.disableBatchActions | public function disableBatchActions(bool $disable = true)
{
$this->tools = $this->tools->map(function ($tool) use ($disable) {
if ($tool instanceof BatchActions) {
return $tool->disable($disable);
}
return $tool;
});
} | php | public function disableBatchActions(bool $disable = true)
{
$this->tools = $this->tools->map(function ($tool) use ($disable) {
if ($tool instanceof BatchActions) {
return $tool->disable($disable);
}
return $tool;
});
} | [
"public",
"function",
"disableBatchActions",
"(",
"bool",
"$",
"disable",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"tools",
"=",
"$",
"this",
"->",
"tools",
"->",
"map",
"(",
"function",
"(",
"$",
"tool",
")",
"use",
"(",
"$",
"disable",
")",
"{",
... | Disable batch actions.
@return void | [
"Disable",
"batch",
"actions",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid/Tools.php#L118-L127 | train | Disable Batch Actions | [
30522,
2270,
3853,
4487,
19150,
14479,
7507,
22014,
1006,
22017,
2140,
1002,
4487,
19150,
1027,
2995,
1007,
1063,
1002,
2023,
1011,
1028,
5906,
1027,
1002,
2023,
1011,
1028,
5906,
1011,
1028,
4949,
1006,
3853,
1006,
1002,
6994,
1007,
2224,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Updates/2.10.0-b5.php | Updates_2_10_0_b5.getAllArchiveBlobTables | public static function getAllArchiveBlobTables()
{
if (empty(self::$archiveBlobTables)) {
$archiveTables = ArchiveTableCreator::getTablesArchivesInstalled();
self::$archiveBlobTables = array_filter($archiveTables, function ($name) {
return ArchiveTableCreator::getTypeFromTableName($name) == ArchiveTableCreator::BLOB_TABLE;
});
// sort tables so we have them in order of their date
rsort(self::$archiveBlobTables);
}
return (array) self::$archiveBlobTables;
} | php | public static function getAllArchiveBlobTables()
{
if (empty(self::$archiveBlobTables)) {
$archiveTables = ArchiveTableCreator::getTablesArchivesInstalled();
self::$archiveBlobTables = array_filter($archiveTables, function ($name) {
return ArchiveTableCreator::getTypeFromTableName($name) == ArchiveTableCreator::BLOB_TABLE;
});
// sort tables so we have them in order of their date
rsort(self::$archiveBlobTables);
}
return (array) self::$archiveBlobTables;
} | [
"public",
"static",
"function",
"getAllArchiveBlobTables",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"self",
"::",
"$",
"archiveBlobTables",
")",
")",
"{",
"$",
"archiveTables",
"=",
"ArchiveTableCreator",
"::",
"getTablesArchivesInstalled",
"(",
")",
";",
"self",... | Returns all available archive blob tables
@return array | [
"Returns",
"all",
"available",
"archive",
"blob",
"tables"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Updates/2.10.0-b5.php#L135-L149 | train | Returns all archive blob tables | [
30522,
2270,
10763,
3853,
2131,
25425,
11140,
3512,
16558,
16429,
10880,
2015,
1006,
1007,
1063,
2065,
1006,
4064,
1006,
2969,
1024,
1024,
1002,
8756,
16558,
16429,
10880,
2015,
1007,
1007,
1063,
1002,
8756,
10880,
2015,
1027,
8756,
10880,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/ServiceProvider.php | ServiceProvider.boot | public function boot()
{
// Fix UTF8MB4 support for MariaDB < 10.2 and MySQL < 5.7
if (Config::get('database.connections.mysql.charset') === 'utf8mb4') {
Schema::defaultStringLength(191);
}
Paginator::defaultSimpleView('system::pagination.simple-default');
/*
* Boot plugins
*/
PluginManager::instance()->bootAll();
parent::boot('system');
} | php | public function boot()
{
// Fix UTF8MB4 support for MariaDB < 10.2 and MySQL < 5.7
if (Config::get('database.connections.mysql.charset') === 'utf8mb4') {
Schema::defaultStringLength(191);
}
Paginator::defaultSimpleView('system::pagination.simple-default');
/*
* Boot plugins
*/
PluginManager::instance()->bootAll();
parent::boot('system');
} | [
"public",
"function",
"boot",
"(",
")",
"{",
"// Fix UTF8MB4 support for MariaDB < 10.2 and MySQL < 5.7",
"if",
"(",
"Config",
"::",
"get",
"(",
"'database.connections.mysql.charset'",
")",
"===",
"'utf8mb4'",
")",
"{",
"Schema",
"::",
"defaultStringLength",
"(",
"191",... | Bootstrap the module events.
@return void | [
"Bootstrap",
"the",
"module",
"events",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/ServiceProvider.php#L84-L99 | train | Boots the system | [
30522,
2270,
3853,
9573,
1006,
1007,
1063,
1013,
1013,
8081,
21183,
2546,
2620,
14905,
2549,
2490,
2005,
3814,
18939,
1026,
2184,
1012,
1016,
1998,
2026,
2015,
4160,
2140,
1026,
1019,
1012,
1021,
2065,
1006,
9530,
8873,
2290,
1024,
1024,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Notifications/Channels/MailChannel.php | MailChannel.addressMessage | protected function addressMessage($mailMessage, $notifiable, $notification, $message)
{
$this->addSender($mailMessage, $message);
$mailMessage->to($this->getRecipients($notifiable, $notification, $message));
if (! empty($message->cc)) {
foreach ($message->cc as $cc) {
$mailMessage->cc($cc[0], Arr::get($cc, 1));
}
}
if (! empty($message->bcc)) {
foreach ($message->bcc as $bcc) {
$mailMessage->bcc($bcc[0], Arr::get($bcc, 1));
}
}
} | php | protected function addressMessage($mailMessage, $notifiable, $notification, $message)
{
$this->addSender($mailMessage, $message);
$mailMessage->to($this->getRecipients($notifiable, $notification, $message));
if (! empty($message->cc)) {
foreach ($message->cc as $cc) {
$mailMessage->cc($cc[0], Arr::get($cc, 1));
}
}
if (! empty($message->bcc)) {
foreach ($message->bcc as $bcc) {
$mailMessage->bcc($bcc[0], Arr::get($bcc, 1));
}
}
} | [
"protected",
"function",
"addressMessage",
"(",
"$",
"mailMessage",
",",
"$",
"notifiable",
",",
"$",
"notification",
",",
"$",
"message",
")",
"{",
"$",
"this",
"->",
"addSender",
"(",
"$",
"mailMessage",
",",
"$",
"message",
")",
";",
"$",
"mailMessage",... | Address the mail message.
@param \Illuminate\Mail\Message $mailMessage
@param mixed $notifiable
@param \Illuminate\Notifications\Notification $notification
@param \Illuminate\Notifications\Messages\MailMessage $message
@return void | [
"Address",
"the",
"mail",
"message",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Notifications/Channels/MailChannel.php#L151-L168 | train | Add recipients cc and bcc addresses to the message | [
30522,
5123,
3853,
4769,
7834,
3736,
3351,
1006,
1002,
5653,
7834,
3736,
3351,
1010,
1002,
2025,
10128,
19210,
1010,
1002,
26828,
1010,
1002,
4471,
1007,
1063,
1002,
2023,
1011,
1028,
9909,
10497,
2121,
1006,
1002,
5653,
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/HttpFoundation/ResponseHeaderBag.php | ResponseHeaderBag.all | public function all()
{
$headers = parent::all();
foreach ($this->getCookies() as $cookie) {
$headers['set-cookie'][] = (string) $cookie;
}
return $headers;
} | php | public function all()
{
$headers = parent::all();
foreach ($this->getCookies() as $cookie) {
$headers['set-cookie'][] = (string) $cookie;
}
return $headers;
} | [
"public",
"function",
"all",
"(",
")",
"{",
"$",
"headers",
"=",
"parent",
"::",
"all",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"getCookies",
"(",
")",
"as",
"$",
"cookie",
")",
"{",
"$",
"headers",
"[",
"'set-cookie'",
"]",
"[",
"]",
"... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpFoundation/ResponseHeaderBag.php#L91-L99 | train | Return all headers | [
30522,
2270,
3853,
2035,
1006,
1007,
1063,
1002,
20346,
2015,
1027,
6687,
1024,
1024,
2035,
1006,
1007,
1025,
18921,
6776,
1006,
1002,
2023,
1011,
1028,
2131,
3597,
23212,
2229,
1006,
1007,
2004,
1002,
17387,
1007,
1063,
1002,
20346,
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... |
symfony/symfony | src/Symfony/Component/Messenger/Middleware/HandleMessageMiddleware.php | HandleMessageMiddleware.handle | public function handle(Envelope $envelope, StackInterface $stack): Envelope
{
$handler = null;
$message = $envelope->getMessage();
$context = [
'message' => $message,
'class' => \get_class($message),
];
$exceptions = [];
foreach ($this->handlersLocator->getHandlers($envelope) as $handlerDescriptor) {
if ($this->messageHasAlreadyBeenHandled($envelope, $handlerDescriptor)) {
continue;
}
try {
$handler = $handlerDescriptor->getHandler();
$handledStamp = HandledStamp::fromDescriptor($handlerDescriptor, $handler($message));
$envelope = $envelope->with($handledStamp);
$this->logger->info('Message "{class}" handled by "{handler}"', $context + ['handler' => $handledStamp->getHandlerName()]);
} catch (\Throwable $e) {
$exceptions[] = $e;
}
}
if (null === $handler) {
if (!$this->allowNoHandlers) {
throw new NoHandlerForMessageException(sprintf('No handler for message "%s".', $context['class']));
}
$this->logger->info('No handler for message "{class}"', $context);
}
if (\count($exceptions)) {
throw new HandlerFailedException($envelope, $exceptions);
}
return $stack->next()->handle($envelope, $stack);
} | php | public function handle(Envelope $envelope, StackInterface $stack): Envelope
{
$handler = null;
$message = $envelope->getMessage();
$context = [
'message' => $message,
'class' => \get_class($message),
];
$exceptions = [];
foreach ($this->handlersLocator->getHandlers($envelope) as $handlerDescriptor) {
if ($this->messageHasAlreadyBeenHandled($envelope, $handlerDescriptor)) {
continue;
}
try {
$handler = $handlerDescriptor->getHandler();
$handledStamp = HandledStamp::fromDescriptor($handlerDescriptor, $handler($message));
$envelope = $envelope->with($handledStamp);
$this->logger->info('Message "{class}" handled by "{handler}"', $context + ['handler' => $handledStamp->getHandlerName()]);
} catch (\Throwable $e) {
$exceptions[] = $e;
}
}
if (null === $handler) {
if (!$this->allowNoHandlers) {
throw new NoHandlerForMessageException(sprintf('No handler for message "%s".', $context['class']));
}
$this->logger->info('No handler for message "{class}"', $context);
}
if (\count($exceptions)) {
throw new HandlerFailedException($envelope, $exceptions);
}
return $stack->next()->handle($envelope, $stack);
} | [
"public",
"function",
"handle",
"(",
"Envelope",
"$",
"envelope",
",",
"StackInterface",
"$",
"stack",
")",
":",
"Envelope",
"{",
"$",
"handler",
"=",
"null",
";",
"$",
"message",
"=",
"$",
"envelope",
"->",
"getMessage",
"(",
")",
";",
"$",
"context",
... | {@inheritdoc}
@throws NoHandlerForMessageException When no handler is found and $allowNoHandlers is false | [
"{",
"@inheritdoc",
"}"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Messenger/Middleware/HandleMessageMiddleware.php#L47-L86 | train | Handle the message | [
30522,
2270,
3853,
5047,
1006,
11255,
1002,
11255,
1010,
9991,
18447,
2121,
12172,
1002,
9991,
1007,
1024,
11255,
1063,
1002,
28213,
1027,
19701,
1025,
1002,
4471,
1027,
1002,
11255,
1011,
1028,
2131,
7834,
3736,
3351,
1006,
1007,
1025,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/Filesystem.php | Filesystem.getFileSize | public static function getFileSize($pathToFile, $unit = 'B')
{
$unit = strtoupper($unit);
$units = array('TB' => pow(1024, 4),
'GB' => pow(1024, 3),
'MB' => pow(1024, 2),
'KB' => 1024,
'B' => 1);
if (!array_key_exists($unit, $units)) {
throw new \Exception('Invalid unit given');
}
if (!file_exists($pathToFile)) {
return;
}
$filesize = filesize($pathToFile);
$factor = $units[$unit];
$converted = $filesize / $factor;
return $converted;
} | php | public static function getFileSize($pathToFile, $unit = 'B')
{
$unit = strtoupper($unit);
$units = array('TB' => pow(1024, 4),
'GB' => pow(1024, 3),
'MB' => pow(1024, 2),
'KB' => 1024,
'B' => 1);
if (!array_key_exists($unit, $units)) {
throw new \Exception('Invalid unit given');
}
if (!file_exists($pathToFile)) {
return;
}
$filesize = filesize($pathToFile);
$factor = $units[$unit];
$converted = $filesize / $factor;
return $converted;
} | [
"public",
"static",
"function",
"getFileSize",
"(",
"$",
"pathToFile",
",",
"$",
"unit",
"=",
"'B'",
")",
"{",
"$",
"unit",
"=",
"strtoupper",
"(",
"$",
"unit",
")",
";",
"$",
"units",
"=",
"array",
"(",
"'TB'",
"=>",
"pow",
"(",
"1024",
",",
"4",
... | Get the size of a file in the specified unit.
@param string $pathToFile
@param string $unit eg 'B' for Byte, 'KB', 'MB', 'GB', 'TB'.
@return float|null Returns null if file does not exist or the size of the file in the specified unit
@throws Exception In case the unit is invalid | [
"Get",
"the",
"size",
"of",
"a",
"file",
"in",
"the",
"specified",
"unit",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Filesystem.php#L413-L435 | train | Get file size in given unit | [
30522,
2270,
10763,
3853,
2131,
8873,
4244,
4697,
1006,
1002,
4130,
3406,
8873,
2571,
1010,
1002,
3131,
1027,
1005,
1038,
1005,
1007,
1063,
1002,
3131,
1027,
2358,
5339,
7140,
18620,
1006,
1002,
3131,
1007,
1025,
1002,
3197,
1027,
9140,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/DBStats/MySQLMetadataProvider.php | MySQLMetadataProvider.getEstimatedBlobArchiveRowSize | public function getEstimatedBlobArchiveRowSize($row_count, $blob_size, $name_size, $status)
{
// calculate the size of each fixed size column in a blob archive table
static $fixedSizeColumnLength = null;
if (is_null($fixedSizeColumnLength)) {
$fixedSizeColumnLength = 0;
foreach ($this->dataAccess->getColumnsFromTable($status['Name']) as $column) {
$columnType = $column['Type'];
if (($paren = strpos($columnType, '(')) !== false) {
$columnType = substr($columnType, 0, $paren);
}
$fixedSizeColumnLength += $this->getSizeOfDatabaseType($columnType);
}
}
// calculate the average row size
if ($status['Rows'] == 0) {
$avgRowSize = 0;
} else {
$avgRowSize = $status['Index_length'] / $status['Rows'] + $fixedSizeColumnLength;
}
// calculate the row set's size
return $avgRowSize * $row_count + $blob_size + $name_size;
} | php | public function getEstimatedBlobArchiveRowSize($row_count, $blob_size, $name_size, $status)
{
// calculate the size of each fixed size column in a blob archive table
static $fixedSizeColumnLength = null;
if (is_null($fixedSizeColumnLength)) {
$fixedSizeColumnLength = 0;
foreach ($this->dataAccess->getColumnsFromTable($status['Name']) as $column) {
$columnType = $column['Type'];
if (($paren = strpos($columnType, '(')) !== false) {
$columnType = substr($columnType, 0, $paren);
}
$fixedSizeColumnLength += $this->getSizeOfDatabaseType($columnType);
}
}
// calculate the average row size
if ($status['Rows'] == 0) {
$avgRowSize = 0;
} else {
$avgRowSize = $status['Index_length'] / $status['Rows'] + $fixedSizeColumnLength;
}
// calculate the row set's size
return $avgRowSize * $row_count + $blob_size + $name_size;
} | [
"public",
"function",
"getEstimatedBlobArchiveRowSize",
"(",
"$",
"row_count",
",",
"$",
"blob_size",
",",
"$",
"name_size",
",",
"$",
"status",
")",
"{",
"// calculate the size of each fixed size column in a blob archive table",
"static",
"$",
"fixedSizeColumnLength",
"=",... | Gets the estimated database size a count of rows in a blob_archive table. Depends on
the data table row to contain the size of all blobs & name strings in the row set it
represents. | [
"Gets",
"the",
"estimated",
"database",
"size",
"a",
"count",
"of",
"rows",
"in",
"a",
"blob_archive",
"table",
".",
"Depends",
"on",
"the",
"data",
"table",
"row",
"to",
"contain",
"the",
"size",
"of",
"all",
"blobs",
"&",
"name",
"strings",
"in",
"the"... | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/DBStats/MySQLMetadataProvider.php#L251-L276 | train | Calculates the estimated size of a row set in a blob archive table | [
30522,
2270,
3853,
2131,
4355,
20592,
16558,
16429,
2906,
5428,
6299,
15568,
4697,
1006,
1002,
5216,
1035,
4175,
1010,
1002,
1038,
4135,
2497,
1035,
2946,
1010,
1002,
2171,
1035,
2946,
1010,
1002,
3570,
1007,
1063,
1013,
1013,
18422,
1996,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/ArchiveProcessor.php | ArchiveProcessor.computeNbUniques | protected function computeNbUniques($metrics)
{
$logAggregator = $this->getLogAggregator();
$query = $logAggregator->queryVisitsByDimension(array(), false, array(), $metrics);
$data = $query->fetch();
return $data;
} | php | protected function computeNbUniques($metrics)
{
$logAggregator = $this->getLogAggregator();
$query = $logAggregator->queryVisitsByDimension(array(), false, array(), $metrics);
$data = $query->fetch();
return $data;
} | [
"protected",
"function",
"computeNbUniques",
"(",
"$",
"metrics",
")",
"{",
"$",
"logAggregator",
"=",
"$",
"this",
"->",
"getLogAggregator",
"(",
")",
";",
"$",
"query",
"=",
"$",
"logAggregator",
"->",
"queryVisitsByDimension",
"(",
"array",
"(",
")",
",",... | Processes number of unique visitors for the given period
This is the only Period metric (ie. week/month/year/range) that we process from the logs directly,
since unique visitors cannot be summed like other metrics.
@param array Metrics Ids for which to aggregates count of values
@return array of metrics, where the key is metricid and the value is the metric value | [
"Processes",
"number",
"of",
"unique",
"visitors",
"for",
"the",
"given",
"period"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/ArchiveProcessor.php#L487-L493 | train | Compute the number of unique entries for the given dimension | [
30522,
5123,
3853,
24134,
27698,
19496,
10997,
1006,
1002,
12046,
2015,
1007,
1063,
1002,
8833,
8490,
17603,
20697,
2953,
1027,
1002,
2023,
1011,
1028,
2131,
21197,
8490,
17603,
20697,
2953,
1006,
1007,
1025,
1002,
23032,
1027,
1002,
8833,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.load | private function load($key)
{
$path = $this->getPath($key);
return file_exists($path) ? file_get_contents($path) : false;
} | php | private function load($key)
{
$path = $this->getPath($key);
return file_exists($path) ? file_get_contents($path) : false;
} | [
"private",
"function",
"load",
"(",
"$",
"key",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"getPath",
"(",
"$",
"key",
")",
";",
"return",
"file_exists",
"(",
"$",
"path",
")",
"?",
"file_get_contents",
"(",
"$",
"path",
")",
":",
"false",
";",... | Loads data for the given key.
@param string $key The store key
@return string The data associated with the key | [
"Loads",
"data",
"for",
"the",
"given",
"key",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/HttpCache/Store.php#L352-L357 | train | Load the content of the file | [
30522,
2797,
3853,
7170,
1006,
1002,
3145,
1007,
1063,
1002,
4130,
1027,
1002,
2023,
1011,
1028,
2131,
15069,
1006,
1002,
3145,
1007,
1025,
2709,
5371,
1035,
6526,
1006,
1002,
4130,
1007,
1029,
5371,
1035,
2131,
1035,
8417,
1006,
1002,
41... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
slimphp/Slim | Slim/Http/Response.php | Response.isEmpty | public function isEmpty()
{
return in_array(
$this->getStatusCode(),
[StatusCode::HTTP_NO_CONTENT, StatusCode::HTTP_RESET_CONTENT, StatusCode::HTTP_NOT_MODIFIED]
);
} | php | public function isEmpty()
{
return in_array(
$this->getStatusCode(),
[StatusCode::HTTP_NO_CONTENT, StatusCode::HTTP_RESET_CONTENT, StatusCode::HTTP_NOT_MODIFIED]
);
} | [
"public",
"function",
"isEmpty",
"(",
")",
"{",
"return",
"in_array",
"(",
"$",
"this",
"->",
"getStatusCode",
"(",
")",
",",
"[",
"StatusCode",
"::",
"HTTP_NO_CONTENT",
",",
"StatusCode",
"::",
"HTTP_RESET_CONTENT",
",",
"StatusCode",
"::",
"HTTP_NOT_MODIFIED",... | Is this response empty?
Note: This method is not part of the PSR-7 standard.
@return bool | [
"Is",
"this",
"response",
"empty?"
] | ccef5f7d8bcd469d59cbe64f6210d83764f91543 | https://github.com/slimphp/Slim/blob/ccef5f7d8bcd469d59cbe64f6210d83764f91543/Slim/Http/Response.php#L373-L379 | train | Is this response empty? | [
30522,
2270,
3853,
2003,
6633,
13876,
2100,
1006,
1007,
1063,
2709,
1999,
1035,
9140,
1006,
1002,
2023,
1011,
1028,
4152,
29336,
2271,
16044,
1006,
1007,
1010,
1031,
3570,
16044,
1024,
1024,
8299,
1035,
2053,
1035,
4180,
1010,
3570,
16044,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Middleware/Authorize.php | Authorize.getModel | protected function getModel($request, $model)
{
if ($this->isClassName($model)) {
return trim($model);
} else {
return $request->route($model, null) ?:
((preg_match("/^['\"](.*)['\"]$/", trim($model), $matches)) ? $matches[1] : null);
}
} | php | protected function getModel($request, $model)
{
if ($this->isClassName($model)) {
return trim($model);
} else {
return $request->route($model, null) ?:
((preg_match("/^['\"](.*)['\"]$/", trim($model), $matches)) ? $matches[1] : null);
}
} | [
"protected",
"function",
"getModel",
"(",
"$",
"request",
",",
"$",
"model",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isClassName",
"(",
"$",
"model",
")",
")",
"{",
"return",
"trim",
"(",
"$",
"model",
")",
";",
"}",
"else",
"{",
"return",
"$",
... | Get the model to authorize.
@param \Illuminate\Http\Request $request
@param string $model
@return \Illuminate\Database\Eloquent\Model|string | [
"Get",
"the",
"model",
"to",
"authorize",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Auth/Middleware/Authorize.php#L73-L81 | train | Get Model Name | [
30522,
5123,
3853,
2131,
5302,
9247,
1006,
1002,
5227,
1010,
1002,
2944,
1007,
1063,
2065,
1006,
1002,
2023,
1011,
1028,
2003,
26266,
18442,
1006,
1002,
2944,
1007,
1007,
1063,
2709,
12241,
1006,
1002,
2944,
1007,
1025,
1065,
2842,
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... |
matomo-org/matomo | core/DataTable/Filter/RangeCheck.php | RangeCheck.filter | public function filter($table)
{
foreach ($table->getRows() as $row) {
$value = $row->getColumn($this->columnToFilter);
if ($value === false) {
$value = $row->getMetadata($this->columnToFilter);
if ($value !== false) {
if ($value < (float) self::$minimumValue) {
$row->setMetadata($this->columnToFilter, self::$minimumValue);
} elseif ($value > (float) self::$maximumValue) {
$row->setMetadata($this->columnToFilter, self::$maximumValue);
}
}
continue;
}
if ($value !== false) {
if ($value < (float) self::$minimumValue) {
$row->setColumn($this->columnToFilter, self::$minimumValue);
} elseif ($value > (float) self::$maximumValue) {
$row->setColumn($this->columnToFilter, self::$maximumValue);
}
}
}
} | php | public function filter($table)
{
foreach ($table->getRows() as $row) {
$value = $row->getColumn($this->columnToFilter);
if ($value === false) {
$value = $row->getMetadata($this->columnToFilter);
if ($value !== false) {
if ($value < (float) self::$minimumValue) {
$row->setMetadata($this->columnToFilter, self::$minimumValue);
} elseif ($value > (float) self::$maximumValue) {
$row->setMetadata($this->columnToFilter, self::$maximumValue);
}
}
continue;
}
if ($value !== false) {
if ($value < (float) self::$minimumValue) {
$row->setColumn($this->columnToFilter, self::$minimumValue);
} elseif ($value > (float) self::$maximumValue) {
$row->setColumn($this->columnToFilter, self::$maximumValue);
}
}
}
} | [
"public",
"function",
"filter",
"(",
"$",
"table",
")",
"{",
"foreach",
"(",
"$",
"table",
"->",
"getRows",
"(",
")",
"as",
"$",
"row",
")",
"{",
"$",
"value",
"=",
"$",
"row",
"->",
"getColumn",
"(",
"$",
"this",
"->",
"columnToFilter",
")",
";",
... | Executes the filter an adjusts all columns to fit the defined range
@param DataTable $table | [
"Executes",
"the",
"filter",
"an",
"adjusts",
"all",
"columns",
"to",
"fit",
"the",
"defined",
"range"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/DataTable/Filter/RangeCheck.php#L46-L71 | train | Filter the table | [
30522,
2270,
3853,
11307,
1006,
1002,
2795,
1007,
1063,
18921,
6776,
1006,
1002,
2795,
1011,
1028,
2131,
10524,
2015,
1006,
1007,
2004,
1002,
5216,
1007,
1063,
1002,
3643,
1027,
1002,
5216,
1011,
1028,
2131,
25778,
2819,
2078,
1006,
1002,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/backend/classes/NavigationManager.php | NavigationManager.listSideMenuItems | public function listSideMenuItems($owner = null, $code = null)
{
$activeItem = null;
if ($owner !== null && $code !== null) {
$activeItem = @$this->items[$this->makeItemKey($owner, $code)];
} else {
foreach ($this->listMainMenuItems() as $item) {
if ($this->isMainMenuItemActive($item)) {
$activeItem = $item;
break;
}
}
}
if (!$activeItem) {
return [];
}
$items = $activeItem->sideMenu;
foreach ($items as $item) {
if ($item->counter !== null && is_callable($item->counter)) {
$item->counter = call_user_func($item->counter, $item);
}
}
return $items;
} | php | public function listSideMenuItems($owner = null, $code = null)
{
$activeItem = null;
if ($owner !== null && $code !== null) {
$activeItem = @$this->items[$this->makeItemKey($owner, $code)];
} else {
foreach ($this->listMainMenuItems() as $item) {
if ($this->isMainMenuItemActive($item)) {
$activeItem = $item;
break;
}
}
}
if (!$activeItem) {
return [];
}
$items = $activeItem->sideMenu;
foreach ($items as $item) {
if ($item->counter !== null && is_callable($item->counter)) {
$item->counter = call_user_func($item->counter, $item);
}
}
return $items;
} | [
"public",
"function",
"listSideMenuItems",
"(",
"$",
"owner",
"=",
"null",
",",
"$",
"code",
"=",
"null",
")",
"{",
"$",
"activeItem",
"=",
"null",
";",
"if",
"(",
"$",
"owner",
"!==",
"null",
"&&",
"$",
"code",
"!==",
"null",
")",
"{",
"$",
"activ... | Returns a list of side menu items for the currently active main menu item.
The currently active main menu item is set with the setContext methods. | [
"Returns",
"a",
"list",
"of",
"side",
"menu",
"items",
"for",
"the",
"currently",
"active",
"main",
"menu",
"item",
".",
"The",
"currently",
"active",
"main",
"menu",
"item",
"is",
"set",
"with",
"the",
"setContext",
"methods",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/classes/NavigationManager.php#L316-L344 | train | Returns the side menu items | [
30522,
2270,
3853,
7201,
5178,
3549,
14663,
6633,
2015,
1006,
1002,
3954,
1027,
19701,
1010,
1002,
3642,
1027,
19701,
1007,
1063,
1002,
3161,
4221,
2213,
1027,
19701,
1025,
2065,
1006,
1002,
3954,
999,
1027,
1027,
19701,
1004,
1004,
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/Routing/RouteParameterBinder.php | RouteParameterBinder.parameters | public function parameters($request)
{
// If the route has a regular expression for the host part of the URI, we will
// compile that and get the parameter matches for this domain. We will then
// merge them into this parameters array so that this array is completed.
$parameters = $this->bindPathParameters($request);
// If the route has a regular expression for the host part of the URI, we will
// compile that and get the parameter matches for this domain. We will then
// merge them into this parameters array so that this array is completed.
if (! is_null($this->route->compiled->getHostRegex())) {
$parameters = $this->bindHostParameters(
$request, $parameters
);
}
return $this->replaceDefaults($parameters);
} | php | public function parameters($request)
{
// If the route has a regular expression for the host part of the URI, we will
// compile that and get the parameter matches for this domain. We will then
// merge them into this parameters array so that this array is completed.
$parameters = $this->bindPathParameters($request);
// If the route has a regular expression for the host part of the URI, we will
// compile that and get the parameter matches for this domain. We will then
// merge them into this parameters array so that this array is completed.
if (! is_null($this->route->compiled->getHostRegex())) {
$parameters = $this->bindHostParameters(
$request, $parameters
);
}
return $this->replaceDefaults($parameters);
} | [
"public",
"function",
"parameters",
"(",
"$",
"request",
")",
"{",
"// If the route has a regular expression for the host part of the URI, we will",
"// compile that and get the parameter matches for this domain. We will then",
"// merge them into this parameters array so that this array is comp... | Get the parameters for the route.
@param \Illuminate\Http\Request $request
@return array | [
"Get",
"the",
"parameters",
"for",
"the",
"route",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Routing/RouteParameterBinder.php#L33-L50 | train | Returns the parameters array for the route | [
30522,
2270,
3853,
11709,
1006,
1002,
5227,
1007,
1063,
1013,
1013,
2065,
1996,
2799,
2038,
1037,
3180,
3670,
2005,
1996,
3677,
2112,
1997,
1996,
24471,
2072,
1010,
2057,
2097,
1013,
1013,
4012,
22090,
2008,
1998,
2131,
1996,
16381,
3503,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/OptionsResolver/OptionsResolver.php | OptionsResolver.setAllowedValues | public function setAllowedValues($option, $allowedValues)
{
if ($this->locked) {
throw new AccessException('Allowed values cannot be set from a lazy option or normalizer.');
}
if (!isset($this->defined[$option])) {
throw new UndefinedOptionsException(sprintf('The option "%s" does not exist. Defined options are: "%s".', $option, implode('", "', array_keys($this->defined))));
}
$this->allowedValues[$option] = \is_array($allowedValues) ? $allowedValues : [$allowedValues];
// Make sure the option is processed
unset($this->resolved[$option]);
return $this;
} | php | public function setAllowedValues($option, $allowedValues)
{
if ($this->locked) {
throw new AccessException('Allowed values cannot be set from a lazy option or normalizer.');
}
if (!isset($this->defined[$option])) {
throw new UndefinedOptionsException(sprintf('The option "%s" does not exist. Defined options are: "%s".', $option, implode('", "', array_keys($this->defined))));
}
$this->allowedValues[$option] = \is_array($allowedValues) ? $allowedValues : [$allowedValues];
// Make sure the option is processed
unset($this->resolved[$option]);
return $this;
} | [
"public",
"function",
"setAllowedValues",
"(",
"$",
"option",
",",
"$",
"allowedValues",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"locked",
")",
"{",
"throw",
"new",
"AccessException",
"(",
"'Allowed values cannot be set from a lazy option or normalizer.'",
")",
";",... | Sets allowed values for an option.
Instead of passing values, you may also pass a closures with the
following signature:
function ($value) {
// return true or false
}
The closure receives the value as argument and should return true to
accept the value and false to reject the value.
@param string $option The option name
@param mixed $allowedValues One or more acceptable values/closures
@return $this
@throws UndefinedOptionsException If the option is undefined
@throws AccessException If called from a lazy option or normalizer | [
"Sets",
"allowed",
"values",
"for",
"an",
"option",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/OptionsResolver/OptionsResolver.php#L565-L581 | train | Sets allowed values for an option | [
30522,
2270,
3853,
2275,
8095,
15096,
10175,
15808,
1006,
1002,
5724,
1010,
1002,
3039,
10175,
15808,
1007,
1063,
2065,
1006,
1002,
2023,
1011,
1028,
5299,
1007,
1063,
5466,
2047,
3229,
10288,
24422,
1006,
1005,
3039,
5300,
3685,
2022,
2275... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/cms/classes/Theme.php | Theme.getEditThemeCode | public static function getEditThemeCode()
{
$editTheme = Config::get('cms.editTheme');
if (!$editTheme) {
$editTheme = static::getActiveThemeCode();
}
/**
* @event cms.theme.getEditTheme
* Overrides the edit theme code.
*
* If a value is returned from this halting event, it will be used as the edit
* theme code. Example usage:
*
* Event::listen('cms.theme.getEditTheme', function() {
* return "the-edit-theme-code";
* });
*
*/
$apiResult = Event::fire('cms.theme.getEditTheme', [], true);
if ($apiResult !== null) {
$editTheme = $apiResult;
}
if (!strlen($editTheme)) {
throw new SystemException(Lang::get('cms::lang.theme.edit.not_set'));
}
return $editTheme;
} | php | public static function getEditThemeCode()
{
$editTheme = Config::get('cms.editTheme');
if (!$editTheme) {
$editTheme = static::getActiveThemeCode();
}
/**
* @event cms.theme.getEditTheme
* Overrides the edit theme code.
*
* If a value is returned from this halting event, it will be used as the edit
* theme code. Example usage:
*
* Event::listen('cms.theme.getEditTheme', function() {
* return "the-edit-theme-code";
* });
*
*/
$apiResult = Event::fire('cms.theme.getEditTheme', [], true);
if ($apiResult !== null) {
$editTheme = $apiResult;
}
if (!strlen($editTheme)) {
throw new SystemException(Lang::get('cms::lang.theme.edit.not_set'));
}
return $editTheme;
} | [
"public",
"static",
"function",
"getEditThemeCode",
"(",
")",
"{",
"$",
"editTheme",
"=",
"Config",
"::",
"get",
"(",
"'cms.editTheme'",
")",
";",
"if",
"(",
"!",
"$",
"editTheme",
")",
"{",
"$",
"editTheme",
"=",
"static",
"::",
"getActiveThemeCode",
"(",... | Returns the edit theme code.
By default the edit theme is loaded from the cms.editTheme parameter,
but this behavior can be overridden by the cms.theme.getEditTheme event listeners.
If the edit theme is not defined in the configuration file, the active theme
is returned.
@return string | [
"Returns",
"the",
"edit",
"theme",
"code",
".",
"By",
"default",
"the",
"edit",
"theme",
"is",
"loaded",
"from",
"the",
"cms",
".",
"editTheme",
"parameter",
"but",
"this",
"behavior",
"can",
"be",
"overridden",
"by",
"the",
"cms",
".",
"theme",
".",
"ge... | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/Theme.php#L251-L280 | train | Returns the edit theme code | [
30522,
2270,
10763,
3853,
2131,
2098,
12474,
29122,
8586,
10244,
1006,
1007,
1063,
1002,
10086,
10760,
4168,
1027,
9530,
8873,
2290,
1024,
1024,
2131,
1006,
1005,
4642,
2015,
1012,
10086,
10760,
4168,
1005,
1007,
1025,
2065,
1006,
999,
1002... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/ArchiveProcessor.php | ArchiveProcessor.getAggregatedDataTableMap | protected function getAggregatedDataTableMap($data, $columnsAggregationOperation)
{
$table = new DataTable();
if (!empty($columnsAggregationOperation)) {
$table->setMetadata(DataTable::COLUMN_AGGREGATION_OPS_METADATA_NAME, $columnsAggregationOperation);
}
if ($data instanceof DataTable\Map) {
// as $date => $tableToSum
$this->aggregatedDataTableMapsAsOne($data, $table);
} else {
$table->addDataTable($data);
}
return $table;
} | php | protected function getAggregatedDataTableMap($data, $columnsAggregationOperation)
{
$table = new DataTable();
if (!empty($columnsAggregationOperation)) {
$table->setMetadata(DataTable::COLUMN_AGGREGATION_OPS_METADATA_NAME, $columnsAggregationOperation);
}
if ($data instanceof DataTable\Map) {
// as $date => $tableToSum
$this->aggregatedDataTableMapsAsOne($data, $table);
} else {
$table->addDataTable($data);
}
return $table;
} | [
"protected",
"function",
"getAggregatedDataTableMap",
"(",
"$",
"data",
",",
"$",
"columnsAggregationOperation",
")",
"{",
"$",
"table",
"=",
"new",
"DataTable",
"(",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"columnsAggregationOperation",
")",
")",
"{",
... | If the DataTable is a Map, sums all DataTable in the map and return the DataTable.
@param $data DataTable|DataTable\Map
@param $columnsToRenameAfterAggregation array
@return DataTable | [
"If",
"the",
"DataTable",
"is",
"a",
"Map",
"sums",
"all",
"DataTable",
"in",
"the",
"map",
"and",
"return",
"the",
"DataTable",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/ArchiveProcessor.php#L503-L519 | train | Get aggregated data table | [
30522,
5123,
3853,
2131,
8490,
17603,
11644,
2850,
29336,
3085,
2863,
2361,
1006,
1002,
2951,
1010,
1002,
7753,
8490,
17603,
12540,
25918,
3370,
1007,
1063,
1002,
2795,
1027,
2047,
2951,
10880,
1006,
1007,
1025,
2065,
1006,
999,
4064,
1006,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/backend/classes/Controller.php | Controller.getId | public function getId($suffix = null)
{
$id = class_basename(get_called_class()) . '-' . $this->action;
if ($suffix !== null) {
$id .= '-' . $suffix;
}
return $id;
} | php | public function getId($suffix = null)
{
$id = class_basename(get_called_class()) . '-' . $this->action;
if ($suffix !== null) {
$id .= '-' . $suffix;
}
return $id;
} | [
"public",
"function",
"getId",
"(",
"$",
"suffix",
"=",
"null",
")",
"{",
"$",
"id",
"=",
"class_basename",
"(",
"get_called_class",
"(",
")",
")",
".",
"'-'",
".",
"$",
"this",
"->",
"action",
";",
"if",
"(",
"$",
"suffix",
"!==",
"null",
")",
"{"... | Returns a unique ID for the controller and route. Useful in creating HTML markup. | [
"Returns",
"a",
"unique",
"ID",
"for",
"the",
"controller",
"and",
"route",
".",
"Useful",
"in",
"creating",
"HTML",
"markup",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/classes/Controller.php#L632-L640 | train | Returns the id of the current action | [
30522,
2270,
3853,
2131,
3593,
1006,
1002,
16809,
1027,
19701,
1007,
1063,
1002,
8909,
1027,
2465,
1035,
2918,
18442,
1006,
2131,
1035,
2170,
1035,
2465,
1006,
1007,
1007,
1012,
1005,
1011,
1005,
1012,
1002,
2023,
1011,
1028,
2895,
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/Mail/Storage/Mbox.php | Zend_Mail_Storage_Mbox._isMboxFile | protected function _isMboxFile($file, $fileIsString = true)
{
if ($fileIsString) {
$file = @fopen($file, 'r');
if (!$file) {
return false;
}
} else {
fseek($file, 0);
}
$result = false;
$line = fgets($file);
if (strpos($line, 'From ') === 0) {
$result = true;
}
if ($fileIsString) {
@fclose($file);
}
return $result;
} | php | protected function _isMboxFile($file, $fileIsString = true)
{
if ($fileIsString) {
$file = @fopen($file, 'r');
if (!$file) {
return false;
}
} else {
fseek($file, 0);
}
$result = false;
$line = fgets($file);
if (strpos($line, 'From ') === 0) {
$result = true;
}
if ($fileIsString) {
@fclose($file);
}
return $result;
} | [
"protected",
"function",
"_isMboxFile",
"(",
"$",
"file",
",",
"$",
"fileIsString",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"fileIsString",
")",
"{",
"$",
"file",
"=",
"@",
"fopen",
"(",
"$",
"file",
",",
"'r'",
")",
";",
"if",
"(",
"!",
"$",
"fil... | check if given file is a mbox file
if $file is a resource its file pointer is moved after the first line
@param resource|string $file stream resource of name of file
@param bool $fileIsString file is string or resource
@return bool file is mbox file | [
"check",
"if",
"given",
"file",
"is",
"a",
"mbox",
"file"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Mail/Storage/Mbox.php#L250-L273 | train | Check if a file is a mbox file | [
30522,
5123,
3853,
1035,
2003,
13344,
2595,
8873,
2571,
1006,
1002,
5371,
1010,
1002,
5371,
14643,
18886,
3070,
1027,
2995,
1007,
1063,
2065,
1006,
1002,
5371,
14643,
18886,
3070,
1007,
1063,
1002,
5371,
1027,
1030,
1042,
26915,
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/Form/Extension/Core/Type/DateIntervalType.php | DateIntervalType.configureOptions | public function configureOptions(OptionsResolver $resolver)
{
$timeParts = $this->timeParts;
$compound = function (Options $options) {
return 'single_text' !== $options['widget'];
};
$emptyData = function (Options $options) {
return 'single_text' === $options['widget'] ? '' : [];
};
$placeholderDefault = function (Options $options) {
return $options['required'] ? null : '';
};
$placeholderNormalizer = function (Options $options, $placeholder) use ($placeholderDefault, $timeParts) {
if (\is_array($placeholder)) {
$default = $placeholderDefault($options);
return array_merge(array_fill_keys($timeParts, $default), $placeholder);
}
return array_fill_keys($timeParts, $placeholder);
};
$labelsNormalizer = function (Options $options, array $labels) {
return array_replace([
'years' => null,
'months' => null,
'days' => null,
'weeks' => null,
'hours' => null,
'minutes' => null,
'seconds' => null,
'invert' => 'Negative interval',
], array_filter($labels, function ($label) {
return null !== $label;
}));
};
$resolver->setDefaults([
'with_years' => true,
'with_months' => true,
'with_days' => true,
'with_weeks' => false,
'with_hours' => false,
'with_minutes' => false,
'with_seconds' => false,
'with_invert' => false,
'years' => range(0, 100),
'months' => range(0, 12),
'weeks' => range(0, 52),
'days' => range(0, 31),
'hours' => range(0, 24),
'minutes' => range(0, 60),
'seconds' => range(0, 60),
'widget' => 'choice',
'input' => 'dateinterval',
'placeholder' => $placeholderDefault,
'by_reference' => true,
'error_bubbling' => false,
// If initialized with a \DateInterval object, FormType initializes
// this option to "\DateInterval". Since the internal, normalized
// representation is not \DateInterval, but an array, we need to unset
// this option.
'data_class' => null,
'compound' => $compound,
'empty_data' => $emptyData,
'labels' => [],
]);
$resolver->setNormalizer('placeholder', $placeholderNormalizer);
$resolver->setNormalizer('labels', $labelsNormalizer);
$resolver->setAllowedValues(
'input',
[
'dateinterval',
'string',
'array',
]
);
$resolver->setAllowedValues(
'widget',
[
'single_text',
'text',
'integer',
'choice',
]
);
// Don't clone \DateInterval classes, as i.e. format()
// does not work after that
$resolver->setAllowedValues('by_reference', true);
$resolver->setAllowedTypes('years', 'array');
$resolver->setAllowedTypes('months', 'array');
$resolver->setAllowedTypes('weeks', 'array');
$resolver->setAllowedTypes('days', 'array');
$resolver->setAllowedTypes('hours', 'array');
$resolver->setAllowedTypes('minutes', 'array');
$resolver->setAllowedTypes('seconds', 'array');
$resolver->setAllowedTypes('with_years', 'bool');
$resolver->setAllowedTypes('with_months', 'bool');
$resolver->setAllowedTypes('with_weeks', 'bool');
$resolver->setAllowedTypes('with_days', 'bool');
$resolver->setAllowedTypes('with_hours', 'bool');
$resolver->setAllowedTypes('with_minutes', 'bool');
$resolver->setAllowedTypes('with_seconds', 'bool');
$resolver->setAllowedTypes('with_invert', 'bool');
$resolver->setAllowedTypes('labels', 'array');
} | php | public function configureOptions(OptionsResolver $resolver)
{
$timeParts = $this->timeParts;
$compound = function (Options $options) {
return 'single_text' !== $options['widget'];
};
$emptyData = function (Options $options) {
return 'single_text' === $options['widget'] ? '' : [];
};
$placeholderDefault = function (Options $options) {
return $options['required'] ? null : '';
};
$placeholderNormalizer = function (Options $options, $placeholder) use ($placeholderDefault, $timeParts) {
if (\is_array($placeholder)) {
$default = $placeholderDefault($options);
return array_merge(array_fill_keys($timeParts, $default), $placeholder);
}
return array_fill_keys($timeParts, $placeholder);
};
$labelsNormalizer = function (Options $options, array $labels) {
return array_replace([
'years' => null,
'months' => null,
'days' => null,
'weeks' => null,
'hours' => null,
'minutes' => null,
'seconds' => null,
'invert' => 'Negative interval',
], array_filter($labels, function ($label) {
return null !== $label;
}));
};
$resolver->setDefaults([
'with_years' => true,
'with_months' => true,
'with_days' => true,
'with_weeks' => false,
'with_hours' => false,
'with_minutes' => false,
'with_seconds' => false,
'with_invert' => false,
'years' => range(0, 100),
'months' => range(0, 12),
'weeks' => range(0, 52),
'days' => range(0, 31),
'hours' => range(0, 24),
'minutes' => range(0, 60),
'seconds' => range(0, 60),
'widget' => 'choice',
'input' => 'dateinterval',
'placeholder' => $placeholderDefault,
'by_reference' => true,
'error_bubbling' => false,
// If initialized with a \DateInterval object, FormType initializes
// this option to "\DateInterval". Since the internal, normalized
// representation is not \DateInterval, but an array, we need to unset
// this option.
'data_class' => null,
'compound' => $compound,
'empty_data' => $emptyData,
'labels' => [],
]);
$resolver->setNormalizer('placeholder', $placeholderNormalizer);
$resolver->setNormalizer('labels', $labelsNormalizer);
$resolver->setAllowedValues(
'input',
[
'dateinterval',
'string',
'array',
]
);
$resolver->setAllowedValues(
'widget',
[
'single_text',
'text',
'integer',
'choice',
]
);
// Don't clone \DateInterval classes, as i.e. format()
// does not work after that
$resolver->setAllowedValues('by_reference', true);
$resolver->setAllowedTypes('years', 'array');
$resolver->setAllowedTypes('months', 'array');
$resolver->setAllowedTypes('weeks', 'array');
$resolver->setAllowedTypes('days', 'array');
$resolver->setAllowedTypes('hours', 'array');
$resolver->setAllowedTypes('minutes', 'array');
$resolver->setAllowedTypes('seconds', 'array');
$resolver->setAllowedTypes('with_years', 'bool');
$resolver->setAllowedTypes('with_months', 'bool');
$resolver->setAllowedTypes('with_weeks', 'bool');
$resolver->setAllowedTypes('with_days', 'bool');
$resolver->setAllowedTypes('with_hours', 'bool');
$resolver->setAllowedTypes('with_minutes', 'bool');
$resolver->setAllowedTypes('with_seconds', 'bool');
$resolver->setAllowedTypes('with_invert', 'bool');
$resolver->setAllowedTypes('labels', 'array');
} | [
"public",
"function",
"configureOptions",
"(",
"OptionsResolver",
"$",
"resolver",
")",
"{",
"$",
"timeParts",
"=",
"$",
"this",
"->",
"timeParts",
";",
"$",
"compound",
"=",
"function",
"(",
"Options",
"$",
"options",
")",
"{",
"return",
"'single_text'",
"!... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Extension/Core/Type/DateIntervalType.php#L169-L278 | train | Configures the options resolver | [
30522,
2270,
3853,
9530,
8873,
27390,
8780,
16790,
2015,
1006,
7047,
6072,
4747,
6299,
1002,
10663,
2099,
1007,
1063,
1002,
2051,
26950,
1027,
1002,
2023,
1011,
1028,
2051,
26950,
1025,
1002,
7328,
1027,
3853,
1006,
7047,
1002,
7047,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getgrav/grav | system/src/Grav/Common/Page/Medium/ImageMedium.php | ImageMedium.width | public function width($value = 'auto')
{
if (!$value || $value === 'auto') {
$this->attributes['width'] = $this->get('width');
} else {
$this->attributes['width'] = $value;
}
return $this;
} | php | public function width($value = 'auto')
{
if (!$value || $value === 'auto') {
$this->attributes['width'] = $this->get('width');
} else {
$this->attributes['width'] = $value;
}
return $this;
} | [
"public",
"function",
"width",
"(",
"$",
"value",
"=",
"'auto'",
")",
"{",
"if",
"(",
"!",
"$",
"value",
"||",
"$",
"value",
"===",
"'auto'",
")",
"{",
"$",
"this",
"->",
"attributes",
"[",
"'width'",
"]",
"=",
"$",
"this",
"->",
"get",
"(",
"'wi... | Allows to set the width attribute from Markdown or Twig
Examples: 



{{ page.media['myimg.png'].width().height().html }}
{{ page.media['myimg.png'].resize(100,200).width(100).height(200).html }}
@param mixed $value A value or 'auto' or empty to use the width of the image
@return $this | [
"Allows",
"to",
"set",
"the",
"width",
"attribute",
"from",
"Markdown",
"or",
"Twig",
"Examples",
":",
"!",
"[",
"Example",
"]",
"(",
"myimg",
".",
"png?width",
"=",
"200&height",
"=",
"400",
")",
"!",
"[",
"Example",
"]",
"(",
"myimg",
".",
"png?resiz... | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Medium/ImageMedium.php#L485-L494 | train | Set width attribute | [
30522,
2270,
3853,
9381,
1006,
1002,
3643,
1027,
1005,
8285,
1005,
1007,
1063,
2065,
1006,
999,
1002,
3643,
1064,
1064,
1002,
3643,
1027,
1027,
1027,
1005,
8285,
1005,
1007,
1063,
1002,
2023,
1011,
1028,
12332,
1031,
1005,
9381,
1005,
103... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
overtrue/wechat | src/Kernel/Encryptor.php | Encryptor.encrypt | public function encrypt($xml, $nonce = null, $timestamp = null): string
{
try {
$xml = $this->pkcs7Pad(str_random(16).pack('N', strlen($xml)).$xml.$this->appId, $this->blockSize);
$encrypted = base64_encode(AES::encrypt(
$xml,
$this->aesKey,
substr($this->aesKey, 0, 16),
OPENSSL_NO_PADDING
));
// @codeCoverageIgnoreStart
} catch (Throwable $e) {
throw new RuntimeException($e->getMessage(), self::ERROR_ENCRYPT_AES);
}
// @codeCoverageIgnoreEnd
!is_null($nonce) || $nonce = substr($this->appId, 0, 10);
!is_null($timestamp) || $timestamp = time();
$response = [
'Encrypt' => $encrypted,
'MsgSignature' => $this->signature($this->token, $timestamp, $nonce, $encrypted),
'TimeStamp' => $timestamp,
'Nonce' => $nonce,
];
//生成响应xml
return XML::build($response);
} | php | public function encrypt($xml, $nonce = null, $timestamp = null): string
{
try {
$xml = $this->pkcs7Pad(str_random(16).pack('N', strlen($xml)).$xml.$this->appId, $this->blockSize);
$encrypted = base64_encode(AES::encrypt(
$xml,
$this->aesKey,
substr($this->aesKey, 0, 16),
OPENSSL_NO_PADDING
));
// @codeCoverageIgnoreStart
} catch (Throwable $e) {
throw new RuntimeException($e->getMessage(), self::ERROR_ENCRYPT_AES);
}
// @codeCoverageIgnoreEnd
!is_null($nonce) || $nonce = substr($this->appId, 0, 10);
!is_null($timestamp) || $timestamp = time();
$response = [
'Encrypt' => $encrypted,
'MsgSignature' => $this->signature($this->token, $timestamp, $nonce, $encrypted),
'TimeStamp' => $timestamp,
'Nonce' => $nonce,
];
//生成响应xml
return XML::build($response);
} | [
"public",
"function",
"encrypt",
"(",
"$",
"xml",
",",
"$",
"nonce",
"=",
"null",
",",
"$",
"timestamp",
"=",
"null",
")",
":",
"string",
"{",
"try",
"{",
"$",
"xml",
"=",
"$",
"this",
"->",
"pkcs7Pad",
"(",
"str_random",
"(",
"16",
")",
".",
"pa... | Encrypt the message and return XML.
@param string $xml
@param string $nonce
@param int $timestamp
@return string
@throws \EasyWeChat\Kernel\Exceptions\RuntimeException | [
"Encrypt",
"the",
"message",
"and",
"return",
"XML",
"."
] | 120c72faaa93c270365bc75c73c362d5fd583209 | https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/Kernel/Encryptor.php#L101-L130 | train | Encrypts XML and returns XML. | [
30522,
2270,
3853,
4372,
26775,
22571,
2102,
1006,
1002,
20950,
1010,
1002,
2512,
3401,
1027,
19701,
1010,
1002,
2335,
15464,
2361,
1027,
19701,
1007,
1024,
5164,
1063,
3046,
1063,
1002,
20950,
1027,
1002,
2023,
1011,
1028,
1052,
2243,
6169... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/HTML/Common2.php | HTML_Common2.setIndentLevel | public function setIndentLevel($level)
{
$level = intval($level);
if (0 <= $level) {
$this->_indentLevel = $level;
}
return $this;
} | php | public function setIndentLevel($level)
{
$level = intval($level);
if (0 <= $level) {
$this->_indentLevel = $level;
}
return $this;
} | [
"public",
"function",
"setIndentLevel",
"(",
"$",
"level",
")",
"{",
"$",
"level",
"=",
"intval",
"(",
"$",
"level",
")",
";",
"if",
"(",
"0",
"<=",
"$",
"level",
")",
"{",
"$",
"this",
"->",
"_indentLevel",
"=",
"$",
"level",
";",
"}",
"return",
... | Sets the indentation level
@param int
@return HTML_Common2 | [
"Sets",
"the",
"indentation",
"level"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/HTML/Common2.php#L349-L356 | train | Set indent level | [
30522,
2270,
3853,
2275,
22254,
4765,
20414,
2884,
1006,
1002,
2504,
1007,
1063,
1002,
2504,
1027,
20014,
10175,
1006,
1002,
2504,
1007,
1025,
2065,
1006,
1014,
1026,
1027,
1002,
2504,
1007,
1063,
1002,
2023,
1011,
1028,
1035,
27427,
4765,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Protocol/Pop3.php | Zend_Mail_Protocol_Pop3.getList | public function getList($msgno = null)
{
if ($msgno !== null) {
$result = $this->request("LIST $msgno");
list(, $result) = explode(' ', $result);
return (int)$result;
}
$result = $this->request('LIST', true);
$messages = array();
$line = strtok($result, "\n");
while ($line) {
list($no, $size) = explode(' ', trim($line));
$messages[(int)$no] = (int)$size;
$line = strtok("\n");
}
return $messages;
} | php | public function getList($msgno = null)
{
if ($msgno !== null) {
$result = $this->request("LIST $msgno");
list(, $result) = explode(' ', $result);
return (int)$result;
}
$result = $this->request('LIST', true);
$messages = array();
$line = strtok($result, "\n");
while ($line) {
list($no, $size) = explode(' ', trim($line));
$messages[(int)$no] = (int)$size;
$line = strtok("\n");
}
return $messages;
} | [
"public",
"function",
"getList",
"(",
"$",
"msgno",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"msgno",
"!==",
"null",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"request",
"(",
"\"LIST $msgno\"",
")",
";",
"list",
"(",
",",
"$",
"result",
")",
... | Make LIST call for size of message(s)
@param int|null $msgno number of message, null for all
@return int|array size of given message or list with array(num => size)
@throws Zend_Mail_Protocol_Exception | [
"Make",
"LIST",
"call",
"for",
"size",
"of",
"message",
"(",
"s",
")"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Mail/Protocol/Pop3.php#L311-L330 | train | Get list of all the messages | [
30522,
2270,
3853,
2131,
9863,
1006,
1002,
5796,
26745,
1027,
19701,
1007,
1063,
2065,
1006,
1002,
5796,
26745,
999,
1027,
1027,
19701,
1007,
1063,
1002,
2765,
1027,
1002,
2023,
1011,
1028,
5227,
1006,
1000,
2862,
1002,
5796,
30524,
1011,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Mail/TransportManager.php | TransportManager.createSparkPostDriver | protected function createSparkPostDriver()
{
$config = $this->app['config']->get('services.sparkpost', []);
return new SparkPostTransport(
$this->guzzle($config), $config['secret'], $config['options'] ?? []
);
} | php | protected function createSparkPostDriver()
{
$config = $this->app['config']->get('services.sparkpost', []);
return new SparkPostTransport(
$this->guzzle($config), $config['secret'], $config['options'] ?? []
);
} | [
"protected",
"function",
"createSparkPostDriver",
"(",
")",
"{",
"$",
"config",
"=",
"$",
"this",
"->",
"app",
"[",
"'config'",
"]",
"->",
"get",
"(",
"'services.sparkpost'",
",",
"[",
"]",
")",
";",
"return",
"new",
"SparkPostTransport",
"(",
"$",
"this",... | Create an instance of the SparkPost Swift Transport driver.
@return \Illuminate\Mail\Transport\SparkPostTransport | [
"Create",
"an",
"instance",
"of",
"the",
"SparkPost",
"Swift",
"Transport",
"driver",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Mail/TransportManager.php#L148-L155 | train | Create a SparkPostTransport instance | [
30522,
5123,
3853,
9005,
30524,
1010,
1031,
1033,
1007,
1025,
2709,
2047,
12125,
19894,
6494,
3619,
6442,
1006,
1002,
2023,
1011,
1028,
19739,
17644,
1006,
1002,
9530,
8873,
2290,
1007,
1010,
1002,
9530,
8873,
2290,
1031,
1005,
3595,
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... |
spatie/laravel-permission | src/PermissionServiceProvider.php | PermissionServiceProvider.getMigrationFileName | protected function getMigrationFileName(Filesystem $filesystem): string
{
$timestamp = date('Y_m_d_His');
return Collection::make($this->app->databasePath().DIRECTORY_SEPARATOR.'migrations'.DIRECTORY_SEPARATOR)
->flatMap(function ($path) use ($filesystem) {
return $filesystem->glob($path.'*_create_permission_tables.php');
})->push($this->app->databasePath()."/migrations/{$timestamp}_create_permission_tables.php")
->first();
} | php | protected function getMigrationFileName(Filesystem $filesystem): string
{
$timestamp = date('Y_m_d_His');
return Collection::make($this->app->databasePath().DIRECTORY_SEPARATOR.'migrations'.DIRECTORY_SEPARATOR)
->flatMap(function ($path) use ($filesystem) {
return $filesystem->glob($path.'*_create_permission_tables.php');
})->push($this->app->databasePath()."/migrations/{$timestamp}_create_permission_tables.php")
->first();
} | [
"protected",
"function",
"getMigrationFileName",
"(",
"Filesystem",
"$",
"filesystem",
")",
":",
"string",
"{",
"$",
"timestamp",
"=",
"date",
"(",
"'Y_m_d_His'",
")",
";",
"return",
"Collection",
"::",
"make",
"(",
"$",
"this",
"->",
"app",
"->",
"databaseP... | Returns existing migration file if found, else uses the current timestamp.
@param Filesystem $filesystem
@return string | [
"Returns",
"existing",
"migration",
"file",
"if",
"found",
"else",
"uses",
"the",
"current",
"timestamp",
"."
] | 81dbe9d372d70c255b66a2727a235076509f8d45 | https://github.com/spatie/laravel-permission/blob/81dbe9d372d70c255b66a2727a235076509f8d45/src/PermissionServiceProvider.php#L157-L166 | train | Get the migration file name. | [
30522,
5123,
3853,
2131,
4328,
29397,
8873,
20844,
4168,
1006,
6764,
27268,
6633,
1002,
6764,
27268,
6633,
1007,
1024,
5164,
1063,
1002,
2335,
15464,
2361,
1027,
3058,
1006,
1005,
1061,
1035,
1049,
1035,
1040,
1035,
2010,
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... |
z-song/laravel-admin | src/Form.php | Form.redirectAfterStore | protected function redirectAfterStore()
{
$resourcesPath = $this->resource(0);
$key = $this->model->getKey();
return $this->redirectAfterSaving($resourcesPath, $key);
} | php | protected function redirectAfterStore()
{
$resourcesPath = $this->resource(0);
$key = $this->model->getKey();
return $this->redirectAfterSaving($resourcesPath, $key);
} | [
"protected",
"function",
"redirectAfterStore",
"(",
")",
"{",
"$",
"resourcesPath",
"=",
"$",
"this",
"->",
"resource",
"(",
"0",
")",
";",
"$",
"key",
"=",
"$",
"this",
"->",
"model",
"->",
"getKey",
"(",
")",
";",
"return",
"$",
"this",
"->",
"redi... | Get RedirectResponse after store.
@return \Illuminate\Http\RedirectResponse | [
"Get",
"RedirectResponse",
"after",
"store",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Form.php#L567-L574 | train | Redirect after store | [
30522,
5123,
3853,
2417,
7442,
25572,
6199,
2545,
19277,
1006,
1007,
1063,
1002,
4219,
15069,
1027,
1002,
2023,
1011,
1028,
7692,
1006,
1014,
1007,
1025,
1002,
3145,
1027,
1002,
2023,
1011,
1028,
2944,
1011,
1028,
2131,
14839,
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/Form/Extension/DataCollector/EventListener/DataCollectorListener.php | DataCollectorListener.postSubmit | public function postSubmit(FormEvent $event)
{
if ($event->getForm()->isRoot()) {
// Collect the submitted data of each form
$this->dataCollector->collectSubmittedData($event->getForm());
// Assemble a form tree
// This is done again after the view is built, but we need it here as the view is not always created.
$this->dataCollector->buildPreliminaryFormTree($event->getForm());
}
} | php | public function postSubmit(FormEvent $event)
{
if ($event->getForm()->isRoot()) {
// Collect the submitted data of each form
$this->dataCollector->collectSubmittedData($event->getForm());
// Assemble a form tree
// This is done again after the view is built, but we need it here as the view is not always created.
$this->dataCollector->buildPreliminaryFormTree($event->getForm());
}
} | [
"public",
"function",
"postSubmit",
"(",
"FormEvent",
"$",
"event",
")",
"{",
"if",
"(",
"$",
"event",
"->",
"getForm",
"(",
")",
"->",
"isRoot",
"(",
")",
")",
"{",
"// Collect the submitted data of each form",
"$",
"this",
"->",
"dataCollector",
"->",
"col... | Listener for the {@link FormEvents::POST_SUBMIT} event. | [
"Listener",
"for",
"the",
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Extension/DataCollector/EventListener/DataCollectorListener.php#L64-L74 | train | Post submit event handler | [
30522,
2270,
3853,
8466,
12083,
22930,
1006,
2433,
18697,
3372,
1002,
2724,
1007,
1063,
2065,
1006,
1002,
2724,
1011,
1028,
2131,
14192,
1006,
1007,
1011,
1028,
2003,
3217,
4140,
1006,
1007,
1007,
1063,
1013,
1013,
8145,
1996,
7864,
2951,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/Zend/Cache/Backend/TwoLevels.php | Zend_Cache_Backend_TwoLevels.load | public function load($id, $doNotTestCacheValidity = false)
{
$res = $this->_fastBackend->load($id, $doNotTestCacheValidity);
if ($res === false) {
$res = $this->_slowBackend->load($id, $doNotTestCacheValidity);
if ($res === false) {
// there is no cache at all for this id
return false;
}
}
$array = unserialize($res);
// maybe, we have to refresh the fast cache ?
if ($this->_options['auto_refresh_fast_cache']) {
if ($array['priority'] == 10) {
// no need to refresh the fast cache with priority = 10
return $array['data'];
}
$newFastLifetime = $this->_getFastLifetime($array['lifetime'], $array['priority'], time() - $array['expire']);
// we have the time to refresh the fast cache
$usage = $this->_getFastFillingPercentage('loading');
if (($array['priority'] > 0) && (10 * $array['priority'] >= $usage)) {
// we can refresh the fast cache
$preparedData = $this->_prepareData($array['data'], $array['lifetime'], $array['priority']);
$this->_fastBackend->save($preparedData, $id, array(), $newFastLifetime);
}
}
return $array['data'];
} | php | public function load($id, $doNotTestCacheValidity = false)
{
$res = $this->_fastBackend->load($id, $doNotTestCacheValidity);
if ($res === false) {
$res = $this->_slowBackend->load($id, $doNotTestCacheValidity);
if ($res === false) {
// there is no cache at all for this id
return false;
}
}
$array = unserialize($res);
// maybe, we have to refresh the fast cache ?
if ($this->_options['auto_refresh_fast_cache']) {
if ($array['priority'] == 10) {
// no need to refresh the fast cache with priority = 10
return $array['data'];
}
$newFastLifetime = $this->_getFastLifetime($array['lifetime'], $array['priority'], time() - $array['expire']);
// we have the time to refresh the fast cache
$usage = $this->_getFastFillingPercentage('loading');
if (($array['priority'] > 0) && (10 * $array['priority'] >= $usage)) {
// we can refresh the fast cache
$preparedData = $this->_prepareData($array['data'], $array['lifetime'], $array['priority']);
$this->_fastBackend->save($preparedData, $id, array(), $newFastLifetime);
}
}
return $array['data'];
} | [
"public",
"function",
"load",
"(",
"$",
"id",
",",
"$",
"doNotTestCacheValidity",
"=",
"false",
")",
"{",
"$",
"res",
"=",
"$",
"this",
"->",
"_fastBackend",
"->",
"load",
"(",
"$",
"id",
",",
"$",
"doNotTestCacheValidity",
")",
";",
"if",
"(",
"$",
... | Test if a cache is available for the given id and (if yes) return it (false else)
Note : return value is always "string" (unserialization is done by the core not by the backend)
@param string $id Cache id
@param boolean $doNotTestCacheValidity If set to true, the cache validity won't be tested
@return string|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/Backend/TwoLevels.php#L224-L251 | train | Load the content of the cache | [
30522,
2270,
3853,
7170,
1006,
1002,
8909,
1010,
1002,
2123,
28495,
3367,
3540,
16179,
11475,
25469,
1027,
6270,
1007,
1063,
1002,
24501,
1027,
1002,
2023,
1011,
1028,
1035,
3435,
5963,
10497,
1011,
1028,
7170,
1006,
1002,
8909,
1010,
1002,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Database/Schema/MySqlBuilder.php | MySqlBuilder.dropAllTables | public function dropAllTables()
{
$tables = [];
foreach ($this->getAllTables() as $row) {
$row = (array) $row;
$tables[] = reset($row);
}
if (empty($tables)) {
return;
}
$this->disableForeignKeyConstraints();
$this->connection->statement(
$this->grammar->compileDropAllTables($tables)
);
$this->enableForeignKeyConstraints();
} | php | public function dropAllTables()
{
$tables = [];
foreach ($this->getAllTables() as $row) {
$row = (array) $row;
$tables[] = reset($row);
}
if (empty($tables)) {
return;
}
$this->disableForeignKeyConstraints();
$this->connection->statement(
$this->grammar->compileDropAllTables($tables)
);
$this->enableForeignKeyConstraints();
} | [
"public",
"function",
"dropAllTables",
"(",
")",
"{",
"$",
"tables",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"getAllTables",
"(",
")",
"as",
"$",
"row",
")",
"{",
"$",
"row",
"=",
"(",
"array",
")",
"$",
"row",
";",
"$",
"tables",
... | Drop all tables from the database.
@return void | [
"Drop",
"all",
"tables",
"from",
"the",
"database",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Schema/MySqlBuilder.php#L44-L65 | train | Drops all tables in the database. | [
30522,
2270,
3853,
4530,
8095,
10880,
2015,
1006,
1007,
1063,
1002,
7251,
1027,
1031,
1033,
1025,
18921,
6776,
1006,
1002,
2023,
1011,
1028,
2131,
8095,
10880,
2015,
1006,
1007,
2004,
1002,
5216,
1007,
1063,
1002,
5216,
1027,
1006,
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/Component/HttpClient/HttpClientTrait.php | HttpClientTrait.prepareRequest | private static function prepareRequest(?string $method, ?string $url, array $options, array $defaultOptions = [], bool $allowExtraOptions = false): array
{
if (null !== $method) {
if (\strlen($method) !== strspn($method, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')) {
throw new InvalidArgumentException(sprintf('Invalid HTTP method "%s", only uppercase letters are accepted.', $method));
}
if (!$method) {
throw new InvalidArgumentException('The HTTP method can not be empty.');
}
}
$options = self::mergeDefaultOptions($options, $defaultOptions, $allowExtraOptions);
if (isset($options['json'])) {
if (isset($options['body']) && '' !== $options['body']) {
throw new InvalidArgumentException('Define either the "json" or the "body" option, setting both is not supported.');
}
$options['body'] = self::jsonEncode($options['json']);
unset($options['json']);
$options['headers']['content-type'] = $options['headers']['content-type'] ?? ['application/json'];
}
if (isset($options['body'])) {
$options['body'] = self::normalizeBody($options['body']);
}
if (isset($options['peer_fingerprint'])) {
$options['peer_fingerprint'] = self::normalizePeerFingerprint($options['peer_fingerprint']);
}
// Compute request headers
$requestHeaders = $headers = [];
foreach ($options['headers'] as $name => $values) {
foreach ($values as $value) {
$requestHeaders[] = $name.': '.$headers[$name][] = $value = (string) $value;
if (\strlen($value) !== strcspn($value, "\r\n\0")) {
throw new InvalidArgumentException(sprintf('Invalid header value: CR/LF/NUL found in "%s".', $value));
}
}
}
// Validate on_progress
if (!\is_callable($onProgress = $options['on_progress'] ?? 'var_dump')) {
throw new InvalidArgumentException(sprintf('Option "on_progress" must be callable, %s given.', \is_object($onProgress) ? \get_class($onProgress) : \gettype($onProgress)));
}
if (\is_array($options['auth_basic'] ?? null)) {
$count = \count($options['auth_basic']);
if ($count <= 0 || $count > 2) {
throw new InvalidArgumentException(sprintf('Option "auth_basic" must contain 1 or 2 elements, %s given.', $count));
}
$options['auth_basic'] = implode(':', $options['auth_basic']);
}
if (!\is_string($options['auth_basic'] ?? '')) {
throw new InvalidArgumentException(sprintf('Option "auth_basic" must be string or an array, %s given.', \gettype($options['auth_basic'])));
}
if (isset($options['auth_bearer']) && (!\is_string($options['auth_bearer']) || !preg_match('{^[-._~+/0-9a-zA-Z]++=*+$}', $options['auth_bearer']))) {
throw new InvalidArgumentException(sprintf('Option "auth_bearer" must be a string containing only characters from the base 64 alphabet, %s given.', \is_string($options['auth_bearer']) ? 'invalid string' : \gettype($options['auth_bearer'])));
}
if (isset($options['auth_basic'], $options['auth_bearer'])) {
throw new InvalidArgumentException('Define either the "auth_basic" or the "auth_bearer" option, setting both is not supported.');
}
if (null !== $url) {
// Merge auth with headers
if (($options['auth_basic'] ?? false) && !($headers['authorization'] ?? false)) {
$requestHeaders[] = 'authorization: '.$headers['authorization'][] = 'Basic '.base64_encode($options['auth_basic']);
}
// Merge bearer with headers
if (($options['auth_bearer'] ?? false) && !($headers['authorization'] ?? false)) {
$requestHeaders[] = 'authorization: '.$headers['authorization'][] = 'Bearer '.$options['auth_bearer'];
}
$options['request_headers'] = $requestHeaders;
unset($options['auth_basic'], $options['auth_bearer']);
// Parse base URI
if (\is_string($options['base_uri'])) {
$options['base_uri'] = self::parseUrl($options['base_uri']);
}
// Validate and resolve URL
$url = self::parseUrl($url, $options['query']);
$url = self::resolveUrl($url, $options['base_uri'], $defaultOptions['query'] ?? []);
}
// Finalize normalization of options
$options['headers'] = $headers;
$options['http_version'] = (string) ($options['http_version'] ?? '') ?: null;
$options['timeout'] = (float) ($options['timeout'] ?? ini_get('default_socket_timeout'));
return [$url, $options];
} | php | private static function prepareRequest(?string $method, ?string $url, array $options, array $defaultOptions = [], bool $allowExtraOptions = false): array
{
if (null !== $method) {
if (\strlen($method) !== strspn($method, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')) {
throw new InvalidArgumentException(sprintf('Invalid HTTP method "%s", only uppercase letters are accepted.', $method));
}
if (!$method) {
throw new InvalidArgumentException('The HTTP method can not be empty.');
}
}
$options = self::mergeDefaultOptions($options, $defaultOptions, $allowExtraOptions);
if (isset($options['json'])) {
if (isset($options['body']) && '' !== $options['body']) {
throw new InvalidArgumentException('Define either the "json" or the "body" option, setting both is not supported.');
}
$options['body'] = self::jsonEncode($options['json']);
unset($options['json']);
$options['headers']['content-type'] = $options['headers']['content-type'] ?? ['application/json'];
}
if (isset($options['body'])) {
$options['body'] = self::normalizeBody($options['body']);
}
if (isset($options['peer_fingerprint'])) {
$options['peer_fingerprint'] = self::normalizePeerFingerprint($options['peer_fingerprint']);
}
// Compute request headers
$requestHeaders = $headers = [];
foreach ($options['headers'] as $name => $values) {
foreach ($values as $value) {
$requestHeaders[] = $name.': '.$headers[$name][] = $value = (string) $value;
if (\strlen($value) !== strcspn($value, "\r\n\0")) {
throw new InvalidArgumentException(sprintf('Invalid header value: CR/LF/NUL found in "%s".', $value));
}
}
}
// Validate on_progress
if (!\is_callable($onProgress = $options['on_progress'] ?? 'var_dump')) {
throw new InvalidArgumentException(sprintf('Option "on_progress" must be callable, %s given.', \is_object($onProgress) ? \get_class($onProgress) : \gettype($onProgress)));
}
if (\is_array($options['auth_basic'] ?? null)) {
$count = \count($options['auth_basic']);
if ($count <= 0 || $count > 2) {
throw new InvalidArgumentException(sprintf('Option "auth_basic" must contain 1 or 2 elements, %s given.', $count));
}
$options['auth_basic'] = implode(':', $options['auth_basic']);
}
if (!\is_string($options['auth_basic'] ?? '')) {
throw new InvalidArgumentException(sprintf('Option "auth_basic" must be string or an array, %s given.', \gettype($options['auth_basic'])));
}
if (isset($options['auth_bearer']) && (!\is_string($options['auth_bearer']) || !preg_match('{^[-._~+/0-9a-zA-Z]++=*+$}', $options['auth_bearer']))) {
throw new InvalidArgumentException(sprintf('Option "auth_bearer" must be a string containing only characters from the base 64 alphabet, %s given.', \is_string($options['auth_bearer']) ? 'invalid string' : \gettype($options['auth_bearer'])));
}
if (isset($options['auth_basic'], $options['auth_bearer'])) {
throw new InvalidArgumentException('Define either the "auth_basic" or the "auth_bearer" option, setting both is not supported.');
}
if (null !== $url) {
// Merge auth with headers
if (($options['auth_basic'] ?? false) && !($headers['authorization'] ?? false)) {
$requestHeaders[] = 'authorization: '.$headers['authorization'][] = 'Basic '.base64_encode($options['auth_basic']);
}
// Merge bearer with headers
if (($options['auth_bearer'] ?? false) && !($headers['authorization'] ?? false)) {
$requestHeaders[] = 'authorization: '.$headers['authorization'][] = 'Bearer '.$options['auth_bearer'];
}
$options['request_headers'] = $requestHeaders;
unset($options['auth_basic'], $options['auth_bearer']);
// Parse base URI
if (\is_string($options['base_uri'])) {
$options['base_uri'] = self::parseUrl($options['base_uri']);
}
// Validate and resolve URL
$url = self::parseUrl($url, $options['query']);
$url = self::resolveUrl($url, $options['base_uri'], $defaultOptions['query'] ?? []);
}
// Finalize normalization of options
$options['headers'] = $headers;
$options['http_version'] = (string) ($options['http_version'] ?? '') ?: null;
$options['timeout'] = (float) ($options['timeout'] ?? ini_get('default_socket_timeout'));
return [$url, $options];
} | [
"private",
"static",
"function",
"prepareRequest",
"(",
"?",
"string",
"$",
"method",
",",
"?",
"string",
"$",
"url",
",",
"array",
"$",
"options",
",",
"array",
"$",
"defaultOptions",
"=",
"[",
"]",
",",
"bool",
"$",
"allowExtraOptions",
"=",
"false",
"... | Validates and normalizes method, URL and options, and merges them with defaults.
@throws InvalidArgumentException When a not-supported option is found | [
"Validates",
"and",
"normalizes",
"method",
"URL",
"and",
"options",
"and",
"merges",
"them",
"with",
"defaults",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpClient/HttpClientTrait.php#L34-L132 | train | Prepares the request. | [
30522,
2797,
10763,
3853,
7374,
2890,
15500,
1006,
1029,
5164,
1002,
4118,
1010,
1029,
5164,
1002,
24471,
2140,
1010,
9140,
1002,
7047,
1010,
9140,
1002,
12398,
7361,
9285,
1027,
1031,
1033,
1010,
22017,
2140,
1002,
3499,
10288,
6494,
7361,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Cache/TagSet.php | TagSet.resetTag | public function resetTag($name)
{
$this->store->forever($this->tagKey($name), $id = str_replace('.', '', uniqid('', true)));
return $id;
} | php | public function resetTag($name)
{
$this->store->forever($this->tagKey($name), $id = str_replace('.', '', uniqid('', true)));
return $id;
} | [
"public",
"function",
"resetTag",
"(",
"$",
"name",
")",
"{",
"$",
"this",
"->",
"store",
"->",
"forever",
"(",
"$",
"this",
"->",
"tagKey",
"(",
"$",
"name",
")",
",",
"$",
"id",
"=",
"str_replace",
"(",
"'.'",
",",
"''",
",",
"uniqid",
"(",
"''... | Reset the tag and return the new tag identifier.
@param string $name
@return string | [
"Reset",
"the",
"tag",
"and",
"return",
"the",
"new",
"tag",
"identifier",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Cache/TagSet.php#L52-L57 | train | Reset tag and return its id | [
30522,
2270,
3853,
25141,
15900,
1006,
1002,
2171,
1007,
1063,
1002,
2023,
1011,
1028,
3573,
1011,
1028,
5091,
1006,
1002,
2023,
1011,
1028,
6415,
14839,
1006,
1002,
2171,
1007,
1010,
1002,
8909,
1027,
2358,
2099,
1035,
5672,
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... |
symfony/symfony | src/Symfony/Component/Form/Extension/Core/Type/DateType.php | DateType.buildForm | public function buildForm(FormBuilderInterface $builder, array $options)
{
$dateFormat = \is_int($options['format']) ? $options['format'] : self::DEFAULT_FORMAT;
$timeFormat = \IntlDateFormatter::NONE;
$calendar = \IntlDateFormatter::GREGORIAN;
$pattern = \is_string($options['format']) ? $options['format'] : null;
if (!\in_array($dateFormat, self::$acceptedFormats, true)) {
throw new InvalidOptionsException('The "format" option must be one of the IntlDateFormatter constants (FULL, LONG, MEDIUM, SHORT) or a string representing a custom format.');
}
if ('single_text' === $options['widget']) {
if (null !== $pattern && false === strpos($pattern, 'y') && false === strpos($pattern, 'M') && false === strpos($pattern, 'd')) {
throw new InvalidOptionsException(sprintf('The "format" option should contain the letters "y", "M" or "d". Its current value is "%s".', $pattern));
}
$builder->addViewTransformer(new DateTimeToLocalizedStringTransformer(
$options['model_timezone'],
$options['view_timezone'],
$dateFormat,
$timeFormat,
$calendar,
$pattern
));
} else {
if (null !== $pattern && (false === strpos($pattern, 'y') || false === strpos($pattern, 'M') || false === strpos($pattern, 'd'))) {
throw new InvalidOptionsException(sprintf('The "format" option should contain the letters "y", "M" and "d". Its current value is "%s".', $pattern));
}
$yearOptions = $monthOptions = $dayOptions = [
'error_bubbling' => true,
'empty_data' => '',
];
// when the form is compound the entries of the array are ignored in favor of children data
// so we need to handle the cascade setting here
$emptyData = $builder->getEmptyData() ?: [];
if (isset($emptyData['year'])) {
$yearOptions['empty_data'] = $emptyData['year'];
}
if (isset($emptyData['month'])) {
$monthOptions['empty_data'] = $emptyData['month'];
}
if (isset($emptyData['day'])) {
$dayOptions['empty_data'] = $emptyData['day'];
}
if (isset($options['invalid_message'])) {
$dayOptions['invalid_message'] = $options['invalid_message'];
$monthOptions['invalid_message'] = $options['invalid_message'];
$yearOptions['invalid_message'] = $options['invalid_message'];
}
if (isset($options['invalid_message_parameters'])) {
$dayOptions['invalid_message_parameters'] = $options['invalid_message_parameters'];
$monthOptions['invalid_message_parameters'] = $options['invalid_message_parameters'];
$yearOptions['invalid_message_parameters'] = $options['invalid_message_parameters'];
}
$formatter = new \IntlDateFormatter(
\Locale::getDefault(),
$dateFormat,
$timeFormat,
// see https://bugs.php.net/bug.php?id=66323
class_exists('IntlTimeZone', false) ? \IntlTimeZone::createDefault() : null,
$calendar,
$pattern
);
// new \IntlDateFormatter may return null instead of false in case of failure, see https://bugs.php.net/bug.php?id=66323
if (!$formatter) {
throw new InvalidOptionsException(intl_get_error_message(), intl_get_error_code());
}
$formatter->setLenient(false);
if ('choice' === $options['widget']) {
// Only pass a subset of the options to children
$yearOptions['choices'] = $this->formatTimestamps($formatter, '/y+/', $this->listYears($options['years']));
$yearOptions['placeholder'] = $options['placeholder']['year'];
$yearOptions['choice_translation_domain'] = $options['choice_translation_domain']['year'];
$monthOptions['choices'] = $this->formatTimestamps($formatter, '/[M|L]+/', $this->listMonths($options['months']));
$monthOptions['placeholder'] = $options['placeholder']['month'];
$monthOptions['choice_translation_domain'] = $options['choice_translation_domain']['month'];
$dayOptions['choices'] = $this->formatTimestamps($formatter, '/d+/', $this->listDays($options['days']));
$dayOptions['placeholder'] = $options['placeholder']['day'];
$dayOptions['choice_translation_domain'] = $options['choice_translation_domain']['day'];
}
// Append generic carry-along options
foreach (['required', 'translation_domain'] as $passOpt) {
$yearOptions[$passOpt] = $monthOptions[$passOpt] = $dayOptions[$passOpt] = $options[$passOpt];
}
$builder
->add('year', self::$widgets[$options['widget']], $yearOptions)
->add('month', self::$widgets[$options['widget']], $monthOptions)
->add('day', self::$widgets[$options['widget']], $dayOptions)
->addViewTransformer(new DateTimeToArrayTransformer(
$options['model_timezone'], $options['view_timezone'], ['year', 'month', 'day']
))
->setAttribute('formatter', $formatter)
;
}
if ('datetime_immutable' === $options['input']) {
$builder->addModelTransformer(new DateTimeImmutableToDateTimeTransformer());
} elseif ('string' === $options['input']) {
$builder->addModelTransformer(new ReversedTransformer(
new DateTimeToStringTransformer($options['model_timezone'], $options['model_timezone'], $options['input_format'])
));
} elseif ('timestamp' === $options['input']) {
$builder->addModelTransformer(new ReversedTransformer(
new DateTimeToTimestampTransformer($options['model_timezone'], $options['model_timezone'])
));
} elseif ('array' === $options['input']) {
$builder->addModelTransformer(new ReversedTransformer(
new DateTimeToArrayTransformer($options['model_timezone'], $options['model_timezone'], ['year', 'month', 'day'])
));
}
} | php | public function buildForm(FormBuilderInterface $builder, array $options)
{
$dateFormat = \is_int($options['format']) ? $options['format'] : self::DEFAULT_FORMAT;
$timeFormat = \IntlDateFormatter::NONE;
$calendar = \IntlDateFormatter::GREGORIAN;
$pattern = \is_string($options['format']) ? $options['format'] : null;
if (!\in_array($dateFormat, self::$acceptedFormats, true)) {
throw new InvalidOptionsException('The "format" option must be one of the IntlDateFormatter constants (FULL, LONG, MEDIUM, SHORT) or a string representing a custom format.');
}
if ('single_text' === $options['widget']) {
if (null !== $pattern && false === strpos($pattern, 'y') && false === strpos($pattern, 'M') && false === strpos($pattern, 'd')) {
throw new InvalidOptionsException(sprintf('The "format" option should contain the letters "y", "M" or "d". Its current value is "%s".', $pattern));
}
$builder->addViewTransformer(new DateTimeToLocalizedStringTransformer(
$options['model_timezone'],
$options['view_timezone'],
$dateFormat,
$timeFormat,
$calendar,
$pattern
));
} else {
if (null !== $pattern && (false === strpos($pattern, 'y') || false === strpos($pattern, 'M') || false === strpos($pattern, 'd'))) {
throw new InvalidOptionsException(sprintf('The "format" option should contain the letters "y", "M" and "d". Its current value is "%s".', $pattern));
}
$yearOptions = $monthOptions = $dayOptions = [
'error_bubbling' => true,
'empty_data' => '',
];
// when the form is compound the entries of the array are ignored in favor of children data
// so we need to handle the cascade setting here
$emptyData = $builder->getEmptyData() ?: [];
if (isset($emptyData['year'])) {
$yearOptions['empty_data'] = $emptyData['year'];
}
if (isset($emptyData['month'])) {
$monthOptions['empty_data'] = $emptyData['month'];
}
if (isset($emptyData['day'])) {
$dayOptions['empty_data'] = $emptyData['day'];
}
if (isset($options['invalid_message'])) {
$dayOptions['invalid_message'] = $options['invalid_message'];
$monthOptions['invalid_message'] = $options['invalid_message'];
$yearOptions['invalid_message'] = $options['invalid_message'];
}
if (isset($options['invalid_message_parameters'])) {
$dayOptions['invalid_message_parameters'] = $options['invalid_message_parameters'];
$monthOptions['invalid_message_parameters'] = $options['invalid_message_parameters'];
$yearOptions['invalid_message_parameters'] = $options['invalid_message_parameters'];
}
$formatter = new \IntlDateFormatter(
\Locale::getDefault(),
$dateFormat,
$timeFormat,
// see https://bugs.php.net/bug.php?id=66323
class_exists('IntlTimeZone', false) ? \IntlTimeZone::createDefault() : null,
$calendar,
$pattern
);
// new \IntlDateFormatter may return null instead of false in case of failure, see https://bugs.php.net/bug.php?id=66323
if (!$formatter) {
throw new InvalidOptionsException(intl_get_error_message(), intl_get_error_code());
}
$formatter->setLenient(false);
if ('choice' === $options['widget']) {
// Only pass a subset of the options to children
$yearOptions['choices'] = $this->formatTimestamps($formatter, '/y+/', $this->listYears($options['years']));
$yearOptions['placeholder'] = $options['placeholder']['year'];
$yearOptions['choice_translation_domain'] = $options['choice_translation_domain']['year'];
$monthOptions['choices'] = $this->formatTimestamps($formatter, '/[M|L]+/', $this->listMonths($options['months']));
$monthOptions['placeholder'] = $options['placeholder']['month'];
$monthOptions['choice_translation_domain'] = $options['choice_translation_domain']['month'];
$dayOptions['choices'] = $this->formatTimestamps($formatter, '/d+/', $this->listDays($options['days']));
$dayOptions['placeholder'] = $options['placeholder']['day'];
$dayOptions['choice_translation_domain'] = $options['choice_translation_domain']['day'];
}
// Append generic carry-along options
foreach (['required', 'translation_domain'] as $passOpt) {
$yearOptions[$passOpt] = $monthOptions[$passOpt] = $dayOptions[$passOpt] = $options[$passOpt];
}
$builder
->add('year', self::$widgets[$options['widget']], $yearOptions)
->add('month', self::$widgets[$options['widget']], $monthOptions)
->add('day', self::$widgets[$options['widget']], $dayOptions)
->addViewTransformer(new DateTimeToArrayTransformer(
$options['model_timezone'], $options['view_timezone'], ['year', 'month', 'day']
))
->setAttribute('formatter', $formatter)
;
}
if ('datetime_immutable' === $options['input']) {
$builder->addModelTransformer(new DateTimeImmutableToDateTimeTransformer());
} elseif ('string' === $options['input']) {
$builder->addModelTransformer(new ReversedTransformer(
new DateTimeToStringTransformer($options['model_timezone'], $options['model_timezone'], $options['input_format'])
));
} elseif ('timestamp' === $options['input']) {
$builder->addModelTransformer(new ReversedTransformer(
new DateTimeToTimestampTransformer($options['model_timezone'], $options['model_timezone'])
));
} elseif ('array' === $options['input']) {
$builder->addModelTransformer(new ReversedTransformer(
new DateTimeToArrayTransformer($options['model_timezone'], $options['model_timezone'], ['year', 'month', 'day'])
));
}
} | [
"public",
"function",
"buildForm",
"(",
"FormBuilderInterface",
"$",
"builder",
",",
"array",
"$",
"options",
")",
"{",
"$",
"dateFormat",
"=",
"\\",
"is_int",
"(",
"$",
"options",
"[",
"'format'",
"]",
")",
"?",
"$",
"options",
"[",
"'format'",
"]",
":"... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Extension/Core/Type/DateType.php#L48-L168 | train | Build the form | [
30522,
2270,
3853,
3857,
14192,
1006,
2433,
8569,
23891,
6657,
3334,
12172,
1002,
12508,
1010,
9140,
1002,
7047,
1007,
1063,
1002,
3058,
14192,
4017,
1027,
1032,
2003,
1035,
20014,
1006,
1002,
7047,
1031,
1005,
4289,
1005,
1033,
1007,
1029,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
z-song/laravel-admin | src/Grid/Filter/Presenter/Text.php | Text.inputmask | public function inputmask($options = [], $icon = 'pencil') : self
{
$options = json_encode($options);
Admin::script("$('#filter-box input.{$this->filter->getId()}').inputmask($options);");
$this->icon = $icon;
return $this;
} | php | public function inputmask($options = [], $icon = 'pencil') : self
{
$options = json_encode($options);
Admin::script("$('#filter-box input.{$this->filter->getId()}').inputmask($options);");
$this->icon = $icon;
return $this;
} | [
"public",
"function",
"inputmask",
"(",
"$",
"options",
"=",
"[",
"]",
",",
"$",
"icon",
"=",
"'pencil'",
")",
":",
"self",
"{",
"$",
"options",
"=",
"json_encode",
"(",
"$",
"options",
")",
";",
"Admin",
"::",
"script",
"(",
"\"$('#filter-box input.{$th... | @param array $options
@param string $icon
@return $this | [
"@param",
"array",
"$options",
"@param",
"string",
"$icon"
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid/Filter/Presenter/Text.php#L161-L170 | train | Set input mask for the filter | [
30522,
2270,
3853,
7953,
9335,
2243,
1006,
1002,
7047,
1027,
1031,
1033,
1010,
1002,
12696,
1027,
1005,
14745,
1005,
1007,
1024,
2969,
1063,
1002,
7047,
1027,
1046,
3385,
1035,
4372,
16044,
1006,
1002,
7047,
1007,
1025,
4748,
10020,
1024,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Database/Schema/PostgresBuilder.php | PostgresBuilder.getAllViews | protected function getAllViews()
{
return $this->connection->select(
$this->grammar->compileGetAllViews($this->connection->getConfig('schema'))
);
} | php | protected function getAllViews()
{
return $this->connection->select(
$this->grammar->compileGetAllViews($this->connection->getConfig('schema'))
);
} | [
"protected",
"function",
"getAllViews",
"(",
")",
"{",
"return",
"$",
"this",
"->",
"connection",
"->",
"select",
"(",
"$",
"this",
"->",
"grammar",
"->",
"compileGetAllViews",
"(",
"$",
"this",
"->",
"connection",
"->",
"getConfig",
"(",
"'schema'",
")",
... | Get all of the view names for the database.
@return array | [
"Get",
"all",
"of",
"the",
"view",
"names",
"for",
"the",
"database",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Schema/PostgresBuilder.php#L95-L100 | train | Get all views from the database | [
30522,
5123,
3853,
2131,
8095,
8584,
2015,
1006,
1007,
1063,
2709,
1002,
2023,
1011,
1028,
4434,
1011,
1028,
7276,
1006,
1002,
2023,
1011,
1028,
8035,
1011,
1028,
4012,
22090,
18150,
8095,
8584,
2015,
1006,
1002,
2023,
1011,
1028,
4434,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Database/Query/Builder.php | Builder.whereRaw | public function whereRaw($sql, $bindings = [], $boolean = 'and')
{
$this->wheres[] = ['type' => 'raw', 'sql' => $sql, 'boolean' => $boolean];
$this->addBinding((array) $bindings, 'where');
return $this;
} | php | public function whereRaw($sql, $bindings = [], $boolean = 'and')
{
$this->wheres[] = ['type' => 'raw', 'sql' => $sql, 'boolean' => $boolean];
$this->addBinding((array) $bindings, 'where');
return $this;
} | [
"public",
"function",
"whereRaw",
"(",
"$",
"sql",
",",
"$",
"bindings",
"=",
"[",
"]",
",",
"$",
"boolean",
"=",
"'and'",
")",
"{",
"$",
"this",
"->",
"wheres",
"[",
"]",
"=",
"[",
"'type'",
"=>",
"'raw'",
",",
"'sql'",
"=>",
"$",
"sql",
",",
... | Add a raw where clause to the query.
@param string $sql
@param mixed $bindings
@param string $boolean
@return $this | [
"Add",
"a",
"raw",
"where",
"clause",
"to",
"the",
"query",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Query/Builder.php#L811-L818 | train | Add a raw where clause to the list of where clauses. | [
30522,
2270,
3853,
2073,
2527,
2860,
1006,
1002,
29296,
1010,
1002,
8031,
2015,
1027,
1031,
1033,
1010,
1002,
22017,
20898,
1027,
1005,
1998,
1005,
1007,
1063,
1002,
2023,
1011,
1028,
2073,
2015,
1031,
1033,
1027,
1031,
1005,
2828,
1005,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php | HasAttributes.getDirty | public function getDirty()
{
$dirty = [];
foreach ($this->getAttributes() as $key => $value) {
if (! $this->originalIsEquivalent($key, $value)) {
$dirty[$key] = $value;
}
}
return $dirty;
} | php | public function getDirty()
{
$dirty = [];
foreach ($this->getAttributes() as $key => $value) {
if (! $this->originalIsEquivalent($key, $value)) {
$dirty[$key] = $value;
}
}
return $dirty;
} | [
"public",
"function",
"getDirty",
"(",
")",
"{",
"$",
"dirty",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"getAttributes",
"(",
")",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"originalIsEquivalen... | Get the attributes that have been changed since last sync.
@return array | [
"Get",
"the",
"attributes",
"that",
"have",
"been",
"changed",
"since",
"last",
"sync",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php#L1122-L1133 | train | Get dirty attributes | [
30522,
2270,
3853,
2131,
4305,
5339,
2100,
1006,
1007,
1063,
1002,
6530,
1027,
1031,
1033,
1025,
18921,
6776,
1006,
1002,
2023,
1011,
1028,
2131,
19321,
3089,
8569,
4570,
1006,
1007,
2004,
1002,
3145,
1027,
1028,
1002,
3643,
1007,
1063,
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/Renderer/Proxy.php | HTML_QuickForm2_Renderer_Proxy.setOption | public function setOption($nameOrOptions, $value = null)
{
$this->_renderer->setOption($nameOrOptions, $value);
return $this;
} | php | public function setOption($nameOrOptions, $value = null)
{
$this->_renderer->setOption($nameOrOptions, $value);
return $this;
} | [
"public",
"function",
"setOption",
"(",
"$",
"nameOrOptions",
",",
"$",
"value",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"_renderer",
"->",
"setOption",
"(",
"$",
"nameOrOptions",
",",
"$",
"value",
")",
";",
"return",
"$",
"this",
";",
"}"
] | #@+
Proxies for methods defined in {@link HTML_QuickForm2_Renderer} | [
"#"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/HTML/QuickForm2/Renderer/Proxy.php#L192-L196 | train | Set option value | [
30522,
2270,
3853,
2275,
7361,
3508,
1006,
1002,
2171,
14604,
16790,
2015,
1010,
1002,
3643,
1027,
19701,
1007,
1063,
1002,
2023,
1011,
1028,
1035,
17552,
2121,
1011,
1028,
2275,
7361,
3508,
1006,
1002,
2171,
14604,
16790,
2015,
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... |
octobercms/october | modules/cms/classes/ComponentBase.php | ComponentBase.paramName | public function paramName($name, $default = null)
{
if (($extName = $this->propertyName($name)) && substr($extName, 0, 1) == ':') {
return substr($extName, 1);
}
return $default;
} | php | public function paramName($name, $default = null)
{
if (($extName = $this->propertyName($name)) && substr($extName, 0, 1) == ':') {
return substr($extName, 1);
}
return $default;
} | [
"public",
"function",
"paramName",
"(",
"$",
"name",
",",
"$",
"default",
"=",
"null",
")",
"{",
"if",
"(",
"(",
"$",
"extName",
"=",
"$",
"this",
"->",
"propertyName",
"(",
"$",
"name",
")",
")",
"&&",
"substr",
"(",
"$",
"extName",
",",
"0",
",... | Returns the external property name when the property value is a routing parameter reference.
Otherwise the default value specified is returned.
@param string $name The property name
@param mixed $default
@return string | [
"Returns",
"the",
"external",
"property",
"name",
"when",
"the",
"property",
"value",
"is",
"a",
"routing",
"parameter",
"reference",
".",
"Otherwise",
"the",
"default",
"value",
"specified",
"is",
"returned",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/ComponentBase.php#L285-L292 | train | Get the name of the parameter | [
30522,
2270,
3853,
11498,
2213,
18442,
1006,
1002,
2171,
1010,
1002,
12398,
1027,
19701,
1007,
1063,
2065,
1006,
1006,
1002,
4654,
2102,
18442,
1027,
1002,
2023,
1011,
1028,
3200,
18442,
1006,
1002,
2171,
1007,
1007,
1004,
1004,
4942,
3367,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/ContainerConstraintValidatorFactory.php | ContainerConstraintValidatorFactory.getInstance | public function getInstance(Constraint $constraint)
{
$name = $constraint->validatedBy();
if (!isset($this->validators[$name])) {
if ($this->container->has($name)) {
$this->validators[$name] = $this->container->get($name);
} else {
if (!class_exists($name)) {
throw new ValidatorException(sprintf('Constraint validator "%s" does not exist or is not enabled. Check the "validatedBy" method in your constraint class "%s".', $name, \get_class($constraint)));
}
$this->validators[$name] = new $name();
}
}
if (!$this->validators[$name] instanceof ConstraintValidatorInterface) {
throw new UnexpectedTypeException($this->validators[$name], ConstraintValidatorInterface::class);
}
return $this->validators[$name];
} | php | public function getInstance(Constraint $constraint)
{
$name = $constraint->validatedBy();
if (!isset($this->validators[$name])) {
if ($this->container->has($name)) {
$this->validators[$name] = $this->container->get($name);
} else {
if (!class_exists($name)) {
throw new ValidatorException(sprintf('Constraint validator "%s" does not exist or is not enabled. Check the "validatedBy" method in your constraint class "%s".', $name, \get_class($constraint)));
}
$this->validators[$name] = new $name();
}
}
if (!$this->validators[$name] instanceof ConstraintValidatorInterface) {
throw new UnexpectedTypeException($this->validators[$name], ConstraintValidatorInterface::class);
}
return $this->validators[$name];
} | [
"public",
"function",
"getInstance",
"(",
"Constraint",
"$",
"constraint",
")",
"{",
"$",
"name",
"=",
"$",
"constraint",
"->",
"validatedBy",
"(",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"validators",
"[",
"$",
"name",
"]",
")",
"... | {@inheritdoc}
@throws ValidatorException When the validator class does not exist
@throws UnexpectedTypeException When the validator is not an instance of ConstraintValidatorInterface | [
"{",
"@inheritdoc",
"}"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Validator/ContainerConstraintValidatorFactory.php#L40-L61 | train | Returns the instance of the validator | [
30522,
2270,
3853,
2131,
7076,
26897,
1006,
27142,
1002,
27142,
1007,
1063,
1002,
2171,
1027,
1002,
27142,
1011,
1028,
9398,
4383,
3762,
1006,
1007,
1025,
2065,
1006,
999,
26354,
3388,
1006,
1002,
2023,
1011,
1028,
30524,
1033,
1007,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getgrav/grav | system/src/Grav/Common/Utils.php | Utils.startsWith | public static function startsWith($haystack, $needle, $case_sensitive = true)
{
$status = false;
$compare_func = $case_sensitive ? 'mb_strpos' : 'mb_stripos';
foreach ((array)$needle as $each_needle) {
$status = $each_needle === '' || $compare_func($haystack, $each_needle) === 0;
if ($status) {
break;
}
}
return $status;
} | php | public static function startsWith($haystack, $needle, $case_sensitive = true)
{
$status = false;
$compare_func = $case_sensitive ? 'mb_strpos' : 'mb_stripos';
foreach ((array)$needle as $each_needle) {
$status = $each_needle === '' || $compare_func($haystack, $each_needle) === 0;
if ($status) {
break;
}
}
return $status;
} | [
"public",
"static",
"function",
"startsWith",
"(",
"$",
"haystack",
",",
"$",
"needle",
",",
"$",
"case_sensitive",
"=",
"true",
")",
"{",
"$",
"status",
"=",
"false",
";",
"$",
"compare_func",
"=",
"$",
"case_sensitive",
"?",
"'mb_strpos'",
":",
"'mb_stri... | Check if the $haystack string starts with the substring $needle
@param string $haystack
@param string|string[] $needle
@param bool $case_sensitive
@return bool | [
"Check",
"if",
"the",
"$haystack",
"string",
"starts",
"with",
"the",
"substring",
"$needle"
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Utils.php#L92-L106 | train | Check if string starts with a substring | [
30522,
2270,
10763,
3853,
4627,
24415,
1006,
1002,
29051,
2696,
3600,
1010,
1002,
12201,
1010,
1002,
2553,
1035,
7591,
1027,
2995,
1007,
1063,
1002,
3570,
1027,
6270,
1025,
1002,
12826,
1035,
4569,
2278,
1027,
1002,
2553,
1035,
7591,
1029,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Updater/Migration/Db/Factory.php | Factory.dropIndex | public function dropIndex($table, $indexName)
{
$table = $this->prefixTable($table);
return $this->container->make('Piwik\Updater\Migration\Db\DropIndex', array(
'table' => $table, 'indexName' => $indexName
));
} | php | public function dropIndex($table, $indexName)
{
$table = $this->prefixTable($table);
return $this->container->make('Piwik\Updater\Migration\Db\DropIndex', array(
'table' => $table, 'indexName' => $indexName
));
} | [
"public",
"function",
"dropIndex",
"(",
"$",
"table",
",",
"$",
"indexName",
")",
"{",
"$",
"table",
"=",
"$",
"this",
"->",
"prefixTable",
"(",
"$",
"table",
")",
";",
"return",
"$",
"this",
"->",
"container",
"->",
"make",
"(",
"'Piwik\\Updater\\Migrat... | Drops an existing index from a database table.
@param string $table Unprefixed database table name, eg 'log_visit'.
@param string $indexName The name of the index that shall be dropped.
@return DropIndex | [
"Drops",
"an",
"existing",
"index",
"from",
"a",
"database",
"table",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Updater/Migration/Db/Factory.php#L304-L311 | train | Drop an index from a table | [
30522,
2270,
3853,
4530,
22254,
10288,
1006,
1002,
2795,
1010,
1002,
5950,
18442,
1007,
1063,
1002,
2795,
1027,
1002,
2023,
1011,
1028,
17576,
10880,
1006,
1002,
2795,
1007,
1025,
2709,
1002,
2023,
1011,
1028,
11661,
1011,
1028,
2191,
1006,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Console/Helper/TableStyle.php | TableStyle.setCrossingChars | public function setCrossingChars(string $cross, string $topLeft, string $topMid, string $topRight, string $midRight, string $bottomRight, string $bottomMid, string $bottomLeft, string $midLeft, string $topLeftBottom = null, string $topMidBottom = null, string $topRightBottom = null): self
{
$this->crossingChar = $cross;
$this->crossingTopLeftChar = $topLeft;
$this->crossingTopMidChar = $topMid;
$this->crossingTopRightChar = $topRight;
$this->crossingMidRightChar = $midRight;
$this->crossingBottomRightChar = $bottomRight;
$this->crossingBottomMidChar = $bottomMid;
$this->crossingBottomLeftChar = $bottomLeft;
$this->crossingMidLeftChar = $midLeft;
$this->crossingTopLeftBottomChar = $topLeftBottom ?? $midLeft;
$this->crossingTopMidBottomChar = $topMidBottom ?? $cross;
$this->crossingTopRightBottomChar = $topRightBottom ?? $midRight;
return $this;
} | php | public function setCrossingChars(string $cross, string $topLeft, string $topMid, string $topRight, string $midRight, string $bottomRight, string $bottomMid, string $bottomLeft, string $midLeft, string $topLeftBottom = null, string $topMidBottom = null, string $topRightBottom = null): self
{
$this->crossingChar = $cross;
$this->crossingTopLeftChar = $topLeft;
$this->crossingTopMidChar = $topMid;
$this->crossingTopRightChar = $topRight;
$this->crossingMidRightChar = $midRight;
$this->crossingBottomRightChar = $bottomRight;
$this->crossingBottomMidChar = $bottomMid;
$this->crossingBottomLeftChar = $bottomLeft;
$this->crossingMidLeftChar = $midLeft;
$this->crossingTopLeftBottomChar = $topLeftBottom ?? $midLeft;
$this->crossingTopMidBottomChar = $topMidBottom ?? $cross;
$this->crossingTopRightBottomChar = $topRightBottom ?? $midRight;
return $this;
} | [
"public",
"function",
"setCrossingChars",
"(",
"string",
"$",
"cross",
",",
"string",
"$",
"topLeft",
",",
"string",
"$",
"topMid",
",",
"string",
"$",
"topRight",
",",
"string",
"$",
"midRight",
",",
"string",
"$",
"bottomRight",
",",
"string",
"$",
"bott... | Sets crossing characters.
Example:
<code>
1═══════════════2══════════════════════════2══════════════════3
║ ISBN │ Title │ Author ║
8'══════════════0'═════════════════════════0'═════════════════4'
║ 99921-58-10-7 │ Divine Comedy │ Dante Alighieri ║
║ 9971-5-0210-0 │ A Tale of Two Cities │ Charles Dickens ║
8───────────────0──────────────────────────0──────────────────4
║ 960-425-059-0 │ The Lord of the Rings │ J. R. R. Tolkien ║
║ 80-902734-1-6 │ And Then There Were None │ Agatha Christie ║
7═══════════════6══════════════════════════6══════════════════5
</code>
@param string $cross Crossing char (see #0 of example)
@param string $topLeft Top left char (see #1 of example)
@param string $topMid Top mid char (see #2 of example)
@param string $topRight Top right char (see #3 of example)
@param string $midRight Mid right char (see #4 of example)
@param string $bottomRight Bottom right char (see #5 of example)
@param string $bottomMid Bottom mid char (see #6 of example)
@param string $bottomLeft Bottom left char (see #7 of example)
@param string $midLeft Mid left char (see #8 of example)
@param string|null $topLeftBottom Top left bottom char (see #8' of example), equals to $midLeft if null
@param string|null $topMidBottom Top mid bottom char (see #0' of example), equals to $cross if null
@param string|null $topRightBottom Top right bottom char (see #4' of example), equals to $midRight if null | [
"Sets",
"crossing",
"characters",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Console/Helper/TableStyle.php#L234-L250 | train | set crossing chars | [
30522,
2270,
3853,
2275,
16458,
2075,
7507,
2869,
1006,
5164,
1002,
2892,
1010,
5164,
1002,
2327,
2571,
6199,
1010,
5164,
1002,
2327,
4328,
2094,
1010,
5164,
1002,
2327,
15950,
1010,
5164,
1002,
3054,
15950,
1010,
5164,
1002,
3953,
15950,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Helper/Optimizer/ConjugateGradient.php | MP.mul | public static function mul(array $m1, array $m2): array
{
$res = [];
foreach ($m1 as $i => $val) {
$res[] = $val * $m2[$i];
}
return $res;
} | php | public static function mul(array $m1, array $m2): array
{
$res = [];
foreach ($m1 as $i => $val) {
$res[] = $val * $m2[$i];
}
return $res;
} | [
"public",
"static",
"function",
"mul",
"(",
"array",
"$",
"m1",
",",
"array",
"$",
"m2",
")",
":",
"array",
"{",
"$",
"res",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"m1",
"as",
"$",
"i",
"=>",
"$",
"val",
")",
"{",
"$",
"res",
"[",
"]",
"=... | Element-wise <b>multiplication</b> of two vectors of the same size | [
"Element",
"-",
"wise",
"<b",
">",
"multiplication<",
"/",
"b",
">",
"of",
"two",
"vectors",
"of",
"the",
"same",
"size"
] | f6aa1a59b0525b8fca3d2786d661ab3e70904016 | https://github.com/php-ai/php-ml/blob/f6aa1a59b0525b8fca3d2786d661ab3e70904016/src/Helper/Optimizer/ConjugateGradient.php#L214-L222 | train | Multiply two array of values | [
30522,
2270,
10763,
3853,
14163,
2140,
1006,
9140,
1002,
23290,
1010,
9140,
1002,
25525,
1007,
1024,
9140,
1063,
1002,
24501,
1027,
1031,
1033,
1025,
18921,
6776,
1006,
1002,
23290,
2004,
1002,
1045,
1027,
1028,
1002,
11748,
1007,
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... |
symfony/symfony | src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToRfc3339Transformer.php | DateTimeToRfc3339Transformer.transform | public function transform($dateTime)
{
if (null === $dateTime) {
return '';
}
if (!$dateTime instanceof \DateTimeInterface) {
throw new TransformationFailedException('Expected a \DateTimeInterface.');
}
if ($this->inputTimezone !== $this->outputTimezone) {
if (!$dateTime instanceof \DateTimeImmutable) {
$dateTime = clone $dateTime;
}
$dateTime = $dateTime->setTimezone(new \DateTimeZone($this->outputTimezone));
}
return preg_replace('/\+00:00$/', 'Z', $dateTime->format('c'));
} | php | public function transform($dateTime)
{
if (null === $dateTime) {
return '';
}
if (!$dateTime instanceof \DateTimeInterface) {
throw new TransformationFailedException('Expected a \DateTimeInterface.');
}
if ($this->inputTimezone !== $this->outputTimezone) {
if (!$dateTime instanceof \DateTimeImmutable) {
$dateTime = clone $dateTime;
}
$dateTime = $dateTime->setTimezone(new \DateTimeZone($this->outputTimezone));
}
return preg_replace('/\+00:00$/', 'Z', $dateTime->format('c'));
} | [
"public",
"function",
"transform",
"(",
"$",
"dateTime",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"dateTime",
")",
"{",
"return",
"''",
";",
"}",
"if",
"(",
"!",
"$",
"dateTime",
"instanceof",
"\\",
"DateTimeInterface",
")",
"{",
"throw",
"new",
"Trans... | Transforms a normalized date into a localized date.
@param \DateTimeInterface $dateTime A DateTimeInterface object
@return string The formatted date
@throws TransformationFailedException If the given value is not a \DateTimeInterface | [
"Transforms",
"a",
"normalized",
"date",
"into",
"a",
"localized",
"date",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToRfc3339Transformer.php#L30-L49 | train | Transform a \ DateTimeImmutable object into a string | [
30522,
2270,
3853,
10938,
1006,
1002,
3058,
7292,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
1027,
1002,
3058,
7292,
1007,
1063,
2709,
1005,
1005,
1025,
1065,
2065,
1006,
999,
1002,
3058,
7292,
6013,
11253,
1032,
3058,
7292,
18447,
2121,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/backend/behaviors/RelationController.php | RelationController.relationGetSessionKey | public function relationGetSessionKey($force = false)
{
if ($this->sessionKey && !$force) {
return $this->sessionKey;
}
if (post('_relation_session_key')) {
return $this->sessionKey = post('_relation_session_key');
}
if (post('_session_key')) {
return $this->sessionKey = post('_session_key');
}
return $this->sessionKey = FormHelper::getSessionKey();
} | php | public function relationGetSessionKey($force = false)
{
if ($this->sessionKey && !$force) {
return $this->sessionKey;
}
if (post('_relation_session_key')) {
return $this->sessionKey = post('_relation_session_key');
}
if (post('_session_key')) {
return $this->sessionKey = post('_session_key');
}
return $this->sessionKey = FormHelper::getSessionKey();
} | [
"public",
"function",
"relationGetSessionKey",
"(",
"$",
"force",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"sessionKey",
"&&",
"!",
"$",
"force",
")",
"{",
"return",
"$",
"this",
"->",
"sessionKey",
";",
"}",
"if",
"(",
"post",
"(",
"'_r... | Returns the active session key. | [
"Returns",
"the",
"active",
"session",
"key",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/behaviors/RelationController.php#L515-L530 | train | Get the session key of the relation | [
30522,
2270,
3853,
7189,
18150,
8583,
10992,
14839,
1006,
1002,
2486,
1027,
6270,
1007,
1063,
2065,
1006,
1002,
2023,
1011,
1028,
5219,
14839,
1004,
1004,
999,
1002,
2486,
1007,
1063,
2709,
1002,
2023,
1011,
1028,
5219,
14839,
1025,
1065,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Database/Query/Grammars/Grammar.php | Grammar.whereRowValues | protected function whereRowValues(Builder $query, $where)
{
$columns = $this->columnize($where['columns']);
$values = $this->parameterize($where['values']);
return '('.$columns.') '.$where['operator'].' ('.$values.')';
} | php | protected function whereRowValues(Builder $query, $where)
{
$columns = $this->columnize($where['columns']);
$values = $this->parameterize($where['values']);
return '('.$columns.') '.$where['operator'].' ('.$values.')';
} | [
"protected",
"function",
"whereRowValues",
"(",
"Builder",
"$",
"query",
",",
"$",
"where",
")",
"{",
"$",
"columns",
"=",
"$",
"this",
"->",
"columnize",
"(",
"$",
"where",
"[",
"'columns'",
"]",
")",
";",
"$",
"values",
"=",
"$",
"this",
"->",
"par... | Compile a where row values condition.
@param \Illuminate\Database\Query\Builder $query
@param array $where
@return string | [
"Compile",
"a",
"where",
"row",
"values",
"condition",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Query/Grammars/Grammar.php#L533-L540 | train | Converts where row values into a string | [
30522,
5123,
3853,
2073,
10524,
10175,
15808,
1006,
12508,
1002,
23032,
1010,
1002,
2073,
1007,
1063,
1002,
7753,
1027,
1002,
2023,
1011,
1028,
5930,
4697,
1006,
1002,
2073,
1031,
1005,
7753,
1005,
1033,
1007,
1025,
1002,
5300,
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... |
matomo-org/matomo | libs/Zend/Config/Writer/Xml.php | Zend_Config_Writer_Xml.render | public function render()
{
$xml = new SimpleXMLElement('<zend-config xmlns:zf="' . Zend_Config_Xml::XML_NAMESPACE . '"/>');
$extends = $this->_config->getExtends();
$sectionName = $this->_config->getSectionName();
if (is_string($sectionName)) {
$child = $xml->addChild($sectionName);
$this->_addBranch($this->_config, $child, $xml);
} else {
foreach ($this->_config as $sectionName => $data) {
if (!($data instanceof Zend_Config)) {
$xml->addChild($sectionName, (string) $data);
} else {
$child = $xml->addChild($sectionName);
if (isset($extends[$sectionName])) {
$child->addAttribute('zf:extends', $extends[$sectionName], Zend_Config_Xml::XML_NAMESPACE);
}
$this->_addBranch($data, $child, $xml);
}
}
}
$dom = dom_import_simplexml($xml)->ownerDocument;
$dom->formatOutput = true;
$xmlString = $dom->saveXML();
return $xmlString;
} | php | public function render()
{
$xml = new SimpleXMLElement('<zend-config xmlns:zf="' . Zend_Config_Xml::XML_NAMESPACE . '"/>');
$extends = $this->_config->getExtends();
$sectionName = $this->_config->getSectionName();
if (is_string($sectionName)) {
$child = $xml->addChild($sectionName);
$this->_addBranch($this->_config, $child, $xml);
} else {
foreach ($this->_config as $sectionName => $data) {
if (!($data instanceof Zend_Config)) {
$xml->addChild($sectionName, (string) $data);
} else {
$child = $xml->addChild($sectionName);
if (isset($extends[$sectionName])) {
$child->addAttribute('zf:extends', $extends[$sectionName], Zend_Config_Xml::XML_NAMESPACE);
}
$this->_addBranch($data, $child, $xml);
}
}
}
$dom = dom_import_simplexml($xml)->ownerDocument;
$dom->formatOutput = true;
$xmlString = $dom->saveXML();
return $xmlString;
} | [
"public",
"function",
"render",
"(",
")",
"{",
"$",
"xml",
"=",
"new",
"SimpleXMLElement",
"(",
"'<zend-config xmlns:zf=\"'",
".",
"Zend_Config_Xml",
"::",
"XML_NAMESPACE",
".",
"'\"/>'",
")",
";",
"$",
"extends",
"=",
"$",
"this",
"->",
"_config",
"->",
"ge... | Render a Zend_Config into a XML config string.
@since 1.10
@return string | [
"Render",
"a",
"Zend_Config",
"into",
"a",
"XML",
"config",
"string",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Config/Writer/Xml.php#L46-L78 | train | Render the Zend_Config into a Zend_Config_Xml object | [
30522,
2270,
3853,
17552,
1006,
1007,
1063,
1002,
20950,
1027,
2047,
3722,
2595,
19968,
12260,
3672,
1006,
1005,
1026,
16729,
2094,
1011,
9530,
8873,
2290,
20950,
3619,
1024,
1062,
2546,
1027,
1000,
1005,
1012,
16729,
2094,
1035,
9530,
8873... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Mime/Header/Headers.php | Headers.addPathHeader | public function addPathHeader(string $name, $path)
{
return $this->add(new PathHeader($name, $path instanceof Address ? $path : new Address($path)));
} | php | public function addPathHeader(string $name, $path)
{
return $this->add(new PathHeader($name, $path instanceof Address ? $path : new Address($path)));
} | [
"public",
"function",
"addPathHeader",
"(",
"string",
"$",
"name",
",",
"$",
"path",
")",
"{",
"return",
"$",
"this",
"->",
"add",
"(",
"new",
"PathHeader",
"(",
"$",
"name",
",",
"$",
"path",
"instanceof",
"Address",
"?",
"$",
"path",
":",
"new",
"A... | @param Address|string $path
@return $this | [
"@param",
"Address|string",
"$path"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Mime/Header/Headers.php#L99-L102 | train | Add a path header to the list of pathheaders | [
30522,
2270,
3853,
5587,
15069,
4974,
2121,
1006,
5164,
1002,
2171,
1010,
1002,
4130,
1007,
1063,
2709,
1002,
2023,
1011,
1028,
5587,
1006,
2047,
4130,
4974,
2121,
1006,
1002,
2171,
1010,
1002,
4130,
6013,
11253,
4769,
1029,
1002,
4130,
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/Support/Str.php | Str.pluralStudly | public static function pluralStudly($value, $count = 2)
{
$parts = preg_split('/(.)(?=[A-Z])/u', $value, -1, PREG_SPLIT_DELIM_CAPTURE);
$lastWord = array_pop($parts);
return implode('', $parts).self::plural($lastWord, $count);
} | php | public static function pluralStudly($value, $count = 2)
{
$parts = preg_split('/(.)(?=[A-Z])/u', $value, -1, PREG_SPLIT_DELIM_CAPTURE);
$lastWord = array_pop($parts);
return implode('', $parts).self::plural($lastWord, $count);
} | [
"public",
"static",
"function",
"pluralStudly",
"(",
"$",
"value",
",",
"$",
"count",
"=",
"2",
")",
"{",
"$",
"parts",
"=",
"preg_split",
"(",
"'/(.)(?=[A-Z])/u'",
",",
"$",
"value",
",",
"-",
"1",
",",
"PREG_SPLIT_DELIM_CAPTURE",
")",
";",
"$",
"lastWo... | Pluralize the last word of an English, studly caps case string.
@param string $value
@param int $count
@return string | [
"Pluralize",
"the",
"last",
"word",
"of",
"an",
"English",
"studly",
"caps",
"case",
"string",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Support/Str.php#L290-L297 | train | Pluralizes the last word of a string | [
30522,
2270,
10763,
3853,
30524,
1031,
1037,
1011,
1062,
1033,
1007,
1013,
1057,
1005,
1010,
1002,
3643,
1010,
1011,
1015,
1010,
3653,
2290,
1035,
3975,
1035,
3972,
5714,
1035,
5425,
1007,
1025,
1002,
2197,
18351,
1027,
9140,
1035,
3769,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Form.php | Form.remove | public function remove($name)
{
if ($this->submitted) {
throw new AlreadySubmittedException('You cannot remove children from a submitted form');
}
if (isset($this->children[$name])) {
if (!$this->children[$name]->isSubmitted()) {
$this->children[$name]->setParent(null);
}
unset($this->children[$name]);
}
return $this;
} | php | public function remove($name)
{
if ($this->submitted) {
throw new AlreadySubmittedException('You cannot remove children from a submitted form');
}
if (isset($this->children[$name])) {
if (!$this->children[$name]->isSubmitted()) {
$this->children[$name]->setParent(null);
}
unset($this->children[$name]);
}
return $this;
} | [
"public",
"function",
"remove",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"submitted",
")",
"{",
"throw",
"new",
"AlreadySubmittedException",
"(",
"'You cannot remove children from a submitted form'",
")",
";",
"}",
"if",
"(",
"isset",
"(",
"$"... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Form.php#L904-L919 | train | Remove a form element s children | [
30522,
2270,
3853,
6366,
1006,
1002,
2171,
1007,
1063,
2065,
1006,
1002,
2023,
1011,
1028,
7864,
1007,
1063,
5466,
2047,
2525,
6342,
25526,
27100,
3207,
2595,
24422,
1006,
1005,
2017,
3685,
6366,
2336,
2013,
1037,
7864,
2433,
1005,
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 | libs/HTML/QuickForm2/Controller/Action/Jump.php | HTML_QuickForm2_Controller_Action_Jump.normalizePath | protected static function normalizePath($path)
{
$pathAry = explode('/', $path);
$i = 1;
do {
if ('.' == $pathAry[$i]) {
if ($i < count($pathAry) - 1) {
array_splice($pathAry, $i, 1);
} else {
$pathAry[$i] = '';
$i++;
}
} elseif ('..' == $pathAry[$i]) {
if (1 == $i) {
array_splice($pathAry, 1, 1);
} elseif ('..' != $pathAry[$i - 1]) {
if ($i < count($pathAry) - 1) {
array_splice($pathAry, $i - 1, 2);
$i--;
} else {
array_splice($pathAry, $i - 1, 2, '');
}
}
} else {
$i++;
}
} while ($i < count($pathAry));
return implode('/', $pathAry);
} | php | protected static function normalizePath($path)
{
$pathAry = explode('/', $path);
$i = 1;
do {
if ('.' == $pathAry[$i]) {
if ($i < count($pathAry) - 1) {
array_splice($pathAry, $i, 1);
} else {
$pathAry[$i] = '';
$i++;
}
} elseif ('..' == $pathAry[$i]) {
if (1 == $i) {
array_splice($pathAry, 1, 1);
} elseif ('..' != $pathAry[$i - 1]) {
if ($i < count($pathAry) - 1) {
array_splice($pathAry, $i - 1, 2);
$i--;
} else {
array_splice($pathAry, $i - 1, 2, '');
}
}
} else {
$i++;
}
} while ($i < count($pathAry));
return implode('/', $pathAry);
} | [
"protected",
"static",
"function",
"normalizePath",
"(",
"$",
"path",
")",
"{",
"$",
"pathAry",
"=",
"explode",
"(",
"'/'",
",",
"$",
"path",
")",
";",
"$",
"i",
"=",
"1",
";",
"do",
"{",
"if",
"(",
"'.'",
"==",
"$",
"pathAry",
"[",
"$",
"i",
"... | Removes the '..' and '.' segments from the path component
@param string Path component of the URL, possibly with '.' and '..' segments
@return string Path component of the URL with '.' and '..' segments removed | [
"Removes",
"the",
"..",
"and",
".",
"segments",
"from",
"the",
"path",
"component"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/HTML/QuickForm2/Controller/Action/Jump.php#L82-L115 | train | Normalize the path | [
30522,
5123,
10763,
3853,
3671,
4697,
15069,
1006,
1002,
4130,
1007,
1063,
1002,
4130,
5649,
1027,
15044,
1006,
1005,
1013,
1005,
1010,
1002,
4130,
1007,
1025,
1002,
1045,
1027,
1015,
1025,
2079,
1063,
2065,
1006,
1005,
1012,
1005,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/View/Concerns/ManagesStacks.php | ManagesStacks.startPush | public function startPush($section, $content = '')
{
if ($content === '') {
if (ob_start()) {
$this->pushStack[] = $section;
}
} else {
$this->extendPush($section, $content);
}
} | php | public function startPush($section, $content = '')
{
if ($content === '') {
if (ob_start()) {
$this->pushStack[] = $section;
}
} else {
$this->extendPush($section, $content);
}
} | [
"public",
"function",
"startPush",
"(",
"$",
"section",
",",
"$",
"content",
"=",
"''",
")",
"{",
"if",
"(",
"$",
"content",
"===",
"''",
")",
"{",
"if",
"(",
"ob_start",
"(",
")",
")",
"{",
"$",
"this",
"->",
"pushStack",
"[",
"]",
"=",
"$",
"... | Start injecting content into a push section.
@param string $section
@param string $content
@return void | [
"Start",
"injecting",
"content",
"into",
"a",
"push",
"section",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/View/Concerns/ManagesStacks.php#L37-L46 | train | Start pushing content to the stack | [
30522,
2270,
3853,
2707,
12207,
2232,
1006,
1002,
2930,
1010,
1002,
4180,
1027,
1005,
1005,
1007,
1063,
2065,
1006,
1002,
4180,
1027,
1027,
1027,
1005,
1005,
1007,
1063,
2065,
1006,
27885,
1035,
2707,
1006,
1007,
1007,
1063,
1002,
2023,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getgrav/grav | system/src/Grav/Common/Grav.php | Grav.redirectLangSafe | public function redirectLangSafe($route, $code = null)
{
if (!$this['uri']->isExternal($route)) {
$this->redirect($this['pages']->route($route), $code);
} else {
$this->redirect($route, $code);
}
} | php | public function redirectLangSafe($route, $code = null)
{
if (!$this['uri']->isExternal($route)) {
$this->redirect($this['pages']->route($route), $code);
} else {
$this->redirect($route, $code);
}
} | [
"public",
"function",
"redirectLangSafe",
"(",
"$",
"route",
",",
"$",
"code",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"[",
"'uri'",
"]",
"->",
"isExternal",
"(",
"$",
"route",
")",
")",
"{",
"$",
"this",
"->",
"redirect",
"(",
"$",
"... | Redirect browser to another location taking language into account (preferred)
@param string $route Internal route.
@param int $code Redirection code (30x) | [
"Redirect",
"browser",
"to",
"another",
"location",
"taking",
"language",
"into",
"account",
"(",
"preferred",
")"
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Grav.php#L322-L329 | train | Redirect lang safe | [
30522,
2270,
3853,
2417,
7442,
6593,
25023,
3736,
7959,
1006,
1002,
2799,
1010,
1002,
3642,
1027,
19701,
1007,
1063,
2065,
1006,
999,
1002,
2023,
1031,
1005,
24471,
2072,
1005,
1033,
1011,
1028,
2003,
10288,
16451,
2389,
1006,
1002,
2799,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.