repo stringclasses 21 values | path stringlengths 10 105 | func_name stringlengths 6 64 | original_string stringlengths 105 15.6k | language stringclasses 1 value | code stringlengths 105 15.6k | code_tokens listlengths 29 2.15k | docstring stringlengths 11 2.85k | docstring_tokens listlengths 1 290 | sha stringclasses 21 values | url stringlengths 100 194 | partition stringclasses 1 value | summary stringlengths 8 319 | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
octobercms/october | modules/system/models/EventLog.php | EventLog.getSummaryAttribute | public function getSummaryAttribute()
{
if (preg_match("/with message '(.+)' in/", $this->message, $match)) {
return $match[1];
}
return Str::limit($this->message, 100);
} | php | public function getSummaryAttribute()
{
if (preg_match("/with message '(.+)' in/", $this->message, $match)) {
return $match[1];
}
return Str::limit($this->message, 100);
} | [
"public",
"function",
"getSummaryAttribute",
"(",
")",
"{",
"if",
"(",
"preg_match",
"(",
"\"/with message '(.+)' in/\"",
",",
"$",
"this",
"->",
"message",
",",
"$",
"match",
")",
")",
"{",
"return",
"$",
"match",
"[",
"1",
"]",
";",
"}",
"return",
"Str... | Creates a shorter version of the message attribute,
extracts the exception message or limits by 100 characters.
@return string | [
"Creates",
"a",
"shorter",
"version",
"of",
"the",
"message",
"attribute",
"extracts",
"the",
"exception",
"message",
"or",
"limits",
"by",
"100",
"characters",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/models/EventLog.php#L81-L88 | train | Get the summary attribute | [
30522,
2270,
3853,
4152,
2819,
7849,
26139,
18886,
8569,
2618,
1006,
1007,
1063,
2065,
1006,
3653,
2290,
1035,
2674,
1006,
1000,
1013,
2007,
4471,
1005,
1006,
1012,
1009,
1007,
1005,
1999,
1013,
1000,
1010,
1002,
2023,
1011,
1028,
4471,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Foundation/Exceptions/Handler.php | Handler.report | public function report(Exception $e)
{
if ($this->shouldntReport($e)) {
return;
}
if (is_callable($reportCallable = [$e, 'report'])) {
return $this->container->call($reportCallable);
}
try {
$logger = $this->container->make(LoggerInterface::class);
} catch (Exception $ex) {
throw $e;
}
$logger->error(
$e->getMessage(),
array_merge($this->context(), ['exception' => $e]
));
} | php | public function report(Exception $e)
{
if ($this->shouldntReport($e)) {
return;
}
if (is_callable($reportCallable = [$e, 'report'])) {
return $this->container->call($reportCallable);
}
try {
$logger = $this->container->make(LoggerInterface::class);
} catch (Exception $ex) {
throw $e;
}
$logger->error(
$e->getMessage(),
array_merge($this->context(), ['exception' => $e]
));
} | [
"public",
"function",
"report",
"(",
"Exception",
"$",
"e",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"shouldntReport",
"(",
"$",
"e",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"is_callable",
"(",
"$",
"reportCallable",
"=",
"[",
"$",
"e",
",",
... | Report or log an exception.
@param \Exception $e
@return mixed
@throws \Exception | [
"Report",
"or",
"log",
"an",
"exception",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Foundation/Exceptions/Handler.php#L96-L116 | train | Report the exception to the logger | [
30522,
2270,
3853,
3189,
1006,
6453,
1002,
1041,
1007,
1063,
2065,
1006,
1002,
2023,
1011,
1028,
5807,
7913,
6442,
1006,
1002,
1041,
1007,
1007,
1063,
2709,
1025,
1065,
2065,
1006,
2003,
1035,
2655,
3085,
1006,
1002,
3189,
9289,
20470,
25... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/UploadedFile.php | UploadedFile.storePublicly | public function storePublicly($path, $options = [])
{
$options = $this->parseOptions($options);
$options['visibility'] = 'public';
return $this->storeAs($path, $this->hashName(), $options);
} | php | public function storePublicly($path, $options = [])
{
$options = $this->parseOptions($options);
$options['visibility'] = 'public';
return $this->storeAs($path, $this->hashName(), $options);
} | [
"public",
"function",
"storePublicly",
"(",
"$",
"path",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"options",
"=",
"$",
"this",
"->",
"parseOptions",
"(",
"$",
"options",
")",
";",
"$",
"options",
"[",
"'visibility'",
"]",
"=",
"'public'",
"... | Store the uploaded file on a filesystem disk with public visibility.
@param string $path
@param array|string $options
@return string|false | [
"Store",
"the",
"uploaded",
"file",
"on",
"a",
"filesystem",
"disk",
"with",
"public",
"visibility",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Http/UploadedFile.php#L45-L52 | train | Store the current page as publicly | [
30522,
2270,
3853,
3573,
14289,
16558,
2594,
2135,
1006,
1002,
4130,
1010,
1002,
7047,
1027,
1031,
1033,
1007,
1063,
1002,
7047,
1027,
1002,
2023,
1011,
1028,
11968,
3366,
7361,
9285,
1006,
1002,
7047,
1007,
1025,
1002,
7047,
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... |
laravel/framework | src/Illuminate/Filesystem/FilesystemAdapter.php | FilesystemAdapter.putFile | public function putFile($path, $file, $options = [])
{
return $this->putFileAs($path, $file, $file->hashName(), $options);
} | php | public function putFile($path, $file, $options = [])
{
return $this->putFileAs($path, $file, $file->hashName(), $options);
} | [
"public",
"function",
"putFile",
"(",
"$",
"path",
",",
"$",
"file",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"putFileAs",
"(",
"$",
"path",
",",
"$",
"file",
",",
"$",
"file",
"->",
"hashName",
"(",
")",
",",
... | Store the uploaded file on the disk.
@param string $path
@param \Illuminate\Http\File|\Illuminate\Http\UploadedFile $file
@param array $options
@return string|false | [
"Store",
"the",
"uploaded",
"file",
"on",
"the",
"disk",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Filesystem/FilesystemAdapter.php#L206-L209 | train | Put a file to the cache | [
30522,
2270,
3853,
2404,
8873,
2571,
1006,
1002,
4130,
1010,
1002,
5371,
1010,
1002,
7047,
1027,
1031,
1033,
1007,
1063,
2709,
1002,
2023,
1011,
1028,
2404,
8873,
19738,
2015,
1006,
1002,
4130,
1010,
1002,
5371,
1010,
1002,
5371,
1011,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Process/Process.php | Process.getExitCodeText | public function getExitCodeText()
{
if (null === $exitcode = $this->getExitCode()) {
return;
}
return isset(self::$exitCodes[$exitcode]) ? self::$exitCodes[$exitcode] : 'Unknown error';
} | php | public function getExitCodeText()
{
if (null === $exitcode = $this->getExitCode()) {
return;
}
return isset(self::$exitCodes[$exitcode]) ? self::$exitCodes[$exitcode] : 'Unknown error';
} | [
"public",
"function",
"getExitCodeText",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"exitcode",
"=",
"$",
"this",
"->",
"getExitCode",
"(",
")",
")",
"{",
"return",
";",
"}",
"return",
"isset",
"(",
"self",
"::",
"$",
"exitCodes",
"[",
"$",
"exitc... | Returns a string representation for the exit code returned by the process.
This method relies on the Unix exit code status standardization
and might not be relevant for other operating systems.
@return string|null A string representation for the exit status code, null if the Process is not terminated
@see http://tldp.org/LDP/abs/html/exitcodes.html
@see http://en.wikipedia.org/wiki/Unix_signal | [
"Returns",
"a",
"string",
"representation",
"for",
"the",
"exit",
"code",
"returned",
"by",
"the",
"process",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Process/Process.php#L752-L759 | train | Get the exit code text | [
30522,
2270,
3853,
2131,
10288,
4183,
16044,
18209,
1006,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
1027,
1002,
6164,
16044,
1027,
1002,
2023,
1011,
1028,
2131,
10288,
4183,
16044,
1006,
1007,
1007,
1063,
2709,
1025,
1065,
2709,
26354,
338... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/backend/formwidgets/Repeater.php | Repeater.processSaveValue | protected function processSaveValue($value)
{
if (!is_array($value) || !$value) {
return $value;
}
if ($this->useGroups) {
foreach ($value as $index => &$data) {
$data['_group'] = $this->getGroupCodeFromIndex($index);
}
}
if ($this->minItems && count($value) < $this->minItems) {
throw new ApplicationException(Lang::get('backend::lang.repeater.min_items_failed', ['name' => $this->fieldName, 'min' => $this->minItems, 'items' => count($value)]));
}
if ($this->maxItems && count($value) > $this->maxItems) {
throw new ApplicationException(Lang::get('backend::lang.repeater.max_items_failed', ['name' => $this->fieldName, 'max' => $this->maxItems, 'items' => count($value)]));
}
return array_values($value);
} | php | protected function processSaveValue($value)
{
if (!is_array($value) || !$value) {
return $value;
}
if ($this->useGroups) {
foreach ($value as $index => &$data) {
$data['_group'] = $this->getGroupCodeFromIndex($index);
}
}
if ($this->minItems && count($value) < $this->minItems) {
throw new ApplicationException(Lang::get('backend::lang.repeater.min_items_failed', ['name' => $this->fieldName, 'min' => $this->minItems, 'items' => count($value)]));
}
if ($this->maxItems && count($value) > $this->maxItems) {
throw new ApplicationException(Lang::get('backend::lang.repeater.max_items_failed', ['name' => $this->fieldName, 'max' => $this->maxItems, 'items' => count($value)]));
}
return array_values($value);
} | [
"protected",
"function",
"processSaveValue",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"value",
")",
"||",
"!",
"$",
"value",
")",
"{",
"return",
"$",
"value",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"useGroups",
")",
"{",
... | Splices in some meta data (group and index values) to the dataset.
@param array $value
@return array | [
"Splices",
"in",
"some",
"meta",
"data",
"(",
"group",
"and",
"index",
"values",
")",
"to",
"the",
"dataset",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/formwidgets/Repeater.php#L182-L202 | train | Process save value | [
30522,
5123,
3853,
2832,
3736,
3726,
10175,
5657,
1006,
1002,
3643,
1007,
1063,
2065,
1006,
999,
2003,
1035,
9140,
1006,
1002,
3643,
1007,
1064,
1064,
999,
1002,
3643,
1007,
1063,
2709,
1002,
3643,
1025,
1065,
2065,
1006,
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... |
opencart/opencart | upload/catalog/controller/information/gdpr.php | ControllerInformationGdpr.action | public function action() {
$this->load->language('information/gdpr');
$json = array();
if (isset($this->request->post['email'])) {
$email = $this->request->post['email'];
} else {
$email = '';
}
if (isset($this->request->post['action'])) {
$action = $this->request->post['action'];
} else {
$action = '';
}
// Validate E-Mail
if ((utf8_strlen($email) > 96) || !filter_var($email, FILTER_VALIDATE_EMAIL)) {
$json['error']['email'] = $this->language->get('error_email');
}
// Validate Action
$allowed = array(
'export',
'remove'
);
if (!in_array($action, $allowed)) {
$json['error']['action'] = $this->language->get('error_action');
}
if (!$json) {
// Added additional check so people are not spamming requests
$status = true;
$this->load->model('account/gdpr');
$results = $this->model_account_gdpr->getGdprsByEmail($email);
foreach ($results as $result) {
if ($result['action'] == $action) {
$status = false;
break;
}
}
if ($status) {
$this->model_account_gdpr->addGdpr(token(), $email, $action);
}
$json['success'] = $this->language->get('text_success');
}
$this->response->addHeader('Content-Type: application/json');
$this->response->setOutput(json_encode($json));
} | php | public function action() {
$this->load->language('information/gdpr');
$json = array();
if (isset($this->request->post['email'])) {
$email = $this->request->post['email'];
} else {
$email = '';
}
if (isset($this->request->post['action'])) {
$action = $this->request->post['action'];
} else {
$action = '';
}
// Validate E-Mail
if ((utf8_strlen($email) > 96) || !filter_var($email, FILTER_VALIDATE_EMAIL)) {
$json['error']['email'] = $this->language->get('error_email');
}
// Validate Action
$allowed = array(
'export',
'remove'
);
if (!in_array($action, $allowed)) {
$json['error']['action'] = $this->language->get('error_action');
}
if (!$json) {
// Added additional check so people are not spamming requests
$status = true;
$this->load->model('account/gdpr');
$results = $this->model_account_gdpr->getGdprsByEmail($email);
foreach ($results as $result) {
if ($result['action'] == $action) {
$status = false;
break;
}
}
if ($status) {
$this->model_account_gdpr->addGdpr(token(), $email, $action);
}
$json['success'] = $this->language->get('text_success');
}
$this->response->addHeader('Content-Type: application/json');
$this->response->setOutput(json_encode($json));
} | [
"public",
"function",
"action",
"(",
")",
"{",
"$",
"this",
"->",
"load",
"->",
"language",
"(",
"'information/gdpr'",
")",
";",
"$",
"json",
"=",
"array",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"request",
"->",
"post",
"[",
"'e... | /*
Action Statuses
EXPORT
unverified = 0
pending = 1
complete = 3
REMOVE
unverified = 0
pending = 1
processing = 2
delete = 3
DENY
unverified = 0
pending = 1
processing = 2
denied = -1 | [
"/",
"*",
"Action",
"Statuses"
] | e7933b56ba05aafb3655c6b490c9733cd18b5c69 | https://github.com/opencart/opencart/blob/e7933b56ba05aafb3655c6b490c9733cd18b5c69/upload/catalog/controller/information/gdpr.php#L71-L128 | train | Displays the action for the user | [
30522,
2270,
3853,
2895,
1006,
1007,
1063,
1002,
2023,
1011,
1028,
7170,
1011,
1028,
2653,
1006,
1005,
2592,
1013,
14230,
2099,
1005,
1007,
1025,
1002,
1046,
3385,
1027,
9140,
1006,
1007,
1025,
2065,
1006,
26354,
3388,
1006,
1002,
2023,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/DataTable.php | DataTable.addRowsFromSimpleArray | public function addRowsFromSimpleArray($array)
{
if (count($array) === 0) {
return;
}
$exceptionText = " Data structure returned is not convertible in the requested format." .
" Try to call this method with the parameters '&format=original&serialize=1'" .
"; you will get the original php data structure serialized." .
" The data structure looks like this: \n \$data = %s; ";
// first pass to see if the array has the structure
// array(col1_name => val1, col2_name => val2, etc.)
// with val* that are never arrays (only strings/numbers/bool/etc.)
// if we detect such a "simple" data structure we convert it to a row with the correct columns' names
$thisIsNotThatSimple = false;
foreach ($array as $columnValue) {
if (is_array($columnValue) || is_object($columnValue)) {
$thisIsNotThatSimple = true;
break;
}
}
if ($thisIsNotThatSimple === false) {
// case when the array is indexed by the default numeric index
if (array_keys($array) == array_keys(array_fill(0, count($array), true))) {
foreach ($array as $row) {
$this->addRow(new Row(array(Row::COLUMNS => array($row))));
}
} else {
$this->addRow(new Row(array(Row::COLUMNS => $array)));
}
// we have converted our simple array to one single row
// => we exit the method as the job is now finished
return;
}
foreach ($array as $key => $row) {
// stuff that looks like a line
if (is_array($row)) {
/**
* We make sure we can convert this PHP array without losing information.
* We are able to convert only simple php array (no strings keys, no sub arrays, etc.)
*
*/
// if the key is a string it means that some information was contained in this key.
// it cannot be lost during the conversion. Because we are not able to handle properly
// this key, we throw an explicit exception.
if (is_string($key)) {
// we define an exception we may throw if at one point we notice that we cannot handle the data structure
throw new Exception(sprintf($exceptionText, var_export($array, true)));
}
// if any of the sub elements of row is an array we cannot handle this data structure...
foreach ($row as $subRow) {
if (is_array($subRow)) {
throw new Exception(sprintf($exceptionText, var_export($array, true)));
}
}
$row = new Row(array(Row::COLUMNS => $row));
} // other (string, numbers...) => we build a line from this value
else {
$row = new Row(array(Row::COLUMNS => array($key => $row)));
}
$this->addRow($row);
}
} | php | public function addRowsFromSimpleArray($array)
{
if (count($array) === 0) {
return;
}
$exceptionText = " Data structure returned is not convertible in the requested format." .
" Try to call this method with the parameters '&format=original&serialize=1'" .
"; you will get the original php data structure serialized." .
" The data structure looks like this: \n \$data = %s; ";
// first pass to see if the array has the structure
// array(col1_name => val1, col2_name => val2, etc.)
// with val* that are never arrays (only strings/numbers/bool/etc.)
// if we detect such a "simple" data structure we convert it to a row with the correct columns' names
$thisIsNotThatSimple = false;
foreach ($array as $columnValue) {
if (is_array($columnValue) || is_object($columnValue)) {
$thisIsNotThatSimple = true;
break;
}
}
if ($thisIsNotThatSimple === false) {
// case when the array is indexed by the default numeric index
if (array_keys($array) == array_keys(array_fill(0, count($array), true))) {
foreach ($array as $row) {
$this->addRow(new Row(array(Row::COLUMNS => array($row))));
}
} else {
$this->addRow(new Row(array(Row::COLUMNS => $array)));
}
// we have converted our simple array to one single row
// => we exit the method as the job is now finished
return;
}
foreach ($array as $key => $row) {
// stuff that looks like a line
if (is_array($row)) {
/**
* We make sure we can convert this PHP array without losing information.
* We are able to convert only simple php array (no strings keys, no sub arrays, etc.)
*
*/
// if the key is a string it means that some information was contained in this key.
// it cannot be lost during the conversion. Because we are not able to handle properly
// this key, we throw an explicit exception.
if (is_string($key)) {
// we define an exception we may throw if at one point we notice that we cannot handle the data structure
throw new Exception(sprintf($exceptionText, var_export($array, true)));
}
// if any of the sub elements of row is an array we cannot handle this data structure...
foreach ($row as $subRow) {
if (is_array($subRow)) {
throw new Exception(sprintf($exceptionText, var_export($array, true)));
}
}
$row = new Row(array(Row::COLUMNS => $row));
} // other (string, numbers...) => we build a line from this value
else {
$row = new Row(array(Row::COLUMNS => array($key => $row)));
}
$this->addRow($row);
}
} | [
"public",
"function",
"addRowsFromSimpleArray",
"(",
"$",
"array",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"array",
")",
"===",
"0",
")",
"{",
"return",
";",
"}",
"$",
"exceptionText",
"=",
"\" Data structure returned is not convertible in the requested format.\"",
... | Adds multiple rows from an array containing arrays of column values.
Row metadata cannot be added with this method.
@param array $array Array with the following structure:
array(
array( col1_name => valueA, col2_name => valueC, ...),
array( col1_name => valueB, col2_name => valueD, ...),
)
@throws Exception if `$array` is in an incorrect format. | [
"Adds",
"multiple",
"rows",
"from",
"an",
"array",
"containing",
"arrays",
"of",
"column",
"values",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/DataTable.php#L1459-L1525 | train | Adds rows from a simple array to the table | [
30522,
2270,
3853,
5587,
10524,
22747,
21716,
5332,
23344,
2906,
9447,
1006,
1002,
9140,
1007,
1063,
2065,
1006,
4175,
1006,
1002,
9140,
1007,
1027,
1027,
1027,
1014,
1007,
1063,
2709,
1025,
1065,
1002,
6453,
18209,
1027,
1000,
2951,
3252,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/Db/Adapter/Pdo/Mssql.php | Mssql.checkClientVersion | public function checkClientVersion()
{
$serverVersion = $this->getServerVersion();
$clientVersion = $this->getClientVersion();
if (version_compare($serverVersion, '10') >= 0
&& version_compare($clientVersion, '10') < 0
) {
throw new Exception(Piwik::translate('General_ExceptionIncompatibleClientServerVersions', array('MSSQL', $clientVersion, $serverVersion)));
}
} | php | public function checkClientVersion()
{
$serverVersion = $this->getServerVersion();
$clientVersion = $this->getClientVersion();
if (version_compare($serverVersion, '10') >= 0
&& version_compare($clientVersion, '10') < 0
) {
throw new Exception(Piwik::translate('General_ExceptionIncompatibleClientServerVersions', array('MSSQL', $clientVersion, $serverVersion)));
}
} | [
"public",
"function",
"checkClientVersion",
"(",
")",
"{",
"$",
"serverVersion",
"=",
"$",
"this",
"->",
"getServerVersion",
"(",
")",
";",
"$",
"clientVersion",
"=",
"$",
"this",
"->",
"getClientVersion",
"(",
")",
";",
"if",
"(",
"version_compare",
"(",
... | Check client version compatibility against database server
@throws Exception | [
"Check",
"client",
"version",
"compatibility",
"against",
"database",
"server"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Db/Adapter/Pdo/Mssql.php#L169-L179 | train | Check client version | [
30522,
2270,
3853,
4638,
20464,
11638,
27774,
1006,
1007,
1063,
1002,
8241,
27774,
1027,
1002,
2023,
1011,
1028,
4152,
2121,
6299,
27774,
1006,
1007,
1025,
1002,
7396,
27774,
1027,
1002,
2023,
1011,
1028,
2131,
20464,
11638,
27774,
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... |
symfony/symfony | src/Symfony/Component/Form/Extension/Csrf/CsrfExtension.php | CsrfExtension.loadTypeExtensions | protected function loadTypeExtensions()
{
return [
new Type\FormTypeCsrfExtension($this->tokenManager, true, '_token', $this->translator, $this->translationDomain),
];
} | php | protected function loadTypeExtensions()
{
return [
new Type\FormTypeCsrfExtension($this->tokenManager, true, '_token', $this->translator, $this->translationDomain),
];
} | [
"protected",
"function",
"loadTypeExtensions",
"(",
")",
"{",
"return",
"[",
"new",
"Type",
"\\",
"FormTypeCsrfExtension",
"(",
"$",
"this",
"->",
"tokenManager",
",",
"true",
",",
"'_token'",
",",
"$",
"this",
"->",
"translator",
",",
"$",
"this",
"->",
"... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Extension/Csrf/CsrfExtension.php#L48-L53 | train | Load type extensions | [
30522,
5123,
3853,
7170,
13874,
10288,
29048,
2015,
1006,
1007,
1063,
2709,
1031,
2047,
2828,
1032,
2433,
13874,
6169,
12881,
10288,
29048,
1006,
1002,
2023,
1011,
1028,
19204,
24805,
4590,
1010,
2995,
1010,
1005,
1035,
19204,
1005,
1010,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Cache/MemcachedStore.php | MemcachedStore.decrement | public function decrement($key, $value = 1)
{
return $this->memcached->decrement($this->prefix.$key, $value);
} | php | public function decrement($key, $value = 1)
{
return $this->memcached->decrement($this->prefix.$key, $value);
} | [
"public",
"function",
"decrement",
"(",
"$",
"key",
",",
"$",
"value",
"=",
"1",
")",
"{",
"return",
"$",
"this",
"->",
"memcached",
"->",
"decrement",
"(",
"$",
"this",
"->",
"prefix",
".",
"$",
"key",
",",
"$",
"value",
")",
";",
"}"
] | Decrement the value of an item in the cache.
@param string $key
@param mixed $value
@return int|bool | [
"Decrement",
"the",
"value",
"of",
"an",
"item",
"in",
"the",
"cache",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Cache/MemcachedStore.php#L164-L167 | train | Decrement value of key in cache | [
30522,
2270,
3853,
11703,
28578,
4765,
1006,
1002,
3145,
1010,
1002,
3643,
1027,
1015,
1007,
1063,
2709,
1002,
2023,
1011,
1028,
2033,
12458,
15395,
2094,
1011,
1028,
11703,
28578,
4765,
1006,
1002,
2023,
1011,
1028,
17576,
1012,
1002,
3145... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
overtrue/wechat | src/Payment/Merchant/Client.php | Client.manage | protected function manage(array $params, array $query)
{
$params = array_merge($params, [
'appid' => $this->app['config']->app_id,
'nonce_str' => '',
'sub_mch_id' => '',
'sub_appid' => '',
]);
return $this->safeRequest('secapi/mch/submchmanage', $params, 'post', compact('query'));
} | php | protected function manage(array $params, array $query)
{
$params = array_merge($params, [
'appid' => $this->app['config']->app_id,
'nonce_str' => '',
'sub_mch_id' => '',
'sub_appid' => '',
]);
return $this->safeRequest('secapi/mch/submchmanage', $params, 'post', compact('query'));
} | [
"protected",
"function",
"manage",
"(",
"array",
"$",
"params",
",",
"array",
"$",
"query",
")",
"{",
"$",
"params",
"=",
"array_merge",
"(",
"$",
"params",
",",
"[",
"'appid'",
"=>",
"$",
"this",
"->",
"app",
"[",
"'config'",
"]",
"->",
"app_id",
",... | @param array $params
@param array $query
@return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string
@throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException | [
"@param",
"array",
"$params",
"@param",
"array",
"$query"
] | 120c72faaa93c270365bc75c73c362d5fd583209 | https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/Payment/Merchant/Client.php#L81-L91 | train | manage submch | [
30522,
5123,
3853,
6133,
1006,
9140,
1002,
11498,
5244,
1010,
9140,
1002,
23032,
1007,
1063,
1002,
11498,
5244,
1027,
9140,
1035,
13590,
1006,
1002,
11498,
5244,
1010,
1031,
1005,
10439,
3593,
1005,
1027,
1028,
1002,
2023,
1011,
1028,
10439... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Console/ListFailedCommand.php | ListFailedCommand.extractJobName | private function extractJobName($payload)
{
$payload = json_decode($payload, true);
if ($payload && (! isset($payload['data']['command']))) {
return $payload['job'] ?? null;
} elseif ($payload && isset($payload['data']['command'])) {
return $this->matchJobName($payload);
}
} | php | private function extractJobName($payload)
{
$payload = json_decode($payload, true);
if ($payload && (! isset($payload['data']['command']))) {
return $payload['job'] ?? null;
} elseif ($payload && isset($payload['data']['command'])) {
return $this->matchJobName($payload);
}
} | [
"private",
"function",
"extractJobName",
"(",
"$",
"payload",
")",
"{",
"$",
"payload",
"=",
"json_decode",
"(",
"$",
"payload",
",",
"true",
")",
";",
"if",
"(",
"$",
"payload",
"&&",
"(",
"!",
"isset",
"(",
"$",
"payload",
"[",
"'data'",
"]",
"[",
... | Extract the failed job name from payload.
@param string $payload
@return string|null | [
"Extract",
"the",
"failed",
"job",
"name",
"from",
"payload",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Queue/Console/ListFailedCommand.php#L80-L89 | train | Extract the job name from the payload | [
30522,
2797,
3853,
14817,
5558,
24700,
14074,
1006,
1002,
18093,
1007,
1063,
1002,
18093,
1027,
1046,
3385,
1035,
21933,
3207,
1006,
1002,
18093,
1010,
2995,
1007,
1025,
2065,
1006,
1002,
18093,
1004,
1004,
1006,
999,
26354,
3388,
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... |
symfony/symfony | src/Symfony/Component/Serializer/Normalizer/DateTimeZoneNormalizer.php | DateTimeZoneNormalizer.normalize | public function normalize($object, $format = null, array $context = [])
{
if (!$object instanceof \DateTimeZone) {
throw new InvalidArgumentException('The object must be an instance of "\DateTimeZone".');
}
return $object->getName();
} | php | public function normalize($object, $format = null, array $context = [])
{
if (!$object instanceof \DateTimeZone) {
throw new InvalidArgumentException('The object must be an instance of "\DateTimeZone".');
}
return $object->getName();
} | [
"public",
"function",
"normalize",
"(",
"$",
"object",
",",
"$",
"format",
"=",
"null",
",",
"array",
"$",
"context",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"$",
"object",
"instanceof",
"\\",
"DateTimeZone",
")",
"{",
"throw",
"new",
"InvalidArgument... | {@inheritdoc}
@throws InvalidArgumentException | [
"{",
"@inheritdoc",
"}"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Serializer/Normalizer/DateTimeZoneNormalizer.php#L29-L36 | train | Normalize the object to a locale name | [
30522,
2270,
3853,
3671,
4697,
1006,
1002,
4874,
1010,
1002,
4289,
1027,
19701,
1010,
9140,
1002,
6123,
1027,
1031,
1033,
1007,
1063,
2065,
1006,
999,
1002,
4874,
6013,
11253,
1032,
3058,
7292,
15975,
1007,
1063,
5466,
2047,
19528,
2906,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Intl/Data/Provider/CurrencyDataProvider.php | CurrencyDataProvider.getRoundingIncrement | public function getRoundingIncrement($currency)
{
try {
return $this->reader->readEntry($this->path, 'meta', ['Meta', $currency, static::INDEX_ROUNDING_INCREMENT]);
} catch (MissingResourceException $e) {
return $this->reader->readEntry($this->path, 'meta', ['Meta', 'DEFAULT', static::INDEX_ROUNDING_INCREMENT]);
}
} | php | public function getRoundingIncrement($currency)
{
try {
return $this->reader->readEntry($this->path, 'meta', ['Meta', $currency, static::INDEX_ROUNDING_INCREMENT]);
} catch (MissingResourceException $e) {
return $this->reader->readEntry($this->path, 'meta', ['Meta', 'DEFAULT', static::INDEX_ROUNDING_INCREMENT]);
}
} | [
"public",
"function",
"getRoundingIncrement",
"(",
"$",
"currency",
")",
"{",
"try",
"{",
"return",
"$",
"this",
"->",
"reader",
"->",
"readEntry",
"(",
"$",
"this",
"->",
"path",
",",
"'meta'",
",",
"[",
"'Meta'",
",",
"$",
"currency",
",",
"static",
... | Data provider for {@link \Symfony\Component\Intl\Currency::getRoundingIncrement()}. | [
"Data",
"provider",
"for",
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Intl/Data/Provider/CurrencyDataProvider.php#L118-L125 | train | Get Rounding Increment | [
30522,
2270,
3853,
2131,
22494,
15683,
2378,
16748,
3672,
1006,
1002,
9598,
1007,
1063,
3046,
1063,
2709,
1002,
2023,
1011,
1028,
8068,
1011,
1028,
3191,
4765,
2854,
1006,
1002,
2023,
1011,
1028,
4130,
1010,
1005,
18804,
1005,
1010,
1031,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Process/Process.php | Process.setInput | public function setInput($input)
{
if ($this->isRunning()) {
throw new LogicException('Input can not be set while the process is running.');
}
$this->input = ProcessUtils::validateInput(__METHOD__, $input);
return $this;
} | php | public function setInput($input)
{
if ($this->isRunning()) {
throw new LogicException('Input can not be set while the process is running.');
}
$this->input = ProcessUtils::validateInput(__METHOD__, $input);
return $this;
} | [
"public",
"function",
"setInput",
"(",
"$",
"input",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isRunning",
"(",
")",
")",
"{",
"throw",
"new",
"LogicException",
"(",
"'Input can not be set while the process is running.'",
")",
";",
"}",
"$",
"this",
"->",
"in... | Sets the input.
This content will be passed to the underlying process standard input.
@param string|int|float|bool|resource|\Traversable|null $input The content
@return self The current Process instance
@throws LogicException In case the process is running | [
"Sets",
"the",
"input",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Process/Process.php#L1192-L1201 | train | Set the input | [
30522,
2270,
3853,
2275,
2378,
18780,
1006,
1002,
7953,
1007,
1063,
2065,
1006,
1002,
2023,
1011,
1028,
2003,
15532,
5582,
1006,
1007,
1007,
1063,
5466,
2047,
7961,
10288,
24422,
1006,
1005,
7953,
2064,
2025,
2022,
2275,
2096,
1996,
2832,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Database/Query/Builder.php | Builder.runSelect | protected function runSelect()
{
return $this->connection->select(
$this->toSql(), $this->getBindings(), ! $this->useWritePdo
);
} | php | protected function runSelect()
{
return $this->connection->select(
$this->toSql(), $this->getBindings(), ! $this->useWritePdo
);
} | [
"protected",
"function",
"runSelect",
"(",
")",
"{",
"return",
"$",
"this",
"->",
"connection",
"->",
"select",
"(",
"$",
"this",
"->",
"toSql",
"(",
")",
",",
"$",
"this",
"->",
"getBindings",
"(",
")",
",",
"!",
"$",
"this",
"->",
"useWritePdo",
")... | Run the query as a "select" statement against the connection.
@return array | [
"Run",
"the",
"query",
"as",
"a",
"select",
"statement",
"against",
"the",
"connection",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Query/Builder.php#L2121-L2126 | train | Runs the select query and returns the result | [
30522,
5123,
3853,
3216,
12260,
6593,
1006,
1007,
1063,
2709,
1002,
2023,
1011,
1028,
4434,
1011,
1028,
7276,
1006,
1002,
2023,
1011,
1028,
2000,
2015,
4160,
2140,
1006,
1007,
1010,
1002,
2023,
1011,
1028,
2131,
8428,
4667,
2015,
1006,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Routing/Router.php | Router.actionReferencesController | protected function actionReferencesController($action)
{
if (! $action instanceof Closure) {
return is_string($action) || (isset($action['uses']) && is_string($action['uses']));
}
return false;
} | php | protected function actionReferencesController($action)
{
if (! $action instanceof Closure) {
return is_string($action) || (isset($action['uses']) && is_string($action['uses']));
}
return false;
} | [
"protected",
"function",
"actionReferencesController",
"(",
"$",
"action",
")",
"{",
"if",
"(",
"!",
"$",
"action",
"instanceof",
"Closure",
")",
"{",
"return",
"is_string",
"(",
"$",
"action",
")",
"||",
"(",
"isset",
"(",
"$",
"action",
"[",
"'uses'",
... | Determine if the action is routing to a controller.
@param array $action
@return bool | [
"Determine",
"if",
"the",
"action",
"is",
"routing",
"to",
"a",
"controller",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Routing/Router.php#L487-L494 | train | Checks if the action references a controller | [
30522,
5123,
3853,
2895,
2890,
25523,
9363,
3372,
26611,
1006,
1002,
2895,
1007,
1063,
2065,
1006,
999,
30524,
2003,
1035,
5164,
1006,
1002,
2895,
1031,
1005,
3594,
1005,
1033,
1007,
1007,
1025,
1065,
2709,
6270,
1025,
1065,
102,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.getIcuVersion | public static function getIcuVersion()
{
if (false === self::$icuVersion) {
if (!self::isExtensionLoaded()) {
self::$icuVersion = self::getIcuStubVersion();
} elseif (\defined('INTL_ICU_VERSION')) {
self::$icuVersion = INTL_ICU_VERSION;
} else {
try {
$reflector = new \ReflectionExtension('intl');
ob_start();
$reflector->info();
$output = strip_tags(ob_get_clean());
preg_match('/^ICU version (?:=>)?(.*)$/m', $output, $matches);
self::$icuVersion = trim($matches[1]);
} catch (\ReflectionException $e) {
self::$icuVersion = null;
}
}
}
return self::$icuVersion;
} | php | public static function getIcuVersion()
{
if (false === self::$icuVersion) {
if (!self::isExtensionLoaded()) {
self::$icuVersion = self::getIcuStubVersion();
} elseif (\defined('INTL_ICU_VERSION')) {
self::$icuVersion = INTL_ICU_VERSION;
} else {
try {
$reflector = new \ReflectionExtension('intl');
ob_start();
$reflector->info();
$output = strip_tags(ob_get_clean());
preg_match('/^ICU version (?:=>)?(.*)$/m', $output, $matches);
self::$icuVersion = trim($matches[1]);
} catch (\ReflectionException $e) {
self::$icuVersion = null;
}
}
}
return self::$icuVersion;
} | [
"public",
"static",
"function",
"getIcuVersion",
"(",
")",
"{",
"if",
"(",
"false",
"===",
"self",
"::",
"$",
"icuVersion",
")",
"{",
"if",
"(",
"!",
"self",
"::",
"isExtensionLoaded",
"(",
")",
")",
"{",
"self",
"::",
"$",
"icuVersion",
"=",
"self",
... | Returns the version of the installed ICU library.
@return string|null The ICU version or NULL if it could not be determined | [
"Returns",
"the",
"version",
"of",
"the",
"installed",
"ICU",
"library",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Intl/Intl.php#L213-L236 | train | Get the icu version | [
30522,
2270,
10763,
3853,
2131,
2594,
22909,
2869,
3258,
1006,
1007,
1063,
2065,
1006,
6270,
1027,
1027,
1027,
2969,
1024,
1024,
1002,
24582,
22909,
2869,
3258,
1007,
1063,
2065,
1006,
999,
2969,
1024,
1024,
2003,
10288,
29048,
17468,
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... |
guzzle/guzzle | src/Cookie/FileCookieJar.php | FileCookieJar.save | public function save($filename)
{
$json = [];
foreach ($this as $cookie) {
/** @var SetCookie $cookie */
if (CookieJar::shouldPersist($cookie, $this->storeSessionCookies)) {
$json[] = $cookie->toArray();
}
}
$jsonStr = \GuzzleHttp\json_encode($json);
if (false === file_put_contents($filename, $jsonStr)) {
throw new \RuntimeException("Unable to save file {$filename}");
}
} | php | public function save($filename)
{
$json = [];
foreach ($this as $cookie) {
/** @var SetCookie $cookie */
if (CookieJar::shouldPersist($cookie, $this->storeSessionCookies)) {
$json[] = $cookie->toArray();
}
}
$jsonStr = \GuzzleHttp\json_encode($json);
if (false === file_put_contents($filename, $jsonStr)) {
throw new \RuntimeException("Unable to save file {$filename}");
}
} | [
"public",
"function",
"save",
"(",
"$",
"filename",
")",
"{",
"$",
"json",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"as",
"$",
"cookie",
")",
"{",
"/** @var SetCookie $cookie */",
"if",
"(",
"CookieJar",
"::",
"shouldPersist",
"(",
"$",
"cookie",... | Saves the cookies to a file.
@param string $filename File to save
@throws \RuntimeException if the file cannot be found or created | [
"Saves",
"the",
"cookies",
"to",
"a",
"file",
"."
] | bf595424e4d442a190582e088985dc835a789071 | https://github.com/guzzle/guzzle/blob/bf595424e4d442a190582e088985dc835a789071/src/Cookie/FileCookieJar.php#L48-L62 | train | Save session cookies to file | [
30522,
2270,
3853,
3828,
1006,
1002,
5371,
18442,
1007,
1063,
1002,
1046,
3385,
1027,
1031,
1033,
1025,
18921,
6776,
1006,
1002,
2023,
2004,
1002,
17387,
1007,
1063,
1013,
1008,
1008,
1030,
13075,
2275,
3597,
23212,
2063,
1002,
17387,
1008,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/Db/Adapter/Pdo/Pgsql.php | Pgsql.isErrNo | public function isErrNo($e, $errno)
{
// map MySQL driver-specific error codes to PostgreSQL SQLSTATE
$map = array(
// MySQL: Unknown database '%s'
// PostgreSQL: database "%s" does not exist
'1049' => '08006',
// MySQL: Table '%s' already exists
// PostgreSQL: relation "%s" already exists
'1050' => '42P07',
// MySQL: Unknown column '%s' in '%s'
// PostgreSQL: column "%s" does not exist
'1054' => '42703',
// MySQL: Duplicate column name '%s'
// PostgreSQL: column "%s" of relation "%s" already exists
'1060' => '42701',
// MySQL: Duplicate key name '%s'
// PostgreSQL: relation "%s" already exists
'1061' => '42P07',
// MySQL: Duplicate entry '%s' for key '%s'
// PostgreSQL: duplicate key violates unique constraint
'1062' => '23505',
// MySQL: Can't DROP '%s'; check that column/key exists
// PostgreSQL: index "%s" does not exist
'1091' => '42704',
// MySQL: Table '%s.%s' doesn't exist
// PostgreSQL: relation "%s" does not exist
'1146' => '42P01',
);
if (preg_match('/([0-9]{2}[0-9P][0-9]{2})/', $e->getMessage(), $match)) {
return $match[1] == $map[$errno];
}
return false;
} | php | public function isErrNo($e, $errno)
{
// map MySQL driver-specific error codes to PostgreSQL SQLSTATE
$map = array(
// MySQL: Unknown database '%s'
// PostgreSQL: database "%s" does not exist
'1049' => '08006',
// MySQL: Table '%s' already exists
// PostgreSQL: relation "%s" already exists
'1050' => '42P07',
// MySQL: Unknown column '%s' in '%s'
// PostgreSQL: column "%s" does not exist
'1054' => '42703',
// MySQL: Duplicate column name '%s'
// PostgreSQL: column "%s" of relation "%s" already exists
'1060' => '42701',
// MySQL: Duplicate key name '%s'
// PostgreSQL: relation "%s" already exists
'1061' => '42P07',
// MySQL: Duplicate entry '%s' for key '%s'
// PostgreSQL: duplicate key violates unique constraint
'1062' => '23505',
// MySQL: Can't DROP '%s'; check that column/key exists
// PostgreSQL: index "%s" does not exist
'1091' => '42704',
// MySQL: Table '%s.%s' doesn't exist
// PostgreSQL: relation "%s" does not exist
'1146' => '42P01',
);
if (preg_match('/([0-9]{2}[0-9P][0-9]{2})/', $e->getMessage(), $match)) {
return $match[1] == $map[$errno];
}
return false;
} | [
"public",
"function",
"isErrNo",
"(",
"$",
"e",
",",
"$",
"errno",
")",
"{",
"// map MySQL driver-specific error codes to PostgreSQL SQLSTATE",
"$",
"map",
"=",
"array",
"(",
"// MySQL: Unknown database '%s'",
"// PostgreSQL: database \"%s\" does not exist",
"'1049'",
"=>",
... | Test error number
@param Exception $e
@param string $errno
@return bool | [
"Test",
"error",
"number"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Db/Adapter/Pdo/Pgsql.php#L109-L151 | train | Checks if the error code is a known error code | [
30522,
2270,
3853,
2003,
2121,
19139,
1006,
1002,
1041,
1010,
1002,
9413,
19139,
1007,
1063,
1013,
1013,
4949,
2026,
2015,
4160,
2140,
4062,
1011,
3563,
7561,
9537,
2000,
2695,
17603,
2015,
4160,
2140,
29296,
9153,
2618,
1002,
4949,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Database/Capsule/Manager.php | Manager.bootEloquent | public function bootEloquent()
{
Eloquent::setConnectionResolver($this->manager);
// If we have an event dispatcher instance, we will go ahead and register it
// with the Eloquent ORM, allowing for model callbacks while creating and
// updating "model" instances; however, it is not necessary to operate.
if ($dispatcher = $this->getEventDispatcher()) {
Eloquent::setEventDispatcher($dispatcher);
}
} | php | public function bootEloquent()
{
Eloquent::setConnectionResolver($this->manager);
// If we have an event dispatcher instance, we will go ahead and register it
// with the Eloquent ORM, allowing for model callbacks while creating and
// updating "model" instances; however, it is not necessary to operate.
if ($dispatcher = $this->getEventDispatcher()) {
Eloquent::setEventDispatcher($dispatcher);
}
} | [
"public",
"function",
"bootEloquent",
"(",
")",
"{",
"Eloquent",
"::",
"setConnectionResolver",
"(",
"$",
"this",
"->",
"manager",
")",
";",
"// If we have an event dispatcher instance, we will go ahead and register it",
"// with the Eloquent ORM, allowing for model callbacks while... | Bootstrap Eloquent so it is ready for usage.
@return void | [
"Bootstrap",
"Eloquent",
"so",
"it",
"is",
"ready",
"for",
"usage",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Capsule/Manager.php#L132-L142 | train | Boots the Eloquent ORM | [
30522,
2270,
3853,
9573,
18349,
15417,
1006,
1007,
1063,
3449,
2080,
15417,
1024,
1024,
2275,
8663,
2638,
7542,
6072,
4747,
6299,
1006,
1002,
2023,
1011,
1028,
3208,
1007,
1025,
1013,
1013,
2065,
2057,
2031,
2019,
2724,
18365,
2121,
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/Encryption/Encrypter.php | Encrypter.calculateMac | protected function calculateMac($payload, $bytes)
{
return hash_hmac(
'sha256', $this->hash($payload['iv'], $payload['value']), $bytes, true
);
} | php | protected function calculateMac($payload, $bytes)
{
return hash_hmac(
'sha256', $this->hash($payload['iv'], $payload['value']), $bytes, true
);
} | [
"protected",
"function",
"calculateMac",
"(",
"$",
"payload",
",",
"$",
"bytes",
")",
"{",
"return",
"hash_hmac",
"(",
"'sha256'",
",",
"$",
"this",
"->",
"hash",
"(",
"$",
"payload",
"[",
"'iv'",
"]",
",",
"$",
"payload",
"[",
"'value'",
"]",
")",
"... | Calculate the hash of the given payload.
@param array $payload
@param string $bytes
@return string | [
"Calculate",
"the",
"hash",
"of",
"the",
"given",
"payload",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Encryption/Encrypter.php#L239-L244 | train | Calculate MAC of payload | [
30522,
5123,
3853,
18422,
22911,
1006,
1002,
18093,
1010,
1002,
27507,
1007,
1063,
2709,
23325,
1035,
20287,
6305,
1006,
1005,
21146,
17788,
2575,
1005,
1010,
1002,
2023,
1011,
1028,
23325,
1006,
1002,
18093,
1031,
1005,
4921,
1005,
1033,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Auth/Recaller.php | Recaller.hasAllSegments | protected function hasAllSegments()
{
$segments = explode('|', $this->recaller);
return count($segments) === 3 && trim($segments[0]) !== '' && trim($segments[1]) !== '';
} | php | protected function hasAllSegments()
{
$segments = explode('|', $this->recaller);
return count($segments) === 3 && trim($segments[0]) !== '' && trim($segments[1]) !== '';
} | [
"protected",
"function",
"hasAllSegments",
"(",
")",
"{",
"$",
"segments",
"=",
"explode",
"(",
"'|'",
",",
"$",
"this",
"->",
"recaller",
")",
";",
"return",
"count",
"(",
"$",
"segments",
")",
"===",
"3",
"&&",
"trim",
"(",
"$",
"segments",
"[",
"0... | Determine if the recaller has all segments.
@return bool | [
"Determine",
"if",
"the",
"recaller",
"has",
"all",
"segments",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Auth/Recaller.php#L82-L87 | train | Returns true if the caller has all segments | [
30522,
5123,
3853,
2038,
8095,
3366,
21693,
11187,
1006,
1007,
1063,
1002,
9214,
1027,
15044,
1006,
1005,
1064,
1005,
1010,
1002,
2023,
1011,
1028,
9131,
2121,
1007,
1025,
2709,
4175,
1006,
1002,
9214,
1007,
1027,
1027,
1027,
1017,
1004,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Security/Core/Authentication/RememberMe/InMemoryTokenProvider.php | InMemoryTokenProvider.updateToken | public function updateToken($series, $tokenValue, \DateTime $lastUsed)
{
if (!isset($this->tokens[$series])) {
throw new TokenNotFoundException('No token found.');
}
$token = new PersistentToken(
$this->tokens[$series]->getClass(),
$this->tokens[$series]->getUsername(),
$series,
$tokenValue,
$lastUsed
);
$this->tokens[$series] = $token;
} | php | public function updateToken($series, $tokenValue, \DateTime $lastUsed)
{
if (!isset($this->tokens[$series])) {
throw new TokenNotFoundException('No token found.');
}
$token = new PersistentToken(
$this->tokens[$series]->getClass(),
$this->tokens[$series]->getUsername(),
$series,
$tokenValue,
$lastUsed
);
$this->tokens[$series] = $token;
} | [
"public",
"function",
"updateToken",
"(",
"$",
"series",
",",
"$",
"tokenValue",
",",
"\\",
"DateTime",
"$",
"lastUsed",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"tokens",
"[",
"$",
"series",
"]",
")",
")",
"{",
"throw",
"new",
"T... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Security/Core/Authentication/RememberMe/InMemoryTokenProvider.php#L40-L54 | train | Updates a token in the cache | [
30522,
2270,
3853,
10651,
18715,
2368,
1006,
1002,
2186,
1010,
1002,
19204,
10175,
5657,
1010,
1032,
3058,
7292,
1002,
2197,
13901,
1007,
1063,
2065,
1006,
999,
26354,
3388,
1006,
1002,
2023,
1011,
1028,
19204,
2015,
1031,
1002,
2186,
1033,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Finder/Finder.php | Finder.getIterator | public function getIterator()
{
if (0 === \count($this->dirs) && 0 === \count($this->iterators)) {
throw new \LogicException('You must call one of in() or append() methods before iterating over a Finder.');
}
if (1 === \count($this->dirs) && 0 === \count($this->iterators)) {
return $this->searchInDirectory($this->dirs[0]);
}
$iterator = new \AppendIterator();
foreach ($this->dirs as $dir) {
$iterator->append($this->searchInDirectory($dir));
}
foreach ($this->iterators as $it) {
$iterator->append($it);
}
return $iterator;
} | php | public function getIterator()
{
if (0 === \count($this->dirs) && 0 === \count($this->iterators)) {
throw new \LogicException('You must call one of in() or append() methods before iterating over a Finder.');
}
if (1 === \count($this->dirs) && 0 === \count($this->iterators)) {
return $this->searchInDirectory($this->dirs[0]);
}
$iterator = new \AppendIterator();
foreach ($this->dirs as $dir) {
$iterator->append($this->searchInDirectory($dir));
}
foreach ($this->iterators as $it) {
$iterator->append($it);
}
return $iterator;
} | [
"public",
"function",
"getIterator",
"(",
")",
"{",
"if",
"(",
"0",
"===",
"\\",
"count",
"(",
"$",
"this",
"->",
"dirs",
")",
"&&",
"0",
"===",
"\\",
"count",
"(",
"$",
"this",
"->",
"iterators",
")",
")",
"{",
"throw",
"new",
"\\",
"LogicExceptio... | Returns an Iterator for the current Finder configuration.
This method implements the IteratorAggregate interface.
@return \Iterator|SplFileInfo[] An iterator
@throws \LogicException if the in() method has not been called | [
"Returns",
"an",
"Iterator",
"for",
"the",
"current",
"Finder",
"configuration",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Finder/Finder.php#L619-L639 | train | Returns an iterator over the directories and its iterators. | [
30522,
2270,
3853,
2131,
21646,
8844,
1006,
1007,
1063,
2065,
1006,
1014,
1027,
1027,
1027,
1032,
4175,
1006,
1002,
2023,
1011,
1028,
16101,
2015,
1007,
1004,
1004,
1014,
1027,
1027,
1027,
1032,
4175,
1006,
1002,
2023,
1011,
1028,
2009,
6... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Parser.php | Parser.parse | public function parse(string $value, int $flags = 0)
{
if (false === preg_match('//u', $value)) {
throw new ParseException('The YAML value does not appear to be valid UTF-8.', -1, null, $this->filename);
}
$this->refs = [];
$mbEncoding = null;
$data = null;
if (2 /* MB_OVERLOAD_STRING */ & (int) ini_get('mbstring.func_overload')) {
$mbEncoding = mb_internal_encoding();
mb_internal_encoding('UTF-8');
}
try {
$data = $this->doParse($value, $flags);
} finally {
if (null !== $mbEncoding) {
mb_internal_encoding($mbEncoding);
}
$this->lines = [];
$this->currentLine = '';
$this->refs = [];
$this->skippedLineNumbers = [];
$this->locallySkippedLineNumbers = [];
}
return $data;
} | php | public function parse(string $value, int $flags = 0)
{
if (false === preg_match('//u', $value)) {
throw new ParseException('The YAML value does not appear to be valid UTF-8.', -1, null, $this->filename);
}
$this->refs = [];
$mbEncoding = null;
$data = null;
if (2 /* MB_OVERLOAD_STRING */ & (int) ini_get('mbstring.func_overload')) {
$mbEncoding = mb_internal_encoding();
mb_internal_encoding('UTF-8');
}
try {
$data = $this->doParse($value, $flags);
} finally {
if (null !== $mbEncoding) {
mb_internal_encoding($mbEncoding);
}
$this->lines = [];
$this->currentLine = '';
$this->refs = [];
$this->skippedLineNumbers = [];
$this->locallySkippedLineNumbers = [];
}
return $data;
} | [
"public",
"function",
"parse",
"(",
"string",
"$",
"value",
",",
"int",
"$",
"flags",
"=",
"0",
")",
"{",
"if",
"(",
"false",
"===",
"preg_match",
"(",
"'//u'",
",",
"$",
"value",
")",
")",
"{",
"throw",
"new",
"ParseException",
"(",
"'The YAML value d... | Parses a YAML string to a PHP value.
@param string $value A YAML string
@param int $flags A bit field of PARSE_* constants to customize the YAML parser behavior
@return mixed A PHP value
@throws ParseException If the YAML is not valid | [
"Parses",
"a",
"YAML",
"string",
"to",
"a",
"PHP",
"value",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Yaml/Parser.php#L79-L109 | train | Parse YAML value | [
30522,
2270,
3853,
11968,
3366,
1006,
5164,
1002,
3643,
1010,
20014,
1002,
9245,
1027,
1014,
1007,
1063,
2065,
1006,
6270,
1027,
1027,
1027,
3653,
2290,
1035,
2674,
1006,
1005,
1013,
1013,
1057,
1005,
1010,
1002,
3643,
1007,
1007,
1063,
5... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Config/Definition/VariableNode.php | VariableNode.finalizeValue | protected function finalizeValue($value)
{
// deny environment variables only when using custom validators
// this avoids ever passing an empty value to final validation closures
if (!$this->allowEmptyValue && $this->isHandlingPlaceholder() && $this->finalValidationClosures) {
@trigger_error(sprintf('Setting path "%s" to an environment variable is deprecated since Symfony 4.3. Remove "cannotBeEmpty()", "validate()" or include a prefix/suffix value instead.', $this->getPath()), E_USER_DEPRECATED);
// $e = new InvalidConfigurationException(sprintf('The path "%s" cannot contain an environment variable when empty values are not allowed by definition and are validated.', $this->getPath(), json_encode($value)));
// if ($hint = $this->getInfo()) {
// $e->addHint($hint);
// }
// $e->setPath($this->getPath());
//
// throw $e;
}
if (!$this->allowEmptyValue && $this->isValueEmpty($value)) {
$ex = new InvalidConfigurationException(sprintf('The path "%s" cannot contain an empty value, but got %s.', $this->getPath(), json_encode($value)));
if ($hint = $this->getInfo()) {
$ex->addHint($hint);
}
$ex->setPath($this->getPath());
throw $ex;
}
return $value;
} | php | protected function finalizeValue($value)
{
// deny environment variables only when using custom validators
// this avoids ever passing an empty value to final validation closures
if (!$this->allowEmptyValue && $this->isHandlingPlaceholder() && $this->finalValidationClosures) {
@trigger_error(sprintf('Setting path "%s" to an environment variable is deprecated since Symfony 4.3. Remove "cannotBeEmpty()", "validate()" or include a prefix/suffix value instead.', $this->getPath()), E_USER_DEPRECATED);
// $e = new InvalidConfigurationException(sprintf('The path "%s" cannot contain an environment variable when empty values are not allowed by definition and are validated.', $this->getPath(), json_encode($value)));
// if ($hint = $this->getInfo()) {
// $e->addHint($hint);
// }
// $e->setPath($this->getPath());
//
// throw $e;
}
if (!$this->allowEmptyValue && $this->isValueEmpty($value)) {
$ex = new InvalidConfigurationException(sprintf('The path "%s" cannot contain an empty value, but got %s.', $this->getPath(), json_encode($value)));
if ($hint = $this->getInfo()) {
$ex->addHint($hint);
}
$ex->setPath($this->getPath());
throw $ex;
}
return $value;
} | [
"protected",
"function",
"finalizeValue",
"(",
"$",
"value",
")",
"{",
"// deny environment variables only when using custom validators",
"// this avoids ever passing an empty value to final validation closures",
"if",
"(",
"!",
"$",
"this",
"->",
"allowEmptyValue",
"&&",
"$",
... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Config/Definition/VariableNode.php#L82-L108 | train | Finalizes the value by throwing an exception if the value is empty | [
30522,
5123,
3853,
2345,
4697,
10175,
5657,
1006,
1002,
3643,
1007,
1063,
1013,
1013,
9772,
4044,
10857,
2069,
2043,
2478,
7661,
9398,
18926,
1013,
1013,
2023,
26777,
2412,
4458,
2019,
4064,
3643,
2000,
2345,
27354,
8503,
2015,
2065,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
z-song/laravel-admin | src/Show/Tools.php | Tools.getDeletePath | protected function getDeletePath()
{
$key = $this->panel->getParent()->getModel()->getKey();
return $this->getListPath().'/'.$key;
} | php | protected function getDeletePath()
{
$key = $this->panel->getParent()->getModel()->getKey();
return $this->getListPath().'/'.$key;
} | [
"protected",
"function",
"getDeletePath",
"(",
")",
"{",
"$",
"key",
"=",
"$",
"this",
"->",
"panel",
"->",
"getParent",
"(",
")",
"->",
"getModel",
"(",
")",
"->",
"getKey",
"(",
")",
";",
"return",
"$",
"this",
"->",
"getListPath",
"(",
")",
".",
... | Get request path for delete.
@return string | [
"Get",
"request",
"path",
"for",
"delete",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Show/Tools.php#L175-L180 | train | Get Delete Path | [
30522,
5123,
3853,
2131,
9247,
12870,
15069,
1006,
1007,
1063,
1002,
3145,
1027,
1002,
2023,
1011,
1028,
5997,
1011,
1028,
2131,
19362,
4765,
1006,
1007,
1011,
1028,
2131,
5302,
9247,
1006,
1007,
1011,
1028,
2131,
14839,
1006,
1007,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/ViewDataTable/Manager.php | Manager.configureFooterIcons | public static function configureFooterIcons(ViewDataTable $view)
{
$result = array();
$normalViewIcons = self::getNormalViewIcons($view);
if (!empty($normalViewIcons['buttons'])) {
$result[] = $normalViewIcons;
}
// add insight views
$insightsViewIcons = array(
'class' => 'tableInsightViews',
'buttons' => array(),
);
$graphViewIcons = self::getGraphViewIcons($view);
$nonCoreVisualizations = static::getNonCoreViewDataTables();
foreach ($nonCoreVisualizations as $id => $klass) {
if ($klass::canDisplayViewDataTable($view)) {
$footerIcon = static::getFooterIconFor($id);
if (Insight::ID == $footerIcon['id']) {
$insightsViewIcons['buttons'][] = static::getFooterIconFor($id);
} else {
$graphViewIcons['buttons'][] = static::getFooterIconFor($id);
}
}
}
$graphViewIcons['buttons'] = array_filter($graphViewIcons['buttons']);
if (!empty($insightsViewIcons['buttons'])
&& $view->config->show_insights
) {
$result[] = $insightsViewIcons;
}
if (!empty($graphViewIcons['buttons'])) {
$result[] = $graphViewIcons;
}
return $result;
} | php | public static function configureFooterIcons(ViewDataTable $view)
{
$result = array();
$normalViewIcons = self::getNormalViewIcons($view);
if (!empty($normalViewIcons['buttons'])) {
$result[] = $normalViewIcons;
}
// add insight views
$insightsViewIcons = array(
'class' => 'tableInsightViews',
'buttons' => array(),
);
$graphViewIcons = self::getGraphViewIcons($view);
$nonCoreVisualizations = static::getNonCoreViewDataTables();
foreach ($nonCoreVisualizations as $id => $klass) {
if ($klass::canDisplayViewDataTable($view)) {
$footerIcon = static::getFooterIconFor($id);
if (Insight::ID == $footerIcon['id']) {
$insightsViewIcons['buttons'][] = static::getFooterIconFor($id);
} else {
$graphViewIcons['buttons'][] = static::getFooterIconFor($id);
}
}
}
$graphViewIcons['buttons'] = array_filter($graphViewIcons['buttons']);
if (!empty($insightsViewIcons['buttons'])
&& $view->config->show_insights
) {
$result[] = $insightsViewIcons;
}
if (!empty($graphViewIcons['buttons'])) {
$result[] = $graphViewIcons;
}
return $result;
} | [
"public",
"static",
"function",
"configureFooterIcons",
"(",
"ViewDataTable",
"$",
"view",
")",
"{",
"$",
"result",
"=",
"array",
"(",
")",
";",
"$",
"normalViewIcons",
"=",
"self",
"::",
"getNormalViewIcons",
"(",
"$",
"view",
")",
";",
"if",
"(",
"!",
... | This method determines the default set of footer icons to display below a report.
$result has the following format:
```
array(
array( // footer icon group 1
'class' => 'footerIconGroup1CssClass',
'buttons' => array(
'id' => 'myid',
'title' => 'My Tooltip',
'icon' => 'path/to/my/icon.png'
)
),
array( // footer icon group 2
'class' => 'footerIconGroup2CssClass',
'buttons' => array(...)
),
...
)
``` | [
"This",
"method",
"determines",
"the",
"default",
"set",
"of",
"footer",
"icons",
"to",
"display",
"below",
"a",
"report",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/ViewDataTable/Manager.php#L166-L210 | train | Returns an array of footer icons for a given viewDataTable | [
30522,
2270,
10763,
3853,
9530,
8873,
27390,
12879,
17206,
22420,
5644,
1006,
3193,
2850,
29336,
3085,
1002,
3193,
1007,
1063,
1002,
2765,
1027,
9140,
1006,
1007,
1025,
1002,
3671,
8584,
28524,
2015,
1027,
2969,
1024,
1024,
2131,
12131,
906... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/SerializesAndRestoresModelIdentifiers.php | SerializesAndRestoresModelIdentifiers.getSerializedPropertyValue | protected function getSerializedPropertyValue($value)
{
if ($value instanceof QueueableCollection) {
return new ModelIdentifier(
$value->getQueueableClass(),
$value->getQueueableIds(),
$value->getQueueableRelations(),
$value->getQueueableConnection()
);
}
if ($value instanceof QueueableEntity) {
return new ModelIdentifier(
get_class($value),
$value->getQueueableId(),
$value->getQueueableRelations(),
$value->getQueueableConnection()
);
}
return $value;
} | php | protected function getSerializedPropertyValue($value)
{
if ($value instanceof QueueableCollection) {
return new ModelIdentifier(
$value->getQueueableClass(),
$value->getQueueableIds(),
$value->getQueueableRelations(),
$value->getQueueableConnection()
);
}
if ($value instanceof QueueableEntity) {
return new ModelIdentifier(
get_class($value),
$value->getQueueableId(),
$value->getQueueableRelations(),
$value->getQueueableConnection()
);
}
return $value;
} | [
"protected",
"function",
"getSerializedPropertyValue",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"value",
"instanceof",
"QueueableCollection",
")",
"{",
"return",
"new",
"ModelIdentifier",
"(",
"$",
"value",
"->",
"getQueueableClass",
"(",
")",
",",
"$",
"v... | Get the property value prepared for serialization.
@param mixed $value
@return mixed | [
"Get",
"the",
"property",
"value",
"prepared",
"for",
"serialization",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Queue/SerializesAndRestoresModelIdentifiers.php#L18-L39 | train | Returns the serialized value of the property | [
30522,
5123,
3853,
4152,
11610,
28931,
21572,
4842,
3723,
10175,
5657,
1006,
1002,
3643,
1007,
1063,
2065,
1006,
1002,
3643,
6013,
11253,
24240,
3085,
26895,
18491,
1007,
1063,
2709,
2047,
2944,
5178,
16778,
8873,
2121,
1006,
1002,
3643,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/DataTable.php | DataTable.getFirstRow | public function getFirstRow()
{
if (count($this->rows) == 0) {
if (!is_null($this->summaryRow)) {
return $this->summaryRow;
}
return false;
}
return reset($this->rows);
} | php | public function getFirstRow()
{
if (count($this->rows) == 0) {
if (!is_null($this->summaryRow)) {
return $this->summaryRow;
}
return false;
}
return reset($this->rows);
} | [
"public",
"function",
"getFirstRow",
"(",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"this",
"->",
"rows",
")",
"==",
"0",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"this",
"->",
"summaryRow",
")",
")",
"{",
"return",
"$",
"this",
"->",
"summar... | Returns the first row of the DataTable.
@return Row|false The first row or `false` if it cannot be found. | [
"Returns",
"the",
"first",
"row",
"of",
"the",
"DataTable",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/DataTable.php#L1013-L1022 | train | Get First Row | [
30522,
2270,
3853,
2131,
8873,
12096,
10524,
1006,
1007,
1063,
2065,
1006,
4175,
1006,
1002,
2023,
1011,
1028,
10281,
1007,
1027,
1027,
1014,
1007,
1063,
2065,
1006,
999,
2003,
1035,
19701,
1006,
1002,
2023,
1011,
1028,
12654,
10524,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/system/behaviors/SettingsModel.php | SettingsModel.afterModelFetch | public function afterModelFetch()
{
$this->fieldValues = $this->model->value ?: [];
$this->model->attributes = array_merge($this->fieldValues, $this->model->attributes);
} | php | public function afterModelFetch()
{
$this->fieldValues = $this->model->value ?: [];
$this->model->attributes = array_merge($this->fieldValues, $this->model->attributes);
} | [
"public",
"function",
"afterModelFetch",
"(",
")",
"{",
"$",
"this",
"->",
"fieldValues",
"=",
"$",
"this",
"->",
"model",
"->",
"value",
"?",
":",
"[",
"]",
";",
"$",
"this",
"->",
"model",
"->",
"attributes",
"=",
"array_merge",
"(",
"$",
"this",
"... | Populate the field values from the database record. | [
"Populate",
"the",
"field",
"values",
"from",
"the",
"database",
"record",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/behaviors/SettingsModel.php#L172-L176 | train | After Model Fetch | [
30522,
2270,
3853,
2044,
5302,
9247,
7959,
10649,
1006,
1007,
1063,
1002,
2023,
1011,
1028,
2492,
10175,
15808,
1027,
1002,
2023,
1011,
1028,
2944,
1011,
1028,
3643,
1029,
1024,
1031,
1033,
1025,
1002,
2023,
1011,
1028,
2944,
1011,
1028,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
overtrue/wechat | src/OfficialAccount/Card/CodeClient.php | CodeClient.get | public function get(string $code, string $cardId = '', bool $checkConsume = true)
{
$params = [
'code' => $code,
'check_consume' => $checkConsume,
'card_id' => $cardId,
];
return $this->httpPostJson('card/code/get', $params);
} | php | public function get(string $code, string $cardId = '', bool $checkConsume = true)
{
$params = [
'code' => $code,
'check_consume' => $checkConsume,
'card_id' => $cardId,
];
return $this->httpPostJson('card/code/get', $params);
} | [
"public",
"function",
"get",
"(",
"string",
"$",
"code",
",",
"string",
"$",
"cardId",
"=",
"''",
",",
"bool",
"$",
"checkConsume",
"=",
"true",
")",
"{",
"$",
"params",
"=",
"[",
"'code'",
"=>",
"$",
"code",
",",
"'check_consume'",
"=>",
"$",
"check... | 查询 Code 接口.
@param string $code
@param string $cardId
@param bool $checkConsume
@return mixed | [
"查询",
"Code",
"接口",
"."
] | 120c72faaa93c270365bc75c73c362d5fd583209 | https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/OfficialAccount/Card/CodeClient.php#L84-L93 | train | Get Card Code | [
30522,
2270,
3853,
2131,
1006,
5164,
1002,
3642,
1010,
5164,
1002,
4003,
3593,
1027,
1005,
1005,
1010,
22017,
2140,
1002,
4638,
8663,
23545,
1027,
2995,
1007,
1063,
1002,
11498,
5244,
1027,
1031,
1005,
3642,
1005,
1027,
1028,
1002,
3642,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Controller/ArgumentResolver/RequestValueResolver.php | RequestValueResolver.supports | public function supports(Request $request, ArgumentMetadata $argument)
{
return Request::class === $argument->getType() || is_subclass_of($argument->getType(), Request::class);
} | php | public function supports(Request $request, ArgumentMetadata $argument)
{
return Request::class === $argument->getType() || is_subclass_of($argument->getType(), Request::class);
} | [
"public",
"function",
"supports",
"(",
"Request",
"$",
"request",
",",
"ArgumentMetadata",
"$",
"argument",
")",
"{",
"return",
"Request",
"::",
"class",
"===",
"$",
"argument",
"->",
"getType",
"(",
")",
"||",
"is_subclass_of",
"(",
"$",
"argument",
"->",
... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/RequestValueResolver.php#L28-L31 | train | Returns true if the type of the request is supported by the ArgumentMetadata | [
30522,
2270,
3853,
6753,
1006,
5227,
1002,
5227,
1010,
6685,
11368,
8447,
2696,
1002,
6685,
1007,
1063,
2709,
5227,
1024,
1024,
2465,
1027,
1027,
1027,
1002,
6685,
1011,
1028,
2131,
13874,
1006,
1007,
1064,
1064,
2003,
1035,
4942,
26266,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Console/Scheduling/Event.php | Event.runCommandInForeground | protected function runCommandInForeground(Container $container)
{
$this->callBeforeCallbacks($container);
$this->exitCode = Process::fromShellCommandline($this->buildCommand(), base_path(), null, null, null)->run();
$this->callAfterCallbacks($container);
} | php | protected function runCommandInForeground(Container $container)
{
$this->callBeforeCallbacks($container);
$this->exitCode = Process::fromShellCommandline($this->buildCommand(), base_path(), null, null, null)->run();
$this->callAfterCallbacks($container);
} | [
"protected",
"function",
"runCommandInForeground",
"(",
"Container",
"$",
"container",
")",
"{",
"$",
"this",
"->",
"callBeforeCallbacks",
"(",
"$",
"container",
")",
";",
"$",
"this",
"->",
"exitCode",
"=",
"Process",
"::",
"fromShellCommandline",
"(",
"$",
"... | Run the command in the foreground.
@param \Illuminate\Contracts\Container\Container $container
@return void | [
"Run",
"the",
"command",
"in",
"the",
"foreground",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Console/Scheduling/Event.php#L214-L221 | train | Runs the command in the foreground. | [
30522,
5123,
3853,
2448,
9006,
2386,
8718,
29278,
13910,
22494,
4859,
1006,
11661,
1002,
11661,
1007,
1063,
1002,
2023,
1011,
1028,
2655,
4783,
29278,
19281,
3363,
12221,
1006,
1002,
11661,
1007,
1025,
1002,
2023,
1011,
1028,
6164,
16044,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Messenger/Transport/Doctrine/DoctrineReceiver.php | DoctrineReceiver.find | public function find($id): ?Envelope
{
try {
$doctrineEnvelope = $this->connection->find($id);
} catch (DBALException $exception) {
throw new TransportException($exception->getMessage(), 0, $exception);
}
if (null === $doctrineEnvelope) {
return null;
}
return $this->createEnvelopeFromData($doctrineEnvelope);
} | php | public function find($id): ?Envelope
{
try {
$doctrineEnvelope = $this->connection->find($id);
} catch (DBALException $exception) {
throw new TransportException($exception->getMessage(), 0, $exception);
}
if (null === $doctrineEnvelope) {
return null;
}
return $this->createEnvelopeFromData($doctrineEnvelope);
} | [
"public",
"function",
"find",
"(",
"$",
"id",
")",
":",
"?",
"Envelope",
"{",
"try",
"{",
"$",
"doctrineEnvelope",
"=",
"$",
"this",
"->",
"connection",
"->",
"find",
"(",
"$",
"id",
")",
";",
"}",
"catch",
"(",
"DBALException",
"$",
"exception",
")"... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Messenger/Transport/Doctrine/DoctrineReceiver.php#L115-L128 | train | Find a Doctrine envelope by its ID. | [
30522,
2270,
3853,
2424,
1006,
1002,
8909,
1007,
1024,
1029,
11255,
1063,
3046,
1063,
1002,
8998,
2368,
15985,
17635,
1027,
1002,
2023,
1011,
1028,
4434,
1011,
1028,
2424,
1006,
1002,
8909,
1007,
1025,
1065,
4608,
1006,
16962,
9453,
2595,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Url.php | Url.redirectToHttps | public static function redirectToHttps()
{
if (ProxyHttp::isHttps()) {
return;
}
$url = self::getCurrentUrl();
$url = str_replace("http://", "https://", $url);
self::redirectToUrl($url);
} | php | public static function redirectToHttps()
{
if (ProxyHttp::isHttps()) {
return;
}
$url = self::getCurrentUrl();
$url = str_replace("http://", "https://", $url);
self::redirectToUrl($url);
} | [
"public",
"static",
"function",
"redirectToHttps",
"(",
")",
"{",
"if",
"(",
"ProxyHttp",
"::",
"isHttps",
"(",
")",
")",
"{",
"return",
";",
"}",
"$",
"url",
"=",
"self",
"::",
"getCurrentUrl",
"(",
")",
";",
"$",
"url",
"=",
"str_replace",
"(",
"\"... | If the page is using HTTP, redirect to the same page over HTTPS | [
"If",
"the",
"page",
"is",
"using",
"HTTP",
"redirect",
"to",
"the",
"same",
"page",
"over",
"HTTPS"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Url.php#L505-L513 | train | Redirects to the current URL if the proxy is using HTTPS | [
30522,
2270,
10763,
3853,
2417,
7442,
6593,
3406,
11039,
25856,
2015,
1006,
1007,
1063,
2065,
1006,
24540,
11039,
25856,
1024,
1024,
2003,
11039,
25856,
2015,
1006,
1007,
1007,
1063,
2709,
1025,
1065,
1002,
24471,
2140,
1027,
2969,
1024,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/CssSelector/Parser/Handler/HashHandler.php | HashHandler.handle | public function handle(Reader $reader, TokenStream $stream): bool
{
$match = $reader->findPattern($this->patterns->getHashPattern());
if (!$match) {
return false;
}
$value = $this->escaping->escapeUnicode($match[1]);
$stream->push(new Token(Token::TYPE_HASH, $value, $reader->getPosition()));
$reader->moveForward(\strlen($match[0]));
return true;
} | php | public function handle(Reader $reader, TokenStream $stream): bool
{
$match = $reader->findPattern($this->patterns->getHashPattern());
if (!$match) {
return false;
}
$value = $this->escaping->escapeUnicode($match[1]);
$stream->push(new Token(Token::TYPE_HASH, $value, $reader->getPosition()));
$reader->moveForward(\strlen($match[0]));
return true;
} | [
"public",
"function",
"handle",
"(",
"Reader",
"$",
"reader",
",",
"TokenStream",
"$",
"stream",
")",
":",
"bool",
"{",
"$",
"match",
"=",
"$",
"reader",
"->",
"findPattern",
"(",
"$",
"this",
"->",
"patterns",
"->",
"getHashPattern",
"(",
")",
")",
";... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/CssSelector/Parser/Handler/HashHandler.php#L44-L57 | train | Handles the hash token. | [
30522,
2270,
3853,
5047,
1006,
8068,
1002,
8068,
1010,
19204,
21422,
1002,
5460,
1007,
1024,
22017,
2140,
1063,
1002,
2674,
1027,
1002,
8068,
1011,
1028,
2424,
4502,
12079,
2078,
1006,
1002,
2023,
1011,
1028,
7060,
1011,
30524,
1006,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Foundation/Console/EventGenerateCommand.php | EventGenerateCommand.makeEventAndListeners | protected function makeEventAndListeners($event, $listeners)
{
if (! Str::contains($event, '\\')) {
return;
}
$this->callSilent('make:event', ['name' => $event]);
$this->makeListeners($event, $listeners);
} | php | protected function makeEventAndListeners($event, $listeners)
{
if (! Str::contains($event, '\\')) {
return;
}
$this->callSilent('make:event', ['name' => $event]);
$this->makeListeners($event, $listeners);
} | [
"protected",
"function",
"makeEventAndListeners",
"(",
"$",
"event",
",",
"$",
"listeners",
")",
"{",
"if",
"(",
"!",
"Str",
"::",
"contains",
"(",
"$",
"event",
",",
"'\\\\'",
")",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"callSilent",
"(",
... | Make the event and listeners for the given event.
@param string $event
@param array $listeners
@return void | [
"Make",
"the",
"event",
"and",
"listeners",
"for",
"the",
"given",
"event",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Foundation/Console/EventGenerateCommand.php#L50-L59 | train | Make event and listeners | [
30522,
5123,
3853,
2191,
18697,
12380,
4859,
9863,
24454,
2015,
1006,
1002,
2724,
1010,
1002,
13810,
1007,
1063,
2065,
1006,
999,
2358,
2099,
1024,
1024,
3397,
1006,
1002,
2724,
1010,
1005,
1032,
1032,
1005,
1007,
1007,
1063,
2709,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Database/Query/Grammars/SqlServerGrammar.php | SqlServerGrammar.compileDelete | public function compileDelete(Builder $query)
{
$table = $this->wrapTable($query->from);
$where = is_array($query->wheres) ? $this->compileWheres($query) : '';
return isset($query->joins)
? $this->compileDeleteWithJoins($query, $table, $where)
: trim("delete from {$table} {$where}");
} | php | public function compileDelete(Builder $query)
{
$table = $this->wrapTable($query->from);
$where = is_array($query->wheres) ? $this->compileWheres($query) : '';
return isset($query->joins)
? $this->compileDeleteWithJoins($query, $table, $where)
: trim("delete from {$table} {$where}");
} | [
"public",
"function",
"compileDelete",
"(",
"Builder",
"$",
"query",
")",
"{",
"$",
"table",
"=",
"$",
"this",
"->",
"wrapTable",
"(",
"$",
"query",
"->",
"from",
")",
";",
"$",
"where",
"=",
"is_array",
"(",
"$",
"query",
"->",
"wheres",
")",
"?",
... | Compile a delete statement into SQL.
@param \Illuminate\Database\Query\Builder $query
@return string | [
"Compile",
"a",
"delete",
"statement",
"into",
"SQL",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Query/Grammars/SqlServerGrammar.php#L303-L312 | train | Compiles a delete query into a string | [
30522,
2270,
3853,
9227,
12260,
2618,
1006,
12508,
1002,
23032,
1007,
1063,
1002,
2795,
1027,
1002,
2023,
1011,
1028,
10236,
10880,
1006,
1002,
23032,
1011,
1028,
2013,
1007,
1025,
1002,
2073,
1027,
2003,
1035,
9140,
1006,
1002,
23032,
1011... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Routing/Matcher/Dumper/CompiledUrlMatcherDumper.php | CompiledUrlMatcherDumper.compileStaticPrefixCollection | private function compileStaticPrefixCollection(StaticPrefixCollection $tree, \stdClass $state, int $prefixLen, array &$conditions): string
{
$code = '';
$prevRegex = null;
$routes = $tree->getRoutes();
foreach ($routes as $i => $route) {
if ($route instanceof StaticPrefixCollection) {
$prevRegex = null;
$prefix = substr($route->getPrefix(), $prefixLen);
$state->mark += \strlen($rx = "|{$prefix}(?");
$code .= "\n .".self::export($rx);
$state->regex .= $rx;
$code .= $this->indent($this->compileStaticPrefixCollection($route, $state, $prefixLen + \strlen($prefix), $conditions));
$code .= "\n .')'";
$state->regex .= ')';
++$state->markTail;
continue;
}
list($name, $regex, $vars, $route, $hasTrailingSlash, $hasTrailingVar) = $route;
$compiledRoute = $route->compile();
$vars = array_merge($state->hostVars, $vars);
if ($compiledRoute->getRegex() === $prevRegex) {
$state->routes[$state->mark][] = $this->compileRoute($route, $name, $vars, $hasTrailingSlash, $hasTrailingVar, $conditions);
continue;
}
$state->mark += 3 + $state->markTail + \strlen($regex) - $prefixLen;
$state->markTail = 2 + \strlen($state->mark);
$rx = sprintf('|%s(*:%s)', substr($regex, $prefixLen), $state->mark);
$code .= "\n .".self::export($rx);
$state->regex .= $rx;
$prevRegex = $compiledRoute->getRegex();
$state->routes[$state->mark] = [$this->compileRoute($route, $name, $vars, $hasTrailingSlash, $hasTrailingVar, $conditions)];
}
return $code;
} | php | private function compileStaticPrefixCollection(StaticPrefixCollection $tree, \stdClass $state, int $prefixLen, array &$conditions): string
{
$code = '';
$prevRegex = null;
$routes = $tree->getRoutes();
foreach ($routes as $i => $route) {
if ($route instanceof StaticPrefixCollection) {
$prevRegex = null;
$prefix = substr($route->getPrefix(), $prefixLen);
$state->mark += \strlen($rx = "|{$prefix}(?");
$code .= "\n .".self::export($rx);
$state->regex .= $rx;
$code .= $this->indent($this->compileStaticPrefixCollection($route, $state, $prefixLen + \strlen($prefix), $conditions));
$code .= "\n .')'";
$state->regex .= ')';
++$state->markTail;
continue;
}
list($name, $regex, $vars, $route, $hasTrailingSlash, $hasTrailingVar) = $route;
$compiledRoute = $route->compile();
$vars = array_merge($state->hostVars, $vars);
if ($compiledRoute->getRegex() === $prevRegex) {
$state->routes[$state->mark][] = $this->compileRoute($route, $name, $vars, $hasTrailingSlash, $hasTrailingVar, $conditions);
continue;
}
$state->mark += 3 + $state->markTail + \strlen($regex) - $prefixLen;
$state->markTail = 2 + \strlen($state->mark);
$rx = sprintf('|%s(*:%s)', substr($regex, $prefixLen), $state->mark);
$code .= "\n .".self::export($rx);
$state->regex .= $rx;
$prevRegex = $compiledRoute->getRegex();
$state->routes[$state->mark] = [$this->compileRoute($route, $name, $vars, $hasTrailingSlash, $hasTrailingVar, $conditions)];
}
return $code;
} | [
"private",
"function",
"compileStaticPrefixCollection",
"(",
"StaticPrefixCollection",
"$",
"tree",
",",
"\\",
"stdClass",
"$",
"state",
",",
"int",
"$",
"prefixLen",
",",
"array",
"&",
"$",
"conditions",
")",
":",
"string",
"{",
"$",
"code",
"=",
"''",
";",... | Compiles a regexp tree of subpatterns that matches nested same-prefix routes.
@param \stdClass $state A simple state object that keeps track of the progress of the compilation,
and gathers the generated switch's "case" and "default" statements | [
"Compiles",
"a",
"regexp",
"tree",
"of",
"subpatterns",
"that",
"matches",
"nested",
"same",
"-",
"prefix",
"routes",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Routing/Matcher/Dumper/CompiledUrlMatcherDumper.php#L374-L414 | train | Compiles a StaticPrefixCollection into code | [
30522,
2797,
3853,
4012,
22090,
16677,
28139,
8873,
2595,
26895,
18491,
1006,
10763,
28139,
8873,
2595,
26895,
18491,
1002,
3392,
1010,
1032,
2358,
16409,
27102,
1002,
2110,
1010,
20014,
1002,
17576,
7770,
1010,
9140,
1004,
1002,
3785,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Routing/Route.php | Route.addOptions | public function addOptions(array $options)
{
foreach ($options as $name => $option) {
$this->options[$name] = $option;
}
$this->compiled = null;
return $this;
} | php | public function addOptions(array $options)
{
foreach ($options as $name => $option) {
$this->options[$name] = $option;
}
$this->compiled = null;
return $this;
} | [
"public",
"function",
"addOptions",
"(",
"array",
"$",
"options",
")",
"{",
"foreach",
"(",
"$",
"options",
"as",
"$",
"name",
"=>",
"$",
"option",
")",
"{",
"$",
"this",
"->",
"options",
"[",
"$",
"name",
"]",
"=",
"$",
"option",
";",
"}",
"$",
... | Adds options.
This method implements a fluent interface.
@param array $options The options
@return $this | [
"Adds",
"options",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Routing/Route.php#L290-L298 | train | Add options to the options array | [
30522,
2270,
3853,
5587,
7361,
9285,
1006,
9140,
1002,
7047,
1007,
1063,
18921,
6776,
1006,
1002,
7047,
2004,
1002,
2171,
1027,
1028,
1002,
5724,
1007,
1063,
1002,
2023,
1011,
1028,
7047,
1031,
1002,
2171,
1033,
1027,
1002,
5724,
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... |
laravel/framework | src/Illuminate/Cache/RedisStore.php | RedisStore.many | public function many(array $keys)
{
$results = [];
$values = $this->connection()->mget(array_map(function ($key) {
return $this->prefix.$key;
}, $keys));
foreach ($values as $index => $value) {
$results[$keys[$index]] = ! is_null($value) ? $this->unserialize($value) : null;
}
return $results;
} | php | public function many(array $keys)
{
$results = [];
$values = $this->connection()->mget(array_map(function ($key) {
return $this->prefix.$key;
}, $keys));
foreach ($values as $index => $value) {
$results[$keys[$index]] = ! is_null($value) ? $this->unserialize($value) : null;
}
return $results;
} | [
"public",
"function",
"many",
"(",
"array",
"$",
"keys",
")",
"{",
"$",
"results",
"=",
"[",
"]",
";",
"$",
"values",
"=",
"$",
"this",
"->",
"connection",
"(",
")",
"->",
"mget",
"(",
"array_map",
"(",
"function",
"(",
"$",
"key",
")",
"{",
"ret... | Retrieve multiple items from the cache by key.
Items not found in the cache will have a null value.
@param array $keys
@return array | [
"Retrieve",
"multiple",
"items",
"from",
"the",
"cache",
"by",
"key",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Cache/RedisStore.php#L67-L80 | train | Get many entries from the cache | [
30522,
2270,
3853,
2116,
1006,
9140,
1002,
6309,
1007,
1063,
1002,
3463,
1027,
1031,
1033,
1025,
1002,
5300,
1027,
1002,
2023,
1011,
1028,
4434,
1006,
1007,
1011,
1028,
11460,
3388,
1006,
9140,
1035,
4949,
1006,
3853,
1006,
1002,
3145,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Database/Query/Builder.php | Builder.orWhereJsonLength | public function orWhereJsonLength($column, $operator, $value = null)
{
[$value, $operator] = $this->prepareValueAndOperator(
$value, $operator, func_num_args() === 2
);
return $this->whereJsonLength($column, $operator, $value, 'or');
} | php | public function orWhereJsonLength($column, $operator, $value = null)
{
[$value, $operator] = $this->prepareValueAndOperator(
$value, $operator, func_num_args() === 2
);
return $this->whereJsonLength($column, $operator, $value, 'or');
} | [
"public",
"function",
"orWhereJsonLength",
"(",
"$",
"column",
",",
"$",
"operator",
",",
"$",
"value",
"=",
"null",
")",
"{",
"[",
"$",
"value",
",",
"$",
"operator",
"]",
"=",
"$",
"this",
"->",
"prepareValueAndOperator",
"(",
"$",
"value",
",",
"$",... | Add a "or where JSON length" clause to the query.
@param string $column
@param mixed $operator
@param mixed $value
@return $this | [
"Add",
"a",
"or",
"where",
"JSON",
"length",
"clause",
"to",
"the",
"query",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Query/Builder.php#L1599-L1606 | train | Add or where JSON length clause to query. | [
30522,
2270,
3853,
2030,
2860,
5886,
20518,
3385,
7770,
13512,
2232,
1006,
1002,
5930,
1010,
1002,
6872,
1010,
1002,
3643,
1027,
19701,
1007,
1063,
1031,
1002,
3643,
1010,
1002,
6872,
1033,
1027,
1002,
2023,
1011,
1028,
7374,
10175,
5657,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Finder/Finder.php | Finder.date | public function date($dates)
{
foreach ((array) $dates as $date) {
$this->dates[] = new Comparator\DateComparator($date);
}
return $this;
} | php | public function date($dates)
{
foreach ((array) $dates as $date) {
$this->dates[] = new Comparator\DateComparator($date);
}
return $this;
} | [
"public",
"function",
"date",
"(",
"$",
"dates",
")",
"{",
"foreach",
"(",
"(",
"array",
")",
"$",
"dates",
"as",
"$",
"date",
")",
"{",
"$",
"this",
"->",
"dates",
"[",
"]",
"=",
"new",
"Comparator",
"\\",
"DateComparator",
"(",
"$",
"date",
")",
... | Adds tests for file dates (last modified).
The date must be something that strtotime() is able to parse:
$finder->date('since yesterday');
$finder->date('until 2 days ago');
$finder->date('> now - 2 hours');
$finder->date('>= 2005-10-15');
$finder->date(['>= 2005-10-15', '<= 2006-05-27']);
@param string|string[] $dates A date range string or an array of date ranges
@return $this
@see strtotime
@see DateRangeFilterIterator
@see DateComparator | [
"Adds",
"tests",
"for",
"file",
"dates",
"(",
"last",
"modified",
")",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Finder/Finder.php#L150-L157 | train | Date Comparator - > DateComparator | [
30522,
2270,
3853,
3058,
1006,
1002,
5246,
1007,
1063,
18921,
6776,
1006,
1006,
9140,
1007,
1002,
5246,
2004,
1002,
3058,
1007,
1063,
1002,
2023,
1011,
1028,
5246,
1031,
1033,
1027,
2047,
4012,
28689,
4263,
30524,
0,
0,
0,
0,
0,
0,
0,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/cms/classes/ComponentManager.php | ComponentManager.hasComponent | public function hasComponent($name)
{
$className = $this->resolve($name);
if (!$className) {
return false;
}
return isset($this->classMap[$className]);
} | php | public function hasComponent($name)
{
$className = $this->resolve($name);
if (!$className) {
return false;
}
return isset($this->classMap[$className]);
} | [
"public",
"function",
"hasComponent",
"(",
"$",
"name",
")",
"{",
"$",
"className",
"=",
"$",
"this",
"->",
"resolve",
"(",
"$",
"name",
")",
";",
"if",
"(",
"!",
"$",
"className",
")",
"{",
"return",
"false",
";",
"}",
"return",
"isset",
"(",
"$",... | Checks to see if a component has been registered.
@param string $name A component class name or code.
@return bool Returns true if the component is registered, otherwise false. | [
"Checks",
"to",
"see",
"if",
"a",
"component",
"has",
"been",
"registered",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/ComponentManager.php#L179-L187 | train | Checks if a component is available | [
30522,
2270,
3853,
2038,
9006,
29513,
3372,
1006,
1002,
2171,
1007,
1063,
1002,
2465,
18442,
1027,
1002,
2023,
1011,
1028,
10663,
1006,
1002,
2171,
1007,
1025,
2065,
1006,
999,
1002,
2465,
18442,
1007,
1063,
2709,
6270,
1025,
1065,
2709,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Console/Scheduling/Schedule.php | Schedule.compileParameters | protected function compileParameters(array $parameters)
{
return collect($parameters)->map(function ($value, $key) {
if (is_array($value)) {
$value = collect($value)->map(function ($value) {
return ProcessUtils::escapeArgument($value);
})->implode(' ');
} elseif (! is_numeric($value) && ! preg_match('/^(-.$|--.*)/i', $value)) {
$value = ProcessUtils::escapeArgument($value);
}
return is_numeric($key) ? $value : "{$key}={$value}";
})->implode(' ');
} | php | protected function compileParameters(array $parameters)
{
return collect($parameters)->map(function ($value, $key) {
if (is_array($value)) {
$value = collect($value)->map(function ($value) {
return ProcessUtils::escapeArgument($value);
})->implode(' ');
} elseif (! is_numeric($value) && ! preg_match('/^(-.$|--.*)/i', $value)) {
$value = ProcessUtils::escapeArgument($value);
}
return is_numeric($key) ? $value : "{$key}={$value}";
})->implode(' ');
} | [
"protected",
"function",
"compileParameters",
"(",
"array",
"$",
"parameters",
")",
"{",
"return",
"collect",
"(",
"$",
"parameters",
")",
"->",
"map",
"(",
"function",
"(",
"$",
"value",
",",
"$",
"key",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"val... | Compile parameters for a command.
@param array $parameters
@return string | [
"Compile",
"parameters",
"for",
"a",
"command",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Console/Scheduling/Schedule.php#L143-L156 | train | Compiles parameters into a string | [
30522,
5123,
3853,
4012,
22090,
28689,
22828,
2015,
1006,
9140,
1002,
11709,
1007,
1063,
2709,
8145,
1006,
1002,
11709,
1007,
1011,
1028,
4949,
1006,
3853,
1006,
1002,
3643,
1010,
1002,
3145,
1007,
1063,
2065,
1006,
2003,
1035,
9140,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
php-ai/php-ml | src/Regression/LeastSquares.php | LeastSquares.computeCoefficients | private function computeCoefficients(): void
{
$samplesMatrix = $this->getSamplesMatrix();
$targetsMatrix = $this->getTargetsMatrix();
$ts = $samplesMatrix->transpose()->multiply($samplesMatrix)->inverse();
$tf = $samplesMatrix->transpose()->multiply($targetsMatrix);
$this->coefficients = $ts->multiply($tf)->getColumnValues(0);
$this->intercept = array_shift($this->coefficients);
} | php | private function computeCoefficients(): void
{
$samplesMatrix = $this->getSamplesMatrix();
$targetsMatrix = $this->getTargetsMatrix();
$ts = $samplesMatrix->transpose()->multiply($samplesMatrix)->inverse();
$tf = $samplesMatrix->transpose()->multiply($targetsMatrix);
$this->coefficients = $ts->multiply($tf)->getColumnValues(0);
$this->intercept = array_shift($this->coefficients);
} | [
"private",
"function",
"computeCoefficients",
"(",
")",
":",
"void",
"{",
"$",
"samplesMatrix",
"=",
"$",
"this",
"->",
"getSamplesMatrix",
"(",
")",
";",
"$",
"targetsMatrix",
"=",
"$",
"this",
"->",
"getTargetsMatrix",
"(",
")",
";",
"$",
"ts",
"=",
"$... | coefficient(b) = (X'X)-1X'Y. | [
"coefficient",
"(",
"b",
")",
"=",
"(",
"X",
"X",
")",
"-",
"1X",
"Y",
"."
] | f6aa1a59b0525b8fca3d2786d661ab3e70904016 | https://github.com/php-ai/php-ml/blob/f6aa1a59b0525b8fca3d2786d661ab3e70904016/src/Regression/LeastSquares.php#L68-L78 | train | Compute coefficients of the terms | [
30522,
2797,
3853,
24134,
16288,
26989,
23402,
7666,
1006,
1007,
1024,
11675,
1063,
1002,
8168,
18900,
17682,
1027,
1002,
2023,
1011,
1028,
4152,
16613,
4244,
18900,
17682,
1006,
1007,
1025,
1002,
7889,
18900,
17682,
1027,
1002,
2023,
1011,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
overtrue/wechat | src/OpenPlatform/Base/Client.php | Client.handleAuthorize | public function handleAuthorize(string $authCode = null)
{
$params = [
'component_appid' => $this->app['config']['app_id'],
'authorization_code' => $authCode ?? $this->app['request']->get('auth_code'),
];
return $this->httpPostJson('cgi-bin/component/api_query_auth', $params);
} | php | public function handleAuthorize(string $authCode = null)
{
$params = [
'component_appid' => $this->app['config']['app_id'],
'authorization_code' => $authCode ?? $this->app['request']->get('auth_code'),
];
return $this->httpPostJson('cgi-bin/component/api_query_auth', $params);
} | [
"public",
"function",
"handleAuthorize",
"(",
"string",
"$",
"authCode",
"=",
"null",
")",
"{",
"$",
"params",
"=",
"[",
"'component_appid'",
"=>",
"$",
"this",
"->",
"app",
"[",
"'config'",
"]",
"[",
"'app_id'",
"]",
",",
"'authorization_code'",
"=>",
"$"... | Get authorization info.
@param string|null $authCode
@return mixed | [
"Get",
"authorization",
"info",
"."
] | 120c72faaa93c270365bc75c73c362d5fd583209 | https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/OpenPlatform/Base/Client.php#L30-L38 | train | Handle authorize request | [
30522,
2270,
3853,
5047,
4887,
27844,
4697,
1006,
5164,
1002,
8740,
2705,
16044,
1027,
19701,
1007,
1063,
1002,
11498,
5244,
1027,
1031,
1005,
6922,
1035,
10439,
3593,
1005,
1027,
1028,
1002,
2023,
1011,
1028,
10439,
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... |
walkor/Workerman | Worker.php | Worker.checkErrors | public static function checkErrors()
{
if (static::STATUS_SHUTDOWN != static::$_status) {
$error_msg = static::$_OS === OS_TYPE_LINUX ? 'Worker['. posix_getpid() .'] process terminated' : 'Worker process terminated';
$errors = error_get_last();
if ($errors && ($errors['type'] === E_ERROR ||
$errors['type'] === E_PARSE ||
$errors['type'] === E_CORE_ERROR ||
$errors['type'] === E_COMPILE_ERROR ||
$errors['type'] === E_RECOVERABLE_ERROR)
) {
$error_msg .= ' with ERROR: ' . static::getErrorType($errors['type']) . " \"{$errors['message']} in {$errors['file']} on line {$errors['line']}\"";
}
static::log($error_msg);
}
} | php | public static function checkErrors()
{
if (static::STATUS_SHUTDOWN != static::$_status) {
$error_msg = static::$_OS === OS_TYPE_LINUX ? 'Worker['. posix_getpid() .'] process terminated' : 'Worker process terminated';
$errors = error_get_last();
if ($errors && ($errors['type'] === E_ERROR ||
$errors['type'] === E_PARSE ||
$errors['type'] === E_CORE_ERROR ||
$errors['type'] === E_COMPILE_ERROR ||
$errors['type'] === E_RECOVERABLE_ERROR)
) {
$error_msg .= ' with ERROR: ' . static::getErrorType($errors['type']) . " \"{$errors['message']} in {$errors['file']} on line {$errors['line']}\"";
}
static::log($error_msg);
}
} | [
"public",
"static",
"function",
"checkErrors",
"(",
")",
"{",
"if",
"(",
"static",
"::",
"STATUS_SHUTDOWN",
"!=",
"static",
"::",
"$",
"_status",
")",
"{",
"$",
"error_msg",
"=",
"static",
"::",
"$",
"_OS",
"===",
"OS_TYPE_LINUX",
"?",
"'Worker['",
".",
... | Check errors when current process exited.
@return void | [
"Check",
"errors",
"when",
"current",
"process",
"exited",
"."
] | 13649907f05014fcfffcfccaef01e63ad3339351 | https://github.com/walkor/Workerman/blob/13649907f05014fcfffcfccaef01e63ad3339351/Worker.php#L2008-L2023 | train | Check for errors | [
30522,
2270,
10763,
3853,
4638,
2121,
29165,
2015,
1006,
1007,
1063,
2065,
1006,
10763,
1024,
1024,
3570,
1035,
3844,
7698,
999,
1027,
10763,
1024,
1024,
1002,
1035,
3570,
1007,
1063,
1002,
7561,
1035,
5796,
2290,
1027,
10763,
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/Framework/Flex/Storage/SimpleStorage.php | SimpleStorage.replaceRows | public function replaceRows(array $rows): array
{
if (null === $this->data) {
$this->buildIndex();
}
$list = [];
foreach ($rows as $key => $row) {
if (strpos($key, '@@')) {
$key = $this->getNewKey();
}
$this->data[$key] = $list[$key] = $row;
}
if ($list) {
$this->save();
}
return $list;
} | php | public function replaceRows(array $rows): array
{
if (null === $this->data) {
$this->buildIndex();
}
$list = [];
foreach ($rows as $key => $row) {
if (strpos($key, '@@')) {
$key = $this->getNewKey();
}
$this->data[$key] = $list[$key] = $row;
}
if ($list) {
$this->save();
}
return $list;
} | [
"public",
"function",
"replaceRows",
"(",
"array",
"$",
"rows",
")",
":",
"array",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"data",
")",
"{",
"$",
"this",
"->",
"buildIndex",
"(",
")",
";",
"}",
"$",
"list",
"=",
"[",
"]",
";",
"foreach"... | {@inheritdoc}
@see FlexStorageInterface::replaceRows() | [
"{"
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Framework/Flex/Storage/SimpleStorage.php#L187-L206 | train | Replace rows with new values | [
30522,
2270,
3853,
5672,
10524,
2015,
1006,
9140,
1002,
10281,
1007,
1024,
9140,
1063,
2065,
1006,
19701,
1027,
1027,
1027,
1002,
2023,
1011,
1028,
2951,
1007,
1063,
1002,
2023,
1011,
1028,
3857,
22254,
10288,
1006,
1007,
1025,
1065,
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/Queue/SyncQueue.php | SyncQueue.resolveJob | protected function resolveJob($payload, $queue)
{
return new SyncJob($this->container, $payload, $this->connectionName, $queue);
} | php | protected function resolveJob($payload, $queue)
{
return new SyncJob($this->container, $payload, $this->connectionName, $queue);
} | [
"protected",
"function",
"resolveJob",
"(",
"$",
"payload",
",",
"$",
"queue",
")",
"{",
"return",
"new",
"SyncJob",
"(",
"$",
"this",
"->",
"container",
",",
"$",
"payload",
",",
"$",
"this",
"->",
"connectionName",
",",
"$",
"queue",
")",
";",
"}"
] | Resolve a Sync job instance.
@param string $payload
@param string $queue
@return \Illuminate\Queue\Jobs\SyncJob | [
"Resolve",
"a",
"Sync",
"job",
"instance",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Queue/SyncQueue.php#L61-L64 | train | Resolve a SyncJob | [
30522,
5123,
3853,
10663,
5558,
2497,
1006,
1002,
18093,
1010,
1002,
24240,
1007,
1063,
2709,
2047,
26351,
5558,
2497,
1006,
1002,
2023,
1011,
1028,
11661,
1010,
1002,
18093,
1010,
1002,
2023,
1011,
1028,
4434,
18442,
1010,
1002,
24240,
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/Form.php | Form.removeTab | public function removeTab($name)
{
foreach ($this->allFields as $fieldName => $field) {
if ($field->tab == $name) {
$this->removeField($fieldName);
}
}
} | php | public function removeTab($name)
{
foreach ($this->allFields as $fieldName => $field) {
if ($field->tab == $name) {
$this->removeField($fieldName);
}
}
} | [
"public",
"function",
"removeTab",
"(",
"$",
"name",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"allFields",
"as",
"$",
"fieldName",
"=>",
"$",
"field",
")",
"{",
"if",
"(",
"$",
"field",
"->",
"tab",
"==",
"$",
"name",
")",
"{",
"$",
"this",
"... | Programatically remove all fields belonging to a tab.
@param string $name
@return bool | [
"Programatically",
"remove",
"all",
"fields",
"belonging",
"to",
"a",
"tab",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/Form.php#L765-L772 | train | Remove Tab Field | [
30522,
2270,
3853,
6366,
2696,
2497,
1006,
1002,
2171,
1007,
1063,
18921,
6776,
1006,
1002,
2023,
1011,
1028,
2035,
15155,
2004,
1002,
2492,
18442,
1027,
1028,
1002,
2492,
1007,
1063,
2065,
1006,
1002,
2492,
1011,
1028,
21628,
1027,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/DomCrawler/Field/ChoiceFormField.php | ChoiceFormField.initialize | protected function initialize()
{
if ('input' !== $this->node->nodeName && 'select' !== $this->node->nodeName) {
throw new \LogicException(sprintf('A ChoiceFormField can only be created from an input or select tag (%s given).', $this->node->nodeName));
}
if ('input' === $this->node->nodeName && 'checkbox' !== strtolower($this->node->getAttribute('type')) && 'radio' !== strtolower($this->node->getAttribute('type'))) {
throw new \LogicException(sprintf('A ChoiceFormField can only be created from an input tag with a type of checkbox or radio (given type is %s).', $this->node->getAttribute('type')));
}
$this->value = null;
$this->options = [];
$this->multiple = false;
if ('input' == $this->node->nodeName) {
$this->type = strtolower($this->node->getAttribute('type'));
$optionValue = $this->buildOptionValue($this->node);
$this->options[] = $optionValue;
if ($this->node->hasAttribute('checked')) {
$this->value = $optionValue['value'];
}
} else {
$this->type = 'select';
if ($this->node->hasAttribute('multiple')) {
$this->multiple = true;
$this->value = [];
$this->name = str_replace('[]', '', $this->name);
}
$found = false;
foreach ($this->xpath->query('descendant::option', $this->node) as $option) {
$optionValue = $this->buildOptionValue($option);
$this->options[] = $optionValue;
if ($option->hasAttribute('selected')) {
$found = true;
if ($this->multiple) {
$this->value[] = $optionValue['value'];
} else {
$this->value = $optionValue['value'];
}
}
}
// if no option is selected and if it is a simple select box, take the first option as the value
if (!$found && !$this->multiple && !empty($this->options)) {
$this->value = $this->options[0]['value'];
}
}
} | php | protected function initialize()
{
if ('input' !== $this->node->nodeName && 'select' !== $this->node->nodeName) {
throw new \LogicException(sprintf('A ChoiceFormField can only be created from an input or select tag (%s given).', $this->node->nodeName));
}
if ('input' === $this->node->nodeName && 'checkbox' !== strtolower($this->node->getAttribute('type')) && 'radio' !== strtolower($this->node->getAttribute('type'))) {
throw new \LogicException(sprintf('A ChoiceFormField can only be created from an input tag with a type of checkbox or radio (given type is %s).', $this->node->getAttribute('type')));
}
$this->value = null;
$this->options = [];
$this->multiple = false;
if ('input' == $this->node->nodeName) {
$this->type = strtolower($this->node->getAttribute('type'));
$optionValue = $this->buildOptionValue($this->node);
$this->options[] = $optionValue;
if ($this->node->hasAttribute('checked')) {
$this->value = $optionValue['value'];
}
} else {
$this->type = 'select';
if ($this->node->hasAttribute('multiple')) {
$this->multiple = true;
$this->value = [];
$this->name = str_replace('[]', '', $this->name);
}
$found = false;
foreach ($this->xpath->query('descendant::option', $this->node) as $option) {
$optionValue = $this->buildOptionValue($option);
$this->options[] = $optionValue;
if ($option->hasAttribute('selected')) {
$found = true;
if ($this->multiple) {
$this->value[] = $optionValue['value'];
} else {
$this->value = $optionValue['value'];
}
}
}
// if no option is selected and if it is a simple select box, take the first option as the value
if (!$found && !$this->multiple && !empty($this->options)) {
$this->value = $this->options[0]['value'];
}
}
} | [
"protected",
"function",
"initialize",
"(",
")",
"{",
"if",
"(",
"'input'",
"!==",
"$",
"this",
"->",
"node",
"->",
"nodeName",
"&&",
"'select'",
"!==",
"$",
"this",
"->",
"node",
"->",
"nodeName",
")",
"{",
"throw",
"new",
"\\",
"LogicException",
"(",
... | Initializes the form field.
@throws \LogicException When node type is incorrect | [
"Initializes",
"the",
"form",
"field",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DomCrawler/Field/ChoiceFormField.php#L203-L253 | train | Initializes the field from the given node | [
30522,
5123,
3853,
3988,
4697,
1006,
1007,
1063,
2065,
1006,
1005,
7953,
1005,
999,
1027,
1027,
1002,
2023,
1011,
1028,
13045,
1011,
1028,
13045,
18442,
1004,
1004,
1005,
7276,
1005,
999,
1027,
1027,
1002,
2023,
1011,
1028,
13045,
1011,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Security/Http/RememberMe/PersistentTokenBasedRememberMeServices.php | PersistentTokenBasedRememberMeServices.onLoginSuccess | protected function onLoginSuccess(Request $request, Response $response, TokenInterface $token)
{
$series = base64_encode(random_bytes(64));
$tokenValue = base64_encode(random_bytes(64));
$this->tokenProvider->createNewToken(
new PersistentToken(
\get_class($user = $token->getUser()),
$user->getUsername(),
$series,
$tokenValue,
new \DateTime()
)
);
$response->headers->setCookie(
new Cookie(
$this->options['name'],
$this->encodeCookie([$series, $tokenValue]),
time() + $this->options['lifetime'],
$this->options['path'],
$this->options['domain'],
$this->options['secure'] ?? $request->isSecure(),
$this->options['httponly'],
false,
$this->options['samesite'] ?? null
)
);
} | php | protected function onLoginSuccess(Request $request, Response $response, TokenInterface $token)
{
$series = base64_encode(random_bytes(64));
$tokenValue = base64_encode(random_bytes(64));
$this->tokenProvider->createNewToken(
new PersistentToken(
\get_class($user = $token->getUser()),
$user->getUsername(),
$series,
$tokenValue,
new \DateTime()
)
);
$response->headers->setCookie(
new Cookie(
$this->options['name'],
$this->encodeCookie([$series, $tokenValue]),
time() + $this->options['lifetime'],
$this->options['path'],
$this->options['domain'],
$this->options['secure'] ?? $request->isSecure(),
$this->options['httponly'],
false,
$this->options['samesite'] ?? null
)
);
} | [
"protected",
"function",
"onLoginSuccess",
"(",
"Request",
"$",
"request",
",",
"Response",
"$",
"response",
",",
"TokenInterface",
"$",
"token",
")",
"{",
"$",
"series",
"=",
"base64_encode",
"(",
"random_bytes",
"(",
"64",
")",
")",
";",
"$",
"tokenValue",... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Security/Http/RememberMe/PersistentTokenBasedRememberMeServices.php#L99-L127 | train | On login success | [
30522,
5123,
3853,
2006,
21197,
7076,
14194,
9623,
2015,
1006,
5227,
1002,
5227,
1010,
3433,
1002,
3433,
1010,
19204,
18447,
2121,
12172,
1002,
19204,
1007,
1063,
1002,
2186,
1027,
2918,
21084,
1035,
4372,
16044,
1006,
6721,
1035,
27507,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/TaskScheduler.php | TaskScheduler.getScheduledTimeForMethod | public static function getScheduledTimeForMethod($className, $methodName, $methodParameter = null)
{
return self::getInstance()->getScheduledTimeForMethod($className, $methodName, $methodParameter);
} | php | public static function getScheduledTimeForMethod($className, $methodName, $methodParameter = null)
{
return self::getInstance()->getScheduledTimeForMethod($className, $methodName, $methodParameter);
} | [
"public",
"static",
"function",
"getScheduledTimeForMethod",
"(",
"$",
"className",
",",
"$",
"methodName",
",",
"$",
"methodParameter",
"=",
"null",
")",
"{",
"return",
"self",
"::",
"getInstance",
"(",
")",
"->",
"getScheduledTimeForMethod",
"(",
"$",
"classNa... | Return the next scheduled time given the class and method names of a scheduled task.
@param string $className The name of the class that contains the scheduled task method.
@param string $methodName The name of the scheduled task method.
@param string|null $methodParameter Optional method parameter.
@return mixed int|bool The time in miliseconds when the scheduled task will be executed
next or false if it is not scheduled to run. | [
"Return",
"the",
"next",
"scheduled",
"time",
"given",
"the",
"class",
"and",
"method",
"names",
"of",
"a",
"scheduled",
"task",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/TaskScheduler.php#L108-L111 | train | Returns the scheduled time for a method. | [
30522,
2270,
10763,
3853,
4152,
7690,
18696,
7292,
14192,
11031,
7716,
1006,
1002,
2465,
18442,
1010,
1002,
4118,
18442,
1010,
1002,
4118,
28689,
22828,
1027,
19701,
1007,
1063,
2709,
2969,
1024,
1024,
2131,
7076,
26897,
1006,
1007,
1011,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
dompdf/dompdf | src/FrameDecorator/TableCell.php | TableCell.reset | function reset()
{
parent::reset();
$this->_resolved_borders = array();
$this->_content_height = 0;
$this->_frame->reset();
} | php | function reset()
{
parent::reset();
$this->_resolved_borders = array();
$this->_content_height = 0;
$this->_frame->reset();
} | [
"function",
"reset",
"(",
")",
"{",
"parent",
"::",
"reset",
"(",
")",
";",
"$",
"this",
"->",
"_resolved_borders",
"=",
"array",
"(",
")",
";",
"$",
"this",
"->",
"_content_height",
"=",
"0",
";",
"$",
"this",
"->",
"_frame",
"->",
"reset",
"(",
"... | ........................................................................ | [
"........................................................................"
] | 75f13c700009be21a1965dc2c5b68a8708c22ba2 | https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/src/FrameDecorator/TableCell.php#L41-L47 | train | Reset the current context | [
30522,
3853,
25141,
1006,
1007,
1063,
6687,
1024,
1024,
25141,
1006,
1007,
1025,
1002,
2023,
1011,
1028,
1035,
10395,
1035,
6645,
1027,
9140,
1006,
1007,
1025,
1002,
2023,
1011,
1028,
1035,
4180,
1035,
4578,
1027,
1014,
1025,
1002,
2023,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/HttpKernel/HttpCache/ResponseCacheStrategy.php | ResponseCacheStrategy.update | public function update(Response $response)
{
// if we have no embedded Response, do nothing
if (0 === $this->embeddedResponses) {
return;
}
// Remove validation related headers of the master response,
// because some of the response content comes from at least
// one embedded response (which likely has a different caching strategy).
$response->setEtag(null);
$response->setLastModified(null);
$this->add($response);
$response->headers->set('Age', $this->age);
if ($this->isNotCacheableResponseEmbedded) {
$response->setExpires($response->getDate());
if ($this->flagDirectives['no-store']) {
$response->headers->set('Cache-Control', 'no-cache, no-store, must-revalidate');
} else {
$response->headers->set('Cache-Control', 'no-cache, must-revalidate');
}
return;
}
$flags = array_filter($this->flagDirectives);
if (isset($flags['must-revalidate'])) {
$flags['no-cache'] = true;
}
$response->headers->set('Cache-Control', implode(', ', array_keys($flags)));
$maxAge = null;
$sMaxage = null;
if (\is_numeric($this->ageDirectives['max-age'])) {
$maxAge = $this->ageDirectives['max-age'] + $this->age;
$response->headers->addCacheControlDirective('max-age', $maxAge);
}
if (\is_numeric($this->ageDirectives['s-maxage'])) {
$sMaxage = $this->ageDirectives['s-maxage'] + $this->age;
if ($maxAge !== $sMaxage) {
$response->headers->addCacheControlDirective('s-maxage', $sMaxage);
}
}
if (\is_numeric($this->ageDirectives['expires'])) {
$date = clone $response->getDate();
$date->modify('+'.($this->ageDirectives['expires'] + $this->age).' seconds');
$response->setExpires($date);
}
} | php | public function update(Response $response)
{
// if we have no embedded Response, do nothing
if (0 === $this->embeddedResponses) {
return;
}
// Remove validation related headers of the master response,
// because some of the response content comes from at least
// one embedded response (which likely has a different caching strategy).
$response->setEtag(null);
$response->setLastModified(null);
$this->add($response);
$response->headers->set('Age', $this->age);
if ($this->isNotCacheableResponseEmbedded) {
$response->setExpires($response->getDate());
if ($this->flagDirectives['no-store']) {
$response->headers->set('Cache-Control', 'no-cache, no-store, must-revalidate');
} else {
$response->headers->set('Cache-Control', 'no-cache, must-revalidate');
}
return;
}
$flags = array_filter($this->flagDirectives);
if (isset($flags['must-revalidate'])) {
$flags['no-cache'] = true;
}
$response->headers->set('Cache-Control', implode(', ', array_keys($flags)));
$maxAge = null;
$sMaxage = null;
if (\is_numeric($this->ageDirectives['max-age'])) {
$maxAge = $this->ageDirectives['max-age'] + $this->age;
$response->headers->addCacheControlDirective('max-age', $maxAge);
}
if (\is_numeric($this->ageDirectives['s-maxage'])) {
$sMaxage = $this->ageDirectives['s-maxage'] + $this->age;
if ($maxAge !== $sMaxage) {
$response->headers->addCacheControlDirective('s-maxage', $sMaxage);
}
}
if (\is_numeric($this->ageDirectives['expires'])) {
$date = clone $response->getDate();
$date->modify('+'.($this->ageDirectives['expires'] + $this->age).' seconds');
$response->setExpires($date);
}
} | [
"public",
"function",
"update",
"(",
"Response",
"$",
"response",
")",
"{",
"// if we have no embedded Response, do nothing",
"if",
"(",
"0",
"===",
"$",
"this",
"->",
"embeddedResponses",
")",
"{",
"return",
";",
"}",
"// Remove validation related headers of the master... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/HttpCache/ResponseCacheStrategy.php#L95-L153 | train | Update the cache headers of the master response | [
30522,
2270,
3853,
10651,
1006,
3433,
1002,
3433,
1007,
1063,
1013,
1013,
2065,
2057,
2031,
2053,
11157,
3433,
1010,
2079,
2498,
2065,
1006,
1014,
1027,
1027,
1027,
1002,
2023,
1011,
1028,
11157,
6072,
26029,
8583,
1007,
1063,
2709,
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... |
walkor/Workerman | Protocols/Http.php | Http.sessionName | public static function sessionName($name = null)
{
if (PHP_SAPI != 'cli') {
return $name ? session_name($name) : session_name();
}
$session_name = HttpCache::$sessionName;
if ($name && ! static::sessionStarted()) {
HttpCache::$sessionName = $name;
}
return $session_name;
} | php | public static function sessionName($name = null)
{
if (PHP_SAPI != 'cli') {
return $name ? session_name($name) : session_name();
}
$session_name = HttpCache::$sessionName;
if ($name && ! static::sessionStarted()) {
HttpCache::$sessionName = $name;
}
return $session_name;
} | [
"public",
"static",
"function",
"sessionName",
"(",
"$",
"name",
"=",
"null",
")",
"{",
"if",
"(",
"PHP_SAPI",
"!=",
"'cli'",
")",
"{",
"return",
"$",
"name",
"?",
"session_name",
"(",
"$",
"name",
")",
":",
"session_name",
"(",
")",
";",
"}",
"$",
... | sessionName
@param string $name
@return string | [
"sessionName"
] | 13649907f05014fcfffcfccaef01e63ad3339351 | https://github.com/walkor/Workerman/blob/13649907f05014fcfffcfccaef01e63ad3339351/Protocols/Http.php#L397-L407 | train | Get the session name | [
30522,
2270,
10763,
3853,
5219,
18442,
1006,
1002,
2171,
1027,
19701,
1007,
1063,
2065,
1006,
25718,
1035,
20066,
2072,
999,
1027,
1005,
18856,
2072,
1005,
1007,
30524,
1002,
5219,
18442,
1025,
2065,
1006,
1002,
2171,
1004,
1004,
999,
10763... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/Zend/Mail/Storage/Imap.php | Zend_Mail_Storage_Imap.appendMessage | public function appendMessage($message, $folder = null, $flags = null)
{
if ($folder === null) {
$folder = $this->_currentFolder;
}
if ($flags === null) {
$flags = array(Zend_Mail_Storage::FLAG_SEEN);
}
// TODO: handle class instances for $message
if (!$this->_protocol->append($folder, $message, $flags)) {
/**
* @see Zend_Mail_Storage_Exception
*/
// require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('cannot create message, please check if the folder exists and your flags');
}
} | php | public function appendMessage($message, $folder = null, $flags = null)
{
if ($folder === null) {
$folder = $this->_currentFolder;
}
if ($flags === null) {
$flags = array(Zend_Mail_Storage::FLAG_SEEN);
}
// TODO: handle class instances for $message
if (!$this->_protocol->append($folder, $message, $flags)) {
/**
* @see Zend_Mail_Storage_Exception
*/
// require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('cannot create message, please check if the folder exists and your flags');
}
} | [
"public",
"function",
"appendMessage",
"(",
"$",
"message",
",",
"$",
"folder",
"=",
"null",
",",
"$",
"flags",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"folder",
"===",
"null",
")",
"{",
"$",
"folder",
"=",
"$",
"this",
"->",
"_currentFolder",
";",
... | not yet * @param string|Zend_Mail_Message|Zend_Mime_Message $message message as string or instance of message class | [
"not",
"yet",
"*"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Mail/Storage/Imap.php#L570-L588 | train | append a message to the current message | [
30522,
2270,
3853,
10439,
10497,
7834,
3736,
3351,
1006,
1002,
4471,
1010,
1002,
19622,
1027,
19701,
1010,
1002,
9245,
1027,
19701,
1007,
1063,
2065,
1006,
1002,
19622,
1027,
1027,
1027,
19701,
1007,
1063,
1002,
19622,
1027,
1002,
2023,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Session/Store.php | Store.exists | public function exists($key)
{
$placeholder = new stdClass;
return ! collect(is_array($key) ? $key : func_get_args())->contains(function ($key) use ($placeholder) {
return $this->get($key, $placeholder) === $placeholder;
});
} | php | public function exists($key)
{
$placeholder = new stdClass;
return ! collect(is_array($key) ? $key : func_get_args())->contains(function ($key) use ($placeholder) {
return $this->get($key, $placeholder) === $placeholder;
});
} | [
"public",
"function",
"exists",
"(",
"$",
"key",
")",
"{",
"$",
"placeholder",
"=",
"new",
"stdClass",
";",
"return",
"!",
"collect",
"(",
"is_array",
"(",
"$",
"key",
")",
"?",
"$",
"key",
":",
"func_get_args",
"(",
")",
")",
"->",
"contains",
"(",
... | Checks if a key exists.
@param string|array $key
@return bool | [
"Checks",
"if",
"a",
"key",
"exists",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Session/Store.php#L176-L183 | train | Checks if a key exists in the cache | [
30522,
2270,
3853,
6526,
1006,
1002,
3145,
1007,
1063,
1002,
2173,
14528,
1027,
2047,
2358,
16409,
27102,
1025,
2709,
999,
8145,
1006,
2003,
1035,
9140,
1006,
1002,
3145,
1007,
1029,
1002,
3145,
1024,
4569,
2278,
1035,
2131,
1035,
12098,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/Goals/API.php | API.getVisitsUntilConversion | public function getVisitsUntilConversion($idSite, $period, $date, $segment = false, $idGoal = false)
{
$dataTable = $this->getGoalSpecificDataTable(
Archiver::VISITS_UNTIL_RECORD_NAME, $idSite, $period, $date, $segment, $idGoal);
$dataTable->queueFilter('Sort', array('label', 'asc', true, false));
$dataTable->queueFilter(
'BeautifyRangeLabels', array(Piwik::translate('General_OneVisit'), Piwik::translate('General_NVisits')));
return $dataTable;
} | php | public function getVisitsUntilConversion($idSite, $period, $date, $segment = false, $idGoal = false)
{
$dataTable = $this->getGoalSpecificDataTable(
Archiver::VISITS_UNTIL_RECORD_NAME, $idSite, $period, $date, $segment, $idGoal);
$dataTable->queueFilter('Sort', array('label', 'asc', true, false));
$dataTable->queueFilter(
'BeautifyRangeLabels', array(Piwik::translate('General_OneVisit'), Piwik::translate('General_NVisits')));
return $dataTable;
} | [
"public",
"function",
"getVisitsUntilConversion",
"(",
"$",
"idSite",
",",
"$",
"period",
",",
"$",
"date",
",",
"$",
"segment",
"=",
"false",
",",
"$",
"idGoal",
"=",
"false",
")",
"{",
"$",
"dataTable",
"=",
"$",
"this",
"->",
"getGoalSpecificDataTable",... | Gets a DataTable that maps ranges of visit counts to the number of conversions that
occurred on those visits for the specified site, date range, segment and goal.
@param int $idSite The site to select data from.
@param string $period The period type.
@param string $date The date type.
@param string|bool $segment The segment.
@param int|bool $idGoal The id of the goal to get data for. If this is set to false,
data for every goal that belongs to $idSite is returned.
@return bool|DataTable | [
"Gets",
"a",
"DataTable",
"that",
"maps",
"ranges",
"of",
"visit",
"counts",
"to",
"the",
"number",
"of",
"conversions",
"that",
"occurred",
"on",
"those",
"visits",
"for",
"the",
"specified",
"site",
"date",
"range",
"segment",
"and",
"goal",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Goals/API.php#L698-L708 | train | Returns the visits until conversion for a specific site period date segment and goal | [
30522,
2270,
3853,
2131,
11365,
12762,
16671,
4014,
8663,
27774,
1006,
1002,
8909,
28032,
2063,
1010,
1002,
2558,
1010,
1002,
3058,
1010,
1002,
6903,
1027,
6270,
1010,
1002,
8909,
3995,
2389,
1027,
6270,
1007,
1063,
1002,
2951,
10880,
1027,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/Site.php | Site.setSiteFromArray | public static function setSiteFromArray($idSite, $infoSite)
{
if (empty($idSite) || empty($infoSite)) {
throw new UnexpectedWebsiteFoundException("An unexpected website was found in the request: website id was set to '$idSite' .");
}
self::$infoSites[$idSite] = $infoSite;
} | php | public static function setSiteFromArray($idSite, $infoSite)
{
if (empty($idSite) || empty($infoSite)) {
throw new UnexpectedWebsiteFoundException("An unexpected website was found in the request: website id was set to '$idSite' .");
}
self::$infoSites[$idSite] = $infoSite;
} | [
"public",
"static",
"function",
"setSiteFromArray",
"(",
"$",
"idSite",
",",
"$",
"infoSite",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"idSite",
")",
"||",
"empty",
"(",
"$",
"infoSite",
")",
")",
"{",
"throw",
"new",
"UnexpectedWebsiteFoundException",
"(",... | Sets a site information in memory (statically cached).
Plugins can filter the website attributes before it is cached, eg. to change the website name,
creation date, etc.
@param $idSite
@param $infoSite
@throws Exception if website or idsite is invalid
@internal | [
"Sets",
"a",
"site",
"information",
"in",
"memory",
"(",
"statically",
"cached",
")",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Site.php#L154-L161 | train | This method sets the website from an array | [
30522,
2270,
10763,
3853,
4520,
4221,
19699,
9626,
11335,
2100,
1006,
1002,
8909,
28032,
2063,
1010,
1002,
18558,
28032,
2063,
1007,
1063,
2065,
1006,
4064,
1006,
1002,
8909,
28032,
2063,
1007,
1064,
1064,
4064,
1006,
1002,
18558,
28032,
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/cms/twig/Extension.php | Extension.placeholderFunction | public function placeholderFunction($name, $default = null)
{
if (($result = Block::get($name)) === null) {
return null;
}
$result = str_replace('<!-- X_OCTOBER_DEFAULT_BLOCK_CONTENT -->', trim($default), $result);
return $result;
} | php | public function placeholderFunction($name, $default = null)
{
if (($result = Block::get($name)) === null) {
return null;
}
$result = str_replace('<!-- X_OCTOBER_DEFAULT_BLOCK_CONTENT -->', trim($default), $result);
return $result;
} | [
"public",
"function",
"placeholderFunction",
"(",
"$",
"name",
",",
"$",
"default",
"=",
"null",
")",
"{",
"if",
"(",
"(",
"$",
"result",
"=",
"Block",
"::",
"get",
"(",
"$",
"name",
")",
")",
"===",
"null",
")",
"{",
"return",
"null",
";",
"}",
... | Renders a placeholder content, without removing the block,
must be called before the placeholder tag itself
@return string Returns the placeholder contents. | [
"Renders",
"a",
"placeholder",
"content",
"without",
"removing",
"the",
"block",
"must",
"be",
"called",
"before",
"the",
"placeholder",
"tag",
"itself"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/twig/Extension.php#L141-L149 | train | This function is used to get the content of a block placeholder | [
30522,
2270,
3853,
2173,
14528,
11263,
27989,
1006,
1002,
2171,
1010,
1002,
12398,
1027,
19701,
1007,
1063,
2065,
1006,
1006,
1002,
2765,
1027,
3796,
1024,
1024,
2131,
1006,
1002,
2171,
1007,
1007,
1027,
1027,
1027,
19701,
1007,
1063,
2709,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/UserCountry/LocationProvider/DefaultProvider.php | DefaultProvider.getLocation | public function getLocation($info)
{
$enableLanguageToCountryGuess = Config::getInstance()->Tracker['enable_language_to_country_guess'];
if (empty($info['lang'])) {
$info['lang'] = Common::getBrowserLanguage();
}
$country = Common::getCountry($info['lang'], $enableLanguageToCountryGuess, $info['ip']);
$location = array(parent::COUNTRY_CODE_KEY => $country);
$this->completeLocationResult($location);
return $location;
} | php | public function getLocation($info)
{
$enableLanguageToCountryGuess = Config::getInstance()->Tracker['enable_language_to_country_guess'];
if (empty($info['lang'])) {
$info['lang'] = Common::getBrowserLanguage();
}
$country = Common::getCountry($info['lang'], $enableLanguageToCountryGuess, $info['ip']);
$location = array(parent::COUNTRY_CODE_KEY => $country);
$this->completeLocationResult($location);
return $location;
} | [
"public",
"function",
"getLocation",
"(",
"$",
"info",
")",
"{",
"$",
"enableLanguageToCountryGuess",
"=",
"Config",
"::",
"getInstance",
"(",
")",
"->",
"Tracker",
"[",
"'enable_language_to_country_guess'",
"]",
";",
"if",
"(",
"empty",
"(",
"$",
"info",
"[",... | Guesses a visitor's location using a visitor's browser language.
@param array $info Contains 'ip' & 'lang' keys.
@return array Contains the guessed country code mapped to LocationProvider::COUNTRY_CODE_KEY. | [
"Guesses",
"a",
"visitor",
"s",
"location",
"using",
"a",
"visitor",
"s",
"browser",
"language",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/UserCountry/LocationProvider/DefaultProvider.php#L32-L45 | train | Guesses the location based on the IP address and the language | [
30522,
2270,
3853,
2131,
4135,
10719,
1006,
1002,
18558,
1007,
1063,
1002,
9585,
25023,
6692,
18150,
24163,
16671,
2854,
22967,
2015,
1027,
9530,
8873,
2290,
1024,
1024,
2131,
7076,
26897,
1006,
1007,
1011,
1028,
27080,
1031,
1005,
9585,
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/Bridge/Twig/TokenParser/FormThemeTokenParser.php | FormThemeTokenParser.parse | public function parse(Token $token)
{
$lineno = $token->getLine();
$stream = $this->parser->getStream();
$form = $this->parser->getExpressionParser()->parseExpression();
$only = false;
if ($this->parser->getStream()->test(Token::NAME_TYPE, 'with')) {
$this->parser->getStream()->next();
$resources = $this->parser->getExpressionParser()->parseExpression();
if ($this->parser->getStream()->nextIf(Token::NAME_TYPE, 'only')) {
$only = true;
}
} else {
$resources = new ArrayExpression([], $stream->getCurrent()->getLine());
do {
$resources->addElement($this->parser->getExpressionParser()->parseExpression());
} while (!$stream->test(Token::BLOCK_END_TYPE));
}
$stream->expect(Token::BLOCK_END_TYPE);
return new FormThemeNode($form, $resources, $lineno, $this->getTag(), $only);
} | php | public function parse(Token $token)
{
$lineno = $token->getLine();
$stream = $this->parser->getStream();
$form = $this->parser->getExpressionParser()->parseExpression();
$only = false;
if ($this->parser->getStream()->test(Token::NAME_TYPE, 'with')) {
$this->parser->getStream()->next();
$resources = $this->parser->getExpressionParser()->parseExpression();
if ($this->parser->getStream()->nextIf(Token::NAME_TYPE, 'only')) {
$only = true;
}
} else {
$resources = new ArrayExpression([], $stream->getCurrent()->getLine());
do {
$resources->addElement($this->parser->getExpressionParser()->parseExpression());
} while (!$stream->test(Token::BLOCK_END_TYPE));
}
$stream->expect(Token::BLOCK_END_TYPE);
return new FormThemeNode($form, $resources, $lineno, $this->getTag(), $only);
} | [
"public",
"function",
"parse",
"(",
"Token",
"$",
"token",
")",
"{",
"$",
"lineno",
"=",
"$",
"token",
"->",
"getLine",
"(",
")",
";",
"$",
"stream",
"=",
"$",
"this",
"->",
"parser",
"->",
"getStream",
"(",
")",
";",
"$",
"form",
"=",
"$",
"this... | Parses a token and returns a node.
@return Node | [
"Parses",
"a",
"token",
"and",
"returns",
"a",
"node",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bridge/Twig/TokenParser/FormThemeTokenParser.php#L32-L57 | train | Parse the form theme | [
30522,
2270,
3853,
11968,
3366,
1006,
19204,
1002,
19204,
1007,
1063,
1002,
17517,
2080,
1027,
1002,
19204,
1011,
1028,
2131,
4179,
1006,
1007,
1025,
1002,
5460,
1027,
1002,
2023,
1011,
1028,
11968,
8043,
1011,
1028,
4152,
25379,
1006,
1007... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Cache/Traits/MemcachedTrait.php | MemcachedTrait.doFetch | protected function doFetch(array $ids)
{
try {
$encodedIds = array_map('rawurlencode', $ids);
$encodedResult = $this->checkResultCode($this->getClient()->getMulti($encodedIds));
$result = [];
foreach ($encodedResult as $key => $value) {
$result[rawurldecode($key)] = $this->marshaller->unmarshall($value);
}
return $result;
} catch (\Error $e) {
throw new \ErrorException($e->getMessage(), $e->getCode(), E_ERROR, $e->getFile(), $e->getLine());
}
} | php | protected function doFetch(array $ids)
{
try {
$encodedIds = array_map('rawurlencode', $ids);
$encodedResult = $this->checkResultCode($this->getClient()->getMulti($encodedIds));
$result = [];
foreach ($encodedResult as $key => $value) {
$result[rawurldecode($key)] = $this->marshaller->unmarshall($value);
}
return $result;
} catch (\Error $e) {
throw new \ErrorException($e->getMessage(), $e->getCode(), E_ERROR, $e->getFile(), $e->getLine());
}
} | [
"protected",
"function",
"doFetch",
"(",
"array",
"$",
"ids",
")",
"{",
"try",
"{",
"$",
"encodedIds",
"=",
"array_map",
"(",
"'rawurlencode'",
",",
"$",
"ids",
")",
";",
"$",
"encodedResult",
"=",
"$",
"this",
"->",
"checkResultCode",
"(",
"$",
"this",
... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Cache/Traits/MemcachedTrait.php#L248-L264 | train | Fetch the list of ids from the server | [
30522,
5123,
3853,
2079,
7959,
10649,
1006,
9140,
1002,
8909,
2015,
1007,
1063,
3046,
1063,
1002,
12359,
9821,
1027,
9140,
1035,
4949,
1006,
1005,
6315,
3126,
7770,
16044,
1005,
1010,
1002,
8909,
2015,
1007,
1025,
1002,
12359,
6072,
11314,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Mime/Address.php | Address.createArray | public static function createArray(array $addresses): array
{
$addrs = [];
foreach ($addresses as $address) {
$addrs[] = self::create($address);
}
return $addrs;
} | php | public static function createArray(array $addresses): array
{
$addrs = [];
foreach ($addresses as $address) {
$addrs[] = self::create($address);
}
return $addrs;
} | [
"public",
"static",
"function",
"createArray",
"(",
"array",
"$",
"addresses",
")",
":",
"array",
"{",
"$",
"addrs",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"addresses",
"as",
"$",
"address",
")",
"{",
"$",
"addrs",
"[",
"]",
"=",
"self",
"::",
"c... | @param (Address|string)[] $addresses
@return Address[] | [
"@param",
"(",
"Address|string",
")",
"[]",
"$addresses"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Mime/Address.php#L89-L97 | train | Create array of addresses | [
30522,
2270,
10763,
3853,
3443,
2906,
9447,
1006,
9140,
1002,
11596,
1007,
1024,
9140,
1063,
1002,
5587,
2869,
1027,
1031,
1033,
1025,
18921,
6776,
1006,
1002,
11596,
2004,
1002,
4769,
1007,
1063,
1002,
5587,
2869,
1031,
1033,
1027,
2969,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/CacheManager.php | CacheManager.createApcDriver | protected function createApcDriver(array $config)
{
$prefix = $this->getPrefix($config);
return $this->repository(new ApcStore(new ApcWrapper, $prefix));
} | php | protected function createApcDriver(array $config)
{
$prefix = $this->getPrefix($config);
return $this->repository(new ApcStore(new ApcWrapper, $prefix));
} | [
"protected",
"function",
"createApcDriver",
"(",
"array",
"$",
"config",
")",
"{",
"$",
"prefix",
"=",
"$",
"this",
"->",
"getPrefix",
"(",
"$",
"config",
")",
";",
"return",
"$",
"this",
"->",
"repository",
"(",
"new",
"ApcStore",
"(",
"new",
"ApcWrappe... | Create an instance of the APC cache driver.
@param array $config
@return \Illuminate\Cache\Repository | [
"Create",
"an",
"instance",
"of",
"the",
"APC",
"cache",
"driver",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Cache/CacheManager.php#L131-L136 | train | Create an instance of the Apc driver | [
30522,
5123,
3853,
3443,
9331,
19797,
24352,
1006,
9140,
1002,
9530,
8873,
2290,
1007,
1063,
1002,
17576,
1027,
1002,
2023,
1011,
1028,
2131,
28139,
8873,
2595,
1006,
1002,
9530,
8873,
2290,
1007,
1025,
2709,
1002,
2023,
1011,
1028,
22409,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Adapter.php | Adapter.getEntryManager | public function getEntryManager()
{
if (null === $this->entryManager) {
$this->entryManager = new EntryManager($this->getConnection());
}
return $this->entryManager;
} | php | public function getEntryManager()
{
if (null === $this->entryManager) {
$this->entryManager = new EntryManager($this->getConnection());
}
return $this->entryManager;
} | [
"public",
"function",
"getEntryManager",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"entryManager",
")",
"{",
"$",
"this",
"->",
"entryManager",
"=",
"new",
"EntryManager",
"(",
"$",
"this",
"->",
"getConnection",
"(",
")",
")",
";",
"... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Ldap/Adapter/ExtLdap/Adapter.php#L50-L57 | train | Get Entry Manager | [
30522,
2270,
3853,
2131,
4765,
2854,
24805,
4590,
1006,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
1027,
1002,
2023,
1011,
1028,
4443,
24805,
4590,
1007,
1063,
1002,
2023,
1011,
1028,
4443,
24805,
4590,
1027,
2047,
4443,
24805,
4590,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Console/Helper/ProgressBar.php | ProgressBar.finish | public function finish(): void
{
if (!$this->max) {
$this->max = $this->step;
}
if ($this->step === $this->max && !$this->overwrite) {
// prevent double 100% output
return;
}
$this->setProgress($this->max);
} | php | public function finish(): void
{
if (!$this->max) {
$this->max = $this->step;
}
if ($this->step === $this->max && !$this->overwrite) {
// prevent double 100% output
return;
}
$this->setProgress($this->max);
} | [
"public",
"function",
"finish",
"(",
")",
":",
"void",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"max",
")",
"{",
"$",
"this",
"->",
"max",
"=",
"$",
"this",
"->",
"step",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"step",
"===",
"$",
"this",
"->"... | Finishes the progress output. | [
"Finishes",
"the",
"progress",
"output",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Console/Helper/ProgressBar.php#L327-L339 | train | Finish the output | [
30522,
2270,
3853,
3926,
1006,
1007,
1024,
11675,
1063,
2065,
1006,
999,
1002,
2023,
1011,
1028,
4098,
1007,
1063,
1002,
2023,
1011,
1028,
4098,
1027,
1002,
2023,
1011,
1028,
3357,
1025,
1065,
2065,
1006,
1002,
2023,
1011,
1028,
3357,
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... |
overtrue/wechat | src/OfficialAccount/Device/Client.php | Client.openid | public function openid(string $deviceId)
{
$params = [
'device_type' => $this->app['config']['device_type'],
'device_id' => $deviceId,
];
return $this->httpGet('device/get_openid', $params);
} | php | public function openid(string $deviceId)
{
$params = [
'device_type' => $this->app['config']['device_type'],
'device_id' => $deviceId,
];
return $this->httpGet('device/get_openid', $params);
} | [
"public",
"function",
"openid",
"(",
"string",
"$",
"deviceId",
")",
"{",
"$",
"params",
"=",
"[",
"'device_type'",
"=>",
"$",
"this",
"->",
"app",
"[",
"'config'",
"]",
"[",
"'device_type'",
"]",
",",
"'device_id'",
"=>",
"$",
"deviceId",
",",
"]",
";... | @param string $deviceId
@return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string | [
"@param",
"string",
"$deviceId"
] | 120c72faaa93c270365bc75c73c362d5fd583209 | https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/OfficialAccount/Device/Client.php#L197-L205 | train | Get openid for a device | [
30522,
2270,
3853,
2330,
3593,
1006,
5164,
1002,
5080,
3593,
1007,
1063,
1002,
11498,
5244,
1027,
1031,
1005,
5080,
1035,
2828,
1005,
1027,
1028,
1002,
2023,
1011,
1028,
10439,
1031,
1005,
9530,
8873,
2290,
1005,
1033,
1031,
1005,
5080,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Notifications/Messages/MailMessage.php | MailMessage.parseAddresses | protected function parseAddresses($value)
{
return collect($value)->map(function ($address, $name) {
return [$address, is_numeric($name) ? null : $name];
})->values()->all();
} | php | protected function parseAddresses($value)
{
return collect($value)->map(function ($address, $name) {
return [$address, is_numeric($name) ? null : $name];
})->values()->all();
} | [
"protected",
"function",
"parseAddresses",
"(",
"$",
"value",
")",
"{",
"return",
"collect",
"(",
"$",
"value",
")",
"->",
"map",
"(",
"function",
"(",
"$",
"address",
",",
"$",
"name",
")",
"{",
"return",
"[",
"$",
"address",
",",
"is_numeric",
"(",
... | Parse the multi-address array into the necessary format.
@param array $value
@return array | [
"Parse",
"the",
"multi",
"-",
"address",
"array",
"into",
"the",
"necessary",
"format",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Notifications/Messages/MailMessage.php#L258-L263 | train | Parse addresses into array | [
30522,
5123,
3853,
11968,
17310,
14141,
25932,
1006,
1002,
3643,
1007,
1063,
2709,
8145,
1006,
1002,
3643,
1007,
1011,
1028,
4949,
1006,
3853,
1006,
1002,
4769,
1010,
1002,
2171,
1007,
1063,
2709,
1031,
1002,
4769,
1010,
2003,
1035,
16371,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
walkor/Workerman | Worker.php | Worker.checkWorkerStatusForWindows | public static function checkWorkerStatusForWindows()
{
foreach(static::$_processForWindows as $process_data)
{
$process = $process_data[0];
$start_file = $process_data[1];
$timer_id = $process_data[2];
$status = proc_get_status($process);
if(isset($status['running']))
{
if(!$status['running'])
{
static::safeEcho("process $start_file terminated and try to restart\n");
Timer::del($timer_id);
proc_close($process);
static::forkOneWorkerForWindows($start_file);
}
}
else
{
static::safeEcho("proc_get_status fail\n");
}
}
} | php | public static function checkWorkerStatusForWindows()
{
foreach(static::$_processForWindows as $process_data)
{
$process = $process_data[0];
$start_file = $process_data[1];
$timer_id = $process_data[2];
$status = proc_get_status($process);
if(isset($status['running']))
{
if(!$status['running'])
{
static::safeEcho("process $start_file terminated and try to restart\n");
Timer::del($timer_id);
proc_close($process);
static::forkOneWorkerForWindows($start_file);
}
}
else
{
static::safeEcho("proc_get_status fail\n");
}
}
} | [
"public",
"static",
"function",
"checkWorkerStatusForWindows",
"(",
")",
"{",
"foreach",
"(",
"static",
"::",
"$",
"_processForWindows",
"as",
"$",
"process_data",
")",
"{",
"$",
"process",
"=",
"$",
"process_data",
"[",
"0",
"]",
";",
"$",
"start_file",
"="... | check worker status for windows.
@return void | [
"check",
"worker",
"status",
"for",
"windows",
"."
] | 13649907f05014fcfffcfccaef01e63ad3339351 | https://github.com/walkor/Workerman/blob/13649907f05014fcfffcfccaef01e63ad3339351/Worker.php#L1422-L1445 | train | Check worker status for Windows | [
30522,
2270,
10763,
3853,
4638,
6198,
2545,
29336,
2271,
29278,
11101,
15568,
1006,
1007,
1063,
18921,
6776,
1006,
10763,
1024,
1024,
1002,
1035,
2832,
29278,
11101,
15568,
2004,
1002,
2832,
1035,
2951,
1007,
1063,
1002,
2832,
1027,
1002,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Intl/Data/Generator/TimezoneDataGenerator.php | TimezoneDataGenerator.compileTemporaryBundles | protected function compileTemporaryBundles(GenrbCompiler $compiler, $sourceDir, $tempDir)
{
$compiler->compile($sourceDir.'/zone', $tempDir);
$compiler->compile($sourceDir.'/misc/timezoneTypes.txt', $tempDir);
$compiler->compile($sourceDir.'/misc/metaZones.txt', $tempDir);
$compiler->compile($sourceDir.'/misc/windowsZones.txt', $tempDir);
} | php | protected function compileTemporaryBundles(GenrbCompiler $compiler, $sourceDir, $tempDir)
{
$compiler->compile($sourceDir.'/zone', $tempDir);
$compiler->compile($sourceDir.'/misc/timezoneTypes.txt', $tempDir);
$compiler->compile($sourceDir.'/misc/metaZones.txt', $tempDir);
$compiler->compile($sourceDir.'/misc/windowsZones.txt', $tempDir);
} | [
"protected",
"function",
"compileTemporaryBundles",
"(",
"GenrbCompiler",
"$",
"compiler",
",",
"$",
"sourceDir",
",",
"$",
"tempDir",
")",
"{",
"$",
"compiler",
"->",
"compile",
"(",
"$",
"sourceDir",
".",
"'/zone'",
",",
"$",
"tempDir",
")",
";",
"$",
"c... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Intl/Data/Generator/TimezoneDataGenerator.php#L57-L63 | train | compile temporary bundles | [
30522,
5123,
3853,
4012,
22090,
18532,
17822,
5649,
27265,
4244,
1006,
8991,
15185,
9006,
22090,
2099,
1002,
21624,
1010,
1002,
23184,
4313,
1010,
1002,
8915,
8737,
4305,
2099,
1007,
1063,
1002,
21624,
1011,
1028,
4012,
22090,
1006,
1002,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Database/Query/Builder.php | Builder.increment | public function increment($column, $amount = 1, array $extra = [])
{
if (! is_numeric($amount)) {
throw new InvalidArgumentException('Non-numeric value passed to increment method.');
}
$wrapped = $this->grammar->wrap($column);
$columns = array_merge([$column => $this->raw("$wrapped + $amount")], $extra);
return $this->update($columns);
} | php | public function increment($column, $amount = 1, array $extra = [])
{
if (! is_numeric($amount)) {
throw new InvalidArgumentException('Non-numeric value passed to increment method.');
}
$wrapped = $this->grammar->wrap($column);
$columns = array_merge([$column => $this->raw("$wrapped + $amount")], $extra);
return $this->update($columns);
} | [
"public",
"function",
"increment",
"(",
"$",
"column",
",",
"$",
"amount",
"=",
"1",
",",
"array",
"$",
"extra",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"is_numeric",
"(",
"$",
"amount",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"("... | Increment a column's value by a given amount.
@param string $column
@param float|int $amount
@param array $extra
@return int | [
"Increment",
"a",
"column",
"s",
"value",
"by",
"a",
"given",
"amount",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Query/Builder.php#L2720-L2731 | train | Increments a column value | [
30522,
2270,
3853,
4297,
28578,
4765,
1006,
1002,
5930,
1010,
1002,
3815,
1027,
1015,
1010,
9140,
1002,
4469,
1027,
1031,
1033,
1007,
1063,
2065,
1006,
999,
2003,
1035,
16371,
25531,
1006,
1002,
3815,
1007,
1007,
1063,
5466,
2047,
19528,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/backend/widgets/Lists.php | Lists.setSearchOptions | public function setSearchOptions($options = [])
{
extract(array_merge([
'mode' => null,
'scope' => null
], $options));
$this->searchMode = $mode;
$this->searchScope = $scope;
} | php | public function setSearchOptions($options = [])
{
extract(array_merge([
'mode' => null,
'scope' => null
], $options));
$this->searchMode = $mode;
$this->searchScope = $scope;
} | [
"public",
"function",
"setSearchOptions",
"(",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"extract",
"(",
"array_merge",
"(",
"[",
"'mode'",
"=>",
"null",
",",
"'scope'",
"=>",
"null",
"]",
",",
"$",
"options",
")",
")",
";",
"$",
"this",
"->",
"search... | Applies a search options to the list search.
@param array $options | [
"Applies",
"a",
"search",
"options",
"to",
"the",
"list",
"search",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/Lists.php#L1404-L1413 | train | Set the search options | [
30522,
2270,
3853,
4520,
14644,
9905,
16790,
2015,
1006,
1002,
7047,
1027,
1031,
1033,
1007,
1063,
14817,
1006,
9140,
1035,
13590,
1006,
1031,
1005,
5549,
1005,
1027,
1028,
19701,
1010,
1005,
9531,
1005,
1027,
1028,
19701,
1033,
1010,
1002,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/DomCrawler/Crawler.php | Crawler.sibling | protected function sibling($node, $siblingDir = 'nextSibling')
{
$nodes = [];
$currentNode = $this->getNode(0);
do {
if ($node !== $currentNode && XML_ELEMENT_NODE === $node->nodeType) {
$nodes[] = $node;
}
} while ($node = $node->$siblingDir);
return $nodes;
} | php | protected function sibling($node, $siblingDir = 'nextSibling')
{
$nodes = [];
$currentNode = $this->getNode(0);
do {
if ($node !== $currentNode && XML_ELEMENT_NODE === $node->nodeType) {
$nodes[] = $node;
}
} while ($node = $node->$siblingDir);
return $nodes;
} | [
"protected",
"function",
"sibling",
"(",
"$",
"node",
",",
"$",
"siblingDir",
"=",
"'nextSibling'",
")",
"{",
"$",
"nodes",
"=",
"[",
"]",
";",
"$",
"currentNode",
"=",
"$",
"this",
"->",
"getNode",
"(",
"0",
")",
";",
"do",
"{",
"if",
"(",
"$",
... | @param \DOMElement $node
@param string $siblingDir
@return array | [
"@param",
"\\",
"DOMElement",
"$node",
"@param",
"string",
"$siblingDir"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DomCrawler/Crawler.php#L1101-L1113 | train | Get sibling nodes | [
30522,
5123,
3853,
22941,
1006,
1002,
13045,
1010,
1002,
22941,
4305,
2099,
1027,
1005,
2279,
5332,
9709,
1005,
1007,
1063,
1002,
14164,
1027,
1031,
1033,
1025,
1002,
2783,
3630,
30524,
14164,
1031,
1033,
1027,
1002,
13045,
1025,
1065,
1065... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
z-song/laravel-admin | src/Grid/Filter/AbstractFilter.php | AbstractFilter.buildCondition | protected function buildCondition()
{
$column = explode('.', $this->column);
if (count($column) == 1) {
return [$this->query => func_get_args()];
}
return $this->buildRelationQuery(...func_get_args());
} | php | protected function buildCondition()
{
$column = explode('.', $this->column);
if (count($column) == 1) {
return [$this->query => func_get_args()];
}
return $this->buildRelationQuery(...func_get_args());
} | [
"protected",
"function",
"buildCondition",
"(",
")",
"{",
"$",
"column",
"=",
"explode",
"(",
"'.'",
",",
"$",
"this",
"->",
"column",
")",
";",
"if",
"(",
"count",
"(",
"$",
"column",
")",
"==",
"1",
")",
"{",
"return",
"[",
"$",
"this",
"->",
"... | Build conditions of filter.
@return mixed | [
"Build",
"conditions",
"of",
"filter",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid/Filter/AbstractFilter.php#L434-L443 | train | Build the condition for the current column | [
30522,
5123,
3853,
3857,
8663,
20562,
1006,
1007,
1063,
1002,
5930,
1027,
15044,
1006,
1005,
1012,
1005,
1010,
1002,
2023,
1011,
1028,
5930,
1007,
1025,
2065,
1006,
4175,
1006,
1002,
5930,
1007,
1027,
1027,
1015,
1007,
1063,
2709,
1031,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Foundation/Application.php | Application.setLocale | public function setLocale($locale)
{
$this['config']->set('app.locale', $locale);
$this['translator']->setLocale($locale);
$this['events']->dispatch(new Events\LocaleUpdated($locale));
} | php | public function setLocale($locale)
{
$this['config']->set('app.locale', $locale);
$this['translator']->setLocale($locale);
$this['events']->dispatch(new Events\LocaleUpdated($locale));
} | [
"public",
"function",
"setLocale",
"(",
"$",
"locale",
")",
"{",
"$",
"this",
"[",
"'config'",
"]",
"->",
"set",
"(",
"'app.locale'",
",",
"$",
"locale",
")",
";",
"$",
"this",
"[",
"'translator'",
"]",
"->",
"setLocale",
"(",
"$",
"locale",
")",
";"... | Set the current application locale.
@param string $locale
@return void | [
"Set",
"the",
"current",
"application",
"locale",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Foundation/Application.php#L1093-L1100 | train | Set the locale for the current language | [
30522,
2270,
3853,
2275,
4135,
9289,
2063,
1006,
1002,
2334,
2063,
1007,
1063,
1002,
2023,
1031,
1005,
9530,
8873,
2290,
1005,
1033,
1011,
1028,
2275,
1006,
1005,
10439,
1012,
2334,
2063,
1005,
1010,
1002,
2334,
2063,
1007,
1025,
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... |
getgrav/grav | system/src/Grav/Common/Uri.php | Uri.query | public function query($id = null, $raw = false)
{
if ($id !== null) {
return $this->queries[$id] ?? null;
}
if ($raw) {
return $this->queries;
}
if (!$this->queries) {
return '';
}
return http_build_query($this->queries);
} | php | public function query($id = null, $raw = false)
{
if ($id !== null) {
return $this->queries[$id] ?? null;
}
if ($raw) {
return $this->queries;
}
if (!$this->queries) {
return '';
}
return http_build_query($this->queries);
} | [
"public",
"function",
"query",
"(",
"$",
"id",
"=",
"null",
",",
"$",
"raw",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"id",
"!==",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"queries",
"[",
"$",
"id",
"]",
"??",
"null",
";",
"}",
"if",
"("... | Return full query string or a single query attribute.
@param string $id Optional attribute. Get a single query attribute if set
@param bool $raw If true and $id is not set, return the full query array. Otherwise return the query string
@return string|array Returns an array if $id = null and $raw = true | [
"Return",
"full",
"query",
"string",
"or",
"a",
"single",
"query",
"attribute",
"."
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Uri.php#L249-L264 | train | Get Query String | [
30522,
2270,
3853,
23032,
1006,
1002,
8909,
1027,
19701,
1010,
1002,
6315,
1027,
6270,
1007,
1063,
2065,
1006,
1002,
8909,
999,
1027,
1027,
19701,
1007,
1063,
2709,
1002,
2023,
1011,
1028,
10861,
5134,
1031,
1002,
8909,
1033,
1029,
1029,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/Login/Controller.php | Controller.authenticateAndRedirect | protected function authenticateAndRedirect($login, $password, $urlToRedirect = false, $passwordHashed = false)
{
Nonce::discardNonce('Login.login');
$this->auth->setLogin($login);
if ($passwordHashed === false) {
$this->auth->setPassword($password);
} else {
$this->auth->setPasswordHash($password);
}
$this->sessionInitializer->initSession($this->auth);
// remove password reset entry if it exists
$this->passwordResetter->removePasswordResetInfo($login);
if (empty($urlToRedirect)) {
$redirect = Common::unsanitizeInputValue(Common::getRequestVar('form_redirect', false));
$redirectParams = UrlHelper::getArrayFromQueryString(UrlHelper::getQueryFromUrl($redirect));
$module = Common::getRequestVar('module', '', 'string', $redirectParams);
// when module is login, we redirect to home...
if (!empty($module) && $module !== 'Login' && $module !== Piwik::getLoginPluginName() && $redirect) {
$host = Url::getHostFromUrl($redirect);
$currentHost = Url::getHost();
$currentHost = explode(':', $currentHost, 2)[0];
// we only redirect to a trusted host
if (!empty($host) && !empty($currentHost) && $host == $currentHost && Url::isValidHost($host)
) {
$urlToRedirect = $redirect;
}
}
}
if (empty($urlToRedirect)) {
$urlToRedirect = Url::getCurrentUrlWithoutQueryString();
}
Url::redirectToUrl($urlToRedirect);
} | php | protected function authenticateAndRedirect($login, $password, $urlToRedirect = false, $passwordHashed = false)
{
Nonce::discardNonce('Login.login');
$this->auth->setLogin($login);
if ($passwordHashed === false) {
$this->auth->setPassword($password);
} else {
$this->auth->setPasswordHash($password);
}
$this->sessionInitializer->initSession($this->auth);
// remove password reset entry if it exists
$this->passwordResetter->removePasswordResetInfo($login);
if (empty($urlToRedirect)) {
$redirect = Common::unsanitizeInputValue(Common::getRequestVar('form_redirect', false));
$redirectParams = UrlHelper::getArrayFromQueryString(UrlHelper::getQueryFromUrl($redirect));
$module = Common::getRequestVar('module', '', 'string', $redirectParams);
// when module is login, we redirect to home...
if (!empty($module) && $module !== 'Login' && $module !== Piwik::getLoginPluginName() && $redirect) {
$host = Url::getHostFromUrl($redirect);
$currentHost = Url::getHost();
$currentHost = explode(':', $currentHost, 2)[0];
// we only redirect to a trusted host
if (!empty($host) && !empty($currentHost) && $host == $currentHost && Url::isValidHost($host)
) {
$urlToRedirect = $redirect;
}
}
}
if (empty($urlToRedirect)) {
$urlToRedirect = Url::getCurrentUrlWithoutQueryString();
}
Url::redirectToUrl($urlToRedirect);
} | [
"protected",
"function",
"authenticateAndRedirect",
"(",
"$",
"login",
",",
"$",
"password",
",",
"$",
"urlToRedirect",
"=",
"false",
",",
"$",
"passwordHashed",
"=",
"false",
")",
"{",
"Nonce",
"::",
"discardNonce",
"(",
"'Login.login'",
")",
";",
"$",
"thi... | Authenticate user and password. Redirect if successful.
@param string $login user name
@param string $password plain-text or hashed password
@param string $urlToRedirect URL to redirect to, if successfully authenticated
@param bool $passwordHashed indicates if $password is hashed
@return string failure message if unable to authenticate | [
"Authenticate",
"user",
"and",
"password",
".",
"Redirect",
"if",
"successful",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Login/Controller.php#L289-L328 | train | Authenticate and redirect to the login page | [
30522,
5123,
3853,
14469,
3686,
5685,
5596,
7442,
6593,
1006,
1002,
8833,
2378,
1010,
1002,
20786,
1010,
1002,
24471,
23223,
5596,
7442,
6593,
1027,
6270,
1010,
1002,
20786,
14949,
9072,
1027,
6270,
1007,
1063,
2512,
3401,
1024,
1024,
5860,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getgrav/grav | system/src/Grav/Common/Language/Language.php | Language.isIncludeDefaultLanguage | public function isIncludeDefaultLanguage($lang = null)
{
// if active lang is not passed in, use current active
if (!$lang) {
$lang = $this->getLanguage();
}
return !($this->default === $lang && $this->config->get('system.languages.include_default_lang') === false);
} | php | public function isIncludeDefaultLanguage($lang = null)
{
// if active lang is not passed in, use current active
if (!$lang) {
$lang = $this->getLanguage();
}
return !($this->default === $lang && $this->config->get('system.languages.include_default_lang') === false);
} | [
"public",
"function",
"isIncludeDefaultLanguage",
"(",
"$",
"lang",
"=",
"null",
")",
"{",
"// if active lang is not passed in, use current active",
"if",
"(",
"!",
"$",
"lang",
")",
"{",
"$",
"lang",
"=",
"$",
"this",
"->",
"getLanguage",
"(",
")",
";",
"}",
... | Test to see if language is default and language should be included in the URL
@param string|null $lang
@return bool | [
"Test",
"to",
"see",
"if",
"language",
"is",
"default",
"and",
"language",
"should",
"be",
"included",
"in",
"the",
"URL"
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Language/Language.php#L258-L266 | train | Returns true if language is not default language | [
30522,
2270,
3853,
2003,
2378,
20464,
13936,
12879,
23505,
25023,
6692,
3351,
1006,
1002,
11374,
1027,
19701,
1007,
1063,
1013,
1013,
2065,
3161,
11374,
2003,
2025,
2979,
1999,
1010,
2224,
2783,
3161,
2065,
1006,
999,
1002,
11374,
1007,
106... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Profiler/Profiler.php | Profiler.saveProfile | public function saveProfile(Profile $profile)
{
// late collect
foreach ($profile->getCollectors() as $collector) {
if ($collector instanceof LateDataCollectorInterface) {
$collector->lateCollect();
}
}
if (!($ret = $this->storage->write($profile)) && null !== $this->logger) {
$this->logger->warning('Unable to store the profiler information.', ['configured_storage' => \get_class($this->storage)]);
}
return $ret;
} | php | public function saveProfile(Profile $profile)
{
// late collect
foreach ($profile->getCollectors() as $collector) {
if ($collector instanceof LateDataCollectorInterface) {
$collector->lateCollect();
}
}
if (!($ret = $this->storage->write($profile)) && null !== $this->logger) {
$this->logger->warning('Unable to store the profiler information.', ['configured_storage' => \get_class($this->storage)]);
}
return $ret;
} | [
"public",
"function",
"saveProfile",
"(",
"Profile",
"$",
"profile",
")",
"{",
"// late collect",
"foreach",
"(",
"$",
"profile",
"->",
"getCollectors",
"(",
")",
"as",
"$",
"collector",
")",
"{",
"if",
"(",
"$",
"collector",
"instanceof",
"LateDataCollectorIn... | Saves a Profile.
@return bool | [
"Saves",
"a",
"Profile",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/Profiler/Profiler.php#L94-L108 | train | Saves the profile information to the storage | [
30522,
2270,
3853,
3828,
21572,
8873,
2571,
1006,
6337,
1002,
6337,
1007,
1063,
1013,
1013,
2397,
8145,
18921,
6776,
1006,
1002,
6337,
1011,
1028,
2131,
26895,
22471,
5668,
1006,
1007,
2004,
1002,
10018,
1007,
1063,
2065,
1006,
1002,
10018,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Auth/SessionGuard.php | SessionGuard.logoutOtherDevices | public function logoutOtherDevices($password, $attribute = 'password')
{
if (! $this->user()) {
return;
}
$result = tap($this->user()->forceFill([
$attribute => Hash::make($password),
]))->save();
if ($this->recaller() ||
$this->getCookieJar()->hasQueued($this->getRecallerName())) {
$this->queueRecallerCookie($this->user());
}
$this->fireOtherDeviceLogoutEvent($this->user());
return $result;
} | php | public function logoutOtherDevices($password, $attribute = 'password')
{
if (! $this->user()) {
return;
}
$result = tap($this->user()->forceFill([
$attribute => Hash::make($password),
]))->save();
if ($this->recaller() ||
$this->getCookieJar()->hasQueued($this->getRecallerName())) {
$this->queueRecallerCookie($this->user());
}
$this->fireOtherDeviceLogoutEvent($this->user());
return $result;
} | [
"public",
"function",
"logoutOtherDevices",
"(",
"$",
"password",
",",
"$",
"attribute",
"=",
"'password'",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"user",
"(",
")",
")",
"{",
"return",
";",
"}",
"$",
"result",
"=",
"tap",
"(",
"$",
"this",
"-... | Invalidate other sessions for the current user.
The application must be using the AuthenticateSession middleware.
@param string $password
@param string $attribute
@return bool|null | [
"Invalidate",
"other",
"sessions",
"for",
"the",
"current",
"user",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Auth/SessionGuard.php#L543-L561 | train | Logout all other devices | [
30522,
2270,
3853,
8154,
16161,
12399,
24844,
23522,
1006,
1002,
20786,
1010,
1002,
17961,
1027,
1005,
20786,
1005,
1007,
1063,
2065,
1006,
999,
1002,
2023,
1011,
1028,
5310,
1006,
1007,
1007,
1063,
2709,
1025,
1065,
1002,
2765,
1027,
11112... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.php | DataTable.filterSubtables | public function filterSubtables($className, $parameters = array())
{
foreach ($this->getRowsWithoutSummaryRow() as $row) {
$subtable = $row->getSubtable();
if ($subtable) {
$subtable->filter($className, $parameters);
$subtable->filterSubtables($className, $parameters);
}
}
} | php | public function filterSubtables($className, $parameters = array())
{
foreach ($this->getRowsWithoutSummaryRow() as $row) {
$subtable = $row->getSubtable();
if ($subtable) {
$subtable->filter($className, $parameters);
$subtable->filterSubtables($className, $parameters);
}
}
} | [
"public",
"function",
"filterSubtables",
"(",
"$",
"className",
",",
"$",
"parameters",
"=",
"array",
"(",
")",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"getRowsWithoutSummaryRow",
"(",
")",
"as",
"$",
"row",
")",
"{",
"$",
"subtable",
"=",
"$",
"r... | Applies a filter to all subtables but not to this datatable.
@param string|Closure $className Class name, eg. `"Sort"` or "Piwik\DataTable\Filters\Sort"`. If no
namespace is supplied, `Piwik\DataTable\BaseFilter` is assumed. This parameter
can also be a closure that takes a DataTable as its first parameter.
@param array $parameters Array of extra parameters to pass to the filter. | [
"Applies",
"a",
"filter",
"to",
"all",
"subtables",
"but",
"not",
"to",
"this",
"datatable",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/DataTable.php#L530-L539 | train | Filter all subtables of this table and all subtables of this table | [
30522,
2270,
3853,
17736,
12083,
10880,
2015,
1006,
1002,
2465,
18442,
1010,
1002,
11709,
1027,
9140,
1006,
1007,
1007,
1063,
18921,
6776,
1006,
1002,
2023,
1011,
1028,
2131,
10524,
26760,
8939,
12166,
2819,
7849,
12541,
5004,
1006,
1007,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Bridge/Twig/AppVariable.php | AppVariable.getFlashes | public function getFlashes($types = null)
{
try {
$session = $this->getSession();
if (null === $session) {
return [];
}
} catch (\RuntimeException $e) {
return [];
}
if (null === $types || '' === $types || [] === $types) {
return $session->getFlashBag()->all();
}
if (\is_string($types)) {
return $session->getFlashBag()->get($types);
}
$result = [];
foreach ($types as $type) {
$result[$type] = $session->getFlashBag()->get($type);
}
return $result;
} | php | public function getFlashes($types = null)
{
try {
$session = $this->getSession();
if (null === $session) {
return [];
}
} catch (\RuntimeException $e) {
return [];
}
if (null === $types || '' === $types || [] === $types) {
return $session->getFlashBag()->all();
}
if (\is_string($types)) {
return $session->getFlashBag()->get($types);
}
$result = [];
foreach ($types as $type) {
$result[$type] = $session->getFlashBag()->get($type);
}
return $result;
} | [
"public",
"function",
"getFlashes",
"(",
"$",
"types",
"=",
"null",
")",
"{",
"try",
"{",
"$",
"session",
"=",
"$",
"this",
"->",
"getSession",
"(",
")",
";",
"if",
"(",
"null",
"===",
"$",
"session",
")",
"{",
"return",
"[",
"]",
";",
"}",
"}",
... | Returns some or all the existing flash messages:
* getFlashes() returns all the flash messages
* getFlashes('notice') returns a simple array with flash messages of that type
* getFlashes(['notice', 'error']) returns a nested array of type => messages.
@return array | [
"Returns",
"some",
"or",
"all",
"the",
"existing",
"flash",
"messages",
":",
"*",
"getFlashes",
"()",
"returns",
"all",
"the",
"flash",
"messages",
"*",
"getFlashes",
"(",
"notice",
")",
"returns",
"a",
"simple",
"array",
"with",
"flash",
"messages",
"of",
... | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bridge/Twig/AppVariable.php#L157-L182 | train | Get Flashes. | [
30522,
2270,
3853,
2131,
10258,
11823,
2229,
1006,
1002,
4127,
1027,
19701,
1007,
1063,
3046,
1063,
1002,
5219,
1027,
1002,
2023,
1011,
1028,
4152,
7971,
3258,
1006,
1007,
1025,
2065,
1006,
19701,
1027,
1027,
1027,
1002,
5219,
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... |
matomo-org/matomo | plugins/CoreAdminHome/OptOutManager.php | OptOutManager.addStylesheet | public function addStylesheet($stylesheet, $inline = true)
{
$type = $inline ? 'inline' : 'external';
$this->stylesheets[$type][] = $stylesheet;
} | php | public function addStylesheet($stylesheet, $inline = true)
{
$type = $inline ? 'inline' : 'external';
$this->stylesheets[$type][] = $stylesheet;
} | [
"public",
"function",
"addStylesheet",
"(",
"$",
"stylesheet",
",",
"$",
"inline",
"=",
"true",
")",
"{",
"$",
"type",
"=",
"$",
"inline",
"?",
"'inline'",
":",
"'external'",
";",
"$",
"this",
"->",
"stylesheets",
"[",
"$",
"type",
"]",
"[",
"]",
"="... | Add a stylesheet file|code into the OptOut View
Note: This method will not escape the inline css code!
@param string $stylesheet Escaped stylesheet
@param bool $inline | [
"Add",
"a",
"stylesheet",
"file|code",
"into",
"the",
"OptOut",
"View",
"Note",
":",
"This",
"method",
"will",
"not",
"escape",
"the",
"inline",
"css",
"code!"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/CoreAdminHome/OptOutManager.php#L86-L90 | train | Adds a stylesheet to the page | [
30522,
2270,
3853,
9909,
27983,
4095,
15558,
1006,
1002,
6782,
21030,
2102,
1010,
1002,
23881,
1027,
2995,
1007,
1063,
1002,
2828,
1027,
1002,
23881,
1029,
1005,
23881,
1005,
1024,
1005,
6327,
1005,
1025,
1002,
2023,
1011,
1028,
6782,
21030... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/CustomVariables/API.php | API.getUsagesOfSlots | public function getUsagesOfSlots($idSite)
{
Piwik::checkUserHasAdminAccess($idSite);
$numVars = CustomVariables::getNumUsableCustomVariables();
$usedCustomVariables = array(
'visit' => array_fill(1, $numVars, array()),
'page' => array_fill(1, $numVars, array()),
);
/** @var DataTable $customVarUsages */
$today = StaticContainer::get('CustomVariables.today');
$date = '2008-12-12,' . $today;
$customVarUsages = Request::processRequest('CustomVariables.getCustomVariables',
array('idSite' => $idSite, 'period' => 'range', 'date' => $date,
'format' => 'original')
);
foreach ($customVarUsages->getRows() as $row) {
$slots = $row->getMetadata('slots');
if (!empty($slots)) {
foreach ($slots as $slot) {
$usedCustomVariables[$slot['scope']][$slot['index']][] = array(
'name' => $row->getColumn('label'),
'nb_visits' => $row->getColumn('nb_visits'),
'nb_actions' => $row->getColumn('nb_actions'),
);
}
}
}
$grouped = array();
foreach ($usedCustomVariables as $scope => $scopes) {
foreach ($scopes as $index => $cvars) {
$grouped[] = array(
'scope' => $scope,
'index' => $index,
'usages' => $cvars
);
}
}
return $grouped;
} | php | public function getUsagesOfSlots($idSite)
{
Piwik::checkUserHasAdminAccess($idSite);
$numVars = CustomVariables::getNumUsableCustomVariables();
$usedCustomVariables = array(
'visit' => array_fill(1, $numVars, array()),
'page' => array_fill(1, $numVars, array()),
);
/** @var DataTable $customVarUsages */
$today = StaticContainer::get('CustomVariables.today');
$date = '2008-12-12,' . $today;
$customVarUsages = Request::processRequest('CustomVariables.getCustomVariables',
array('idSite' => $idSite, 'period' => 'range', 'date' => $date,
'format' => 'original')
);
foreach ($customVarUsages->getRows() as $row) {
$slots = $row->getMetadata('slots');
if (!empty($slots)) {
foreach ($slots as $slot) {
$usedCustomVariables[$slot['scope']][$slot['index']][] = array(
'name' => $row->getColumn('label'),
'nb_visits' => $row->getColumn('nb_visits'),
'nb_actions' => $row->getColumn('nb_actions'),
);
}
}
}
$grouped = array();
foreach ($usedCustomVariables as $scope => $scopes) {
foreach ($scopes as $index => $cvars) {
$grouped[] = array(
'scope' => $scope,
'index' => $index,
'usages' => $cvars
);
}
}
return $grouped;
} | [
"public",
"function",
"getUsagesOfSlots",
"(",
"$",
"idSite",
")",
"{",
"Piwik",
"::",
"checkUserHasAdminAccess",
"(",
"$",
"idSite",
")",
";",
"$",
"numVars",
"=",
"CustomVariables",
"::",
"getNumUsableCustomVariables",
"(",
")",
";",
"$",
"usedCustomVariables",
... | Get a list of all available custom variable slots (scope + index) and which names have been used so far in
each slot since the beginning of the website.
@param int $idSite
@return array | [
"Get",
"a",
"list",
"of",
"all",
"available",
"custom",
"variable",
"slots",
"(",
"scope",
"+",
"index",
")",
"and",
"which",
"names",
"have",
"been",
"used",
"so",
"far",
"in",
"each",
"slot",
"since",
"the",
"beginning",
"of",
"the",
"website",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/CustomVariables/API.php#L133-L178 | train | Returns all usages of slots | [
30522,
2270,
3853,
2131,
10383,
8449,
11253,
14540,
12868,
1006,
1002,
8909,
28032,
2063,
1007,
1063,
14255,
9148,
2243,
1024,
1024,
4638,
20330,
14949,
4215,
22311,
9468,
7971,
1006,
1002,
8909,
28032,
2063,
1007,
1025,
1002,
16371,
2213,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Routing/Loader/XmlFileLoader.php | XmlFileLoader.parseRoute | protected function parseRoute(RouteCollection $collection, \DOMElement $node, $path)
{
if ('' === $id = $node->getAttribute('id')) {
throw new \InvalidArgumentException(sprintf('The <route> element in file "%s" must have an "id" attribute.', $path));
}
$schemes = preg_split('/[\s,\|]++/', $node->getAttribute('schemes'), -1, PREG_SPLIT_NO_EMPTY);
$methods = preg_split('/[\s,\|]++/', $node->getAttribute('methods'), -1, PREG_SPLIT_NO_EMPTY);
list($defaults, $requirements, $options, $condition, $paths) = $this->parseConfigs($node, $path);
if (!$paths && '' === $node->getAttribute('path')) {
throw new \InvalidArgumentException(sprintf('The <route> element in file "%s" must have a "path" attribute or <path> child nodes.', $path));
}
if ($paths && '' !== $node->getAttribute('path')) {
throw new \InvalidArgumentException(sprintf('The <route> element in file "%s" must not have both a "path" attribute and <path> child nodes.', $path));
}
if (!$paths) {
$route = new Route($node->getAttribute('path'), $defaults, $requirements, $options, $node->getAttribute('host'), $schemes, $methods, $condition);
$collection->add($id, $route);
} else {
foreach ($paths as $locale => $p) {
$defaults['_locale'] = $locale;
$defaults['_canonical_route'] = $id;
$route = new Route($p, $defaults, $requirements, $options, $node->getAttribute('host'), $schemes, $methods, $condition);
$collection->add($id.'.'.$locale, $route);
}
}
} | php | protected function parseRoute(RouteCollection $collection, \DOMElement $node, $path)
{
if ('' === $id = $node->getAttribute('id')) {
throw new \InvalidArgumentException(sprintf('The <route> element in file "%s" must have an "id" attribute.', $path));
}
$schemes = preg_split('/[\s,\|]++/', $node->getAttribute('schemes'), -1, PREG_SPLIT_NO_EMPTY);
$methods = preg_split('/[\s,\|]++/', $node->getAttribute('methods'), -1, PREG_SPLIT_NO_EMPTY);
list($defaults, $requirements, $options, $condition, $paths) = $this->parseConfigs($node, $path);
if (!$paths && '' === $node->getAttribute('path')) {
throw new \InvalidArgumentException(sprintf('The <route> element in file "%s" must have a "path" attribute or <path> child nodes.', $path));
}
if ($paths && '' !== $node->getAttribute('path')) {
throw new \InvalidArgumentException(sprintf('The <route> element in file "%s" must not have both a "path" attribute and <path> child nodes.', $path));
}
if (!$paths) {
$route = new Route($node->getAttribute('path'), $defaults, $requirements, $options, $node->getAttribute('host'), $schemes, $methods, $condition);
$collection->add($id, $route);
} else {
foreach ($paths as $locale => $p) {
$defaults['_locale'] = $locale;
$defaults['_canonical_route'] = $id;
$route = new Route($p, $defaults, $requirements, $options, $node->getAttribute('host'), $schemes, $methods, $condition);
$collection->add($id.'.'.$locale, $route);
}
}
} | [
"protected",
"function",
"parseRoute",
"(",
"RouteCollection",
"$",
"collection",
",",
"\\",
"DOMElement",
"$",
"node",
",",
"$",
"path",
")",
"{",
"if",
"(",
"''",
"===",
"$",
"id",
"=",
"$",
"node",
"->",
"getAttribute",
"(",
"'id'",
")",
")",
"{",
... | Parses a route and adds it to the RouteCollection.
@param RouteCollection $collection RouteCollection instance
@param \DOMElement $node Element to parse that represents a Route
@param string $path Full path of the XML file being processed
@throws \InvalidArgumentException When the XML is invalid | [
"Parses",
"a",
"route",
"and",
"adds",
"it",
"to",
"the",
"RouteCollection",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Routing/Loader/XmlFileLoader.php#L108-L138 | train | Parse Route Collection | [
30522,
5123,
3853,
11968,
8043,
5833,
2063,
1006,
2799,
26895,
18491,
1002,
3074,
1010,
1032,
8514,
16930,
4765,
1002,
13045,
1010,
1002,
4130,
1007,
1063,
2065,
1006,
1005,
1005,
1027,
1027,
1027,
1002,
8909,
1027,
1002,
13045,
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/API.php | API.getEntryPageTitles | public function getEntryPageTitles($idSite, $period, $date, $segment = false, $expanded = false,
$idSubtable = false, $flat = false)
{
Piwik::checkUserHasViewAccess($idSite);
$dataTable = $this->getPageTitles($idSite, $period, $date, $segment, $expanded, $idSubtable, $flat);
$this->filterNonEntryActions($dataTable);
return $dataTable;
} | php | public function getEntryPageTitles($idSite, $period, $date, $segment = false, $expanded = false,
$idSubtable = false, $flat = false)
{
Piwik::checkUserHasViewAccess($idSite);
$dataTable = $this->getPageTitles($idSite, $period, $date, $segment, $expanded, $idSubtable, $flat);
$this->filterNonEntryActions($dataTable);
return $dataTable;
} | [
"public",
"function",
"getEntryPageTitles",
"(",
"$",
"idSite",
",",
"$",
"period",
",",
"$",
"date",
",",
"$",
"segment",
"=",
"false",
",",
"$",
"expanded",
"=",
"false",
",",
"$",
"idSubtable",
"=",
"false",
",",
"$",
"flat",
"=",
"false",
")",
"{... | Returns a DataTable with analytics information for every unique entry page title
for the given site, time period & segment. | [
"Returns",
"a",
"DataTable",
"with",
"analytics",
"information",
"for",
"every",
"unique",
"entry",
"page",
"title",
"for",
"the",
"given",
"site",
"time",
"period",
"&",
"segment",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Actions/API.php#L218-L226 | train | Returns an array of page titles for the specified site period date segment and subtable. | [
30522,
2270,
3853,
2131,
4765,
2854,
13704,
27430,
1006,
1002,
8909,
28032,
2063,
1010,
1002,
2558,
1010,
1002,
3058,
1010,
1002,
6903,
1027,
6270,
1010,
1002,
4423,
1027,
6270,
1010,
1002,
8909,
6342,
19279,
3085,
1027,
6270,
1010,
1002,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Routing/Router.php | Router.runRouteWithinStack | protected function runRouteWithinStack(Route $route, Request $request)
{
$shouldSkipMiddleware = $this->container->bound('middleware.disable') &&
$this->container->make('middleware.disable') === true;
$middleware = $shouldSkipMiddleware ? [] : $this->gatherRouteMiddleware($route);
return (new Pipeline($this->container))
->send($request)
->through($middleware)
->then(function ($request) use ($route) {
return $this->prepareResponse(
$request, $route->run()
);
});
} | php | protected function runRouteWithinStack(Route $route, Request $request)
{
$shouldSkipMiddleware = $this->container->bound('middleware.disable') &&
$this->container->make('middleware.disable') === true;
$middleware = $shouldSkipMiddleware ? [] : $this->gatherRouteMiddleware($route);
return (new Pipeline($this->container))
->send($request)
->through($middleware)
->then(function ($request) use ($route) {
return $this->prepareResponse(
$request, $route->run()
);
});
} | [
"protected",
"function",
"runRouteWithinStack",
"(",
"Route",
"$",
"route",
",",
"Request",
"$",
"request",
")",
"{",
"$",
"shouldSkipMiddleware",
"=",
"$",
"this",
"->",
"container",
"->",
"bound",
"(",
"'middleware.disable'",
")",
"&&",
"$",
"this",
"->",
... | Run the given route within a Stack "onion" instance.
@param \Illuminate\Routing\Route $route
@param \Illuminate\Http\Request $request
@return mixed | [
"Run",
"the",
"given",
"route",
"within",
"a",
"Stack",
"onion",
"instance",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Routing/Router.php#L668-L683 | train | Run the route within the stack | [
30522,
5123,
3853,
2448,
22494,
2618,
24415,
7076,
2696,
30524,
1028,
11661,
1011,
1028,
5391,
1006,
1005,
2690,
8059,
1012,
4487,
19150,
1005,
1007,
1004,
1004,
1002,
2023,
1011,
1028,
11661,
1011,
1028,
2191,
1006,
1005,
2690,
8059,
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... |
getgrav/grav | system/src/Grav/Common/Twig/Node/TwigNodeThrow.php | TwigNodeThrow.compile | public function compile(Compiler $compiler)
{
$compiler->addDebugInfo($this);
$compiler
->write('throw new \RuntimeException(')
->subcompile($this->getNode('message'))
->write(', ')
->write($this->getAttribute('code') ?: 500)
->write(");\n");
} | php | public function compile(Compiler $compiler)
{
$compiler->addDebugInfo($this);
$compiler
->write('throw new \RuntimeException(')
->subcompile($this->getNode('message'))
->write(', ')
->write($this->getAttribute('code') ?: 500)
->write(");\n");
} | [
"public",
"function",
"compile",
"(",
"Compiler",
"$",
"compiler",
")",
"{",
"$",
"compiler",
"->",
"addDebugInfo",
"(",
"$",
"this",
")",
";",
"$",
"compiler",
"->",
"write",
"(",
"'throw new \\RuntimeException('",
")",
"->",
"subcompile",
"(",
"$",
"this",... | Compiles the node to PHP.
@param Compiler $compiler A Twig_Compiler instance
@throws \LogicException | [
"Compiles",
"the",
"node",
"to",
"PHP",
"."
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Twig/Node/TwigNodeThrow.php#L40-L50 | train | Compiles the exception into PHP code | [
30522,
2270,
3853,
4012,
22090,
1006,
21624,
1002,
21624,
1007,
1063,
1002,
21624,
1011,
1028,
5587,
3207,
8569,
11528,
14876,
1006,
1002,
2023,
1007,
1025,
1002,
21624,
30524,
1006,
1005,
4471,
1005,
1007,
1007,
1011,
1028,
4339,
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... |
z-song/laravel-admin | src/Show/Tools.php | Tools.renderDelete | protected function renderDelete()
{
$trans = [
'delete_confirm' => trans('admin.delete_confirm'),
'confirm' => trans('admin.confirm'),
'cancel' => trans('admin.cancel'),
'delete' => trans('admin.delete'),
];
$class = uniqid();
$script = <<<SCRIPT
$('.{$class}-delete').unbind('click').click(function() {
swal({
title: "{$trans['delete_confirm']}",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "{$trans['confirm']}",
showLoaderOnConfirm: true,
cancelButtonText: "{$trans['cancel']}",
preConfirm: function() {
return new Promise(function(resolve) {
$.ajax({
method: 'post',
url: '{$this->getDeletePath()}',
data: {
_method:'delete',
_token:LA.token,
},
success: function (data) {
$.pjax({container:'#pjax-container', url: '{$this->getListPath()}' });
resolve(data);
}
});
});
}
}).then(function(result) {
var data = result.value;
if (typeof data === 'object') {
if (data.status) {
swal(data.message, '', 'success');
} else {
swal(data.message, '', 'error');
}
}
});
});
SCRIPT;
Admin::script($script);
return <<<HTML
<div class="btn-group pull-right" style="margin-right: 5px">
<a href="javascript:void(0);" class="btn btn-sm btn-danger {$class}-delete" title="{$trans['delete']}">
<i class="fa fa-trash"></i><span class="hidden-xs"> {$trans['delete']}</span>
</a>
</div>
HTML;
} | php | protected function renderDelete()
{
$trans = [
'delete_confirm' => trans('admin.delete_confirm'),
'confirm' => trans('admin.confirm'),
'cancel' => trans('admin.cancel'),
'delete' => trans('admin.delete'),
];
$class = uniqid();
$script = <<<SCRIPT
$('.{$class}-delete').unbind('click').click(function() {
swal({
title: "{$trans['delete_confirm']}",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "{$trans['confirm']}",
showLoaderOnConfirm: true,
cancelButtonText: "{$trans['cancel']}",
preConfirm: function() {
return new Promise(function(resolve) {
$.ajax({
method: 'post',
url: '{$this->getDeletePath()}',
data: {
_method:'delete',
_token:LA.token,
},
success: function (data) {
$.pjax({container:'#pjax-container', url: '{$this->getListPath()}' });
resolve(data);
}
});
});
}
}).then(function(result) {
var data = result.value;
if (typeof data === 'object') {
if (data.status) {
swal(data.message, '', 'success');
} else {
swal(data.message, '', 'error');
}
}
});
});
SCRIPT;
Admin::script($script);
return <<<HTML
<div class="btn-group pull-right" style="margin-right: 5px">
<a href="javascript:void(0);" class="btn btn-sm btn-danger {$class}-delete" title="{$trans['delete']}">
<i class="fa fa-trash"></i><span class="hidden-xs"> {$trans['delete']}</span>
</a>
</div>
HTML;
} | [
"protected",
"function",
"renderDelete",
"(",
")",
"{",
"$",
"trans",
"=",
"[",
"'delete_confirm'",
"=>",
"trans",
"(",
"'admin.delete_confirm'",
")",
",",
"'confirm'",
"=>",
"trans",
"(",
"'admin.confirm'",
")",
",",
"'cancel'",
"=>",
"trans",
"(",
"'admin.ca... | Render `delete` tool.
@return string | [
"Render",
"delete",
"tool",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Show/Tools.php#L223-L285 | train | Renders the delete action | [
30522,
5123,
3853,
17552,
9247,
12870,
1006,
1007,
1063,
1002,
9099,
1027,
1031,
1005,
3972,
12870,
1035,
12210,
1005,
1027,
1028,
9099,
1006,
1005,
4748,
10020,
1012,
3972,
12870,
1035,
12210,
1005,
1007,
1010,
1005,
12210,
1005,
1027,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/system/models/MailBrandSetting.php | MailBrandSetting.initSettingsData | public function initSettingsData()
{
$config = App::make('config');
$vars = static::getCssVars();
foreach ($vars as $var => $default) {
$this->{$var} = $config->get('brand.mail.'.Str::studly($var), $default);
}
} | php | public function initSettingsData()
{
$config = App::make('config');
$vars = static::getCssVars();
foreach ($vars as $var => $default) {
$this->{$var} = $config->get('brand.mail.'.Str::studly($var), $default);
}
} | [
"public",
"function",
"initSettingsData",
"(",
")",
"{",
"$",
"config",
"=",
"App",
"::",
"make",
"(",
"'config'",
")",
";",
"$",
"vars",
"=",
"static",
"::",
"getCssVars",
"(",
")",
";",
"foreach",
"(",
"$",
"vars",
"as",
"$",
"var",
"=>",
"$",
"d... | Initialize the seed data for this model. This only executes when the
model is first created or reset to default.
@return void | [
"Initialize",
"the",
"seed",
"data",
"for",
"this",
"model",
".",
"This",
"only",
"executes",
"when",
"the",
"model",
"is",
"first",
"created",
"or",
"reset",
"to",
"default",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/models/MailBrandSetting.php#L68-L77 | train | Initialize the settings data | [
30522,
2270,
3853,
1999,
12762,
18319,
3070,
16150,
6790,
1006,
1007,
1063,
1002,
9530,
8873,
2290,
1027,
10439,
1024,
1024,
2191,
1006,
1005,
9530,
8873,
2290,
1005,
1007,
1025,
1002,
13075,
2015,
1027,
10763,
1024,
1024,
2131,
6169,
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... |
laravel/framework | src/Illuminate/Session/Store.php | Store.migrate | public function migrate($destroy = false)
{
if ($destroy) {
$this->handler->destroy($this->getId());
}
$this->setExists(false);
$this->setId($this->generateSessionId());
return true;
} | php | public function migrate($destroy = false)
{
if ($destroy) {
$this->handler->destroy($this->getId());
}
$this->setExists(false);
$this->setId($this->generateSessionId());
return true;
} | [
"public",
"function",
"migrate",
"(",
"$",
"destroy",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"destroy",
")",
"{",
"$",
"this",
"->",
"handler",
"->",
"destroy",
"(",
"$",
"this",
"->",
"getId",
"(",
")",
")",
";",
"}",
"$",
"this",
"->",
"setExi... | Generate a new session ID for the session.
@param bool $destroy
@return bool | [
"Generate",
"a",
"new",
"session",
"ID",
"for",
"the",
"session",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Session/Store.php#L489-L500 | train | Migrate the current session to the new session | [
30522,
2270,
3853,
22806,
1006,
1002,
6033,
1027,
6270,
1007,
1063,
2065,
1006,
1002,
6033,
1007,
1063,
1002,
2023,
1011,
1028,
28213,
1011,
1028,
6033,
1006,
1002,
2023,
1011,
1028,
2131,
3593,
1006,
1007,
1007,
1025,
1065,
1002,
2023,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php | HasAttributes.getCastType | protected function getCastType($key)
{
if ($this->isCustomDateTimeCast($this->getCasts()[$key])) {
return 'custom_datetime';
}
if ($this->isDecimalCast($this->getCasts()[$key])) {
return 'decimal';
}
return trim(strtolower($this->getCasts()[$key]));
} | php | protected function getCastType($key)
{
if ($this->isCustomDateTimeCast($this->getCasts()[$key])) {
return 'custom_datetime';
}
if ($this->isDecimalCast($this->getCasts()[$key])) {
return 'decimal';
}
return trim(strtolower($this->getCasts()[$key]));
} | [
"protected",
"function",
"getCastType",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isCustomDateTimeCast",
"(",
"$",
"this",
"->",
"getCasts",
"(",
")",
"[",
"$",
"key",
"]",
")",
")",
"{",
"return",
"'custom_datetime'",
";",
"}",
"if",
... | Get the type of cast for a model attribute.
@param string $key
@return string | [
"Get",
"the",
"type",
"of",
"cast",
"for",
"a",
"model",
"attribute",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php#L516-L527 | train | Get the cast type | [
30522,
5123,
3853,
2131,
10526,
13874,
1006,
1002,
3145,
1007,
1063,
2065,
1006,
1002,
2023,
1011,
1028,
2003,
7874,
20389,
13701,
7292,
10526,
1006,
1002,
2023,
1011,
1028,
2131,
10526,
2015,
1006,
1007,
1031,
1002,
3145,
1033,
1007,
1007,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Http/ResponseTrait.php | ResponseTrait.withHeaders | public function withHeaders($headers)
{
if ($headers instanceof HeaderBag) {
$headers = $headers->all();
}
foreach ($headers as $key => $value) {
$this->headers->set($key, $value);
}
return $this;
} | php | public function withHeaders($headers)
{
if ($headers instanceof HeaderBag) {
$headers = $headers->all();
}
foreach ($headers as $key => $value) {
$this->headers->set($key, $value);
}
return $this;
} | [
"public",
"function",
"withHeaders",
"(",
"$",
"headers",
")",
"{",
"if",
"(",
"$",
"headers",
"instanceof",
"HeaderBag",
")",
"{",
"$",
"headers",
"=",
"$",
"headers",
"->",
"all",
"(",
")",
";",
"}",
"foreach",
"(",
"$",
"headers",
"as",
"$",
"key"... | Add an array of headers to the response.
@param \Symfony\Component\HttpFoundation\HeaderBag|array $headers
@return $this | [
"Add",
"an",
"array",
"of",
"headers",
"to",
"the",
"response",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Http/ResponseTrait.php#L78-L89 | train | Set Headers to the HeaderBag | [
30522,
2270,
3853,
2007,
4974,
2545,
1006,
1002,
20346,
2015,
1007,
1063,
2065,
1006,
1002,
20346,
2015,
6013,
11253,
20346,
16078,
1007,
1063,
1002,
20346,
2015,
1027,
1002,
20346,
2015,
1011,
1028,
2035,
1006,
1007,
1025,
1065,
18921,
677... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Intl/Data/Util/RingBuffer.php | RingBuffer.offsetUnset | public function offsetUnset($key)
{
if (isset($this->indices[$key])) {
$this->values[$this->indices[$key]] = null;
unset($this->indices[$key]);
}
} | php | public function offsetUnset($key)
{
if (isset($this->indices[$key])) {
$this->values[$this->indices[$key]] = null;
unset($this->indices[$key]);
}
} | [
"public",
"function",
"offsetUnset",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"indices",
"[",
"$",
"key",
"]",
")",
")",
"{",
"$",
"this",
"->",
"values",
"[",
"$",
"this",
"->",
"indices",
"[",
"$",
"key",
"]",
"]... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Intl/Data/Util/RingBuffer.php#L80-L86 | train | Unsets an index | [
30522,
2270,
3853,
16396,
4609,
13462,
1006,
1002,
3145,
1007,
1063,
2065,
1006,
26354,
3388,
1006,
1002,
2023,
1011,
1028,
29299,
1031,
1002,
3145,
1033,
1007,
1007,
1063,
1002,
2023,
1011,
1028,
5300,
1031,
1002,
2023,
1011,
1028,
29299,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.