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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
getgrav/grav | system/src/Grav/Common/Uri.php | Uri.cleanPath | public static function cleanPath($path)
{
$regex = '/(\/)\/+/';
$path = str_replace(['\\', '/ /'], '/', $path);
$path = preg_replace($regex,'$1',$path);
return $path;
} | php | public static function cleanPath($path)
{
$regex = '/(\/)\/+/';
$path = str_replace(['\\', '/ /'], '/', $path);
$path = preg_replace($regex,'$1',$path);
return $path;
} | [
"public",
"static",
"function",
"cleanPath",
"(",
"$",
"path",
")",
"{",
"$",
"regex",
"=",
"'/(\\/)\\/+/'",
";",
"$",
"path",
"=",
"str_replace",
"(",
"[",
"'\\\\'",
",",
"'/ /'",
"]",
",",
"'/'",
",",
"$",
"path",
")",
";",
"$",
"path",
"=",
"pre... | Removes extra double slashes and fixes back-slashes
@param string $path
@return mixed|string | [
"Removes",
"extra",
"double",
"slashes",
"and",
"fixes",
"back",
"-",
"slashes"
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Uri.php#L1097-L1104 | train | Clean path of the page | [
30522,
2270,
10763,
3853,
4550,
15069,
1006,
1002,
4130,
1007,
1063,
1002,
19723,
10288,
1027,
1005,
1013,
1006,
1032,
1013,
1007,
1032,
1013,
1009,
1013,
1005,
1025,
1002,
4130,
1027,
2358,
2099,
1035,
5672,
1006,
1031,
1005,
1032,
1032,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/API/API.php | API.getWidgetMetadata | public function getWidgetMetadata($idSite)
{
Piwik::checkUserHasViewAccess($idSite);
$widgetsList = WidgetsList::get();
$categoryList = CategoryList::get();
$metadata = new WidgetMetadata();
return $metadata->getWidgetMetadata($categoryList, $widgetsList);
} | php | public function getWidgetMetadata($idSite)
{
Piwik::checkUserHasViewAccess($idSite);
$widgetsList = WidgetsList::get();
$categoryList = CategoryList::get();
$metadata = new WidgetMetadata();
return $metadata->getWidgetMetadata($categoryList, $widgetsList);
} | [
"public",
"function",
"getWidgetMetadata",
"(",
"$",
"idSite",
")",
"{",
"Piwik",
"::",
"checkUserHasViewAccess",
"(",
"$",
"idSite",
")",
";",
"$",
"widgetsList",
"=",
"WidgetsList",
"::",
"get",
"(",
")",
";",
"$",
"categoryList",
"=",
"CategoryList",
"::"... | Get a list of all widgetizable widgets.
@param int $idSite
@return array | [
"Get",
"a",
"list",
"of",
"all",
"widgetizable",
"widgets",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/API/API.php#L378-L387 | train | Returns the widget metadata for the given site | [
30522,
2270,
3853,
2131,
9148,
24291,
11368,
8447,
2696,
1006,
1002,
8909,
28032,
2063,
1007,
1063,
14255,
9148,
2243,
1024,
1024,
4638,
20330,
14949,
8584,
6305,
9623,
2015,
1006,
1002,
8909,
28032,
2063,
1007,
1025,
1002,
15536,
28682,
98... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/UrlGenerator.php | UrlGenerator.removeIndex | protected function removeIndex($root)
{
$i = 'index.php';
return Str::contains($root, $i) ? str_replace('/'.$i, '', $root) : $root;
} | php | protected function removeIndex($root)
{
$i = 'index.php';
return Str::contains($root, $i) ? str_replace('/'.$i, '', $root) : $root;
} | [
"protected",
"function",
"removeIndex",
"(",
"$",
"root",
")",
"{",
"$",
"i",
"=",
"'index.php'",
";",
"return",
"Str",
"::",
"contains",
"(",
"$",
"root",
",",
"$",
"i",
")",
"?",
"str_replace",
"(",
"'/'",
".",
"$",
"i",
",",
"''",
",",
"$",
"r... | Remove the index.php file from a path.
@param string $root
@return string | [
"Remove",
"the",
"index",
".",
"php",
"file",
"from",
"a",
"path",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Routing/UrlGenerator.php#L283-L288 | train | Remove index. php from root | [
30522,
5123,
3853,
6366,
22254,
10288,
1006,
1002,
7117,
1007,
1063,
1002,
1045,
1027,
1005,
5950,
1012,
25718,
1005,
1025,
2709,
2358,
2099,
1024,
1024,
3397,
1006,
1002,
7117,
1010,
1002,
1045,
1007,
1029,
2358,
2099,
1035,
5672,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Support/MessageBag.php | MessageBag.transform | protected function transform($messages, $format, $messageKey)
{
return collect((array) $messages)
->map(function ($message) use ($format, $messageKey) {
// We will simply spin through the given messages and transform each one
// replacing the :message place holder with the real message allowing
// the messages to be easily formatted to each developer's desires.
return str_replace([':message', ':key'], [$message, $messageKey], $format);
})->all();
} | php | protected function transform($messages, $format, $messageKey)
{
return collect((array) $messages)
->map(function ($message) use ($format, $messageKey) {
// We will simply spin through the given messages and transform each one
// replacing the :message place holder with the real message allowing
// the messages to be easily formatted to each developer's desires.
return str_replace([':message', ':key'], [$message, $messageKey], $format);
})->all();
} | [
"protected",
"function",
"transform",
"(",
"$",
"messages",
",",
"$",
"format",
",",
"$",
"messageKey",
")",
"{",
"return",
"collect",
"(",
"(",
"array",
")",
"$",
"messages",
")",
"->",
"map",
"(",
"function",
"(",
"$",
"message",
")",
"use",
"(",
"... | Format an array of messages.
@param array $messages
@param string $format
@param string $messageKey
@return array | [
"Format",
"an",
"array",
"of",
"messages",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Support/MessageBag.php#L249-L258 | train | Transform the given messages into a string | [
30522,
5123,
3853,
10938,
1006,
1002,
7696,
1010,
1002,
4289,
1010,
1002,
4471,
14839,
1007,
1063,
2709,
8145,
1006,
1006,
9140,
1007,
1002,
7696,
1007,
1011,
1028,
4949,
1006,
3853,
1006,
1002,
4471,
1007,
2224,
1006,
1002,
4289,
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/Queue/Jobs/Job.php | Job.fail | public function fail($e = null)
{
$this->markAsFailed();
if ($this->isDeleted()) {
return;
}
try {
// If the job has failed, we will delete it, call the "failed" method and then call
// an event indicating the job has failed so it can be logged if needed. This is
// to allow every developer to better keep monitor of their failed queue jobs.
$this->delete();
$this->failed($e);
} finally {
$this->resolve(Dispatcher::class)->dispatch(new JobFailed(
$this->connectionName, $this, $e ?: new ManuallyFailedException
));
}
} | php | public function fail($e = null)
{
$this->markAsFailed();
if ($this->isDeleted()) {
return;
}
try {
// If the job has failed, we will delete it, call the "failed" method and then call
// an event indicating the job has failed so it can be logged if needed. This is
// to allow every developer to better keep monitor of their failed queue jobs.
$this->delete();
$this->failed($e);
} finally {
$this->resolve(Dispatcher::class)->dispatch(new JobFailed(
$this->connectionName, $this, $e ?: new ManuallyFailedException
));
}
} | [
"public",
"function",
"fail",
"(",
"$",
"e",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"markAsFailed",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"isDeleted",
"(",
")",
")",
"{",
"return",
";",
"}",
"try",
"{",
"// If the job has failed, we will dele... | Delete the job, call the "failed" method, and raise the failed job event.
@param \Throwable|null $e
@return void | [
"Delete",
"the",
"job",
"call",
"the",
"failed",
"method",
"and",
"raise",
"the",
"failed",
"job",
"event",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Queue/Jobs/Job.php#L166-L186 | train | Mark the job as failed | [
30522,
2270,
3853,
8246,
1006,
1002,
1041,
1027,
19701,
1007,
1063,
1002,
2023,
1011,
1028,
2928,
3022,
7011,
18450,
1006,
1007,
1025,
2065,
1006,
1002,
2023,
1011,
1028,
2003,
9247,
12870,
2094,
1006,
1007,
1007,
1063,
2709,
1025,
1065,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/Updater/Migration/Db/Factory.php | Factory.boundSql | public function boundSql($sql, $bind, $errorCodesToIgnore = array())
{
if ($errorCodesToIgnore === false) {
$errorCodesToIgnore = array();
}
return $this->container->make('Piwik\Updater\Migration\Db\BoundSql', array(
'sql' => $sql, 'errorCodesToIgnore' => $errorCodesToIgnore, 'bind' => $bind
));
} | php | public function boundSql($sql, $bind, $errorCodesToIgnore = array())
{
if ($errorCodesToIgnore === false) {
$errorCodesToIgnore = array();
}
return $this->container->make('Piwik\Updater\Migration\Db\BoundSql', array(
'sql' => $sql, 'errorCodesToIgnore' => $errorCodesToIgnore, 'bind' => $bind
));
} | [
"public",
"function",
"boundSql",
"(",
"$",
"sql",
",",
"$",
"bind",
",",
"$",
"errorCodesToIgnore",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"$",
"errorCodesToIgnore",
"===",
"false",
")",
"{",
"$",
"errorCodesToIgnore",
"=",
"array",
"(",
")",
";... | Performs a custom SQL query that uses bound parameters during the update.
You can replace values with a question mark and then pass the actual value via `$bind` for better security.
Example:
$factory->boundSql('DELETE * FROM table_name WHERE idsite = ?, array($idSite = 1));
@param string $sql The SQL query that should be executed. Make sure to prefix a table name via
{@link Piwik\Commin::prefixTable()}.
@param array $bind An array of values that need to be replaced with the question marks in the SQL query.
@param int|int[] $errorCodesToIgnore Any given MySQL server error code will be ignored. For a list of all
possible error codes have a look at {@link \Piwik\Updater\Migration\Db}.
If no error should be ignored use `false`.
@return BoundSql | [
"Performs",
"a",
"custom",
"SQL",
"query",
"that",
"uses",
"bound",
"parameters",
"during",
"the",
"update",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Updater/Migration/Db/Factory.php#L73-L82 | train | Returns a bound SQL statement. | [
30522,
2270,
3853,
19202,
4160,
2140,
1006,
1002,
29296,
1010,
1002,
14187,
1010,
1002,
7561,
23237,
3406,
23773,
5686,
1027,
9140,
1006,
1007,
1007,
1063,
2065,
1006,
1002,
7561,
23237,
3406,
23773,
5686,
1027,
1027,
1027,
6270,
1007,
1063... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Config/Definition/Builder/ValidationBuilder.php | ValidationBuilder.rule | public function rule(\Closure $closure = null)
{
if (null !== $closure) {
$this->rules[] = $closure;
return $this;
}
return $this->rules[] = new ExprBuilder($this->node);
} | php | public function rule(\Closure $closure = null)
{
if (null !== $closure) {
$this->rules[] = $closure;
return $this;
}
return $this->rules[] = new ExprBuilder($this->node);
} | [
"public",
"function",
"rule",
"(",
"\\",
"Closure",
"$",
"closure",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"closure",
")",
"{",
"$",
"this",
"->",
"rules",
"[",
"]",
"=",
"$",
"closure",
";",
"return",
"$",
"this",
";",
"}",
"retur... | Registers a closure to run as normalization or an expression builder to build it if null is provided.
@return ExprBuilder|$this | [
"Registers",
"a",
"closure",
"to",
"run",
"as",
"normalization",
"or",
"an",
"expression",
"builder",
"to",
"build",
"it",
"if",
"null",
"is",
"provided",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Config/Definition/Builder/ValidationBuilder.php#L34-L43 | train | Add a new rule to the list of rules | [
30522,
2270,
3853,
3627,
1006,
1032,
8503,
1002,
8503,
1027,
19701,
1007,
1063,
2065,
1006,
19701,
999,
1027,
1027,
1002,
8503,
1007,
1063,
1002,
2023,
1011,
1028,
3513,
1031,
1033,
1027,
1002,
8503,
1025,
2709,
1002,
2023,
1025,
1065,
27... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Database/Schema/Blueprint.php | Blueprint.char | public function char($column, $length = null)
{
$length = $length ?: Builder::$defaultStringLength;
return $this->addColumn('char', $column, compact('length'));
} | php | public function char($column, $length = null)
{
$length = $length ?: Builder::$defaultStringLength;
return $this->addColumn('char', $column, compact('length'));
} | [
"public",
"function",
"char",
"(",
"$",
"column",
",",
"$",
"length",
"=",
"null",
")",
"{",
"$",
"length",
"=",
"$",
"length",
"?",
":",
"Builder",
"::",
"$",
"defaultStringLength",
";",
"return",
"$",
"this",
"->",
"addColumn",
"(",
"'char'",
",",
... | Create a new char column on the table.
@param string $column
@param int $length
@return \Illuminate\Database\Schema\ColumnDefinition | [
"Create",
"a",
"new",
"char",
"column",
"on",
"the",
"table",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Schema/Blueprint.php#L603-L608 | train | Add column for char type | [
30522,
2270,
3853,
25869,
1006,
1002,
5930,
1010,
1002,
3091,
1027,
19701,
1007,
1063,
1002,
3091,
1027,
1002,
3091,
1029,
1024,
12508,
1024,
1024,
1002,
12398,
3367,
4892,
7770,
13512,
2232,
1025,
2709,
1002,
2023,
1011,
1028,
5587,
25778,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | Connection/TcpConnection.php | TcpConnection.getStatus | public function getStatus($raw_output = true)
{
if ($raw_output) {
return $this->_status;
}
return self::$_statusToString[$this->_status];
} | php | public function getStatus($raw_output = true)
{
if ($raw_output) {
return $this->_status;
}
return self::$_statusToString[$this->_status];
} | [
"public",
"function",
"getStatus",
"(",
"$",
"raw_output",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"raw_output",
")",
"{",
"return",
"$",
"this",
"->",
"_status",
";",
"}",
"return",
"self",
"::",
"$",
"_statusToString",
"[",
"$",
"this",
"->",
"_status... | Get status.
@param bool $raw_output
@return int | [
"Get",
"status",
"."
] | 13649907f05014fcfffcfccaef01e63ad3339351 | https://github.com/walkor/Workerman/blob/13649907f05014fcfffcfccaef01e63ad3339351/Connection/TcpConnection.php#L320-L326 | train | Get the status of the page | [
30522,
2270,
3853,
4152,
29336,
2271,
1006,
1002,
6315,
1035,
6434,
1027,
2995,
1007,
1063,
2065,
1006,
1002,
6315,
1035,
6434,
1007,
1063,
2709,
1002,
2023,
1011,
1028,
1035,
3570,
1025,
1065,
2709,
2969,
1024,
1024,
1002,
1035,
3570,
13... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Container/Container.php | Container.getContextualConcrete | protected function getContextualConcrete($abstract)
{
if (! is_null($binding = $this->findInContextualBindings($abstract))) {
return $binding;
}
// Next we need to see if a contextual binding might be bound under an alias of the
// given abstract type. So, we will need to check if any aliases exist with this
// type and then spin through them and check for contextual bindings on these.
if (empty($this->abstractAliases[$abstract])) {
return;
}
foreach ($this->abstractAliases[$abstract] as $alias) {
if (! is_null($binding = $this->findInContextualBindings($alias))) {
return $binding;
}
}
} | php | protected function getContextualConcrete($abstract)
{
if (! is_null($binding = $this->findInContextualBindings($abstract))) {
return $binding;
}
// Next we need to see if a contextual binding might be bound under an alias of the
// given abstract type. So, we will need to check if any aliases exist with this
// type and then spin through them and check for contextual bindings on these.
if (empty($this->abstractAliases[$abstract])) {
return;
}
foreach ($this->abstractAliases[$abstract] as $alias) {
if (! is_null($binding = $this->findInContextualBindings($alias))) {
return $binding;
}
}
} | [
"protected",
"function",
"getContextualConcrete",
"(",
"$",
"abstract",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"binding",
"=",
"$",
"this",
"->",
"findInContextualBindings",
"(",
"$",
"abstract",
")",
")",
")",
"{",
"return",
"$",
"binding",
";",
... | Get the contextual concrete binding for the given abstract.
@param string $abstract
@return \Closure|string|null | [
"Get",
"the",
"contextual",
"concrete",
"binding",
"for",
"the",
"given",
"abstract",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Container/Container.php#L728-L746 | train | Get the contextual concrete | [
30522,
5123,
3853,
2131,
8663,
18209,
8787,
8663,
16748,
2618,
1006,
1002,
10061,
1007,
1063,
2065,
1006,
999,
2003,
1035,
19701,
1006,
1002,
8031,
1027,
1002,
2023,
1011,
1028,
2424,
2378,
8663,
18209,
8787,
8428,
4667,
2015,
1006,
1002,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Form/Form.php | Form.add | public function add($child, $type = null, array $options = [])
{
if ($this->submitted) {
throw new AlreadySubmittedException('You cannot add children to a submitted form');
}
if (!$this->config->getCompound()) {
throw new LogicException('You cannot add children to a simple form. Maybe you should set the option "compound" to true?');
}
if (!$child instanceof FormInterface) {
if (!\is_string($child) && !\is_int($child)) {
throw new UnexpectedTypeException($child, 'string, integer or Symfony\Component\Form\FormInterface');
}
if (null !== $type && !\is_string($type) && !$type instanceof FormTypeInterface) {
throw new UnexpectedTypeException($type, 'string or Symfony\Component\Form\FormTypeInterface');
}
// Never initialize child forms automatically
$options['auto_initialize'] = false;
if (null === $type && null === $this->config->getDataClass()) {
$type = 'Symfony\Component\Form\Extension\Core\Type\TextType';
}
if (null === $type) {
$child = $this->config->getFormFactory()->createForProperty($this->config->getDataClass(), $child, null, $options);
} else {
$child = $this->config->getFormFactory()->createNamed($child, $type, null, $options);
}
} elseif ($child->getConfig()->getAutoInitialize()) {
throw new RuntimeException(sprintf('Automatic initialization is only supported on root forms. You should set the "auto_initialize" option to false on the field "%s".', $child->getName()));
}
$this->children[$child->getName()] = $child;
$child->setParent($this);
// If setData() is currently being called, there is no need to call
// mapDataToForms() here, as mapDataToForms() is called at the end
// of setData() anyway. Not doing this check leads to an endless
// recursion when initializing the form lazily and an event listener
// (such as ResizeFormListener) adds fields depending on the data:
//
// * setData() is called, the form is not initialized yet
// * add() is called by the listener (setData() is not complete, so
// the form is still not initialized)
// * getViewData() is called
// * setData() is called since the form is not initialized yet
// * ... endless recursion ...
//
// Also skip data mapping if setData() has not been called yet.
// setData() will be called upon form initialization and data mapping
// will take place by then.
if (!$this->lockSetData && $this->defaultDataSet && !$this->inheritData) {
$viewData = $this->getViewData();
$this->config->getDataMapper()->mapDataToForms(
$viewData,
new \RecursiveIteratorIterator(new InheritDataAwareIterator(new \ArrayIterator([$child->getName() => $child])))
);
}
return $this;
} | php | public function add($child, $type = null, array $options = [])
{
if ($this->submitted) {
throw new AlreadySubmittedException('You cannot add children to a submitted form');
}
if (!$this->config->getCompound()) {
throw new LogicException('You cannot add children to a simple form. Maybe you should set the option "compound" to true?');
}
if (!$child instanceof FormInterface) {
if (!\is_string($child) && !\is_int($child)) {
throw new UnexpectedTypeException($child, 'string, integer or Symfony\Component\Form\FormInterface');
}
if (null !== $type && !\is_string($type) && !$type instanceof FormTypeInterface) {
throw new UnexpectedTypeException($type, 'string or Symfony\Component\Form\FormTypeInterface');
}
// Never initialize child forms automatically
$options['auto_initialize'] = false;
if (null === $type && null === $this->config->getDataClass()) {
$type = 'Symfony\Component\Form\Extension\Core\Type\TextType';
}
if (null === $type) {
$child = $this->config->getFormFactory()->createForProperty($this->config->getDataClass(), $child, null, $options);
} else {
$child = $this->config->getFormFactory()->createNamed($child, $type, null, $options);
}
} elseif ($child->getConfig()->getAutoInitialize()) {
throw new RuntimeException(sprintf('Automatic initialization is only supported on root forms. You should set the "auto_initialize" option to false on the field "%s".', $child->getName()));
}
$this->children[$child->getName()] = $child;
$child->setParent($this);
// If setData() is currently being called, there is no need to call
// mapDataToForms() here, as mapDataToForms() is called at the end
// of setData() anyway. Not doing this check leads to an endless
// recursion when initializing the form lazily and an event listener
// (such as ResizeFormListener) adds fields depending on the data:
//
// * setData() is called, the form is not initialized yet
// * add() is called by the listener (setData() is not complete, so
// the form is still not initialized)
// * getViewData() is called
// * setData() is called since the form is not initialized yet
// * ... endless recursion ...
//
// Also skip data mapping if setData() has not been called yet.
// setData() will be called upon form initialization and data mapping
// will take place by then.
if (!$this->lockSetData && $this->defaultDataSet && !$this->inheritData) {
$viewData = $this->getViewData();
$this->config->getDataMapper()->mapDataToForms(
$viewData,
new \RecursiveIteratorIterator(new InheritDataAwareIterator(new \ArrayIterator([$child->getName() => $child])))
);
}
return $this;
} | [
"public",
"function",
"add",
"(",
"$",
"child",
",",
"$",
"type",
"=",
"null",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"submitted",
")",
"{",
"throw",
"new",
"AlreadySubmittedException",
"(",
"'You cannot ad... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Form.php#L835-L899 | train | Adds a child form to the form | [
30522,
2270,
3853,
5587,
1006,
1002,
2775,
1010,
1002,
2828,
1027,
19701,
1010,
9140,
1002,
7047,
1027,
1031,
1033,
1007,
1063,
2065,
1006,
1002,
2023,
1011,
1028,
7864,
1007,
1063,
5466,
2047,
2525,
6342,
25526,
27100,
3207,
2595,
24422,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Console/Question/ConfirmationQuestion.php | ConfirmationQuestion.getDefaultNormalizer | private function getDefaultNormalizer()
{
$default = $this->getDefault();
$regex = $this->trueAnswerRegex;
return function ($answer) use ($default, $regex) {
if (\is_bool($answer)) {
return $answer;
}
$answerIsTrue = (bool) preg_match($regex, $answer);
if (false === $default) {
return $answer && $answerIsTrue;
}
return '' === $answer || $answerIsTrue;
};
} | php | private function getDefaultNormalizer()
{
$default = $this->getDefault();
$regex = $this->trueAnswerRegex;
return function ($answer) use ($default, $regex) {
if (\is_bool($answer)) {
return $answer;
}
$answerIsTrue = (bool) preg_match($regex, $answer);
if (false === $default) {
return $answer && $answerIsTrue;
}
return '' === $answer || $answerIsTrue;
};
} | [
"private",
"function",
"getDefaultNormalizer",
"(",
")",
"{",
"$",
"default",
"=",
"$",
"this",
"->",
"getDefault",
"(",
")",
";",
"$",
"regex",
"=",
"$",
"this",
"->",
"trueAnswerRegex",
";",
"return",
"function",
"(",
"$",
"answer",
")",
"use",
"(",
... | Returns the default answer normalizer.
@return callable | [
"Returns",
"the",
"default",
"answer",
"normalizer",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Console/Question/ConfirmationQuestion.php#L41-L58 | train | Returns a normalizer that will return the default answer if any | [
30522,
2797,
3853,
2131,
3207,
7011,
11314,
12131,
9067,
17629,
1006,
1007,
1063,
1002,
12398,
1027,
1002,
2023,
1011,
1028,
2131,
3207,
7011,
11314,
1006,
1007,
1025,
1002,
19723,
10288,
1027,
1002,
2023,
1011,
1028,
2995,
6962,
13777,
289... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.deleteColumns | public function deleteColumns($names, $deleteRecursiveInSubtables = false)
{
foreach ($this->rows as $row) {
foreach ($names as $name) {
$row->deleteColumn($name);
}
$subTable = $row->getSubtable();
if ($subTable) {
$subTable->deleteColumns($names, $deleteRecursiveInSubtables);
}
}
if (!is_null($this->summaryRow)) {
foreach ($names as $name) {
$this->summaryRow->deleteColumn($name);
}
}
if (!is_null($this->totalsRow)) {
foreach ($names as $name) {
$this->totalsRow->deleteColumn($name);
}
}
} | php | public function deleteColumns($names, $deleteRecursiveInSubtables = false)
{
foreach ($this->rows as $row) {
foreach ($names as $name) {
$row->deleteColumn($name);
}
$subTable = $row->getSubtable();
if ($subTable) {
$subTable->deleteColumns($names, $deleteRecursiveInSubtables);
}
}
if (!is_null($this->summaryRow)) {
foreach ($names as $name) {
$this->summaryRow->deleteColumn($name);
}
}
if (!is_null($this->totalsRow)) {
foreach ($names as $name) {
$this->totalsRow->deleteColumn($name);
}
}
} | [
"public",
"function",
"deleteColumns",
"(",
"$",
"names",
",",
"$",
"deleteRecursiveInSubtables",
"=",
"false",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"rows",
"as",
"$",
"row",
")",
"{",
"foreach",
"(",
"$",
"names",
"as",
"$",
"name",
")",
"{",
... | Deletes several columns by name in every row.
@param array $names List of column names to delete.
@param bool $deleteRecursiveInSubtables Whether to apply this change to all subtables or not. | [
"Deletes",
"several",
"columns",
"by",
"name",
"in",
"every",
"row",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/DataTable.php#L1110-L1131 | train | Delete columns in the table | [
30522,
2270,
3853,
3972,
12870,
25778,
2819,
3619,
1006,
1002,
3415,
1010,
1002,
3972,
15141,
8586,
9236,
3512,
7076,
12083,
10880,
2015,
1027,
6270,
1007,
1063,
18921,
6776,
1006,
1002,
2023,
1011,
1028,
10281,
2004,
1002,
5216,
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... |
walkor/Workerman | Lib/Timer.php | Timer.del | public static function del($timer_id)
{
if (self::$_event) {
return self::$_event->del($timer_id, EventInterface::EV_TIMER);
}
return false;
} | php | public static function del($timer_id)
{
if (self::$_event) {
return self::$_event->del($timer_id, EventInterface::EV_TIMER);
}
return false;
} | [
"public",
"static",
"function",
"del",
"(",
"$",
"timer_id",
")",
"{",
"if",
"(",
"self",
"::",
"$",
"_event",
")",
"{",
"return",
"self",
"::",
"$",
"_event",
"->",
"del",
"(",
"$",
"timer_id",
",",
"EventInterface",
"::",
"EV_TIMER",
")",
";",
"}",... | Remove a timer.
@param mixed $timer_id
@return bool | [
"Remove",
"a",
"timer",
"."
] | 13649907f05014fcfffcfccaef01e63ad3339351 | https://github.com/walkor/Workerman/blob/13649907f05014fcfffcfccaef01e63ad3339351/Lib/Timer.php#L157-L164 | train | Delete timer from the event | [
30522,
2270,
10763,
3853,
3972,
1006,
1002,
25309,
1035,
8909,
1007,
1063,
2065,
1006,
2969,
1024,
1024,
1002,
1035,
2724,
1007,
1063,
2709,
2969,
1024,
1024,
1002,
1035,
2724,
1011,
1028,
3972,
1006,
1002,
25309,
1035,
8909,
1010,
2724,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/AuthServiceProvider.php | AuthServiceProvider.registerAccessGate | protected function registerAccessGate()
{
$this->app->singleton(GateContract::class, function ($app) {
return new Gate($app, function () use ($app) {
return call_user_func($app['auth']->userResolver());
});
});
} | php | protected function registerAccessGate()
{
$this->app->singleton(GateContract::class, function ($app) {
return new Gate($app, function () use ($app) {
return call_user_func($app['auth']->userResolver());
});
});
} | [
"protected",
"function",
"registerAccessGate",
"(",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"singleton",
"(",
"GateContract",
"::",
"class",
",",
"function",
"(",
"$",
"app",
")",
"{",
"return",
"new",
"Gate",
"(",
"$",
"app",
",",
"function",
"(",
"... | Register the access gate service.
@return void | [
"Register",
"the",
"access",
"gate",
"service",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Auth/AuthServiceProvider.php#L66-L73 | train | Register access gate | [
30522,
5123,
3853,
4236,
6305,
9623,
28745,
3686,
1006,
1007,
1063,
1002,
2023,
1011,
1028,
10439,
1011,
1028,
28159,
1006,
4796,
8663,
6494,
6593,
1024,
1024,
2465,
1010,
3853,
1006,
1002,
10439,
1007,
1063,
2709,
2047,
4796,
1006,
1002,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
z-song/laravel-admin | src/Form.php | Form.mergeValidationMessages | protected function mergeValidationMessages($validators)
{
$messageBag = new MessageBag();
foreach ($validators as $validator) {
$messageBag = $messageBag->merge($validator->messages());
}
return $messageBag;
} | php | protected function mergeValidationMessages($validators)
{
$messageBag = new MessageBag();
foreach ($validators as $validator) {
$messageBag = $messageBag->merge($validator->messages());
}
return $messageBag;
} | [
"protected",
"function",
"mergeValidationMessages",
"(",
"$",
"validators",
")",
"{",
"$",
"messageBag",
"=",
"new",
"MessageBag",
"(",
")",
";",
"foreach",
"(",
"$",
"validators",
"as",
"$",
"validator",
")",
"{",
"$",
"messageBag",
"=",
"$",
"messageBag",
... | Merge validation messages from input validators.
@param \Illuminate\Validation\Validator[] $validators
@return MessageBag | [
"Merge",
"validation",
"messages",
"from",
"input",
"validators",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Form.php#L1124-L1133 | train | Merge validation messages from all validators | [
30522,
5123,
3853,
13590,
10175,
8524,
3508,
7834,
3736,
8449,
1006,
1002,
9398,
18926,
1007,
1063,
1002,
4471,
16078,
1027,
2047,
4471,
16078,
1006,
1007,
1025,
18921,
6776,
1006,
1002,
9398,
18926,
2004,
1002,
9398,
8844,
1007,
1063,
1002... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
opencart/opencart | upload/catalog/controller/mail/gdpr.php | ControllerMailGdpr.index | public function index(&$route, &$args, &$output) {
// $args[0] $code
// $args[1] $email
// $args[2] $action
$this->load->language('mail/gdpr');
if ($this->config->get('config_logo')) {
$data['logo'] = html_entity_decode($this->config->get('config_logo'), ENT_QUOTES, 'UTF-8');
} else {
$data['logo'] = '';
}
$data['text_request'] = $this->language->get('text_' . $args[2]);
$data['button_confirm'] = $this->language->get('button_' . $args[2]);
$data['confirm'] = $this->url->link('information/gdpr/success', 'language=' . $this->config->get('config_language') . '&code=' . $args[0]);
$data['ip'] = $this->request->server['REMOTE_ADDR'];
$data['store_name'] = html_entity_decode($this->config->get('config_name'), ENT_QUOTES, 'UTF-8');
$data['store_url'] = $this->config->get('config_url');
$mail = new Mail($this->config->get('config_mail_engine'));
$mail->parameter = $this->config->get('config_mail_parameter');
$mail->smtp_hostname = $this->config->get('config_mail_smtp_hostname');
$mail->smtp_username = $this->config->get('config_mail_smtp_username');
$mail->smtp_password = html_entity_decode($this->config->get('config_mail_smtp_password'), ENT_QUOTES, 'UTF-8');
$mail->smtp_port = $this->config->get('config_mail_smtp_port');
$mail->smtp_timeout = $this->config->get('config_mail_smtp_timeout');
$mail->setTo($args[1]);
$mail->setFrom($this->config->get('config_email'));
$mail->setSender(html_entity_decode($this->config->get('config_name'), ENT_QUOTES, 'UTF-8'));
$mail->setSubject(html_entity_decode(sprintf($this->language->get('text_subject'), $this->config->get('config_name')), ENT_QUOTES, 'UTF-8'));
$mail->setHtml($this->load->view('mail/gdpr', $data));
$mail->send();
} | php | public function index(&$route, &$args, &$output) {
// $args[0] $code
// $args[1] $email
// $args[2] $action
$this->load->language('mail/gdpr');
if ($this->config->get('config_logo')) {
$data['logo'] = html_entity_decode($this->config->get('config_logo'), ENT_QUOTES, 'UTF-8');
} else {
$data['logo'] = '';
}
$data['text_request'] = $this->language->get('text_' . $args[2]);
$data['button_confirm'] = $this->language->get('button_' . $args[2]);
$data['confirm'] = $this->url->link('information/gdpr/success', 'language=' . $this->config->get('config_language') . '&code=' . $args[0]);
$data['ip'] = $this->request->server['REMOTE_ADDR'];
$data['store_name'] = html_entity_decode($this->config->get('config_name'), ENT_QUOTES, 'UTF-8');
$data['store_url'] = $this->config->get('config_url');
$mail = new Mail($this->config->get('config_mail_engine'));
$mail->parameter = $this->config->get('config_mail_parameter');
$mail->smtp_hostname = $this->config->get('config_mail_smtp_hostname');
$mail->smtp_username = $this->config->get('config_mail_smtp_username');
$mail->smtp_password = html_entity_decode($this->config->get('config_mail_smtp_password'), ENT_QUOTES, 'UTF-8');
$mail->smtp_port = $this->config->get('config_mail_smtp_port');
$mail->smtp_timeout = $this->config->get('config_mail_smtp_timeout');
$mail->setTo($args[1]);
$mail->setFrom($this->config->get('config_email'));
$mail->setSender(html_entity_decode($this->config->get('config_name'), ENT_QUOTES, 'UTF-8'));
$mail->setSubject(html_entity_decode(sprintf($this->language->get('text_subject'), $this->config->get('config_name')), ENT_QUOTES, 'UTF-8'));
$mail->setHtml($this->load->view('mail/gdpr', $data));
$mail->send();
} | [
"public",
"function",
"index",
"(",
"&",
"$",
"route",
",",
"&",
"$",
"args",
",",
"&",
"$",
"output",
")",
"{",
"// $args[0] $code",
"// $args[1] $email",
"// $args[2] $action",
"$",
"this",
"->",
"load",
"->",
"language",
"(",
"'mail/gdpr'",
")",
";",
"i... | catalog/model/account/gdpr/addGdpr | [
"catalog",
"/",
"model",
"/",
"account",
"/",
"gdpr",
"/",
"addGdpr"
] | e7933b56ba05aafb3655c6b490c9733cd18b5c69 | https://github.com/opencart/opencart/blob/e7933b56ba05aafb3655c6b490c9733cd18b5c69/upload/catalog/controller/mail/gdpr.php#L4-L42 | train | The main function | [
30522,
2270,
3853,
5950,
1006,
1004,
1002,
2799,
1010,
1004,
1002,
12098,
5620,
1010,
1004,
1002,
6434,
1007,
1063,
1013,
1013,
1002,
12098,
5620,
1031,
1014,
1033,
1002,
3642,
1013,
1013,
1002,
12098,
5620,
1031,
1015,
1033,
1002,
10373,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/Zend/Db/Table/Abstract.php | Zend_Db_Table_Abstract._getCols | protected function _getCols()
{
if (null === $this->_cols) {
$this->_setupMetadata();
$this->_cols = array_keys($this->_metadata);
}
return $this->_cols;
} | php | protected function _getCols()
{
if (null === $this->_cols) {
$this->_setupMetadata();
$this->_cols = array_keys($this->_metadata);
}
return $this->_cols;
} | [
"protected",
"function",
"_getCols",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"_cols",
")",
"{",
"$",
"this",
"->",
"_setupMetadata",
"(",
")",
";",
"$",
"this",
"->",
"_cols",
"=",
"array_keys",
"(",
"$",
"this",
"->",
"_metadata"... | Retrieve table columns
@return array | [
"Retrieve",
"table",
"columns"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Table/Abstract.php#L854-L861 | train | Return array of columns names | [
30522,
5123,
3853,
1035,
2131,
25778,
2015,
1006,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
1027,
30524,
8447,
2696,
1006,
1007,
1025,
1002,
2023,
1011,
1028,
1035,
8902,
2015,
1027,
9140,
1035,
6309,
1006,
1002,
2023,
1011,
1028,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Debug/ErrorHandler.php | ErrorHandler.handleError | public function handleError($type, $message, $file, $line)
{
// Level is the current error reporting level to manage silent error.
$level = error_reporting();
$silenced = 0 === ($level & $type);
// Strong errors are not authorized to be silenced.
$level |= E_RECOVERABLE_ERROR | E_USER_ERROR | E_DEPRECATED | E_USER_DEPRECATED;
$log = $this->loggedErrors & $type;
$throw = $this->thrownErrors & $type & $level;
$type &= $level | $this->screamedErrors;
if (!$type || (!$log && !$throw)) {
return !$silenced && $type && $log;
}
$scope = $this->scopedErrors & $type;
if (4 < $numArgs = \func_num_args()) {
$context = $scope ? (func_get_arg(4) ?: []) : [];
} else {
$context = [];
}
if (isset($context['GLOBALS']) && $scope) {
$e = $context; // Whatever the signature of the method,
unset($e['GLOBALS'], $context); // $context is always a reference in 5.3
$context = $e;
}
if (false !== strpos($message, "class@anonymous\0")) {
$logMessage = $this->levels[$type].': '.(new FlattenException())->setMessage($message)->getMessage();
} else {
$logMessage = $this->levels[$type].': '.$message;
}
if (null !== self::$toStringException) {
$errorAsException = self::$toStringException;
self::$toStringException = null;
} elseif (!$throw && !($type & $level)) {
if (!isset(self::$silencedErrorCache[$id = $file.':'.$line])) {
$lightTrace = $this->tracedErrors & $type ? $this->cleanTrace(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 5), $type, $file, $line, false) : [];
$errorAsException = new SilencedErrorContext($type, $file, $line, isset($lightTrace[1]) ? [$lightTrace[0]] : $lightTrace);
} elseif (isset(self::$silencedErrorCache[$id][$message])) {
$lightTrace = null;
$errorAsException = self::$silencedErrorCache[$id][$message];
++$errorAsException->count;
} else {
$lightTrace = [];
$errorAsException = null;
}
if (100 < ++self::$silencedErrorCount) {
self::$silencedErrorCache = $lightTrace = [];
self::$silencedErrorCount = 1;
}
if ($errorAsException) {
self::$silencedErrorCache[$id][$message] = $errorAsException;
}
if (null === $lightTrace) {
return;
}
} else {
$errorAsException = new \ErrorException($logMessage, 0, $type, $file, $line);
if ($throw || $this->tracedErrors & $type) {
$backtrace = $errorAsException->getTrace();
$lightTrace = $this->cleanTrace($backtrace, $type, $file, $line, $throw);
$this->traceReflector->setValue($errorAsException, $lightTrace);
} else {
$this->traceReflector->setValue($errorAsException, []);
$backtrace = [];
}
}
if ($throw) {
if (E_USER_ERROR & $type) {
for ($i = 1; isset($backtrace[$i]); ++$i) {
if (isset($backtrace[$i]['function'], $backtrace[$i]['type'], $backtrace[$i - 1]['function'])
&& '__toString' === $backtrace[$i]['function']
&& '->' === $backtrace[$i]['type']
&& !isset($backtrace[$i - 1]['class'])
&& ('trigger_error' === $backtrace[$i - 1]['function'] || 'user_error' === $backtrace[$i - 1]['function'])
) {
// Here, we know trigger_error() has been called from __toString().
// PHP triggers a fatal error when throwing from __toString().
// A small convention allows working around the limitation:
// given a caught $e exception in __toString(), quitting the method with
// `return trigger_error($e, E_USER_ERROR);` allows this error handler
// to make $e get through the __toString() barrier.
foreach ($context as $e) {
if ($e instanceof \Throwable && $e->__toString() === $message) {
self::$toStringException = $e;
return true;
}
}
// Display the original error message instead of the default one.
$this->handleException($errorAsException);
// Stop the process by giving back the error to the native handler.
return false;
}
}
}
throw $errorAsException;
}
if ($this->isRecursive) {
$log = 0;
} else {
if (!\defined('HHVM_VERSION')) {
$currentErrorHandler = set_error_handler('var_dump');
restore_error_handler();
}
try {
$this->isRecursive = true;
$level = ($type & $level) ? $this->loggers[$type][1] : LogLevel::DEBUG;
$this->loggers[$type][0]->log($level, $logMessage, $errorAsException ? ['exception' => $errorAsException] : []);
} finally {
$this->isRecursive = false;
if (!\defined('HHVM_VERSION')) {
set_error_handler($currentErrorHandler);
}
}
}
return !$silenced && $type && $log;
} | php | public function handleError($type, $message, $file, $line)
{
// Level is the current error reporting level to manage silent error.
$level = error_reporting();
$silenced = 0 === ($level & $type);
// Strong errors are not authorized to be silenced.
$level |= E_RECOVERABLE_ERROR | E_USER_ERROR | E_DEPRECATED | E_USER_DEPRECATED;
$log = $this->loggedErrors & $type;
$throw = $this->thrownErrors & $type & $level;
$type &= $level | $this->screamedErrors;
if (!$type || (!$log && !$throw)) {
return !$silenced && $type && $log;
}
$scope = $this->scopedErrors & $type;
if (4 < $numArgs = \func_num_args()) {
$context = $scope ? (func_get_arg(4) ?: []) : [];
} else {
$context = [];
}
if (isset($context['GLOBALS']) && $scope) {
$e = $context; // Whatever the signature of the method,
unset($e['GLOBALS'], $context); // $context is always a reference in 5.3
$context = $e;
}
if (false !== strpos($message, "class@anonymous\0")) {
$logMessage = $this->levels[$type].': '.(new FlattenException())->setMessage($message)->getMessage();
} else {
$logMessage = $this->levels[$type].': '.$message;
}
if (null !== self::$toStringException) {
$errorAsException = self::$toStringException;
self::$toStringException = null;
} elseif (!$throw && !($type & $level)) {
if (!isset(self::$silencedErrorCache[$id = $file.':'.$line])) {
$lightTrace = $this->tracedErrors & $type ? $this->cleanTrace(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 5), $type, $file, $line, false) : [];
$errorAsException = new SilencedErrorContext($type, $file, $line, isset($lightTrace[1]) ? [$lightTrace[0]] : $lightTrace);
} elseif (isset(self::$silencedErrorCache[$id][$message])) {
$lightTrace = null;
$errorAsException = self::$silencedErrorCache[$id][$message];
++$errorAsException->count;
} else {
$lightTrace = [];
$errorAsException = null;
}
if (100 < ++self::$silencedErrorCount) {
self::$silencedErrorCache = $lightTrace = [];
self::$silencedErrorCount = 1;
}
if ($errorAsException) {
self::$silencedErrorCache[$id][$message] = $errorAsException;
}
if (null === $lightTrace) {
return;
}
} else {
$errorAsException = new \ErrorException($logMessage, 0, $type, $file, $line);
if ($throw || $this->tracedErrors & $type) {
$backtrace = $errorAsException->getTrace();
$lightTrace = $this->cleanTrace($backtrace, $type, $file, $line, $throw);
$this->traceReflector->setValue($errorAsException, $lightTrace);
} else {
$this->traceReflector->setValue($errorAsException, []);
$backtrace = [];
}
}
if ($throw) {
if (E_USER_ERROR & $type) {
for ($i = 1; isset($backtrace[$i]); ++$i) {
if (isset($backtrace[$i]['function'], $backtrace[$i]['type'], $backtrace[$i - 1]['function'])
&& '__toString' === $backtrace[$i]['function']
&& '->' === $backtrace[$i]['type']
&& !isset($backtrace[$i - 1]['class'])
&& ('trigger_error' === $backtrace[$i - 1]['function'] || 'user_error' === $backtrace[$i - 1]['function'])
) {
// Here, we know trigger_error() has been called from __toString().
// PHP triggers a fatal error when throwing from __toString().
// A small convention allows working around the limitation:
// given a caught $e exception in __toString(), quitting the method with
// `return trigger_error($e, E_USER_ERROR);` allows this error handler
// to make $e get through the __toString() barrier.
foreach ($context as $e) {
if ($e instanceof \Throwable && $e->__toString() === $message) {
self::$toStringException = $e;
return true;
}
}
// Display the original error message instead of the default one.
$this->handleException($errorAsException);
// Stop the process by giving back the error to the native handler.
return false;
}
}
}
throw $errorAsException;
}
if ($this->isRecursive) {
$log = 0;
} else {
if (!\defined('HHVM_VERSION')) {
$currentErrorHandler = set_error_handler('var_dump');
restore_error_handler();
}
try {
$this->isRecursive = true;
$level = ($type & $level) ? $this->loggers[$type][1] : LogLevel::DEBUG;
$this->loggers[$type][0]->log($level, $logMessage, $errorAsException ? ['exception' => $errorAsException] : []);
} finally {
$this->isRecursive = false;
if (!\defined('HHVM_VERSION')) {
set_error_handler($currentErrorHandler);
}
}
}
return !$silenced && $type && $log;
} | [
"public",
"function",
"handleError",
"(",
"$",
"type",
",",
"$",
"message",
",",
"$",
"file",
",",
"$",
"line",
")",
"{",
"// Level is the current error reporting level to manage silent error.",
"$",
"level",
"=",
"error_reporting",
"(",
")",
";",
"$",
"silenced",... | Handles errors by filtering then logging them according to the configured bit fields.
@param int $type One of the E_* constants
@param string $message
@param string $file
@param int $line
@return bool Returns false when no handling happens so that the PHP engine can handle the error itself
@throws \ErrorException When $this->thrownErrors requests so
@internal | [
"Handles",
"errors",
"by",
"filtering",
"then",
"logging",
"them",
"according",
"to",
"the",
"configured",
"bit",
"fields",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Debug/ErrorHandler.php#L383-L514 | train | Handles the error | [
30522,
2270,
3853,
5047,
2121,
29165,
1006,
1002,
2828,
1010,
1002,
4471,
1010,
1002,
5371,
1010,
1002,
2240,
1007,
1063,
1013,
1013,
2504,
2003,
1996,
2783,
7561,
7316,
2504,
2000,
6133,
4333,
7561,
1012,
1002,
2504,
1027,
7561,
1035,
73... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Getters.php | Getters.offsetGet | public function offsetGet($offset)
{
if ($this->gettersVariable) {
$var = $this->gettersVariable;
return $this->{$var}[$offset] ?? null;
}
return $this->{$offset} ?? null;
} | php | public function offsetGet($offset)
{
if ($this->gettersVariable) {
$var = $this->gettersVariable;
return $this->{$var}[$offset] ?? null;
}
return $this->{$offset} ?? null;
} | [
"public",
"function",
"offsetGet",
"(",
"$",
"offset",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"gettersVariable",
")",
"{",
"$",
"var",
"=",
"$",
"this",
"->",
"gettersVariable",
";",
"return",
"$",
"this",
"->",
"{",
"$",
"var",
"}",
"[",
"$",
"of... | @param mixed $offset
@return mixed | [
"@param",
"mixed",
"$offset"
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Getters.php#L87-L96 | train | Get the value of an offset | [
30522,
2270,
3853,
16396,
18150,
1006,
1002,
16396,
30524,
2709,
1002,
2023,
1011,
1028,
1063,
1002,
16396,
1065,
1029,
1029,
19701,
1025,
1065,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
php-ai/php-ml | src/Math/Set.php | Set.union | public static function union(self $a, self $b): self
{
return new self(array_merge($a->toArray(), $b->toArray()));
} | php | public static function union(self $a, self $b): self
{
return new self(array_merge($a->toArray(), $b->toArray()));
} | [
"public",
"static",
"function",
"union",
"(",
"self",
"$",
"a",
",",
"self",
"$",
"b",
")",
":",
"self",
"{",
"return",
"new",
"self",
"(",
"array_merge",
"(",
"$",
"a",
"->",
"toArray",
"(",
")",
",",
"$",
"b",
"->",
"toArray",
"(",
")",
")",
... | Creates the union of A and B. | [
"Creates",
"the",
"union",
"of",
"A",
"and",
"B",
"."
] | f6aa1a59b0525b8fca3d2786d661ab3e70904016 | https://github.com/php-ai/php-ml/blob/f6aa1a59b0525b8fca3d2786d661ab3e70904016/src/Math/Set.php#L28-L31 | train | Union two sets of objects | [
30522,
2270,
10763,
3853,
2586,
1006,
2969,
1002,
1037,
1010,
2969,
1002,
1038,
1007,
1024,
2969,
1063,
2709,
2047,
2969,
1006,
9140,
1035,
13590,
1006,
1002,
1037,
1011,
1028,
2000,
2906,
30524,
1007,
1007,
1007,
1025,
1065,
102,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/traits/ViewMaker.php | ViewMaker.guessViewPathFrom | public function guessViewPathFrom($class, $suffix = '', $isPublic = false)
{
$classFolder = strtolower(class_basename($class));
$classFile = realpath(dirname(File::fromClass($class)));
$guessedPath = $classFile ? $classFile . '/' . $classFolder . $suffix : null;
return $isPublic ? File::localToPublic($guessedPath) : $guessedPath;
} | php | public function guessViewPathFrom($class, $suffix = '', $isPublic = false)
{
$classFolder = strtolower(class_basename($class));
$classFile = realpath(dirname(File::fromClass($class)));
$guessedPath = $classFile ? $classFile . '/' . $classFolder . $suffix : null;
return $isPublic ? File::localToPublic($guessedPath) : $guessedPath;
} | [
"public",
"function",
"guessViewPathFrom",
"(",
"$",
"class",
",",
"$",
"suffix",
"=",
"''",
",",
"$",
"isPublic",
"=",
"false",
")",
"{",
"$",
"classFolder",
"=",
"strtolower",
"(",
"class_basename",
"(",
"$",
"class",
")",
")",
";",
"$",
"classFile",
... | Guess the package path from a specified class.
@param string $class Class to guess path from.
@param string $suffix An extra path to attach to the end
@param bool $isPublic Returns public path instead of an absolute one
@return string | [
"Guess",
"the",
"package",
"path",
"from",
"a",
"specified",
"class",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/traits/ViewMaker.php#L295-L301 | train | Guess view path from class name | [
30522,
2270,
3853,
3984,
8584,
15069,
19699,
5358,
1006,
1002,
2465,
1010,
1002,
16809,
1027,
1005,
1005,
1010,
1002,
2003,
14289,
16558,
2594,
1027,
6270,
1007,
1063,
1002,
2465,
10371,
2121,
1027,
2358,
5339,
12898,
13777,
1006,
2465,
103... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Serializer/Encoder/CsvEncoder.php | CsvEncoder.decode | public function decode($data, $format, array $context = [])
{
$handle = fopen('php://temp', 'r+');
fwrite($handle, $data);
rewind($handle);
$headers = null;
$nbHeaders = 0;
$headerCount = [];
$result = [];
list($delimiter, $enclosure, $escapeChar, $keySeparator) = $this->getCsvOptions($context);
while (false !== ($cols = fgetcsv($handle, 0, $delimiter, $enclosure, $escapeChar))) {
$nbCols = \count($cols);
if (null === $headers) {
$nbHeaders = $nbCols;
if ($context[self::NO_HEADERS_KEY] ?? false) {
for ($i = 0; $i < $nbCols; ++$i) {
$headers[] = [$i];
}
$headerCount = array_fill(0, $nbCols, 1);
} else {
foreach ($cols as $col) {
$header = explode($keySeparator, $col);
$headers[] = $header;
$headerCount[] = \count($header);
}
continue;
}
}
$item = [];
for ($i = 0; ($i < $nbCols) && ($i < $nbHeaders); ++$i) {
$depth = $headerCount[$i];
$arr = &$item;
for ($j = 0; $j < $depth; ++$j) {
// Handle nested arrays
if ($j === ($depth - 1)) {
$arr[$headers[$i][$j]] = $cols[$i];
continue;
}
if (!isset($arr[$headers[$i][$j]])) {
$arr[$headers[$i][$j]] = [];
}
$arr = &$arr[$headers[$i][$j]];
}
}
$result[] = $item;
}
fclose($handle);
if ($context[self::AS_COLLECTION_KEY] ?? false) {
return $result;
}
if (empty($result) || isset($result[1])) {
return $result;
}
if (!isset($context['as_collection'])) {
@trigger_error('Relying on the default value (false) of the "as_collection" option is deprecated since 4.2. You should set it to false explicitly instead as true will be the default value in 5.0.', E_USER_DEPRECATED);
}
// If there is only one data line in the document, return it (the line), the result is not considered as a collection
return $result[0];
} | php | public function decode($data, $format, array $context = [])
{
$handle = fopen('php://temp', 'r+');
fwrite($handle, $data);
rewind($handle);
$headers = null;
$nbHeaders = 0;
$headerCount = [];
$result = [];
list($delimiter, $enclosure, $escapeChar, $keySeparator) = $this->getCsvOptions($context);
while (false !== ($cols = fgetcsv($handle, 0, $delimiter, $enclosure, $escapeChar))) {
$nbCols = \count($cols);
if (null === $headers) {
$nbHeaders = $nbCols;
if ($context[self::NO_HEADERS_KEY] ?? false) {
for ($i = 0; $i < $nbCols; ++$i) {
$headers[] = [$i];
}
$headerCount = array_fill(0, $nbCols, 1);
} else {
foreach ($cols as $col) {
$header = explode($keySeparator, $col);
$headers[] = $header;
$headerCount[] = \count($header);
}
continue;
}
}
$item = [];
for ($i = 0; ($i < $nbCols) && ($i < $nbHeaders); ++$i) {
$depth = $headerCount[$i];
$arr = &$item;
for ($j = 0; $j < $depth; ++$j) {
// Handle nested arrays
if ($j === ($depth - 1)) {
$arr[$headers[$i][$j]] = $cols[$i];
continue;
}
if (!isset($arr[$headers[$i][$j]])) {
$arr[$headers[$i][$j]] = [];
}
$arr = &$arr[$headers[$i][$j]];
}
}
$result[] = $item;
}
fclose($handle);
if ($context[self::AS_COLLECTION_KEY] ?? false) {
return $result;
}
if (empty($result) || isset($result[1])) {
return $result;
}
if (!isset($context['as_collection'])) {
@trigger_error('Relying on the default value (false) of the "as_collection" option is deprecated since 4.2. You should set it to false explicitly instead as true will be the default value in 5.0.', E_USER_DEPRECATED);
}
// If there is only one data line in the document, return it (the line), the result is not considered as a collection
return $result[0];
} | [
"public",
"function",
"decode",
"(",
"$",
"data",
",",
"$",
"format",
",",
"array",
"$",
"context",
"=",
"[",
"]",
")",
"{",
"$",
"handle",
"=",
"fopen",
"(",
"'php://temp'",
",",
"'r+'",
")",
";",
"fwrite",
"(",
"$",
"handle",
",",
"$",
"data",
... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Serializer/Encoder/CsvEncoder.php#L127-L200 | train | Decode CSV data | [
30522,
2270,
3853,
21933,
3207,
1006,
1002,
2951,
1010,
1002,
4289,
1010,
9140,
1002,
6123,
1027,
1031,
1033,
1007,
1063,
1002,
5047,
1027,
1042,
26915,
1006,
1005,
25718,
1024,
1013,
1013,
8915,
8737,
1005,
1010,
1005,
1054,
1009,
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/Bus/BusServiceProvider.php | BusServiceProvider.register | public function register()
{
$this->app->singleton(Dispatcher::class, function ($app) {
return new Dispatcher($app, function ($connection = null) use ($app) {
return $app[QueueFactoryContract::class]->connection($connection);
});
});
$this->app->alias(
Dispatcher::class, DispatcherContract::class
);
$this->app->alias(
Dispatcher::class, QueueingDispatcherContract::class
);
} | php | public function register()
{
$this->app->singleton(Dispatcher::class, function ($app) {
return new Dispatcher($app, function ($connection = null) use ($app) {
return $app[QueueFactoryContract::class]->connection($connection);
});
});
$this->app->alias(
Dispatcher::class, DispatcherContract::class
);
$this->app->alias(
Dispatcher::class, QueueingDispatcherContract::class
);
} | [
"public",
"function",
"register",
"(",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"singleton",
"(",
"Dispatcher",
"::",
"class",
",",
"function",
"(",
"$",
"app",
")",
"{",
"return",
"new",
"Dispatcher",
"(",
"$",
"app",
",",
"function",
"(",
"$",
"co... | Register the service provider.
@return void | [
"Register",
"the",
"service",
"provider",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Bus/BusServiceProvider.php#L18-L33 | train | Register the queue dispatcher | [
30522,
2270,
3853,
4236,
1006,
1007,
1063,
1002,
2023,
1011,
1028,
10439,
1011,
1028,
28159,
1006,
18365,
2121,
1024,
1024,
2465,
1010,
3853,
1006,
1002,
10439,
1007,
1063,
2709,
2047,
18365,
2121,
1006,
1002,
10439,
1010,
3853,
1006,
1002,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Database/Query/Builder.php | Builder.having | public function having($column, $operator = null, $value = null, $boolean = 'and')
{
$type = 'Basic';
// Here we will make some assumptions about the operator. If only 2 values are
// passed to the method, we will assume that the operator is an equals sign
// and keep going. Otherwise, we'll require the operator to be passed in.
[$value, $operator] = $this->prepareValueAndOperator(
$value, $operator, func_num_args() === 2
);
// If the given operator is not found in the list of valid operators we will
// assume that the developer is just short-cutting the '=' operators and
// we will set the operators to '=' and set the values appropriately.
if ($this->invalidOperator($operator)) {
[$value, $operator] = [$operator, '='];
}
$this->havings[] = compact('type', 'column', 'operator', 'value', 'boolean');
if (! $value instanceof Expression) {
$this->addBinding($value, 'having');
}
return $this;
} | php | public function having($column, $operator = null, $value = null, $boolean = 'and')
{
$type = 'Basic';
// Here we will make some assumptions about the operator. If only 2 values are
// passed to the method, we will assume that the operator is an equals sign
// and keep going. Otherwise, we'll require the operator to be passed in.
[$value, $operator] = $this->prepareValueAndOperator(
$value, $operator, func_num_args() === 2
);
// If the given operator is not found in the list of valid operators we will
// assume that the developer is just short-cutting the '=' operators and
// we will set the operators to '=' and set the values appropriately.
if ($this->invalidOperator($operator)) {
[$value, $operator] = [$operator, '='];
}
$this->havings[] = compact('type', 'column', 'operator', 'value', 'boolean');
if (! $value instanceof Expression) {
$this->addBinding($value, 'having');
}
return $this;
} | [
"public",
"function",
"having",
"(",
"$",
"column",
",",
"$",
"operator",
"=",
"null",
",",
"$",
"value",
"=",
"null",
",",
"$",
"boolean",
"=",
"'and'",
")",
"{",
"$",
"type",
"=",
"'Basic'",
";",
"// Here we will make some assumptions about the operator. If ... | Add a "having" clause to the query.
@param string $column
@param string|null $operator
@param string|null $value
@param string $boolean
@return $this | [
"Add",
"a",
"having",
"clause",
"to",
"the",
"query",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Query/Builder.php#L1697-L1722 | train | Add having clause to the query | [
30522,
2270,
3853,
2383,
1006,
1002,
5930,
1010,
1002,
6872,
1027,
19701,
1010,
1002,
3643,
1027,
19701,
1010,
1002,
22017,
20898,
1027,
1005,
1998,
1005,
1007,
1063,
1002,
2828,
1027,
1005,
3937,
1005,
1025,
1013,
1013,
2182,
2057,
2097,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getgrav/grav | system/src/Grav/Common/User/FlexUser/User.php | User.getFormValue | public function getFormValue(string $name, $default = null, string $separator = null)
{
$value = parent::getFormValue($name, null, $separator);
if ($name === 'avatar') {
return $this->parseFileProperty($value);
}
if (null === $value) {
if ($name === 'media_order') {
return implode(',', $this->getMediaOrder());
}
}
return $value ?? $default;
} | php | public function getFormValue(string $name, $default = null, string $separator = null)
{
$value = parent::getFormValue($name, null, $separator);
if ($name === 'avatar') {
return $this->parseFileProperty($value);
}
if (null === $value) {
if ($name === 'media_order') {
return implode(',', $this->getMediaOrder());
}
}
return $value ?? $default;
} | [
"public",
"function",
"getFormValue",
"(",
"string",
"$",
"name",
",",
"$",
"default",
"=",
"null",
",",
"string",
"$",
"separator",
"=",
"null",
")",
"{",
"$",
"value",
"=",
"parent",
"::",
"getFormValue",
"(",
"$",
"name",
",",
"null",
",",
"$",
"s... | Get value from a page variable (used mostly for creating edit forms).
@param string $name Variable name.
@param mixed $default
@param string|null $separator
@return mixed | [
"Get",
"value",
"from",
"a",
"page",
"variable",
"(",
"used",
"mostly",
"for",
"creating",
"edit",
"forms",
")",
"."
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/User/FlexUser/User.php#L164-L179 | train | Get form value | [
30522,
2270,
3853,
2131,
14192,
10175,
5657,
1006,
5164,
1002,
2171,
1010,
1002,
12398,
1027,
19701,
1010,
5164,
1002,
19802,
25879,
2953,
1027,
19701,
1007,
1063,
1002,
3643,
1027,
6687,
1024,
1024,
2131,
14192,
10175,
5657,
1006,
1002,
21... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/Dashboard/Controller.php | Controller.resetLayout | public function resetLayout()
{
$this->checkTokenInUrl();
if (Piwik::isUserIsAnonymous()) {
$session = new SessionNamespace("Dashboard");
$session->dashboardLayout = $this->dashboard->getDefaultLayout();
$session->setExpirationSeconds(1800);
} else {
Request::processRequest('Dashboard.resetDashboardLayout');
}
} | php | public function resetLayout()
{
$this->checkTokenInUrl();
if (Piwik::isUserIsAnonymous()) {
$session = new SessionNamespace("Dashboard");
$session->dashboardLayout = $this->dashboard->getDefaultLayout();
$session->setExpirationSeconds(1800);
} else {
Request::processRequest('Dashboard.resetDashboardLayout');
}
} | [
"public",
"function",
"resetLayout",
"(",
")",
"{",
"$",
"this",
"->",
"checkTokenInUrl",
"(",
")",
";",
"if",
"(",
"Piwik",
"::",
"isUserIsAnonymous",
"(",
")",
")",
"{",
"$",
"session",
"=",
"new",
"SessionNamespace",
"(",
"\"Dashboard\"",
")",
";",
"$... | Resets the dashboard to the default widget configuration | [
"Resets",
"the",
"dashboard",
"to",
"the",
"default",
"widget",
"configuration"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Dashboard/Controller.php#L88-L98 | train | Reset the dashboard layout | [
30522,
2270,
3853,
25141,
8485,
5833,
1006,
1007,
1063,
1002,
2023,
1011,
1028,
4638,
18715,
18595,
11231,
12190,
1006,
1007,
1025,
2065,
1006,
14255,
9148,
2243,
1024,
1024,
2003,
20330,
29196,
16585,
27711,
1006,
1007,
1007,
1063,
1002,
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... |
z-song/laravel-admin | src/Widgets/Table.php | Table.setRows | public function setRows($rows = [])
{
if (Arr::isAssoc($rows)) {
foreach ($rows as $key => $item) {
$this->rows[] = [$key, $item];
}
return $this;
}
$this->rows = $rows;
return $this;
} | php | public function setRows($rows = [])
{
if (Arr::isAssoc($rows)) {
foreach ($rows as $key => $item) {
$this->rows[] = [$key, $item];
}
return $this;
}
$this->rows = $rows;
return $this;
} | [
"public",
"function",
"setRows",
"(",
"$",
"rows",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"Arr",
"::",
"isAssoc",
"(",
"$",
"rows",
")",
")",
"{",
"foreach",
"(",
"$",
"rows",
"as",
"$",
"key",
"=>",
"$",
"item",
")",
"{",
"$",
"this",
"->",
"ro... | Set table rows.
@param array $rows
@return $this | [
"Set",
"table",
"rows",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Widgets/Table.php#L67-L80 | train | Set rows to the table | [
30522,
2270,
3853,
2275,
10524,
2015,
1006,
1002,
10281,
1027,
1031,
1033,
1007,
1063,
2065,
1006,
12098,
30524,
1002,
8875,
1007,
1063,
1002,
2023,
1011,
1028,
10281,
1031,
1033,
1027,
1031,
1002,
3145,
1010,
1002,
8875,
1033,
1025,
1065,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Broadcasting/Broadcasters/Broadcaster.php | Broadcaster.normalizeChannelHandlerToCallable | protected function normalizeChannelHandlerToCallable($callback)
{
return is_callable($callback) ? $callback : function (...$args) use ($callback) {
return Container::getInstance()
->make($callback)
->join(...$args);
};
} | php | protected function normalizeChannelHandlerToCallable($callback)
{
return is_callable($callback) ? $callback : function (...$args) use ($callback) {
return Container::getInstance()
->make($callback)
->join(...$args);
};
} | [
"protected",
"function",
"normalizeChannelHandlerToCallable",
"(",
"$",
"callback",
")",
"{",
"return",
"is_callable",
"(",
"$",
"callback",
")",
"?",
"$",
"callback",
":",
"function",
"(",
"...",
"$",
"args",
")",
"use",
"(",
"$",
"callback",
")",
"{",
"r... | Normalize the given callback into a callable.
@param mixed $callback
@return callable|\Closure | [
"Normalize",
"the",
"given",
"callback",
"into",
"a",
"callable",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Broadcasting/Broadcasters/Broadcaster.php#L266-L273 | train | Normalize a callback to a callable that can be used to create a new instance of the class | [
30522,
5123,
3853,
3671,
4697,
26058,
11774,
3917,
3406,
9289,
20470,
2571,
1006,
1002,
2655,
5963,
1007,
1063,
2709,
2003,
1035,
2655,
3085,
1006,
1002,
2655,
5963,
1007,
1029,
1002,
2655,
5963,
1024,
3853,
1006,
1012,
1012,
1012,
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... |
barryvdh/laravel-debugbar | src/DataFormatter/SimpleFormatter.php | SimpleFormatter.exportValue | private function exportValue($value, $depth = 1, $deep = false)
{
if ($value instanceof \__PHP_Incomplete_Class) {
return sprintf('__PHP_Incomplete_Class(%s)', $this->getClassNameFromIncomplete($value));
}
if (is_object($value)) {
if ($value instanceof \DateTimeInterface) {
return sprintf('Object(%s) - %s', get_class($value), $value->format(\DateTime::ATOM));
}
return sprintf('Object(%s)', get_class($value));
}
if (is_array($value)) {
if (empty($value)) {
return '[]';
}
$indent = str_repeat(' ', $depth);
$a = array();
foreach ($value as $k => $v) {
if (is_array($v)) {
$deep = true;
}
$a[] = sprintf('%s => %s', $k, $this->exportValue($v, $depth + 1, $deep));
}
if ($deep) {
return sprintf("[\n%s%s\n%s]", $indent, implode(sprintf(", \n%s", $indent), $a), str_repeat(' ', $depth - 1));
}
$s = sprintf('[%s]', implode(', ', $a));
if (80 > strlen($s)) {
return $s;
}
return sprintf("[\n%s%s\n]", $indent, implode(sprintf(",\n%s", $indent), $a));
}
if (is_resource($value)) {
return sprintf('Resource(%s#%d)', get_resource_type($value), $value);
}
if (null === $value) {
return 'null';
}
if (false === $value) {
return 'false';
}
if (true === $value) {
return 'true';
}
return (string) $value;
} | php | private function exportValue($value, $depth = 1, $deep = false)
{
if ($value instanceof \__PHP_Incomplete_Class) {
return sprintf('__PHP_Incomplete_Class(%s)', $this->getClassNameFromIncomplete($value));
}
if (is_object($value)) {
if ($value instanceof \DateTimeInterface) {
return sprintf('Object(%s) - %s', get_class($value), $value->format(\DateTime::ATOM));
}
return sprintf('Object(%s)', get_class($value));
}
if (is_array($value)) {
if (empty($value)) {
return '[]';
}
$indent = str_repeat(' ', $depth);
$a = array();
foreach ($value as $k => $v) {
if (is_array($v)) {
$deep = true;
}
$a[] = sprintf('%s => %s', $k, $this->exportValue($v, $depth + 1, $deep));
}
if ($deep) {
return sprintf("[\n%s%s\n%s]", $indent, implode(sprintf(", \n%s", $indent), $a), str_repeat(' ', $depth - 1));
}
$s = sprintf('[%s]', implode(', ', $a));
if (80 > strlen($s)) {
return $s;
}
return sprintf("[\n%s%s\n]", $indent, implode(sprintf(",\n%s", $indent), $a));
}
if (is_resource($value)) {
return sprintf('Resource(%s#%d)', get_resource_type($value), $value);
}
if (null === $value) {
return 'null';
}
if (false === $value) {
return 'false';
}
if (true === $value) {
return 'true';
}
return (string) $value;
} | [
"private",
"function",
"exportValue",
"(",
"$",
"value",
",",
"$",
"depth",
"=",
"1",
",",
"$",
"deep",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"value",
"instanceof",
"\\",
"__PHP_Incomplete_Class",
")",
"{",
"return",
"sprintf",
"(",
"'__PHP_Incomplete_Cl... | Converts a PHP value to a string.
@param mixed $value The PHP value
@param int $depth Only for internal usage
@param bool $deep Only for internal usage
@return string The string representation of the given value
@author Bernhard Schussek <bschussek@gmail.com> | [
"Converts",
"a",
"PHP",
"value",
"to",
"a",
"string",
"."
] | 2d195779ea4f809f69764a795e2ec371dbb76a96 | https://github.com/barryvdh/laravel-debugbar/blob/2d195779ea4f809f69764a795e2ec371dbb76a96/src/DataFormatter/SimpleFormatter.php#L33-L92 | train | Exports the value to the language | [
30522,
2797,
3853,
9167,
10175,
5657,
1006,
1002,
3643,
1010,
1002,
5995,
1027,
1015,
1010,
1002,
2784,
1027,
6270,
1007,
1063,
2065,
1006,
1002,
3643,
6013,
11253,
1032,
1035,
1035,
25718,
1035,
12958,
1035,
2465,
1007,
1063,
2709,
9043,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Archive/DataCollection.php | DataCollection.getDataTable | public function getDataTable($resultIndices)
{
$dataTableFactory = new DataTableFactory(
$this->dataNames, $this->dataType, $this->sitesId, $this->periods, $this->defaultRow);
$index = $this->getIndexedArray($resultIndices);
return $dataTableFactory->make($index, $resultIndices);
} | php | public function getDataTable($resultIndices)
{
$dataTableFactory = new DataTableFactory(
$this->dataNames, $this->dataType, $this->sitesId, $this->periods, $this->defaultRow);
$index = $this->getIndexedArray($resultIndices);
return $dataTableFactory->make($index, $resultIndices);
} | [
"public",
"function",
"getDataTable",
"(",
"$",
"resultIndices",
")",
"{",
"$",
"dataTableFactory",
"=",
"new",
"DataTableFactory",
"(",
"$",
"this",
"->",
"dataNames",
",",
"$",
"this",
"->",
"dataType",
",",
"$",
"this",
"->",
"sitesId",
",",
"$",
"this"... | Returns archive data as a DataTable indexed by metadata. Indexed data will
be represented by Map instances.
@param array $resultIndices An array mapping metadata names to pretty labels
for them. Each archive data row will be indexed
by the metadata specified here.
Eg, array('site' => 'idSite', 'period' => 'Date')
@return DataTable|DataTable\Map | [
"Returns",
"archive",
"data",
"as",
"a",
"DataTable",
"indexed",
"by",
"metadata",
".",
"Indexed",
"data",
"will",
"be",
"represented",
"by",
"Map",
"instances",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Archive/DataCollection.php#L221-L229 | train | Get the DataTable for the given result indices | [
30522,
2270,
3853,
2131,
2850,
29336,
3085,
1006,
1002,
2765,
22254,
23522,
1007,
1063,
1002,
2951,
10880,
21450,
1027,
2047,
2951,
10880,
21450,
1006,
1002,
2023,
1011,
1028,
2951,
18442,
2015,
1010,
1002,
2023,
1011,
1028,
2951,
13874,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
dompdf/dompdf | lib/html5lib/Parser.php | HTML5_Parser.parseFragment | static public function parseFragment($text, $context = null, $builder = null) {
$tokenizer = new HTML5_Tokenizer($text, $builder);
$tokenizer->parseFragment($context);
return $tokenizer->save();
} | php | static public function parseFragment($text, $context = null, $builder = null) {
$tokenizer = new HTML5_Tokenizer($text, $builder);
$tokenizer->parseFragment($context);
return $tokenizer->save();
} | [
"static",
"public",
"function",
"parseFragment",
"(",
"$",
"text",
",",
"$",
"context",
"=",
"null",
",",
"$",
"builder",
"=",
"null",
")",
"{",
"$",
"tokenizer",
"=",
"new",
"HTML5_Tokenizer",
"(",
"$",
"text",
",",
"$",
"builder",
")",
";",
"$",
"t... | Parses an HTML fragment.
@param $text | HTML text to parse
@param $context String name of context element to pretend parsing is in.
@param $builder | Custom builder implementation
@return DOMDocument|DOMNodeList Parsed HTML as DOMDocument | [
"Parses",
"an",
"HTML",
"fragment",
"."
] | 75f13c700009be21a1965dc2c5b68a8708c22ba2 | https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/lib/html5lib/Parser.php#L32-L36 | train | Parse a fragment | [
30522,
10763,
2270,
3853,
11968,
20106,
29181,
3672,
1006,
1002,
3793,
1010,
1002,
6123,
1027,
19701,
1010,
1002,
12508,
1027,
19701,
1007,
1063,
1002,
19204,
17629,
1027,
2047,
16129,
2629,
1035,
19204,
17629,
1006,
1002,
3793,
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... |
overtrue/wechat | src/MiniProgram/ActivityMessage/Client.php | Client.formatParameters | protected function formatParameters(array $params)
{
$formatted = [];
foreach ($params as $name => $value) {
if (!in_array($name, ['member_count', 'room_limit', 'path', 'version_type'], true)) {
continue;
}
if ('version_type' === $name && !in_array($value, ['develop', 'trial', 'release'], true)) {
throw new InvalidArgumentException('Invalid value of attribute "version_type".');
}
$formatted[] = [
'name' => $name,
'value' => strval($value),
];
}
return $formatted;
} | php | protected function formatParameters(array $params)
{
$formatted = [];
foreach ($params as $name => $value) {
if (!in_array($name, ['member_count', 'room_limit', 'path', 'version_type'], true)) {
continue;
}
if ('version_type' === $name && !in_array($value, ['develop', 'trial', 'release'], true)) {
throw new InvalidArgumentException('Invalid value of attribute "version_type".');
}
$formatted[] = [
'name' => $name,
'value' => strval($value),
];
}
return $formatted;
} | [
"protected",
"function",
"formatParameters",
"(",
"array",
"$",
"params",
")",
"{",
"$",
"formatted",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"params",
"as",
"$",
"name",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"name",
... | @param array $params
@return array | [
"@param",
"array",
"$params"
] | 120c72faaa93c270365bc75c73c362d5fd583209 | https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/MiniProgram/ActivityMessage/Client.php#L58-L78 | train | Formats parameters for the page. | [
30522,
5123,
3853,
4289,
28689,
22828,
2015,
1006,
9140,
1002,
11498,
5244,
1007,
1063,
1002,
4289,
3064,
1027,
1031,
1033,
1025,
18921,
6776,
1006,
1002,
11498,
5244,
2004,
1002,
2171,
1027,
1028,
1002,
3643,
1007,
1063,
2065,
1006,
999,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spatie/laravel-permission | src/Traits/HasRoles.php | HasRoles.assignRole | public function assignRole(...$roles)
{
$roles = collect($roles)
->flatten()
->map(function ($role) {
if (empty($role)) {
return false;
}
return $this->getStoredRole($role);
})
->filter(function ($role) {
return $role instanceof Role;
})
->each(function ($role) {
$this->ensureModelSharesGuard($role);
})
->map->id
->all();
$model = $this->getModel();
if ($model->exists) {
$this->roles()->sync($roles, false);
$model->load('roles');
} else {
$class = \get_class($model);
$class::saved(
function ($object) use ($roles, $model) {
static $modelLastFiredOn;
if ($modelLastFiredOn !== null && $modelLastFiredOn === $model) {
return;
}
$object->roles()->sync($roles, false);
$object->load('roles');
$modelLastFiredOn = $object;
});
}
$this->forgetCachedPermissions();
return $this;
} | php | public function assignRole(...$roles)
{
$roles = collect($roles)
->flatten()
->map(function ($role) {
if (empty($role)) {
return false;
}
return $this->getStoredRole($role);
})
->filter(function ($role) {
return $role instanceof Role;
})
->each(function ($role) {
$this->ensureModelSharesGuard($role);
})
->map->id
->all();
$model = $this->getModel();
if ($model->exists) {
$this->roles()->sync($roles, false);
$model->load('roles');
} else {
$class = \get_class($model);
$class::saved(
function ($object) use ($roles, $model) {
static $modelLastFiredOn;
if ($modelLastFiredOn !== null && $modelLastFiredOn === $model) {
return;
}
$object->roles()->sync($roles, false);
$object->load('roles');
$modelLastFiredOn = $object;
});
}
$this->forgetCachedPermissions();
return $this;
} | [
"public",
"function",
"assignRole",
"(",
"...",
"$",
"roles",
")",
"{",
"$",
"roles",
"=",
"collect",
"(",
"$",
"roles",
")",
"->",
"flatten",
"(",
")",
"->",
"map",
"(",
"function",
"(",
"$",
"role",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"role... | Assign the given role to the model.
@param array|string|\Spatie\Permission\Contracts\Role ...$roles
@return $this | [
"Assign",
"the",
"given",
"role",
"to",
"the",
"model",
"."
] | 81dbe9d372d70c255b66a2727a235076509f8d45 | https://github.com/spatie/laravel-permission/blob/81dbe9d372d70c255b66a2727a235076509f8d45/src/Traits/HasRoles.php#L97-L140 | train | Assigns roles to the model | [
30522,
2270,
3853,
23911,
13153,
2063,
1006,
1012,
1012,
1012,
1002,
4395,
1007,
1063,
1002,
4395,
1027,
8145,
1006,
1002,
4395,
1007,
1011,
1028,
4257,
6528,
1006,
1007,
1011,
1028,
4949,
1006,
3853,
1006,
1002,
2535,
1007,
1063,
2065,
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/Form/AbstractExtension.php | AbstractExtension.hasType | public function hasType($name)
{
if (null === $this->types) {
$this->initTypes();
}
return isset($this->types[$name]);
} | php | public function hasType($name)
{
if (null === $this->types) {
$this->initTypes();
}
return isset($this->types[$name]);
} | [
"public",
"function",
"hasType",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"types",
")",
"{",
"$",
"this",
"->",
"initTypes",
"(",
")",
";",
"}",
"return",
"isset",
"(",
"$",
"this",
"->",
"types",
"[",
"$",
"name",... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/AbstractExtension.php#L69-L76 | train | Checks if a type exists | [
30522,
2270,
30524,
2023,
1011,
1028,
4127,
1031,
1002,
2171,
1033,
1007,
1025,
1065,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/models/MaintenanceSetting.php | MaintenanceSetting.beforeValidate | public function beforeValidate()
{
if (!$theme = Theme::getEditTheme()) {
throw new ApplicationException('Unable to find the active theme.');
}
$themeMap = $this->getSettingsValue('theme_map', []);
$themeMap[$theme->getDirName()] = $this->getSettingsValue('cms_page');
$this->setSettingsValue('theme_map', $themeMap);
} | php | public function beforeValidate()
{
if (!$theme = Theme::getEditTheme()) {
throw new ApplicationException('Unable to find the active theme.');
}
$themeMap = $this->getSettingsValue('theme_map', []);
$themeMap[$theme->getDirName()] = $this->getSettingsValue('cms_page');
$this->setSettingsValue('theme_map', $themeMap);
} | [
"public",
"function",
"beforeValidate",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"theme",
"=",
"Theme",
"::",
"getEditTheme",
"(",
")",
")",
"{",
"throw",
"new",
"ApplicationException",
"(",
"'Unable to find the active theme.'",
")",
";",
"}",
"$",
"themeMap",
"=... | Ensure each theme has its own CMS page, store it inside a mapping array.
@return void | [
"Ensure",
"each",
"theme",
"has",
"its",
"own",
"CMS",
"page",
"store",
"it",
"inside",
"a",
"mapping",
"array",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/models/MaintenanceSetting.php#L63-L72 | train | This method is called before the form is validated. | [
30522,
2270,
3853,
2077,
10175,
8524,
2618,
1006,
1007,
1063,
2065,
1006,
999,
1002,
4323,
1027,
4323,
1024,
1024,
2131,
2098,
12474,
29122,
2063,
1006,
1007,
1007,
1063,
5466,
2047,
4646,
10288,
24422,
1006,
1005,
4039,
2000,
2424,
1996,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/HttpKernel/DataCollector/ExceptionDataCollector.php | ExceptionDataCollector.collect | public function collect(Request $request, Response $response, \Exception $exception = null)
{
if (null !== $exception) {
$this->data = [
'exception' => FlattenException::create($exception),
];
}
} | php | public function collect(Request $request, Response $response, \Exception $exception = null)
{
if (null !== $exception) {
$this->data = [
'exception' => FlattenException::create($exception),
];
}
} | [
"public",
"function",
"collect",
"(",
"Request",
"$",
"request",
",",
"Response",
"$",
"response",
",",
"\\",
"Exception",
"$",
"exception",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"exception",
")",
"{",
"$",
"this",
"->",
"data",
"=",
... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/DataCollector/ExceptionDataCollector.php#L28-L35 | train | collects the data | [
30522,
2270,
3853,
8145,
1006,
5227,
1002,
5227,
1010,
3433,
1002,
3433,
1010,
1032,
6453,
1002,
6453,
1027,
19701,
1007,
1063,
2065,
1006,
19701,
999,
1027,
1027,
1002,
6453,
1007,
1063,
1002,
2023,
1011,
1028,
2951,
1027,
1031,
1005,
64... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Validator/Validator/RecursiveValidator.php | RecursiveValidator.validateProperty | public function validateProperty($object, $propertyName, $groups = null)
{
return $this->startContext($object)
->validateProperty($object, $propertyName, $groups)
->getViolations();
} | php | public function validateProperty($object, $propertyName, $groups = null)
{
return $this->startContext($object)
->validateProperty($object, $propertyName, $groups)
->getViolations();
} | [
"public",
"function",
"validateProperty",
"(",
"$",
"object",
",",
"$",
"propertyName",
",",
"$",
"groups",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"startContext",
"(",
"$",
"object",
")",
"->",
"validateProperty",
"(",
"$",
"object",
",",
"$... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Validator/Validator/RecursiveValidator.php#L107-L112 | train | Validate a property of an object | [
30522,
2270,
3853,
9398,
3686,
21572,
4842,
3723,
1006,
1002,
4874,
1010,
1002,
3200,
18442,
1010,
1002,
2967,
1027,
19701,
1007,
1063,
2709,
1002,
2023,
1011,
1028,
2707,
8663,
18209,
1006,
1002,
4874,
1007,
1011,
1028,
9398,
3686,
21572,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Bundle/FrameworkBundle/CacheWarmer/SerializerCacheWarmer.php | SerializerCacheWarmer.extractSupportedLoaders | private function extractSupportedLoaders(array $loaders)
{
$supportedLoaders = [];
foreach ($loaders as $loader) {
if ($loader instanceof XmlFileLoader || $loader instanceof YamlFileLoader) {
$supportedLoaders[] = $loader;
} elseif ($loader instanceof LoaderChain) {
$supportedLoaders = array_merge($supportedLoaders, $this->extractSupportedLoaders($loader->getLoaders()));
}
}
return $supportedLoaders;
} | php | private function extractSupportedLoaders(array $loaders)
{
$supportedLoaders = [];
foreach ($loaders as $loader) {
if ($loader instanceof XmlFileLoader || $loader instanceof YamlFileLoader) {
$supportedLoaders[] = $loader;
} elseif ($loader instanceof LoaderChain) {
$supportedLoaders = array_merge($supportedLoaders, $this->extractSupportedLoaders($loader->getLoaders()));
}
}
return $supportedLoaders;
} | [
"private",
"function",
"extractSupportedLoaders",
"(",
"array",
"$",
"loaders",
")",
"{",
"$",
"supportedLoaders",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"loaders",
"as",
"$",
"loader",
")",
"{",
"if",
"(",
"$",
"loader",
"instanceof",
"XmlFileLoader",
"... | @param LoaderInterface[] $loaders
@return XmlFileLoader[]|YamlFileLoader[] | [
"@param",
"LoaderInterface",
"[]",
"$loaders"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/SerializerCacheWarmer.php#L77-L90 | train | Extract all the supported loaders from the passed array. | [
30522,
2797,
3853,
27059,
6279,
6442,
2098,
11066,
2545,
1006,
9140,
1002,
7170,
2545,
1007,
1063,
1002,
3569,
11066,
2545,
1027,
1031,
1033,
1025,
18921,
6776,
1006,
1002,
7170,
2545,
2004,
1002,
7170,
2121,
1007,
1063,
2065,
1006,
1002,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
dompdf/dompdf | src/Frame.php | Frame.is_auto_width | public function is_auto_width()
{
$style = $this->_style;
return in_array(
"auto",
array(
$style->width,
$style->margin_left,
$style->margin_right,
$style->border_left_width,
$style->border_right_width,
$style->padding_left,
$style->padding_right,
$this->_containing_block["w"]
),
true
);
} | php | public function is_auto_width()
{
$style = $this->_style;
return in_array(
"auto",
array(
$style->width,
$style->margin_left,
$style->margin_right,
$style->border_left_width,
$style->border_right_width,
$style->padding_left,
$style->padding_right,
$this->_containing_block["w"]
),
true
);
} | [
"public",
"function",
"is_auto_width",
"(",
")",
"{",
"$",
"style",
"=",
"$",
"this",
"->",
"_style",
";",
"return",
"in_array",
"(",
"\"auto\"",
",",
"array",
"(",
"$",
"style",
"->",
"width",
",",
"$",
"style",
"->",
"margin_left",
",",
"$",
"style",... | Indicates if the margin width is auto sized
@return bool | [
"Indicates",
"if",
"the",
"margin",
"width",
"is",
"auto",
"sized"
] | 75f13c700009be21a1965dc2c5b68a8708c22ba2 | https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/src/Frame.php#L789-L807 | train | Is the page auto width? | [
30522,
2270,
3853,
2003,
1035,
8285,
1035,
9381,
1006,
1007,
1063,
1002,
2806,
1027,
1002,
2023,
1011,
1028,
1035,
2806,
1025,
2709,
1999,
1035,
9140,
1006,
1000,
8285,
1000,
1010,
9140,
1006,
1002,
2806,
1011,
1028,
9381,
1010,
1002,
280... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/cms/classes/Theme.php | Theme.__isset | public function __isset($key)
{
if ($this->hasCustomData()) {
$theme = $this->getCustomData();
return $theme->offsetExists($key);
}
return false;
} | php | public function __isset($key)
{
if ($this->hasCustomData()) {
$theme = $this->getCustomData();
return $theme->offsetExists($key);
}
return false;
} | [
"public",
"function",
"__isset",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasCustomData",
"(",
")",
")",
"{",
"$",
"theme",
"=",
"$",
"this",
"->",
"getCustomData",
"(",
")",
";",
"return",
"$",
"theme",
"->",
"offsetExists",
"(",
... | Determine if an attribute exists on the object.
@param string $key
@return void | [
"Determine",
"if",
"an",
"attribute",
"exists",
"on",
"the",
"object",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/Theme.php#L540-L548 | train | Return TRUE if the value of the key exists in the theme | [
30522,
2270,
3853,
1035,
1035,
26354,
3388,
1006,
1002,
3145,
1007,
1063,
2065,
1006,
1002,
2023,
1011,
1028,
2038,
7874,
20389,
2850,
2696,
1006,
1007,
1007,
1063,
1002,
4323,
1027,
1002,
2023,
1011,
1028,
2131,
7874,
20389,
2850,
2696,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Asset.php | Asset.fill | public function fill(array $attributes)
{
foreach ($attributes as $key => $value) {
if (!in_array($key, $this->fillable)) {
throw new ApplicationException(Lang::get(
'cms::lang.cms_object.invalid_property',
['name' => $key]
));
}
$this->$key = $value;
}
} | php | public function fill(array $attributes)
{
foreach ($attributes as $key => $value) {
if (!in_array($key, $this->fillable)) {
throw new ApplicationException(Lang::get(
'cms::lang.cms_object.invalid_property',
['name' => $key]
));
}
$this->$key = $value;
}
} | [
"public",
"function",
"fill",
"(",
"array",
"$",
"attributes",
")",
"{",
"foreach",
"(",
"$",
"attributes",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"key",
",",
"$",
"this",
"->",
"fillable",
")",
")",
... | Sets the object attributes.
@param array $attributes A list of attributes to set. | [
"Sets",
"the",
"object",
"attributes",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/Asset.php#L138-L150 | train | Fill the object with the values from an array | [
30522,
2270,
3853,
6039,
1006,
9140,
1002,
12332,
1007,
1063,
18921,
6776,
1006,
1002,
12332,
2004,
1002,
3145,
1027,
1028,
1002,
3643,
1007,
1063,
2065,
1006,
999,
1999,
1035,
9140,
1006,
1002,
3145,
1010,
1002,
2023,
1011,
1028,
6039,
3... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/Zend/Cache/Core.php | Zend_Cache_Core._setOption | private function _setOption($name, $value)
{
if (!is_string($name) || !array_key_exists($name, $this->_options)) {
Zend_Cache::throwException("Incorrect option name : $name");
}
if ($name == 'lifetime' && empty($value)) {
$value = null;
}
$this->_options[$name] = $value;
} | php | private function _setOption($name, $value)
{
if (!is_string($name) || !array_key_exists($name, $this->_options)) {
Zend_Cache::throwException("Incorrect option name : $name");
}
if ($name == 'lifetime' && empty($value)) {
$value = null;
}
$this->_options[$name] = $value;
} | [
"private",
"function",
"_setOption",
"(",
"$",
"name",
",",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"name",
")",
"||",
"!",
"array_key_exists",
"(",
"$",
"name",
",",
"$",
"this",
"->",
"_options",
")",
")",
"{",
"Zend_Cache",
... | Set an option
@param string $name Name of the option
@param mixed $value Value of the option
@throws Zend_Cache_Exception
@return void | [
"Set",
"an",
"option"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Cache/Core.php#L260-L269 | train | Set option value | [
30522,
2797,
3853,
1035,
2275,
7361,
3508,
1006,
1002,
2171,
1010,
1002,
3643,
1007,
1063,
2065,
1006,
999,
2003,
1035,
5164,
1006,
1002,
2171,
1007,
1064,
1064,
999,
9140,
1035,
3145,
1035,
6526,
1006,
1002,
2171,
1010,
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... |
matomo-org/matomo | core/Segment/SegmentExpression.php | SegmentExpression.checkFieldIsAvailable | private function checkFieldIsAvailable($field, &$availableTables)
{
$fieldParts = explode('.', $field);
$table = count($fieldParts) == 2 ? $fieldParts[0] : false;
// remove sql functions from field name
// example: `HOUR(log_visit.visit_last_action_time)` gets `HOUR(log_visit` => remove `HOUR(`
$table = preg_replace('/^[A-Z_]+\(/', '', $table);
$tableExists = !$table || in_array($table, $availableTables);
if ($tableExists) {
return;
}
if (is_array($availableTables)) {
foreach ($availableTables as $availableTable) {
if (is_array($availableTable)) {
if (!isset($availableTable['tableAlias']) && $availableTable['table'] === $table) {
return;
} elseif (isset($availableTable['tableAlias']) && $availableTable['tableAlias'] === $table) {
return;
}
}
}
}
$availableTables[] = $table;
} | php | private function checkFieldIsAvailable($field, &$availableTables)
{
$fieldParts = explode('.', $field);
$table = count($fieldParts) == 2 ? $fieldParts[0] : false;
// remove sql functions from field name
// example: `HOUR(log_visit.visit_last_action_time)` gets `HOUR(log_visit` => remove `HOUR(`
$table = preg_replace('/^[A-Z_]+\(/', '', $table);
$tableExists = !$table || in_array($table, $availableTables);
if ($tableExists) {
return;
}
if (is_array($availableTables)) {
foreach ($availableTables as $availableTable) {
if (is_array($availableTable)) {
if (!isset($availableTable['tableAlias']) && $availableTable['table'] === $table) {
return;
} elseif (isset($availableTable['tableAlias']) && $availableTable['tableAlias'] === $table) {
return;
}
}
}
}
$availableTables[] = $table;
} | [
"private",
"function",
"checkFieldIsAvailable",
"(",
"$",
"field",
",",
"&",
"$",
"availableTables",
")",
"{",
"$",
"fieldParts",
"=",
"explode",
"(",
"'.'",
",",
"$",
"field",
")",
";",
"$",
"table",
"=",
"count",
"(",
"$",
"fieldParts",
")",
"==",
"2... | Check whether the field is available
If not, add it to the available tables
@param string $field
@param array $availableTables | [
"Check",
"whether",
"the",
"field",
"is",
"available",
"If",
"not",
"add",
"it",
"to",
"the",
"available",
"tables"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Segment/SegmentExpression.php#L335-L363 | train | Checks if the field is available in the available tables | [
30522,
2797,
3853,
4638,
3790,
14268,
3567,
11733,
3468,
1006,
1002,
2492,
1010,
1004,
1002,
2800,
10880,
30524,
1013,
6366,
29296,
4972,
2013,
2492,
2171,
1013,
1013,
2742,
1024,
1036,
3178,
1006,
8833,
1035,
3942,
1012,
3942,
1035,
2197,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/ServiceProvider.php | ServiceProvider.bootRichEditorEvents | protected function bootRichEditorEvents()
{
Event::listen('backend.richeditor.listTypes', function () {
return [
'cms-page' => 'cms::lang.page.cms_page'
];
});
Event::listen('backend.richeditor.getTypeInfo', function ($type) {
if ($type === 'cms-page') {
return CmsPage::getRichEditorTypeInfo($type);
}
});
} | php | protected function bootRichEditorEvents()
{
Event::listen('backend.richeditor.listTypes', function () {
return [
'cms-page' => 'cms::lang.page.cms_page'
];
});
Event::listen('backend.richeditor.getTypeInfo', function ($type) {
if ($type === 'cms-page') {
return CmsPage::getRichEditorTypeInfo($type);
}
});
} | [
"protected",
"function",
"bootRichEditorEvents",
"(",
")",
"{",
"Event",
"::",
"listen",
"(",
"'backend.richeditor.listTypes'",
",",
"function",
"(",
")",
"{",
"return",
"[",
"'cms-page'",
"=>",
"'cms::lang.page.cms_page'",
"]",
";",
"}",
")",
";",
"Event",
"::"... | Registers events for rich editor page links. | [
"Registers",
"events",
"for",
"rich",
"editor",
"page",
"links",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/ServiceProvider.php#L313-L326 | train | Boots the richeditor events | [
30522,
5123,
3853,
9573,
13149,
2098,
15660,
18697,
7666,
1006,
1007,
1063,
2724,
1024,
1024,
4952,
1006,
1005,
2067,
10497,
1012,
4138,
2098,
15660,
1012,
2862,
13874,
2015,
1005,
1010,
3853,
1006,
1007,
1063,
2709,
1031,
1005,
4642,
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... |
matomo-org/matomo | core/Plugin/Report.php | Report.render | public function render()
{
$viewDataTable = Common::getRequestVar('viewDataTable', false, 'string');
$fixed = Common::getRequestVar('forceView', 0, 'int');
$module = $this->getModule();
$action = $this->getAction();
$apiProxy = Proxy::getInstance();
if (!$apiProxy->isExistingApiAction($module, $action)) {
throw new Exception("Invalid action name '$action' for '$module' plugin.");
}
$apiAction = $apiProxy->buildApiActionName($module, $action);
$view = ViewDataTableFactory::build($viewDataTable, $apiAction, $module . '.' . $action, $fixed);
return $view->render();
} | php | public function render()
{
$viewDataTable = Common::getRequestVar('viewDataTable', false, 'string');
$fixed = Common::getRequestVar('forceView', 0, 'int');
$module = $this->getModule();
$action = $this->getAction();
$apiProxy = Proxy::getInstance();
if (!$apiProxy->isExistingApiAction($module, $action)) {
throw new Exception("Invalid action name '$action' for '$module' plugin.");
}
$apiAction = $apiProxy->buildApiActionName($module, $action);
$view = ViewDataTableFactory::build($viewDataTable, $apiAction, $module . '.' . $action, $fixed);
return $view->render();
} | [
"public",
"function",
"render",
"(",
")",
"{",
"$",
"viewDataTable",
"=",
"Common",
"::",
"getRequestVar",
"(",
"'viewDataTable'",
",",
"false",
",",
"'string'",
")",
";",
"$",
"fixed",
"=",
"Common",
"::",
"getRequestVar",
"(",
"'forceView'",
",",
"0",
",... | Renders a report depending on the configured ViewDataTable see {@link configureView()} and
{@link getDefaultTypeViewDataTable()}. If you want to customize the render process or just render any custom view
you can overwrite this method.
@return string
@throws \Exception In case the given API action does not exist yet.
@api | [
"Renders",
"a",
"report",
"depending",
"on",
"the",
"configured",
"ViewDataTable",
"see",
"{",
"@link",
"configureView",
"()",
"}",
"and",
"{",
"@link",
"getDefaultTypeViewDataTable",
"()",
"}",
".",
"If",
"you",
"want",
"to",
"customize",
"the",
"render",
"pr... | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Plugin/Report.php#L296-L315 | train | Render the viewDataTable | [
30522,
2270,
3853,
17552,
1006,
1007,
1063,
1002,
3193,
2850,
29336,
3085,
1027,
2691,
1024,
1024,
2131,
2890,
15500,
10755,
1006,
1005,
3193,
2850,
29336,
3085,
1005,
1010,
6270,
1010,
1005,
5164,
1005,
1007,
1025,
1002,
4964,
1027,
2691,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/ImageGraph/StaticGraph/PieGraph.php | PieGraph.truncateSmallValues | private function truncateSmallValues()
{
$metricColumns = array_keys($this->ordinateSeries);
$metricColumn = $metricColumns[0];
$ordinateValuesSum = 0;
foreach ($this->ordinateSeries[$metricColumn] as $ordinateValue) {
$ordinateValuesSum += $ordinateValue;
}
$truncatedOrdinateSeries[$metricColumn] = array();
$truncatedAbscissaSeries = array();
$smallValuesSum = 0;
$ordinateValuesCount = count($this->ordinateSeries[$metricColumn]);
for ($i = 0; $i < $ordinateValuesCount - 1; $i++) {
$ordinateValue = $this->ordinateSeries[$metricColumn][$i];
if ($ordinateValue / $ordinateValuesSum > 0.01) {
$truncatedOrdinateSeries[$metricColumn][] = $ordinateValue;
$truncatedAbscissaSeries[] = $this->abscissaSeries[$i];
} else {
$smallValuesSum += $ordinateValue;
}
}
$smallValuesSum += $this->ordinateSeries[$metricColumn][$ordinateValuesCount - 1];
if (($smallValuesSum / $ordinateValuesSum) > 0.01) {
$truncatedOrdinateSeries[$metricColumn][] = $smallValuesSum;
$truncatedAbscissaSeries[] = end($this->abscissaSeries);
}
$this->ordinateSeries = $truncatedOrdinateSeries;
$this->abscissaSeries = $truncatedAbscissaSeries;
} | php | private function truncateSmallValues()
{
$metricColumns = array_keys($this->ordinateSeries);
$metricColumn = $metricColumns[0];
$ordinateValuesSum = 0;
foreach ($this->ordinateSeries[$metricColumn] as $ordinateValue) {
$ordinateValuesSum += $ordinateValue;
}
$truncatedOrdinateSeries[$metricColumn] = array();
$truncatedAbscissaSeries = array();
$smallValuesSum = 0;
$ordinateValuesCount = count($this->ordinateSeries[$metricColumn]);
for ($i = 0; $i < $ordinateValuesCount - 1; $i++) {
$ordinateValue = $this->ordinateSeries[$metricColumn][$i];
if ($ordinateValue / $ordinateValuesSum > 0.01) {
$truncatedOrdinateSeries[$metricColumn][] = $ordinateValue;
$truncatedAbscissaSeries[] = $this->abscissaSeries[$i];
} else {
$smallValuesSum += $ordinateValue;
}
}
$smallValuesSum += $this->ordinateSeries[$metricColumn][$ordinateValuesCount - 1];
if (($smallValuesSum / $ordinateValuesSum) > 0.01) {
$truncatedOrdinateSeries[$metricColumn][] = $smallValuesSum;
$truncatedAbscissaSeries[] = end($this->abscissaSeries);
}
$this->ordinateSeries = $truncatedOrdinateSeries;
$this->abscissaSeries = $truncatedAbscissaSeries;
} | [
"private",
"function",
"truncateSmallValues",
"(",
")",
"{",
"$",
"metricColumns",
"=",
"array_keys",
"(",
"$",
"this",
"->",
"ordinateSeries",
")",
";",
"$",
"metricColumn",
"=",
"$",
"metricColumns",
"[",
"0",
"]",
";",
"$",
"ordinateValuesSum",
"=",
"0",
... | this method logic is close to Piwik's core filter_truncate.
it uses a threshold to determine if an abscissa value should be drawn on the PIE
discarded abscissa values are summed in the 'other' abscissa value
if this process is not perform, CpChart will draw pie slices that are too small to see | [
"this",
"method",
"logic",
"is",
"close",
"to",
"Piwik",
"s",
"core",
"filter_truncate",
".",
"it",
"uses",
"a",
"threshold",
"to",
"determine",
"if",
"an",
"abscissa",
"value",
"should",
"be",
"drawn",
"on",
"the",
"PIE",
"discarded",
"abscissa",
"values",
... | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/ImageGraph/StaticGraph/PieGraph.php#L92-L125 | train | Truncates the abscissa series to the smallest value | [
30522,
2797,
3853,
19817,
4609,
16280,
26212,
3363,
10175,
15808,
1006,
1007,
1063,
1002,
12046,
25778,
2819,
3619,
1027,
9140,
1035,
6309,
1006,
1002,
2023,
1011,
1028,
2030,
18979,
4570,
28077,
1007,
1025,
1002,
12046,
25778,
2819,
2078,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/TokenStream.php | TokenStream.getNextIdentifierOrStar | public function getNextIdentifierOrStar()
{
$next = $this->getNext();
if ($next->isIdentifier()) {
return $next->getValue();
}
if ($next->isDelimiter(['*'])) {
return;
}
throw SyntaxErrorException::unexpectedToken('identifier or "*"', $next);
} | php | public function getNextIdentifierOrStar()
{
$next = $this->getNext();
if ($next->isIdentifier()) {
return $next->getValue();
}
if ($next->isDelimiter(['*'])) {
return;
}
throw SyntaxErrorException::unexpectedToken('identifier or "*"', $next);
} | [
"public",
"function",
"getNextIdentifierOrStar",
"(",
")",
"{",
"$",
"next",
"=",
"$",
"this",
"->",
"getNext",
"(",
")",
";",
"if",
"(",
"$",
"next",
"->",
"isIdentifier",
"(",
")",
")",
"{",
"return",
"$",
"next",
"->",
"getValue",
"(",
")",
";",
... | Returns nex identifier or star delimiter token.
@return string|null The identifier token value or null if star found
@throws SyntaxErrorException If next token is not an identifier or a star delimiter | [
"Returns",
"nex",
"identifier",
"or",
"star",
"delimiter",
"token",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/CssSelector/Parser/TokenStream.php#L149-L162 | train | Returns the next identifier or star token. | [
30522,
2270,
3853,
2131,
2638,
18413,
5178,
16778,
8873,
10624,
12096,
2906,
1006,
1007,
1063,
1002,
2279,
1027,
1002,
2023,
1011,
1028,
2131,
2638,
18413,
1006,
1007,
1025,
2065,
1006,
1002,
2279,
1011,
1028,
2003,
5178,
16778,
8873,
2121,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/HTML/Common2.php | HTML_Common2.getOption | public static function getOption($name = null)
{
if (null === $name) {
return self::$_options;
} else {
return isset(self::$_options[$name])? self::$_options[$name]: null;
}
} | php | public static function getOption($name = null)
{
if (null === $name) {
return self::$_options;
} else {
return isset(self::$_options[$name])? self::$_options[$name]: null;
}
} | [
"public",
"static",
"function",
"getOption",
"(",
"$",
"name",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"name",
")",
"{",
"return",
"self",
"::",
"$",
"_options",
";",
"}",
"else",
"{",
"return",
"isset",
"(",
"self",
"::",
"$",
"_opti... | Returns global option(s)
@param string Option name
@return mixed Option value, null if option does not exist,
array of all options if $name is not given | [
"Returns",
"global",
"option",
"(",
"s",
")"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/HTML/Common2.php#L130-L137 | train | Get option value | [
30522,
2270,
10763,
3853,
2131,
7361,
3508,
1006,
1002,
2171,
1027,
19701,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
1027,
1002,
2171,
1007,
1063,
2709,
2969,
1024,
1024,
1002,
1035,
7047,
1025,
1065,
2842,
1063,
2709,
26354,
3388,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getgrav/grav | system/src/Grav/Framework/Form/Traits/FormTrait.php | FormTrait.decodeData | protected function decodeData($data): array
{
if (!\is_array($data)) {
return [];
}
// Decode JSON encoded fields and merge them to data.
if (isset($data['_json'])) {
$data = array_replace_recursive($data, $this->jsonDecode($data['_json']));
unset($data['_json']);
}
return $data;
} | php | protected function decodeData($data): array
{
if (!\is_array($data)) {
return [];
}
// Decode JSON encoded fields and merge them to data.
if (isset($data['_json'])) {
$data = array_replace_recursive($data, $this->jsonDecode($data['_json']));
unset($data['_json']);
}
return $data;
} | [
"protected",
"function",
"decodeData",
"(",
"$",
"data",
")",
":",
"array",
"{",
"if",
"(",
"!",
"\\",
"is_array",
"(",
"$",
"data",
")",
")",
"{",
"return",
"[",
"]",
";",
"}",
"// Decode JSON encoded fields and merge them to data.",
"if",
"(",
"isset",
"... | Decode POST data
@param array $data
@return array | [
"Decode",
"POST",
"data"
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Framework/Form/Traits/FormTrait.php#L554-L567 | train | Decode data from array | [
30522,
5123,
3853,
21933,
5732,
6790,
1006,
1002,
2951,
1007,
1024,
9140,
1063,
2065,
1006,
999,
1032,
2003,
1035,
9140,
1006,
1002,
2951,
1007,
1007,
1063,
2709,
1031,
1033,
1025,
1065,
1013,
1013,
21933,
3207,
1046,
3385,
12359,
4249,
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/Console/Kernel.php | Kernel.load | protected function load($paths)
{
$paths = array_unique(Arr::wrap($paths));
$paths = array_filter($paths, function ($path) {
return is_dir($path);
});
if (empty($paths)) {
return;
}
$namespace = $this->app->getNamespace();
foreach ((new Finder)->in($paths)->files() as $command) {
$command = $namespace.str_replace(
['/', '.php'],
['\\', ''],
Str::after($command->getPathname(), realpath(app_path()).DIRECTORY_SEPARATOR)
);
if (is_subclass_of($command, Command::class) &&
! (new ReflectionClass($command))->isAbstract()) {
Artisan::starting(function ($artisan) use ($command) {
$artisan->resolve($command);
});
}
}
} | php | protected function load($paths)
{
$paths = array_unique(Arr::wrap($paths));
$paths = array_filter($paths, function ($path) {
return is_dir($path);
});
if (empty($paths)) {
return;
}
$namespace = $this->app->getNamespace();
foreach ((new Finder)->in($paths)->files() as $command) {
$command = $namespace.str_replace(
['/', '.php'],
['\\', ''],
Str::after($command->getPathname(), realpath(app_path()).DIRECTORY_SEPARATOR)
);
if (is_subclass_of($command, Command::class) &&
! (new ReflectionClass($command))->isAbstract()) {
Artisan::starting(function ($artisan) use ($command) {
$artisan->resolve($command);
});
}
}
} | [
"protected",
"function",
"load",
"(",
"$",
"paths",
")",
"{",
"$",
"paths",
"=",
"array_unique",
"(",
"Arr",
"::",
"wrap",
"(",
"$",
"paths",
")",
")",
";",
"$",
"paths",
"=",
"array_filter",
"(",
"$",
"paths",
",",
"function",
"(",
"$",
"path",
")... | Register all of the commands in the given directory.
@param array|string $paths
@return void | [
"Register",
"all",
"of",
"the",
"commands",
"in",
"the",
"given",
"directory",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Foundation/Console/Kernel.php#L209-L237 | train | Load all commands in the given paths | [
30522,
5123,
3853,
7170,
1006,
1002,
10425,
1007,
1063,
1002,
10425,
1027,
9140,
1035,
4310,
1006,
12098,
2099,
1024,
1024,
10236,
1006,
1002,
10425,
1007,
1007,
1025,
1002,
10425,
1027,
9140,
1035,
11307,
1006,
1002,
10425,
1010,
3853,
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/Cache/Adapter/TagAwareAdapter.php | TagAwareAdapter.hasItem | public function hasItem($key)
{
if ($this->deferred) {
$this->commit();
}
if (!$this->pool->hasItem($key)) {
return false;
}
if (!$itemTags = $this->pool->getItem(static::TAGS_PREFIX.$key)->get()) {
return true;
}
foreach ($this->getTagVersions([$itemTags]) as $tag => $version) {
if ($itemTags[$tag] !== $version && 1 !== $itemTags[$tag] - $version) {
return false;
}
}
return true;
} | php | public function hasItem($key)
{
if ($this->deferred) {
$this->commit();
}
if (!$this->pool->hasItem($key)) {
return false;
}
if (!$itemTags = $this->pool->getItem(static::TAGS_PREFIX.$key)->get()) {
return true;
}
foreach ($this->getTagVersions([$itemTags]) as $tag => $version) {
if ($itemTags[$tag] !== $version && 1 !== $itemTags[$tag] - $version) {
return false;
}
}
return true;
} | [
"public",
"function",
"hasItem",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"deferred",
")",
"{",
"$",
"this",
"->",
"commit",
"(",
")",
";",
"}",
"if",
"(",
"!",
"$",
"this",
"->",
"pool",
"->",
"hasItem",
"(",
"$",
"key",
")",
... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php#L155-L174 | train | Has Item? | [
30522,
2270,
3853,
2038,
4221,
2213,
1006,
1002,
3145,
1007,
1063,
2065,
1006,
1002,
2023,
1011,
1028,
13366,
28849,
2094,
1007,
1063,
1002,
2023,
1011,
1028,
10797,
1006,
1007,
1025,
1065,
2065,
1006,
999,
1002,
2023,
1011,
1028,
4770,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/Dashboard/API.php | API.resetDashboardLayout | public function resetDashboardLayout($idDashboard, $login='')
{
$login = $login ? $login : Piwik::getCurrentUserLogin();
Piwik::checkUserHasSuperUserAccessOrIsTheUser($login);
$layout = $this->dashboard->getDefaultLayout();
$this->model->updateLayoutForUser($login, $idDashboard, $layout);
} | php | public function resetDashboardLayout($idDashboard, $login='')
{
$login = $login ? $login : Piwik::getCurrentUserLogin();
Piwik::checkUserHasSuperUserAccessOrIsTheUser($login);
$layout = $this->dashboard->getDefaultLayout();
$this->model->updateLayoutForUser($login, $idDashboard, $layout);
} | [
"public",
"function",
"resetDashboardLayout",
"(",
"$",
"idDashboard",
",",
"$",
"login",
"=",
"''",
")",
"{",
"$",
"login",
"=",
"$",
"login",
"?",
"$",
"login",
":",
"Piwik",
"::",
"getCurrentUserLogin",
"(",
")",
";",
"Piwik",
"::",
"checkUserHasSuperUs... | Resets a dashboard to the default widget configuration
Note: Only a super user is able to reset dashboards for other users
@param int $idDashboard dashboard id
@param string $login user the dashboard belongs | [
"Resets",
"a",
"dashboard",
"to",
"the",
"default",
"widget",
"configuration"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Dashboard/API.php#L151-L160 | train | Reset the dashboard layout to the default one. | [
30522,
2270,
3853,
25141,
8883,
2232,
6277,
8485,
5833,
1006,
1002,
8909,
8883,
2232,
6277,
1010,
1002,
8833,
2378,
1027,
1005,
1005,
1007,
1063,
1002,
8833,
2378,
1027,
1002,
8833,
2378,
1029,
1002,
8833,
2378,
1024,
14255,
9148,
2243,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getgrav/grav | system/src/Grav/Common/Page/Pages.php | Pages.sort | public function sort(PageInterface $page, $order_by = null, $order_dir = null, $sort_flags = null)
{
if ($order_by === null) {
$order_by = $page->orderBy();
}
if ($order_dir === null) {
$order_dir = $page->orderDir();
}
$path = $page->path();
$children = $this->children[$path] ?? [];
if (!$children) {
return $children;
}
if (!isset($this->sort[$path][$order_by])) {
$this->buildSort($path, $children, $order_by, $page->orderManual(), $sort_flags);
}
$sort = $this->sort[$path][$order_by];
if ($order_dir !== 'asc') {
$sort = array_reverse($sort);
}
return $sort;
} | php | public function sort(PageInterface $page, $order_by = null, $order_dir = null, $sort_flags = null)
{
if ($order_by === null) {
$order_by = $page->orderBy();
}
if ($order_dir === null) {
$order_dir = $page->orderDir();
}
$path = $page->path();
$children = $this->children[$path] ?? [];
if (!$children) {
return $children;
}
if (!isset($this->sort[$path][$order_by])) {
$this->buildSort($path, $children, $order_by, $page->orderManual(), $sort_flags);
}
$sort = $this->sort[$path][$order_by];
if ($order_dir !== 'asc') {
$sort = array_reverse($sort);
}
return $sort;
} | [
"public",
"function",
"sort",
"(",
"PageInterface",
"$",
"page",
",",
"$",
"order_by",
"=",
"null",
",",
"$",
"order_dir",
"=",
"null",
",",
"$",
"sort_flags",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"order_by",
"===",
"null",
")",
"{",
"$",
"order_by... | Sort sub-pages in a page.
@param PageInterface $page
@param string $order_by
@param string $order_dir
@return array | [
"Sort",
"sub",
"-",
"pages",
"in",
"a",
"page",
"."
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Pages.php#L323-L350 | train | Sort a page | [
30522,
2270,
3853,
4066,
1006,
3931,
18447,
2121,
12172,
1002,
3931,
1010,
1002,
30524,
1007,
1025,
1065,
2065,
1006,
1002,
2344,
1035,
16101,
1027,
1027,
1027,
19701,
1007,
1063,
1002,
2344,
1035,
16101,
1027,
1002,
3931,
1011,
1028,
2344,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
slimphp/Slim | Slim/Http/Response.php | Response.withHeader | public function withHeader($name, $value)
{
$clone = clone $this;
$clone->headers->set($name, $value);
if ($this->body instanceof NonBufferedBody) {
header(sprintf('%s: %s', $name, $clone->getHeaderLine($name)));
}
if ($clone->getStatusCode() === StatusCode::HTTP_OK && strtolower($name) === 'location') {
$clone = $clone->withStatus(StatusCode::HTTP_FOUND);
}
return $clone;
} | php | public function withHeader($name, $value)
{
$clone = clone $this;
$clone->headers->set($name, $value);
if ($this->body instanceof NonBufferedBody) {
header(sprintf('%s: %s', $name, $clone->getHeaderLine($name)));
}
if ($clone->getStatusCode() === StatusCode::HTTP_OK && strtolower($name) === 'location') {
$clone = $clone->withStatus(StatusCode::HTTP_FOUND);
}
return $clone;
} | [
"public",
"function",
"withHeader",
"(",
"$",
"name",
",",
"$",
"value",
")",
"{",
"$",
"clone",
"=",
"clone",
"$",
"this",
";",
"$",
"clone",
"->",
"headers",
"->",
"set",
"(",
"$",
"name",
",",
"$",
"value",
")",
";",
"if",
"(",
"$",
"this",
... | Return an instance with the provided value replacing the specified header.
If a Location header is set and the status code is 200, then set the status
code to 302 to mimic what PHP does. See https://github.com/slimphp/Slim/issues/1730
@param string $name Case-insensitive header field name.
@param string|string[] $value Header value(s).
@return static
@throws InvalidArgumentException For invalid header names or values. | [
"Return",
"an",
"instance",
"with",
"the",
"provided",
"value",
"replacing",
"the",
"specified",
"header",
"."
] | ccef5f7d8bcd469d59cbe64f6210d83764f91543 | https://github.com/slimphp/Slim/blob/ccef5f7d8bcd469d59cbe64f6210d83764f91543/Slim/Http/Response.php#L271-L285 | train | Return an instance with the specified header value | [
30522,
2270,
3853,
2007,
4974,
2121,
1006,
1002,
2171,
1010,
1002,
3643,
1007,
1063,
1002,
17598,
1027,
17598,
1002,
2023,
1025,
1002,
17598,
1011,
1028,
20346,
2015,
1011,
1028,
2275,
1006,
1002,
2171,
1010,
1002,
3643,
1007,
1025,
2065,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/DependencyInjection/ReverseContainer.php | ReverseContainer.getService | public function getService(string $id)
{
if ($this->serviceContainer->has($id)) {
return $this->serviceContainer->get($id);
}
if ($this->reversibleLocator->has($id)) {
return $this->reversibleLocator->get($id);
}
if (isset($this->serviceContainer->getRemovedIds()[$id])) {
throw new ServiceNotFoundException($id, null, null, [], sprintf('The "%s" service is private and cannot be accessed by reference. You should either make it public, or tag it as "%s".', $id, $this->tagName));
}
// will throw a ServiceNotFoundException
$this->serviceContainer->get($id);
} | php | public function getService(string $id)
{
if ($this->serviceContainer->has($id)) {
return $this->serviceContainer->get($id);
}
if ($this->reversibleLocator->has($id)) {
return $this->reversibleLocator->get($id);
}
if (isset($this->serviceContainer->getRemovedIds()[$id])) {
throw new ServiceNotFoundException($id, null, null, [], sprintf('The "%s" service is private and cannot be accessed by reference. You should either make it public, or tag it as "%s".', $id, $this->tagName));
}
// will throw a ServiceNotFoundException
$this->serviceContainer->get($id);
} | [
"public",
"function",
"getService",
"(",
"string",
"$",
"id",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"serviceContainer",
"->",
"has",
"(",
"$",
"id",
")",
")",
"{",
"return",
"$",
"this",
"->",
"serviceContainer",
"->",
"get",
"(",
"$",
"id",
")",
... | @return object
@throws ServiceNotFoundException When the service is not reversible | [
"@return",
"object"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DependencyInjection/ReverseContainer.php#L68-L84 | train | Get a service from the container | [
30522,
2270,
3853,
4152,
2121,
7903,
2063,
1006,
5164,
1002,
8909,
1007,
1063,
2065,
1006,
1002,
2023,
1011,
1028,
2326,
8663,
18249,
2121,
1011,
1028,
2038,
1006,
1002,
30524,
7065,
2545,
7028,
4135,
11266,
2953,
1011,
1028,
2038,
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... |
overtrue/wechat | src/OfficialAccount/Material/Client.php | Client.uploadArticle | public function uploadArticle($articles)
{
if ($articles instanceof Article || !empty($articles['title'])) {
$articles = [$articles];
}
$params = ['articles' => array_map(function ($article) {
if ($article instanceof Article) {
return $article->transformForJsonRequestWithoutType();
}
return $article;
}, $articles)];
return $this->httpPostJson('cgi-bin/material/add_news', $params);
} | php | public function uploadArticle($articles)
{
if ($articles instanceof Article || !empty($articles['title'])) {
$articles = [$articles];
}
$params = ['articles' => array_map(function ($article) {
if ($article instanceof Article) {
return $article->transformForJsonRequestWithoutType();
}
return $article;
}, $articles)];
return $this->httpPostJson('cgi-bin/material/add_news', $params);
} | [
"public",
"function",
"uploadArticle",
"(",
"$",
"articles",
")",
"{",
"if",
"(",
"$",
"articles",
"instanceof",
"Article",
"||",
"!",
"empty",
"(",
"$",
"articles",
"[",
"'title'",
"]",
")",
")",
"{",
"$",
"articles",
"=",
"[",
"$",
"articles",
"]",
... | Upload articles.
@param array|Article $articles
@return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string
@throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException | [
"Upload",
"articles",
"."
] | 120c72faaa93c270365bc75c73c362d5fd583209 | https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/OfficialAccount/Material/Client.php#L108-L123 | train | Upload Article to Material | [
30522,
2270,
3853,
2039,
11066,
8445,
25128,
1006,
1002,
4790,
1007,
1063,
2065,
1006,
1002,
4790,
6013,
11253,
3720,
1064,
1064,
999,
4064,
1006,
1002,
4790,
1031,
1005,
2516,
1005,
1033,
1007,
1007,
1063,
1002,
4790,
1027,
1031,
1002,
4... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Mail/Mailer.php | Mailer.sendSwiftMessage | protected function sendSwiftMessage($message)
{
try {
return $this->swift->send($message, $this->failedRecipients);
} finally {
$this->forceReconnection();
}
} | php | protected function sendSwiftMessage($message)
{
try {
return $this->swift->send($message, $this->failedRecipients);
} finally {
$this->forceReconnection();
}
} | [
"protected",
"function",
"sendSwiftMessage",
"(",
"$",
"message",
")",
"{",
"try",
"{",
"return",
"$",
"this",
"->",
"swift",
"->",
"send",
"(",
"$",
"message",
",",
"$",
"this",
"->",
"failedRecipients",
")",
";",
"}",
"finally",
"{",
"$",
"this",
"->... | Send a Swift Message instance.
@param \Swift_Message $message
@return int|null | [
"Send",
"a",
"Swift",
"Message",
"instance",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Mail/Mailer.php#L481-L488 | train | Send Swift Message | [
30522,
5123,
3853,
10255,
9148,
6199,
7834,
3736,
3351,
1006,
1002,
4471,
1007,
1063,
3046,
1063,
2709,
1002,
2023,
1011,
1028,
9170,
1011,
1028,
4604,
1006,
1002,
4471,
1010,
1002,
2023,
1011,
1028,
3478,
2890,
6895,
14756,
7666,
1007,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Form/Extension/Core/DataTransformer/BooleanToStringTransformer.php | BooleanToStringTransformer.reverseTransform | public function reverseTransform($value)
{
if (\in_array($value, $this->falseValues, true)) {
return false;
}
if (!\is_string($value)) {
throw new TransformationFailedException('Expected a string.');
}
return true;
} | php | public function reverseTransform($value)
{
if (\in_array($value, $this->falseValues, true)) {
return false;
}
if (!\is_string($value)) {
throw new TransformationFailedException('Expected a string.');
}
return true;
} | [
"public",
"function",
"reverseTransform",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"\\",
"in_array",
"(",
"$",
"value",
",",
"$",
"this",
"->",
"falseValues",
",",
"true",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"!",
"\\",
"is_string",
... | Transforms a string into a Boolean.
@param string $value String value
@return bool Boolean value
@throws TransformationFailedException if the given value is not a string | [
"Transforms",
"a",
"string",
"into",
"a",
"Boolean",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Extension/Core/DataTransformer/BooleanToStringTransformer.php#L74-L85 | train | Transforms a string into a boolean value. | [
30522,
2270,
3853,
7901,
6494,
3619,
14192,
1006,
1002,
3643,
1007,
1063,
2065,
1006,
1032,
1999,
1035,
9140,
1006,
1002,
3643,
1010,
1002,
2023,
1011,
1028,
6270,
10175,
15808,
1010,
2995,
1007,
1007,
1063,
2709,
6270,
1025,
1065,
2065,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/system/controllers/Updates.php | Updates.onInstallPlugin | public function onInstallPlugin()
{
try {
if (!$code = trim(post('code'))) {
throw new ApplicationException(Lang::get('system::lang.install.missing_plugin_name'));
}
$manager = UpdateManager::instance();
$result = $manager->requestPluginDetails($code);
if (!isset($result['code']) || !isset($result['hash'])) {
throw new ApplicationException(Lang::get('system::lang.server.response_invalid'));
}
$name = $result['code'];
$hash = $result['hash'];
$plugins = [$name => $hash];
$plugins = $this->appendRequiredPlugins($plugins, $result);
/*
* Update steps
*/
$updateSteps = $this->buildUpdateSteps(null, $plugins, [], true);
/*
* Finish up
*/
$updateSteps[] = [
'code' => 'completeInstall',
'label' => Lang::get('system::lang.install.install_completing'),
];
$this->vars['updateSteps'] = $updateSteps;
return $this->makePartial('execute');
}
catch (Exception $ex) {
$this->handleError($ex);
return $this->makePartial('plugin_form');
}
} | php | public function onInstallPlugin()
{
try {
if (!$code = trim(post('code'))) {
throw new ApplicationException(Lang::get('system::lang.install.missing_plugin_name'));
}
$manager = UpdateManager::instance();
$result = $manager->requestPluginDetails($code);
if (!isset($result['code']) || !isset($result['hash'])) {
throw new ApplicationException(Lang::get('system::lang.server.response_invalid'));
}
$name = $result['code'];
$hash = $result['hash'];
$plugins = [$name => $hash];
$plugins = $this->appendRequiredPlugins($plugins, $result);
/*
* Update steps
*/
$updateSteps = $this->buildUpdateSteps(null, $plugins, [], true);
/*
* Finish up
*/
$updateSteps[] = [
'code' => 'completeInstall',
'label' => Lang::get('system::lang.install.install_completing'),
];
$this->vars['updateSteps'] = $updateSteps;
return $this->makePartial('execute');
}
catch (Exception $ex) {
$this->handleError($ex);
return $this->makePartial('plugin_form');
}
} | [
"public",
"function",
"onInstallPlugin",
"(",
")",
"{",
"try",
"{",
"if",
"(",
"!",
"$",
"code",
"=",
"trim",
"(",
"post",
"(",
"'code'",
")",
")",
")",
"{",
"throw",
"new",
"ApplicationException",
"(",
"Lang",
"::",
"get",
"(",
"'system::lang.install.mi... | Validate the plugin code and execute the plugin installation | [
"Validate",
"the",
"plugin",
"code",
"and",
"execute",
"the",
"plugin",
"installation"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/controllers/Updates.php#L699-L739 | train | Install plugin action | [
30522,
2270,
3853,
2006,
7076,
9080,
14277,
7630,
11528,
1006,
1007,
1063,
3046,
1063,
2065,
1006,
999,
1002,
3642,
1027,
12241,
1006,
2695,
1006,
1005,
3642,
1005,
1007,
1007,
1007,
1063,
5466,
2047,
4646,
10288,
24422,
1006,
11374,
1024,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php | HasAttributes.only | public function only($attributes)
{
$results = [];
foreach (is_array($attributes) ? $attributes : func_get_args() as $attribute) {
$results[$attribute] = $this->getAttribute($attribute);
}
return $results;
} | php | public function only($attributes)
{
$results = [];
foreach (is_array($attributes) ? $attributes : func_get_args() as $attribute) {
$results[$attribute] = $this->getAttribute($attribute);
}
return $results;
} | [
"public",
"function",
"only",
"(",
"$",
"attributes",
")",
"{",
"$",
"results",
"=",
"[",
"]",
";",
"foreach",
"(",
"is_array",
"(",
"$",
"attributes",
")",
"?",
"$",
"attributes",
":",
"func_get_args",
"(",
")",
"as",
"$",
"attribute",
")",
"{",
"$"... | Get a subset of the model's attributes.
@param array|mixed $attributes
@return array | [
"Get",
"a",
"subset",
"of",
"the",
"model",
"s",
"attributes",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php#L989-L998 | train | Return all attributes | [
30522,
2270,
3853,
2069,
1006,
1002,
12332,
1007,
1063,
1002,
3463,
1027,
1031,
1033,
1025,
18921,
6776,
1006,
2003,
1035,
9140,
1006,
1002,
12332,
1007,
1029,
1002,
12332,
1024,
4569,
2278,
1035,
2131,
1035,
12098,
5620,
1006,
1007,
2004,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/Zend/Config.php | Zend_Config.merge | public function merge(Zend_Config $merge)
{
foreach($merge as $key => $item) {
if(array_key_exists($key, $this->_data)) {
if($item instanceof Zend_Config && $this->$key instanceof Zend_Config) {
$this->$key = $this->$key->merge(new Zend_Config($item->toArray(), !$this->readOnly()));
} else {
$this->$key = $item;
}
} else {
if($item instanceof Zend_Config) {
$this->$key = new Zend_Config($item->toArray(), !$this->readOnly());
} else {
$this->$key = $item;
}
}
}
return $this;
} | php | public function merge(Zend_Config $merge)
{
foreach($merge as $key => $item) {
if(array_key_exists($key, $this->_data)) {
if($item instanceof Zend_Config && $this->$key instanceof Zend_Config) {
$this->$key = $this->$key->merge(new Zend_Config($item->toArray(), !$this->readOnly()));
} else {
$this->$key = $item;
}
} else {
if($item instanceof Zend_Config) {
$this->$key = new Zend_Config($item->toArray(), !$this->readOnly());
} else {
$this->$key = $item;
}
}
}
return $this;
} | [
"public",
"function",
"merge",
"(",
"Zend_Config",
"$",
"merge",
")",
"{",
"foreach",
"(",
"$",
"merge",
"as",
"$",
"key",
"=>",
"$",
"item",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"key",
",",
"$",
"this",
"->",
"_data",
")",
")",
"{",
... | Merge another Zend_Config with this one. The items
in $merge will override the same named items in
the current config.
@param Zend_Config $merge
@return Zend_Config | [
"Merge",
"another",
"Zend_Config",
"with",
"this",
"one",
".",
"The",
"items",
"in",
"$merge",
"will",
"override",
"the",
"same",
"named",
"items",
"in",
"the",
"current",
"config",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Config.php#L341-L360 | train | Merge a Zend_Config with this one | [
30522,
2270,
3853,
13590,
1006,
16729,
2094,
1035,
9530,
8873,
2290,
1002,
13590,
1007,
1063,
18921,
6776,
1006,
1002,
13590,
2004,
1002,
3145,
1027,
1028,
1002,
8875,
1007,
1063,
2065,
1006,
9140,
1035,
3145,
1035,
6526,
1006,
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... |
matomo-org/matomo | plugins/VisitorInterest/API.php | API.getNumberOfVisitsByDaysSinceLast | public function getNumberOfVisitsByDaysSinceLast($idSite, $period, $date, $segment = false)
{
$dataTable = $this->getDataTable(
Archiver::DAYS_SINCE_LAST_RECORD_NAME, $idSite, $period, $date, $segment, Metrics::INDEX_NB_VISITS);
$dataTable->queueFilter('AddSegmentByRangeLabel', array('daysSinceLastVisit'));
$dataTable->queueFilter('BeautifyRangeLabels', array(Piwik::translate('Intl_OneDay'), Piwik::translate('Intl_NDays')));
return $dataTable;
} | php | public function getNumberOfVisitsByDaysSinceLast($idSite, $period, $date, $segment = false)
{
$dataTable = $this->getDataTable(
Archiver::DAYS_SINCE_LAST_RECORD_NAME, $idSite, $period, $date, $segment, Metrics::INDEX_NB_VISITS);
$dataTable->queueFilter('AddSegmentByRangeLabel', array('daysSinceLastVisit'));
$dataTable->queueFilter('BeautifyRangeLabels', array(Piwik::translate('Intl_OneDay'), Piwik::translate('Intl_NDays')));
return $dataTable;
} | [
"public",
"function",
"getNumberOfVisitsByDaysSinceLast",
"(",
"$",
"idSite",
",",
"$",
"period",
",",
"$",
"date",
",",
"$",
"segment",
"=",
"false",
")",
"{",
"$",
"dataTable",
"=",
"$",
"this",
"->",
"getDataTable",
"(",
"Archiver",
"::",
"DAYS_SINCE_LAST... | Returns a DataTable that associates counts of days (N) with the count of visits that
occurred within N days of the last visit.
@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.
@return DataTable the archived report data. | [
"Returns",
"a",
"DataTable",
"that",
"associates",
"counts",
"of",
"days",
"(",
"N",
")",
"with",
"the",
"count",
"of",
"visits",
"that",
"occurred",
"within",
"N",
"days",
"of",
"the",
"last",
"visit",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/VisitorInterest/API.php#L66-L73 | train | Returns the number of visits that are in the last range of days since the last visit. | [
30522,
2270,
3853,
2131,
19172,
5677,
11253,
11365,
12762,
3762,
10259,
18719,
5897,
8523,
2102,
1006,
1002,
8909,
28032,
2063,
1010,
1002,
2558,
1010,
1002,
3058,
1010,
1002,
6903,
1027,
6270,
1007,
1063,
1002,
2951,
10880,
1027,
1002,
202... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/DependencyInjection/ConfigurableExtension.php | ConfigurableExtension.load | final public function load(array $configs, ContainerBuilder $container)
{
$this->loadInternal($this->processConfiguration($this->getConfiguration($configs, $container), $configs), $container);
} | php | final public function load(array $configs, ContainerBuilder $container)
{
$this->loadInternal($this->processConfiguration($this->getConfiguration($configs, $container), $configs), $container);
} | [
"final",
"public",
"function",
"load",
"(",
"array",
"$",
"configs",
",",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"this",
"->",
"loadInternal",
"(",
"$",
"this",
"->",
"processConfiguration",
"(",
"$",
"this",
"->",
"getConfiguration",
"(",
"$",... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/DependencyInjection/ConfigurableExtension.php#L33-L36 | train | Loads the current configuration into the container. | [
30522,
2345,
2270,
3853,
7170,
1006,
9140,
1002,
9530,
8873,
5620,
30524,
1006,
1002,
2023,
1011,
1028,
2131,
8663,
8873,
27390,
3370,
1006,
1002,
9530,
8873,
5620,
1010,
1002,
11661,
1007,
1010,
1002,
9530,
8873,
5620,
1007,
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... |
matomo-org/matomo | plugins/CoreAdminHome/Model/DuplicateActionRemover.php | DuplicateActionRemover.getDuplicateIdActions | public function getDuplicateIdActions()
{
$sql = "SELECT name, COUNT(*) AS count, GROUP_CONCAT(idaction ORDER BY idaction ASC SEPARATOR ',') as idactions
FROM " . Common::prefixTable('log_action') . "
GROUP BY name, hash, type HAVING count > 1";
$result = array();
foreach (Db::fetchAll($sql) as $row) {
$dupeInfo = array('name' => $row['name']);
$idActions = explode(",", $row['idactions']);
$dupeInfo['idaction'] = array_shift($idActions);
$dupeInfo['duplicateIdActions'] = $idActions;
$result[] = $dupeInfo;
}
return $result;
} | php | public function getDuplicateIdActions()
{
$sql = "SELECT name, COUNT(*) AS count, GROUP_CONCAT(idaction ORDER BY idaction ASC SEPARATOR ',') as idactions
FROM " . Common::prefixTable('log_action') . "
GROUP BY name, hash, type HAVING count > 1";
$result = array();
foreach (Db::fetchAll($sql) as $row) {
$dupeInfo = array('name' => $row['name']);
$idActions = explode(",", $row['idactions']);
$dupeInfo['idaction'] = array_shift($idActions);
$dupeInfo['duplicateIdActions'] = $idActions;
$result[] = $dupeInfo;
}
return $result;
} | [
"public",
"function",
"getDuplicateIdActions",
"(",
")",
"{",
"$",
"sql",
"=",
"\"SELECT name, COUNT(*) AS count, GROUP_CONCAT(idaction ORDER BY idaction ASC SEPARATOR ',') as idactions\n FROM \"",
".",
"Common",
"::",
"prefixTable",
"(",
"'log_action'",
")",
".",
... | Returns list of all duplicate actions in the log_action table by name and the lowest action ID.
The duplicate actions are returned with each action.
@return array Contains the following elements:
* **name**: The action's name.
* **idaction**: The action's ID.
* **duplicateIdActions**: An array of duplicate action IDs. | [
"Returns",
"list",
"of",
"all",
"duplicate",
"actions",
"in",
"the",
"log_action",
"table",
"by",
"name",
"and",
"the",
"lowest",
"action",
"ID",
".",
"The",
"duplicate",
"actions",
"are",
"returned",
"with",
"each",
"action",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/CoreAdminHome/Model/DuplicateActionRemover.php#L75-L92 | train | Get duplicate id actions | [
30522,
2270,
3853,
2131,
8566,
24759,
24695,
8524,
22014,
1006,
1007,
1063,
1002,
29296,
1027,
1000,
7276,
2171,
1010,
4175,
1006,
1008,
1007,
2004,
4175,
1010,
2177,
1035,
9530,
11266,
1006,
16096,
7542,
2344,
2011,
16096,
7542,
2004,
2278... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/Tracker/PageUrl.php | PageUrl.normalizeUrl | public static function normalizeUrl($url)
{
foreach (self::$urlPrefixMap as $prefix => $id) {
if (strtolower(substr($url, 0, strlen($prefix))) == $prefix) {
return array(
'url' => substr($url, strlen($prefix)),
'prefixId' => $id
);
}
}
return array('url' => $url, 'prefixId' => null);
} | php | public static function normalizeUrl($url)
{
foreach (self::$urlPrefixMap as $prefix => $id) {
if (strtolower(substr($url, 0, strlen($prefix))) == $prefix) {
return array(
'url' => substr($url, strlen($prefix)),
'prefixId' => $id
);
}
}
return array('url' => $url, 'prefixId' => null);
} | [
"public",
"static",
"function",
"normalizeUrl",
"(",
"$",
"url",
")",
"{",
"foreach",
"(",
"self",
"::",
"$",
"urlPrefixMap",
"as",
"$",
"prefix",
"=>",
"$",
"id",
")",
"{",
"if",
"(",
"strtolower",
"(",
"substr",
"(",
"$",
"url",
",",
"0",
",",
"s... | Extract the prefix from a URL.
Return the prefix ID and the rest.
@param string $url
@return array | [
"Extract",
"the",
"prefix",
"from",
"a",
"URL",
".",
"Return",
"the",
"prefix",
"ID",
"and",
"the",
"rest",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Tracker/PageUrl.php#L339-L351 | train | Normalize URL to prefix | [
30522,
2270,
10763,
3853,
3671,
4697,
3126,
2140,
1006,
1002,
24471,
2140,
1007,
1063,
18921,
6776,
1006,
2969,
1024,
1024,
1002,
24471,
14277,
2890,
8873,
2595,
2863,
2361,
2004,
1002,
17576,
1027,
1028,
1002,
8909,
1007,
1063,
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... |
laravel/framework | src/Illuminate/Database/Eloquent/Builder.php | Builder.eagerLoadRelation | protected function eagerLoadRelation(array $models, $name, Closure $constraints)
{
// First we will "back up" the existing where conditions on the query so we can
// add our eager constraints. Then we will merge the wheres that were on the
// query back to it in order that any where conditions might be specified.
$relation = $this->getRelation($name);
$relation->addEagerConstraints($models);
$constraints($relation);
// Once we have the results, we just match those back up to their parent models
// using the relationship instance. Then we just return the finished arrays
// of models which have been eagerly hydrated and are readied for return.
return $relation->match(
$relation->initRelation($models, $name),
$relation->getEager(), $name
);
} | php | protected function eagerLoadRelation(array $models, $name, Closure $constraints)
{
// First we will "back up" the existing where conditions on the query so we can
// add our eager constraints. Then we will merge the wheres that were on the
// query back to it in order that any where conditions might be specified.
$relation = $this->getRelation($name);
$relation->addEagerConstraints($models);
$constraints($relation);
// Once we have the results, we just match those back up to their parent models
// using the relationship instance. Then we just return the finished arrays
// of models which have been eagerly hydrated and are readied for return.
return $relation->match(
$relation->initRelation($models, $name),
$relation->getEager(), $name
);
} | [
"protected",
"function",
"eagerLoadRelation",
"(",
"array",
"$",
"models",
",",
"$",
"name",
",",
"Closure",
"$",
"constraints",
")",
"{",
"// First we will \"back up\" the existing where conditions on the query so we can",
"// add our eager constraints. Then we will merge the wher... | Eagerly load the relationship on a set of models.
@param array $models
@param string $name
@param \Closure $constraints
@return array | [
"Eagerly",
"load",
"the",
"relationship",
"on",
"a",
"set",
"of",
"models",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Builder.php#L551-L569 | train | Eager loads a relationship. | [
30522,
5123,
3853,
9461,
11066,
16570,
3370,
1006,
9140,
1002,
4275,
1010,
1002,
2171,
1010,
8503,
1002,
14679,
1007,
1063,
1013,
1013,
2034,
2057,
2097,
1000,
2067,
2039,
30524,
1996,
2073,
2015,
2008,
2020,
2006,
1996,
1013,
1013,
23032,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Auth/AuthServiceProvider.php | AuthServiceProvider.registerEventRebindHandler | protected function registerEventRebindHandler()
{
$this->app->rebinding('events', function ($app, $dispatcher) {
if (! $app->resolved('auth')) {
return;
}
if (method_exists($guard = $app['auth']->guard(), 'setDispatcher')) {
$guard->setDispatcher($dispatcher);
}
});
} | php | protected function registerEventRebindHandler()
{
$this->app->rebinding('events', function ($app, $dispatcher) {
if (! $app->resolved('auth')) {
return;
}
if (method_exists($guard = $app['auth']->guard(), 'setDispatcher')) {
$guard->setDispatcher($dispatcher);
}
});
} | [
"protected",
"function",
"registerEventRebindHandler",
"(",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"rebinding",
"(",
"'events'",
",",
"function",
"(",
"$",
"app",
",",
"$",
"dispatcher",
")",
"{",
"if",
"(",
"!",
"$",
"app",
"->",
"resolved",
"(",
"... | Handle the re-binding of the event dispatcher binding.
@return void | [
"Handle",
"the",
"re",
"-",
"binding",
"of",
"the",
"event",
"dispatcher",
"binding",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Auth/AuthServiceProvider.php#L94-L105 | train | Register event rebind handler | [
30522,
5123,
3853,
4236,
18697,
3372,
2890,
8428,
17516,
30524,
1002,
10439,
1010,
1002,
18365,
2121,
1007,
1063,
2065,
1006,
999,
1002,
10439,
1011,
1028,
10395,
1006,
1005,
8740,
2705,
1005,
1007,
1007,
1063,
2709,
1025,
1065,
2065,
1006,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPass.php | RegisterEventListenersAndSubscribersPass.process | public function process(ContainerBuilder $container)
{
if (!$container->hasParameter($this->connections)) {
return;
}
$this->connections = $container->getParameter($this->connections);
$this->addTaggedSubscribers($container);
$this->addTaggedListeners($container);
} | php | public function process(ContainerBuilder $container)
{
if (!$container->hasParameter($this->connections)) {
return;
}
$this->connections = $container->getParameter($this->connections);
$this->addTaggedSubscribers($container);
$this->addTaggedListeners($container);
} | [
"public",
"function",
"process",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"if",
"(",
"!",
"$",
"container",
"->",
"hasParameter",
"(",
"$",
"this",
"->",
"connections",
")",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"connections",
"=",... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPass.php#L51-L60 | train | Process the container builder | [
30522,
2270,
3853,
2832,
1006,
11661,
8569,
23891,
2099,
1002,
11661,
1007,
1063,
2065,
1006,
999,
1002,
11661,
1011,
1028,
2038,
28689,
22828,
1006,
1002,
2023,
1011,
1028,
7264,
1007,
1007,
1063,
2709,
1025,
1065,
1002,
2023,
1011,
1028,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/CoreAdminHome/Tasks.php | Tasks.getSegmentHashesByIdSite | public function getSegmentHashesByIdSite()
{
//Get a list of hashes of all segments that exist now
$sql = "SELECT DISTINCT definition, enable_only_idsite FROM " . Common::prefixTable('segment')
. " WHERE deleted = 0";
$rows = Db::fetchAll($sql);
$segmentHashes = array();
foreach ($rows as $row) {
$idSite = (int)$row['enable_only_idsite'];
if (! isset($segmentHashes[$idSite])) {
$segmentHashes[$idSite] = array();
}
$segmentHashes[$idSite][] = Segment::getSegmentHash($row['definition']);
}
return $segmentHashes;
} | php | public function getSegmentHashesByIdSite()
{
//Get a list of hashes of all segments that exist now
$sql = "SELECT DISTINCT definition, enable_only_idsite FROM " . Common::prefixTable('segment')
. " WHERE deleted = 0";
$rows = Db::fetchAll($sql);
$segmentHashes = array();
foreach ($rows as $row) {
$idSite = (int)$row['enable_only_idsite'];
if (! isset($segmentHashes[$idSite])) {
$segmentHashes[$idSite] = array();
}
$segmentHashes[$idSite][] = Segment::getSegmentHash($row['definition']);
}
return $segmentHashes;
} | [
"public",
"function",
"getSegmentHashesByIdSite",
"(",
")",
"{",
"//Get a list of hashes of all segments that exist now",
"$",
"sql",
"=",
"\"SELECT DISTINCT definition, enable_only_idsite FROM \"",
".",
"Common",
"::",
"prefixTable",
"(",
"'segment'",
")",
".",
"\" WHERE delet... | Get a list of all segment hashes that currently exist, indexed by idSite.
@return array | [
"Get",
"a",
"list",
"of",
"all",
"segment",
"hashes",
"that",
"currently",
"exist",
"indexed",
"by",
"idSite",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/CoreAdminHome/Tasks.php#L294-L310 | train | Get a list of all segment hashes by site | [
30522,
2270,
3853,
4152,
13910,
3672,
14949,
15689,
3762,
9821,
4221,
1006,
1007,
1063,
1013,
1013,
2131,
1037,
2862,
1997,
23325,
2229,
1997,
2035,
9214,
2008,
4839,
2085,
1002,
29296,
1027,
1000,
7276,
5664,
6210,
1010,
9585,
1035,
2069,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/Zend/Validate/File/Extension.php | Zend_Validate_File_Extension.isValid | public function isValid($value, $file = null)
{
// Is file readable ?
// require_once 'Zend/Loader.php';
if (!Zend_Loader::isReadable($value)) {
return $this->_throw($file, self::NOT_FOUND);
}
if ($file !== null) {
$info['extension'] = substr($file['name'], strrpos($file['name'], '.') + 1);
} else {
$info = pathinfo($value);
}
$extensions = $this->getExtension();
if ($this->_case && (in_array($info['extension'], $extensions))) {
return true;
} else if (!$this->getCase()) {
foreach ($extensions as $extension) {
if (strtolower($extension) == strtolower($info['extension'])) {
return true;
}
}
}
return $this->_throw($file, self::FALSE_EXTENSION);
} | php | public function isValid($value, $file = null)
{
// Is file readable ?
// require_once 'Zend/Loader.php';
if (!Zend_Loader::isReadable($value)) {
return $this->_throw($file, self::NOT_FOUND);
}
if ($file !== null) {
$info['extension'] = substr($file['name'], strrpos($file['name'], '.') + 1);
} else {
$info = pathinfo($value);
}
$extensions = $this->getExtension();
if ($this->_case && (in_array($info['extension'], $extensions))) {
return true;
} else if (!$this->getCase()) {
foreach ($extensions as $extension) {
if (strtolower($extension) == strtolower($info['extension'])) {
return true;
}
}
}
return $this->_throw($file, self::FALSE_EXTENSION);
} | [
"public",
"function",
"isValid",
"(",
"$",
"value",
",",
"$",
"file",
"=",
"null",
")",
"{",
"// Is file readable ?",
"// require_once 'Zend/Loader.php';",
"if",
"(",
"!",
"Zend_Loader",
"::",
"isReadable",
"(",
"$",
"value",
")",
")",
"{",
"return",
"$",
"t... | Defined by Zend_Validate_Interface
Returns true if and only if the fileextension of $value is included in the
set extension list
@param string $value Real file to check for extension
@param array $file File data from Zend_File_Transfer
@return boolean | [
"Defined",
"by",
"Zend_Validate_Interface"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Validate/File/Extension.php#L187-L214 | train | Is file valid? | [
30522,
2270,
3853,
2003,
10175,
3593,
1006,
1002,
3643,
1010,
1002,
5371,
1027,
19701,
1007,
1063,
1013,
1013,
2003,
5371,
3191,
3085,
1029,
1013,
1013,
5478,
1035,
2320,
1005,
16729,
2094,
1013,
7170,
2121,
1012,
25718,
1005,
1025,
2065,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/cms/classes/CodeParser.php | CodeParser.rebuild | protected function rebuild($path)
{
$uniqueName = str_replace('.', '', uniqid('', true)).'_'.md5(mt_rand());
$className = 'Cms'.$uniqueName.'Class';
$body = $this->object->code;
$body = preg_replace('/^\s*function/m', 'public function', $body);
$codeNamespaces = [];
$pattern = '/(use\s+[a-z0-9_\\\\]+(\s+as\s+[a-z0-9_]+)?;\n?)/mi';
preg_match_all($pattern, $body, $namespaces);
$body = preg_replace($pattern, '', $body);
$parentClass = $this->object->getCodeClassParent();
if ($parentClass !== null) {
$parentClass = ' extends '.$parentClass;
}
$fileContents = '<?php '.PHP_EOL;
foreach ($namespaces[0] as $namespace) {
$fileContents .= $namespace;
}
$fileContents .= 'class '.$className.$parentClass.PHP_EOL;
$fileContents .= '{'.PHP_EOL;
$fileContents .= $body.PHP_EOL;
$fileContents .= '}'.PHP_EOL;
$this->validate($fileContents);
$this->makeDirectorySafe(dirname($path));
$this->writeContentSafe($path, $fileContents);
return $className;
} | php | protected function rebuild($path)
{
$uniqueName = str_replace('.', '', uniqid('', true)).'_'.md5(mt_rand());
$className = 'Cms'.$uniqueName.'Class';
$body = $this->object->code;
$body = preg_replace('/^\s*function/m', 'public function', $body);
$codeNamespaces = [];
$pattern = '/(use\s+[a-z0-9_\\\\]+(\s+as\s+[a-z0-9_]+)?;\n?)/mi';
preg_match_all($pattern, $body, $namespaces);
$body = preg_replace($pattern, '', $body);
$parentClass = $this->object->getCodeClassParent();
if ($parentClass !== null) {
$parentClass = ' extends '.$parentClass;
}
$fileContents = '<?php '.PHP_EOL;
foreach ($namespaces[0] as $namespace) {
$fileContents .= $namespace;
}
$fileContents .= 'class '.$className.$parentClass.PHP_EOL;
$fileContents .= '{'.PHP_EOL;
$fileContents .= $body.PHP_EOL;
$fileContents .= '}'.PHP_EOL;
$this->validate($fileContents);
$this->makeDirectorySafe(dirname($path));
$this->writeContentSafe($path, $fileContents);
return $className;
} | [
"protected",
"function",
"rebuild",
"(",
"$",
"path",
")",
"{",
"$",
"uniqueName",
"=",
"str_replace",
"(",
"'.'",
",",
"''",
",",
"uniqid",
"(",
"''",
",",
"true",
")",
")",
".",
"'_'",
".",
"md5",
"(",
"mt_rand",
"(",
")",
")",
";",
"$",
"class... | Rebuilds the current file cache.
@param string The path in which the cached file should be stored | [
"Rebuilds",
"the",
"current",
"file",
"cache",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/CodeParser.php#L123-L159 | train | Rebuilds the code for the class | [
30522,
5123,
3853,
14591,
1006,
1002,
4130,
1007,
1063,
1002,
4310,
18442,
1027,
2358,
2099,
1035,
5672,
1006,
1005,
1012,
1005,
1010,
1005,
1005,
1010,
4895,
18515,
3593,
1006,
1005,
1005,
1010,
2995,
1007,
1007,
1012,
1005,
1035,
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... |
getgrav/grav | system/src/Grav/Common/Cache.php | Cache.save | public function save($id, $data, $lifetime = null)
{
if ($this->enabled) {
if ($lifetime === null) {
$lifetime = $this->getLifetime();
}
$this->driver->save($id, $data, $lifetime);
}
} | php | public function save($id, $data, $lifetime = null)
{
if ($this->enabled) {
if ($lifetime === null) {
$lifetime = $this->getLifetime();
}
$this->driver->save($id, $data, $lifetime);
}
} | [
"public",
"function",
"save",
"(",
"$",
"id",
",",
"$",
"data",
",",
"$",
"lifetime",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"enabled",
")",
"{",
"if",
"(",
"$",
"lifetime",
"===",
"null",
")",
"{",
"$",
"lifetime",
"=",
"$",
"thi... | Stores a new cached entry.
@param string $id the id of the cached entry
@param array|object $data the data for the cached entry to store
@param int $lifetime the lifetime to store the entry in seconds | [
"Stores",
"a",
"new",
"cached",
"entry",
"."
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Cache.php#L340-L348 | train | Save data to the cache | [
30522,
2270,
3853,
3828,
1006,
1002,
8909,
1010,
1002,
2951,
1010,
1002,
6480,
1027,
19701,
1007,
1063,
2065,
1006,
1002,
2023,
1011,
1028,
9124,
1007,
1063,
2065,
1006,
1002,
6480,
1027,
1027,
1027,
19701,
1007,
1063,
1002,
6480,
1027,
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/IP.php | IP.getNonProxyIpFromHeader | public static function getNonProxyIpFromHeader($default, $proxyHeaders)
{
$proxyIps = array();
$config = Config::getInstance()->General;
if (isset($config['proxy_ips'])) {
$proxyIps = $config['proxy_ips'];
}
if (!is_array($proxyIps)) {
$proxyIps = array();
}
$proxyIps[] = $default;
// examine proxy headers
foreach ($proxyHeaders as $proxyHeader) {
if (!empty($_SERVER[$proxyHeader])) {
// this may be buggy if someone has proxy IPs and proxy host headers configured as
// `$_SERVER[$proxyHeader]` could be eg $_SERVER['HTTP_X_FORWARDED_HOST'] and
// include an actual host name, not an IP
$proxyIp = self::getFirstIpFromList($_SERVER[$proxyHeader], $proxyIps);
if (strlen($proxyIp) && stripos($proxyIp, 'unknown') === false) {
return $proxyIp;
}
}
}
return $default;
} | php | public static function getNonProxyIpFromHeader($default, $proxyHeaders)
{
$proxyIps = array();
$config = Config::getInstance()->General;
if (isset($config['proxy_ips'])) {
$proxyIps = $config['proxy_ips'];
}
if (!is_array($proxyIps)) {
$proxyIps = array();
}
$proxyIps[] = $default;
// examine proxy headers
foreach ($proxyHeaders as $proxyHeader) {
if (!empty($_SERVER[$proxyHeader])) {
// this may be buggy if someone has proxy IPs and proxy host headers configured as
// `$_SERVER[$proxyHeader]` could be eg $_SERVER['HTTP_X_FORWARDED_HOST'] and
// include an actual host name, not an IP
$proxyIp = self::getFirstIpFromList($_SERVER[$proxyHeader], $proxyIps);
if (strlen($proxyIp) && stripos($proxyIp, 'unknown') === false) {
return $proxyIp;
}
}
}
return $default;
} | [
"public",
"static",
"function",
"getNonProxyIpFromHeader",
"(",
"$",
"default",
",",
"$",
"proxyHeaders",
")",
"{",
"$",
"proxyIps",
"=",
"array",
"(",
")",
";",
"$",
"config",
"=",
"Config",
"::",
"getInstance",
"(",
")",
"->",
"General",
";",
"if",
"("... | Returns a non-proxy IP address from header.
@param string $default Default value to return if there no matching proxy header.
@param array $proxyHeaders List of proxy headers.
@return string | [
"Returns",
"a",
"non",
"-",
"proxy",
"IP",
"address",
"from",
"header",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/IP.php#L70-L97 | train | Get the first IP that is not in the list of proxy headers | [
30522,
2270,
10763,
3853,
2131,
8540,
21572,
18037,
11514,
19699,
5358,
4974,
2121,
1006,
1002,
12398,
1010,
1002,
24540,
4974,
2545,
1007,
1063,
1002,
24540,
11514,
2015,
1027,
9140,
1006,
1007,
1025,
1002,
9530,
8873,
2290,
1027,
9530,
88... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/HttpFoundation/Request.php | Request.getHost | public function getHost()
{
if ($this->isFromTrustedProxy() && $host = $this->getTrustedValues(self::HEADER_X_FORWARDED_HOST)) {
$host = $host[0];
} elseif (!$host = $this->headers->get('HOST')) {
if (!$host = $this->server->get('SERVER_NAME')) {
$host = $this->server->get('SERVER_ADDR', '');
}
}
// trim and remove port number from host
// host is lowercase as per RFC 952/2181
$host = strtolower(preg_replace('/:\d+$/', '', trim($host)));
// as the host can come from the user (HTTP_HOST and depending on the configuration, SERVER_NAME too can come from the user)
// check that it does not contain forbidden characters (see RFC 952 and RFC 2181)
// use preg_replace() instead of preg_match() to prevent DoS attacks with long host names
if ($host && '' !== preg_replace('/(?:^\[)?[a-zA-Z0-9-:\]_]+\.?/', '', $host)) {
if (!$this->isHostValid) {
return '';
}
$this->isHostValid = false;
throw new SuspiciousOperationException(sprintf('Invalid Host "%s".', $host));
}
if (\count(self::$trustedHostPatterns) > 0) {
// to avoid host header injection attacks, you should provide a list of trusted host patterns
if (\in_array($host, self::$trustedHosts)) {
return $host;
}
foreach (self::$trustedHostPatterns as $pattern) {
if (preg_match($pattern, $host)) {
self::$trustedHosts[] = $host;
return $host;
}
}
if (!$this->isHostValid) {
return '';
}
$this->isHostValid = false;
throw new SuspiciousOperationException(sprintf('Untrusted Host "%s".', $host));
}
return $host;
} | php | public function getHost()
{
if ($this->isFromTrustedProxy() && $host = $this->getTrustedValues(self::HEADER_X_FORWARDED_HOST)) {
$host = $host[0];
} elseif (!$host = $this->headers->get('HOST')) {
if (!$host = $this->server->get('SERVER_NAME')) {
$host = $this->server->get('SERVER_ADDR', '');
}
}
// trim and remove port number from host
// host is lowercase as per RFC 952/2181
$host = strtolower(preg_replace('/:\d+$/', '', trim($host)));
// as the host can come from the user (HTTP_HOST and depending on the configuration, SERVER_NAME too can come from the user)
// check that it does not contain forbidden characters (see RFC 952 and RFC 2181)
// use preg_replace() instead of preg_match() to prevent DoS attacks with long host names
if ($host && '' !== preg_replace('/(?:^\[)?[a-zA-Z0-9-:\]_]+\.?/', '', $host)) {
if (!$this->isHostValid) {
return '';
}
$this->isHostValid = false;
throw new SuspiciousOperationException(sprintf('Invalid Host "%s".', $host));
}
if (\count(self::$trustedHostPatterns) > 0) {
// to avoid host header injection attacks, you should provide a list of trusted host patterns
if (\in_array($host, self::$trustedHosts)) {
return $host;
}
foreach (self::$trustedHostPatterns as $pattern) {
if (preg_match($pattern, $host)) {
self::$trustedHosts[] = $host;
return $host;
}
}
if (!$this->isHostValid) {
return '';
}
$this->isHostValid = false;
throw new SuspiciousOperationException(sprintf('Untrusted Host "%s".', $host));
}
return $host;
} | [
"public",
"function",
"getHost",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isFromTrustedProxy",
"(",
")",
"&&",
"$",
"host",
"=",
"$",
"this",
"->",
"getTrustedValues",
"(",
"self",
"::",
"HEADER_X_FORWARDED_HOST",
")",
")",
"{",
"$",
"host",
"=",
... | Returns the host name.
This method can read the client host name from the "X-Forwarded-Host" header
when trusted proxies were set via "setTrustedProxies()".
The "X-Forwarded-Host" header must contain the client host name.
@return string
@throws SuspiciousOperationException when the host name is invalid or not trusted | [
"Returns",
"the",
"host",
"name",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpFoundation/Request.php#L1137-L1187 | train | Get the host name | [
30522,
2270,
3853,
2131,
15006,
2102,
1006,
1007,
1063,
2065,
1006,
1002,
2023,
1011,
1028,
2003,
19699,
5358,
24669,
2098,
21572,
18037,
1006,
1007,
1004,
1004,
1002,
3677,
1027,
1002,
2023,
1011,
1028,
2131,
24669,
2098,
10175,
15808,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/Archive/DataCollection.php | DataCollection.getExpandedDataTable | public function getExpandedDataTable($resultIndices, $idSubTable = null, $depth = null, $addMetadataSubTableId = false)
{
if ($this->dataType != 'blob') {
throw new Exception("DataCollection: cannot call getExpandedDataTable with "
. "{$this->dataType} data types. Only works with blob data.");
}
if (count($this->dataNames) !== 1) {
throw new Exception("DataCollection: cannot call getExpandedDataTable with "
. "more than one record.");
}
$dataTableFactory = new DataTableFactory(
$this->dataNames, 'blob', $this->sitesId, $this->periods, $this->defaultRow);
$dataTableFactory->expandDataTable($depth, $addMetadataSubTableId);
$dataTableFactory->useSubtable($idSubTable);
$index = $this->getIndexedArray($resultIndices);
return $dataTableFactory->make($index, $resultIndices);
} | php | public function getExpandedDataTable($resultIndices, $idSubTable = null, $depth = null, $addMetadataSubTableId = false)
{
if ($this->dataType != 'blob') {
throw new Exception("DataCollection: cannot call getExpandedDataTable with "
. "{$this->dataType} data types. Only works with blob data.");
}
if (count($this->dataNames) !== 1) {
throw new Exception("DataCollection: cannot call getExpandedDataTable with "
. "more than one record.");
}
$dataTableFactory = new DataTableFactory(
$this->dataNames, 'blob', $this->sitesId, $this->periods, $this->defaultRow);
$dataTableFactory->expandDataTable($depth, $addMetadataSubTableId);
$dataTableFactory->useSubtable($idSubTable);
$index = $this->getIndexedArray($resultIndices);
return $dataTableFactory->make($index, $resultIndices);
} | [
"public",
"function",
"getExpandedDataTable",
"(",
"$",
"resultIndices",
",",
"$",
"idSubTable",
"=",
"null",
",",
"$",
"depth",
"=",
"null",
",",
"$",
"addMetadataSubTableId",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"dataType",
"!=",
"'blob'... | Returns archive data as a DataTable indexed by metadata. Indexed data will
be represented by Map instances. Each DataTable will have
its subtable IDs set.
This function will only work if blob data was loaded and only one record
was loaded (not including subtables of the record).
@param array $resultIndices An array mapping metadata names to pretty labels
for them. Each archive data row will be indexed
by the metadata specified here.
Eg, array('site' => 'idSite', 'period' => 'Date')
@param int|null $idSubTable The subtable to return.
@param int|null $depth max depth for subtables.
@param bool $addMetadataSubTableId Whether to add the DB subtable ID as metadata
to each datatable, or not.
@throws Exception
@return DataTable|DataTable\Map | [
"Returns",
"archive",
"data",
"as",
"a",
"DataTable",
"indexed",
"by",
"metadata",
".",
"Indexed",
"data",
"will",
"be",
"represented",
"by",
"Map",
"instances",
".",
"Each",
"DataTable",
"will",
"have",
"its",
"subtable",
"IDs",
"set",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Archive/DataCollection.php#L268-L288 | train | Returns the expanded DataTable for the given result indices | [
30522,
2270,
3853,
2131,
10288,
9739,
5732,
2850,
29336,
3085,
1006,
1002,
2765,
22254,
23522,
1010,
1002,
8909,
6342,
19279,
3085,
1027,
19701,
1010,
1002,
5995,
1027,
19701,
1010,
1002,
5587,
11368,
8447,
10230,
12083,
10880,
3593,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Serializer/Mapping/Factory/ClassMetadataFactory.php | ClassMetadataFactory.getMetadataFor | public function getMetadataFor($value)
{
$class = $this->getClass($value);
if (isset($this->loadedClasses[$class])) {
return $this->loadedClasses[$class];
}
$classMetadata = new ClassMetadata($class);
$this->loader->loadClassMetadata($classMetadata);
$reflectionClass = $classMetadata->getReflectionClass();
// Include metadata from the parent class
if ($parent = $reflectionClass->getParentClass()) {
$classMetadata->merge($this->getMetadataFor($parent->name));
}
// Include metadata from all implemented interfaces
foreach ($reflectionClass->getInterfaces() as $interface) {
$classMetadata->merge($this->getMetadataFor($interface->name));
}
return $this->loadedClasses[$class] = $classMetadata;
} | php | public function getMetadataFor($value)
{
$class = $this->getClass($value);
if (isset($this->loadedClasses[$class])) {
return $this->loadedClasses[$class];
}
$classMetadata = new ClassMetadata($class);
$this->loader->loadClassMetadata($classMetadata);
$reflectionClass = $classMetadata->getReflectionClass();
// Include metadata from the parent class
if ($parent = $reflectionClass->getParentClass()) {
$classMetadata->merge($this->getMetadataFor($parent->name));
}
// Include metadata from all implemented interfaces
foreach ($reflectionClass->getInterfaces() as $interface) {
$classMetadata->merge($this->getMetadataFor($interface->name));
}
return $this->loadedClasses[$class] = $classMetadata;
} | [
"public",
"function",
"getMetadataFor",
"(",
"$",
"value",
")",
"{",
"$",
"class",
"=",
"$",
"this",
"->",
"getClass",
"(",
"$",
"value",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"loadedClasses",
"[",
"$",
"class",
"]",
")",
")",
"{",
... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Serializer/Mapping/Factory/ClassMetadataFactory.php#L41-L65 | train | Returns the class metadata for the given value. | [
30522,
2270,
3853,
2131,
11368,
8447,
2696,
29278,
1006,
1002,
3643,
1007,
1063,
1002,
2465,
1027,
1002,
2023,
1011,
1028,
2131,
26266,
1006,
1002,
3643,
1007,
1025,
2065,
1006,
26354,
3388,
1006,
1002,
2023,
1011,
1028,
8209,
26266,
2229,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.put | public function put($key, $value = null)
{
if (! is_array($key)) {
$key = [$key => $value];
}
foreach ($key as $arrayKey => $arrayValue) {
Arr::set($this->attributes, $arrayKey, $arrayValue);
}
} | php | public function put($key, $value = null)
{
if (! is_array($key)) {
$key = [$key => $value];
}
foreach ($key as $arrayKey => $arrayValue) {
Arr::set($this->attributes, $arrayKey, $arrayValue);
}
} | [
"public",
"function",
"put",
"(",
"$",
"key",
",",
"$",
"value",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"key",
")",
")",
"{",
"$",
"key",
"=",
"[",
"$",
"key",
"=>",
"$",
"value",
"]",
";",
"}",
"foreach",
"(",
"$",
"k... | Put a key / value pair or array of key / value pairs in the session.
@param string|array $key
@param mixed $value
@return void | [
"Put",
"a",
"key",
"/",
"value",
"pair",
"or",
"array",
"of",
"key",
"/",
"value",
"pairs",
"in",
"the",
"session",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Session/Store.php#L265-L274 | train | Put an attribute value | [
30522,
2270,
3853,
2404,
1006,
1002,
3145,
1010,
1002,
3643,
1027,
19701,
1007,
1063,
2065,
1006,
999,
2003,
1035,
9140,
1006,
1002,
3145,
1007,
1007,
1063,
1002,
3145,
1027,
1031,
1002,
3145,
1027,
1028,
1002,
3643,
1033,
1025,
1065,
189... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/RouteCollection.php | RouteCollection.add | public function add($name, Route $route)
{
unset($this->routes[$name]);
$this->routes[$name] = $route;
} | php | public function add($name, Route $route)
{
unset($this->routes[$name]);
$this->routes[$name] = $route;
} | [
"public",
"function",
"add",
"(",
"$",
"name",
",",
"Route",
"$",
"route",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"routes",
"[",
"$",
"name",
"]",
")",
";",
"$",
"this",
"->",
"routes",
"[",
"$",
"name",
"]",
"=",
"$",
"route",
";",
"}"
] | Adds a route.
@param string $name The route name
@param Route $route A Route instance | [
"Adds",
"a",
"route",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Routing/RouteCollection.php#L75-L80 | train | Add route to the stack | [
30522,
2270,
3853,
5587,
1006,
1002,
2171,
1010,
2799,
1002,
2799,
1007,
1063,
4895,
13462,
1006,
1002,
2023,
1011,
1028,
5847,
1031,
1002,
2171,
1033,
1007,
1025,
1002,
2023,
1011,
1028,
5847,
1031,
1002,
2171,
1033,
1027,
1002,
2799,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/Zend/Db/Statement/Pdo.php | Zend_Db_Statement_Pdo._prepare | protected function _prepare($sql)
{
try {
$this->_stmt = $this->_adapter->getConnection()->prepare($sql);
} catch (PDOException $e) {
// require_once 'Zend/Db/Statement/Exception.php';
throw new Zend_Db_Statement_Exception($e->getMessage(), $e->getCode(), $e);
}
} | php | protected function _prepare($sql)
{
try {
$this->_stmt = $this->_adapter->getConnection()->prepare($sql);
} catch (PDOException $e) {
// require_once 'Zend/Db/Statement/Exception.php';
throw new Zend_Db_Statement_Exception($e->getMessage(), $e->getCode(), $e);
}
} | [
"protected",
"function",
"_prepare",
"(",
"$",
"sql",
")",
"{",
"try",
"{",
"$",
"this",
"->",
"_stmt",
"=",
"$",
"this",
"->",
"_adapter",
"->",
"getConnection",
"(",
")",
"->",
"prepare",
"(",
"$",
"sql",
")",
";",
"}",
"catch",
"(",
"PDOException"... | Prepare a string SQL statement and create a statement object.
@param string $sql
@return void
@throws Zend_Db_Statement_Exception | [
"Prepare",
"a",
"string",
"SQL",
"statement",
"and",
"create",
"a",
"statement",
"object",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Statement/Pdo.php#L55-L63 | train | Prepare statement for execution | [
30522,
5123,
3853,
1035,
7374,
1006,
1002,
29296,
1007,
1063,
3046,
1063,
1002,
2023,
1011,
1028,
1035,
2358,
20492,
1027,
1002,
2023,
1011,
1028,
1035,
15581,
2121,
1011,
1028,
2131,
8663,
2638,
7542,
1006,
1007,
1011,
1028,
7374,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/CoreAdminHome/API.php | API.getDatesToInvalidateFromString | private function getDatesToInvalidateFromString($dates)
{
$toInvalidate = array();
$invalidDates = array();
$dates = explode(',', trim($dates));
$dates = array_unique($dates);
foreach ($dates as $theDate) {
$theDate = trim($theDate);
try {
$date = Date::factory($theDate);
} catch (\Exception $e) {
$invalidDates[] = $theDate;
continue;
}
if ($date->toString() == $theDate) {
$toInvalidate[] = $date;
} else {
$invalidDates[] = $theDate;
}
}
return array($toInvalidate, $invalidDates);
} | php | private function getDatesToInvalidateFromString($dates)
{
$toInvalidate = array();
$invalidDates = array();
$dates = explode(',', trim($dates));
$dates = array_unique($dates);
foreach ($dates as $theDate) {
$theDate = trim($theDate);
try {
$date = Date::factory($theDate);
} catch (\Exception $e) {
$invalidDates[] = $theDate;
continue;
}
if ($date->toString() == $theDate) {
$toInvalidate[] = $date;
} else {
$invalidDates[] = $theDate;
}
}
return array($toInvalidate, $invalidDates);
} | [
"private",
"function",
"getDatesToInvalidateFromString",
"(",
"$",
"dates",
")",
"{",
"$",
"toInvalidate",
"=",
"array",
"(",
")",
";",
"$",
"invalidDates",
"=",
"array",
"(",
")",
";",
"$",
"dates",
"=",
"explode",
"(",
"','",
",",
"trim",
"(",
"$",
"... | Ensure the specified dates are valid.
Store invalid date so we can log them
@param array $dates
@return Date[] | [
"Ensure",
"the",
"specified",
"dates",
"are",
"valid",
".",
"Store",
"invalid",
"date",
"so",
"we",
"can",
"log",
"them"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/CoreAdminHome/API.php#L245-L270 | train | Returns array of dates to invalidate from string | [
30522,
2797,
3853,
2131,
27122,
3406,
2378,
10175,
8524,
2618,
19699,
22225,
18886,
3070,
1006,
1002,
5246,
1007,
1063,
1002,
2000,
2378,
10175,
8524,
2618,
1027,
9140,
1006,
1007,
1025,
1002,
19528,
27122,
1027,
9140,
1006,
1007,
1025,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/Zend/Mime/Part.php | Zend_Mime_Part.getEncodedStream | public function getEncodedStream()
{
if (!$this->_isStream) {
// require_once 'Zend/Mime/Exception.php';
throw new Zend_Mime_Exception('Attempt to get a stream from a string part');
}
//stream_filter_remove(); // ??? is that right?
switch ($this->encoding) {
case Zend_Mime::ENCODING_QUOTEDPRINTABLE:
$filter = stream_filter_append(
$this->_content,
'convert.quoted-printable-encode',
STREAM_FILTER_READ,
array(
'line-length' => 76,
'line-break-chars' => Zend_Mime::LINEEND
)
);
if (!is_resource($filter)) {
// require_once 'Zend/Mime/Exception.php';
throw new Zend_Mime_Exception('Failed to append quoted-printable filter');
}
break;
case Zend_Mime::ENCODING_BASE64:
$filter = stream_filter_append(
$this->_content,
'convert.base64-encode',
STREAM_FILTER_READ,
array(
'line-length' => 76,
'line-break-chars' => Zend_Mime::LINEEND
)
);
if (!is_resource($filter)) {
// require_once 'Zend/Mime/Exception.php';
throw new Zend_Mime_Exception('Failed to append base64 filter');
}
break;
default:
}
return $this->_content;
} | php | public function getEncodedStream()
{
if (!$this->_isStream) {
// require_once 'Zend/Mime/Exception.php';
throw new Zend_Mime_Exception('Attempt to get a stream from a string part');
}
//stream_filter_remove(); // ??? is that right?
switch ($this->encoding) {
case Zend_Mime::ENCODING_QUOTEDPRINTABLE:
$filter = stream_filter_append(
$this->_content,
'convert.quoted-printable-encode',
STREAM_FILTER_READ,
array(
'line-length' => 76,
'line-break-chars' => Zend_Mime::LINEEND
)
);
if (!is_resource($filter)) {
// require_once 'Zend/Mime/Exception.php';
throw new Zend_Mime_Exception('Failed to append quoted-printable filter');
}
break;
case Zend_Mime::ENCODING_BASE64:
$filter = stream_filter_append(
$this->_content,
'convert.base64-encode',
STREAM_FILTER_READ,
array(
'line-length' => 76,
'line-break-chars' => Zend_Mime::LINEEND
)
);
if (!is_resource($filter)) {
// require_once 'Zend/Mime/Exception.php';
throw new Zend_Mime_Exception('Failed to append base64 filter');
}
break;
default:
}
return $this->_content;
} | [
"public",
"function",
"getEncodedStream",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"_isStream",
")",
"{",
"// require_once 'Zend/Mime/Exception.php';",
"throw",
"new",
"Zend_Mime_Exception",
"(",
"'Attempt to get a stream from a string part'",
")",
";",
"}",
... | if this was created with a stream, return a filtered stream for
reading the content. very useful for large file attachments.
@return stream
@throws Zend_Mime_Exception if not a stream or unable to append filter | [
"if",
"this",
"was",
"created",
"with",
"a",
"stream",
"return",
"a",
"filtered",
"stream",
"for",
"reading",
"the",
"content",
".",
"very",
"useful",
"for",
"large",
"file",
"attachments",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Mime/Part.php#L92-L134 | train | Encode the content to a stream | [
30522,
2270,
3853,
2131,
2368,
16044,
30524,
1028,
1035,
26354,
25379,
1007,
1063,
1013,
1013,
5478,
1035,
2320,
1005,
16729,
2094,
1013,
2771,
4168,
1013,
6453,
1012,
25718,
1005,
1025,
5466,
2047,
16729,
2094,
1035,
2771,
4168,
1035,
6453... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/Zend/Db/Adapter/Pdo/Ibm.php | Zend_Db_Adapter_Pdo_Ibm.lastInsertId | public function lastInsertId($tableName = null, $primaryKey = null)
{
$this->_connect();
if ($tableName !== null) {
$sequenceName = $tableName;
if ($primaryKey) {
$sequenceName .= "_$primaryKey";
}
$sequenceName .= '_seq';
return $this->lastSequenceId($sequenceName);
}
$id = $this->getConnection()->lastInsertId();
return $id;
} | php | public function lastInsertId($tableName = null, $primaryKey = null)
{
$this->_connect();
if ($tableName !== null) {
$sequenceName = $tableName;
if ($primaryKey) {
$sequenceName .= "_$primaryKey";
}
$sequenceName .= '_seq';
return $this->lastSequenceId($sequenceName);
}
$id = $this->getConnection()->lastInsertId();
return $id;
} | [
"public",
"function",
"lastInsertId",
"(",
"$",
"tableName",
"=",
"null",
",",
"$",
"primaryKey",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"_connect",
"(",
")",
";",
"if",
"(",
"$",
"tableName",
"!==",
"null",
")",
"{",
"$",
"sequenceName",
"=",
"$"... | Gets the last ID generated automatically by an IDENTITY/AUTOINCREMENT
column.
@param string $tableName OPTIONAL
@param string $primaryKey OPTIONAL
@return integer | [
"Gets",
"the",
"last",
"ID",
"generated",
"automatically",
"by",
"an",
"IDENTITY",
"/",
"AUTOINCREMENT",
"column",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Adapter/Pdo/Ibm.php#L294-L310 | train | Return last ID of the current record | [
30522,
2270,
3853,
2197,
7076,
8743,
3593,
1006,
1002,
2795,
18442,
1027,
19701,
1010,
1002,
3078,
14839,
1027,
19701,
1007,
1063,
1002,
2023,
1011,
1028,
1035,
7532,
1006,
1007,
1025,
2065,
1006,
1002,
2795,
18442,
999,
1027,
1027,
30524,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/HasEvents.php | HasEvents.flushEventListeners | public static function flushEventListeners()
{
if (! isset(static::$dispatcher)) {
return;
}
$instance = new static;
foreach ($instance->getObservableEvents() as $event) {
static::$dispatcher->forget("eloquent.{$event}: ".static::class);
}
foreach (array_values($instance->dispatchesEvents) as $event) {
static::$dispatcher->forget($event);
}
} | php | public static function flushEventListeners()
{
if (! isset(static::$dispatcher)) {
return;
}
$instance = new static;
foreach ($instance->getObservableEvents() as $event) {
static::$dispatcher->forget("eloquent.{$event}: ".static::class);
}
foreach (array_values($instance->dispatchesEvents) as $event) {
static::$dispatcher->forget($event);
}
} | [
"public",
"static",
"function",
"flushEventListeners",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"static",
"::",
"$",
"dispatcher",
")",
")",
"{",
"return",
";",
"}",
"$",
"instance",
"=",
"new",
"static",
";",
"foreach",
"(",
"$",
"instance",
"->",... | Remove all of the event listeners for the model.
@return void | [
"Remove",
"all",
"of",
"the",
"event",
"listeners",
"for",
"the",
"model",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Concerns/HasEvents.php#L344-L359 | train | Flush all events that have been dispatched to the current object | [
30522,
2270,
10763,
3853,
13862,
18697,
3372,
9863,
24454,
2015,
1006,
1007,
1063,
2065,
1006,
999,
26354,
3388,
1006,
10763,
1024,
1024,
1002,
18365,
2121,
1007,
1007,
1063,
2709,
1025,
1065,
1002,
6013,
1027,
2047,
10763,
1025,
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/Cache/DependencyInjection/CachePoolClearerPass.php | CachePoolClearerPass.process | public function process(ContainerBuilder $container)
{
$container->getParameterBag()->remove('cache.prefix.seed');
foreach ($container->findTaggedServiceIds($this->cachePoolClearerTag) as $id => $attr) {
$clearer = $container->getDefinition($id);
$pools = [];
foreach ($clearer->getArgument(0) as $name => $ref) {
if ($container->hasDefinition($ref)) {
$pools[$name] = new Reference($ref);
}
}
$clearer->replaceArgument(0, $pools);
}
} | php | public function process(ContainerBuilder $container)
{
$container->getParameterBag()->remove('cache.prefix.seed');
foreach ($container->findTaggedServiceIds($this->cachePoolClearerTag) as $id => $attr) {
$clearer = $container->getDefinition($id);
$pools = [];
foreach ($clearer->getArgument(0) as $name => $ref) {
if ($container->hasDefinition($ref)) {
$pools[$name] = new Reference($ref);
}
}
$clearer->replaceArgument(0, $pools);
}
} | [
"public",
"function",
"process",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"container",
"->",
"getParameterBag",
"(",
")",
"->",
"remove",
"(",
"'cache.prefix.seed'",
")",
";",
"foreach",
"(",
"$",
"container",
"->",
"findTaggedServiceIds",
"(",
... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Cache/DependencyInjection/CachePoolClearerPass.php#L33-L47 | train | Removes cache pool clearers from the container and replaces them with their references | [
30522,
2270,
3853,
2832,
1006,
11661,
8569,
23891,
2099,
1002,
11661,
1007,
1063,
1002,
11661,
1011,
1028,
2131,
28689,
22828,
16078,
1006,
1007,
1011,
1028,
6366,
1006,
1005,
17053,
1012,
17576,
1012,
6534,
1005,
1007,
1025,
18921,
6776,
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 | lib/Cpdf.php | Cpdf.getFontHeight | function getFontHeight($size)
{
if (!$this->numFonts) {
$this->selectFont($this->defaultFont);
}
$font = $this->fonts[$this->currentFont];
// for the current font, and the given size, what is the height of the font in user units
if (isset($font['Ascender']) && isset($font['Descender'])) {
$h = $font['Ascender'] - $font['Descender'];
} else {
$h = $font['FontBBox'][3] - $font['FontBBox'][1];
}
// have to adjust by a font offset for Windows fonts. unfortunately it looks like
// the bounding box calculations are wrong and I don't know why.
if (isset($font['FontHeightOffset'])) {
// For CourierNew from Windows this needs to be -646 to match the
// Adobe native Courier font.
//
// For FreeMono from GNU this needs to be -337 to match the
// Courier font.
//
// Both have been added manually to the .afm and .ufm files.
$h += (int)$font['FontHeightOffset'];
}
return $size * $h / 1000;
} | php | function getFontHeight($size)
{
if (!$this->numFonts) {
$this->selectFont($this->defaultFont);
}
$font = $this->fonts[$this->currentFont];
// for the current font, and the given size, what is the height of the font in user units
if (isset($font['Ascender']) && isset($font['Descender'])) {
$h = $font['Ascender'] - $font['Descender'];
} else {
$h = $font['FontBBox'][3] - $font['FontBBox'][1];
}
// have to adjust by a font offset for Windows fonts. unfortunately it looks like
// the bounding box calculations are wrong and I don't know why.
if (isset($font['FontHeightOffset'])) {
// For CourierNew from Windows this needs to be -646 to match the
// Adobe native Courier font.
//
// For FreeMono from GNU this needs to be -337 to match the
// Courier font.
//
// Both have been added manually to the .afm and .ufm files.
$h += (int)$font['FontHeightOffset'];
}
return $size * $h / 1000;
} | [
"function",
"getFontHeight",
"(",
"$",
"size",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"numFonts",
")",
"{",
"$",
"this",
"->",
"selectFont",
"(",
"$",
"this",
"->",
"defaultFont",
")",
";",
"}",
"$",
"font",
"=",
"$",
"this",
"->",
"fonts",
... | return the height in units of the current font in the given size
@param $size
@return float|int | [
"return",
"the",
"height",
"in",
"units",
"of",
"the",
"current",
"font",
"in",
"the",
"given",
"size"
] | 75f13c700009be21a1965dc2c5b68a8708c22ba2 | https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/lib/Cpdf.php#L3917-L3946 | train | Get the height of the font in user units | [
30522,
3853,
2131,
14876,
3372,
26036,
13900,
1006,
1002,
2946,
1007,
1063,
2065,
1006,
999,
1002,
2023,
1011,
1028,
16371,
2213,
14876,
7666,
1007,
1063,
1002,
2023,
1011,
1028,
7276,
14876,
3372,
1006,
1002,
2023,
1011,
1028,
12398,
14876... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php | BelongsToMany.addEagerConstraints | public function addEagerConstraints(array $models)
{
$whereIn = $this->whereInMethod($this->parent, $this->parentKey);
$this->query->{$whereIn}(
$this->getQualifiedForeignPivotKeyName(),
$this->getKeys($models, $this->parentKey)
);
} | php | public function addEagerConstraints(array $models)
{
$whereIn = $this->whereInMethod($this->parent, $this->parentKey);
$this->query->{$whereIn}(
$this->getQualifiedForeignPivotKeyName(),
$this->getKeys($models, $this->parentKey)
);
} | [
"public",
"function",
"addEagerConstraints",
"(",
"array",
"$",
"models",
")",
"{",
"$",
"whereIn",
"=",
"$",
"this",
"->",
"whereInMethod",
"(",
"$",
"this",
"->",
"parent",
",",
"$",
"this",
"->",
"parentKey",
")",
";",
"$",
"this",
"->",
"query",
"-... | Set the constraints for an eager load of the relation.
@param array $models
@return void | [
"Set",
"the",
"constraints",
"for",
"an",
"eager",
"load",
"of",
"the",
"relation",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php#L235-L243 | train | Adds eager constraints to the query object. | [
30522,
2270,
3853,
5587,
5243,
4590,
8663,
20528,
18447,
2015,
1006,
9140,
1002,
4275,
1007,
1063,
1002,
16726,
1027,
1002,
2023,
1011,
1028,
16726,
11368,
6806,
2094,
1006,
1002,
2023,
1011,
1028,
6687,
1010,
1002,
2023,
1011,
1028,
6687,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Mail/Mailable.php | Mailable.attachFromStorage | public function attachFromStorage($path, $name = null, array $options = [])
{
return $this->attachFromStorageDisk(null, $path, $name, $options);
} | php | public function attachFromStorage($path, $name = null, array $options = [])
{
return $this->attachFromStorageDisk(null, $path, $name, $options);
} | [
"public",
"function",
"attachFromStorage",
"(",
"$",
"path",
",",
"$",
"name",
"=",
"null",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"attachFromStorageDisk",
"(",
"null",
",",
"$",
"path",
",",
"$",
"name",
... | Attach a file to the message from storage.
@param string $path
@param string $name
@param array $options
@return $this | [
"Attach",
"a",
"file",
"to",
"the",
"message",
"from",
"storage",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Mail/Mailable.php#L763-L766 | train | Attaches a new record from the local disk to the recordset | [
30522,
2270,
3853,
22476,
19699,
22225,
4263,
4270,
1006,
1002,
4130,
1010,
1002,
2171,
1027,
19701,
1010,
9140,
1002,
7047,
1027,
1031,
1033,
1007,
1063,
2709,
1002,
2023,
1011,
1028,
22476,
19699,
22225,
4263,
18655,
20573,
1006,
19701,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getgrav/grav | system/src/Grav/Framework/File/Formatter/CsvFormatter.php | CsvFormatter.encode | public function encode($data, $delimiter = null): string
{
if (count($data) === 0) {
return '';
}
$delimiter = $delimiter ?? $this->getDelimiter();
$header = array_keys(reset($data));
// Encode the field names
$string = implode($delimiter, $header). "\n";
// Encode the data
foreach ($data as $row) {
$string .= implode($delimiter, $row). "\n";
}
return $string;
} | php | public function encode($data, $delimiter = null): string
{
if (count($data) === 0) {
return '';
}
$delimiter = $delimiter ?? $this->getDelimiter();
$header = array_keys(reset($data));
// Encode the field names
$string = implode($delimiter, $header). "\n";
// Encode the data
foreach ($data as $row) {
$string .= implode($delimiter, $row). "\n";
}
return $string;
} | [
"public",
"function",
"encode",
"(",
"$",
"data",
",",
"$",
"delimiter",
"=",
"null",
")",
":",
"string",
"{",
"if",
"(",
"count",
"(",
"$",
"data",
")",
"===",
"0",
")",
"{",
"return",
"''",
";",
"}",
"$",
"delimiter",
"=",
"$",
"delimiter",
"??... | {@inheritdoc}
@see FileFormatterInterface::encode() | [
"{"
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Framework/File/Formatter/CsvFormatter.php#L47-L64 | train | Encode the data into a string | [
30522,
2270,
3853,
4372,
16044,
1006,
1002,
2951,
1010,
1002,
3972,
27605,
3334,
1027,
19701,
1007,
1024,
5164,
1063,
2065,
1006,
4175,
1006,
1002,
2951,
1007,
1027,
1027,
1027,
1014,
1007,
1063,
2709,
1005,
1005,
1025,
1065,
1002,
3972,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getgrav/grav | system/src/Grav/Common/Twig/TwigExtension.php | TwigExtension.ofTypeFunc | public function ofTypeFunc($var, $typeTest=null, $className=null)
{
switch ($typeTest)
{
default:
return false;
break;
case 'array':
return is_array($var);
break;
case 'bool':
return is_bool($var);
break;
case 'class':
return is_object($var) === true && get_class($var) === $className;
break;
case 'float':
return is_float($var);
break;
case 'int':
return is_int($var);
break;
case 'numeric':
return is_numeric($var);
break;
case 'object':
return is_object($var);
break;
case 'scalar':
return is_scalar($var);
break;
case 'string':
return is_string($var);
break;
}
} | php | public function ofTypeFunc($var, $typeTest=null, $className=null)
{
switch ($typeTest)
{
default:
return false;
break;
case 'array':
return is_array($var);
break;
case 'bool':
return is_bool($var);
break;
case 'class':
return is_object($var) === true && get_class($var) === $className;
break;
case 'float':
return is_float($var);
break;
case 'int':
return is_int($var);
break;
case 'numeric':
return is_numeric($var);
break;
case 'object':
return is_object($var);
break;
case 'scalar':
return is_scalar($var);
break;
case 'string':
return is_string($var);
break;
}
} | [
"public",
"function",
"ofTypeFunc",
"(",
"$",
"var",
",",
"$",
"typeTest",
"=",
"null",
",",
"$",
"className",
"=",
"null",
")",
"{",
"switch",
"(",
"$",
"typeTest",
")",
"{",
"default",
":",
"return",
"false",
";",
"break",
";",
"case",
"'array'",
"... | Function/Filter to test type of variable
@param mixed $var
@param string|null $typeTest
@param string|null $className
@return bool | [
"Function",
"/",
"Filter",
"to",
"test",
"type",
"of",
"variable"
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Twig/TwigExtension.php#L1397-L1442 | train | Checks if variable is of type | [
30522,
2270,
3853,
1997,
13874,
11263,
12273,
1006,
1002,
13075,
1010,
1002,
2828,
22199,
1027,
19701,
1010,
1002,
2465,
18442,
1027,
19701,
1007,
1063,
6942,
1006,
1002,
2828,
22199,
1007,
1063,
12398,
1024,
2709,
6270,
1025,
3338,
1025,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/Db/Adapter.php | Adapter.factory | public static function factory($adapterName, & $dbInfos, $connect = true)
{
if ($connect) {
if ($dbInfos['port'][0] == '/') {
$dbInfos['unix_socket'] = $dbInfos['port'];
unset($dbInfos['host']);
unset($dbInfos['port']);
}
// not used by Zend Framework
unset($dbInfos['tables_prefix']);
unset($dbInfos['adapter']);
unset($dbInfos['schema']);
}
$className = self::getAdapterClassName($adapterName);
// make sure not to pass any references otherwise they will modify $dbInfos
$infos = array();
foreach ($dbInfos as $key => $val) {
$infos[$key] = $val;
}
$adapter = new $className($infos);
if ($connect) {
$adapter->getConnection();
Zend_Db_Table::setDefaultAdapter($adapter);
// we don't want the connection information to appear in the logs
$adapter->resetConfig();
}
return $adapter;
} | php | public static function factory($adapterName, & $dbInfos, $connect = true)
{
if ($connect) {
if ($dbInfos['port'][0] == '/') {
$dbInfos['unix_socket'] = $dbInfos['port'];
unset($dbInfos['host']);
unset($dbInfos['port']);
}
// not used by Zend Framework
unset($dbInfos['tables_prefix']);
unset($dbInfos['adapter']);
unset($dbInfos['schema']);
}
$className = self::getAdapterClassName($adapterName);
// make sure not to pass any references otherwise they will modify $dbInfos
$infos = array();
foreach ($dbInfos as $key => $val) {
$infos[$key] = $val;
}
$adapter = new $className($infos);
if ($connect) {
$adapter->getConnection();
Zend_Db_Table::setDefaultAdapter($adapter);
// we don't want the connection information to appear in the logs
$adapter->resetConfig();
}
return $adapter;
} | [
"public",
"static",
"function",
"factory",
"(",
"$",
"adapterName",
",",
"&",
"$",
"dbInfos",
",",
"$",
"connect",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"connect",
")",
"{",
"if",
"(",
"$",
"dbInfos",
"[",
"'port'",
"]",
"[",
"0",
"]",
"==",
"'/... | Create adapter
@param string $adapterName database adapter name
@param array $dbInfos database connection info
@param bool $connect
@return AdapterInterface | [
"Create",
"adapter"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Db/Adapter.php#L25-L59 | train | Factory method for creating new Adapter objects | [
30522,
2270,
10763,
3853,
4713,
1006,
1002,
15581,
11795,
14074,
1010,
1004,
1002,
16962,
2378,
14876,
2015,
1010,
1002,
7532,
1027,
2995,
1007,
1063,
2065,
1006,
1002,
7532,
1007,
1063,
2065,
1006,
1002,
16962,
2378,
14876,
2015,
1031,
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... |
domnikl/DesignPatternsPHP | Behavioral/Specification/AndSpecification.php | AndSpecification.isSatisfiedBy | public function isSatisfiedBy(Item $item): bool
{
foreach ($this->specifications as $specification) {
if (!$specification->isSatisfiedBy($item)) {
return false;
}
}
return true;
} | php | public function isSatisfiedBy(Item $item): bool
{
foreach ($this->specifications as $specification) {
if (!$specification->isSatisfiedBy($item)) {
return false;
}
}
return true;
} | [
"public",
"function",
"isSatisfiedBy",
"(",
"Item",
"$",
"item",
")",
":",
"bool",
"{",
"foreach",
"(",
"$",
"this",
"->",
"specifications",
"as",
"$",
"specification",
")",
"{",
"if",
"(",
"!",
"$",
"specification",
"->",
"isSatisfiedBy",
"(",
"$",
"ite... | if at least one specification is false, return false, else return true. | [
"if",
"at",
"least",
"one",
"specification",
"is",
"false",
"return",
"false",
"else",
"return",
"true",
"."
] | 5f5649b57ea94471e20b54eb439c6368dea07886 | https://github.com/domnikl/DesignPatternsPHP/blob/5f5649b57ea94471e20b54eb439c6368dea07886/Behavioral/Specification/AndSpecification.php#L23-L32 | train | Checks if the item is satisfied by all specifications | [
30522,
2270,
3853,
26354,
10450,
22747,
6340,
3762,
1006,
8875,
1002,
8875,
1007,
1024,
22017,
2140,
1063,
18921,
6776,
1006,
1002,
2023,
1011,
1028,
15480,
2004,
1002,
12827,
1007,
1063,
2065,
1006,
999,
1002,
12827,
1011,
1028,
26354,
104... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/backend/widgets/MediaManager.php | MediaManager.setFilter | protected function setFilter($filter)
{
if (!in_array($filter, [
self::FILTER_EVERYTHING,
MediaLibraryItem::FILE_TYPE_IMAGE,
MediaLibraryItem::FILE_TYPE_AUDIO,
MediaLibraryItem::FILE_TYPE_DOCUMENT,
MediaLibraryItem::FILE_TYPE_VIDEO
])) {
throw new ApplicationException('Invalid input data');
}
$this->putSession('media_filter', $filter);
} | php | protected function setFilter($filter)
{
if (!in_array($filter, [
self::FILTER_EVERYTHING,
MediaLibraryItem::FILE_TYPE_IMAGE,
MediaLibraryItem::FILE_TYPE_AUDIO,
MediaLibraryItem::FILE_TYPE_DOCUMENT,
MediaLibraryItem::FILE_TYPE_VIDEO
])) {
throw new ApplicationException('Invalid input data');
}
$this->putSession('media_filter', $filter);
} | [
"protected",
"function",
"setFilter",
"(",
"$",
"filter",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"filter",
",",
"[",
"self",
"::",
"FILTER_EVERYTHING",
",",
"MediaLibraryItem",
"::",
"FILE_TYPE_IMAGE",
",",
"MediaLibraryItem",
"::",
"FILE_TYPE_AUDIO",
... | Sets the user filter from the session state
@param string $filter
@return void | [
"Sets",
"the",
"user",
"filter",
"from",
"the",
"session",
"state"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/MediaManager.php#L903-L916 | train | Set the filter in the session | [
30522,
5123,
3853,
2275,
8873,
21928,
1006,
1002,
11307,
1007,
1063,
2065,
1006,
999,
1999,
1035,
9140,
1006,
1002,
11307,
1010,
1031,
2969,
1024,
1024,
11307,
1035,
2673,
1010,
23828,
12322,
19848,
10139,
18532,
1024,
1024,
5371,
1035,
282... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Archive.php | Archive.getDataTableFromNumericAndMergeChildren | public function getDataTableFromNumericAndMergeChildren($names)
{
$data = $this->get($names, 'numeric');
$resultIndexes = $this->getResultIndices();
return $data->getMergedDataTable($resultIndexes);
} | php | public function getDataTableFromNumericAndMergeChildren($names)
{
$data = $this->get($names, 'numeric');
$resultIndexes = $this->getResultIndices();
return $data->getMergedDataTable($resultIndexes);
} | [
"public",
"function",
"getDataTableFromNumericAndMergeChildren",
"(",
"$",
"names",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"get",
"(",
"$",
"names",
",",
"'numeric'",
")",
";",
"$",
"resultIndexes",
"=",
"$",
"this",
"->",
"getResultIndices",
"(",
... | Similar to {@link getDataTableFromNumeric()} but merges all children on the created DataTable.
This is the same as doing `$this->getDataTableFromNumeric()->mergeChildren()` but this way it is much faster.
@return DataTable|DataTable\Map
@internal Currently only used by MultiSites.getAll plugin. Feel free to remove internal tag if needed somewhere
else. If no longer needed by MultiSites.getAll please remove this method. If you need this to work in
a bit different way feel free to refactor as always. | [
"Similar",
"to",
"{",
"@link",
"getDataTableFromNumeric",
"()",
"}",
"but",
"merges",
"all",
"children",
"on",
"the",
"created",
"DataTable",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Archive.php#L318-L323 | train | Get Data Table From Numeric And Merge Children | [
30522,
2270,
3853,
2131,
2850,
29336,
3085,
19699,
5358,
19172,
22420,
5685,
5017,
3351,
19339,
7389,
1006,
1002,
3415,
1007,
1063,
1002,
2951,
1027,
1002,
2023,
1011,
1028,
2131,
1006,
1002,
3415,
1010,
1005,
16371,
25531,
1005,
1007,
1025... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
dompdf/dompdf | src/Adapter/CPDF.php | CPDF._add_page_text | protected function _add_page_text()
{
if (!count($this->_page_text)) {
return;
}
$page_number = 1;
$eval = null;
foreach ($this->_pages as $pid) {
$this->reopen_object($pid);
foreach ($this->_page_text as $pt) {
extract($pt);
switch ($_t) {
case "text":
$text = str_replace(array("{PAGE_NUM}", "{PAGE_COUNT}"),
array($page_number, $this->_page_count), $text);
$this->text($x, $y, $text, $font, $size, $color, $word_space, $char_space, $angle);
break;
case "script":
if (!$eval) {
$eval = new PhpEvaluator($this);
}
$eval->evaluate($code, array('PAGE_NUM' => $page_number, 'PAGE_COUNT' => $this->_page_count));
break;
case 'line':
$this->line( $x1, $y1, $x2, $y2, $color, $width, $style );
break;
}
}
$this->close_object();
$page_number++;
}
} | php | protected function _add_page_text()
{
if (!count($this->_page_text)) {
return;
}
$page_number = 1;
$eval = null;
foreach ($this->_pages as $pid) {
$this->reopen_object($pid);
foreach ($this->_page_text as $pt) {
extract($pt);
switch ($_t) {
case "text":
$text = str_replace(array("{PAGE_NUM}", "{PAGE_COUNT}"),
array($page_number, $this->_page_count), $text);
$this->text($x, $y, $text, $font, $size, $color, $word_space, $char_space, $angle);
break;
case "script":
if (!$eval) {
$eval = new PhpEvaluator($this);
}
$eval->evaluate($code, array('PAGE_NUM' => $page_number, 'PAGE_COUNT' => $this->_page_count));
break;
case 'line':
$this->line( $x1, $y1, $x2, $y2, $color, $width, $style );
break;
}
}
$this->close_object();
$page_number++;
}
} | [
"protected",
"function",
"_add_page_text",
"(",
")",
"{",
"if",
"(",
"!",
"count",
"(",
"$",
"this",
"->",
"_page_text",
")",
")",
"{",
"return",
";",
"}",
"$",
"page_number",
"=",
"1",
";",
"$",
"eval",
"=",
"null",
";",
"foreach",
"(",
"$",
"this... | Add text to each page after rendering is complete | [
"Add",
"text",
"to",
"each",
"page",
"after",
"rendering",
"is",
"complete"
] | 75f13c700009be21a1965dc2c5b68a8708c22ba2 | https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/src/Adapter/CPDF.php#L1086-L1124 | train | Adds page text to the page | [
30522,
5123,
3853,
1035,
5587,
1035,
30524,
1006,
1002,
2023,
1011,
1028,
1035,
3931,
1035,
3793,
1007,
1007,
1063,
2709,
1025,
1065,
1002,
3931,
1035,
2193,
1027,
1015,
1025,
1002,
9345,
2140,
1027,
19701,
1025,
18921,
6776,
1006,
1002,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/cms/classes/ComponentPartial.php | ComponentPartial.loadOverrideCached | public static function loadOverrideCached($theme, $component, $fileName)
{
$partial = Partial::loadCached($theme, strtolower($component->alias) . '/' . $fileName);
if ($partial === null) {
$partial = Partial::loadCached($theme, $component->alias . '/' . $fileName);
}
return $partial;
} | php | public static function loadOverrideCached($theme, $component, $fileName)
{
$partial = Partial::loadCached($theme, strtolower($component->alias) . '/' . $fileName);
if ($partial === null) {
$partial = Partial::loadCached($theme, $component->alias . '/' . $fileName);
}
return $partial;
} | [
"public",
"static",
"function",
"loadOverrideCached",
"(",
"$",
"theme",
",",
"$",
"component",
",",
"$",
"fileName",
")",
"{",
"$",
"partial",
"=",
"Partial",
"::",
"loadCached",
"(",
"$",
"theme",
",",
"strtolower",
"(",
"$",
"component",
"->",
"alias",
... | Checks if a partial override exists in the supplied theme and returns it.
Since the beginning of time, October inconsistently checked for overrides
using the component alias exactly, resulting in a folder with uppercase
characters, subsequently this method checks for both variants.
@param \Cms\Classes\Theme $theme
@param \Cms\Classes\ComponentBase $component
@param string $fileName
@return mixed | [
"Checks",
"if",
"a",
"partial",
"override",
"exists",
"in",
"the",
"supplied",
"theme",
"and",
"returns",
"it",
".",
"Since",
"the",
"beginning",
"of",
"time",
"October",
"inconsistently",
"checked",
"for",
"overrides",
"using",
"the",
"component",
"alias",
"e... | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/ComponentPartial.php#L102-L111 | train | Load override partial | [
30522,
2270,
10763,
3853,
7170,
7840,
15637,
3540,
7690,
1006,
1002,
4323,
1010,
1002,
6922,
1010,
1002,
5371,
18442,
1007,
1063,
1002,
7704,
1027,
7704,
1024,
1024,
7170,
3540,
7690,
1006,
1002,
4323,
1010,
2358,
5339,
12898,
13777,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Routing/Route.php | Route.run | public function run()
{
$this->container = $this->container ?: new Container;
try {
if ($this->isControllerAction()) {
return $this->runController();
}
return $this->runCallable();
} catch (HttpResponseException $e) {
return $e->getResponse();
}
} | php | public function run()
{
$this->container = $this->container ?: new Container;
try {
if ($this->isControllerAction()) {
return $this->runController();
}
return $this->runCallable();
} catch (HttpResponseException $e) {
return $e->getResponse();
}
} | [
"public",
"function",
"run",
"(",
")",
"{",
"$",
"this",
"->",
"container",
"=",
"$",
"this",
"->",
"container",
"?",
":",
"new",
"Container",
";",
"try",
"{",
"if",
"(",
"$",
"this",
"->",
"isControllerAction",
"(",
")",
")",
"{",
"return",
"$",
"... | Run the route action and return the response.
@return mixed | [
"Run",
"the",
"route",
"action",
"and",
"return",
"the",
"response",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Routing/Route.php#L170-L183 | train | Runs the controller action and callable. | [
30522,
2270,
3853,
2448,
1006,
1007,
1063,
1002,
2023,
1011,
1028,
11661,
1027,
1002,
2023,
1011,
1028,
11661,
1029,
1024,
2047,
11661,
1025,
3046,
1063,
2065,
1006,
1002,
2023,
1011,
1028,
2003,
8663,
13181,
10820,
18908,
3258,
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... |
octobercms/october | modules/backend/formwidgets/TagList.php | TagList.hydrateRelationSaveValue | protected function hydrateRelationSaveValue($names)
{
if (!$names) {
return $names;
}
$relationModel = $this->getRelationModel();
$existingTags = $relationModel
->whereIn($this->nameFrom, $names)
->lists($this->nameFrom, $relationModel->getKeyName())
;
$newTags = $this->customTags ? array_diff($names, $existingTags) : [];
foreach ($newTags as $newTag) {
$newModel = $relationModel::create([$this->nameFrom => $newTag]);
$existingTags[$newModel->getKey()] = $newTag;
}
return array_keys($existingTags);
} | php | protected function hydrateRelationSaveValue($names)
{
if (!$names) {
return $names;
}
$relationModel = $this->getRelationModel();
$existingTags = $relationModel
->whereIn($this->nameFrom, $names)
->lists($this->nameFrom, $relationModel->getKeyName())
;
$newTags = $this->customTags ? array_diff($names, $existingTags) : [];
foreach ($newTags as $newTag) {
$newModel = $relationModel::create([$this->nameFrom => $newTag]);
$existingTags[$newModel->getKey()] = $newTag;
}
return array_keys($existingTags);
} | [
"protected",
"function",
"hydrateRelationSaveValue",
"(",
"$",
"names",
")",
"{",
"if",
"(",
"!",
"$",
"names",
")",
"{",
"return",
"$",
"names",
";",
"}",
"$",
"relationModel",
"=",
"$",
"this",
"->",
"getRelationModel",
"(",
")",
";",
"$",
"existingTag... | Returns an array suitable for saving against a relation (array of keys).
This method also creates non-existent tags.
@return array | [
"Returns",
"an",
"array",
"suitable",
"for",
"saving",
"against",
"a",
"relation",
"(",
"array",
"of",
"keys",
")",
".",
"This",
"method",
"also",
"creates",
"non",
"-",
"existent",
"tags",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/formwidgets/TagList.php#L124-L144 | train | Hydrate RelationSaveValue Hydrates relations | [
30522,
5123,
3853,
26018,
3334,
10581,
9285,
10696,
10175,
5657,
1006,
1002,
3415,
1007,
1063,
2065,
1006,
999,
1002,
3415,
1007,
1063,
2709,
1002,
3415,
1025,
1065,
1002,
7189,
5302,
9247,
1027,
1002,
2023,
1011,
1028,
2131,
16570,
3370,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/DataCollector/TimeDataCollector.php | TimeDataCollector.lateCollect | public function lateCollect()
{
if (null !== $this->stopwatch && isset($this->data['token'])) {
$this->setEvents($this->stopwatch->getSectionEvents($this->data['token']));
}
unset($this->data['token']);
} | php | public function lateCollect()
{
if (null !== $this->stopwatch && isset($this->data['token'])) {
$this->setEvents($this->stopwatch->getSectionEvents($this->data['token']));
}
unset($this->data['token']);
} | [
"public",
"function",
"lateCollect",
"(",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"this",
"->",
"stopwatch",
"&&",
"isset",
"(",
"$",
"this",
"->",
"data",
"[",
"'token'",
"]",
")",
")",
"{",
"$",
"this",
"->",
"setEvents",
"(",
"$",
"this",
"->",... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/DataCollector/TimeDataCollector.php#L69-L75 | train | This method is called when the current request is finished. | [
30522,
2270,
3853,
2397,
26895,
22471,
1006,
1007,
1063,
2065,
1006,
19701,
999,
1027,
1027,
1002,
2023,
1011,
1028,
2644,
18866,
1004,
1004,
26354,
3388,
1006,
1002,
2023,
1011,
1028,
2951,
1031,
1005,
19204,
1005,
1033,
1007,
1007,
1063,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
z-song/laravel-admin | src/Grid/Filter.php | Filter.sanitizeInputs | protected function sanitizeInputs(&$inputs)
{
if (!$this->name) {
return $inputs;
}
$inputs = collect($inputs)->filter(function ($input, $key) {
return Str::startsWith($key, "{$this->name}_");
})->mapWithKeys(function ($val, $key) {
$key = str_replace("{$this->name}_", '', $key);
return [$key => $val];
})->toArray();
} | php | protected function sanitizeInputs(&$inputs)
{
if (!$this->name) {
return $inputs;
}
$inputs = collect($inputs)->filter(function ($input, $key) {
return Str::startsWith($key, "{$this->name}_");
})->mapWithKeys(function ($val, $key) {
$key = str_replace("{$this->name}_", '', $key);
return [$key => $val];
})->toArray();
} | [
"protected",
"function",
"sanitizeInputs",
"(",
"&",
"$",
"inputs",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"name",
")",
"{",
"return",
"$",
"inputs",
";",
"}",
"$",
"inputs",
"=",
"collect",
"(",
"$",
"inputs",
")",
"->",
"filter",
"(",
"func... | @param $inputs
@return array | [
"@param",
"$inputs"
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid/Filter.php#L336-L349 | train | Sanitize inputs by name | [
30522,
5123,
3853,
2624,
25090,
4371,
2378,
18780,
2015,
1006,
1004,
1002,
20407,
1007,
1063,
2065,
1006,
999,
1002,
2023,
1011,
1028,
2171,
1007,
1063,
2709,
1002,
20407,
1025,
1065,
1002,
20407,
1027,
8145,
1006,
1002,
20407,
1007,
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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.