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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
getgrav/grav | system/src/Grav/Common/Uri.php | Uri.setUriProperties | public function setUriProperties($data)
{
foreach (get_object_vars($this) as $property => $default) {
if (!array_key_exists($property, $data)) continue;
$this->{$property} = $data[$property]; // assign value to object
}
return $this;
} | php | public function setUriProperties($data)
{
foreach (get_object_vars($this) as $property => $default) {
if (!array_key_exists($property, $data)) continue;
$this->{$property} = $data[$property]; // assign value to object
}
return $this;
} | [
"public",
"function",
"setUriProperties",
"(",
"$",
"data",
")",
"{",
"foreach",
"(",
"get_object_vars",
"(",
"$",
"this",
")",
"as",
"$",
"property",
"=>",
"$",
"default",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"property",
",",
"$",
"... | Allow overriding of any element (be careful!)
@param $data
@return Uri | [
"Allow",
"overriding",
"of",
"any",
"element",
"(",
"be",
"careful!",
")"
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Uri.php#L1363-L1370 | train | Set the properties of the object | [
30522,
2270,
3853,
2275,
9496,
21572,
4842,
7368,
1006,
1002,
2951,
1007,
1063,
18921,
6776,
1006,
2131,
1035,
4874,
1035,
13075,
2015,
1006,
1002,
2023,
1007,
2004,
1002,
3200,
1027,
1028,
1002,
12398,
1007,
1063,
2065,
1006,
999,
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... |
laravel/framework | src/Illuminate/Filesystem/Cache.php | Cache.load | public function load()
{
$contents = $this->repository->get($this->key);
if (! is_null($contents)) {
$this->setFromStorage($contents);
}
} | php | public function load()
{
$contents = $this->repository->get($this->key);
if (! is_null($contents)) {
$this->setFromStorage($contents);
}
} | [
"public",
"function",
"load",
"(",
")",
"{",
"$",
"contents",
"=",
"$",
"this",
"->",
"repository",
"->",
"get",
"(",
"$",
"this",
"->",
"key",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"contents",
")",
")",
"{",
"$",
"this",
"->",
"setFromS... | Load the cache.
@return void | [
"Load",
"the",
"cache",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Filesystem/Cache.php#L50-L57 | train | Load the current language from the repository | [
30522,
2270,
3853,
7170,
1006,
1007,
1063,
1002,
8417,
1027,
1002,
2023,
1011,
1028,
22409,
1011,
1028,
2131,
1006,
1002,
2023,
1011,
1028,
3145,
1007,
1025,
2065,
1006,
999,
2003,
1035,
19701,
1006,
1002,
8417,
1007,
1007,
1063,
1002,
20... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/backend/helpers/Backend.php | Backend.dateTime | public function dateTime($dateTime, $options = [])
{
extract(array_merge([
'defaultValue' => '',
'format' => null,
'formatAlias' => null,
'jsFormat' => null,
'timeTense' => false,
'timeSince' => false,
'ignoreTimezone' => false,
], $options));
if(!$dateTime) {
return '';
}
$carbon = DateTimeHelper::makeCarbon($dateTime);
if ($jsFormat !== null) {
$format = $jsFormat;
}
else {
$format = DateTimeHelper::momentFormat($format);
}
$attributes = [
'datetime' => $carbon,
'data-datetime-control' => 1,
];
if ($ignoreTimezone) {
$attributes['data-ignore-timezone'] = true;
}
if ($timeTense) {
$attributes['data-time-tense'] = 1;
}
elseif ($timeSince) {
$attributes['data-time-since'] = 1;
}
elseif ($format) {
$attributes['data-format'] = $format;
}
elseif ($formatAlias) {
$attributes['data-format-alias'] = $formatAlias;
}
return '<time'.Html::attributes($attributes).'>'.e($defaultValue).'</time>'.PHP_EOL;
} | php | public function dateTime($dateTime, $options = [])
{
extract(array_merge([
'defaultValue' => '',
'format' => null,
'formatAlias' => null,
'jsFormat' => null,
'timeTense' => false,
'timeSince' => false,
'ignoreTimezone' => false,
], $options));
if(!$dateTime) {
return '';
}
$carbon = DateTimeHelper::makeCarbon($dateTime);
if ($jsFormat !== null) {
$format = $jsFormat;
}
else {
$format = DateTimeHelper::momentFormat($format);
}
$attributes = [
'datetime' => $carbon,
'data-datetime-control' => 1,
];
if ($ignoreTimezone) {
$attributes['data-ignore-timezone'] = true;
}
if ($timeTense) {
$attributes['data-time-tense'] = 1;
}
elseif ($timeSince) {
$attributes['data-time-since'] = 1;
}
elseif ($format) {
$attributes['data-format'] = $format;
}
elseif ($formatAlias) {
$attributes['data-format-alias'] = $formatAlias;
}
return '<time'.Html::attributes($attributes).'>'.e($defaultValue).'</time>'.PHP_EOL;
} | [
"public",
"function",
"dateTime",
"(",
"$",
"dateTime",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"extract",
"(",
"array_merge",
"(",
"[",
"'defaultValue'",
"=>",
"''",
",",
"'format'",
"=>",
"null",
",",
"'formatAlias'",
"=>",
"null",
",",
"'jsForma... | Returns the HTML for a date formatted in the backend.
Supported for formatAlias:
time -> 6:28 AM
timeLong -> 6:28:01 AM
date -> 04/23/2016
dateMin -> 4/23/2016
dateLong -> April 23, 2016
dateLongMin -> Apr 23, 2016
dateTime -> April 23, 2016 6:28 AM
dateTimeMin -> Apr 23, 2016 6:28 AM
dateTimeLong -> Saturday, April 23, 2016 6:28 AM
dateTimeLongMin -> Sat, Apr 23, 2016 6:29 AM
@return string | [
"Returns",
"the",
"HTML",
"for",
"a",
"date",
"formatted",
"in",
"the",
"backend",
".",
"Supported",
"for",
"formatAlias",
":",
"time",
"-",
">",
"6",
":",
"28",
"AM",
"timeLong",
"-",
">",
"6",
":",
"28",
":",
"01",
"AM",
"date",
"-",
">",
"04",
... | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/helpers/Backend.php#L110-L158 | train | Returns a datetime formatted string | [
30522,
2270,
3853,
3058,
7292,
1006,
1002,
3058,
7292,
1010,
1002,
7047,
1027,
1031,
1033,
1007,
1063,
14817,
1006,
9140,
1035,
13590,
1006,
1031,
1005,
12398,
10175,
5657,
1005,
1027,
1028,
1005,
1005,
1010,
1005,
4289,
1005,
1027,
1028,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/Zend/Cache/Frontend/Page.php | Zend_Cache_Frontend_Page._setDefaultOptions | protected function _setDefaultOptions($options)
{
if (!is_array($options)) {
Zend_Cache::throwException('default_options must be an array !');
}
foreach ($options as $key=>$value) {
if (!is_string($key)) {
Zend_Cache::throwException("invalid option [$key] !");
}
$key = strtolower($key);
if (isset($this->_specificOptions['default_options'][$key])) {
$this->_specificOptions['default_options'][$key] = $value;
}
}
} | php | protected function _setDefaultOptions($options)
{
if (!is_array($options)) {
Zend_Cache::throwException('default_options must be an array !');
}
foreach ($options as $key=>$value) {
if (!is_string($key)) {
Zend_Cache::throwException("invalid option [$key] !");
}
$key = strtolower($key);
if (isset($this->_specificOptions['default_options'][$key])) {
$this->_specificOptions['default_options'][$key] = $value;
}
}
} | [
"protected",
"function",
"_setDefaultOptions",
"(",
"$",
"options",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"options",
")",
")",
"{",
"Zend_Cache",
"::",
"throwException",
"(",
"'default_options must be an array !'",
")",
";",
"}",
"foreach",
"(",
"$",... | Specific setter for the 'default_options' option (with some additional tests)
@param array $options Associative array
@throws Zend_Cache_Exception
@return void | [
"Specific",
"setter",
"for",
"the",
"default_options",
"option",
"(",
"with",
"some",
"additional",
"tests",
")"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Cache/Frontend/Page.php#L163-L177 | train | Set default options for all languages | [
30522,
5123,
3853,
1035,
2275,
3207,
7011,
11314,
7361,
9285,
1006,
1002,
7047,
1007,
1063,
2065,
1006,
999,
2003,
1035,
9140,
1006,
1002,
7047,
1007,
1007,
1063,
16729,
2094,
1035,
17053,
1024,
1024,
5466,
10288,
24422,
1006,
1005,
12398,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getgrav/grav | system/src/Grav/Common/User/Authentication.php | Authentication.create | public static function create($password): string
{
if (!$password) {
throw new \RuntimeException('Password hashing failed: no password provided.');
}
$hash = password_hash($password, PASSWORD_DEFAULT);
if (!$hash) {
throw new \RuntimeException('Password hashing failed: internal error.');
}
return $hash;
} | php | public static function create($password): string
{
if (!$password) {
throw new \RuntimeException('Password hashing failed: no password provided.');
}
$hash = password_hash($password, PASSWORD_DEFAULT);
if (!$hash) {
throw new \RuntimeException('Password hashing failed: internal error.');
}
return $hash;
} | [
"public",
"static",
"function",
"create",
"(",
"$",
"password",
")",
":",
"string",
"{",
"if",
"(",
"!",
"$",
"password",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"'Password hashing failed: no password provided.'",
")",
";",
"}",
"$",
"hash",
... | Create password hash from plaintext password.
@param string $password Plaintext password.
@throws \RuntimeException
@return string | [
"Create",
"password",
"hash",
"from",
"plaintext",
"password",
"."
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/User/Authentication.php#L22-L35 | train | Create a hash of a password | [
30522,
2270,
10763,
3853,
3443,
1006,
1002,
20786,
1007,
1024,
5164,
1063,
2065,
1006,
999,
1002,
20786,
1007,
1063,
5466,
2047,
1032,
2448,
7292,
10288,
24422,
1006,
1005,
20786,
23325,
2075,
3478,
1024,
2053,
20786,
3024,
1012,
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... |
symfony/symfony | src/Symfony/Component/HttpKernel/Fragment/FragmentHandler.php | FragmentHandler.render | public function render($uri, $renderer = 'inline', array $options = [])
{
if (!isset($options['ignore_errors'])) {
$options['ignore_errors'] = !$this->debug;
}
if (!isset($this->renderers[$renderer])) {
throw new \InvalidArgumentException(sprintf('The "%s" renderer does not exist.', $renderer));
}
if (!$request = $this->requestStack->getCurrentRequest()) {
throw new \LogicException('Rendering a fragment can only be done when handling a Request.');
}
return $this->deliver($this->renderers[$renderer]->render($uri, $request, $options));
} | php | public function render($uri, $renderer = 'inline', array $options = [])
{
if (!isset($options['ignore_errors'])) {
$options['ignore_errors'] = !$this->debug;
}
if (!isset($this->renderers[$renderer])) {
throw new \InvalidArgumentException(sprintf('The "%s" renderer does not exist.', $renderer));
}
if (!$request = $this->requestStack->getCurrentRequest()) {
throw new \LogicException('Rendering a fragment can only be done when handling a Request.');
}
return $this->deliver($this->renderers[$renderer]->render($uri, $request, $options));
} | [
"public",
"function",
"render",
"(",
"$",
"uri",
",",
"$",
"renderer",
"=",
"'inline'",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"options",
"[",
"'ignore_errors'",
"]",
")",
")",
"{",
"$",
"options",... | Renders a URI and returns the Response content.
Available options:
* ignore_errors: true to return an empty string in case of an error
@param string|ControllerReference $uri A URI as a string or a ControllerReference instance
@param string $renderer The renderer name
@param array $options An array of options
@return string|null The Response content or null when the Response is streamed
@throws \InvalidArgumentException when the renderer does not exist
@throws \LogicException when no master request is being handled | [
"Renders",
"a",
"URI",
"and",
"returns",
"the",
"Response",
"content",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/Fragment/FragmentHandler.php#L73-L88 | train | Render a fragment using the current request | [
30522,
2270,
3853,
17552,
1006,
1002,
24471,
2072,
1010,
1002,
17552,
2121,
1027,
1005,
23881,
1005,
1010,
9140,
1002,
7047,
1027,
1031,
1033,
1007,
1063,
2065,
1006,
999,
26354,
3388,
1006,
1002,
7047,
1031,
1005,
8568,
1035,
10697,
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... |
barryvdh/laravel-debugbar | src/JavascriptRenderer.php | JavascriptRenderer.renderHead | public function renderHead()
{
$cssRoute = route('debugbar.assets.css', [
'v' => $this->getModifiedTime('css')
]);
$jsRoute = route('debugbar.assets.js', [
'v' => $this->getModifiedTime('js')
]);
$cssRoute = preg_replace('/\Ahttps?:/', '', $cssRoute);
$jsRoute = preg_replace('/\Ahttps?:/', '', $jsRoute);
$html = "<link rel='stylesheet' type='text/css' property='stylesheet' href='{$cssRoute}'>";
$html .= "<script type='text/javascript' src='{$jsRoute}'></script>";
if ($this->isJqueryNoConflictEnabled()) {
$html .= '<script type="text/javascript">jQuery.noConflict(true);</script>' . "\n";
}
$html .= $this->getInlineHtml();
return $html;
} | php | public function renderHead()
{
$cssRoute = route('debugbar.assets.css', [
'v' => $this->getModifiedTime('css')
]);
$jsRoute = route('debugbar.assets.js', [
'v' => $this->getModifiedTime('js')
]);
$cssRoute = preg_replace('/\Ahttps?:/', '', $cssRoute);
$jsRoute = preg_replace('/\Ahttps?:/', '', $jsRoute);
$html = "<link rel='stylesheet' type='text/css' property='stylesheet' href='{$cssRoute}'>";
$html .= "<script type='text/javascript' src='{$jsRoute}'></script>";
if ($this->isJqueryNoConflictEnabled()) {
$html .= '<script type="text/javascript">jQuery.noConflict(true);</script>' . "\n";
}
$html .= $this->getInlineHtml();
return $html;
} | [
"public",
"function",
"renderHead",
"(",
")",
"{",
"$",
"cssRoute",
"=",
"route",
"(",
"'debugbar.assets.css'",
",",
"[",
"'v'",
"=>",
"$",
"this",
"->",
"getModifiedTime",
"(",
"'css'",
")",
"]",
")",
";",
"$",
"jsRoute",
"=",
"route",
"(",
"'debugbar.a... | {@inheritdoc} | [
"{"
] | 2d195779ea4f809f69764a795e2ec371dbb76a96 | https://github.com/barryvdh/laravel-debugbar/blob/2d195779ea4f809f69764a795e2ec371dbb76a96/src/JavascriptRenderer.php#L40-L64 | train | Render the head of the debug bar | [
30522,
2270,
3853,
17552,
4974,
1006,
1007,
1063,
1002,
20116,
21338,
5833,
2063,
1027,
2799,
1006,
1005,
2139,
8569,
18259,
2906,
1012,
7045,
1012,
20116,
2015,
1005,
1010,
1031,
1005,
1058,
1005,
1027,
1028,
1002,
2023,
1011,
1028,
2131,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Cache/DatabaseStore.php | DatabaseStore.serialize | protected function serialize($value)
{
$result = serialize($value);
if ($this->connection instanceof PostgresConnection && Str::contains($result, "\0")) {
$result = base64_encode($result);
}
return $result;
} | php | protected function serialize($value)
{
$result = serialize($value);
if ($this->connection instanceof PostgresConnection && Str::contains($result, "\0")) {
$result = base64_encode($result);
}
return $result;
} | [
"protected",
"function",
"serialize",
"(",
"$",
"value",
")",
"{",
"$",
"result",
"=",
"serialize",
"(",
"$",
"value",
")",
";",
"if",
"(",
"$",
"this",
"->",
"connection",
"instanceof",
"PostgresConnection",
"&&",
"Str",
"::",
"contains",
"(",
"$",
"res... | Serialize the given value.
@param mixed $value
@return string | [
"Serialize",
"the",
"given",
"value",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Cache/DatabaseStore.php#L269-L278 | train | Serializes the value to a string | [
30522,
5123,
3853,
7642,
4697,
1006,
1002,
3643,
1007,
1063,
1002,
2765,
1027,
7642,
4697,
1006,
1002,
3643,
1007,
1025,
2065,
1006,
1002,
2023,
1011,
1028,
4434,
6013,
11253,
2695,
17603,
9363,
10087,
7542,
1004,
1004,
2358,
2099,
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... |
matomo-org/matomo | libs/Zend/Validate/Hex.php | Zend_Validate_Hex.isValid | public function isValid($value)
{
if (!is_string($value) && !is_int($value)) {
$this->_error(self::INVALID);
return false;
}
$this->_setValue($value);
if (!ctype_xdigit((string) $value)) {
$this->_error(self::NOT_HEX);
return false;
}
return true;
} | php | public function isValid($value)
{
if (!is_string($value) && !is_int($value)) {
$this->_error(self::INVALID);
return false;
}
$this->_setValue($value);
if (!ctype_xdigit((string) $value)) {
$this->_error(self::NOT_HEX);
return false;
}
return true;
} | [
"public",
"function",
"isValid",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"value",
")",
"&&",
"!",
"is_int",
"(",
"$",
"value",
")",
")",
"{",
"$",
"this",
"->",
"_error",
"(",
"self",
"::",
"INVALID",
")",
";",
"return... | Defined by Zend_Validate_Interface
Returns true if and only if $value contains only hexadecimal digit characters
@param string $value
@return boolean | [
"Defined",
"by",
"Zend_Validate_Interface"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Validate/Hex.php#L56-L70 | train | Valida o valor de una peticion | [
30522,
2270,
3853,
2003,
10175,
3593,
1006,
1002,
3643,
1007,
1063,
2065,
1006,
999,
2003,
1035,
5164,
1006,
1002,
3643,
1007,
1004,
1004,
999,
2003,
1035,
20014,
1006,
1002,
3643,
1007,
1007,
1063,
1002,
2023,
1011,
1028,
1035,
7561,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/CoreVisualizations/Visualizations/Cloud.php | Cloud.shuffleCloud | protected function shuffleCloud()
{
if (self::$debugDisableShuffle) {
return;
}
$keys = array_keys($this->wordsArray);
shuffle($keys);
if (count($keys) && is_array($keys)) {
$tmpArray = $this->wordsArray;
$this->wordsArray = array();
foreach ($keys as $value) {
$this->wordsArray[$value] = $tmpArray[$value];
}
}
} | php | protected function shuffleCloud()
{
if (self::$debugDisableShuffle) {
return;
}
$keys = array_keys($this->wordsArray);
shuffle($keys);
if (count($keys) && is_array($keys)) {
$tmpArray = $this->wordsArray;
$this->wordsArray = array();
foreach ($keys as $value) {
$this->wordsArray[$value] = $tmpArray[$value];
}
}
} | [
"protected",
"function",
"shuffleCloud",
"(",
")",
"{",
"if",
"(",
"self",
"::",
"$",
"debugDisableShuffle",
")",
"{",
"return",
";",
"}",
"$",
"keys",
"=",
"array_keys",
"(",
"$",
"this",
"->",
"wordsArray",
")",
";",
"shuffle",
"(",
"$",
"keys",
")",... | Shuffle associated names in array | [
"Shuffle",
"associated",
"names",
"in",
"array"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/CoreVisualizations/Visualizations/Cloud.php#L132-L152 | train | Shuffle the cloud of words array | [
30522,
5123,
3853,
23046,
20464,
19224,
1006,
1007,
1063,
2065,
1006,
2969,
1024,
1024,
1002,
2139,
8569,
2290,
10521,
3085,
14235,
18142,
1007,
1063,
2709,
1025,
1065,
1002,
6309,
1027,
9140,
1035,
6309,
1006,
1002,
2023,
1011,
1028,
2616,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Translation/Translator.php | Translator.load | public function load($namespace, $group, $locale)
{
if ($this->isLoaded($namespace, $group, $locale)) {
return;
}
// The loader is responsible for returning the array of language lines for the
// given namespace, group, and locale. We'll set the lines in this array of
// lines that have already been loaded so that we can easily access them.
$lines = $this->loader->load($locale, $group, $namespace);
$this->loaded[$namespace][$group][$locale] = $lines;
} | php | public function load($namespace, $group, $locale)
{
if ($this->isLoaded($namespace, $group, $locale)) {
return;
}
// The loader is responsible for returning the array of language lines for the
// given namespace, group, and locale. We'll set the lines in this array of
// lines that have already been loaded so that we can easily access them.
$lines = $this->loader->load($locale, $group, $namespace);
$this->loaded[$namespace][$group][$locale] = $lines;
} | [
"public",
"function",
"load",
"(",
"$",
"namespace",
",",
"$",
"group",
",",
"$",
"locale",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isLoaded",
"(",
"$",
"namespace",
",",
"$",
"group",
",",
"$",
"locale",
")",
")",
"{",
"return",
";",
"}",
"// T... | Load the specified language group.
@param string $namespace
@param string $group
@param string $locale
@return void | [
"Load",
"the",
"specified",
"language",
"group",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Translation/Translator.php#L315-L327 | train | Load the language lines for the given namespace group and locale | [
30522,
2270,
3853,
7170,
1006,
1002,
3415,
15327,
1010,
1002,
2177,
1010,
1002,
2334,
2063,
1007,
1063,
2065,
1006,
1002,
2023,
1011,
1028,
2003,
17468,
1006,
1002,
3415,
15327,
1010,
1002,
2177,
1010,
1002,
2334,
2063,
1007,
1007,
1063,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Log/LogManager.php | LogManager.tap | protected function tap($name, Logger $logger)
{
foreach ($this->configurationFor($name)['tap'] ?? [] as $tap) {
[$class, $arguments] = $this->parseTap($tap);
$this->app->make($class)->__invoke($logger, ...explode(',', $arguments));
}
return $logger;
} | php | protected function tap($name, Logger $logger)
{
foreach ($this->configurationFor($name)['tap'] ?? [] as $tap) {
[$class, $arguments] = $this->parseTap($tap);
$this->app->make($class)->__invoke($logger, ...explode(',', $arguments));
}
return $logger;
} | [
"protected",
"function",
"tap",
"(",
"$",
"name",
",",
"Logger",
"$",
"logger",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"configurationFor",
"(",
"$",
"name",
")",
"[",
"'tap'",
"]",
"??",
"[",
"]",
"as",
"$",
"tap",
")",
"{",
"[",
"$",
"clas... | Apply the configured taps for the logger.
@param string $name
@param \Illuminate\Log\Logger $logger
@return \Illuminate\Log\Logger | [
"Apply",
"the",
"configured",
"taps",
"for",
"the",
"logger",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Log/LogManager.php#L121-L130 | train | taps the given logger | [
30522,
5123,
3853,
11112,
1006,
1002,
2171,
1010,
8833,
4590,
1002,
8833,
4590,
1007,
1063,
18921,
6776,
1006,
1002,
2023,
1011,
1028,
9563,
29278,
1006,
1002,
2171,
1007,
1031,
1005,
11112,
1005,
1033,
1029,
1029,
1031,
1033,
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... |
laravel/framework | src/Illuminate/Database/Eloquent/Collection.php | Collection.loadMorph | public function loadMorph($relation, $relations)
{
$this->pluck($relation)
->filter()
->groupBy(function ($model) {
return get_class($model);
})
->each(function ($models, $className) use ($relations) {
static::make($models)->load($relations[$className] ?? []);
});
return $this;
} | php | public function loadMorph($relation, $relations)
{
$this->pluck($relation)
->filter()
->groupBy(function ($model) {
return get_class($model);
})
->each(function ($models, $className) use ($relations) {
static::make($models)->load($relations[$className] ?? []);
});
return $this;
} | [
"public",
"function",
"loadMorph",
"(",
"$",
"relation",
",",
"$",
"relations",
")",
"{",
"$",
"this",
"->",
"pluck",
"(",
"$",
"relation",
")",
"->",
"filter",
"(",
")",
"->",
"groupBy",
"(",
"function",
"(",
"$",
"model",
")",
"{",
"return",
"get_c... | Load a set of relationships onto the mixed relationship collection.
@param string $relation
@param array $relations
@return $this | [
"Load",
"a",
"set",
"of",
"relationships",
"onto",
"the",
"mixed",
"relationship",
"collection",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Collection.php#L178-L190 | train | Load morph relation models | [
30522,
2270,
3853,
7170,
5302,
14536,
2232,
1006,
1002,
7189,
1010,
1002,
4262,
1007,
1063,
1002,
2023,
1011,
1028,
20228,
12722,
1006,
1002,
7189,
1007,
1011,
1028,
11307,
1006,
1007,
1011,
1028,
2177,
3762,
1006,
3853,
1006,
1002,
2944,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
overtrue/wechat | src/OfficialAccount/Broadcasting/MessageBuilder.php | MessageBuilder.build | public function build(array $prepends = []): array
{
if (empty($this->message)) {
throw new RuntimeException('No message content to send.');
}
$content = $this->message->transformForJsonRequest();
if (empty($prepends)) {
$prepends = $this->to;
}
$message = array_merge($prepends, $content, $this->attributes);
return $message;
} | php | public function build(array $prepends = []): array
{
if (empty($this->message)) {
throw new RuntimeException('No message content to send.');
}
$content = $this->message->transformForJsonRequest();
if (empty($prepends)) {
$prepends = $this->to;
}
$message = array_merge($prepends, $content, $this->attributes);
return $message;
} | [
"public",
"function",
"build",
"(",
"array",
"$",
"prepends",
"=",
"[",
"]",
")",
":",
"array",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"message",
")",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"'No message content to send.'",
")",
";",... | Build message.
@param array $prepends
@return array
@throws \EasyWeChat\Kernel\Exceptions\RuntimeException | [
"Build",
"message",
"."
] | 120c72faaa93c270365bc75c73c362d5fd583209 | https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/OfficialAccount/Broadcasting/MessageBuilder.php#L131-L146 | train | Build the array with the content of the message | [
30522,
2270,
3853,
3857,
1006,
9140,
1002,
17463,
10497,
2015,
1027,
1031,
1033,
1007,
1024,
9140,
1063,
2065,
1006,
4064,
1006,
1002,
2023,
1011,
1028,
4471,
1007,
1007,
1063,
5466,
2047,
2448,
7292,
10288,
24422,
1006,
1005,
2053,
4471,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
z-song/laravel-admin | src/Form/Field/Text.php | Text.prepare_options | protected function prepare_options($options)
{
$original = [];
$toReplace = [];
foreach ($options as $key => &$value) {
if (is_array($value)) {
$subArray = $this->prepare_options($value);
$value = $subArray['options'];
$original = array_merge($original, $subArray['original']);
$toReplace = array_merge($toReplace, $subArray['toReplace']);
} elseif (preg_match('/function.*?/', $value)) {
$original[] = $value;
$value = "%{$key}%";
$toReplace[] = "\"{$value}\"";
}
}
return compact('original', 'toReplace', 'options');
} | php | protected function prepare_options($options)
{
$original = [];
$toReplace = [];
foreach ($options as $key => &$value) {
if (is_array($value)) {
$subArray = $this->prepare_options($value);
$value = $subArray['options'];
$original = array_merge($original, $subArray['original']);
$toReplace = array_merge($toReplace, $subArray['toReplace']);
} elseif (preg_match('/function.*?/', $value)) {
$original[] = $value;
$value = "%{$key}%";
$toReplace[] = "\"{$value}\"";
}
}
return compact('original', 'toReplace', 'options');
} | [
"protected",
"function",
"prepare_options",
"(",
"$",
"options",
")",
"{",
"$",
"original",
"=",
"[",
"]",
";",
"$",
"toReplace",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"options",
"as",
"$",
"key",
"=>",
"&",
"$",
"value",
")",
"{",
"if",
"(",
... | Prepare options.
@param array $options
@return array | [
"Prepare",
"options",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Form/Field/Text.php#L96-L115 | train | Prepares the options array for the parser | [
30522,
5123,
3853,
7374,
1035,
7047,
1006,
1002,
7047,
1007,
1063,
1002,
2434,
1027,
1031,
1033,
1025,
1002,
9538,
24759,
10732,
1027,
1031,
1033,
1025,
18921,
6776,
1006,
1002,
7047,
2004,
1002,
3145,
1027,
1028,
1004,
1002,
3643,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/SitesManager/API.php | API.getJavascriptTag | public function getJavascriptTag($idSite, $piwikUrl = '', $mergeSubdomains = false, $groupPageTitlesByDomain = false,
$mergeAliasUrls = false, $visitorCustomVariables = false, $pageCustomVariables = false,
$customCampaignNameQueryParam = false, $customCampaignKeywordParam = false,
$doNotTrack = false, $disableCookies = false, $trackNoScript = false,
$crossDomain = false, $forceMatomoEndpoint = false)
{
Piwik::checkUserHasViewAccess($idSite);
if (empty($piwikUrl)) {
$piwikUrl = SettingsPiwik::getPiwikUrl();
}
// Revert the automatic encoding
// TODO remove that when https://github.com/piwik/piwik/issues/4231 is fixed
$piwikUrl = Common::unsanitizeInputValue($piwikUrl);
$visitorCustomVariables = Common::unsanitizeInputValues($visitorCustomVariables);
$pageCustomVariables = Common::unsanitizeInputValues($pageCustomVariables);
$customCampaignNameQueryParam = Common::unsanitizeInputValue($customCampaignNameQueryParam);
$customCampaignKeywordParam = Common::unsanitizeInputValue($customCampaignKeywordParam);
$generator = new TrackerCodeGenerator();
if ($forceMatomoEndpoint) {
$generator->forceMatomoEndpoint();
}
$code = $generator->generate($idSite, $piwikUrl, $mergeSubdomains, $groupPageTitlesByDomain,
$mergeAliasUrls, $visitorCustomVariables, $pageCustomVariables,
$customCampaignNameQueryParam, $customCampaignKeywordParam,
$doNotTrack, $disableCookies, $trackNoScript, $crossDomain);
$code = str_replace(array('<br>', '<br />', '<br/>'), '', $code);
return $code;
} | php | public function getJavascriptTag($idSite, $piwikUrl = '', $mergeSubdomains = false, $groupPageTitlesByDomain = false,
$mergeAliasUrls = false, $visitorCustomVariables = false, $pageCustomVariables = false,
$customCampaignNameQueryParam = false, $customCampaignKeywordParam = false,
$doNotTrack = false, $disableCookies = false, $trackNoScript = false,
$crossDomain = false, $forceMatomoEndpoint = false)
{
Piwik::checkUserHasViewAccess($idSite);
if (empty($piwikUrl)) {
$piwikUrl = SettingsPiwik::getPiwikUrl();
}
// Revert the automatic encoding
// TODO remove that when https://github.com/piwik/piwik/issues/4231 is fixed
$piwikUrl = Common::unsanitizeInputValue($piwikUrl);
$visitorCustomVariables = Common::unsanitizeInputValues($visitorCustomVariables);
$pageCustomVariables = Common::unsanitizeInputValues($pageCustomVariables);
$customCampaignNameQueryParam = Common::unsanitizeInputValue($customCampaignNameQueryParam);
$customCampaignKeywordParam = Common::unsanitizeInputValue($customCampaignKeywordParam);
$generator = new TrackerCodeGenerator();
if ($forceMatomoEndpoint) {
$generator->forceMatomoEndpoint();
}
$code = $generator->generate($idSite, $piwikUrl, $mergeSubdomains, $groupPageTitlesByDomain,
$mergeAliasUrls, $visitorCustomVariables, $pageCustomVariables,
$customCampaignNameQueryParam, $customCampaignKeywordParam,
$doNotTrack, $disableCookies, $trackNoScript, $crossDomain);
$code = str_replace(array('<br>', '<br />', '<br/>'), '', $code);
return $code;
} | [
"public",
"function",
"getJavascriptTag",
"(",
"$",
"idSite",
",",
"$",
"piwikUrl",
"=",
"''",
",",
"$",
"mergeSubdomains",
"=",
"false",
",",
"$",
"groupPageTitlesByDomain",
"=",
"false",
",",
"$",
"mergeAliasUrls",
"=",
"false",
",",
"$",
"visitorCustomVaria... | Returns the javascript tag for the given idSite.
This tag must be included on every page to be tracked by Matomo
@param int $idSite
@param string $piwikUrl
@param bool $mergeSubdomains
@param bool $groupPageTitlesByDomain
@param bool $mergeAliasUrls
@param bool $visitorCustomVariables
@param bool $pageCustomVariables
@param bool $customCampaignNameQueryParam
@param bool $customCampaignKeywordParam
@param bool $doNotTrack
@param bool $disableCookies
@param bool $trackNoScript
@param bool $forceMatomoEndpoint Whether the Matomo endpoint should be forced if Matomo was installed prior 3.7.0.
@return string The Javascript tag ready to be included on the HTML pages | [
"Returns",
"the",
"javascript",
"tag",
"for",
"the",
"given",
"idSite",
".",
"This",
"tag",
"must",
"be",
"included",
"on",
"every",
"page",
"to",
"be",
"tracked",
"by",
"Matomo"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/SitesManager/API.php#L107-L138 | train | Returns the javascript tag for the given site | [
30522,
2270,
3853,
2131,
3900,
12044,
23235,
15900,
1006,
1002,
8909,
28032,
2063,
1010,
1002,
14255,
9148,
18569,
2140,
1027,
1005,
1005,
1010,
1002,
13590,
6342,
2497,
9527,
28247,
1027,
6270,
1010,
1002,
2177,
13704,
27430,
3762,
9527,
8... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Console/Helper/ProcessHelper.php | ProcessHelper.mustRun | public function mustRun(OutputInterface $output, $cmd, $error = null, callable $callback = null)
{
$process = $this->run($output, $cmd, $error, $callback);
if (!$process->isSuccessful()) {
throw new ProcessFailedException($process);
}
return $process;
} | php | public function mustRun(OutputInterface $output, $cmd, $error = null, callable $callback = null)
{
$process = $this->run($output, $cmd, $error, $callback);
if (!$process->isSuccessful()) {
throw new ProcessFailedException($process);
}
return $process;
} | [
"public",
"function",
"mustRun",
"(",
"OutputInterface",
"$",
"output",
",",
"$",
"cmd",
",",
"$",
"error",
"=",
"null",
",",
"callable",
"$",
"callback",
"=",
"null",
")",
"{",
"$",
"process",
"=",
"$",
"this",
"->",
"run",
"(",
"$",
"output",
",",
... | Runs the process.
This is identical to run() except that an exception is thrown if the process
exits with a non-zero exit code.
@param OutputInterface $output An OutputInterface instance
@param string|Process $cmd An instance of Process or a command to run
@param string|null $error An error message that must be displayed if something went wrong
@param callable|null $callback A PHP callback to run whenever there is some
output available on STDOUT or STDERR
@return Process The process that ran
@throws ProcessFailedException
@see run() | [
"Runs",
"the",
"process",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Console/Helper/ProcessHelper.php#L107-L116 | train | Runs a command and returns the result of the process | [
30522,
2270,
3853,
2442,
15532,
1006,
6434,
18447,
2121,
12172,
1002,
6434,
1010,
1002,
4642,
2094,
1010,
1002,
7561,
1027,
19701,
1010,
2655,
3085,
1002,
2655,
5963,
1027,
19701,
1007,
1063,
1002,
2832,
1027,
1002,
2023,
1011,
1028,
2448,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/controllers/Index.php | Index.onCreateTemplate | public function onCreateTemplate()
{
$type = Request::input('type');
$template = $this->createTemplate($type);
if ($type === 'asset') {
$template->fileName = $this->widget->assetList->getCurrentRelativePath();
}
$widget = $this->makeTemplateFormWidget($type, $template);
$this->vars['templatePath'] = '';
return [
'tabTitle' => $this->getTabTitle($type, $template),
'tab' => $this->makePartial('form_page', [
'form' => $widget,
'templateType' => $type,
'templateTheme' => $this->theme->getDirName(),
'templateMtime' => null
])
];
} | php | public function onCreateTemplate()
{
$type = Request::input('type');
$template = $this->createTemplate($type);
if ($type === 'asset') {
$template->fileName = $this->widget->assetList->getCurrentRelativePath();
}
$widget = $this->makeTemplateFormWidget($type, $template);
$this->vars['templatePath'] = '';
return [
'tabTitle' => $this->getTabTitle($type, $template),
'tab' => $this->makePartial('form_page', [
'form' => $widget,
'templateType' => $type,
'templateTheme' => $this->theme->getDirName(),
'templateMtime' => null
])
];
} | [
"public",
"function",
"onCreateTemplate",
"(",
")",
"{",
"$",
"type",
"=",
"Request",
"::",
"input",
"(",
"'type'",
")",
";",
"$",
"template",
"=",
"$",
"this",
"->",
"createTemplate",
"(",
"$",
"type",
")",
";",
"if",
"(",
"$",
"type",
"===",
"'asse... | Create a new template
@return array | [
"Create",
"a",
"new",
"template"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/controllers/Index.php#L257-L279 | train | onCreateTemplate - Create template | [
30522,
2270,
3853,
2006,
16748,
3686,
18532,
15725,
1006,
1007,
1063,
1002,
2828,
1027,
5227,
1024,
1024,
7953,
1006,
1005,
2828,
1005,
1007,
1025,
1002,
23561,
1027,
1002,
2023,
1011,
1028,
3443,
18532,
15725,
1006,
1002,
2828,
1007,
1025,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Database/Connectors/ConnectionFactory.php | ConnectionFactory.createSingleConnection | protected function createSingleConnection(array $config)
{
$pdo = $this->createPdoResolver($config);
return $this->createConnection(
$config['driver'], $pdo, $config['database'], $config['prefix'], $config
);
} | php | protected function createSingleConnection(array $config)
{
$pdo = $this->createPdoResolver($config);
return $this->createConnection(
$config['driver'], $pdo, $config['database'], $config['prefix'], $config
);
} | [
"protected",
"function",
"createSingleConnection",
"(",
"array",
"$",
"config",
")",
"{",
"$",
"pdo",
"=",
"$",
"this",
"->",
"createPdoResolver",
"(",
"$",
"config",
")",
";",
"return",
"$",
"this",
"->",
"createConnection",
"(",
"$",
"config",
"[",
"'dri... | Create a single database connection instance.
@param array $config
@return \Illuminate\Database\Connection | [
"Create",
"a",
"single",
"database",
"connection",
"instance",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Connectors/ConnectionFactory.php#L71-L78 | train | Create a single connection to the database | [
30522,
5123,
3853,
9005,
2075,
2571,
8663,
2638,
7542,
1006,
9140,
1002,
9530,
8873,
2290,
1007,
1063,
1002,
22851,
2080,
1027,
1002,
2023,
1011,
1028,
3443,
17299,
16610,
4747,
6299,
1006,
1002,
9530,
8873,
2290,
1007,
1025,
2709,
1002,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/API/API.php | API.getMetadata | public function getMetadata($idSite, $apiModule, $apiAction, $apiParameters = array(), $language = false,
$period = false, $date = false, $hideMetricsDoc = false, $showSubtableReports = false)
{
Piwik::checkUserHasViewAccess($idSite);
if ($language) {
/** @var Translator $translator */
$translator = StaticContainer::get('Piwik\Translation\Translator');
$translator->setCurrentLanguage($language);
}
$metadata = $this->processedReport->getMetadata($idSite, $apiModule, $apiAction, $apiParameters, $language, $period, $date, $hideMetricsDoc, $showSubtableReports);
return $metadata;
} | php | public function getMetadata($idSite, $apiModule, $apiAction, $apiParameters = array(), $language = false,
$period = false, $date = false, $hideMetricsDoc = false, $showSubtableReports = false)
{
Piwik::checkUserHasViewAccess($idSite);
if ($language) {
/** @var Translator $translator */
$translator = StaticContainer::get('Piwik\Translation\Translator');
$translator->setCurrentLanguage($language);
}
$metadata = $this->processedReport->getMetadata($idSite, $apiModule, $apiAction, $apiParameters, $language, $period, $date, $hideMetricsDoc, $showSubtableReports);
return $metadata;
} | [
"public",
"function",
"getMetadata",
"(",
"$",
"idSite",
",",
"$",
"apiModule",
",",
"$",
"apiAction",
",",
"$",
"apiParameters",
"=",
"array",
"(",
")",
",",
"$",
"language",
"=",
"false",
",",
"$",
"period",
"=",
"false",
",",
"$",
"date",
"=",
"fa... | Loads reports metadata, then return the requested one,
matching optional API parameters. | [
"Loads",
"reports",
"metadata",
"then",
"return",
"the",
"requested",
"one",
"matching",
"optional",
"API",
"parameters",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/API/API.php#L295-L308 | train | Returns metadata for the specified site | [
30522,
2270,
3853,
2131,
11368,
8447,
2696,
1006,
1002,
8909,
28032,
2063,
1010,
1002,
17928,
5302,
8566,
2571,
1010,
1002,
17928,
18908,
3258,
1010,
1002,
30524,
5342,
12589,
16150,
10085,
1027,
6270,
1010,
1002,
3065,
12083,
10880,
2890,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/DependencyInjection/Compiler/MergeExtensionConfigurationPass.php | MergeExtensionConfigurationContainerBuilder.resolveEnvPlaceholders | public function resolveEnvPlaceholders($value, $format = null, array &$usedEnvs = null)
{
if (true !== $format || !\is_string($value)) {
return parent::resolveEnvPlaceholders($value, $format, $usedEnvs);
}
$bag = $this->getParameterBag();
$value = $bag->resolveValue($value);
foreach ($bag->getEnvPlaceholders() as $env => $placeholders) {
if (false === strpos($env, ':')) {
continue;
}
foreach ($placeholders as $placeholder) {
if (false !== stripos($value, $placeholder)) {
throw new RuntimeException(sprintf('Using a cast in "env(%s)" is incompatible with resolution at compile time in "%s". The logic in the extension should be moved to a compiler pass, or an env parameter with no cast should be used instead.', $env, $this->extensionClass));
}
}
}
return parent::resolveEnvPlaceholders($value, $format, $usedEnvs);
} | php | public function resolveEnvPlaceholders($value, $format = null, array &$usedEnvs = null)
{
if (true !== $format || !\is_string($value)) {
return parent::resolveEnvPlaceholders($value, $format, $usedEnvs);
}
$bag = $this->getParameterBag();
$value = $bag->resolveValue($value);
foreach ($bag->getEnvPlaceholders() as $env => $placeholders) {
if (false === strpos($env, ':')) {
continue;
}
foreach ($placeholders as $placeholder) {
if (false !== stripos($value, $placeholder)) {
throw new RuntimeException(sprintf('Using a cast in "env(%s)" is incompatible with resolution at compile time in "%s". The logic in the extension should be moved to a compiler pass, or an env parameter with no cast should be used instead.', $env, $this->extensionClass));
}
}
}
return parent::resolveEnvPlaceholders($value, $format, $usedEnvs);
} | [
"public",
"function",
"resolveEnvPlaceholders",
"(",
"$",
"value",
",",
"$",
"format",
"=",
"null",
",",
"array",
"&",
"$",
"usedEnvs",
"=",
"null",
")",
"{",
"if",
"(",
"true",
"!==",
"$",
"format",
"||",
"!",
"\\",
"is_string",
"(",
"$",
"value",
"... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DependencyInjection/Compiler/MergeExtensionConfigurationPass.php#L194-L215 | train | Resolve env placeholders | [
30522,
2270,
3853,
10663,
2368,
2615,
24759,
10732,
17794,
1006,
1002,
3643,
1010,
1002,
4289,
1027,
19701,
1010,
9140,
1004,
1002,
2109,
2368,
15088,
1027,
19701,
1007,
1063,
2065,
1006,
2995,
999,
1027,
1027,
1002,
4289,
1064,
1064,
999,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.buildView | public function buildView(FormView $view, FormInterface $form, array $options)
{
$vars = [
'widget' => $options['widget'],
'with_invert' => $options['with_invert'],
];
foreach ($this->timeParts as $part) {
$vars['with_'.$part] = $options['with_'.$part];
}
$view->vars = array_replace($view->vars, $vars);
} | php | public function buildView(FormView $view, FormInterface $form, array $options)
{
$vars = [
'widget' => $options['widget'],
'with_invert' => $options['with_invert'],
];
foreach ($this->timeParts as $part) {
$vars['with_'.$part] = $options['with_'.$part];
}
$view->vars = array_replace($view->vars, $vars);
} | [
"public",
"function",
"buildView",
"(",
"FormView",
"$",
"view",
",",
"FormInterface",
"$",
"form",
",",
"array",
"$",
"options",
")",
"{",
"$",
"vars",
"=",
"[",
"'widget'",
"=>",
"$",
"options",
"[",
"'widget'",
"]",
",",
"'with_invert'",
"=>",
"$",
... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Extension/Core/Type/DateIntervalType.php#L154-L164 | train | Build the view. | [
30522,
2270,
3853,
3857,
8584,
1006,
2433,
8584,
1002,
3193,
1010,
2433,
18447,
2121,
12172,
1002,
2433,
1010,
9140,
1002,
7047,
1007,
1063,
1002,
13075,
2015,
1027,
1031,
1005,
15536,
24291,
1005,
1027,
1028,
1002,
7047,
1031,
1005,
15536,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
google/flatbuffers | php/FlatbufferBuilder.php | FlatbufferBuilder.prep | public function prep($size, $additional_bytes)
{
if ($size > $this->minalign) {
$this->minalign = $size;
}
$align_size = ((~($this->bb->capacity() - $this->space + $additional_bytes)) + 1) & ($size - 1);
while ($this->space < $align_size + $size + $additional_bytes) {
$old_buf_size = $this->bb->capacity();
$this->bb = $this->growByteBuffer($this->bb);
$this->space += $this->bb->capacity() - $old_buf_size;
}
$this->pad($align_size);
} | php | public function prep($size, $additional_bytes)
{
if ($size > $this->minalign) {
$this->minalign = $size;
}
$align_size = ((~($this->bb->capacity() - $this->space + $additional_bytes)) + 1) & ($size - 1);
while ($this->space < $align_size + $size + $additional_bytes) {
$old_buf_size = $this->bb->capacity();
$this->bb = $this->growByteBuffer($this->bb);
$this->space += $this->bb->capacity() - $old_buf_size;
}
$this->pad($align_size);
} | [
"public",
"function",
"prep",
"(",
"$",
"size",
",",
"$",
"additional_bytes",
")",
"{",
"if",
"(",
"$",
"size",
">",
"$",
"this",
"->",
"minalign",
")",
"{",
"$",
"this",
"->",
"minalign",
"=",
"$",
"size",
";",
"}",
"$",
"align_size",
"=",
"(",
... | prepare bytebuffer
@param $size
@param $additional_bytes
@throws \Exception | [
"prepare",
"bytebuffer"
] | af74f87ccd6ea9bcf9e325427dca7c7faf1d79c1 | https://github.com/google/flatbuffers/blob/af74f87ccd6ea9bcf9e325427dca7c7faf1d79c1/php/FlatbufferBuilder.php#L139-L153 | train | Pre - aligns the buffer | [
30522,
2270,
3853,
17463,
1006,
1002,
2946,
1010,
1002,
3176,
1035,
27507,
1007,
1063,
2065,
1006,
1002,
2946,
1028,
1002,
2023,
1011,
1028,
19808,
3669,
16206,
1007,
1063,
1002,
2023,
1011,
1028,
19808,
3669,
16206,
1027,
1002,
2946,
1025,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Ldap/Adapter/ExtLdap/EntryManager.php | EntryManager.add | public function add(Entry $entry)
{
$con = $this->getConnectionResource();
if (!@ldap_add($con, $entry->getDn(), $entry->getAttributes())) {
throw new LdapException(sprintf('Could not add entry "%s": %s.', $entry->getDn(), ldap_error($con)));
}
return $this;
} | php | public function add(Entry $entry)
{
$con = $this->getConnectionResource();
if (!@ldap_add($con, $entry->getDn(), $entry->getAttributes())) {
throw new LdapException(sprintf('Could not add entry "%s": %s.', $entry->getDn(), ldap_error($con)));
}
return $this;
} | [
"public",
"function",
"add",
"(",
"Entry",
"$",
"entry",
")",
"{",
"$",
"con",
"=",
"$",
"this",
"->",
"getConnectionResource",
"(",
")",
";",
"if",
"(",
"!",
"@",
"ldap_add",
"(",
"$",
"con",
",",
"$",
"entry",
"->",
"getDn",
"(",
")",
",",
"$",... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Ldap/Adapter/ExtLdap/EntryManager.php#L36-L45 | train | Adds an entry to the current LDAP directory | [
30522,
2270,
3853,
5587,
1006,
4443,
1002,
4443,
1007,
1063,
1002,
9530,
1027,
1002,
2023,
1011,
1028,
2131,
8663,
2638,
7542,
6072,
8162,
3401,
1006,
1007,
1025,
2065,
1006,
999,
1030,
25510,
9331,
1035,
5587,
1006,
1002,
9530,
1010,
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/Security/Http/Firewall/RemoteUserAuthenticationListener.php | RemoteUserAuthenticationListener.getPreAuthenticatedData | protected function getPreAuthenticatedData(Request $request)
{
if (!$request->server->has($this->userKey)) {
throw new BadCredentialsException(sprintf('User key was not found: %s', $this->userKey));
}
return [$request->server->get($this->userKey), null];
} | php | protected function getPreAuthenticatedData(Request $request)
{
if (!$request->server->has($this->userKey)) {
throw new BadCredentialsException(sprintf('User key was not found: %s', $this->userKey));
}
return [$request->server->get($this->userKey), null];
} | [
"protected",
"function",
"getPreAuthenticatedData",
"(",
"Request",
"$",
"request",
")",
"{",
"if",
"(",
"!",
"$",
"request",
"->",
"server",
"->",
"has",
"(",
"$",
"this",
"->",
"userKey",
")",
")",
"{",
"throw",
"new",
"BadCredentialsException",
"(",
"sp... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Security/Http/Firewall/RemoteUserAuthenticationListener.php#L41-L48 | train | Get pre authenticated data | [
30522,
5123,
3853,
2131,
28139,
4887,
10760,
16778,
12921,
2850,
2696,
1006,
5227,
1002,
5227,
1007,
1063,
2065,
1006,
999,
1002,
5227,
1011,
1028,
8241,
1011,
1028,
2038,
1006,
1002,
2023,
1011,
1028,
5310,
14839,
1007,
1007,
1063,
5466,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
z-song/laravel-admin | src/Grid/Tools/Paginator.php | Paginator.paginationRanger | protected function paginationRanger()
{
$parameters = [
'first' => $this->paginator->firstItem(),
'last' => $this->paginator->lastItem(),
'total' => $this->paginator->total(),
];
$parameters = collect($parameters)->flatMap(function ($parameter, $key) {
return [$key => "<b>$parameter</b>"];
});
return trans('admin.pagination.range', $parameters->all());
} | php | protected function paginationRanger()
{
$parameters = [
'first' => $this->paginator->firstItem(),
'last' => $this->paginator->lastItem(),
'total' => $this->paginator->total(),
];
$parameters = collect($parameters)->flatMap(function ($parameter, $key) {
return [$key => "<b>$parameter</b>"];
});
return trans('admin.pagination.range', $parameters->all());
} | [
"protected",
"function",
"paginationRanger",
"(",
")",
"{",
"$",
"parameters",
"=",
"[",
"'first'",
"=>",
"$",
"this",
"->",
"paginator",
"->",
"firstItem",
"(",
")",
",",
"'last'",
"=>",
"$",
"this",
"->",
"paginator",
"->",
"lastItem",
"(",
")",
",",
... | Get range infomation of paginator.
@return string|\Symfony\Component\Translation\TranslatorInterface | [
"Get",
"range",
"infomation",
"of",
"paginator",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid/Tools/Paginator.php#L67-L80 | train | Return pagination range | [
30522,
5123,
3853,
6643,
20876,
3508,
24388,
2121,
1006,
1007,
1063,
1002,
11709,
1027,
1031,
1005,
2034,
1005,
1027,
1028,
1002,
2023,
1011,
1028,
6643,
20876,
4263,
1011,
1028,
2034,
4221,
2213,
1006,
1007,
1010,
1005,
2197,
1005,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php | AbstractNormalizer.setCircularReferenceHandler | public function setCircularReferenceHandler(callable $circularReferenceHandler)
{
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.2, use the "circular_reference_handler" key of the context instead.', __METHOD__), E_USER_DEPRECATED);
$this->defaultContext[self::CIRCULAR_REFERENCE_HANDLER] = $this->circularReferenceHandler = $circularReferenceHandler;
return $this;
} | php | public function setCircularReferenceHandler(callable $circularReferenceHandler)
{
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.2, use the "circular_reference_handler" key of the context instead.', __METHOD__), E_USER_DEPRECATED);
$this->defaultContext[self::CIRCULAR_REFERENCE_HANDLER] = $this->circularReferenceHandler = $circularReferenceHandler;
return $this;
} | [
"public",
"function",
"setCircularReferenceHandler",
"(",
"callable",
"$",
"circularReferenceHandler",
")",
"{",
"@",
"trigger_error",
"(",
"sprintf",
"(",
"'The \"%s()\" method is deprecated since Symfony 4.2, use the \"circular_reference_handler\" key of the context instead.'",
",",
... | Sets circular reference handler.
@deprecated since Symfony 4.2
@param callable $circularReferenceHandler
@return self | [
"Sets",
"circular",
"reference",
"handler",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php#L215-L222 | train | Sets circular reference handler | [
30522,
2270,
3853,
2275,
6895,
11890,
7934,
2890,
25523,
11774,
3917,
1006,
2655,
3085,
1002,
8206,
2890,
25523,
11774,
3917,
1007,
1063,
1030,
9495,
1035,
7561,
1006,
9043,
2546,
1006,
1005,
1996,
1000,
1003,
1055,
1006,
1007,
1000,
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... |
symfony/symfony | src/Symfony/Component/DependencyInjection/Compiler/ExtensionCompilerPass.php | ExtensionCompilerPass.process | public function process(ContainerBuilder $container)
{
foreach ($container->getExtensions() as $extension) {
if (!$extension instanceof CompilerPassInterface) {
continue;
}
$extension->process($container);
}
} | php | public function process(ContainerBuilder $container)
{
foreach ($container->getExtensions() as $extension) {
if (!$extension instanceof CompilerPassInterface) {
continue;
}
$extension->process($container);
}
} | [
"public",
"function",
"process",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"foreach",
"(",
"$",
"container",
"->",
"getExtensions",
"(",
")",
"as",
"$",
"extension",
")",
"{",
"if",
"(",
"!",
"$",
"extension",
"instanceof",
"CompilerPassInterface",
... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DependencyInjection/Compiler/ExtensionCompilerPass.php#L27-L36 | train | Process all CompilerPassInterface extensions | [
30522,
2270,
3853,
2832,
1006,
11661,
8569,
23891,
2099,
1002,
11661,
1007,
1063,
18921,
6776,
1006,
1002,
11661,
1011,
1028,
2131,
10288,
29048,
2015,
1006,
1007,
2004,
1002,
5331,
1007,
1063,
2065,
1006,
999,
1002,
5331,
6013,
11253,
2162... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Yaml/Inline.php | Inline.dump | public static function dump($value, int $flags = 0): string
{
switch (true) {
case \is_resource($value):
if (Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE & $flags) {
throw new DumpException(sprintf('Unable to dump PHP resources in a YAML file ("%s").', get_resource_type($value)));
}
return 'null';
case $value instanceof \DateTimeInterface:
return $value->format('c');
case \is_object($value):
if ($value instanceof TaggedValue) {
return '!'.$value->getTag().' '.self::dump($value->getValue(), $flags);
}
if (Yaml::DUMP_OBJECT & $flags) {
return '!php/object '.self::dump(serialize($value));
}
if (Yaml::DUMP_OBJECT_AS_MAP & $flags && ($value instanceof \stdClass || $value instanceof \ArrayObject)) {
$output = [];
foreach ($value as $key => $val) {
$output[] = sprintf('%s: %s', self::dump($key, $flags), self::dump($val, $flags));
}
return sprintf('{ %s }', implode(', ', $output));
}
if (Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE & $flags) {
throw new DumpException('Object support when dumping a YAML file has been disabled.');
}
return 'null';
case \is_array($value):
return self::dumpArray($value, $flags);
case null === $value:
return 'null';
case true === $value:
return 'true';
case false === $value:
return 'false';
case ctype_digit($value):
return \is_string($value) ? "'$value'" : (int) $value;
case is_numeric($value):
$locale = setlocale(LC_NUMERIC, 0);
if (false !== $locale) {
setlocale(LC_NUMERIC, 'C');
}
if (\is_float($value)) {
$repr = (string) $value;
if (is_infinite($value)) {
$repr = str_ireplace('INF', '.Inf', $repr);
} elseif (floor($value) == $value && $repr == $value) {
// Preserve float data type since storing a whole number will result in integer value.
$repr = '!!float '.$repr;
}
} else {
$repr = \is_string($value) ? "'$value'" : (string) $value;
}
if (false !== $locale) {
setlocale(LC_NUMERIC, $locale);
}
return $repr;
case '' == $value:
return "''";
case self::isBinaryString($value):
return '!!binary '.base64_encode($value);
case Escaper::requiresDoubleQuoting($value):
return Escaper::escapeWithDoubleQuotes($value);
case Escaper::requiresSingleQuoting($value):
case Parser::preg_match('{^[0-9]+[_0-9]*$}', $value):
case Parser::preg_match(self::getHexRegex(), $value):
case Parser::preg_match(self::getTimestampRegex(), $value):
return Escaper::escapeWithSingleQuotes($value);
default:
return $value;
}
} | php | public static function dump($value, int $flags = 0): string
{
switch (true) {
case \is_resource($value):
if (Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE & $flags) {
throw new DumpException(sprintf('Unable to dump PHP resources in a YAML file ("%s").', get_resource_type($value)));
}
return 'null';
case $value instanceof \DateTimeInterface:
return $value->format('c');
case \is_object($value):
if ($value instanceof TaggedValue) {
return '!'.$value->getTag().' '.self::dump($value->getValue(), $flags);
}
if (Yaml::DUMP_OBJECT & $flags) {
return '!php/object '.self::dump(serialize($value));
}
if (Yaml::DUMP_OBJECT_AS_MAP & $flags && ($value instanceof \stdClass || $value instanceof \ArrayObject)) {
$output = [];
foreach ($value as $key => $val) {
$output[] = sprintf('%s: %s', self::dump($key, $flags), self::dump($val, $flags));
}
return sprintf('{ %s }', implode(', ', $output));
}
if (Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE & $flags) {
throw new DumpException('Object support when dumping a YAML file has been disabled.');
}
return 'null';
case \is_array($value):
return self::dumpArray($value, $flags);
case null === $value:
return 'null';
case true === $value:
return 'true';
case false === $value:
return 'false';
case ctype_digit($value):
return \is_string($value) ? "'$value'" : (int) $value;
case is_numeric($value):
$locale = setlocale(LC_NUMERIC, 0);
if (false !== $locale) {
setlocale(LC_NUMERIC, 'C');
}
if (\is_float($value)) {
$repr = (string) $value;
if (is_infinite($value)) {
$repr = str_ireplace('INF', '.Inf', $repr);
} elseif (floor($value) == $value && $repr == $value) {
// Preserve float data type since storing a whole number will result in integer value.
$repr = '!!float '.$repr;
}
} else {
$repr = \is_string($value) ? "'$value'" : (string) $value;
}
if (false !== $locale) {
setlocale(LC_NUMERIC, $locale);
}
return $repr;
case '' == $value:
return "''";
case self::isBinaryString($value):
return '!!binary '.base64_encode($value);
case Escaper::requiresDoubleQuoting($value):
return Escaper::escapeWithDoubleQuotes($value);
case Escaper::requiresSingleQuoting($value):
case Parser::preg_match('{^[0-9]+[_0-9]*$}', $value):
case Parser::preg_match(self::getHexRegex(), $value):
case Parser::preg_match(self::getTimestampRegex(), $value):
return Escaper::escapeWithSingleQuotes($value);
default:
return $value;
}
} | [
"public",
"static",
"function",
"dump",
"(",
"$",
"value",
",",
"int",
"$",
"flags",
"=",
"0",
")",
":",
"string",
"{",
"switch",
"(",
"true",
")",
"{",
"case",
"\\",
"is_resource",
"(",
"$",
"value",
")",
":",
"if",
"(",
"Yaml",
"::",
"DUMP_EXCEPT... | Dumps a given PHP variable to a YAML string.
@param mixed $value The PHP variable to convert
@param int $flags A bit field of Yaml::DUMP_* constants to customize the dumped YAML string
@return string The YAML string representing the PHP value
@throws DumpException When trying to dump PHP resource | [
"Dumps",
"a",
"given",
"PHP",
"variable",
"to",
"a",
"YAML",
"string",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Yaml/Inline.php#L124-L204 | train | Dump a value to a YAML string | [
30522,
2270,
10763,
3853,
15653,
1006,
1002,
3643,
1010,
20014,
1002,
9245,
1027,
1014,
1007,
1024,
5164,
1063,
6942,
1006,
2995,
1007,
1063,
2553,
1032,
2003,
1035,
7692,
1006,
1002,
3643,
1007,
1024,
2065,
1006,
8038,
19968,
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... |
getgrav/grav | system/src/Grav/Common/Service/ConfigServiceProvider.php | ConfigServiceProvider.pluginFolderPaths | private static function pluginFolderPaths($plugins, $folder_path)
{
$paths = [];
foreach ($plugins as $path) {
$iterator = new \DirectoryIterator($path);
/** @var \DirectoryIterator $directory */
foreach ($iterator as $directory) {
if (!$directory->isDir() || $directory->isDot()) {
continue;
}
// Path to the languages folder
$lang_path = $directory->getPathName() . '/' . $folder_path;
// If this folder exists, add it to the list of paths
if (file_exists($lang_path)) {
$paths []= $lang_path;
}
}
}
return $paths;
} | php | private static function pluginFolderPaths($plugins, $folder_path)
{
$paths = [];
foreach ($plugins as $path) {
$iterator = new \DirectoryIterator($path);
/** @var \DirectoryIterator $directory */
foreach ($iterator as $directory) {
if (!$directory->isDir() || $directory->isDot()) {
continue;
}
// Path to the languages folder
$lang_path = $directory->getPathName() . '/' . $folder_path;
// If this folder exists, add it to the list of paths
if (file_exists($lang_path)) {
$paths []= $lang_path;
}
}
}
return $paths;
} | [
"private",
"static",
"function",
"pluginFolderPaths",
"(",
"$",
"plugins",
",",
"$",
"folder_path",
")",
"{",
"$",
"paths",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"plugins",
"as",
"$",
"path",
")",
"{",
"$",
"iterator",
"=",
"new",
"\\",
"DirectoryIt... | Find specific paths in plugins
@param array $plugins
@param string $folder_path
@return array | [
"Find",
"specific",
"paths",
"in",
"plugins"
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Service/ConfigServiceProvider.php#L147-L170 | train | Get paths to the languages folder | [
30522,
2797,
10763,
3853,
13354,
2378,
10371,
2121,
15069,
2015,
1006,
1002,
13354,
7076,
1010,
1002,
19622,
1035,
4130,
1007,
1063,
1002,
10425,
1027,
1031,
1033,
1025,
18921,
6776,
1006,
1002,
13354,
7076,
2004,
1002,
4130,
1007,
1063,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/cms/classes/Page.php | Page.getNameList | public static function getNameList()
{
$result = [];
$pages = self::sortBy('baseFileName')->all();
foreach ($pages as $page) {
$result[$page->baseFileName] = $page->title . ' (' . $page->baseFileName . ')';
}
return $result;
} | php | public static function getNameList()
{
$result = [];
$pages = self::sortBy('baseFileName')->all();
foreach ($pages as $page) {
$result[$page->baseFileName] = $page->title . ' (' . $page->baseFileName . ')';
}
return $result;
} | [
"public",
"static",
"function",
"getNameList",
"(",
")",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"$",
"pages",
"=",
"self",
"::",
"sortBy",
"(",
"'baseFileName'",
")",
"->",
"all",
"(",
")",
";",
"foreach",
"(",
"$",
"pages",
"as",
"$",
"page",
")"... | Helper that returns a nicer list of pages for use in dropdowns.
@return array | [
"Helper",
"that",
"returns",
"a",
"nicer",
"list",
"of",
"pages",
"for",
"use",
"in",
"dropdowns",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/Page.php#L104-L113 | train | Get Name List | [
30522,
2270,
10763,
30524,
1007,
1025,
18921,
6776,
1006,
1002,
5530,
2004,
1002,
3931,
1007,
1063,
1002,
2765,
1031,
1002,
3931,
1011,
1028,
2918,
8873,
20844,
4168,
1033,
1027,
1002,
3931,
1011,
1028,
2516,
1012,
1005,
1006,
1005,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
overtrue/wechat | src/OpenPlatform/Base/Client.php | Client.setAuthorizerOption | public function setAuthorizerOption(string $appId, string $name, string $value)
{
$params = [
'component_appid' => $this->app['config']['app_id'],
'authorizer_appid' => $appId,
'option_name' => $name,
'option_value' => $value,
];
return $this->httpPostJson('cgi-bin/component/api_set_authorizer_option', $params);
} | php | public function setAuthorizerOption(string $appId, string $name, string $value)
{
$params = [
'component_appid' => $this->app['config']['app_id'],
'authorizer_appid' => $appId,
'option_name' => $name,
'option_value' => $value,
];
return $this->httpPostJson('cgi-bin/component/api_set_authorizer_option', $params);
} | [
"public",
"function",
"setAuthorizerOption",
"(",
"string",
"$",
"appId",
",",
"string",
"$",
"name",
",",
"string",
"$",
"value",
")",
"{",
"$",
"params",
"=",
"[",
"'component_appid'",
"=>",
"$",
"this",
"->",
"app",
"[",
"'config'",
"]",
"[",
"'app_id... | Set authorizer option.
@param string $appId
@param string $name
@param string $value
@return mixed | [
"Set",
"authorizer",
"option",
"."
] | 120c72faaa93c270365bc75c73c362d5fd583209 | https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/OpenPlatform/Base/Client.php#L85-L95 | train | Set authorizer option | [
30522,
2270,
3853,
2275,
4887,
27844,
17629,
7361,
3508,
1006,
5164,
1002,
10439,
3593,
1010,
5164,
1002,
2171,
1010,
5164,
1002,
3643,
1007,
1063,
1002,
11498,
5244,
1027,
1031,
1005,
6922,
1035,
10439,
3593,
1005,
1027,
1028,
1002,
2023,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/Tracker/GoalManager.php | GoalManager.getCleanedEcommerceItems | private function getCleanedEcommerceItems($items)
{
// Clean up the items array
$cleanedItems = array();
foreach ($items as $item) {
$name = $category = $category2 = $category3 = $category4 = $category5 = false;
$price = 0;
$quantity = 1;
// items are passed in the request as an array: ( $sku, $name, $category, $price, $quantity )
if (empty($item[self::INDEX_ITEM_SKU])) {
continue;
}
$sku = $item[self::INDEX_ITEM_SKU];
if (!empty($item[self::INDEX_ITEM_NAME])) {
$name = $item[self::INDEX_ITEM_NAME];
}
if (!empty($item[self::INDEX_ITEM_CATEGORY])) {
$category = $item[self::INDEX_ITEM_CATEGORY];
}
if (isset($item[self::INDEX_ITEM_PRICE])
&& is_numeric($item[self::INDEX_ITEM_PRICE])
) {
$price = $this->getRevenue($item[self::INDEX_ITEM_PRICE]);
}
if (!empty($item[self::INDEX_ITEM_QUANTITY])
&& is_numeric($item[self::INDEX_ITEM_QUANTITY])
) {
$quantity = (int)$item[self::INDEX_ITEM_QUANTITY];
}
// self::INDEX_ITEM_* are in order
$cleanedItems[] = array(
self::INTERNAL_ITEM_SKU => $sku,
self::INTERNAL_ITEM_NAME => $name,
self::INTERNAL_ITEM_CATEGORY => $category,
self::INTERNAL_ITEM_CATEGORY2 => $category2,
self::INTERNAL_ITEM_CATEGORY3 => $category3,
self::INTERNAL_ITEM_CATEGORY4 => $category4,
self::INTERNAL_ITEM_CATEGORY5 => $category5,
self::INTERNAL_ITEM_PRICE => $price,
self::INTERNAL_ITEM_QUANTITY => $quantity
);
}
// Lookup Item SKUs, Names & Categories Ids
$actionsToLookupAllItems = array();
// Each item has 7 potential "ids" to lookup in the lookup table
$columnsInEachRow = 1 + 1 + self::MAXIMUM_PRODUCT_CATEGORIES;
foreach ($cleanedItems as $item) {
$actionsToLookup = array();
list($sku, $name, $category, $price, $quantity) = $item;
$actionsToLookup[] = array(trim($sku), Action::TYPE_ECOMMERCE_ITEM_SKU);
$actionsToLookup[] = array(trim($name), Action::TYPE_ECOMMERCE_ITEM_NAME);
// Only one category
if (!is_array($category)) {
$actionsToLookup[] = array(trim($category), Action::TYPE_ECOMMERCE_ITEM_CATEGORY);
} // Multiple categories
else {
$countCategories = 0;
foreach ($category as $productCategory) {
$productCategory = trim($productCategory);
if (empty($productCategory)) {
continue;
}
$countCategories++;
if ($countCategories > self::MAXIMUM_PRODUCT_CATEGORIES) {
break;
}
$actionsToLookup[] = array($productCategory, Action::TYPE_ECOMMERCE_ITEM_CATEGORY);
}
}
// Ensure that each row has the same number of columns, fill in the blanks
for ($i = count($actionsToLookup); $i < $columnsInEachRow; $i++) {
$actionsToLookup[] = array(false, Action::TYPE_ECOMMERCE_ITEM_CATEGORY);
}
$actionsToLookupAllItems = array_merge($actionsToLookupAllItems, $actionsToLookup);
}
$actionsLookedUp = TableLogAction::loadIdsAction($actionsToLookupAllItems);
// Replace SKU, name & category by their ID action
foreach ($cleanedItems as $index => &$item) {
// SKU
$item[0] = $actionsLookedUp[$index * $columnsInEachRow + 0];
// Name
$item[1] = $actionsLookedUp[$index * $columnsInEachRow + 1];
// Categories
$item[2] = $actionsLookedUp[$index * $columnsInEachRow + 2];
$item[3] = $actionsLookedUp[$index * $columnsInEachRow + 3];
$item[4] = $actionsLookedUp[$index * $columnsInEachRow + 4];
$item[5] = $actionsLookedUp[$index * $columnsInEachRow + 5];
$item[6] = $actionsLookedUp[$index * $columnsInEachRow + 6];
}
return $cleanedItems;
} | php | private function getCleanedEcommerceItems($items)
{
// Clean up the items array
$cleanedItems = array();
foreach ($items as $item) {
$name = $category = $category2 = $category3 = $category4 = $category5 = false;
$price = 0;
$quantity = 1;
// items are passed in the request as an array: ( $sku, $name, $category, $price, $quantity )
if (empty($item[self::INDEX_ITEM_SKU])) {
continue;
}
$sku = $item[self::INDEX_ITEM_SKU];
if (!empty($item[self::INDEX_ITEM_NAME])) {
$name = $item[self::INDEX_ITEM_NAME];
}
if (!empty($item[self::INDEX_ITEM_CATEGORY])) {
$category = $item[self::INDEX_ITEM_CATEGORY];
}
if (isset($item[self::INDEX_ITEM_PRICE])
&& is_numeric($item[self::INDEX_ITEM_PRICE])
) {
$price = $this->getRevenue($item[self::INDEX_ITEM_PRICE]);
}
if (!empty($item[self::INDEX_ITEM_QUANTITY])
&& is_numeric($item[self::INDEX_ITEM_QUANTITY])
) {
$quantity = (int)$item[self::INDEX_ITEM_QUANTITY];
}
// self::INDEX_ITEM_* are in order
$cleanedItems[] = array(
self::INTERNAL_ITEM_SKU => $sku,
self::INTERNAL_ITEM_NAME => $name,
self::INTERNAL_ITEM_CATEGORY => $category,
self::INTERNAL_ITEM_CATEGORY2 => $category2,
self::INTERNAL_ITEM_CATEGORY3 => $category3,
self::INTERNAL_ITEM_CATEGORY4 => $category4,
self::INTERNAL_ITEM_CATEGORY5 => $category5,
self::INTERNAL_ITEM_PRICE => $price,
self::INTERNAL_ITEM_QUANTITY => $quantity
);
}
// Lookup Item SKUs, Names & Categories Ids
$actionsToLookupAllItems = array();
// Each item has 7 potential "ids" to lookup in the lookup table
$columnsInEachRow = 1 + 1 + self::MAXIMUM_PRODUCT_CATEGORIES;
foreach ($cleanedItems as $item) {
$actionsToLookup = array();
list($sku, $name, $category, $price, $quantity) = $item;
$actionsToLookup[] = array(trim($sku), Action::TYPE_ECOMMERCE_ITEM_SKU);
$actionsToLookup[] = array(trim($name), Action::TYPE_ECOMMERCE_ITEM_NAME);
// Only one category
if (!is_array($category)) {
$actionsToLookup[] = array(trim($category), Action::TYPE_ECOMMERCE_ITEM_CATEGORY);
} // Multiple categories
else {
$countCategories = 0;
foreach ($category as $productCategory) {
$productCategory = trim($productCategory);
if (empty($productCategory)) {
continue;
}
$countCategories++;
if ($countCategories > self::MAXIMUM_PRODUCT_CATEGORIES) {
break;
}
$actionsToLookup[] = array($productCategory, Action::TYPE_ECOMMERCE_ITEM_CATEGORY);
}
}
// Ensure that each row has the same number of columns, fill in the blanks
for ($i = count($actionsToLookup); $i < $columnsInEachRow; $i++) {
$actionsToLookup[] = array(false, Action::TYPE_ECOMMERCE_ITEM_CATEGORY);
}
$actionsToLookupAllItems = array_merge($actionsToLookupAllItems, $actionsToLookup);
}
$actionsLookedUp = TableLogAction::loadIdsAction($actionsToLookupAllItems);
// Replace SKU, name & category by their ID action
foreach ($cleanedItems as $index => &$item) {
// SKU
$item[0] = $actionsLookedUp[$index * $columnsInEachRow + 0];
// Name
$item[1] = $actionsLookedUp[$index * $columnsInEachRow + 1];
// Categories
$item[2] = $actionsLookedUp[$index * $columnsInEachRow + 2];
$item[3] = $actionsLookedUp[$index * $columnsInEachRow + 3];
$item[4] = $actionsLookedUp[$index * $columnsInEachRow + 4];
$item[5] = $actionsLookedUp[$index * $columnsInEachRow + 5];
$item[6] = $actionsLookedUp[$index * $columnsInEachRow + 6];
}
return $cleanedItems;
} | [
"private",
"function",
"getCleanedEcommerceItems",
"(",
"$",
"items",
")",
"{",
"// Clean up the items array",
"$",
"cleanedItems",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"items",
"as",
"$",
"item",
")",
"{",
"$",
"name",
"=",
"$",
"category",
"... | Reads items from the request, then looks up the names from the lookup table
and returns a clean array of items ready for the database.
@param array $items
@return array $cleanedItems | [
"Reads",
"items",
"from",
"the",
"request",
"then",
"looks",
"up",
"the",
"names",
"from",
"the",
"lookup",
"table",
"and",
"returns",
"a",
"clean",
"array",
"of",
"items",
"ready",
"for",
"the",
"database",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Tracker/GoalManager.php#L456-L558 | train | Clean up the ecommerce items array | [
30522,
2797,
3853,
2131,
14321,
7231,
3207,
9006,
5017,
3401,
4221,
5244,
1006,
1002,
5167,
1007,
1063,
1013,
1013,
4550,
2039,
1996,
5167,
9140,
1002,
12176,
4221,
5244,
1027,
9140,
1006,
1007,
1025,
18921,
6776,
1006,
1002,
5167,
2004,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/system/classes/UpdateManager.php | UpdateManager.update | public function update()
{
$firstUp = !Schema::hasTable($this->getMigrationTableName());
if ($firstUp) {
$this->repository->createRepository();
$this->note('Migration table created');
}
/*
* Update modules
*/
$modules = Config::get('cms.loadModules', []);
foreach ($modules as $module) {
$this->migrateModule($module);
}
/*
* Update plugins
*/
$plugins = $this->pluginManager->sortByDependencies();
foreach ($plugins as $plugin) {
$this->updatePlugin($plugin);
}
Parameter::set('system::update.count', 0);
CacheHelper::clear();
/*
* Seed modules
*/
if ($firstUp) {
$modules = Config::get('cms.loadModules', []);
foreach ($modules as $module) {
$this->seedModule($module);
}
}
return $this;
} | php | public function update()
{
$firstUp = !Schema::hasTable($this->getMigrationTableName());
if ($firstUp) {
$this->repository->createRepository();
$this->note('Migration table created');
}
/*
* Update modules
*/
$modules = Config::get('cms.loadModules', []);
foreach ($modules as $module) {
$this->migrateModule($module);
}
/*
* Update plugins
*/
$plugins = $this->pluginManager->sortByDependencies();
foreach ($plugins as $plugin) {
$this->updatePlugin($plugin);
}
Parameter::set('system::update.count', 0);
CacheHelper::clear();
/*
* Seed modules
*/
if ($firstUp) {
$modules = Config::get('cms.loadModules', []);
foreach ($modules as $module) {
$this->seedModule($module);
}
}
return $this;
} | [
"public",
"function",
"update",
"(",
")",
"{",
"$",
"firstUp",
"=",
"!",
"Schema",
"::",
"hasTable",
"(",
"$",
"this",
"->",
"getMigrationTableName",
"(",
")",
")",
";",
"if",
"(",
"$",
"firstUp",
")",
"{",
"$",
"this",
"->",
"repository",
"->",
"cre... | Creates the migration table and updates
@return self | [
"Creates",
"the",
"migration",
"table",
"and",
"updates"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/UpdateManager.php#L133-L171 | train | Update modules and plugins | [
30522,
2270,
3853,
10651,
1006,
1007,
1063,
1002,
2034,
6279,
1027,
999,
8040,
28433,
1024,
1024,
2038,
10880,
1006,
1002,
2023,
1011,
1028,
2131,
4328,
29397,
10880,
18442,
1006,
1007,
1007,
1025,
2065,
1006,
1002,
2034,
6279,
1007,
1063,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
dompdf/dompdf | lib/Cpdf.php | Cpdf.utf8toCodePointsArray | function utf8toCodePointsArray(&$text)
{
$length = mb_strlen($text, '8bit'); // http://www.php.net/manual/en/function.mb-strlen.php#77040
$unicode = array(); // array containing unicode values
$bytes = array(); // array containing single character byte sequences
$numbytes = 1; // number of octets needed to represent the UTF-8 character
for ($i = 0; $i < $length; $i++) {
$c = ord($text[$i]); // get one string character at time
if (count($bytes) === 0) { // get starting octect
if ($c <= 0x7F) {
$unicode[] = $c; // use the character "as is" because is ASCII
$numbytes = 1;
} elseif (($c >> 0x05) === 0x06) { // 2 bytes character (0x06 = 110 BIN)
$bytes[] = ($c - 0xC0) << 0x06;
$numbytes = 2;
} elseif (($c >> 0x04) === 0x0E) { // 3 bytes character (0x0E = 1110 BIN)
$bytes[] = ($c - 0xE0) << 0x0C;
$numbytes = 3;
} elseif (($c >> 0x03) === 0x1E) { // 4 bytes character (0x1E = 11110 BIN)
$bytes[] = ($c - 0xF0) << 0x12;
$numbytes = 4;
} else {
// use replacement character for other invalid sequences
$unicode[] = 0xFFFD;
$bytes = array();
$numbytes = 1;
}
} elseif (($c >> 0x06) === 0x02) { // bytes 2, 3 and 4 must start with 0x02 = 10 BIN
$bytes[] = $c - 0x80;
if (count($bytes) === $numbytes) {
// compose UTF-8 bytes to a single unicode value
$c = $bytes[0];
for ($j = 1; $j < $numbytes; $j++) {
$c += ($bytes[$j] << (($numbytes - $j - 1) * 0x06));
}
if ((($c >= 0xD800) AND ($c <= 0xDFFF)) OR ($c >= 0x10FFFF)) {
// The definition of UTF-8 prohibits encoding character numbers between
// U+D800 and U+DFFF, which are reserved for use with the UTF-16
// encoding form (as surrogate pairs) and do not directly represent
// characters.
$unicode[] = 0xFFFD; // use replacement character
} else {
$unicode[] = $c; // add char to array
}
// reset data for next char
$bytes = array();
$numbytes = 1;
}
} else {
// use replacement character for other invalid sequences
$unicode[] = 0xFFFD;
$bytes = array();
$numbytes = 1;
}
} | php | function utf8toCodePointsArray(&$text)
{
$length = mb_strlen($text, '8bit'); // http://www.php.net/manual/en/function.mb-strlen.php#77040
$unicode = array(); // array containing unicode values
$bytes = array(); // array containing single character byte sequences
$numbytes = 1; // number of octets needed to represent the UTF-8 character
for ($i = 0; $i < $length; $i++) {
$c = ord($text[$i]); // get one string character at time
if (count($bytes) === 0) { // get starting octect
if ($c <= 0x7F) {
$unicode[] = $c; // use the character "as is" because is ASCII
$numbytes = 1;
} elseif (($c >> 0x05) === 0x06) { // 2 bytes character (0x06 = 110 BIN)
$bytes[] = ($c - 0xC0) << 0x06;
$numbytes = 2;
} elseif (($c >> 0x04) === 0x0E) { // 3 bytes character (0x0E = 1110 BIN)
$bytes[] = ($c - 0xE0) << 0x0C;
$numbytes = 3;
} elseif (($c >> 0x03) === 0x1E) { // 4 bytes character (0x1E = 11110 BIN)
$bytes[] = ($c - 0xF0) << 0x12;
$numbytes = 4;
} else {
// use replacement character for other invalid sequences
$unicode[] = 0xFFFD;
$bytes = array();
$numbytes = 1;
}
} elseif (($c >> 0x06) === 0x02) { // bytes 2, 3 and 4 must start with 0x02 = 10 BIN
$bytes[] = $c - 0x80;
if (count($bytes) === $numbytes) {
// compose UTF-8 bytes to a single unicode value
$c = $bytes[0];
for ($j = 1; $j < $numbytes; $j++) {
$c += ($bytes[$j] << (($numbytes - $j - 1) * 0x06));
}
if ((($c >= 0xD800) AND ($c <= 0xDFFF)) OR ($c >= 0x10FFFF)) {
// The definition of UTF-8 prohibits encoding character numbers between
// U+D800 and U+DFFF, which are reserved for use with the UTF-16
// encoding form (as surrogate pairs) and do not directly represent
// characters.
$unicode[] = 0xFFFD; // use replacement character
} else {
$unicode[] = $c; // add char to array
}
// reset data for next char
$bytes = array();
$numbytes = 1;
}
} else {
// use replacement character for other invalid sequences
$unicode[] = 0xFFFD;
$bytes = array();
$numbytes = 1;
}
} | [
"function",
"utf8toCodePointsArray",
"(",
"&",
"$",
"text",
")",
"{",
"$",
"length",
"=",
"mb_strlen",
"(",
"$",
"text",
",",
"'8bit'",
")",
";",
"// http://www.php.net/manual/en/function.mb-strlen.php#77040",
"$",
"unicode",
"=",
"array",
"(",
")",
";",
"// arr... | return array containing codepoints (UTF-8 character values) for the
string passed in.
based on the excellent TCPDF code by Nicola Asuni and the
RFC for UTF-8 at http://www.faqs.org/rfcs/rfc3629.html
@access private
@author Orion Richardson
@since January 5, 2008
@param string $text UTF-8 string to process
@return array UTF-8 codepoints array for the string | [
"return",
"array",
"containing",
"codepoints",
"(",
"UTF",
"-",
"8",
"character",
"values",
")",
"for",
"the",
"string",
"passed",
"in",
"."
] | 75f13c700009be21a1965dc2c5b68a8708c22ba2 | https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/lib/Cpdf.php#L4039-L4094 | train | converts UTF - 8 characters to code points array | [
30522,
3853,
21183,
2546,
2620,
3406,
16044,
26521,
2906,
9447,
1006,
1004,
1002,
3793,
1007,
1063,
1002,
3091,
1027,
16914,
1035,
2358,
20927,
2078,
1006,
1002,
3793,
1010,
1005,
1022,
16313,
1005,
1007,
1025,
1013,
1013,
8299,
1024,
1013,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
overtrue/wechat | src/Work/Message/ServiceProvider.php | ServiceProvider.register | public function register(Container $app)
{
$app['message'] = function ($app) {
return new Client($app);
};
$app['messenger'] = function ($app) {
$messenger = new Messenger($app['message']);
if (is_int($app['config']['agent_id'])) {
$messenger->ofAgent($app['config']['agent_id']);
}
return $messenger;
};
} | php | public function register(Container $app)
{
$app['message'] = function ($app) {
return new Client($app);
};
$app['messenger'] = function ($app) {
$messenger = new Messenger($app['message']);
if (is_int($app['config']['agent_id'])) {
$messenger->ofAgent($app['config']['agent_id']);
}
return $messenger;
};
} | [
"public",
"function",
"register",
"(",
"Container",
"$",
"app",
")",
"{",
"$",
"app",
"[",
"'message'",
"]",
"=",
"function",
"(",
"$",
"app",
")",
"{",
"return",
"new",
"Client",
"(",
"$",
"app",
")",
";",
"}",
";",
"$",
"app",
"[",
"'messenger'",... | {@inheritdoc}. | [
"{"
] | 120c72faaa93c270365bc75c73c362d5fd583209 | https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/Work/Message/ServiceProvider.php#L27-L42 | train | Register the message and messenger | [
30522,
2270,
3853,
4236,
1006,
11661,
1002,
10439,
1007,
1063,
1002,
10439,
1031,
1005,
4471,
1005,
1033,
1027,
3853,
1006,
1002,
10439,
1007,
1063,
2709,
2047,
7396,
1006,
1002,
10439,
1007,
1025,
1065,
1025,
1002,
10439,
1031,
1005,
11981... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/CssSelector/Parser/Shortcut/ElementParser.php | ElementParser.parse | public function parse(string $source): array
{
// Matches an optional namespace, required element or `*`
// $source = 'testns|testel';
// $matches = array (size=3)
// 0 => string 'testns|testel' (length=13)
// 1 => string 'testns' (length=6)
// 2 => string 'testel' (length=6)
if (preg_match('/^(?:([a-z]++)\|)?([\w-]++|\*)$/i', trim($source), $matches)) {
return [new SelectorNode(new ElementNode($matches[1] ?: null, $matches[2]))];
}
return [];
} | php | public function parse(string $source): array
{
// Matches an optional namespace, required element or `*`
// $source = 'testns|testel';
// $matches = array (size=3)
// 0 => string 'testns|testel' (length=13)
// 1 => string 'testns' (length=6)
// 2 => string 'testel' (length=6)
if (preg_match('/^(?:([a-z]++)\|)?([\w-]++|\*)$/i', trim($source), $matches)) {
return [new SelectorNode(new ElementNode($matches[1] ?: null, $matches[2]))];
}
return [];
} | [
"public",
"function",
"parse",
"(",
"string",
"$",
"source",
")",
":",
"array",
"{",
"// Matches an optional namespace, required element or `*`",
"// $source = 'testns|testel';",
"// $matches = array (size=3)",
"// 0 => string 'testns|testel' (length=13)",
"// 1 => string 'test... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/CssSelector/Parser/Shortcut/ElementParser.php#L33-L46 | train | Parse the source string into an array of SelectorNode objects | [
30522,
2270,
3853,
11968,
3366,
1006,
5164,
1002,
3120,
1007,
1024,
9140,
1063,
1013,
1013,
3503,
2019,
11887,
3415,
15327,
1010,
3223,
5783,
2030,
1036,
1008,
1036,
1013,
1013,
1002,
3120,
1027,
1005,
3231,
3619,
1064,
3231,
2884,
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/Relations/Concerns/AsPivot.php | AsPivot.getDeleteQuery | protected function getDeleteQuery()
{
return $this->newQueryWithoutRelationships()->where([
$this->foreignKey => $this->getOriginal($this->foreignKey, $this->getAttribute($this->foreignKey)),
$this->relatedKey => $this->getOriginal($this->relatedKey, $this->getAttribute($this->relatedKey)),
]);
} | php | protected function getDeleteQuery()
{
return $this->newQueryWithoutRelationships()->where([
$this->foreignKey => $this->getOriginal($this->foreignKey, $this->getAttribute($this->foreignKey)),
$this->relatedKey => $this->getOriginal($this->relatedKey, $this->getAttribute($this->relatedKey)),
]);
} | [
"protected",
"function",
"getDeleteQuery",
"(",
")",
"{",
"return",
"$",
"this",
"->",
"newQueryWithoutRelationships",
"(",
")",
"->",
"where",
"(",
"[",
"$",
"this",
"->",
"foreignKey",
"=>",
"$",
"this",
"->",
"getOriginal",
"(",
"$",
"this",
"->",
"fore... | Get the query builder for a delete operation on the pivot.
@return \Illuminate\Database\Eloquent\Builder | [
"Get",
"the",
"query",
"builder",
"for",
"a",
"delete",
"operation",
"on",
"the",
"pivot",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Relations/Concerns/AsPivot.php#L133-L139 | train | Get new query without relationships | [
30522,
5123,
3853,
2131,
9247,
12870,
4226,
2854,
1006,
1007,
1063,
2709,
1002,
2023,
1011,
1028,
2047,
4226,
2854,
24415,
5833,
16570,
10708,
19801,
1006,
1007,
1011,
1028,
2073,
1006,
1031,
1002,
2023,
1011,
1028,
3097,
14839,
1027,
1028,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/Zend/Cache/Core.php | Zend_Cache_Core.getTags | public function getTags()
{
if (!$this->_extendedBackend) {
Zend_Cache::throwException(self::BACKEND_NOT_IMPLEMENTS_EXTENDED_IF);
}
if (!($this->_backendCapabilities['tags'])) {
Zend_Cache::throwException(self::BACKEND_NOT_SUPPORTS_TAG);
}
return $this->_backend->getTags();
} | php | public function getTags()
{
if (!$this->_extendedBackend) {
Zend_Cache::throwException(self::BACKEND_NOT_IMPLEMENTS_EXTENDED_IF);
}
if (!($this->_backendCapabilities['tags'])) {
Zend_Cache::throwException(self::BACKEND_NOT_SUPPORTS_TAG);
}
return $this->_backend->getTags();
} | [
"public",
"function",
"getTags",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"_extendedBackend",
")",
"{",
"Zend_Cache",
"::",
"throwException",
"(",
"self",
"::",
"BACKEND_NOT_IMPLEMENTS_EXTENDED_IF",
")",
";",
"}",
"if",
"(",
"!",
"(",
"$",
"this",... | Return an array of stored tags
@return array array of stored tags (string) | [
"Return",
"an",
"array",
"of",
"stored",
"tags"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Cache/Core.php#L598-L607 | train | Get all tags from the cache | [
30522,
2270,
3853,
2131,
15900,
2015,
1006,
1007,
1063,
2065,
1006,
999,
1002,
2023,
1011,
1028,
1035,
3668,
5963,
10497,
1007,
1063,
16729,
2094,
1035,
17053,
1024,
1024,
5466,
10288,
24422,
1006,
2969,
1024,
1024,
2067,
10497,
1035,
2025,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php | HttpCache.record | private function record(Request $request, string $event)
{
$this->traces[$this->getTraceKey($request)][] = $event;
} | php | private function record(Request $request, string $event)
{
$this->traces[$this->getTraceKey($request)][] = $event;
} | [
"private",
"function",
"record",
"(",
"Request",
"$",
"request",
",",
"string",
"$",
"event",
")",
"{",
"$",
"this",
"->",
"traces",
"[",
"$",
"this",
"->",
"getTraceKey",
"(",
"$",
"request",
")",
"]",
"[",
"]",
"=",
"$",
"event",
";",
"}"
] | Records that an event took place. | [
"Records",
"that",
"an",
"event",
"took",
"place",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php#L668-L671 | train | Records an event for the current request. | [
30522,
2797,
3853,
2501,
1006,
5227,
1002,
5227,
1010,
5164,
1002,
2724,
1007,
1063,
1002,
2023,
1011,
1028,
10279,
1031,
1002,
2023,
1011,
1028,
2131,
6494,
25368,
3240,
1006,
1002,
5227,
1007,
1033,
1031,
1033,
1027,
1002,
2724,
1025,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/system/models/Parameter.php | Parameter.scopeApplyKey | public function scopeApplyKey($query, $key)
{
list($namespace, $group, $item) = $this->parseKey($key);
$query = $query
->where('namespace', $namespace)
->where('group', $group)
->where('item', $item);
return $query;
} | php | public function scopeApplyKey($query, $key)
{
list($namespace, $group, $item) = $this->parseKey($key);
$query = $query
->where('namespace', $namespace)
->where('group', $group)
->where('item', $item);
return $query;
} | [
"public",
"function",
"scopeApplyKey",
"(",
"$",
"query",
",",
"$",
"key",
")",
"{",
"list",
"(",
"$",
"namespace",
",",
"$",
"group",
",",
"$",
"item",
")",
"=",
"$",
"this",
"->",
"parseKey",
"(",
"$",
"key",
")",
";",
"$",
"query",
"=",
"$",
... | Scope to find a setting record for the specified module (or plugin) name and setting name.
@param string $key Specifies the setting key value, for example 'system:updates.check'
@param mixed $default The default value to return if the setting doesn't exist in the DB.
@return QueryBuilder | [
"Scope",
"to",
"find",
"a",
"setting",
"record",
"for",
"the",
"specified",
"module",
"(",
"or",
"plugin",
")",
"name",
"and",
"setting",
"name",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/models/Parameter.php#L130-L140 | train | Apply a key to a query | [
30522,
2270,
3853,
9531,
29098,
2135,
14839,
1006,
1002,
23032,
1010,
1002,
3145,
1007,
1063,
2862,
1006,
1002,
3415,
15327,
1010,
1002,
2177,
1010,
1002,
8875,
1007,
1027,
1002,
2023,
1011,
1028,
11968,
3366,
14839,
1006,
1002,
3145,
1007,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/CoreHome/Tracker/VisitRequestProcessor.php | VisitRequestProcessor.isLastActionInTheSameVisit | protected function isLastActionInTheSameVisit(VisitProperties $visitProperties, Request $request)
{
$lastActionTime = $visitProperties->getProperty('visit_last_action_time');
return isset($lastActionTime)
&& false !== $lastActionTime
&& ($lastActionTime > ($request->getCurrentTimestamp() - $this->visitStandardLength));
} | php | protected function isLastActionInTheSameVisit(VisitProperties $visitProperties, Request $request)
{
$lastActionTime = $visitProperties->getProperty('visit_last_action_time');
return isset($lastActionTime)
&& false !== $lastActionTime
&& ($lastActionTime > ($request->getCurrentTimestamp() - $this->visitStandardLength));
} | [
"protected",
"function",
"isLastActionInTheSameVisit",
"(",
"VisitProperties",
"$",
"visitProperties",
",",
"Request",
"$",
"request",
")",
"{",
"$",
"lastActionTime",
"=",
"$",
"visitProperties",
"->",
"getProperty",
"(",
"'visit_last_action_time'",
")",
";",
"return... | Returns true if the last action was done during the last 30 minutes
@return bool | [
"Returns",
"true",
"if",
"the",
"last",
"action",
"was",
"done",
"during",
"the",
"last",
"30",
"minutes"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/CoreHome/Tracker/VisitRequestProcessor.php#L179-L186 | train | Returns true if the last action was in the same visit | [
30522,
5123,
3853,
25340,
9153,
7542,
18447,
15689,
14074,
11365,
4183,
1006,
3942,
21572,
4842,
7368,
1002,
3942,
21572,
4842,
7368,
1010,
5227,
1002,
5227,
1007,
1063,
1002,
2197,
18908,
3258,
7292,
1027,
1002,
3942,
21572,
4842,
7368,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/cms/classes/CodeParser.php | CodeParser.parse | public function parse()
{
/*
* If the object has already been parsed in this request return the cached data.
*/
if (array_key_exists($this->filePath, self::$cache)) {
self::$cache[$this->filePath]['source'] = 'request-cache';
return self::$cache[$this->filePath];
}
/*
* Try to load the parsed data from the cache
*/
$path = $this->getCacheFilePath();
$result = [
'filePath' => $path,
'className' => null,
'source' => null,
'offset' => 0
];
/*
* There are two types of possible caching scenarios, either stored
* in the cache itself, or stored as a cache file. In both cases,
* make sure the cache is not stale and use it.
*/
if (is_file($path)) {
$cachedInfo = $this->getCachedFileInfo();
$hasCache = $cachedInfo !== null;
/*
* Valid cache, return result
*/
if ($hasCache && $cachedInfo['mtime'] == $this->object->mtime) {
$result['className'] = $cachedInfo['className'];
$result['source'] = 'cache';
return self::$cache[$this->filePath] = $result;
}
/*
* Cache expired, cache file not stale, refresh cache and return result
*/
if (!$hasCache && filemtime($path) >= $this->object->mtime) {
$className = $this->extractClassFromFile($path);
if ($className) {
$result['className'] = $className;
$result['source'] = 'file-cache';
$this->storeCachedInfo($result);
return $result;
}
}
}
$result['className'] = $this->rebuild($path);
$result['source'] = 'parser';
$this->storeCachedInfo($result);
return $result;
} | php | public function parse()
{
/*
* If the object has already been parsed in this request return the cached data.
*/
if (array_key_exists($this->filePath, self::$cache)) {
self::$cache[$this->filePath]['source'] = 'request-cache';
return self::$cache[$this->filePath];
}
/*
* Try to load the parsed data from the cache
*/
$path = $this->getCacheFilePath();
$result = [
'filePath' => $path,
'className' => null,
'source' => null,
'offset' => 0
];
/*
* There are two types of possible caching scenarios, either stored
* in the cache itself, or stored as a cache file. In both cases,
* make sure the cache is not stale and use it.
*/
if (is_file($path)) {
$cachedInfo = $this->getCachedFileInfo();
$hasCache = $cachedInfo !== null;
/*
* Valid cache, return result
*/
if ($hasCache && $cachedInfo['mtime'] == $this->object->mtime) {
$result['className'] = $cachedInfo['className'];
$result['source'] = 'cache';
return self::$cache[$this->filePath] = $result;
}
/*
* Cache expired, cache file not stale, refresh cache and return result
*/
if (!$hasCache && filemtime($path) >= $this->object->mtime) {
$className = $this->extractClassFromFile($path);
if ($className) {
$result['className'] = $className;
$result['source'] = 'file-cache';
$this->storeCachedInfo($result);
return $result;
}
}
}
$result['className'] = $this->rebuild($path);
$result['source'] = 'parser';
$this->storeCachedInfo($result);
return $result;
} | [
"public",
"function",
"parse",
"(",
")",
"{",
"/*\n * If the object has already been parsed in this request return the cached data.\n */",
"if",
"(",
"array_key_exists",
"(",
"$",
"this",
"->",
"filePath",
",",
"self",
"::",
"$",
"cache",
")",
")",
"{",
... | Parses the CMS object's PHP code section and returns an array with the following keys:
- className
- filePath (path to the parsed PHP file)
- offset (PHP section offset in the template file)
- source ('parser', 'request-cache', or 'cache')
@return array | [
"Parses",
"the",
"CMS",
"object",
"s",
"PHP",
"code",
"section",
"and",
"returns",
"an",
"array",
"with",
"the",
"following",
"keys",
":",
"-",
"className",
"-",
"filePath",
"(",
"path",
"to",
"the",
"parsed",
"PHP",
"file",
")",
"-",
"offset",
"(",
"P... | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/CodeParser.php#L56-L117 | train | Parse the parsed data | [
30522,
2270,
3853,
11968,
3366,
1006,
1007,
1063,
1013,
1008,
1008,
2065,
1996,
4874,
2038,
2525,
2042,
11968,
6924,
1999,
2023,
5227,
2709,
1996,
17053,
2094,
2951,
1012,
1008,
1013,
2065,
1006,
9140,
1035,
3145,
1035,
6526,
1006,
1002,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
overtrue/wechat | src/Kernel/BaseClient.php | BaseClient.logMiddleware | protected function logMiddleware()
{
$formatter = new MessageFormatter($this->app['config']['http.log_template'] ?? MessageFormatter::DEBUG);
return Middleware::log($this->app['logger'], $formatter);
} | php | protected function logMiddleware()
{
$formatter = new MessageFormatter($this->app['config']['http.log_template'] ?? MessageFormatter::DEBUG);
return Middleware::log($this->app['logger'], $formatter);
} | [
"protected",
"function",
"logMiddleware",
"(",
")",
"{",
"$",
"formatter",
"=",
"new",
"MessageFormatter",
"(",
"$",
"this",
"->",
"app",
"[",
"'config'",
"]",
"[",
"'http.log_template'",
"]",
"??",
"MessageFormatter",
"::",
"DEBUG",
")",
";",
"return",
"Mid... | Log the request.
@return \Closure | [
"Log",
"the",
"request",
"."
] | 120c72faaa93c270365bc75c73c362d5fd583209 | https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/Kernel/BaseClient.php#L225-L230 | train | Log middleware. | [
30522,
5123,
3853,
8833,
4328,
20338,
8059,
1006,
1007,
1063,
1002,
4289,
3334,
1027,
2047,
4471,
14192,
20097,
1006,
1002,
2023,
1011,
1028,
10439,
1031,
1005,
9530,
8873,
2290,
1005,
1033,
1031,
1005,
8299,
1012,
8833,
1035,
23561,
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/Relations/MorphToMany.php | MorphToMany.addWhereConstraints | protected function addWhereConstraints()
{
parent::addWhereConstraints();
$this->query->where($this->table.'.'.$this->morphType, $this->morphClass);
return $this;
} | php | protected function addWhereConstraints()
{
parent::addWhereConstraints();
$this->query->where($this->table.'.'.$this->morphType, $this->morphClass);
return $this;
} | [
"protected",
"function",
"addWhereConstraints",
"(",
")",
"{",
"parent",
"::",
"addWhereConstraints",
"(",
")",
";",
"$",
"this",
"->",
"query",
"->",
"where",
"(",
"$",
"this",
"->",
"table",
".",
"'.'",
".",
"$",
"this",
"->",
"morphType",
",",
"$",
... | Set the where clause for the relation query.
@return $this | [
"Set",
"the",
"where",
"clause",
"for",
"the",
"relation",
"query",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Relations/MorphToMany.php#L67-L74 | train | Add where constraints to the query | [
30522,
5123,
3853,
5587,
2860,
5886,
8586,
5644,
23654,
3215,
1006,
1007,
1063,
6687,
1024,
1024,
5587,
2860,
5886,
8586,
5644,
23654,
3215,
1006,
1007,
1025,
1002,
2023,
1011,
1028,
23032,
1011,
1028,
2073,
1006,
1002,
2023,
1011,
1028,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/Actions/Archiver.php | Archiver.insertDayReports | protected function insertDayReports()
{
ArchivingHelper::clearActionsCache();
$this->insertPageUrlsReports();
$this->insertDownloadsReports();
$this->insertOutlinksReports();
$this->insertPageTitlesReports();
$this->insertSiteSearchReports();
} | php | protected function insertDayReports()
{
ArchivingHelper::clearActionsCache();
$this->insertPageUrlsReports();
$this->insertDownloadsReports();
$this->insertOutlinksReports();
$this->insertPageTitlesReports();
$this->insertSiteSearchReports();
} | [
"protected",
"function",
"insertDayReports",
"(",
")",
"{",
"ArchivingHelper",
"::",
"clearActionsCache",
"(",
")",
";",
"$",
"this",
"->",
"insertPageUrlsReports",
"(",
")",
";",
"$",
"this",
"->",
"insertDownloadsReports",
"(",
")",
";",
"$",
"this",
"->",
... | Records in the DB the archived reports for Page views, Downloads, Outlinks, and Page titles | [
"Records",
"in",
"the",
"DB",
"the",
"archived",
"reports",
"for",
"Page",
"views",
"Downloads",
"Outlinks",
"and",
"Page",
"titles"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Actions/Archiver.php#L415-L424 | train | Inserts the reports for the day of the site | [
30522,
5123,
3853,
19274,
10259,
2890,
25378,
1006,
1007,
1063,
7905,
30524,
5833,
13767,
21338,
13699,
11589,
2015,
1006,
1007,
1025,
1002,
2023,
1011,
1028,
19274,
13704,
27430,
2890,
25378,
1006,
1007,
1025,
1002,
2023,
1011,
1028,
19274,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.insertNumericRecord | public function insertNumericRecord($name, $value)
{
$value = round($value, 2);
$value = Common::forceDotAsSeparatorForDecimalPoint($value);
$this->archiveWriter->insertRecord($name, $value);
} | php | public function insertNumericRecord($name, $value)
{
$value = round($value, 2);
$value = Common::forceDotAsSeparatorForDecimalPoint($value);
$this->archiveWriter->insertRecord($name, $value);
} | [
"public",
"function",
"insertNumericRecord",
"(",
"$",
"name",
",",
"$",
"value",
")",
"{",
"$",
"value",
"=",
"round",
"(",
"$",
"value",
",",
"2",
")",
";",
"$",
"value",
"=",
"Common",
"::",
"forceDotAsSeparatorForDecimalPoint",
"(",
"$",
"value",
")"... | Caches a single numeric record in the archive for this processor's site, period and
segment.
Numeric values are not inserted if they equal `0`.
@param string $name The name of the numeric value, eg, `'Referrers_distinctKeywords'`.
@param float $value The numeric value.
@api | [
"Caches",
"a",
"single",
"numeric",
"record",
"in",
"the",
"archive",
"for",
"this",
"processor",
"s",
"site",
"period",
"and",
"segment",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/ArchiveProcessor.php#L313-L319 | train | This method is used to insert a numeric record into the archive. | [
30522,
2270,
3853,
19274,
19172,
22420,
2890,
27108,
2094,
1006,
1002,
2171,
1010,
1002,
3643,
1007,
1063,
1002,
3643,
1027,
2461,
1006,
1002,
3643,
1010,
1016,
1007,
1025,
1002,
3643,
1027,
2691,
1024,
1024,
3140,
17287,
11393,
28689,
4263... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Common.php | Common.unprefixTable | public static function unprefixTable($table)
{
static $prefixTable = null;
if (is_null($prefixTable)) {
$prefixTable = Config::getInstance()->database['tables_prefix'];
}
if (empty($prefixTable)
|| strpos($table, $prefixTable) !== 0
) {
return $table;
}
$count = 1;
return str_replace($prefixTable, '', $table, $count);
} | php | public static function unprefixTable($table)
{
static $prefixTable = null;
if (is_null($prefixTable)) {
$prefixTable = Config::getInstance()->database['tables_prefix'];
}
if (empty($prefixTable)
|| strpos($table, $prefixTable) !== 0
) {
return $table;
}
$count = 1;
return str_replace($prefixTable, '', $table, $count);
} | [
"public",
"static",
"function",
"unprefixTable",
"(",
"$",
"table",
")",
"{",
"static",
"$",
"prefixTable",
"=",
"null",
";",
"if",
"(",
"is_null",
"(",
"$",
"prefixTable",
")",
")",
"{",
"$",
"prefixTable",
"=",
"Config",
"::",
"getInstance",
"(",
")",
... | Removes the prefix from a table name and returns the result.
The table prefix is determined by the `[database] tables_prefix` INI config
option.
@param string $table The prefixed table name, eg "piwik-production_log_visit".
@return string The unprefixed table name, eg "log_visit".
@api | [
"Removes",
"the",
"prefix",
"from",
"a",
"table",
"name",
"and",
"returns",
"the",
"result",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Common.php#L94-L107 | train | Unprefix a table name | [
30522,
2270,
10763,
3853,
4895,
28139,
8873,
18413,
3085,
1006,
1002,
2795,
1007,
1063,
10763,
1002,
17576,
10880,
1027,
19701,
1025,
2065,
1006,
2003,
1035,
19701,
1006,
1002,
17576,
10880,
1007,
1007,
1063,
1002,
17576,
10880,
1027,
9530,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php | TagAwareAdapter.getItems | public function getItems(array $keys = [])
{
if ($this->deferred) {
$this->commit();
}
$tagKeys = [];
foreach ($keys as $key) {
if ('' !== $key && \is_string($key)) {
$key = static::TAGS_PREFIX.$key;
$tagKeys[$key] = $key;
}
}
try {
$items = $this->pool->getItems($tagKeys + $keys);
} catch (InvalidArgumentException $e) {
$this->pool->getItems($keys); // Should throw an exception
throw $e;
}
return $this->generateItems($items, $tagKeys);
} | php | public function getItems(array $keys = [])
{
if ($this->deferred) {
$this->commit();
}
$tagKeys = [];
foreach ($keys as $key) {
if ('' !== $key && \is_string($key)) {
$key = static::TAGS_PREFIX.$key;
$tagKeys[$key] = $key;
}
}
try {
$items = $this->pool->getItems($tagKeys + $keys);
} catch (InvalidArgumentException $e) {
$this->pool->getItems($keys); // Should throw an exception
throw $e;
}
return $this->generateItems($items, $tagKeys);
} | [
"public",
"function",
"getItems",
"(",
"array",
"$",
"keys",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"deferred",
")",
"{",
"$",
"this",
"->",
"commit",
"(",
")",
";",
"}",
"$",
"tagKeys",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php#L189-L212 | train | Get items from the pool | [
30522,
2270,
3853,
2131,
4221,
5244,
1006,
9140,
1002,
6309,
1027,
1031,
1033,
1007,
1063,
2065,
1006,
1002,
2023,
1011,
1028,
13366,
28849,
2094,
1007,
1063,
1002,
2023,
1011,
1028,
10797,
1006,
1007,
1025,
1065,
1002,
6415,
14839,
2015,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
overtrue/wechat | src/OfficialAccount/Card/SubMerchantClient.php | SubMerchantClient.list | public function list(int $beginId = 0, int $limit = 50, string $status = 'CHECKING')
{
$params = [
'begin_id' => $beginId,
'limit' => $limit,
'status' => $status,
];
return $this->httpPostJson('card/submerchant/batchget', $params);
} | php | public function list(int $beginId = 0, int $limit = 50, string $status = 'CHECKING')
{
$params = [
'begin_id' => $beginId,
'limit' => $limit,
'status' => $status,
];
return $this->httpPostJson('card/submerchant/batchget', $params);
} | [
"public",
"function",
"list",
"(",
"int",
"$",
"beginId",
"=",
"0",
",",
"int",
"$",
"limit",
"=",
"50",
",",
"string",
"$",
"status",
"=",
"'CHECKING'",
")",
"{",
"$",
"params",
"=",
"[",
"'begin_id'",
"=>",
"$",
"beginId",
",",
"'limit'",
"=>",
"... | 批量获取子商户信息.
@param int $beginId
@param int $limit
@param string $status
@return mixed | [
"批量获取子商户信息",
"."
] | 120c72faaa93c270365bc75c73c362d5fd583209 | https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/OfficialAccount/Card/SubMerchantClient.php#L99-L108 | train | List Cards | [
30522,
2270,
3853,
2862,
1006,
20014,
1002,
4088,
3593,
1027,
1014,
1010,
20014,
1002,
5787,
1027,
2753,
1010,
5164,
1002,
3570,
1027,
1005,
9361,
1005,
1007,
1063,
1002,
11498,
5244,
1027,
1031,
1005,
4088,
1035,
8909,
1005,
1027,
1028,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/system/ServiceProvider.php | ServiceProvider.registerConsole | protected function registerConsole()
{
/*
* Allow plugins to use the scheduler
*/
Event::listen('console.schedule', function ($schedule) {
$plugins = PluginManager::instance()->getPlugins();
foreach ($plugins as $plugin) {
if (method_exists($plugin, 'registerSchedule')) {
$plugin->registerSchedule($schedule);
}
}
});
/*
* Add CMS based cache clearing to native command
*/
Event::listen('cache:cleared', function () {
\System\Helpers\Cache::clearInternal();
});
/*
* Register console commands
*/
$this->registerConsoleCommand('october.up', 'System\Console\OctoberUp');
$this->registerConsoleCommand('october.down', 'System\Console\OctoberDown');
$this->registerConsoleCommand('october.update', 'System\Console\OctoberUpdate');
$this->registerConsoleCommand('october.util', 'System\Console\OctoberUtil');
$this->registerConsoleCommand('october.mirror', 'System\Console\OctoberMirror');
$this->registerConsoleCommand('october.fresh', 'System\Console\OctoberFresh');
$this->registerConsoleCommand('october.env', 'System\Console\OctoberEnv');
$this->registerConsoleCommand('october.install', 'System\Console\OctoberInstall');
$this->registerConsoleCommand('plugin.install', 'System\Console\PluginInstall');
$this->registerConsoleCommand('plugin.remove', 'System\Console\PluginRemove');
$this->registerConsoleCommand('plugin.refresh', 'System\Console\PluginRefresh');
$this->registerConsoleCommand('theme.install', 'System\Console\ThemeInstall');
$this->registerConsoleCommand('theme.remove', 'System\Console\ThemeRemove');
$this->registerConsoleCommand('theme.list', 'System\Console\ThemeList');
$this->registerConsoleCommand('theme.use', 'System\Console\ThemeUse');
} | php | protected function registerConsole()
{
/*
* Allow plugins to use the scheduler
*/
Event::listen('console.schedule', function ($schedule) {
$plugins = PluginManager::instance()->getPlugins();
foreach ($plugins as $plugin) {
if (method_exists($plugin, 'registerSchedule')) {
$plugin->registerSchedule($schedule);
}
}
});
/*
* Add CMS based cache clearing to native command
*/
Event::listen('cache:cleared', function () {
\System\Helpers\Cache::clearInternal();
});
/*
* Register console commands
*/
$this->registerConsoleCommand('october.up', 'System\Console\OctoberUp');
$this->registerConsoleCommand('october.down', 'System\Console\OctoberDown');
$this->registerConsoleCommand('october.update', 'System\Console\OctoberUpdate');
$this->registerConsoleCommand('october.util', 'System\Console\OctoberUtil');
$this->registerConsoleCommand('october.mirror', 'System\Console\OctoberMirror');
$this->registerConsoleCommand('october.fresh', 'System\Console\OctoberFresh');
$this->registerConsoleCommand('october.env', 'System\Console\OctoberEnv');
$this->registerConsoleCommand('october.install', 'System\Console\OctoberInstall');
$this->registerConsoleCommand('plugin.install', 'System\Console\PluginInstall');
$this->registerConsoleCommand('plugin.remove', 'System\Console\PluginRemove');
$this->registerConsoleCommand('plugin.refresh', 'System\Console\PluginRefresh');
$this->registerConsoleCommand('theme.install', 'System\Console\ThemeInstall');
$this->registerConsoleCommand('theme.remove', 'System\Console\ThemeRemove');
$this->registerConsoleCommand('theme.list', 'System\Console\ThemeList');
$this->registerConsoleCommand('theme.use', 'System\Console\ThemeUse');
} | [
"protected",
"function",
"registerConsole",
"(",
")",
"{",
"/*\n * Allow plugins to use the scheduler\n */",
"Event",
"::",
"listen",
"(",
"'console.schedule'",
",",
"function",
"(",
"$",
"schedule",
")",
"{",
"$",
"plugins",
"=",
"PluginManager",
"::",
... | Register command line specifics | [
"Register",
"command",
"line",
"specifics"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/ServiceProvider.php#L206-L247 | train | Register console commands | [
30522,
5123,
3853,
4236,
8663,
19454,
2063,
1006,
1007,
1063,
1013,
1008,
1008,
3499,
13354,
7076,
2000,
2224,
1996,
6134,
2099,
1008,
1013,
2724,
1024,
1024,
4952,
1006,
1005,
10122,
1012,
6134,
1005,
1010,
3853,
1006,
30524,
1063,
2065,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.php | Zend_Cache_Backend._log | protected function _log($message, $priority = 4)
{
if (!$this->_directives['logging']) {
return;
}
if (!isset($this->_directives['logger'])) {
Zend_Cache::throwException('Logging is enabled but logger is not set.');
}
$logger = $this->_directives['logger'];
if (!$logger instanceof Zend_Log) {
Zend_Cache::throwException('Logger object is not an instance of Zend_Log class.');
}
$logger->log($message, $priority);
} | php | protected function _log($message, $priority = 4)
{
if (!$this->_directives['logging']) {
return;
}
if (!isset($this->_directives['logger'])) {
Zend_Cache::throwException('Logging is enabled but logger is not set.');
}
$logger = $this->_directives['logger'];
if (!$logger instanceof Zend_Log) {
Zend_Cache::throwException('Logger object is not an instance of Zend_Log class.');
}
$logger->log($message, $priority);
} | [
"protected",
"function",
"_log",
"(",
"$",
"message",
",",
"$",
"priority",
"=",
"4",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"_directives",
"[",
"'logging'",
"]",
")",
"{",
"return",
";",
"}",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->"... | Log a message at the WARN (4) priority.
@param string $message
@throws Zend_Cache_Exception
@return void | [
"Log",
"a",
"message",
"at",
"the",
"WARN",
"(",
"4",
")",
"priority",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Cache/Backend.php#L253-L267 | train | Log message to the logger | [
30522,
5123,
3853,
1035,
8833,
1006,
1002,
4471,
1010,
1002,
9470,
1027,
1018,
1007,
1063,
2065,
1006,
999,
1002,
2023,
1011,
1028,
1035,
16449,
2015,
1031,
1005,
15899,
1005,
1033,
1007,
1063,
2709,
1025,
1065,
2065,
1006,
999,
26354,
33... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Input/ArrayInput.php | ArrayInput.addLongOption | private function addLongOption($name, $value)
{
if (!$this->definition->hasOption($name)) {
throw new InvalidOptionException(sprintf('The "--%s" option does not exist.', $name));
}
$option = $this->definition->getOption($name);
if (null === $value) {
if ($option->isValueRequired()) {
throw new InvalidOptionException(sprintf('The "--%s" option requires a value.', $name));
}
if (!$option->isValueOptional()) {
$value = true;
}
}
$this->options[$name] = $value;
} | php | private function addLongOption($name, $value)
{
if (!$this->definition->hasOption($name)) {
throw new InvalidOptionException(sprintf('The "--%s" option does not exist.', $name));
}
$option = $this->definition->getOption($name);
if (null === $value) {
if ($option->isValueRequired()) {
throw new InvalidOptionException(sprintf('The "--%s" option requires a value.', $name));
}
if (!$option->isValueOptional()) {
$value = true;
}
}
$this->options[$name] = $value;
} | [
"private",
"function",
"addLongOption",
"(",
"$",
"name",
",",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"definition",
"->",
"hasOption",
"(",
"$",
"name",
")",
")",
"{",
"throw",
"new",
"InvalidOptionException",
"(",
"sprintf",
"(",
"... | Adds a long option value.
@param string $name The long option key
@param mixed $value The value for the option
@throws InvalidOptionException When option given doesn't exist
@throws InvalidOptionException When a required value is missing | [
"Adds",
"a",
"long",
"option",
"value",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Console/Input/ArrayInput.php#L169-L188 | train | Adds a long option to the options array | [
30522,
2797,
3853,
5587,
10052,
7361,
3508,
1006,
1002,
2171,
1010,
1002,
3643,
1007,
1063,
2065,
1006,
999,
1002,
2023,
1011,
1028,
6210,
1011,
1028,
2038,
7361,
3508,
1006,
1002,
2171,
1007,
1007,
1063,
5466,
2047,
19528,
7361,
3508,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Console/Output/ConsoleSectionOutput.php | ConsoleSectionOutput.doWrite | protected function doWrite($message, $newline)
{
if (!$this->isDecorated()) {
return parent::doWrite($message, $newline);
}
$erasedContent = $this->popStreamContentUntilCurrentSection();
$this->addContent($message);
parent::doWrite($message, true);
parent::doWrite($erasedContent, false);
} | php | protected function doWrite($message, $newline)
{
if (!$this->isDecorated()) {
return parent::doWrite($message, $newline);
}
$erasedContent = $this->popStreamContentUntilCurrentSection();
$this->addContent($message);
parent::doWrite($message, true);
parent::doWrite($erasedContent, false);
} | [
"protected",
"function",
"doWrite",
"(",
"$",
"message",
",",
"$",
"newline",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isDecorated",
"(",
")",
")",
"{",
"return",
"parent",
"::",
"doWrite",
"(",
"$",
"message",
",",
"$",
"newline",
")",
";",
"... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Console/Output/ConsoleSectionOutput.php#L95-L107 | train | Override doWrite to add content to the current section | [
30522,
5123,
3853,
23268,
17625,
1006,
1002,
4471,
1010,
1002,
2047,
4179,
1007,
1063,
2065,
1006,
999,
1002,
2023,
1011,
1028,
2003,
3207,
27108,
4383,
1006,
1007,
1007,
1063,
2709,
6687,
1024,
1024,
23268,
17625,
1006,
1002,
4471,
1010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getgrav/grav | system/src/Grav/Common/Page/Page.php | Page.processMarkdown | protected function processMarkdown()
{
/** @var Config $config */
$config = Grav::instance()['config'];
$defaults = (array)$config->get('system.pages.markdown');
if (isset($this->header()->markdown)) {
$defaults = array_merge($defaults, $this->header()->markdown);
}
// pages.markdown_extra is deprecated, but still check it...
if (!isset($defaults['extra']) && (isset($this->markdown_extra) || $config->get('system.pages.markdown_extra') !== null)) {
user_error('Configuration option \'system.pages.markdown_extra\' is deprecated since Grav 1.5, use \'system.pages.markdown.extra\' instead', E_USER_DEPRECATED);
$defaults['extra'] = $this->markdown_extra ?: $config->get('system.pages.markdown_extra');
}
// Initialize the preferred variant of Parsedown
if ($defaults['extra']) {
$parsedown = new ParsedownExtra($this, $defaults);
} else {
$parsedown = new Parsedown($this, $defaults);
}
$this->content = $parsedown->text($this->content);
} | php | protected function processMarkdown()
{
/** @var Config $config */
$config = Grav::instance()['config'];
$defaults = (array)$config->get('system.pages.markdown');
if (isset($this->header()->markdown)) {
$defaults = array_merge($defaults, $this->header()->markdown);
}
// pages.markdown_extra is deprecated, but still check it...
if (!isset($defaults['extra']) && (isset($this->markdown_extra) || $config->get('system.pages.markdown_extra') !== null)) {
user_error('Configuration option \'system.pages.markdown_extra\' is deprecated since Grav 1.5, use \'system.pages.markdown.extra\' instead', E_USER_DEPRECATED);
$defaults['extra'] = $this->markdown_extra ?: $config->get('system.pages.markdown_extra');
}
// Initialize the preferred variant of Parsedown
if ($defaults['extra']) {
$parsedown = new ParsedownExtra($this, $defaults);
} else {
$parsedown = new Parsedown($this, $defaults);
}
$this->content = $parsedown->text($this->content);
} | [
"protected",
"function",
"processMarkdown",
"(",
")",
"{",
"/** @var Config $config */",
"$",
"config",
"=",
"Grav",
"::",
"instance",
"(",
")",
"[",
"'config'",
"]",
";",
"$",
"defaults",
"=",
"(",
"array",
")",
"$",
"config",
"->",
"get",
"(",
"'system.p... | Process the Markdown content. Uses Parsedown or Parsedown Extra depending on configuration | [
"Process",
"the",
"Markdown",
"content",
".",
"Uses",
"Parsedown",
"or",
"Parsedown",
"Extra",
"depending",
"on",
"configuration"
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L817-L842 | train | Process the Markdown content | [
30522,
5123,
3853,
2832,
10665,
7698,
1006,
1007,
1063,
1013,
1008,
1008,
1030,
13075,
9530,
8873,
2290,
1002,
9530,
8873,
2290,
1008,
1013,
1002,
9530,
8873,
2290,
1027,
24665,
11431,
1024,
1024,
6013,
1006,
1007,
1031,
1005,
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... |
laravel/framework | src/Illuminate/Routing/Matching/MethodValidator.php | MethodValidator.matches | public function matches(Route $route, Request $request)
{
return in_array($request->getMethod(), $route->methods());
} | php | public function matches(Route $route, Request $request)
{
return in_array($request->getMethod(), $route->methods());
} | [
"public",
"function",
"matches",
"(",
"Route",
"$",
"route",
",",
"Request",
"$",
"request",
")",
"{",
"return",
"in_array",
"(",
"$",
"request",
"->",
"getMethod",
"(",
")",
",",
"$",
"route",
"->",
"methods",
"(",
")",
")",
";",
"}"
] | Validate a given rule against a route and request.
@param \Illuminate\Routing\Route $route
@param \Illuminate\Http\Request $request
@return bool | [
"Validate",
"a",
"given",
"rule",
"against",
"a",
"route",
"and",
"request",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Routing/Matching/MethodValidator.php#L17-L20 | train | Checks if the route matches the request | [
30522,
2270,
3853,
3503,
1006,
2799,
1002,
2799,
1010,
5227,
1002,
5227,
1007,
1063,
2709,
1999,
1035,
9140,
1006,
1002,
5227,
1011,
1028,
2131,
11368,
6806,
2094,
1006,
1007,
1010,
1002,
2799,
1011,
1028,
4725,
1006,
1007,
1007,
1025,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/Zend/Db/Adapter/Pdo/Oci.php | Zend_Db_Adapter_Pdo_Oci._dsn | protected function _dsn()
{
// baseline of DSN parts
$dsn = $this->_config;
if (isset($dsn['host'])) {
$tns = 'dbname=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)' .
'(HOST=' . $dsn['host'] . ')';
if (isset($dsn['port'])) {
$tns .= '(PORT=' . $dsn['port'] . ')';
} else {
$tns .= '(PORT=1521)';
}
$tns .= '))(CONNECT_DATA=(SID=' . $dsn['dbname'] . ')))';
} else {
$tns = 'dbname=' . $dsn['dbname'];
}
if (isset($dsn['charset'])) {
$tns .= ';charset=' . $dsn['charset'];
}
return $this->_pdoType . ':' . $tns;
} | php | protected function _dsn()
{
// baseline of DSN parts
$dsn = $this->_config;
if (isset($dsn['host'])) {
$tns = 'dbname=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)' .
'(HOST=' . $dsn['host'] . ')';
if (isset($dsn['port'])) {
$tns .= '(PORT=' . $dsn['port'] . ')';
} else {
$tns .= '(PORT=1521)';
}
$tns .= '))(CONNECT_DATA=(SID=' . $dsn['dbname'] . ')))';
} else {
$tns = 'dbname=' . $dsn['dbname'];
}
if (isset($dsn['charset'])) {
$tns .= ';charset=' . $dsn['charset'];
}
return $this->_pdoType . ':' . $tns;
} | [
"protected",
"function",
"_dsn",
"(",
")",
"{",
"// baseline of DSN parts",
"$",
"dsn",
"=",
"$",
"this",
"->",
"_config",
";",
"if",
"(",
"isset",
"(",
"$",
"dsn",
"[",
"'host'",
"]",
")",
")",
"{",
"$",
"tns",
"=",
"'dbname=(DESCRIPTION=(ADDRESS_LIST=(AD... | Creates a PDO DSN for the adapter from $this->_config settings.
@return string | [
"Creates",
"a",
"PDO",
"DSN",
"for",
"the",
"adapter",
"from",
"$this",
"-",
">",
"_config",
"settings",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Adapter/Pdo/Oci.php#L81-L106 | train | Return the DSN part of the connection string | [
30522,
5123,
3853,
1035,
16233,
2078,
1006,
1007,
1063,
1013,
1013,
26163,
1997,
16233,
2078,
3033,
1002,
16233,
2078,
1027,
1002,
2023,
1011,
1028,
1035,
9530,
8873,
2290,
1025,
2065,
1006,
26354,
3388,
1006,
1002,
16233,
2078,
1031,
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/Translation/PluralizationRules.php | PluralizationRules.set | public static function set(callable $rule, $locale)
{
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.2.', __CLASS__), E_USER_DEPRECATED);
if ('pt_BR' === $locale) {
// temporary set a locale for brazilian
$locale = 'xbr';
}
if (\strlen($locale) > 3) {
$locale = substr($locale, 0, -\strlen(strrchr($locale, '_')));
}
self::$rules[$locale] = $rule;
} | php | public static function set(callable $rule, $locale)
{
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.2.', __CLASS__), E_USER_DEPRECATED);
if ('pt_BR' === $locale) {
// temporary set a locale for brazilian
$locale = 'xbr';
}
if (\strlen($locale) > 3) {
$locale = substr($locale, 0, -\strlen(strrchr($locale, '_')));
}
self::$rules[$locale] = $rule;
} | [
"public",
"static",
"function",
"set",
"(",
"callable",
"$",
"rule",
",",
"$",
"locale",
")",
"{",
"@",
"trigger_error",
"(",
"sprintf",
"(",
"'The \"%s\" class is deprecated since Symfony 4.2.'",
",",
"__CLASS__",
")",
",",
"E_USER_DEPRECATED",
")",
";",
"if",
... | Overrides the default plural rule for a given locale.
@param callable $rule A PHP callable
@param string $locale The locale | [
"Overrides",
"the",
"default",
"plural",
"rule",
"for",
"a",
"given",
"locale",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Translation/PluralizationRules.php#L203-L217 | train | Sets a rule to the current locale | [
30522,
2270,
10763,
3853,
2275,
1006,
2655,
3085,
1002,
3627,
1010,
1002,
2334,
2063,
1007,
1063,
1030,
9495,
1035,
7561,
1006,
9043,
2546,
1006,
1005,
1996,
1000,
1003,
1055,
1000,
2465,
2003,
2139,
28139,
12921,
2144,
25353,
2213,
14876,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/DataTable/Filter/AddSegmentByLabelMapping.php | AddSegmentByLabelMapping.filter | public function filter($table)
{
if (empty($this->segment) || empty($this->mapping)) {
return;
}
foreach ($table->getRows() as $row) {
$label = $row->getColumn('label');
if (!empty($this->mapping[$label])) {
$label = $this->mapping[$label];
$row->setMetadata('segment', $this->segment . '==' . urlencode($label));
}
}
} | php | public function filter($table)
{
if (empty($this->segment) || empty($this->mapping)) {
return;
}
foreach ($table->getRows() as $row) {
$label = $row->getColumn('label');
if (!empty($this->mapping[$label])) {
$label = $this->mapping[$label];
$row->setMetadata('segment', $this->segment . '==' . urlencode($label));
}
}
} | [
"public",
"function",
"filter",
"(",
"$",
"table",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"segment",
")",
"||",
"empty",
"(",
"$",
"this",
"->",
"mapping",
")",
")",
"{",
"return",
";",
"}",
"foreach",
"(",
"$",
"table",
"->",
"get... | See {@link AddSegmentByLabelMapping}.
@param DataTable $table | [
"See",
"{",
"@link",
"AddSegmentByLabelMapping",
"}",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/DataTable/Filter/AddSegmentByLabelMapping.php#L48-L62 | train | Filter the table to only include the segment column | [
30522,
2270,
3853,
11307,
1006,
1002,
2795,
1007,
1063,
2065,
1006,
4064,
1006,
1002,
2023,
1011,
1028,
6903,
1007,
1064,
1064,
4064,
1006,
1002,
2023,
1011,
1028,
12375,
1007,
1007,
1063,
2709,
1025,
1065,
18921,
6776,
1006,
1002,
2795,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Security/Core/Exception/AccountStatusException.php | AccountStatusException.__unserialize | public function __unserialize(array $data): void
{
[$this->user, $parentData] = $data;
parent::__unserialize($parentData);
} | php | public function __unserialize(array $data): void
{
[$this->user, $parentData] = $data;
parent::__unserialize($parentData);
} | [
"public",
"function",
"__unserialize",
"(",
"array",
"$",
"data",
")",
":",
"void",
"{",
"[",
"$",
"this",
"->",
"user",
",",
"$",
"parentData",
"]",
"=",
"$",
"data",
";",
"parent",
"::",
"__unserialize",
"(",
"$",
"parentData",
")",
";",
"}"
] | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Security/Core/Exception/AccountStatusException.php#L53-L57 | train | Unserialize the data array | [
30522,
2270,
3853,
1035,
1035,
4895,
8043,
4818,
4697,
1006,
9140,
1002,
2951,
1007,
1024,
11675,
1063,
1031,
1002,
2023,
1011,
1028,
5310,
1010,
1002,
6687,
2850,
2696,
1033,
1027,
1002,
2951,
1025,
6687,
1024,
1024,
1035,
1035,
4895,
80... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/FactoryBuilder.php | FactoryBuilder.makeInstance | protected function makeInstance(array $attributes = [])
{
return Model::unguarded(function () use ($attributes) {
$instance = new $this->class(
$this->getRawAttributes($attributes)
);
if (isset($this->connection)) {
$instance->setConnection($this->connection);
}
return $instance;
});
} | php | protected function makeInstance(array $attributes = [])
{
return Model::unguarded(function () use ($attributes) {
$instance = new $this->class(
$this->getRawAttributes($attributes)
);
if (isset($this->connection)) {
$instance->setConnection($this->connection);
}
return $instance;
});
} | [
"protected",
"function",
"makeInstance",
"(",
"array",
"$",
"attributes",
"=",
"[",
"]",
")",
"{",
"return",
"Model",
"::",
"unguarded",
"(",
"function",
"(",
")",
"use",
"(",
"$",
"attributes",
")",
"{",
"$",
"instance",
"=",
"new",
"$",
"this",
"->",... | Make an instance of the model with the given attributes.
@param array $attributes
@return \Illuminate\Database\Eloquent\Model | [
"Make",
"an",
"instance",
"of",
"the",
"model",
"with",
"the",
"given",
"attributes",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/FactoryBuilder.php#L288-L301 | train | Creates an instance of the class | [
30522,
5123,
3853,
2191,
7076,
26897,
1006,
9140,
1002,
12332,
1027,
1031,
1033,
1007,
1063,
2709,
2944,
1024,
1024,
4895,
18405,
2098,
1006,
3853,
1006,
1007,
2224,
1006,
1002,
12332,
1007,
1063,
1002,
6013,
1027,
2047,
1002,
2023,
1011,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/backend/widgets/MediaManager.php | MediaManager.removeCropEditDir | protected function removeCropEditDir($cropSessionKey)
{
$sessionDirectoryPath = $this->getCropSessionDirPath($cropSessionKey);
$fullSessionDirectoryPath = temp_path($sessionDirectoryPath);
if (File::isDirectory($fullSessionDirectoryPath)) {
@File::deleteDirectory($fullSessionDirectoryPath);
}
} | php | protected function removeCropEditDir($cropSessionKey)
{
$sessionDirectoryPath = $this->getCropSessionDirPath($cropSessionKey);
$fullSessionDirectoryPath = temp_path($sessionDirectoryPath);
if (File::isDirectory($fullSessionDirectoryPath)) {
@File::deleteDirectory($fullSessionDirectoryPath);
}
} | [
"protected",
"function",
"removeCropEditDir",
"(",
"$",
"cropSessionKey",
")",
"{",
"$",
"sessionDirectoryPath",
"=",
"$",
"this",
"->",
"getCropSessionDirPath",
"(",
"$",
"cropSessionKey",
")",
";",
"$",
"fullSessionDirectoryPath",
"=",
"temp_path",
"(",
"$",
"se... | Cleans up the directory used for cropping based on the session key
@param string $cropSessionKey
@return void | [
"Cleans",
"up",
"the",
"directory",
"used",
"for",
"cropping",
"based",
"on",
"the",
"session",
"key"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/MediaManager.php#L1741-L1749 | train | Remove the crop edit directory if it exists | [
30522,
5123,
3853,
6366,
26775,
24174,
4183,
4305,
2099,
1006,
1002,
8765,
7971,
3258,
14839,
1007,
1063,
1002,
5219,
4305,
2890,
16761,
22571,
8988,
1027,
1002,
2023,
1011,
1028,
2131,
26775,
11923,
7971,
3258,
4305,
14536,
8988,
1006,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/backend/widgets/MediaManager.php | MediaManager.onLoadImageCropPopup | public function onLoadImageCropPopup()
{
$this->abortIfReadOnly();
$path = Input::get('path');
$path = MediaLibrary::validatePath($path);
$cropSessionKey = md5(FormHelper::getSessionKey());
$selectionParams = $this->getSelectionParams();
$urlAndSize = $this->getCropEditImageUrlAndSize($path, $cropSessionKey);
$width = $urlAndSize['dimensions'][0];
$height = $urlAndSize['dimensions'][1] ?: 1;
$this->vars['currentSelectionMode'] = $selectionParams['mode'];
$this->vars['currentSelectionWidth'] = $selectionParams['width'];
$this->vars['currentSelectionHeight'] = $selectionParams['height'];
$this->vars['cropSessionKey'] = $cropSessionKey;
$this->vars['imageUrl'] = $urlAndSize['url'];
$this->vars['dimensions'] = $urlAndSize['dimensions'];
$this->vars['originalRatio'] = round($width / $height, 5);
$this->vars['path'] = $path;
return $this->makePartial('image-crop-popup-body');
} | php | public function onLoadImageCropPopup()
{
$this->abortIfReadOnly();
$path = Input::get('path');
$path = MediaLibrary::validatePath($path);
$cropSessionKey = md5(FormHelper::getSessionKey());
$selectionParams = $this->getSelectionParams();
$urlAndSize = $this->getCropEditImageUrlAndSize($path, $cropSessionKey);
$width = $urlAndSize['dimensions'][0];
$height = $urlAndSize['dimensions'][1] ?: 1;
$this->vars['currentSelectionMode'] = $selectionParams['mode'];
$this->vars['currentSelectionWidth'] = $selectionParams['width'];
$this->vars['currentSelectionHeight'] = $selectionParams['height'];
$this->vars['cropSessionKey'] = $cropSessionKey;
$this->vars['imageUrl'] = $urlAndSize['url'];
$this->vars['dimensions'] = $urlAndSize['dimensions'];
$this->vars['originalRatio'] = round($width / $height, 5);
$this->vars['path'] = $path;
return $this->makePartial('image-crop-popup-body');
} | [
"public",
"function",
"onLoadImageCropPopup",
"(",
")",
"{",
"$",
"this",
"->",
"abortIfReadOnly",
"(",
")",
";",
"$",
"path",
"=",
"Input",
"::",
"get",
"(",
"'path'",
")",
";",
"$",
"path",
"=",
"MediaLibrary",
"::",
"validatePath",
"(",
"$",
"path",
... | Load image for cropping AJAX handler
@return array | [
"Load",
"image",
"for",
"cropping",
"AJAX",
"handler"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/MediaManager.php#L696-L719 | train | Displays the image crop popup | [
30522,
2270,
3853,
2006,
11066,
9581,
3351,
26775,
7361,
16340,
6279,
1006,
1007,
1063,
1002,
2023,
1011,
1028,
11113,
11589,
10128,
16416,
5280,
2135,
1006,
1007,
1025,
1002,
4130,
1027,
7953,
1024,
1024,
2131,
1006,
1005,
4130,
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/Zend/Cache/Frontend/File.php | Zend_Cache_Frontend_File.setOption | public function setOption($name, $value)
{
if ($name == 'master_file') {
$this->setMasterFile($value);
} else if ($name == 'master_files') {
$this->setMasterFiles($value);
} else {
parent::setOption($name, $value);
}
} | php | public function setOption($name, $value)
{
if ($name == 'master_file') {
$this->setMasterFile($value);
} else if ($name == 'master_files') {
$this->setMasterFiles($value);
} else {
parent::setOption($name, $value);
}
} | [
"public",
"function",
"setOption",
"(",
"$",
"name",
",",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"name",
"==",
"'master_file'",
")",
"{",
"$",
"this",
"->",
"setMasterFile",
"(",
"$",
"value",
")",
";",
"}",
"else",
"if",
"(",
"$",
"name",
"==",
... | Public frontend to set an option
Just a wrapper to get a specific behaviour for master_file
@param string $name Name of the option
@param mixed $value Value of the option
@throws Zend_Cache_Exception
@return void | [
"Public",
"frontend",
"to",
"set",
"an",
"option"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Cache/Frontend/File.php#L156-L165 | train | Set the value of an option in the current context | [
30522,
2270,
3853,
2275,
7361,
3508,
1006,
1002,
2171,
1010,
1002,
3643,
1007,
1063,
2065,
1006,
1002,
2171,
1027,
1027,
1005,
3040,
1035,
5371,
1005,
1007,
1063,
1002,
2023,
1011,
1028,
2275,
8706,
8873,
2571,
1006,
1002,
3643,
1007,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/Menu/MenuAdmin.php | MenuAdmin.addMeasurableItem | public function addMeasurableItem($menuName, $url, $order = 50, $tooltip = false)
{
$this->addItem('CoreAdminHome_MenuMeasurables', $menuName, $url, $order, $tooltip);
} | php | public function addMeasurableItem($menuName, $url, $order = 50, $tooltip = false)
{
$this->addItem('CoreAdminHome_MenuMeasurables', $menuName, $url, $order, $tooltip);
} | [
"public",
"function",
"addMeasurableItem",
"(",
"$",
"menuName",
",",
"$",
"url",
",",
"$",
"order",
"=",
"50",
",",
"$",
"tooltip",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"addItem",
"(",
"'CoreAdminHome_MenuMeasurables'",
",",
"$",
"menuName",
",",
... | See {@link add()}. Adds a new menu item to the measurable section of the admin menu.
@param string $menuName
@param array $url
@param int $order
@param bool|string $tooltip
@api
@since 3.0.0 | [
"See",
"{"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Menu/MenuAdmin.php#L90-L93 | train | AddMeasurableItem - AddMeasurable Menu - MenuItem | [
30522,
30524,
1028,
5587,
4221,
2213,
1006,
1005,
4563,
4215,
10020,
23393,
2063,
1035,
12183,
4168,
28329,
2015,
1005,
1010,
1002,
12183,
18442,
1010,
1002,
24471,
2140,
1010,
1002,
2344,
1010,
1002,
6994,
25101,
1007,
1025,
1065,
102,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
guzzle/guzzle | src/Middleware.php | Middleware.httpErrors | public static function httpErrors()
{
return function (callable $handler) {
return function ($request, array $options) use ($handler) {
if (empty($options['http_errors'])) {
return $handler($request, $options);
}
return $handler($request, $options)->then(
function (ResponseInterface $response) use ($request) {
$code = $response->getStatusCode();
if ($code < 400) {
return $response;
}
throw RequestException::create($request, $response);
}
);
};
};
} | php | public static function httpErrors()
{
return function (callable $handler) {
return function ($request, array $options) use ($handler) {
if (empty($options['http_errors'])) {
return $handler($request, $options);
}
return $handler($request, $options)->then(
function (ResponseInterface $response) use ($request) {
$code = $response->getStatusCode();
if ($code < 400) {
return $response;
}
throw RequestException::create($request, $response);
}
);
};
};
} | [
"public",
"static",
"function",
"httpErrors",
"(",
")",
"{",
"return",
"function",
"(",
"callable",
"$",
"handler",
")",
"{",
"return",
"function",
"(",
"$",
"request",
",",
"array",
"$",
"options",
")",
"use",
"(",
"$",
"handler",
")",
"{",
"if",
"(",... | Middleware that throws exceptions for 4xx or 5xx responses when the
"http_error" request option is set to true.
@return callable Returns a function that accepts the next handler. | [
"Middleware",
"that",
"throws",
"exceptions",
"for",
"4xx",
"or",
"5xx",
"responses",
"when",
"the",
"http_error",
"request",
"option",
"is",
"set",
"to",
"true",
"."
] | bf595424e4d442a190582e088985dc835a789071 | https://github.com/guzzle/guzzle/blob/bf595424e4d442a190582e088985dc835a789071/src/Middleware.php#L53-L71 | train | Returns a closure that will catch HTTP errors | [
30522,
2270,
10763,
3853,
8299,
2121,
29165,
2015,
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,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/Zend/Validate/EmailAddress.php | Zend_Validate_EmailAddress._validateHostnamePart | private function _validateHostnamePart()
{
$hostname = $this->_options['hostname']->setTranslator($this->getTranslator())
->isValid($this->_hostname);
if (!$hostname) {
$this->_error(self::INVALID_HOSTNAME);
// Get messages and errors from hostnameValidator
foreach ($this->_options['hostname']->getMessages() as $code => $message) {
$this->_messages[$code] = $message;
}
foreach ($this->_options['hostname']->getErrors() as $error) {
$this->_errors[] = $error;
}
} else if ($this->_options['mx']) {
// MX check on hostname
$hostname = $this->_validateMXRecords();
}
return $hostname;
} | php | private function _validateHostnamePart()
{
$hostname = $this->_options['hostname']->setTranslator($this->getTranslator())
->isValid($this->_hostname);
if (!$hostname) {
$this->_error(self::INVALID_HOSTNAME);
// Get messages and errors from hostnameValidator
foreach ($this->_options['hostname']->getMessages() as $code => $message) {
$this->_messages[$code] = $message;
}
foreach ($this->_options['hostname']->getErrors() as $error) {
$this->_errors[] = $error;
}
} else if ($this->_options['mx']) {
// MX check on hostname
$hostname = $this->_validateMXRecords();
}
return $hostname;
} | [
"private",
"function",
"_validateHostnamePart",
"(",
")",
"{",
"$",
"hostname",
"=",
"$",
"this",
"->",
"_options",
"[",
"'hostname'",
"]",
"->",
"setTranslator",
"(",
"$",
"this",
"->",
"getTranslator",
"(",
")",
")",
"->",
"isValid",
"(",
"$",
"this",
... | Internal method to validate the hostname part of the email address
@return boolean | [
"Internal",
"method",
"to",
"validate",
"the",
"hostname",
"part",
"of",
"the",
"email",
"address"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Validate/EmailAddress.php#L484-L505 | train | Validate hostname part | [
30522,
2797,
3853,
1035,
9398,
3686,
15006,
2102,
18442,
19362,
2102,
1006,
1007,
1063,
1002,
3677,
18442,
1027,
1002,
2023,
1011,
1028,
1035,
7047,
1031,
1005,
3677,
18442,
1005,
1033,
1011,
1028,
2275,
6494,
3619,
20051,
2953,
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/HttpKernel/Kernel.php | Kernel.initializeBundles | protected function initializeBundles()
{
// init bundles
$this->bundles = [];
foreach ($this->registerBundles() as $bundle) {
$name = $bundle->getName();
if (isset($this->bundles[$name])) {
throw new \LogicException(sprintf('Trying to register two bundles with the same name "%s"', $name));
}
$this->bundles[$name] = $bundle;
}
} | php | protected function initializeBundles()
{
// init bundles
$this->bundles = [];
foreach ($this->registerBundles() as $bundle) {
$name = $bundle->getName();
if (isset($this->bundles[$name])) {
throw new \LogicException(sprintf('Trying to register two bundles with the same name "%s"', $name));
}
$this->bundles[$name] = $bundle;
}
} | [
"protected",
"function",
"initializeBundles",
"(",
")",
"{",
"// init bundles",
"$",
"this",
"->",
"bundles",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"registerBundles",
"(",
")",
"as",
"$",
"bundle",
")",
"{",
"$",
"name",
"=",
"$",
"bun... | Initializes bundles.
@throws \LogicException if two bundles share a common name | [
"Initializes",
"bundles",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/Kernel.php#L420-L431 | train | Initializes bundles. | [
30522,
5123,
3853,
3988,
4697,
27265,
4244,
1006,
1007,
1063,
1013,
1013,
1999,
4183,
26825,
1002,
2023,
1011,
1028,
26825,
1027,
1031,
1033,
1025,
18921,
6776,
1006,
1002,
2023,
1011,
1028,
4236,
27265,
4244,
1006,
1007,
2004,
1002,
14012,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.dropTable | public function dropTable($table)
{
$table = $this->prefixTable($table);
return $this->container->make('Piwik\Updater\Migration\Db\DropTable', array(
'table' => $table
));
} | php | public function dropTable($table)
{
$table = $this->prefixTable($table);
return $this->container->make('Piwik\Updater\Migration\Db\DropTable', array(
'table' => $table
));
} | [
"public",
"function",
"dropTable",
"(",
"$",
"table",
")",
"{",
"$",
"table",
"=",
"$",
"this",
"->",
"prefixTable",
"(",
"$",
"table",
")",
";",
"return",
"$",
"this",
"->",
"container",
"->",
"make",
"(",
"'Piwik\\Updater\\Migration\\Db\\DropTable'",
",",
... | Drops an existing database table.
@param string $table Unprefixed database table name, eg 'log_visit'.
@return DropTable | [
"Drops",
"an",
"existing",
"database",
"table",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Updater/Migration/Db/Factory.php#L110-L117 | train | Drops a table in the database. | [
30522,
2270,
3853,
4530,
10880,
1006,
1002,
2795,
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,
1005,
14255,
9148,
2243,
1032,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/Plugin/Report.php | Report.getThirdLeveltableDimension | public function getThirdLeveltableDimension()
{
if (empty($this->actionToLoadSubTables)) {
return null;
}
list($subtableReportModule, $subtableReportAction) = $this->getSubtableApiMethod();
$subtableReport = ReportsProvider::factory($subtableReportModule, $subtableReportAction);
if (empty($subtableReport) || empty($subtableReport->actionToLoadSubTables)) {
return null;
}
list($subSubtableReportModule, $subSubtableReportAction) = $subtableReport->getSubtableApiMethod();
$subSubtableReport = ReportsProvider::factory($subSubtableReportModule, $subSubtableReportAction);
if (empty($subSubtableReport)) {
return null;
}
return $subSubtableReport->getDimension();
} | php | public function getThirdLeveltableDimension()
{
if (empty($this->actionToLoadSubTables)) {
return null;
}
list($subtableReportModule, $subtableReportAction) = $this->getSubtableApiMethod();
$subtableReport = ReportsProvider::factory($subtableReportModule, $subtableReportAction);
if (empty($subtableReport) || empty($subtableReport->actionToLoadSubTables)) {
return null;
}
list($subSubtableReportModule, $subSubtableReportAction) = $subtableReport->getSubtableApiMethod();
$subSubtableReport = ReportsProvider::factory($subSubtableReportModule, $subSubtableReportAction);
if (empty($subSubtableReport)) {
return null;
}
return $subSubtableReport->getDimension();
} | [
"public",
"function",
"getThirdLeveltableDimension",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"actionToLoadSubTables",
")",
")",
"{",
"return",
"null",
";",
"}",
"list",
"(",
"$",
"subtableReportModule",
",",
"$",
"subtableReportAction",
")",... | Returns the Dimension instance of the subtable report of this report's subtable report.
@return Dimension|null The subtable report's dimension or null if there is no subtable report or
no dimension for the subtable report.
@api | [
"Returns",
"the",
"Dimension",
"instance",
"of",
"the",
"subtable",
"report",
"of",
"this",
"report",
"s",
"subtable",
"report",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Plugin/Report.php#L832-L853 | train | Returns the Dimension of the third level table report. | [
30522,
2270,
3853,
2131,
15222,
4103,
20414,
20042,
3085,
22172,
6132,
3258,
1006,
1007,
1063,
2065,
1006,
4064,
1006,
1002,
2023,
1011,
1028,
2895,
3406,
11066,
6342,
19279,
3085,
2015,
1007,
1007,
1063,
2709,
19701,
1025,
1065,
2862,
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/SqsQueue.php | SqsQueue.getQueue | public function getQueue($queue)
{
$queue = $queue ?: $this->default;
return filter_var($queue, FILTER_VALIDATE_URL) === false
? rtrim($this->prefix, '/').'/'.$queue : $queue;
} | php | public function getQueue($queue)
{
$queue = $queue ?: $this->default;
return filter_var($queue, FILTER_VALIDATE_URL) === false
? rtrim($this->prefix, '/').'/'.$queue : $queue;
} | [
"public",
"function",
"getQueue",
"(",
"$",
"queue",
")",
"{",
"$",
"queue",
"=",
"$",
"queue",
"?",
":",
"$",
"this",
"->",
"default",
";",
"return",
"filter_var",
"(",
"$",
"queue",
",",
"FILTER_VALIDATE_URL",
")",
"===",
"false",
"?",
"rtrim",
"(",
... | Get the queue or return the default.
@param string|null $queue
@return string | [
"Get",
"the",
"queue",
"or",
"return",
"the",
"default",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Queue/SqsQueue.php#L138-L144 | train | Get queue name | [
30522,
2270,
3853,
2131,
4226,
5657,
1006,
1002,
24240,
1007,
1063,
1002,
24240,
1027,
1002,
24240,
1029,
1024,
1002,
2023,
1011,
1028,
12398,
1025,
2709,
11307,
1035,
13075,
1006,
1002,
24240,
1010,
11307,
1035,
9398,
3686,
1035,
24471,
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... |
matomo-org/matomo | core/Settings/Storage/Backend/PluginSettingsTable.php | PluginSettingsTable.removeAllSettingsForPlugin | public static function removeAllSettingsForPlugin($pluginName)
{
try {
$table = Common::prefixTable('plugin_setting');
Db::get()->query(sprintf('DELETE FROM %s WHERE plugin_name = ?', $table), array($pluginName));
} catch (Exception $e) {
if ($e->getCode() != 42) {
// ignore table not found error, which might occur when updating from an older version of Piwik
throw $e;
}
}
} | php | public static function removeAllSettingsForPlugin($pluginName)
{
try {
$table = Common::prefixTable('plugin_setting');
Db::get()->query(sprintf('DELETE FROM %s WHERE plugin_name = ?', $table), array($pluginName));
} catch (Exception $e) {
if ($e->getCode() != 42) {
// ignore table not found error, which might occur when updating from an older version of Piwik
throw $e;
}
}
} | [
"public",
"static",
"function",
"removeAllSettingsForPlugin",
"(",
"$",
"pluginName",
")",
"{",
"try",
"{",
"$",
"table",
"=",
"Common",
"::",
"prefixTable",
"(",
"'plugin_setting'",
")",
";",
"Db",
"::",
"get",
"(",
")",
"->",
"query",
"(",
"sprintf",
"("... | Unsets all settings for a plugin. The settings will be removed from the database. Used when
a plugin is uninstalled.
@internal
@param string $pluginName
@throws \Exception If the `$userLogin` is empty. | [
"Unsets",
"all",
"settings",
"for",
"a",
"plugin",
".",
"The",
"settings",
"will",
"be",
"removed",
"from",
"the",
"database",
".",
"Used",
"when",
"a",
"plugin",
"is",
"uninstalled",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Settings/Storage/Backend/PluginSettingsTable.php#L197-L208 | train | Remove all settings for a plugin | [
30522,
2270,
10763,
3853,
6366,
8095,
21678,
8613,
29278,
24759,
15916,
2378,
1006,
1002,
13354,
23111,
14074,
1007,
1063,
3046,
1063,
1002,
2795,
1027,
2691,
1024,
1024,
17576,
10880,
1006,
1005,
13354,
2378,
1035,
4292,
1005,
1007,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Support/Collection.php | Collection.eachSpread | public function eachSpread(callable $callback)
{
return $this->each(function ($chunk, $key) use ($callback) {
$chunk[] = $key;
return $callback(...$chunk);
});
} | php | public function eachSpread(callable $callback)
{
return $this->each(function ($chunk, $key) use ($callback) {
$chunk[] = $key;
return $callback(...$chunk);
});
} | [
"public",
"function",
"eachSpread",
"(",
"callable",
"$",
"callback",
")",
"{",
"return",
"$",
"this",
"->",
"each",
"(",
"function",
"(",
"$",
"chunk",
",",
"$",
"key",
")",
"use",
"(",
"$",
"callback",
")",
"{",
"$",
"chunk",
"[",
"]",
"=",
"$",
... | Execute a callback over each nested chunk of items.
@param callable $callback
@return static | [
"Execute",
"a",
"callback",
"over",
"each",
"nested",
"chunk",
"of",
"items",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Support/Collection.php#L489-L496 | train | Iterators over the array and calls the callback with each item. | [
30522,
2270,
3853,
2169,
13102,
16416,
2094,
1006,
2655,
3085,
1002,
2655,
5963,
1007,
30524,
1025,
1065,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Select.php | Zend_Db_Select._renderHaving | protected function _renderHaving($sql)
{
if ($this->_parts[self::FROM] && $this->_parts[self::HAVING]) {
$sql .= ' ' . self::SQL_HAVING . ' ' . implode(' ', $this->_parts[self::HAVING]);
}
return $sql;
} | php | protected function _renderHaving($sql)
{
if ($this->_parts[self::FROM] && $this->_parts[self::HAVING]) {
$sql .= ' ' . self::SQL_HAVING . ' ' . implode(' ', $this->_parts[self::HAVING]);
}
return $sql;
} | [
"protected",
"function",
"_renderHaving",
"(",
"$",
"sql",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_parts",
"[",
"self",
"::",
"FROM",
"]",
"&&",
"$",
"this",
"->",
"_parts",
"[",
"self",
"::",
"HAVING",
"]",
")",
"{",
"$",
"sql",
".=",
"' '",
"... | Render HAVING clause
@param string $sql SQL query
@return string | [
"Render",
"HAVING",
"clause"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Select.php#L1210-L1217 | train | Render HAVING clause | [
30522,
5123,
3853,
1035,
17552,
3270,
6455,
1006,
1002,
29296,
1007,
1063,
2065,
1006,
1002,
2023,
1011,
1028,
1035,
3033,
1031,
2969,
1024,
1024,
2013,
1033,
1004,
1004,
1002,
2023,
1011,
1028,
1035,
3033,
1031,
2969,
1024,
1024,
2383,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/Authenticator/TwoFactorAuthenticator.php | TwoFactorAuthenticator._base32Encode | protected function _base32Encode($secret, $padding = true)
{
if (empty($secret)) return '';
$base32chars = $this->_getBase32LookupTable();
$secret = str_split($secret);
$binaryString = "";
for ($i = 0; $i < count($secret); $i++) {
$binaryString .= str_pad(base_convert(ord($secret[$i]), 10, 2), 8, '0', STR_PAD_LEFT);
}
$fiveBitBinaryArray = str_split($binaryString, 5);
$base32 = "";
$i = 0;
while ($i < count($fiveBitBinaryArray)) {
$base32 .= $base32chars[base_convert(str_pad($fiveBitBinaryArray[$i], 5, '0'), 2, 10)];
$i++;
}
if ($padding && ($x = strlen($binaryString) % 40) != 0) {
if ($x == 8) $base32 .= str_repeat($base32chars[32], 6);
elseif ($x == 16) $base32 .= str_repeat($base32chars[32], 4);
elseif ($x == 24) $base32 .= str_repeat($base32chars[32], 3);
elseif ($x == 32) $base32 .= $base32chars[32];
}
return $base32;
} | php | protected function _base32Encode($secret, $padding = true)
{
if (empty($secret)) return '';
$base32chars = $this->_getBase32LookupTable();
$secret = str_split($secret);
$binaryString = "";
for ($i = 0; $i < count($secret); $i++) {
$binaryString .= str_pad(base_convert(ord($secret[$i]), 10, 2), 8, '0', STR_PAD_LEFT);
}
$fiveBitBinaryArray = str_split($binaryString, 5);
$base32 = "";
$i = 0;
while ($i < count($fiveBitBinaryArray)) {
$base32 .= $base32chars[base_convert(str_pad($fiveBitBinaryArray[$i], 5, '0'), 2, 10)];
$i++;
}
if ($padding && ($x = strlen($binaryString) % 40) != 0) {
if ($x == 8) $base32 .= str_repeat($base32chars[32], 6);
elseif ($x == 16) $base32 .= str_repeat($base32chars[32], 4);
elseif ($x == 24) $base32 .= str_repeat($base32chars[32], 3);
elseif ($x == 32) $base32 .= $base32chars[32];
}
return $base32;
} | [
"protected",
"function",
"_base32Encode",
"(",
"$",
"secret",
",",
"$",
"padding",
"=",
"true",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"secret",
")",
")",
"return",
"''",
";",
"$",
"base32chars",
"=",
"$",
"this",
"->",
"_getBase32LookupTable",
"(",
"... | Helper class to encode base32
@param string $secret
@param bool $padding
@return string | [
"Helper",
"class",
"to",
"encode",
"base32"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Authenticator/TwoFactorAuthenticator.php#L152-L177 | train | Encode the base32 string | [
30522,
5123,
3853,
1035,
2918,
16703,
2368,
16044,
1006,
1002,
3595,
1010,
1002,
11687,
4667,
1027,
2995,
1007,
1063,
2065,
1006,
4064,
1006,
1002,
3595,
1007,
1007,
2709,
1005,
1005,
1025,
1002,
2918,
16703,
7507,
2869,
1027,
1002,
2023,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Database/Connectors/PostgresConnector.php | PostgresConnector.addSslOptions | protected function addSslOptions($dsn, array $config)
{
foreach (['sslmode', 'sslcert', 'sslkey', 'sslrootcert'] as $option) {
if (isset($config[$option])) {
$dsn .= ";{$option}={$config[$option]}";
}
}
return $dsn;
} | php | protected function addSslOptions($dsn, array $config)
{
foreach (['sslmode', 'sslcert', 'sslkey', 'sslrootcert'] as $option) {
if (isset($config[$option])) {
$dsn .= ";{$option}={$config[$option]}";
}
}
return $dsn;
} | [
"protected",
"function",
"addSslOptions",
"(",
"$",
"dsn",
",",
"array",
"$",
"config",
")",
"{",
"foreach",
"(",
"[",
"'sslmode'",
",",
"'sslcert'",
",",
"'sslkey'",
",",
"'sslrootcert'",
"]",
"as",
"$",
"option",
")",
"{",
"if",
"(",
"isset",
"(",
"$... | Add the SSL options to the DSN.
@param string $dsn
@param array $config
@return string | [
"Add",
"the",
"SSL",
"options",
"to",
"the",
"DSN",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Connectors/PostgresConnector.php#L166-L175 | train | Adds SSL options to the DSN | [
30522,
5123,
3853,
9909,
14540,
7361,
9285,
1006,
1002,
16233,
2078,
1010,
9140,
1002,
9530,
8873,
2290,
1007,
1063,
18921,
6776,
1006,
1031,
1005,
7020,
13728,
10244,
1005,
1010,
1005,
7020,
23314,
5339,
1005,
1010,
1005,
7020,
28143,
2100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Connection.php | Connection.logQuery | public function logQuery($query, $bindings, $time = null)
{
$this->event(new QueryExecuted($query, $bindings, $time, $this));
if ($this->loggingQueries) {
$this->queryLog[] = compact('query', 'bindings', 'time');
}
} | php | public function logQuery($query, $bindings, $time = null)
{
$this->event(new QueryExecuted($query, $bindings, $time, $this));
if ($this->loggingQueries) {
$this->queryLog[] = compact('query', 'bindings', 'time');
}
} | [
"public",
"function",
"logQuery",
"(",
"$",
"query",
",",
"$",
"bindings",
",",
"$",
"time",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"event",
"(",
"new",
"QueryExecuted",
"(",
"$",
"query",
",",
"$",
"bindings",
",",
"$",
"time",
",",
"$",
"this"... | Log a query in the connection's query log.
@param string $query
@param array $bindings
@param float|null $time
@return void | [
"Log",
"a",
"query",
"in",
"the",
"connection",
"s",
"query",
"log",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Connection.php#L680-L687 | train | Logs a query to the query log | [
30522,
2270,
3853,
8833,
4226,
2854,
1006,
1002,
23032,
1010,
1002,
8031,
2015,
1010,
1002,
2051,
1027,
19701,
1007,
1063,
1002,
2023,
1011,
1028,
2724,
1006,
2047,
23032,
10288,
8586,
12926,
1006,
1002,
23032,
1010,
1002,
8031,
2015,
1010,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/UsersManager/API.php | API.getUsersHavingSuperUserAccess | public function getUsersHavingSuperUserAccess()
{
Piwik::checkUserIsNotAnonymous();
$users = $this->model->getUsersHavingSuperUserAccess();
$users = $this->enrichUsers($users);
// we do not filter these users by access and return them all since we need to print this information in the
// UI and they are allowed to see this.
return $users;
} | php | public function getUsersHavingSuperUserAccess()
{
Piwik::checkUserIsNotAnonymous();
$users = $this->model->getUsersHavingSuperUserAccess();
$users = $this->enrichUsers($users);
// we do not filter these users by access and return them all since we need to print this information in the
// UI and they are allowed to see this.
return $users;
} | [
"public",
"function",
"getUsersHavingSuperUserAccess",
"(",
")",
"{",
"Piwik",
"::",
"checkUserIsNotAnonymous",
"(",
")",
";",
"$",
"users",
"=",
"$",
"this",
"->",
"model",
"->",
"getUsersHavingSuperUserAccess",
"(",
")",
";",
"$",
"users",
"=",
"$",
"this",
... | Returns a list of all Super Users containing there userLogin and email address.
@return array | [
"Returns",
"a",
"list",
"of",
"all",
"Super",
"Users",
"containing",
"there",
"userLogin",
"and",
"email",
"address",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/UsersManager/API.php#L738-L749 | train | Returns all users having super user access | [
30522,
2270,
3853,
2131,
20330,
7377,
6455,
6342,
4842,
20330,
6305,
9623,
2015,
1006,
1007,
1063,
14255,
9148,
2243,
1024,
1024,
4638,
20330,
2483,
17048,
6761,
4890,
27711,
1006,
1007,
1025,
1002,
5198,
1027,
1002,
2023,
1011,
1028,
2944,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/Piwik.php | Piwik.hasTheUserSuperUserAccess | public static function hasTheUserSuperUserAccess($theUser)
{
if (empty($theUser)) {
return false;
}
if (Piwik::getCurrentUserLogin() === $theUser && Piwik::hasUserSuperUserAccess()) {
return true;
}
try {
$superUsers = APIUsersManager::getInstance()->getUsersHavingSuperUserAccess();
} catch (\Exception $e) {
return false;
}
foreach ($superUsers as $superUser) {
if ($theUser === $superUser['login']) {
return true;
}
}
return false;
} | php | public static function hasTheUserSuperUserAccess($theUser)
{
if (empty($theUser)) {
return false;
}
if (Piwik::getCurrentUserLogin() === $theUser && Piwik::hasUserSuperUserAccess()) {
return true;
}
try {
$superUsers = APIUsersManager::getInstance()->getUsersHavingSuperUserAccess();
} catch (\Exception $e) {
return false;
}
foreach ($superUsers as $superUser) {
if ($theUser === $superUser['login']) {
return true;
}
}
return false;
} | [
"public",
"static",
"function",
"hasTheUserSuperUserAccess",
"(",
"$",
"theUser",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"theUser",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"Piwik",
"::",
"getCurrentUserLogin",
"(",
")",
"===",
"$",
"theUs... | Check whether the given user has superuser access.
@param string $theUser A username.
@return bool
@api | [
"Check",
"whether",
"the",
"given",
"user",
"has",
"superuser",
"access",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Piwik.php#L272-L295 | train | Returns true if the current user has Super User access | [
30522,
2270,
10763,
3853,
2038,
10760,
20330,
6342,
4842,
20330,
6305,
9623,
2015,
1006,
1002,
1996,
20330,
1007,
1063,
2065,
1006,
4064,
1006,
1002,
1996,
20330,
1007,
1007,
1063,
2709,
6270,
1025,
1065,
2065,
1006,
14255,
9148,
2243,
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... |
octobercms/october | modules/cms/controllers/Index.php | Index.getTabTitle | protected function getTabTitle($type, $template)
{
if ($type === 'page') {
$result = $template->title ?: $template->getFileName();
if (!$result) {
$result = trans('cms::lang.page.new');
}
return $result;
}
if ($type === 'partial' || $type === 'layout' || $type === 'content' || $type === 'asset') {
$result = in_array($type, ['asset', 'content']) ? $template->getFileName() : $template->getBaseFileName();
if (!$result) {
$result = trans('cms::lang.'.$type.'.new');
}
return $result;
}
return $template->getFileName();
} | php | protected function getTabTitle($type, $template)
{
if ($type === 'page') {
$result = $template->title ?: $template->getFileName();
if (!$result) {
$result = trans('cms::lang.page.new');
}
return $result;
}
if ($type === 'partial' || $type === 'layout' || $type === 'content' || $type === 'asset') {
$result = in_array($type, ['asset', 'content']) ? $template->getFileName() : $template->getBaseFileName();
if (!$result) {
$result = trans('cms::lang.'.$type.'.new');
}
return $result;
}
return $template->getFileName();
} | [
"protected",
"function",
"getTabTitle",
"(",
"$",
"type",
",",
"$",
"template",
")",
"{",
"if",
"(",
"$",
"type",
"===",
"'page'",
")",
"{",
"$",
"result",
"=",
"$",
"template",
"->",
"title",
"?",
":",
"$",
"template",
"->",
"getFileName",
"(",
")",... | Returns the text for a template tab
@param string $type
@param string $template
@return string | [
"Returns",
"the",
"text",
"for",
"a",
"template",
"tab"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/controllers/Index.php#L495-L516 | train | Get tab title | [
30522,
5123,
3853,
2131,
2696,
19279,
4183,
2571,
1006,
1002,
2828,
1010,
1002,
23561,
1007,
1063,
2065,
1006,
1002,
2828,
1027,
1027,
1027,
1005,
3931,
1005,
1007,
1063,
1002,
2765,
1027,
1002,
23561,
1011,
1028,
2516,
1029,
1024,
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/Mime.php | Zend_Mime.getNextQuotedPrintableToken | private static function getNextQuotedPrintableToken($str)
{
if(substr($str, 0, 1) == "=") {
$token = substr($str, 0, 3);
} else {
$token = substr($str, 0, 1);
}
return $token;
} | php | private static function getNextQuotedPrintableToken($str)
{
if(substr($str, 0, 1) == "=") {
$token = substr($str, 0, 3);
} else {
$token = substr($str, 0, 1);
}
return $token;
} | [
"private",
"static",
"function",
"getNextQuotedPrintableToken",
"(",
"$",
"str",
")",
"{",
"if",
"(",
"substr",
"(",
"$",
"str",
",",
"0",
",",
"1",
")",
"==",
"\"=\"",
")",
"{",
"$",
"token",
"=",
"substr",
"(",
"$",
"str",
",",
"0",
",",
"3",
"... | Retrieves the first token from a quoted printable string.
@param string $str
@return string | [
"Retrieves",
"the",
"first",
"token",
"from",
"a",
"quoted",
"printable",
"string",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Mime.php#L240-L248 | train | Get next quoted printable token | [
30522,
2797,
10763,
3853,
2131,
2638,
18413,
28940,
27428,
16550,
3085,
18715,
2368,
1006,
1002,
2358,
2099,
1007,
1063,
2065,
1006,
4942,
3367,
2099,
1006,
1002,
2358,
2099,
1010,
1014,
1010,
1015,
1007,
1027,
1027,
1000,
1027,
30524,
2358... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Route/Route.php | Route.getParam | public function getParam($param)
{
$value = $this->getGravParam($param);
if ($value === null) {
$value = $this->getQueryParam($param);
}
return $value;
} | php | public function getParam($param)
{
$value = $this->getGravParam($param);
if ($value === null) {
$value = $this->getQueryParam($param);
}
return $value;
} | [
"public",
"function",
"getParam",
"(",
"$",
"param",
")",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"getGravParam",
"(",
"$",
"param",
")",
";",
"if",
"(",
"$",
"value",
"===",
"null",
")",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"getQueryParam... | Return value of the parameter, looking into both Grav parameters and query parameters.
If the parameter exists in both, return Grav parameter.
@param string $param
@return string|null | [
"Return",
"value",
"of",
"the",
"parameter",
"looking",
"into",
"both",
"Grav",
"parameters",
"and",
"query",
"parameters",
"."
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Framework/Route/Route.php#L159-L167 | train | Get the value of a parameter | [
30522,
2270,
3853,
2131,
28689,
2213,
1006,
1002,
11498,
2213,
1007,
1063,
1002,
3643,
1027,
1002,
2023,
1011,
1028,
2131,
17643,
2615,
28689,
2213,
1006,
1002,
11498,
2213,
1007,
1025,
2065,
1006,
1002,
3643,
1027,
30524,
0,
0,
0,
0,
0... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/DependencyInjection/Compiler/ServiceReferenceGraph.php | ServiceReferenceGraph.getNode | public function getNode(string $id): ServiceReferenceGraphNode
{
if (!isset($this->nodes[$id])) {
throw new InvalidArgumentException(sprintf('There is no node with id "%s".', $id));
}
return $this->nodes[$id];
} | php | public function getNode(string $id): ServiceReferenceGraphNode
{
if (!isset($this->nodes[$id])) {
throw new InvalidArgumentException(sprintf('There is no node with id "%s".', $id));
}
return $this->nodes[$id];
} | [
"public",
"function",
"getNode",
"(",
"string",
"$",
"id",
")",
":",
"ServiceReferenceGraphNode",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"nodes",
"[",
"$",
"id",
"]",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"sprintf... | Gets a node by identifier.
@throws InvalidArgumentException if no node matches the supplied identifier | [
"Gets",
"a",
"node",
"by",
"identifier",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DependencyInjection/Compiler/ServiceReferenceGraph.php#L43-L50 | train | Returns the node with the given id. | [
30522,
2270,
3853,
2131,
3630,
3207,
1006,
5164,
1002,
8909,
1007,
1024,
2326,
2890,
25523,
14413,
3630,
3207,
1063,
2065,
1006,
999,
26354,
3388,
1006,
1002,
2023,
1011,
1028,
14164,
1031,
1002,
8909,
1033,
1007,
1007,
1063,
5466,
2047,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
dompdf/dompdf | src/Css/Stylesheet.php | Stylesheet.lookup | function lookup($key)
{
if (!isset($this->_styles[$key])) {
return null;
}
return $this->_styles[$key];
} | php | function lookup($key)
{
if (!isset($this->_styles[$key])) {
return null;
}
return $this->_styles[$key];
} | [
"function",
"lookup",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"_styles",
"[",
"$",
"key",
"]",
")",
")",
"{",
"return",
"null",
";",
"}",
"return",
"$",
"this",
"->",
"_styles",
"[",
"$",
"key",
"]",
";",
"... | lookup a specific Style collection
lookup() returns the Style collection specified by $key, or null if the Style is
not found.
@param string $key the selector of the requested Style
@return Style
@Fixme _styles is a two dimensional array. It should produce wrong results | [
"lookup",
"a",
"specific",
"Style",
"collection"
] | 75f13c700009be21a1965dc2c5b68a8708c22ba2 | https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/src/Css/Stylesheet.php#L298-L305 | train | Lookup a style by its key | [
30522,
3853,
2298,
6279,
1006,
1002,
3145,
1007,
1063,
2065,
1006,
999,
26354,
3388,
1006,
1002,
2023,
1011,
1028,
1035,
6782,
1031,
1002,
3145,
1033,
1007,
1007,
1063,
2709,
19701,
1025,
1065,
2709,
1002,
2023,
1011,
1028,
1035,
6782,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/View/Compilers/BladeCompiler.php | BladeCompiler.addFooters | protected function addFooters($result)
{
return ltrim($result, PHP_EOL)
.PHP_EOL.implode(PHP_EOL, array_reverse($this->footer));
} | php | protected function addFooters($result)
{
return ltrim($result, PHP_EOL)
.PHP_EOL.implode(PHP_EOL, array_reverse($this->footer));
} | [
"protected",
"function",
"addFooters",
"(",
"$",
"result",
")",
"{",
"return",
"ltrim",
"(",
"$",
"result",
",",
"PHP_EOL",
")",
".",
"PHP_EOL",
".",
"implode",
"(",
"PHP_EOL",
",",
"array_reverse",
"(",
"$",
"this",
"->",
"footer",
")",
")",
";",
"}"
... | Add the stored footers onto the given content.
@param string $result
@return string | [
"Add",
"the",
"stored",
"footers",
"onto",
"the",
"given",
"content",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/View/Compilers/BladeCompiler.php#L295-L299 | train | Adds footer to the page content | [
30522,
5123,
3853,
5587,
13064,
2545,
1006,
1002,
2765,
1007,
1063,
2709,
8318,
20026,
1006,
1002,
2765,
1010,
25718,
1035,
1041,
4747,
1007,
1012,
25718,
1035,
1041,
4747,
1012,
17727,
4135,
3207,
1006,
25718,
1035,
1041,
4747,
1010,
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/Intl/Intl.php | Intl.getRegionBundle | public static function getRegionBundle()
{
@trigger_error(sprintf('The method "%s()" is deprecated since Symfony 4.3, use "%s" instead.', __METHOD__, Regions::class), E_USER_DEPRECATED);
if (null === self::$regionBundle) {
self::$regionBundle = new RegionBundle(
self::getDataDirectory().'/'.self::REGION_DIR,
self::getEntryReader(),
self::$localeBundle ?? self::$localeBundle = new LocaleBundle(self::getDataDirectory().'/'.self::LOCALE_DIR, self::getEntryReader())
);
}
return self::$regionBundle;
} | php | public static function getRegionBundle()
{
@trigger_error(sprintf('The method "%s()" is deprecated since Symfony 4.3, use "%s" instead.', __METHOD__, Regions::class), E_USER_DEPRECATED);
if (null === self::$regionBundle) {
self::$regionBundle = new RegionBundle(
self::getDataDirectory().'/'.self::REGION_DIR,
self::getEntryReader(),
self::$localeBundle ?? self::$localeBundle = new LocaleBundle(self::getDataDirectory().'/'.self::LOCALE_DIR, self::getEntryReader())
);
}
return self::$regionBundle;
} | [
"public",
"static",
"function",
"getRegionBundle",
"(",
")",
"{",
"@",
"trigger_error",
"(",
"sprintf",
"(",
"'The method \"%s()\" is deprecated since Symfony 4.3, use \"%s\" instead.'",
",",
"__METHOD__",
",",
"Regions",
"::",
"class",
")",
",",
"E_USER_DEPRECATED",
")",... | Returns the bundle containing region information.
@return RegionBundleInterface The region resource bundle
@deprecated since Symfony 4.3, to be removed in 5.0. Use {@see Regions} instead. | [
"Returns",
"the",
"bundle",
"containing",
"region",
"information",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Intl/Intl.php#L193-L206 | train | Returns the region bundle | [
30522,
2270,
10763,
3853,
2131,
23784,
27265,
2571,
1006,
1007,
1063,
1030,
9495,
1035,
7561,
1006,
9043,
2546,
1006,
1005,
1996,
4118,
1000,
1003,
1055,
1006,
1007,
1000,
2003,
2139,
28139,
12921,
2144,
25353,
2213,
14876,
4890,
1018,
1012... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Mail/TransportManager.php | TransportManager.createLogDriver | protected function createLogDriver()
{
$logger = $this->app->make(LoggerInterface::class);
if ($logger instanceof LogManager) {
$logger = $logger->channel($this->app['config']['mail.log_channel']);
}
return new LogTransport($logger);
} | php | protected function createLogDriver()
{
$logger = $this->app->make(LoggerInterface::class);
if ($logger instanceof LogManager) {
$logger = $logger->channel($this->app['config']['mail.log_channel']);
}
return new LogTransport($logger);
} | [
"protected",
"function",
"createLogDriver",
"(",
")",
"{",
"$",
"logger",
"=",
"$",
"this",
"->",
"app",
"->",
"make",
"(",
"LoggerInterface",
"::",
"class",
")",
";",
"if",
"(",
"$",
"logger",
"instanceof",
"LogManager",
")",
"{",
"$",
"logger",
"=",
... | Create an instance of the Log Swift Transport driver.
@return \Illuminate\Mail\Transport\LogTransport | [
"Create",
"an",
"instance",
"of",
"the",
"Log",
"Swift",
"Transport",
"driver",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Mail/TransportManager.php#L174-L183 | train | Create Log Transport Driver | [
30522,
5123,
3853,
3443,
21197,
23663,
2099,
1006,
1007,
1063,
1002,
8833,
4590,
1027,
1002,
2023,
1011,
1028,
10439,
1011,
1028,
2191,
1006,
8833,
4590,
18447,
2121,
12172,
1024,
1024,
2465,
1007,
1025,
2065,
1006,
1002,
8833,
4590,
6013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Http/Response.php | Response.shouldBeJson | protected function shouldBeJson($content)
{
return $content instanceof Arrayable ||
$content instanceof Jsonable ||
$content instanceof ArrayObject ||
$content instanceof JsonSerializable ||
is_array($content);
} | php | protected function shouldBeJson($content)
{
return $content instanceof Arrayable ||
$content instanceof Jsonable ||
$content instanceof ArrayObject ||
$content instanceof JsonSerializable ||
is_array($content);
} | [
"protected",
"function",
"shouldBeJson",
"(",
"$",
"content",
")",
"{",
"return",
"$",
"content",
"instanceof",
"Arrayable",
"||",
"$",
"content",
"instanceof",
"Jsonable",
"||",
"$",
"content",
"instanceof",
"ArrayObject",
"||",
"$",
"content",
"instanceof",
"J... | Determine if the given content should be turned into JSON.
@param mixed $content
@return bool | [
"Determine",
"if",
"the",
"given",
"content",
"should",
"be",
"turned",
"into",
"JSON",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Http/Response.php#L56-L63 | train | Checks if content is a Jsonable Arrayable ArrayObject JsonSerializable | [
30522,
5123,
3853,
2323,
4783,
22578,
2239,
1006,
1002,
4180,
1007,
1063,
2709,
1002,
4180,
6013,
11253,
9140,
3085,
1064,
1064,
1002,
4180,
6013,
11253,
1046,
3385,
3085,
1064,
1064,
1002,
4180,
6013,
11253,
9140,
16429,
20614,
1064,
1064,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getgrav/grav | system/src/Grav/Common/GPM/GPM.php | GPM.getBlueprints | public static function getBlueprints($source)
{
$blueprint_file = $source . 'blueprints.yaml';
if (!file_exists($blueprint_file)) {
return false;
}
$file = YamlFile::instance($blueprint_file);
$blueprint = (array)$file->content();
$file->free();
return $blueprint;
} | php | public static function getBlueprints($source)
{
$blueprint_file = $source . 'blueprints.yaml';
if (!file_exists($blueprint_file)) {
return false;
}
$file = YamlFile::instance($blueprint_file);
$blueprint = (array)$file->content();
$file->free();
return $blueprint;
} | [
"public",
"static",
"function",
"getBlueprints",
"(",
"$",
"source",
")",
"{",
"$",
"blueprint_file",
"=",
"$",
"source",
".",
"'blueprints.yaml'",
";",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"blueprint_file",
")",
")",
"{",
"return",
"false",
";",
"}",
... | Find/Parse the blueprint file
@param string $source
@return array|bool | [
"Find",
"/",
"Parse",
"the",
"blueprint",
"file"
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/GPM/GPM.php#L624-L636 | train | Get blueprints from source | [
30522,
2270,
10763,
3853,
2131,
16558,
5657,
16550,
2015,
1006,
1002,
3120,
1007,
1063,
1002,
2630,
16550,
1035,
5371,
1027,
1002,
3120,
1012,
1005,
2630,
16550,
2015,
1012,
8038,
19968,
1005,
1025,
2065,
1006,
999,
5371,
1035,
6526,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/Zend/Mail/Protocol/Pop3.php | Zend_Mail_Protocol_Pop3.status | public function status(&$messages, &$octets)
{
$messages = 0;
$octets = 0;
$result = $this->request('STAT');
list($messages, $octets) = explode(' ', $result);
} | php | public function status(&$messages, &$octets)
{
$messages = 0;
$octets = 0;
$result = $this->request('STAT');
list($messages, $octets) = explode(' ', $result);
} | [
"public",
"function",
"status",
"(",
"&",
"$",
"messages",
",",
"&",
"$",
"octets",
")",
"{",
"$",
"messages",
"=",
"0",
";",
"$",
"octets",
"=",
"0",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"request",
"(",
"'STAT'",
")",
";",
"list",
"(",
... | Make STAT call for message count and size sum
@param int $messages out parameter with count of messages
@param int $octets out parameter with size in octects of messages
@return void
@throws Zend_Mail_Protocol_Exception | [
"Make",
"STAT",
"call",
"for",
"message",
"count",
"and",
"size",
"sum"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Mail/Protocol/Pop3.php#L294-L301 | train | Get status of the current page | [
30522,
2270,
3853,
3570,
1006,
1004,
1002,
7696,
1010,
1004,
1002,
13323,
8454,
1007,
1063,
1002,
7696,
1027,
1014,
1025,
1002,
13323,
8454,
1027,
1014,
1025,
1002,
2765,
1027,
1002,
2023,
1011,
1028,
5227,
1006,
1005,
28093,
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... |
symfony/symfony | src/Symfony/Component/HttpFoundation/ResponseHeaderBag.php | ResponseHeaderBag.computeCacheControlValue | protected function computeCacheControlValue()
{
if (!$this->cacheControl && !$this->has('ETag') && !$this->has('Last-Modified') && !$this->has('Expires')) {
return 'no-cache, private';
}
if (!$this->cacheControl) {
// conservative by default
return 'private, must-revalidate';
}
$header = $this->getCacheControlHeader();
if (isset($this->cacheControl['public']) || isset($this->cacheControl['private'])) {
return $header;
}
// public if s-maxage is defined, private otherwise
if (!isset($this->cacheControl['s-maxage'])) {
return $header.', private';
}
return $header;
} | php | protected function computeCacheControlValue()
{
if (!$this->cacheControl && !$this->has('ETag') && !$this->has('Last-Modified') && !$this->has('Expires')) {
return 'no-cache, private';
}
if (!$this->cacheControl) {
// conservative by default
return 'private, must-revalidate';
}
$header = $this->getCacheControlHeader();
if (isset($this->cacheControl['public']) || isset($this->cacheControl['private'])) {
return $header;
}
// public if s-maxage is defined, private otherwise
if (!isset($this->cacheControl['s-maxage'])) {
return $header.', private';
}
return $header;
} | [
"protected",
"function",
"computeCacheControlValue",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"cacheControl",
"&&",
"!",
"$",
"this",
"->",
"has",
"(",
"'ETag'",
")",
"&&",
"!",
"$",
"this",
"->",
"has",
"(",
"'Last-Modified'",
")",
"&&",
"!",... | Returns the calculated value of the cache-control header.
This considers several other headers and calculates or modifies the
cache-control header to a sensible, conservative value.
@return string | [
"Returns",
"the",
"calculated",
"value",
"of",
"the",
"cache",
"-",
"control",
"header",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpFoundation/ResponseHeaderBag.php#L268-L290 | train | Compute the Cache - Control value | [
30522,
5123,
3853,
24134,
3540,
5403,
8663,
13181,
22144,
7630,
2063,
1006,
1007,
1063,
2065,
1006,
999,
1002,
2023,
1011,
1028,
17053,
8663,
13181,
2140,
1004,
1004,
999,
1002,
2023,
1011,
1028,
2038,
1006,
1005,
27859,
2290,
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... |
symfony/symfony | src/Symfony/Component/Form/Extension/Core/Type/FormType.php | FormType.buildView | public function buildView(FormView $view, FormInterface $form, array $options)
{
parent::buildView($view, $form, $options);
$name = $form->getName();
$helpTranslationParameters = $options['help_translation_parameters'];
if ($view->parent) {
if ('' === $name) {
throw new LogicException('Form node with empty name can be used only as root form node.');
}
// Complex fields are read-only if they themselves or their parents are.
if (!isset($view->vars['attr']['readonly']) && isset($view->parent->vars['attr']['readonly']) && false !== $view->parent->vars['attr']['readonly']) {
$view->vars['attr']['readonly'] = true;
}
$helpTranslationParameters = array_merge($view->parent->vars['help_translation_parameters'], $helpTranslationParameters);
}
$formConfig = $form->getConfig();
$view->vars = array_replace($view->vars, [
'errors' => $form->getErrors(),
'valid' => $form->isSubmitted() ? $form->isValid() : true,
'value' => $form->getViewData(),
'data' => $form->getNormData(),
'required' => $form->isRequired(),
'size' => null,
'label_attr' => $options['label_attr'],
'help' => $options['help'],
'help_attr' => $options['help_attr'],
'help_html' => $options['help_html'],
'help_translation_parameters' => $helpTranslationParameters,
'compound' => $formConfig->getCompound(),
'method' => $formConfig->getMethod(),
'action' => $formConfig->getAction(),
'submitted' => $form->isSubmitted(),
]);
} | php | public function buildView(FormView $view, FormInterface $form, array $options)
{
parent::buildView($view, $form, $options);
$name = $form->getName();
$helpTranslationParameters = $options['help_translation_parameters'];
if ($view->parent) {
if ('' === $name) {
throw new LogicException('Form node with empty name can be used only as root form node.');
}
// Complex fields are read-only if they themselves or their parents are.
if (!isset($view->vars['attr']['readonly']) && isset($view->parent->vars['attr']['readonly']) && false !== $view->parent->vars['attr']['readonly']) {
$view->vars['attr']['readonly'] = true;
}
$helpTranslationParameters = array_merge($view->parent->vars['help_translation_parameters'], $helpTranslationParameters);
}
$formConfig = $form->getConfig();
$view->vars = array_replace($view->vars, [
'errors' => $form->getErrors(),
'valid' => $form->isSubmitted() ? $form->isValid() : true,
'value' => $form->getViewData(),
'data' => $form->getNormData(),
'required' => $form->isRequired(),
'size' => null,
'label_attr' => $options['label_attr'],
'help' => $options['help'],
'help_attr' => $options['help_attr'],
'help_html' => $options['help_html'],
'help_translation_parameters' => $helpTranslationParameters,
'compound' => $formConfig->getCompound(),
'method' => $formConfig->getMethod(),
'action' => $formConfig->getAction(),
'submitted' => $form->isSubmitted(),
]);
} | [
"public",
"function",
"buildView",
"(",
"FormView",
"$",
"view",
",",
"FormInterface",
"$",
"form",
",",
"array",
"$",
"options",
")",
"{",
"parent",
"::",
"buildView",
"(",
"$",
"view",
",",
"$",
"form",
",",
"$",
"options",
")",
";",
"$",
"name",
"... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Extension/Core/Type/FormType.php#L66-L104 | train | Build the view | [
30522,
2270,
3853,
3857,
8584,
1006,
2433,
8584,
1002,
3193,
1010,
2433,
18447,
2121,
12172,
1002,
2433,
1010,
9140,
1002,
7047,
1007,
1063,
6687,
1024,
1024,
3857,
8584,
1006,
1002,
3193,
1010,
1002,
2433,
1010,
1002,
7047,
1007,
1025,
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/Scheduler/Scheduler.php | Scheduler.pushFailedJob | private function pushFailedJob(Job $job)
{
$this->failed_jobs[] = $job;
$command = $job->getCommand();
// If callable, log the string Closure
if (is_callable($command)) {
$command = \is_string($command) ? $command : 'Closure';
}
$output = trim($job->getOutput());
$this->addSchedulerVerboseOutput("<red>Error</red>: <white>{$command}</white> → <normal>{$output}</normal>");
return $job;
} | php | private function pushFailedJob(Job $job)
{
$this->failed_jobs[] = $job;
$command = $job->getCommand();
// If callable, log the string Closure
if (is_callable($command)) {
$command = \is_string($command) ? $command : 'Closure';
}
$output = trim($job->getOutput());
$this->addSchedulerVerboseOutput("<red>Error</red>: <white>{$command}</white> → <normal>{$output}</normal>");
return $job;
} | [
"private",
"function",
"pushFailedJob",
"(",
"Job",
"$",
"job",
")",
"{",
"$",
"this",
"->",
"failed_jobs",
"[",
"]",
"=",
"$",
"job",
";",
"$",
"command",
"=",
"$",
"job",
"->",
"getCommand",
"(",
")",
";",
"// If callable, log the string Closure",
"if",
... | Push a failed job.
@param Job $job
@return Job | [
"Push",
"a",
"failed",
"job",
"."
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Scheduler/Scheduler.php#L348-L360 | train | Pushes a failed job onto the failed_jobs array | [
30522,
2797,
3853,
5245,
7011,
18450,
5558,
2497,
1006,
3105,
1002,
3105,
1007,
1063,
1002,
2023,
1011,
1028,
3478,
1035,
5841,
1031,
1033,
1027,
1002,
3105,
1025,
1002,
3094,
1027,
1002,
3105,
1011,
1028,
2131,
9006,
2386,
2094,
1006,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/backend/widgets/Filter.php | Filter.optionsToAjax | protected function optionsToAjax($options)
{
$processed = [];
foreach ($options as $id => $result) {
$processed[] = ['id' => $id, 'name' => trans($result)];
}
return $processed;
} | php | protected function optionsToAjax($options)
{
$processed = [];
foreach ($options as $id => $result) {
$processed[] = ['id' => $id, 'name' => trans($result)];
}
return $processed;
} | [
"protected",
"function",
"optionsToAjax",
"(",
"$",
"options",
")",
"{",
"$",
"processed",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"options",
"as",
"$",
"id",
"=>",
"$",
"result",
")",
"{",
"$",
"processed",
"[",
"]",
"=",
"[",
"'id'",
"=>",
"$",
... | Convert a key/pair array to a named array {id: 1, name: 'Foobar'}
@param array $options
@return array | [
"Convert",
"a",
"key",
"/",
"pair",
"array",
"to",
"a",
"named",
"array",
"{",
"id",
":",
"1",
"name",
":",
"Foobar",
"}"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/Filter.php#L933-L940 | train | Convert options to array for ajax | [
30522,
5123,
3853,
7047,
3406,
22734,
2595,
1006,
1002,
7047,
1007,
1063,
1002,
13995,
1027,
1031,
1033,
1025,
18921,
6776,
1006,
1002,
7047,
2004,
1002,
8909,
1027,
1028,
1002,
2765,
1007,
1063,
1002,
13995,
1031,
1033,
1027,
1031,
1005,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/CronArchive.php | CronArchive.main | public function main()
{
if ($this->isMaintenanceModeEnabled()) {
$this->logger->info("Archiving won't run because maintenance mode is enabled");
return;
}
$self = $this;
Access::doAsSuperUser(function () use ($self) {
$self->init();
$self->run();
$self->runScheduledTasks();
$self->end();
});
} | php | public function main()
{
if ($this->isMaintenanceModeEnabled()) {
$this->logger->info("Archiving won't run because maintenance mode is enabled");
return;
}
$self = $this;
Access::doAsSuperUser(function () use ($self) {
$self->init();
$self->run();
$self->runScheduledTasks();
$self->end();
});
} | [
"public",
"function",
"main",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isMaintenanceModeEnabled",
"(",
")",
")",
"{",
"$",
"this",
"->",
"logger",
"->",
"info",
"(",
"\"Archiving won't run because maintenance mode is enabled\"",
")",
";",
"return",
";",
"... | Initializes and runs the cron archiver. | [
"Initializes",
"and",
"runs",
"the",
"cron",
"archiver",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/CronArchive.php#L306-L320 | train | Main entry point for the archiving process. | [
30522,
2270,
3853,
2364,
1006,
1007,
1063,
2065,
1006,
1002,
2023,
1011,
1028,
2003,
24238,
6528,
6651,
5302,
26095,
22966,
2094,
1006,
1007,
1007,
1063,
1002,
2023,
1011,
1028,
8833,
4590,
1011,
1028,
18558,
1006,
1000,
7905,
14966,
2180,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
z-song/laravel-admin | src/Form/Field/UploadField.php | UploadField.upload | protected function upload(UploadedFile $file)
{
$this->renameIfExists($file);
if (!is_null($this->storage_permission)) {
return $this->storage->putFileAs($this->getDirectory(), $file, $this->name, $this->storage_permission);
}
return $this->storage->putFileAs($this->getDirectory(), $file, $this->name);
} | php | protected function upload(UploadedFile $file)
{
$this->renameIfExists($file);
if (!is_null($this->storage_permission)) {
return $this->storage->putFileAs($this->getDirectory(), $file, $this->name, $this->storage_permission);
}
return $this->storage->putFileAs($this->getDirectory(), $file, $this->name);
} | [
"protected",
"function",
"upload",
"(",
"UploadedFile",
"$",
"file",
")",
"{",
"$",
"this",
"->",
"renameIfExists",
"(",
"$",
"file",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"this",
"->",
"storage_permission",
")",
")",
"{",
"return",
"$",
"this... | Upload file and delete original file.
@param UploadedFile $file
@return mixed | [
"Upload",
"file",
"and",
"delete",
"original",
"file",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Form/Field/UploadField.php#L295-L304 | train | Upload file to the storage directory | [
30522,
5123,
3853,
2039,
11066,
1006,
21345,
8873,
2571,
1002,
5371,
1007,
1063,
1002,
2023,
1011,
1028,
14916,
14074,
29323,
9048,
12837,
1006,
1002,
5371,
1007,
1025,
2065,
1006,
999,
2003,
1035,
19701,
1006,
1002,
2023,
1011,
1028,
5527,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Redis/Connections/PhpRedisConnection.php | PhpRedisConnection.zinterstore | public function zinterstore($output, $keys, $options = [])
{
return $this->command('zInter', [$output, $keys,
$options['weights'] ?? null,
$options['aggregate'] ?? 'sum',
]);
} | php | public function zinterstore($output, $keys, $options = [])
{
return $this->command('zInter', [$output, $keys,
$options['weights'] ?? null,
$options['aggregate'] ?? 'sum',
]);
} | [
"public",
"function",
"zinterstore",
"(",
"$",
"output",
",",
"$",
"keys",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"command",
"(",
"'zInter'",
",",
"[",
"$",
"output",
",",
"$",
"keys",
",",
"$",
"options",
"[",
... | Find the intersection between sets and store in a new set.
@param string $output
@param array $keys
@param array $options
@return int | [
"Find",
"the",
"intersection",
"between",
"sets",
"and",
"store",
"in",
"a",
"new",
"set",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Redis/Connections/PhpRedisConnection.php#L268-L274 | train | Interstore - store data into cache store | [
30522,
2270,
3853,
1062,
18447,
2545,
19277,
1006,
1002,
6434,
1010,
1002,
6309,
1010,
1002,
7047,
1027,
1031,
1033,
1007,
1063,
2709,
1002,
2023,
1011,
1028,
3094,
1006,
1005,
1062,
18447,
2121,
1005,
1010,
1031,
1002,
6434,
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... |
getgrav/grav | system/src/Grav/Common/GPM/GPM.php | GPM.getDependencies | public function getDependencies($packages)
{
$dependencies = $this->calculateMergedDependenciesOfPackages($packages);
foreach ($dependencies as $dependency_slug => $dependencyVersionWithOperator) {
if (\in_array($dependency_slug, $packages, true)) {
unset($dependencies[$dependency_slug]);
continue;
}
// Check PHP version
if ($dependency_slug === 'php') {
$current_php_version = phpversion();
if (version_compare($this->calculateVersionNumberFromDependencyVersion($dependencyVersionWithOperator),
$current_php_version) === 1
) {
//Needs a Grav update first
throw new \RuntimeException("<red>One of the packages require PHP {$dependencies['php']}. Please update PHP to resolve this");
} else {
unset($dependencies[$dependency_slug]);
continue;
}
}
//First, check for Grav dependency. If a dependency requires Grav > the current version, abort and tell.
if ($dependency_slug === 'grav') {
if (version_compare($this->calculateVersionNumberFromDependencyVersion($dependencyVersionWithOperator),
GRAV_VERSION) === 1
) {
//Needs a Grav update first
throw new \RuntimeException("<red>One of the packages require Grav {$dependencies['grav']}. Please update Grav to the latest release.");
} else {
unset($dependencies[$dependency_slug]);
continue;
}
}
if ($this->isPluginInstalled($dependency_slug)) {
if ($this->isPluginInstalledAsSymlink($dependency_slug)) {
unset($dependencies[$dependency_slug]);
continue;
}
$dependencyVersion = $this->calculateVersionNumberFromDependencyVersion($dependencyVersionWithOperator);
// get currently installed version
$locator = Grav::instance()['locator'];
$blueprints_path = $locator->findResource('plugins://' . $dependency_slug . DS . 'blueprints.yaml');
$file = YamlFile::instance($blueprints_path);
$package_yaml = $file->content();
$file->free();
$currentlyInstalledVersion = $package_yaml['version'];
// if requirement is next significant release, check is compatible with currently installed version, might not be
if ($this->versionFormatIsNextSignificantRelease($dependencyVersionWithOperator)) {
if ($this->firstVersionIsLower($dependencyVersion, $currentlyInstalledVersion)) {
$compatible = $this->checkNextSignificantReleasesAreCompatible($dependencyVersion,
$currentlyInstalledVersion);
if (!$compatible) {
throw new \RuntimeException('Dependency <cyan>' . $dependency_slug . '</cyan> is required in an older version than the one installed. This package must be updated. Please get in touch with its developer.',
2);
}
}
}
//if I already have the latest release, remove the dependency
$latestRelease = $this->getLatestVersionOfPackage($dependency_slug);
if ($this->firstVersionIsLower($latestRelease, $dependencyVersion)) {
//throw an exception if a required version cannot be found in the GPM yet
throw new \RuntimeException('Dependency <cyan>' . $package_yaml['name'] . '</cyan> is required in version <cyan>' . $dependencyVersion . '</cyan> which is higher than the latest release, <cyan>' . $latestRelease . '</cyan>. Try running `bin/gpm -f index` to force a refresh of the GPM cache',
1);
}
if ($this->firstVersionIsLower($currentlyInstalledVersion, $dependencyVersion)) {
$dependencies[$dependency_slug] = 'update';
} else {
if ($currentlyInstalledVersion == $latestRelease) {
unset($dependencies[$dependency_slug]);
} else {
// an update is not strictly required mark as 'ignore'
$dependencies[$dependency_slug] = 'ignore';
}
}
} else {
$dependencyVersion = $this->calculateVersionNumberFromDependencyVersion($dependencyVersionWithOperator);
// if requirement is next significant release, check is compatible with latest available version, might not be
if ($this->versionFormatIsNextSignificantRelease($dependencyVersionWithOperator)) {
$latestVersionOfPackage = $this->getLatestVersionOfPackage($dependency_slug);
if ($this->firstVersionIsLower($dependencyVersion, $latestVersionOfPackage)) {
$compatible = $this->checkNextSignificantReleasesAreCompatible($dependencyVersion,
$latestVersionOfPackage);
if (!$compatible) {
throw new \Exception('Dependency <cyan>' . $dependency_slug . '</cyan> is required in an older version than the latest release available, and it cannot be installed. This package must be updated. Please get in touch with its developer.',
2);
}
}
}
$dependencies[$dependency_slug] = 'install';
}
}
$dependencies_slugs = array_keys($dependencies);
$this->checkNoOtherPackageNeedsTheseDependenciesInALowerVersion(array_merge($packages, $dependencies_slugs));
return $dependencies;
} | php | public function getDependencies($packages)
{
$dependencies = $this->calculateMergedDependenciesOfPackages($packages);
foreach ($dependencies as $dependency_slug => $dependencyVersionWithOperator) {
if (\in_array($dependency_slug, $packages, true)) {
unset($dependencies[$dependency_slug]);
continue;
}
// Check PHP version
if ($dependency_slug === 'php') {
$current_php_version = phpversion();
if (version_compare($this->calculateVersionNumberFromDependencyVersion($dependencyVersionWithOperator),
$current_php_version) === 1
) {
//Needs a Grav update first
throw new \RuntimeException("<red>One of the packages require PHP {$dependencies['php']}. Please update PHP to resolve this");
} else {
unset($dependencies[$dependency_slug]);
continue;
}
}
//First, check for Grav dependency. If a dependency requires Grav > the current version, abort and tell.
if ($dependency_slug === 'grav') {
if (version_compare($this->calculateVersionNumberFromDependencyVersion($dependencyVersionWithOperator),
GRAV_VERSION) === 1
) {
//Needs a Grav update first
throw new \RuntimeException("<red>One of the packages require Grav {$dependencies['grav']}. Please update Grav to the latest release.");
} else {
unset($dependencies[$dependency_slug]);
continue;
}
}
if ($this->isPluginInstalled($dependency_slug)) {
if ($this->isPluginInstalledAsSymlink($dependency_slug)) {
unset($dependencies[$dependency_slug]);
continue;
}
$dependencyVersion = $this->calculateVersionNumberFromDependencyVersion($dependencyVersionWithOperator);
// get currently installed version
$locator = Grav::instance()['locator'];
$blueprints_path = $locator->findResource('plugins://' . $dependency_slug . DS . 'blueprints.yaml');
$file = YamlFile::instance($blueprints_path);
$package_yaml = $file->content();
$file->free();
$currentlyInstalledVersion = $package_yaml['version'];
// if requirement is next significant release, check is compatible with currently installed version, might not be
if ($this->versionFormatIsNextSignificantRelease($dependencyVersionWithOperator)) {
if ($this->firstVersionIsLower($dependencyVersion, $currentlyInstalledVersion)) {
$compatible = $this->checkNextSignificantReleasesAreCompatible($dependencyVersion,
$currentlyInstalledVersion);
if (!$compatible) {
throw new \RuntimeException('Dependency <cyan>' . $dependency_slug . '</cyan> is required in an older version than the one installed. This package must be updated. Please get in touch with its developer.',
2);
}
}
}
//if I already have the latest release, remove the dependency
$latestRelease = $this->getLatestVersionOfPackage($dependency_slug);
if ($this->firstVersionIsLower($latestRelease, $dependencyVersion)) {
//throw an exception if a required version cannot be found in the GPM yet
throw new \RuntimeException('Dependency <cyan>' . $package_yaml['name'] . '</cyan> is required in version <cyan>' . $dependencyVersion . '</cyan> which is higher than the latest release, <cyan>' . $latestRelease . '</cyan>. Try running `bin/gpm -f index` to force a refresh of the GPM cache',
1);
}
if ($this->firstVersionIsLower($currentlyInstalledVersion, $dependencyVersion)) {
$dependencies[$dependency_slug] = 'update';
} else {
if ($currentlyInstalledVersion == $latestRelease) {
unset($dependencies[$dependency_slug]);
} else {
// an update is not strictly required mark as 'ignore'
$dependencies[$dependency_slug] = 'ignore';
}
}
} else {
$dependencyVersion = $this->calculateVersionNumberFromDependencyVersion($dependencyVersionWithOperator);
// if requirement is next significant release, check is compatible with latest available version, might not be
if ($this->versionFormatIsNextSignificantRelease($dependencyVersionWithOperator)) {
$latestVersionOfPackage = $this->getLatestVersionOfPackage($dependency_slug);
if ($this->firstVersionIsLower($dependencyVersion, $latestVersionOfPackage)) {
$compatible = $this->checkNextSignificantReleasesAreCompatible($dependencyVersion,
$latestVersionOfPackage);
if (!$compatible) {
throw new \Exception('Dependency <cyan>' . $dependency_slug . '</cyan> is required in an older version than the latest release available, and it cannot be installed. This package must be updated. Please get in touch with its developer.',
2);
}
}
}
$dependencies[$dependency_slug] = 'install';
}
}
$dependencies_slugs = array_keys($dependencies);
$this->checkNoOtherPackageNeedsTheseDependenciesInALowerVersion(array_merge($packages, $dependencies_slugs));
return $dependencies;
} | [
"public",
"function",
"getDependencies",
"(",
"$",
"packages",
")",
"{",
"$",
"dependencies",
"=",
"$",
"this",
"->",
"calculateMergedDependenciesOfPackages",
"(",
"$",
"packages",
")",
";",
"foreach",
"(",
"$",
"dependencies",
"as",
"$",
"dependency_slug",
"=>"... | Fetch the dependencies, check the installed packages and return an array with
the list of packages with associated an information on what to do: install, update or ignore.
`ignore` means the package is already installed and can be safely left as-is.
`install` means the package is not installed and must be installed.
`update` means the package is already installed and must be updated as a dependency needs a higher version.
@param array $packages
@return mixed
@throws \Exception | [
"Fetch",
"the",
"dependencies",
"check",
"the",
"installed",
"packages",
"and",
"return",
"an",
"array",
"with",
"the",
"list",
"of",
"packages",
"with",
"associated",
"an",
"information",
"on",
"what",
"to",
"do",
":",
"install",
"update",
"or",
"ignore",
"... | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/GPM/GPM.php#L836-L945 | train | Returns all dependencies of the packages | [
30522,
2270,
3853,
2131,
3207,
11837,
4181,
9243,
1006,
1002,
14555,
1007,
1063,
1002,
12530,
15266,
1027,
1002,
2023,
1011,
1028,
18422,
5017,
5999,
3207,
11837,
4181,
9243,
11253,
23947,
13923,
1006,
1002,
14555,
1007,
1025,
18921,
6776,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php | ValidatePostSize.getPostMaxSize | protected function getPostMaxSize()
{
if (is_numeric($postMaxSize = ini_get('post_max_size'))) {
return (int) $postMaxSize;
}
$metric = strtoupper(substr($postMaxSize, -1));
$postMaxSize = (int) $postMaxSize;
switch ($metric) {
case 'K':
return $postMaxSize * 1024;
case 'M':
return $postMaxSize * 1048576;
case 'G':
return $postMaxSize * 1073741824;
default:
return $postMaxSize;
}
} | php | protected function getPostMaxSize()
{
if (is_numeric($postMaxSize = ini_get('post_max_size'))) {
return (int) $postMaxSize;
}
$metric = strtoupper(substr($postMaxSize, -1));
$postMaxSize = (int) $postMaxSize;
switch ($metric) {
case 'K':
return $postMaxSize * 1024;
case 'M':
return $postMaxSize * 1048576;
case 'G':
return $postMaxSize * 1073741824;
default:
return $postMaxSize;
}
} | [
"protected",
"function",
"getPostMaxSize",
"(",
")",
"{",
"if",
"(",
"is_numeric",
"(",
"$",
"postMaxSize",
"=",
"ini_get",
"(",
"'post_max_size'",
")",
")",
")",
"{",
"return",
"(",
"int",
")",
"$",
"postMaxSize",
";",
"}",
"$",
"metric",
"=",
"strtoupp... | Determine the server 'post_max_size' as bytes.
@return int | [
"Determine",
"the",
"server",
"post_max_size",
"as",
"bytes",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php#L35-L54 | train | Get Post Max Size | [
30522,
5123,
3853,
2131,
19894,
17848,
5332,
4371,
1006,
1007,
1063,
2065,
1006,
2003,
1035,
16371,
25531,
1006,
1002,
2695,
17848,
5332,
4371,
1027,
1999,
2072,
1035,
2131,
1006,
1005,
2695,
1035,
4098,
1035,
2946,
1005,
1007,
1007,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Auth/Middleware/Authenticate.php | Authenticate.handle | public function handle($request, Closure $next, ...$guards)
{
$this->authenticate($request, $guards);
return $next($request);
} | php | public function handle($request, Closure $next, ...$guards)
{
$this->authenticate($request, $guards);
return $next($request);
} | [
"public",
"function",
"handle",
"(",
"$",
"request",
",",
"Closure",
"$",
"next",
",",
"...",
"$",
"guards",
")",
"{",
"$",
"this",
"->",
"authenticate",
"(",
"$",
"request",
",",
"$",
"guards",
")",
";",
"return",
"$",
"next",
"(",
"$",
"request",
... | Handle an incoming request.
@param \Illuminate\Http\Request $request
@param \Closure $next
@param string[] ...$guards
@return mixed
@throws \Illuminate\Auth\AuthenticationException | [
"Handle",
"an",
"incoming",
"request",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Auth/Middleware/Authenticate.php#L39-L44 | train | Handle the request and return the response. | [
30522,
2270,
3853,
5047,
1006,
1002,
5227,
1010,
8503,
1002,
2279,
1010,
1012,
1012,
1012,
1002,
4932,
1007,
1063,
1002,
2023,
1011,
1028,
14469,
3686,
1006,
1002,
5227,
1010,
1002,
4932,
1007,
1025,
2709,
1002,
2279,
1006,
1002,
5227,
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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.