repo stringclasses 21 values | path stringlengths 10 100 | func_name stringlengths 6 71 | original_string stringlengths 115 97k | language stringclasses 1 value | code stringlengths 115 97k | code_tokens listlengths 27 7.5k | docstring stringlengths 6 1.88k | docstring_tokens listlengths 1 177 | sha stringclasses 21 values | url stringlengths 100 189 | partition stringclasses 1 value | summary stringlengths 9 340 | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
laravel/framework | src/Illuminate/Database/Query/JoinClause.php | JoinClause.on | public function on($first, $operator = null, $second = null, $boolean = 'and')
{
if ($first instanceof Closure) {
return $this->whereNested($first, $boolean);
}
return $this->whereColumn($first, $operator, $second, $boolean);
} | php | public function on($first, $operator = null, $second = null, $boolean = 'and')
{
if ($first instanceof Closure) {
return $this->whereNested($first, $boolean);
}
return $this->whereColumn($first, $operator, $second, $boolean);
} | [
"public",
"function",
"on",
"(",
"$",
"first",
",",
"$",
"operator",
"=",
"null",
",",
"$",
"second",
"=",
"null",
",",
"$",
"boolean",
"=",
"'and'",
")",
"{",
"if",
"(",
"$",
"first",
"instanceof",
"Closure",
")",
"{",
"return",
"$",
"this",
"->",... | Add an "on" clause to the join.
On clauses can be chained, e.g.
$join->on('contacts.user_id', '=', 'users.id')
->on('contacts.info_id', '=', 'info.id')
will produce the following SQL:
on `contacts`.`user_id` = `users`.`id` and `contacts`.`info_id` = `info`.`id`
@param \Closure|string $first
@param string|null $operator
@param string|null $second
@param string $boolean
@return $this
@throws \InvalidArgumentException | [
"Add",
"an",
"on",
"clause",
"to",
"the",
"join",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Query/JoinClause.php#L93-L100 | train | WHERE clause. | [
30522,
2270,
3853,
2006,
1006,
1002,
2034,
1010,
1002,
6872,
1027,
19701,
1010,
1002,
2117,
1027,
19701,
1010,
1002,
22017,
20898,
1027,
1005,
1998,
1005,
1007,
1063,
2065,
1006,
1002,
2034,
6013,
11253,
8503,
1007,
1063,
2709,
1002,
2023,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/Plugin/Manager.php | Manager.updatePluginsInstalledConfig | private function updatePluginsInstalledConfig($plugins)
{
$section = PiwikConfig::getInstance()->PluginsInstalled;
$section['PluginsInstalled'] = $plugins;
PiwikConfig::getInstance()->PluginsInstalled = $section;
} | php | private function updatePluginsInstalledConfig($plugins)
{
$section = PiwikConfig::getInstance()->PluginsInstalled;
$section['PluginsInstalled'] = $plugins;
PiwikConfig::getInstance()->PluginsInstalled = $section;
} | [
"private",
"function",
"updatePluginsInstalledConfig",
"(",
"$",
"plugins",
")",
"{",
"$",
"section",
"=",
"PiwikConfig",
"::",
"getInstance",
"(",
")",
"->",
"PluginsInstalled",
";",
"$",
"section",
"[",
"'PluginsInstalled'",
"]",
"=",
"$",
"plugins",
";",
"P... | Update PluginsInstalled config
@param array $plugins Plugins | [
"Update",
"PluginsInstalled",
"config"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Plugin/Manager.php#L228-L233 | train | Update the plugins installed config | [
30522,
2797,
3853,
10651,
24759,
15916,
7076,
7076,
9080,
3709,
8663,
8873,
2290,
1006,
1002,
13354,
7076,
1007,
1063,
1002,
2930,
1027,
14255,
9148,
2243,
8663,
8873,
2290,
1024,
1024,
2131,
7076,
26897,
1006,
1007,
1011,
1028,
13354,
7076... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.addViewPath | public function addViewPath($path)
{
$this->viewPath = (array) $this->viewPath;
if (is_array($path)) {
$this->viewPath = array_merge($path, $this->viewPath);
}
else {
array_unshift($this->viewPath, $path);
}
} | php | public function addViewPath($path)
{
$this->viewPath = (array) $this->viewPath;
if (is_array($path)) {
$this->viewPath = array_merge($path, $this->viewPath);
}
else {
array_unshift($this->viewPath, $path);
}
} | [
"public",
"function",
"addViewPath",
"(",
"$",
"path",
")",
"{",
"$",
"this",
"->",
"viewPath",
"=",
"(",
"array",
")",
"$",
"this",
"->",
"viewPath",
";",
"if",
"(",
"is_array",
"(",
"$",
"path",
")",
")",
"{",
"$",
"this",
"->",
"viewPath",
"=",
... | Prepends a path on the available view path locations.
@param string|array $path
@return void | [
"Prepends",
"a",
"path",
"on",
"the",
"available",
"view",
"path",
"locations",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/traits/ViewMaker.php#L51-L61 | train | Add View Path | [
30522,
2270,
3853,
5587,
8584,
15069,
1006,
1002,
4130,
1007,
1063,
1002,
2023,
1011,
1028,
3193,
15069,
1027,
1006,
9140,
1007,
1002,
2023,
1011,
1028,
3193,
15069,
1025,
2065,
1006,
2003,
1035,
9140,
1006,
1002,
4130,
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... |
getgrav/grav | system/src/Grav/Common/Session.php | Session.setFlashCookieObject | public function setFlashCookieObject($name, $object, $time = 60)
{
setcookie($name, json_encode($object), time() + $time, '/');
return $this;
} | php | public function setFlashCookieObject($name, $object, $time = 60)
{
setcookie($name, json_encode($object), time() + $time, '/');
return $this;
} | [
"public",
"function",
"setFlashCookieObject",
"(",
"$",
"name",
",",
"$",
"object",
",",
"$",
"time",
"=",
"60",
")",
"{",
"setcookie",
"(",
"$",
"name",
",",
"json_encode",
"(",
"$",
"object",
")",
",",
"time",
"(",
")",
"+",
"$",
"time",
",",
"'/... | Store something in cookie temporarily.
@param string $name
@param mixed $object
@param int $time
@return $this | [
"Store",
"something",
"in",
"cookie",
"temporarily",
"."
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Session.php#L143-L148 | train | Set a cookie object to be sent to the user | [
30522,
2270,
3853,
2275,
10258,
11823,
3597,
23212,
8780,
2497,
20614,
1006,
1002,
2171,
1010,
1002,
4874,
1010,
1002,
2051,
1027,
3438,
1007,
1063,
2275,
3597,
23212,
2063,
1006,
1002,
2171,
1010,
1046,
3385,
1035,
4372,
16044,
1006,
1002,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
overtrue/wechat | src/OfficialAccount/CustomerService/Client.php | Client.update | public function update(string $account, string $nickname)
{
$params = [
'kf_account' => $account,
'nickname' => $nickname,
];
return $this->httpPostJson('customservice/kfaccount/update', $params);
} | php | public function update(string $account, string $nickname)
{
$params = [
'kf_account' => $account,
'nickname' => $nickname,
];
return $this->httpPostJson('customservice/kfaccount/update', $params);
} | [
"public",
"function",
"update",
"(",
"string",
"$",
"account",
",",
"string",
"$",
"nickname",
")",
"{",
"$",
"params",
"=",
"[",
"'kf_account'",
"=>",
"$",
"account",
",",
"'nickname'",
"=>",
"$",
"nickname",
",",
"]",
";",
"return",
"$",
"this",
"->"... | Update a staff.
@param string $account
@param string $nickname
@return mixed | [
"Update",
"a",
"staff",
"."
] | 120c72faaa93c270365bc75c73c362d5fd583209 | https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/OfficialAccount/CustomerService/Client.php#L69-L77 | train | Update KFAccount s account | [
30522,
2270,
3853,
10651,
1006,
5164,
1002,
4070,
1010,
5164,
1002,
8367,
1007,
1063,
1002,
11498,
5244,
1027,
1031,
1005,
1047,
2546,
1035,
4070,
1005,
1027,
1028,
1002,
4070,
1010,
1005,
8367,
1005,
1027,
1028,
1002,
8367,
1010,
1033,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getgrav/grav | system/src/Grav/Common/User/Traits/UserTrait.php | UserTrait.getAvatarImage | public function getAvatarImage(): ?ImageMedium
{
$avatars = $this->get('avatar');
if (\is_array($avatars) && $avatars) {
$avatar = array_shift($avatars);
$media = $this->getMedia();
$name = $avatar['name'] ?? null;
$image = $name ? $media[$name] : null;
if ($image instanceof ImageMedium) {
return $image;
}
}
return null;
} | php | public function getAvatarImage(): ?ImageMedium
{
$avatars = $this->get('avatar');
if (\is_array($avatars) && $avatars) {
$avatar = array_shift($avatars);
$media = $this->getMedia();
$name = $avatar['name'] ?? null;
$image = $name ? $media[$name] : null;
if ($image instanceof ImageMedium) {
return $image;
}
}
return null;
} | [
"public",
"function",
"getAvatarImage",
"(",
")",
":",
"?",
"ImageMedium",
"{",
"$",
"avatars",
"=",
"$",
"this",
"->",
"get",
"(",
"'avatar'",
")",
";",
"if",
"(",
"\\",
"is_array",
"(",
"$",
"avatars",
")",
"&&",
"$",
"avatars",
")",
"{",
"$",
"a... | Return media object for the User's avatar.
Note: if there's no local avatar image for the user, you should call getAvatarUrl() to get the external avatar URL.
@return ImageMedium|null | [
"Return",
"media",
"object",
"for",
"the",
"User",
"s",
"avatar",
"."
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/User/Traits/UserTrait.php#L112-L128 | train | Get avatar image | [
30522,
2270,
3853,
2131,
12462,
7559,
9581,
3351,
1006,
1007,
1024,
1029,
3746,
7583,
5007,
1063,
1002,
22128,
2015,
1027,
1002,
2023,
1011,
1028,
2131,
1006,
1005,
22128,
1005,
1007,
1025,
2065,
1006,
1032,
2003,
1035,
9140,
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/Auth/AuthManager.php | AuthManager.viaRequest | public function viaRequest($driver, callable $callback)
{
return $this->extend($driver, function () use ($callback) {
$guard = new RequestGuard($callback, $this->app['request'], $this->createUserProvider());
$this->app->refresh('request', $guard, 'setRequest');
return $guard;
});
} | php | public function viaRequest($driver, callable $callback)
{
return $this->extend($driver, function () use ($callback) {
$guard = new RequestGuard($callback, $this->app['request'], $this->createUserProvider());
$this->app->refresh('request', $guard, 'setRequest');
return $guard;
});
} | [
"public",
"function",
"viaRequest",
"(",
"$",
"driver",
",",
"callable",
"$",
"callback",
")",
"{",
"return",
"$",
"this",
"->",
"extend",
"(",
"$",
"driver",
",",
"function",
"(",
")",
"use",
"(",
"$",
"callback",
")",
"{",
"$",
"guard",
"=",
"new",... | Register a new callback based request guard.
@param string $driver
@param callable $callback
@return $this | [
"Register",
"a",
"new",
"callback",
"based",
"request",
"guard",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Auth/AuthManager.php#L226-L235 | train | Extend the current request guard with a new instance. | [
30522,
2270,
3853,
3081,
2890,
15500,
1006,
1002,
4062,
1010,
2655,
3085,
1002,
2655,
5963,
1007,
1063,
2709,
1002,
2023,
1011,
1028,
7949,
1006,
1002,
4062,
1010,
3853,
1006,
1007,
2224,
1006,
1002,
2655,
5963,
1007,
30524,
2121,
1006,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/SitesManager/SitesManager.php | SitesManager.recordWebsiteDataInCache | public function recordWebsiteDataInCache(&$array, $idSite)
{
$idSite = (int) $idSite;
$website = API::getInstance()->getSiteFromId($idSite);
$urls = API::getInstance()->getSiteUrlsFromId($idSite);
// add the 'hosts' entry in the website array
$array['urls'] = $urls;
$array['hosts'] = $this->getTrackerHosts($urls);
$array['exclude_unknown_urls'] = $website['exclude_unknown_urls'];
$array['excluded_ips'] = $this->getTrackerExcludedIps($website);
$array['excluded_parameters'] = self::getTrackerExcludedQueryParameters($website);
$array['excluded_user_agents'] = self::getExcludedUserAgents($website);
$array['keep_url_fragment'] = self::shouldKeepURLFragmentsFor($website);
$array['sitesearch'] = $website['sitesearch'];
$array['sitesearch_keyword_parameters'] = $this->getTrackerSearchKeywordParameters($website);
$array['sitesearch_category_parameters'] = $this->getTrackerSearchCategoryParameters($website);
$array['timezone'] = $this->getTimezoneFromWebsite($website);
$array['ts_created'] = $website['ts_created'];
$array['type'] = $website['type'];
} | php | public function recordWebsiteDataInCache(&$array, $idSite)
{
$idSite = (int) $idSite;
$website = API::getInstance()->getSiteFromId($idSite);
$urls = API::getInstance()->getSiteUrlsFromId($idSite);
// add the 'hosts' entry in the website array
$array['urls'] = $urls;
$array['hosts'] = $this->getTrackerHosts($urls);
$array['exclude_unknown_urls'] = $website['exclude_unknown_urls'];
$array['excluded_ips'] = $this->getTrackerExcludedIps($website);
$array['excluded_parameters'] = self::getTrackerExcludedQueryParameters($website);
$array['excluded_user_agents'] = self::getExcludedUserAgents($website);
$array['keep_url_fragment'] = self::shouldKeepURLFragmentsFor($website);
$array['sitesearch'] = $website['sitesearch'];
$array['sitesearch_keyword_parameters'] = $this->getTrackerSearchKeywordParameters($website);
$array['sitesearch_category_parameters'] = $this->getTrackerSearchCategoryParameters($website);
$array['timezone'] = $this->getTimezoneFromWebsite($website);
$array['ts_created'] = $website['ts_created'];
$array['type'] = $website['type'];
} | [
"public",
"function",
"recordWebsiteDataInCache",
"(",
"&",
"$",
"array",
",",
"$",
"idSite",
")",
"{",
"$",
"idSite",
"=",
"(",
"int",
")",
"$",
"idSite",
";",
"$",
"website",
"=",
"API",
"::",
"getInstance",
"(",
")",
"->",
"getSiteFromId",
"(",
"$",... | Hooks when a website tracker cache is flushed (website updated, cache deleted, or empty cache)
Will record in the tracker config file all data needed for this website in Tracker.
@param array $array
@param int $idSite
@return void | [
"Hooks",
"when",
"a",
"website",
"tracker",
"cache",
"is",
"flushed",
"(",
"website",
"updated",
"cache",
"deleted",
"or",
"empty",
"cache",
")",
"Will",
"record",
"in",
"the",
"tracker",
"config",
"file",
"all",
"data",
"needed",
"for",
"this",
"website",
... | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/SitesManager/SitesManager.php#L147-L169 | train | Record website data in the cache | [
30522,
2270,
3853,
2501,
8545,
5910,
17572,
6790,
2378,
3540,
5403,
1006,
1004,
1002,
9140,
1010,
1002,
8909,
28032,
2063,
1007,
1063,
1002,
8909,
28032,
2063,
1027,
1006,
20014,
1007,
1002,
8909,
28032,
2063,
1025,
1002,
4037,
1027,
17928,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/SitesManager/API.php | API.setSiteAliasUrls | public function setSiteAliasUrls($idSite, $urls = array())
{
Piwik::checkUserHasAdminAccess($idSite);
$mainUrl = Site::getMainUrlFor($idSite);
array_unshift($urls, $mainUrl);
$urlsProperty = new Urls($idSite);
$urlsProperty->setValue($urls);
$urlsProperty->save();
$inserted = array_diff($urlsProperty->getValue(), $urls);
$this->postUpdateWebsite($idSite);
return count($inserted);
} | php | public function setSiteAliasUrls($idSite, $urls = array())
{
Piwik::checkUserHasAdminAccess($idSite);
$mainUrl = Site::getMainUrlFor($idSite);
array_unshift($urls, $mainUrl);
$urlsProperty = new Urls($idSite);
$urlsProperty->setValue($urls);
$urlsProperty->save();
$inserted = array_diff($urlsProperty->getValue(), $urls);
$this->postUpdateWebsite($idSite);
return count($inserted);
} | [
"public",
"function",
"setSiteAliasUrls",
"(",
"$",
"idSite",
",",
"$",
"urls",
"=",
"array",
"(",
")",
")",
"{",
"Piwik",
"::",
"checkUserHasAdminAccess",
"(",
"$",
"idSite",
")",
";",
"$",
"mainUrl",
"=",
"Site",
"::",
"getMainUrlFor",
"(",
"$",
"idSit... | Set the list of alias Urls for the given idSite
Completely overwrites the current list of URLs with the provided list.
The 'main_url' of the website won't be affected by this method.
@return int the number of inserted URLs | [
"Set",
"the",
"list",
"of",
"alias",
"Urls",
"for",
"the",
"given",
"idSite"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/SitesManager/API.php#L927-L943 | train | Set alias URLs for a site | [
30522,
2270,
3853,
4520,
4221,
22786,
26210,
4877,
1006,
1002,
8909,
28032,
2063,
1010,
1002,
24471,
4877,
1027,
9140,
1006,
1007,
1007,
1063,
14255,
9148,
2243,
1024,
1024,
4638,
20330,
14949,
4215,
22311,
9468,
7971,
1006,
1002,
8909,
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... |
matomo-org/matomo | core/DataTable/Filter/ReplaceSummaryRowLabel.php | ReplaceSummaryRowLabel.filter | public function filter($table)
{
$row = $table->getRowFromId(DataTable::ID_SUMMARY_ROW);
if ($row) {
$row->setColumn('label', $this->newLabel);
} else {
$row = $table->getRowFromLabel(DataTable::LABEL_SUMMARY_ROW);
if ($row) {
$row->setColumn('label', $this->newLabel);
}
}
// recurse
foreach ($table->getRowsWithoutSummaryRow() as $row) {
$subTable = $row->getSubtable();
if ($subTable) {
$this->filter($subTable);
}
}
$summaryRow = $table->getRowFromId(DataTable::ID_SUMMARY_ROW);
if (!empty($summaryRow)) {
$subTable = $summaryRow->getSubtable();
if ($subTable) {
$this->filter($subTable);
}
}
} | php | public function filter($table)
{
$row = $table->getRowFromId(DataTable::ID_SUMMARY_ROW);
if ($row) {
$row->setColumn('label', $this->newLabel);
} else {
$row = $table->getRowFromLabel(DataTable::LABEL_SUMMARY_ROW);
if ($row) {
$row->setColumn('label', $this->newLabel);
}
}
// recurse
foreach ($table->getRowsWithoutSummaryRow() as $row) {
$subTable = $row->getSubtable();
if ($subTable) {
$this->filter($subTable);
}
}
$summaryRow = $table->getRowFromId(DataTable::ID_SUMMARY_ROW);
if (!empty($summaryRow)) {
$subTable = $summaryRow->getSubtable();
if ($subTable) {
$this->filter($subTable);
}
}
} | [
"public",
"function",
"filter",
"(",
"$",
"table",
")",
"{",
"$",
"row",
"=",
"$",
"table",
"->",
"getRowFromId",
"(",
"DataTable",
"::",
"ID_SUMMARY_ROW",
")",
";",
"if",
"(",
"$",
"row",
")",
"{",
"$",
"row",
"->",
"setColumn",
"(",
"'label'",
",",... | See {@link ReplaceSummaryRowLabel}.
@param DataTable $table | [
"See",
"{",
"@link",
"ReplaceSummaryRowLabel",
"}",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/DataTable/Filter/ReplaceSummaryRowLabel.php#L53-L81 | train | Filter the table to only the rows with the new label | [
30522,
2270,
3853,
11307,
1006,
1002,
2795,
1007,
1063,
1002,
5216,
1027,
1002,
2795,
1011,
1028,
2131,
10524,
19699,
20936,
2094,
1006,
2951,
10880,
1024,
1024,
8909,
1035,
12654,
1035,
5216,
1007,
1025,
2065,
1006,
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... |
matomo-org/matomo | libs/HTML/QuickForm2/Rule/MaxFileSize.php | HTML_QuickForm2_Rule_MaxFileSize.validateOwner | protected function validateOwner()
{
$value = $this->owner->getValue();
if (!isset($value['error']) || UPLOAD_ERR_NO_FILE == $value['error']) {
return true;
}
return ($this->getConfig() >= @filesize($value['tmp_name']));
} | php | protected function validateOwner()
{
$value = $this->owner->getValue();
if (!isset($value['error']) || UPLOAD_ERR_NO_FILE == $value['error']) {
return true;
}
return ($this->getConfig() >= @filesize($value['tmp_name']));
} | [
"protected",
"function",
"validateOwner",
"(",
")",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"owner",
"->",
"getValue",
"(",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"value",
"[",
"'error'",
"]",
")",
"||",
"UPLOAD_ERR_NO_FILE",
"==",
"$",
"val... | Validates the owner element
@return bool whether uploaded file's size is within given limit | [
"Validates",
"the",
"owner",
"element"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/HTML/QuickForm2/Rule/MaxFileSize.php#L79-L86 | train | Validate owner. | [
30522,
5123,
3853,
9398,
3686,
12384,
2121,
1006,
1007,
1063,
1002,
3643,
1027,
1002,
2023,
1011,
1028,
3954,
1011,
1028,
2131,
10175,
5657,
1006,
1007,
1025,
2065,
1006,
999,
26354,
3388,
1006,
1002,
3643,
1031,
1005,
7561,
1005,
1033,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Stopwatch/Stopwatch.php | Stopwatch.stopSection | public function stopSection($id)
{
$this->stop('__section__');
if (1 == \count($this->activeSections)) {
throw new \LogicException('There is no started section to stop.');
}
$this->sections[$id] = array_pop($this->activeSections)->setId($id);
$this->stop('__section__.child');
} | php | public function stopSection($id)
{
$this->stop('__section__');
if (1 == \count($this->activeSections)) {
throw new \LogicException('There is no started section to stop.');
}
$this->sections[$id] = array_pop($this->activeSections)->setId($id);
$this->stop('__section__.child');
} | [
"public",
"function",
"stopSection",
"(",
"$",
"id",
")",
"{",
"$",
"this",
"->",
"stop",
"(",
"'__section__'",
")",
";",
"if",
"(",
"1",
"==",
"\\",
"count",
"(",
"$",
"this",
"->",
"activeSections",
")",
")",
"{",
"throw",
"new",
"\\",
"LogicExcept... | Stops the last started section.
The id parameter is used to retrieve the events from this section.
@see getSectionEvents()
@param string $id The identifier of the section
@throws \LogicException When there's no started section to be stopped | [
"Stops",
"the",
"last",
"started",
"section",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Stopwatch/Stopwatch.php#L86-L96 | train | Stops a section | [
30522,
2270,
3853,
6762,
18491,
1006,
1002,
8909,
1007,
1063,
1002,
2023,
1011,
1028,
2644,
1006,
1005,
1035,
1035,
2930,
1035,
1035,
1005,
1007,
1025,
2065,
1006,
1015,
1027,
1027,
1032,
4175,
1006,
1002,
2023,
1011,
1028,
3161,
29015,
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... |
octobercms/october | modules/cms/classes/CmsCompoundObject.php | CmsCompoundObject.getViewBag | public function getViewBag()
{
if ($this->viewBagCache !== false) {
return $this->viewBagCache;
}
$componentName = 'viewBag';
if (!isset($this->settings['components'][$componentName])) {
$viewBag = new ViewBag(null, []);
$viewBag->name = $componentName;
return $this->viewBagCache = $viewBag;
}
return $this->viewBagCache = $this->getComponent($componentName);
} | php | public function getViewBag()
{
if ($this->viewBagCache !== false) {
return $this->viewBagCache;
}
$componentName = 'viewBag';
if (!isset($this->settings['components'][$componentName])) {
$viewBag = new ViewBag(null, []);
$viewBag->name = $componentName;
return $this->viewBagCache = $viewBag;
}
return $this->viewBagCache = $this->getComponent($componentName);
} | [
"public",
"function",
"getViewBag",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"viewBagCache",
"!==",
"false",
")",
"{",
"return",
"$",
"this",
"->",
"viewBagCache",
";",
"}",
"$",
"componentName",
"=",
"'viewBag'",
";",
"if",
"(",
"!",
"isset",
"(",... | Returns the configured view bag component.
This method is used only in the back-end and for internal system needs when
the standard way to access components is not an option.
@return \Cms\Components\ViewBag Returns the view bag component instance. | [
"Returns",
"the",
"configured",
"view",
"bag",
"component",
".",
"This",
"method",
"is",
"used",
"only",
"in",
"the",
"back",
"-",
"end",
"and",
"for",
"internal",
"system",
"needs",
"when",
"the",
"standard",
"way",
"to",
"access",
"components",
"is",
"no... | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/CmsCompoundObject.php#L355-L371 | train | Get ViewBag object | [
30522,
2270,
3853,
2131,
8584,
16078,
1006,
1007,
1063,
2065,
1006,
1002,
2023,
1011,
1028,
3193,
16078,
3540,
5403,
999,
1027,
1027,
6270,
1007,
1063,
2709,
1002,
2023,
1011,
1028,
3193,
16078,
3540,
5403,
1025,
1065,
1002,
6922,
18442,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Bundle/WebProfilerBundle/Controller/RouterController.php | RouterController.getTraces | private function getTraces(RequestDataCollector $request, string $method): array
{
$traceRequest = Request::create(
$request->getPathInfo(),
$request->getRequestServer(true)->get('REQUEST_METHOD'),
[],
$request->getRequestCookies(true)->all(),
[],
$request->getRequestServer(true)->all()
);
$context = $this->matcher->getContext();
$context->setMethod($method);
$matcher = new TraceableUrlMatcher($this->routes, $context);
return $matcher->getTracesForRequest($traceRequest);
} | php | private function getTraces(RequestDataCollector $request, string $method): array
{
$traceRequest = Request::create(
$request->getPathInfo(),
$request->getRequestServer(true)->get('REQUEST_METHOD'),
[],
$request->getRequestCookies(true)->all(),
[],
$request->getRequestServer(true)->all()
);
$context = $this->matcher->getContext();
$context->setMethod($method);
$matcher = new TraceableUrlMatcher($this->routes, $context);
return $matcher->getTracesForRequest($traceRequest);
} | [
"private",
"function",
"getTraces",
"(",
"RequestDataCollector",
"$",
"request",
",",
"string",
"$",
"method",
")",
":",
"array",
"{",
"$",
"traceRequest",
"=",
"Request",
"::",
"create",
"(",
"$",
"request",
"->",
"getPathInfo",
"(",
")",
",",
"$",
"reque... | Returns the routing traces associated to the given request. | [
"Returns",
"the",
"routing",
"traces",
"associated",
"to",
"the",
"given",
"request",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/WebProfilerBundle/Controller/RouterController.php#L81-L97 | train | Returns the traces for the given request and method | [
30522,
2797,
3853,
2131,
6494,
9623,
1006,
5227,
2850,
2696,
26895,
22471,
2953,
1002,
5227,
1010,
5164,
1002,
4118,
1007,
1024,
9140,
1063,
1002,
7637,
2890,
15500,
1027,
5227,
1024,
1024,
3443,
1006,
1002,
5227,
1011,
1028,
2131,
15069,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/Menu/MenuTop.php | MenuTop.getMenu | public function getMenu()
{
if (!$this->menu) {
foreach ($this->getAllMenus() as $menu) {
$menu->configureTopMenu($this);
}
}
return parent::getMenu();
} | php | public function getMenu()
{
if (!$this->menu) {
foreach ($this->getAllMenus() as $menu) {
$menu->configureTopMenu($this);
}
}
return parent::getMenu();
} | [
"public",
"function",
"getMenu",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"menu",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"getAllMenus",
"(",
")",
"as",
"$",
"menu",
")",
"{",
"$",
"menu",
"->",
"configureTopMenu",
"(",
"$",
"this",
... | Triggers the Menu.Top.addItems hook and returns the menu.
@return Array | [
"Triggers",
"the",
"Menu",
".",
"Top",
".",
"addItems",
"hook",
"and",
"returns",
"the",
"menu",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Menu/MenuTop.php#L52-L62 | train | Returns the top menu | [
30522,
2270,
3853,
2131,
3549,
2226,
1006,
1007,
1063,
2065,
1006,
999,
1002,
2023,
1011,
1028,
12183,
1007,
1063,
18921,
6776,
1006,
1002,
2023,
1011,
1028,
2131,
8095,
3549,
2271,
1006,
1007,
2004,
1002,
12183,
1007,
1063,
1002,
12183,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/ParameterBag/ParameterBag.php | ParameterBag.add | public function add(array $parameters)
{
foreach ($parameters as $key => $value) {
$this->set($key, $value);
}
} | php | public function add(array $parameters)
{
foreach ($parameters as $key => $value) {
$this->set($key, $value);
}
} | [
"public",
"function",
"add",
"(",
"array",
"$",
"parameters",
")",
"{",
"foreach",
"(",
"$",
"parameters",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"set",
"(",
"$",
"key",
",",
"$",
"value",
")",
";",
"}",
"}"
] | Adds parameters to the service container parameters.
@param array $parameters An array of parameters | [
"Adds",
"parameters",
"to",
"the",
"service",
"container",
"parameters",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php#L49-L54 | train | Add parameters to the array | [
30522,
2270,
3853,
5587,
1006,
9140,
1002,
11709,
1007,
1063,
18921,
6776,
1006,
1002,
11709,
2004,
1002,
3145,
1027,
1028,
1002,
3643,
1007,
1063,
1002,
2023,
1011,
1028,
2275,
1006,
1002,
3145,
1010,
1002,
3643,
1007,
1025,
1065,
1065,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/backend/widgets/MediaManager.php | MediaManager.setSortDirection | protected function setSortDirection($sortDirection)
{
if (!in_array($sortDirection, [
MediaLibrary::SORT_DIRECTION_ASC,
MediaLibrary::SORT_DIRECTION_DESC
])) {
throw new ApplicationException('Invalid input data');
}
$this->putSession('media_sort_direction', $sortDirection);
} | php | protected function setSortDirection($sortDirection)
{
if (!in_array($sortDirection, [
MediaLibrary::SORT_DIRECTION_ASC,
MediaLibrary::SORT_DIRECTION_DESC
])) {
throw new ApplicationException('Invalid input data');
}
$this->putSession('media_sort_direction', $sortDirection);
} | [
"protected",
"function",
"setSortDirection",
"(",
"$",
"sortDirection",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"sortDirection",
",",
"[",
"MediaLibrary",
"::",
"SORT_DIRECTION_ASC",
",",
"MediaLibrary",
"::",
"SORT_DIRECTION_DESC",
"]",
")",
")",
"{",
... | Sets the user sort direction from the session state
@param string $sortDirection
@return void | [
"Sets",
"the",
"user",
"sort",
"direction",
"from",
"the",
"session",
"state"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/MediaManager.php#L978-L988 | train | Set sort direction in session | [
30522,
5123,
3853,
4520,
11589,
4305,
2890,
7542,
1006,
1002,
4066,
4305,
2890,
7542,
1007,
1063,
2065,
1006,
999,
1999,
1035,
9140,
1006,
1002,
4066,
4305,
2890,
7542,
1010,
1031,
23828,
12322,
19848,
2100,
1024,
1024,
4066,
1035,
3257,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/EventDispatcher/EventDispatcher.php | EventDispatcher.sortListeners | private function sortListeners(string $eventName)
{
krsort($this->listeners[$eventName]);
$this->sorted[$eventName] = [];
foreach ($this->listeners[$eventName] as &$listeners) {
foreach ($listeners as $k => $listener) {
if (\is_array($listener) && isset($listener[0]) && $listener[0] instanceof \Closure) {
$listener[0] = $listener[0]();
}
$this->sorted[$eventName][] = $listener;
}
}
} | php | private function sortListeners(string $eventName)
{
krsort($this->listeners[$eventName]);
$this->sorted[$eventName] = [];
foreach ($this->listeners[$eventName] as &$listeners) {
foreach ($listeners as $k => $listener) {
if (\is_array($listener) && isset($listener[0]) && $listener[0] instanceof \Closure) {
$listener[0] = $listener[0]();
}
$this->sorted[$eventName][] = $listener;
}
}
} | [
"private",
"function",
"sortListeners",
"(",
"string",
"$",
"eventName",
")",
"{",
"krsort",
"(",
"$",
"this",
"->",
"listeners",
"[",
"$",
"eventName",
"]",
")",
";",
"$",
"this",
"->",
"sorted",
"[",
"$",
"eventName",
"]",
"=",
"[",
"]",
";",
"fore... | Sorts the internal list of listeners for the given event by priority. | [
"Sorts",
"the",
"internal",
"list",
"of",
"listeners",
"for",
"the",
"given",
"event",
"by",
"priority",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/EventDispatcher/EventDispatcher.php#L267-L280 | train | Sort listeners by priority | [
30522,
2797,
3853,
4066,
9863,
24454,
2015,
1006,
5164,
1002,
2724,
18442,
1007,
1063,
1047,
25301,
5339,
1006,
30524,
13810,
1007,
1063,
18921,
6776,
1006,
1002,
13810,
2004,
1002,
1047,
1027,
1028,
1002,
19373,
1007,
1063,
2065,
1006,
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... |
php-ai/php-ml | src/Math/LinearAlgebra/EigenvalueDecomposition.php | EigenvalueDecomposition.getDiagonalEigenvalues | public function getDiagonalEigenvalues(): array
{
$D = [];
for ($i = 0; $i < $this->n; ++$i) {
$D[$i] = array_fill(0, $this->n, 0.0);
$D[$i][$i] = $this->d[$i];
if ($this->e[$i] == 0) {
continue;
}
$o = $this->e[$i] > 0 ? $i + 1 : $i - 1;
$D[$i][$o] = $this->e[$i];
}
return $D;
} | php | public function getDiagonalEigenvalues(): array
{
$D = [];
for ($i = 0; $i < $this->n; ++$i) {
$D[$i] = array_fill(0, $this->n, 0.0);
$D[$i][$i] = $this->d[$i];
if ($this->e[$i] == 0) {
continue;
}
$o = $this->e[$i] > 0 ? $i + 1 : $i - 1;
$D[$i][$o] = $this->e[$i];
}
return $D;
} | [
"public",
"function",
"getDiagonalEigenvalues",
"(",
")",
":",
"array",
"{",
"$",
"D",
"=",
"[",
"]",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"$",
"this",
"->",
"n",
";",
"++",
"$",
"i",
")",
"{",
"$",
"D",
"[",
"$",
"i",
... | Return the block diagonal eigenvalue matrix | [
"Return",
"the",
"block",
"diagonal",
"eigenvalue",
"matrix"
] | f6aa1a59b0525b8fca3d2786d661ab3e70904016 | https://github.com/php-ai/php-ml/blob/f6aa1a59b0525b8fca3d2786d661ab3e70904016/src/Math/LinearAlgebra/EigenvalueDecomposition.php#L168-L184 | train | getDiagonal Eigenvalues - 1 = > n 0 = > 1 0 = > 1 0 = > 1 0 = > 1 0 = > 1 0 = > 1 0 = > 1 0 = > 1 0 = > 1 0 = > 1 0 = > 1 0 = > 1 0 = > 1 0 = > 1 0 = > 1 0 = > 1 0 = > 1 0 = > 1 0 = > 1 0 = > 1 0 = > 1 0 = > 1 | [
30522,
2270,
3853,
2131,
9032,
20028,
7416,
6914,
10175,
15808,
1006,
1007,
1024,
9140,
1063,
1002,
1040,
1027,
1031,
1033,
1025,
2005,
1006,
1002,
1045,
1027,
1014,
1025,
1002,
1045,
1026,
1002,
2023,
1011,
1028,
1050,
1025,
1009,
1009,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getgrav/grav | system/src/Grav/Common/Page/Page.php | Page.raw | public function raw($var = null)
{
$file = $this->file();
if ($var) {
// First update file object.
if ($file) {
$file->raw($var);
}
// Reset header and content.
$this->modified = time();
$this->id($this->modified() . md5($this->filePath()));
$this->header = null;
$this->content = null;
$this->summary = null;
}
return $file ? $file->raw() : '';
} | php | public function raw($var = null)
{
$file = $this->file();
if ($var) {
// First update file object.
if ($file) {
$file->raw($var);
}
// Reset header and content.
$this->modified = time();
$this->id($this->modified() . md5($this->filePath()));
$this->header = null;
$this->content = null;
$this->summary = null;
}
return $file ? $file->raw() : '';
} | [
"public",
"function",
"raw",
"(",
"$",
"var",
"=",
"null",
")",
"{",
"$",
"file",
"=",
"$",
"this",
"->",
"file",
"(",
")",
";",
"if",
"(",
"$",
"var",
")",
"{",
"// First update file object.",
"if",
"(",
"$",
"file",
")",
"{",
"$",
"file",
"->",... | Gets and Sets the raw data
@param string $var Raw content string
@return string Raw content string | [
"Gets",
"and",
"Sets",
"the",
"raw",
"data"
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L255-L274 | train | Return raw content of file | [
30522,
2270,
3853,
6315,
1006,
1002,
13075,
1027,
19701,
1007,
1063,
1002,
5371,
1027,
1002,
2023,
1011,
1028,
5371,
1006,
1007,
1025,
2065,
1006,
1002,
13075,
1007,
1063,
1013,
1013,
2034,
10651,
5371,
4874,
1012,
2065,
1006,
1002,
5371,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/system/classes/MediaLibrary.php | MediaLibrary.listAllDirectories | public function listAllDirectories($exclude = [])
{
$fullPath = $this->getMediaPath('/');
$folders = $this->getStorageDisk()->allDirectories($fullPath);
$folders = array_unique($folders, SORT_LOCALE_STRING);
$result = [];
foreach ($folders as $folder) {
$folder = $this->getMediaRelativePath($folder);
if (!strlen($folder)) {
$folder = '/';
}
if (Str::startsWith($folder, $exclude)) {
continue;
}
$result[] = $folder;
}
if (!in_array('/', $result)) {
array_unshift($result, '/');
}
return $result;
} | php | public function listAllDirectories($exclude = [])
{
$fullPath = $this->getMediaPath('/');
$folders = $this->getStorageDisk()->allDirectories($fullPath);
$folders = array_unique($folders, SORT_LOCALE_STRING);
$result = [];
foreach ($folders as $folder) {
$folder = $this->getMediaRelativePath($folder);
if (!strlen($folder)) {
$folder = '/';
}
if (Str::startsWith($folder, $exclude)) {
continue;
}
$result[] = $folder;
}
if (!in_array('/', $result)) {
array_unshift($result, '/');
}
return $result;
} | [
"public",
"function",
"listAllDirectories",
"(",
"$",
"exclude",
"=",
"[",
"]",
")",
"{",
"$",
"fullPath",
"=",
"$",
"this",
"->",
"getMediaPath",
"(",
"'/'",
")",
";",
"$",
"folders",
"=",
"$",
"this",
"->",
"getStorageDisk",
"(",
")",
"->",
"allDirec... | Returns a list of all directories in the Library, optionally excluding some of them.
@param array $exclude A list of folders to exclude from the result list.
The folder paths should be specified relative to the Library root.
@return array | [
"Returns",
"a",
"list",
"of",
"all",
"directories",
"in",
"the",
"Library",
"optionally",
"excluding",
"some",
"of",
"them",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/MediaLibrary.php#L274-L302 | train | Get all directories in the media directory | [
30522,
2270,
3853,
2862,
8095,
4305,
2890,
16761,
3111,
1006,
1002,
23329,
1027,
1031,
1033,
1007,
1063,
1002,
2440,
15069,
1027,
1002,
2023,
1011,
1028,
2131,
16969,
15069,
1006,
1005,
1013,
1005,
1007,
1025,
1002,
19622,
2015,
1027,
1002,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php | AbstractNormalizer.setIgnoredAttributes | public function setIgnoredAttributes(array $ignoredAttributes)
{
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.2, use the "ignored_attributes" key of the context instead.', __METHOD__), E_USER_DEPRECATED);
$this->defaultContext[self::IGNORED_ATTRIBUTES] = $this->ignoredAttributes = $ignoredAttributes;
return $this;
} | php | public function setIgnoredAttributes(array $ignoredAttributes)
{
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.2, use the "ignored_attributes" key of the context instead.', __METHOD__), E_USER_DEPRECATED);
$this->defaultContext[self::IGNORED_ATTRIBUTES] = $this->ignoredAttributes = $ignoredAttributes;
return $this;
} | [
"public",
"function",
"setIgnoredAttributes",
"(",
"array",
"$",
"ignoredAttributes",
")",
"{",
"@",
"trigger_error",
"(",
"sprintf",
"(",
"'The \"%s()\" method is deprecated since Symfony 4.2, use the \"ignored_attributes\" key of the context instead.'",
",",
"__METHOD__",
")",
... | Sets ignored attributes for normalization and denormalization.
@deprecated since Symfony 4.2
@return self | [
"Sets",
"ignored",
"attributes",
"for",
"normalization",
"and",
"denormalization",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php#L256-L263 | train | Sets the ignored attributes | [
30522,
2270,
3853,
2275,
23773,
19574,
19321,
3089,
8569,
4570,
1006,
9140,
1002,
6439,
19321,
3089,
8569,
4570,
1007,
1063,
1030,
9495,
1035,
7561,
1006,
9043,
2546,
1006,
1005,
1996,
1000,
1003,
1055,
1006,
1007,
1000,
4118,
2003,
2139,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Database/Query/Grammars/Grammar.php | Grammar.compileAggregate | protected function compileAggregate(Builder $query, $aggregate)
{
$column = $this->columnize($aggregate['columns']);
// If the query has a "distinct" constraint and we're not asking for all columns
// we need to prepend "distinct" onto the column name so that the query takes
// it into account when it performs the aggregating operations on the data.
if ($query->distinct && $column !== '*') {
$column = 'distinct '.$column;
}
return 'select '.$aggregate['function'].'('.$column.') as aggregate';
} | php | protected function compileAggregate(Builder $query, $aggregate)
{
$column = $this->columnize($aggregate['columns']);
// If the query has a "distinct" constraint and we're not asking for all columns
// we need to prepend "distinct" onto the column name so that the query takes
// it into account when it performs the aggregating operations on the data.
if ($query->distinct && $column !== '*') {
$column = 'distinct '.$column;
}
return 'select '.$aggregate['function'].'('.$column.') as aggregate';
} | [
"protected",
"function",
"compileAggregate",
"(",
"Builder",
"$",
"query",
",",
"$",
"aggregate",
")",
"{",
"$",
"column",
"=",
"$",
"this",
"->",
"columnize",
"(",
"$",
"aggregate",
"[",
"'columns'",
"]",
")",
";",
"// If the query has a \"distinct\" constraint... | Compile an aggregated select clause.
@param \Illuminate\Database\Query\Builder $query
@param array $aggregate
@return string | [
"Compile",
"an",
"aggregated",
"select",
"clause",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Query/Grammars/Grammar.php#L105-L117 | train | Compiles an aggregate function into a string | [
30522,
5123,
3853,
4012,
22090,
8490,
17603,
5867,
1006,
12508,
1002,
23032,
1010,
1002,
9572,
1007,
1063,
1002,
5930,
1027,
1002,
2023,
1011,
1028,
5930,
4697,
1006,
1002,
9572,
1031,
1005,
7753,
1005,
1033,
1007,
1025,
1013,
1013,
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... |
barryvdh/laravel-debugbar | src/ServiceProvider.php | ServiceProvider.boot | public function boot()
{
$configPath = __DIR__ . '/../config/debugbar.php';
$this->publishes([$configPath => $this->getConfigPath()], 'config');
$routeConfig = [
'namespace' => 'Barryvdh\Debugbar\Controllers',
'prefix' => $this->app['config']->get('debugbar.route_prefix'),
'domain' => $this->app['config']->get('debugbar.route_domain'),
'middleware' => [DebugbarEnabled::class],
];
$this->getRouter()->group($routeConfig, function($router) {
$router->get('open', [
'uses' => 'OpenHandlerController@handle',
'as' => 'debugbar.openhandler',
]);
$router->get('clockwork/{id}', [
'uses' => 'OpenHandlerController@clockwork',
'as' => 'debugbar.clockwork',
]);
$router->get('telescope/{id}', [
'uses' => 'TelescopeController@show',
'as' => 'debugbar.telescope',
]);
$router->get('assets/stylesheets', [
'uses' => 'AssetController@css',
'as' => 'debugbar.assets.css',
]);
$router->get('assets/javascript', [
'uses' => 'AssetController@js',
'as' => 'debugbar.assets.js',
]);
$router->delete('cache/{key}/{tags?}', [
'uses' => 'CacheController@delete',
'as' => 'debugbar.cache.delete',
]);
});
$this->registerMiddleware(InjectDebugbar::class);
} | php | public function boot()
{
$configPath = __DIR__ . '/../config/debugbar.php';
$this->publishes([$configPath => $this->getConfigPath()], 'config');
$routeConfig = [
'namespace' => 'Barryvdh\Debugbar\Controllers',
'prefix' => $this->app['config']->get('debugbar.route_prefix'),
'domain' => $this->app['config']->get('debugbar.route_domain'),
'middleware' => [DebugbarEnabled::class],
];
$this->getRouter()->group($routeConfig, function($router) {
$router->get('open', [
'uses' => 'OpenHandlerController@handle',
'as' => 'debugbar.openhandler',
]);
$router->get('clockwork/{id}', [
'uses' => 'OpenHandlerController@clockwork',
'as' => 'debugbar.clockwork',
]);
$router->get('telescope/{id}', [
'uses' => 'TelescopeController@show',
'as' => 'debugbar.telescope',
]);
$router->get('assets/stylesheets', [
'uses' => 'AssetController@css',
'as' => 'debugbar.assets.css',
]);
$router->get('assets/javascript', [
'uses' => 'AssetController@js',
'as' => 'debugbar.assets.js',
]);
$router->delete('cache/{key}/{tags?}', [
'uses' => 'CacheController@delete',
'as' => 'debugbar.cache.delete',
]);
});
$this->registerMiddleware(InjectDebugbar::class);
} | [
"public",
"function",
"boot",
"(",
")",
"{",
"$",
"configPath",
"=",
"__DIR__",
".",
"'/../config/debugbar.php'",
";",
"$",
"this",
"->",
"publishes",
"(",
"[",
"$",
"configPath",
"=>",
"$",
"this",
"->",
"getConfigPath",
"(",
")",
"]",
",",
"'config'",
... | Bootstrap the application events.
@return void | [
"Bootstrap",
"the",
"application",
"events",
"."
] | 2d195779ea4f809f69764a795e2ec371dbb76a96 | https://github.com/barryvdh/laravel-debugbar/blob/2d195779ea4f809f69764a795e2ec371dbb76a96/src/ServiceProvider.php#L64-L109 | train | Boots the debug bar | [
30522,
2270,
3853,
9573,
1006,
1007,
1063,
1002,
9530,
8873,
21600,
8988,
1027,
1035,
1035,
16101,
1035,
1035,
1012,
1005,
1013,
1012,
1012,
1013,
9530,
8873,
2290,
1013,
2139,
8569,
18259,
2906,
1012,
25718,
1005,
1025,
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/Piwik.php | Piwik.isUserIsAnonymous | public static function isUserIsAnonymous()
{
$currentUserLogin = Piwik::getCurrentUserLogin();
$isSuperUser = self::hasUserSuperUserAccess();
return !$isSuperUser && $currentUserLogin && strtolower($currentUserLogin) == 'anonymous';
} | php | public static function isUserIsAnonymous()
{
$currentUserLogin = Piwik::getCurrentUserLogin();
$isSuperUser = self::hasUserSuperUserAccess();
return !$isSuperUser && $currentUserLogin && strtolower($currentUserLogin) == 'anonymous';
} | [
"public",
"static",
"function",
"isUserIsAnonymous",
"(",
")",
"{",
"$",
"currentUserLogin",
"=",
"Piwik",
"::",
"getCurrentUserLogin",
"(",
")",
";",
"$",
"isSuperUser",
"=",
"self",
"::",
"hasUserSuperUserAccess",
"(",
")",
";",
"return",
"!",
"$",
"isSuperU... | Returns true if the current user is the special **anonymous** user or not.
@return bool
@api | [
"Returns",
"true",
"if",
"the",
"current",
"user",
"is",
"the",
"special",
"**",
"anonymous",
"**",
"user",
"or",
"not",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Piwik.php#L320-L325 | train | Returns true if the current user is not a super user | [
30522,
2270,
10763,
3853,
2003,
20330,
29196,
16585,
27711,
1006,
1007,
1063,
1002,
2783,
20330,
21197,
2378,
1027,
14255,
9148,
2243,
1024,
1024,
2131,
10841,
14343,
3372,
20330,
21197,
2378,
1006,
1007,
1025,
1002,
26354,
6279,
21608,
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... |
laravel/framework | src/Illuminate/Queue/QueueServiceProvider.php | QueueServiceProvider.register | public function register()
{
$this->registerManager();
$this->registerConnection();
$this->registerWorker();
$this->registerListener();
$this->registerFailedJobServices();
$this->registerOpisSecurityKey();
} | php | public function register()
{
$this->registerManager();
$this->registerConnection();
$this->registerWorker();
$this->registerListener();
$this->registerFailedJobServices();
$this->registerOpisSecurityKey();
} | [
"public",
"function",
"register",
"(",
")",
"{",
"$",
"this",
"->",
"registerManager",
"(",
")",
";",
"$",
"this",
"->",
"registerConnection",
"(",
")",
";",
"$",
"this",
"->",
"registerWorker",
"(",
")",
";",
"$",
"this",
"->",
"registerListener",
"(",
... | Register the service provider.
@return void | [
"Register",
"the",
"service",
"provider",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Queue/QueueServiceProvider.php#L26-L34 | train | Register all the classes | [
30522,
2270,
3853,
4236,
1006,
1007,
1063,
1002,
2023,
1011,
1028,
4236,
24805,
4590,
1006,
1007,
1025,
1002,
2023,
1011,
1028,
4236,
8663,
2638,
7542,
1006,
1007,
1025,
1002,
2023,
1011,
1028,
4236,
6198,
2121,
1006,
1007,
1025,
1002,
20... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/HttpFoundation/Session/Session.php | Session.setId | public function setId($id)
{
if ($this->storage->getId() !== $id) {
$this->storage->setId($id);
}
} | php | public function setId($id)
{
if ($this->storage->getId() !== $id) {
$this->storage->setId($id);
}
} | [
"public",
"function",
"setId",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"storage",
"->",
"getId",
"(",
")",
"!==",
"$",
"id",
")",
"{",
"$",
"this",
"->",
"storage",
"->",
"setId",
"(",
"$",
"id",
")",
";",
"}",
"}"
] | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpFoundation/Session/Session.php#L210-L215 | train | Set ID of the record in the cache | [
30522,
2270,
3853,
2275,
3593,
1006,
1002,
8909,
1007,
1063,
2065,
1006,
1002,
2023,
1011,
1028,
5527,
1011,
1028,
2131,
3593,
1006,
1007,
999,
1027,
1027,
1002,
8909,
1007,
1063,
1002,
2023,
1011,
1028,
5527,
1011,
1028,
2275,
3593,
1006... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Templating/Helper/SlotsHelper.php | SlotsHelper.get | public function get($name, $default = false)
{
return isset($this->slots[$name]) ? $this->slots[$name] : $default;
} | php | public function get($name, $default = false)
{
return isset($this->slots[$name]) ? $this->slots[$name] : $default;
} | [
"public",
"function",
"get",
"(",
"$",
"name",
",",
"$",
"default",
"=",
"false",
")",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"slots",
"[",
"$",
"name",
"]",
")",
"?",
"$",
"this",
"->",
"slots",
"[",
"$",
"name",
"]",
":",
"$",
"defau... | Gets the slot value.
@param string $name The slot name
@param bool|string $default The default slot content
@return string The slot content | [
"Gets",
"the",
"slot",
"value",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Templating/Helper/SlotsHelper.php#L83-L86 | train | Get a slot | [
30522,
2270,
3853,
2131,
1006,
1002,
2171,
1010,
1002,
12398,
1027,
6270,
1007,
1063,
2709,
26354,
3388,
1006,
1002,
2023,
1011,
1028,
19832,
1031,
1002,
2171,
1033,
1007,
1029,
1002,
2023,
1011,
1028,
19832,
1031,
1002,
2171,
1033,
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... |
symfony/symfony | src/Symfony/Component/Process/Process.php | Process.resetProcessData | private function resetProcessData()
{
$this->starttime = null;
$this->callback = null;
$this->exitcode = null;
$this->fallbackStatus = [];
$this->processInformation = null;
$this->stdout = fopen('php://temp/maxmemory:'.(1024 * 1024), 'w+b');
$this->stderr = fopen('php://temp/maxmemory:'.(1024 * 1024), 'w+b');
$this->process = null;
$this->latestSignal = null;
$this->status = self::STATUS_READY;
$this->incrementalOutputOffset = 0;
$this->incrementalErrorOutputOffset = 0;
} | php | private function resetProcessData()
{
$this->starttime = null;
$this->callback = null;
$this->exitcode = null;
$this->fallbackStatus = [];
$this->processInformation = null;
$this->stdout = fopen('php://temp/maxmemory:'.(1024 * 1024), 'w+b');
$this->stderr = fopen('php://temp/maxmemory:'.(1024 * 1024), 'w+b');
$this->process = null;
$this->latestSignal = null;
$this->status = self::STATUS_READY;
$this->incrementalOutputOffset = 0;
$this->incrementalErrorOutputOffset = 0;
} | [
"private",
"function",
"resetProcessData",
"(",
")",
"{",
"$",
"this",
"->",
"starttime",
"=",
"null",
";",
"$",
"this",
"->",
"callback",
"=",
"null",
";",
"$",
"this",
"->",
"exitcode",
"=",
"null",
";",
"$",
"this",
"->",
"fallbackStatus",
"=",
"[",... | Resets data related to the latest run of the process. | [
"Resets",
"data",
"related",
"to",
"the",
"latest",
"run",
"of",
"the",
"process",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Process/Process.php#L1470-L1484 | train | Reset process data | [
30522,
2797,
3853,
25141,
21572,
9623,
16150,
6790,
1006,
1007,
1063,
1002,
2023,
1011,
1028,
2707,
7292,
1027,
19701,
1025,
1002,
2023,
1011,
1028,
2655,
5963,
1027,
19701,
1025,
1002,
2023,
1011,
1028,
6164,
16044,
1027,
19701,
1025,
1002... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Cache/Repository.php | Repository.handleManyResult | protected function handleManyResult($keys, $key, $value)
{
// If we could not find the cache value, we will fire the missed event and get
// the default value for this cache value. This default could be a callback
// so we will execute the value function which will resolve it if needed.
if (is_null($value)) {
$this->event(new CacheMissed($key));
return isset($keys[$key]) ? value($keys[$key]) : null;
}
// If we found a valid value we will fire the "hit" event and return the value
// back from this function. The "hit" event gives developers an opportunity
// to listen for every possible cache "hit" throughout this applications.
$this->event(new CacheHit($key, $value));
return $value;
} | php | protected function handleManyResult($keys, $key, $value)
{
// If we could not find the cache value, we will fire the missed event and get
// the default value for this cache value. This default could be a callback
// so we will execute the value function which will resolve it if needed.
if (is_null($value)) {
$this->event(new CacheMissed($key));
return isset($keys[$key]) ? value($keys[$key]) : null;
}
// If we found a valid value we will fire the "hit" event and return the value
// back from this function. The "hit" event gives developers an opportunity
// to listen for every possible cache "hit" throughout this applications.
$this->event(new CacheHit($key, $value));
return $value;
} | [
"protected",
"function",
"handleManyResult",
"(",
"$",
"keys",
",",
"$",
"key",
",",
"$",
"value",
")",
"{",
"// If we could not find the cache value, we will fire the missed event and get",
"// the default value for this cache value. This default could be a callback",
"// so we will... | Handle a result for the "many" method.
@param array $keys
@param string $key
@param mixed $value
@return mixed | [
"Handle",
"a",
"result",
"for",
"the",
"many",
"method",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Cache/Repository.php#L158-L175 | train | Handle the many result | [
30522,
5123,
3853,
5047,
2386,
16363,
23722,
2102,
1006,
1002,
6309,
1010,
1002,
3145,
1010,
1002,
3643,
1007,
1063,
1013,
1013,
2065,
2057,
2071,
2025,
2424,
1996,
17053,
3643,
1010,
2057,
2097,
2543,
1996,
4771,
2724,
1998,
2131,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
z-song/laravel-admin | src/Form/Field/Select.php | Select.options | public function options($options = [])
{
// remote options
if (is_string($options)) {
// reload selected
if (class_exists($options) && in_array(Model::class, class_parents($options))) {
return $this->model(...func_get_args());
}
return $this->loadRemoteOptions(...func_get_args());
}
if ($options instanceof Arrayable) {
$options = $options->toArray();
}
if (is_callable($options)) {
$this->options = $options;
} else {
$this->options = (array) $options;
}
return $this;
} | php | public function options($options = [])
{
// remote options
if (is_string($options)) {
// reload selected
if (class_exists($options) && in_array(Model::class, class_parents($options))) {
return $this->model(...func_get_args());
}
return $this->loadRemoteOptions(...func_get_args());
}
if ($options instanceof Arrayable) {
$options = $options->toArray();
}
if (is_callable($options)) {
$this->options = $options;
} else {
$this->options = (array) $options;
}
return $this;
} | [
"public",
"function",
"options",
"(",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"// remote options",
"if",
"(",
"is_string",
"(",
"$",
"options",
")",
")",
"{",
"// reload selected",
"if",
"(",
"class_exists",
"(",
"$",
"options",
")",
"&&",
"in_array",
"... | Set options.
@param array|callable|string $options
@return $this|mixed | [
"Set",
"options",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Form/Field/Select.php#L45-L68 | train | Options getter and setter | [
30522,
2270,
3853,
7047,
1006,
1002,
7047,
1027,
1031,
1033,
1007,
1063,
1013,
1013,
6556,
7047,
2065,
1006,
2003,
1035,
5164,
1006,
1002,
7047,
1007,
1007,
1063,
1013,
1013,
2128,
11066,
3479,
2065,
1006,
2465,
1035,
6526,
1006,
1002,
70... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.render | public function render()
{
return $this->withLocale($this->locale, function () {
Container::getInstance()->call([$this, 'build']);
return Container::getInstance()->make('mailer')->render(
$this->buildView(), $this->buildViewData()
);
});
} | php | public function render()
{
return $this->withLocale($this->locale, function () {
Container::getInstance()->call([$this, 'build']);
return Container::getInstance()->make('mailer')->render(
$this->buildView(), $this->buildViewData()
);
});
} | [
"public",
"function",
"render",
"(",
")",
"{",
"return",
"$",
"this",
"->",
"withLocale",
"(",
"$",
"this",
"->",
"locale",
",",
"function",
"(",
")",
"{",
"Container",
"::",
"getInstance",
"(",
")",
"->",
"call",
"(",
"[",
"$",
"this",
",",
"'build'... | Render the mailable into a view.
@return \Illuminate\View\View
@throws \ReflectionException | [
"Render",
"the",
"mailable",
"into",
"a",
"view",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Mail/Mailable.php#L209-L218 | train | Render the message. | [
30522,
2270,
3853,
17552,
1006,
1007,
1063,
2709,
1002,
2023,
1011,
1028,
2007,
4135,
9289,
2063,
1006,
1002,
2023,
1011,
1028,
2334,
2063,
1010,
3853,
1006,
1007,
1063,
11661,
1024,
1024,
2131,
7076,
26897,
1006,
1007,
1011,
1028,
2655,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Ldap/Adapter/ExtLdap/EntryManager.php | EntryManager.addAttributeValues | public function addAttributeValues(Entry $entry, string $attribute, array $values)
{
$con = $this->getConnectionResource();
if (!@ldap_mod_add($con, $entry->getDn(), [$attribute => $values])) {
throw new LdapException(sprintf('Could not add values to entry "%s", attribute %s: %s.', $entry->getDn(), $attribute, ldap_error($con)));
}
} | php | public function addAttributeValues(Entry $entry, string $attribute, array $values)
{
$con = $this->getConnectionResource();
if (!@ldap_mod_add($con, $entry->getDn(), [$attribute => $values])) {
throw new LdapException(sprintf('Could not add values to entry "%s", attribute %s: %s.', $entry->getDn(), $attribute, ldap_error($con)));
}
} | [
"public",
"function",
"addAttributeValues",
"(",
"Entry",
"$",
"entry",
",",
"string",
"$",
"attribute",
",",
"array",
"$",
"values",
")",
"{",
"$",
"con",
"=",
"$",
"this",
"->",
"getConnectionResource",
"(",
")",
";",
"if",
"(",
"!",
"@",
"ldap_mod_add... | Adds values to an entry's multi-valued attribute from the LDAP server.
@throws NotBoundException
@throws LdapException | [
"Adds",
"values",
"to",
"an",
"entry",
"s",
"multi",
"-",
"valued",
"attribute",
"from",
"the",
"LDAP",
"server",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Ldap/Adapter/ExtLdap/EntryManager.php#L77-L84 | train | Adds values to an entry s attribute | [
30522,
2270,
3853,
5587,
19321,
3089,
8569,
2618,
10175,
15808,
1006,
4443,
1002,
4443,
1010,
5164,
1002,
17961,
1010,
9140,
1002,
5300,
1007,
1063,
1002,
9530,
1027,
1002,
2023,
1011,
1028,
2131,
8663,
2638,
7542,
6072,
8162,
3401,
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... |
dompdf/dompdf | src/Adapter/CPDF.php | CPDF.line | public function line($x1, $y1, $x2, $y2, $color, $width, $style = array())
{
$this->_set_stroke_color($color);
$this->_set_line_style($width, "butt", "", $style);
$this->_pdf->line($x1, $this->y($y1),
$x2, $this->y($y2));
$this->_set_line_transparency("Normal", $this->_current_opacity);
} | php | public function line($x1, $y1, $x2, $y2, $color, $width, $style = array())
{
$this->_set_stroke_color($color);
$this->_set_line_style($width, "butt", "", $style);
$this->_pdf->line($x1, $this->y($y1),
$x2, $this->y($y2));
$this->_set_line_transparency("Normal", $this->_current_opacity);
} | [
"public",
"function",
"line",
"(",
"$",
"x1",
",",
"$",
"y1",
",",
"$",
"x2",
",",
"$",
"y2",
",",
"$",
"color",
",",
"$",
"width",
",",
"$",
"style",
"=",
"array",
"(",
")",
")",
"{",
"$",
"this",
"->",
"_set_stroke_color",
"(",
"$",
"color",
... | Canvas implementation
@param float $x1
@param float $y1
@param float $x2
@param float $y2
@param array $color
@param float $width
@param array $style | [
"Canvas",
"implementation"
] | 75f13c700009be21a1965dc2c5b68a8708c22ba2 | https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/src/Adapter/CPDF.php#L554-L562 | train | Write a line to the pdf | [
30522,
2270,
3853,
2240,
1006,
1002,
1060,
2487,
1010,
1002,
1061,
2487,
1010,
1002,
1060,
2475,
1010,
1002,
1061,
2475,
1010,
1002,
3609,
1010,
1002,
9381,
1010,
1002,
2806,
1027,
9140,
1006,
1007,
1007,
1063,
1002,
2023,
1011,
1028,
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/Bundle/FrameworkBundle/Command/DebugAutowiringCommand.php | DebugAutowiringCommand.execute | protected function execute(InputInterface $input, OutputInterface $output)
{
$io = new SymfonyStyle($input, $output);
$errorIo = $io->getErrorStyle();
$builder = $this->getContainerBuilder();
$serviceIds = $builder->getServiceIds();
$serviceIds = array_filter($serviceIds, [$this, 'filterToServiceTypes']);
if ($search = $input->getArgument('search')) {
$serviceIds = array_filter($serviceIds, function ($serviceId) use ($search) {
return false !== stripos(str_replace('\\', '', $serviceId), $search) && 0 !== strpos($serviceId, '.');
});
if (empty($serviceIds)) {
$errorIo->error(sprintf('No autowirable classes or interfaces found matching "%s"', $search));
return 1;
}
}
uasort($serviceIds, 'strnatcmp');
$io->title('Autowirable Types');
$io->text('The following classes & interfaces can be used as type-hints when autowiring:');
if ($search) {
$io->text(sprintf('(only showing classes/interfaces matching <comment>%s</comment>)', $search));
}
$hasAlias = [];
$all = $input->getOption('all');
$previousId = '-';
$serviceIdsNb = 0;
foreach ($serviceIds as $serviceId) {
$text = [];
if (0 !== strpos($serviceId, $previousId)) {
$text[] = '';
if ('' !== $description = Descriptor::getClassDescription($serviceId, $serviceId)) {
if (isset($hasAlias[$serviceId])) {
continue;
}
$text[] = $description;
}
$previousId = $serviceId.' $';
}
$serviceLine = sprintf('<fg=yellow>%s</>', $serviceId);
if ($this->supportsHref && '' !== $fileLink = $this->getFileLink($serviceId)) {
$serviceLine = sprintf('<fg=yellow;href=%s>%s</>', $fileLink, $serviceId);
}
if ($builder->hasAlias($serviceId)) {
$hasAlias[$serviceId] = true;
$serviceAlias = $builder->getAlias($serviceId);
$serviceLine .= ' <fg=cyan>('.$serviceAlias.')</>';
if ($serviceAlias->isDeprecated()) {
$serviceLine .= ' - <fg=magenta>deprecated</>';
}
} elseif (!$all) {
++$serviceIdsNb;
continue;
}
$text[] = $serviceLine;
$io->text($text);
}
$io->newLine();
if (0 < $serviceIdsNb) {
$io->text(sprintf('%s more concrete service%s would be displayed when adding the "--all" option.', $serviceIdsNb, $serviceIdsNb > 1 ? 's' : ''));
}
if ($all) {
$io->text('Pro-tip: use interfaces in your type-hints instead of classes to benefit from the dependency inversion principle.');
}
$io->newLine();
} | php | protected function execute(InputInterface $input, OutputInterface $output)
{
$io = new SymfonyStyle($input, $output);
$errorIo = $io->getErrorStyle();
$builder = $this->getContainerBuilder();
$serviceIds = $builder->getServiceIds();
$serviceIds = array_filter($serviceIds, [$this, 'filterToServiceTypes']);
if ($search = $input->getArgument('search')) {
$serviceIds = array_filter($serviceIds, function ($serviceId) use ($search) {
return false !== stripos(str_replace('\\', '', $serviceId), $search) && 0 !== strpos($serviceId, '.');
});
if (empty($serviceIds)) {
$errorIo->error(sprintf('No autowirable classes or interfaces found matching "%s"', $search));
return 1;
}
}
uasort($serviceIds, 'strnatcmp');
$io->title('Autowirable Types');
$io->text('The following classes & interfaces can be used as type-hints when autowiring:');
if ($search) {
$io->text(sprintf('(only showing classes/interfaces matching <comment>%s</comment>)', $search));
}
$hasAlias = [];
$all = $input->getOption('all');
$previousId = '-';
$serviceIdsNb = 0;
foreach ($serviceIds as $serviceId) {
$text = [];
if (0 !== strpos($serviceId, $previousId)) {
$text[] = '';
if ('' !== $description = Descriptor::getClassDescription($serviceId, $serviceId)) {
if (isset($hasAlias[$serviceId])) {
continue;
}
$text[] = $description;
}
$previousId = $serviceId.' $';
}
$serviceLine = sprintf('<fg=yellow>%s</>', $serviceId);
if ($this->supportsHref && '' !== $fileLink = $this->getFileLink($serviceId)) {
$serviceLine = sprintf('<fg=yellow;href=%s>%s</>', $fileLink, $serviceId);
}
if ($builder->hasAlias($serviceId)) {
$hasAlias[$serviceId] = true;
$serviceAlias = $builder->getAlias($serviceId);
$serviceLine .= ' <fg=cyan>('.$serviceAlias.')</>';
if ($serviceAlias->isDeprecated()) {
$serviceLine .= ' - <fg=magenta>deprecated</>';
}
} elseif (!$all) {
++$serviceIdsNb;
continue;
}
$text[] = $serviceLine;
$io->text($text);
}
$io->newLine();
if (0 < $serviceIdsNb) {
$io->text(sprintf('%s more concrete service%s would be displayed when adding the "--all" option.', $serviceIdsNb, $serviceIdsNb > 1 ? 's' : ''));
}
if ($all) {
$io->text('Pro-tip: use interfaces in your type-hints instead of classes to benefit from the dependency inversion principle.');
}
$io->newLine();
} | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"$",
"io",
"=",
"new",
"SymfonyStyle",
"(",
"$",
"input",
",",
"$",
"output",
")",
";",
"$",
"errorIo",
"=",
"$",
"io",
"->",
"get... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/FrameworkBundle/Command/DebugAutowiringCommand.php#L72-L148 | train | Executes the type - hint command | [
30522,
5123,
3853,
15389,
1006,
7953,
18447,
2121,
12172,
1002,
7953,
1010,
6434,
18447,
2121,
12172,
1002,
6434,
1007,
1063,
1002,
22834,
1027,
2047,
25353,
2213,
14876,
4890,
30524,
2023,
1011,
1028,
2131,
8663,
18249,
2121,
8569,
23891,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Intl/Data/Util/LocaleScanner.php | LocaleScanner.scanLocales | public function scanLocales($sourceDir)
{
$locales = glob($sourceDir.'/*.txt');
// Remove file extension and sort
array_walk($locales, function (&$locale) { $locale = basename($locale, '.txt'); });
// Remove non-locales
$locales = array_filter($locales, function ($locale) {
return preg_match('/^[a-z]{2}(_.+)?$/', $locale);
});
sort($locales);
return $locales;
} | php | public function scanLocales($sourceDir)
{
$locales = glob($sourceDir.'/*.txt');
// Remove file extension and sort
array_walk($locales, function (&$locale) { $locale = basename($locale, '.txt'); });
// Remove non-locales
$locales = array_filter($locales, function ($locale) {
return preg_match('/^[a-z]{2}(_.+)?$/', $locale);
});
sort($locales);
return $locales;
} | [
"public",
"function",
"scanLocales",
"(",
"$",
"sourceDir",
")",
"{",
"$",
"locales",
"=",
"glob",
"(",
"$",
"sourceDir",
".",
"'/*.txt'",
")",
";",
"// Remove file extension and sort",
"array_walk",
"(",
"$",
"locales",
",",
"function",
"(",
"&",
"$",
"loca... | Returns all locales found in the given directory.
@param string $sourceDir The directory with ICU files
@return array An array of locales. The result also contains locales that
are in fact just aliases for other locales. Use
{@link scanAliases()} to determine which of the locales
are aliases | [
"Returns",
"all",
"locales",
"found",
"in",
"the",
"given",
"directory",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Intl/Data/Util/LocaleScanner.php#L43-L58 | train | Scan locales in source directory and return array of locales | [
30522,
2270,
3853,
13594,
4135,
9289,
2229,
1006,
1002,
23184,
4313,
1007,
1063,
1002,
2334,
2229,
1027,
1043,
4135,
2497,
1006,
1002,
23184,
4313,
1012,
1005,
1013,
1008,
1012,
19067,
2102,
1005,
1007,
1025,
1013,
1013,
6366,
5371,
5331,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/system/classes/SettingsManager.php | SettingsManager.filterByContext | protected function filterByContext($items, $context)
{
$filteredItems = [];
foreach ($items as $categoryName => $category) {
$filteredCategory = [];
foreach ($category as $item) {
$itemContext = is_array($item->context) ? $item->context : [$item->context];
if (in_array($context, $itemContext)) {
$filteredCategory[] = $item;
}
}
if (count($filteredCategory)) {
$filteredItems[$categoryName] = $filteredCategory;
}
}
return $filteredItems;
} | php | protected function filterByContext($items, $context)
{
$filteredItems = [];
foreach ($items as $categoryName => $category) {
$filteredCategory = [];
foreach ($category as $item) {
$itemContext = is_array($item->context) ? $item->context : [$item->context];
if (in_array($context, $itemContext)) {
$filteredCategory[] = $item;
}
}
if (count($filteredCategory)) {
$filteredItems[$categoryName] = $filteredCategory;
}
}
return $filteredItems;
} | [
"protected",
"function",
"filterByContext",
"(",
"$",
"items",
",",
"$",
"context",
")",
"{",
"$",
"filteredItems",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"items",
"as",
"$",
"categoryName",
"=>",
"$",
"category",
")",
"{",
"$",
"filteredCategory",
"="... | Filters a set of items by a given context.
@param array $items
@param string $context
@return array | [
"Filters",
"a",
"set",
"of",
"items",
"by",
"a",
"given",
"context",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/SettingsManager.php#L170-L189 | train | Filter items by context | [
30522,
5123,
3853,
11307,
3762,
8663,
18209,
1006,
1002,
5167,
1010,
1002,
6123,
1007,
1063,
1002,
21839,
4221,
5244,
1027,
1031,
1033,
1025,
18921,
6776,
1006,
1002,
5167,
2004,
1002,
4696,
18442,
1027,
1028,
1002,
4696,
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... |
laravel/framework | src/Illuminate/Events/CallQueuedListener.php | CallQueuedListener.handle | public function handle(Container $container)
{
$this->prepareData();
$handler = $this->setJobInstanceIfNecessary(
$this->job, $container->make($this->class)
);
call_user_func_array(
[$handler, $this->method], $this->data
);
} | php | public function handle(Container $container)
{
$this->prepareData();
$handler = $this->setJobInstanceIfNecessary(
$this->job, $container->make($this->class)
);
call_user_func_array(
[$handler, $this->method], $this->data
);
} | [
"public",
"function",
"handle",
"(",
"Container",
"$",
"container",
")",
"{",
"$",
"this",
"->",
"prepareData",
"(",
")",
";",
"$",
"handler",
"=",
"$",
"this",
"->",
"setJobInstanceIfNecessary",
"(",
"$",
"this",
"->",
"job",
",",
"$",
"container",
"->"... | Handle the queued job.
@param \Illuminate\Container\Container $container
@return void | [
"Handle",
"the",
"queued",
"job",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Events/CallQueuedListener.php#L77-L88 | train | Handle the request and call the handler | [
30522,
2270,
3853,
5047,
1006,
11661,
1002,
11661,
1007,
1063,
1002,
2023,
1011,
1028,
4810,
6790,
1006,
1007,
1025,
1002,
28213,
1027,
1002,
2023,
1011,
1028,
2275,
5558,
8428,
12693,
3401,
10128,
2638,
9623,
10286,
2100,
1006,
1002,
2023,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getgrav/grav | system/src/Grav/Framework/File/AbstractFile.php | AbstractFile.unlock | public function unlock(): bool
{
if (!$this->handle) {
return false;
}
if ($this->locked) {
flock($this->handle, LOCK_UN);
$this->locked = false;
}
fclose($this->handle);
$this->handle = null;
return true;
} | php | public function unlock(): bool
{
if (!$this->handle) {
return false;
}
if ($this->locked) {
flock($this->handle, LOCK_UN);
$this->locked = false;
}
fclose($this->handle);
$this->handle = null;
return true;
} | [
"public",
"function",
"unlock",
"(",
")",
":",
"bool",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"handle",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"locked",
")",
"{",
"flock",
"(",
"$",
"this",
"->",
"handle",
",",
"L... | {@inheritdoc}
@see FileInterface::unlock() | [
"{"
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Framework/File/AbstractFile.php#L203-L218 | train | Unlocks the current thread | [
30522,
2270,
3853,
19829,
1006,
1007,
1024,
22017,
2140,
1063,
2065,
1006,
999,
1002,
2023,
1011,
1028,
5047,
1007,
1063,
2709,
6270,
1025,
1065,
2065,
1006,
1002,
2023,
1011,
1028,
5299,
1007,
1063,
19311,
1006,
1002,
2023,
1011,
1028,
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... |
walkor/Workerman | Worker.php | Worker.reload | protected static function reload()
{
// For master process.
if (static::$_masterPid === posix_getpid()) {
// Set reloading state.
if (static::$_status !== static::STATUS_RELOADING && static::$_status !== static::STATUS_SHUTDOWN) {
static::log("Workerman[" . basename(static::$_startFile) . "] reloading");
static::$_status = static::STATUS_RELOADING;
// Try to emit onMasterReload callback.
if (static::$onMasterReload) {
try {
call_user_func(static::$onMasterReload);
} catch (\Exception $e) {
static::log($e);
exit(250);
} catch (\Error $e) {
static::log($e);
exit(250);
}
static::initId();
}
}
if (static::$_gracefulStop) {
$sig = SIGQUIT;
} else {
$sig = SIGUSR1;
}
// Send reload signal to all child processes.
$reloadable_pid_array = array();
foreach (static::$_pidMap as $worker_id => $worker_pid_array) {
$worker = static::$_workers[$worker_id];
if ($worker->reloadable) {
foreach ($worker_pid_array as $pid) {
$reloadable_pid_array[$pid] = $pid;
}
} else {
foreach ($worker_pid_array as $pid) {
// Send reload signal to a worker process which reloadable is false.
posix_kill($pid, $sig);
}
}
}
// Get all pids that are waiting reload.
static::$_pidsToRestart = array_intersect(static::$_pidsToRestart, $reloadable_pid_array);
// Reload complete.
if (empty(static::$_pidsToRestart)) {
if (static::$_status !== static::STATUS_SHUTDOWN) {
static::$_status = static::STATUS_RUNNING;
}
return;
}
// Continue reload.
$one_worker_pid = current(static::$_pidsToRestart);
// Send reload signal to a worker process.
posix_kill($one_worker_pid, $sig);
// If the process does not exit after static::KILL_WORKER_TIMER_TIME seconds try to kill it.
if(!static::$_gracefulStop){
Timer::add(static::KILL_WORKER_TIMER_TIME, 'posix_kill', array($one_worker_pid, SIGKILL), false);
}
} // For child processes.
else {
reset(static::$_workers);
$worker = current(static::$_workers);
// Try to emit onWorkerReload callback.
if ($worker->onWorkerReload) {
try {
call_user_func($worker->onWorkerReload, $worker);
} catch (\Exception $e) {
static::log($e);
exit(250);
} catch (\Error $e) {
static::log($e);
exit(250);
}
}
if ($worker->reloadable) {
static::stopAll();
}
}
} | php | protected static function reload()
{
// For master process.
if (static::$_masterPid === posix_getpid()) {
// Set reloading state.
if (static::$_status !== static::STATUS_RELOADING && static::$_status !== static::STATUS_SHUTDOWN) {
static::log("Workerman[" . basename(static::$_startFile) . "] reloading");
static::$_status = static::STATUS_RELOADING;
// Try to emit onMasterReload callback.
if (static::$onMasterReload) {
try {
call_user_func(static::$onMasterReload);
} catch (\Exception $e) {
static::log($e);
exit(250);
} catch (\Error $e) {
static::log($e);
exit(250);
}
static::initId();
}
}
if (static::$_gracefulStop) {
$sig = SIGQUIT;
} else {
$sig = SIGUSR1;
}
// Send reload signal to all child processes.
$reloadable_pid_array = array();
foreach (static::$_pidMap as $worker_id => $worker_pid_array) {
$worker = static::$_workers[$worker_id];
if ($worker->reloadable) {
foreach ($worker_pid_array as $pid) {
$reloadable_pid_array[$pid] = $pid;
}
} else {
foreach ($worker_pid_array as $pid) {
// Send reload signal to a worker process which reloadable is false.
posix_kill($pid, $sig);
}
}
}
// Get all pids that are waiting reload.
static::$_pidsToRestart = array_intersect(static::$_pidsToRestart, $reloadable_pid_array);
// Reload complete.
if (empty(static::$_pidsToRestart)) {
if (static::$_status !== static::STATUS_SHUTDOWN) {
static::$_status = static::STATUS_RUNNING;
}
return;
}
// Continue reload.
$one_worker_pid = current(static::$_pidsToRestart);
// Send reload signal to a worker process.
posix_kill($one_worker_pid, $sig);
// If the process does not exit after static::KILL_WORKER_TIMER_TIME seconds try to kill it.
if(!static::$_gracefulStop){
Timer::add(static::KILL_WORKER_TIMER_TIME, 'posix_kill', array($one_worker_pid, SIGKILL), false);
}
} // For child processes.
else {
reset(static::$_workers);
$worker = current(static::$_workers);
// Try to emit onWorkerReload callback.
if ($worker->onWorkerReload) {
try {
call_user_func($worker->onWorkerReload, $worker);
} catch (\Exception $e) {
static::log($e);
exit(250);
} catch (\Error $e) {
static::log($e);
exit(250);
}
}
if ($worker->reloadable) {
static::stopAll();
}
}
} | [
"protected",
"static",
"function",
"reload",
"(",
")",
"{",
"// For master process.",
"if",
"(",
"static",
"::",
"$",
"_masterPid",
"===",
"posix_getpid",
"(",
")",
")",
"{",
"// Set reloading state.",
"if",
"(",
"static",
"::",
"$",
"_status",
"!==",
"static"... | Execute reload.
@return void | [
"Execute",
"reload",
"."
] | 13649907f05014fcfffcfccaef01e63ad3339351 | https://github.com/walkor/Workerman/blob/13649907f05014fcfffcfccaef01e63ad3339351/Worker.php#L1677-L1761 | train | Reloads the master process. | [
30522,
5123,
10763,
3853,
2128,
11066,
1006,
1007,
1063,
1013,
1013,
2005,
3040,
2832,
1012,
2065,
1006,
10763,
1024,
1024,
1002,
1035,
3040,
23267,
1027,
1027,
1027,
13433,
5332,
2595,
1035,
2131,
23267,
1006,
1007,
1007,
1063,
1013,
1013,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php | TextDescriptor.describeRoute | protected function describeRoute(Route $route, array $options = [])
{
$tableHeaders = ['Property', 'Value'];
$tableRows = [
['Route Name', isset($options['name']) ? $options['name'] : ''],
['Path', $route->getPath()],
['Path Regex', $route->compile()->getRegex()],
['Host', ('' !== $route->getHost() ? $route->getHost() : 'ANY')],
['Host Regex', ('' !== $route->getHost() ? $route->compile()->getHostRegex() : '')],
['Scheme', ($route->getSchemes() ? implode('|', $route->getSchemes()) : 'ANY')],
['Method', ($route->getMethods() ? implode('|', $route->getMethods()) : 'ANY')],
['Requirements', ($route->getRequirements() ? $this->formatRouterConfig($route->getRequirements()) : 'NO CUSTOM')],
['Class', \get_class($route)],
['Defaults', $this->formatRouterConfig($route->getDefaults())],
['Options', $this->formatRouterConfig($route->getOptions())],
];
if ('' !== $route->getCondition()) {
$tableRows[] = ['Condition', $route->getCondition()];
}
$table = new Table($this->getOutput());
$table->setHeaders($tableHeaders)->setRows($tableRows);
$table->render();
} | php | protected function describeRoute(Route $route, array $options = [])
{
$tableHeaders = ['Property', 'Value'];
$tableRows = [
['Route Name', isset($options['name']) ? $options['name'] : ''],
['Path', $route->getPath()],
['Path Regex', $route->compile()->getRegex()],
['Host', ('' !== $route->getHost() ? $route->getHost() : 'ANY')],
['Host Regex', ('' !== $route->getHost() ? $route->compile()->getHostRegex() : '')],
['Scheme', ($route->getSchemes() ? implode('|', $route->getSchemes()) : 'ANY')],
['Method', ($route->getMethods() ? implode('|', $route->getMethods()) : 'ANY')],
['Requirements', ($route->getRequirements() ? $this->formatRouterConfig($route->getRequirements()) : 'NO CUSTOM')],
['Class', \get_class($route)],
['Defaults', $this->formatRouterConfig($route->getDefaults())],
['Options', $this->formatRouterConfig($route->getOptions())],
];
if ('' !== $route->getCondition()) {
$tableRows[] = ['Condition', $route->getCondition()];
}
$table = new Table($this->getOutput());
$table->setHeaders($tableHeaders)->setRows($tableRows);
$table->render();
} | [
"protected",
"function",
"describeRoute",
"(",
"Route",
"$",
"route",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"tableHeaders",
"=",
"[",
"'Property'",
",",
"'Value'",
"]",
";",
"$",
"tableRows",
"=",
"[",
"[",
"'Route Name'",
",",
"i... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php#L88-L112 | train | Describes a route | [
30522,
5123,
3853,
6235,
22494,
2618,
1006,
2799,
1002,
2799,
1010,
9140,
1002,
7047,
1027,
1031,
1033,
1007,
1063,
1002,
2795,
4974,
2545,
1027,
1031,
1005,
3200,
1005,
1010,
1005,
3643,
1005,
1033,
1025,
1002,
2795,
10524,
2015,
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... |
octobercms/october | modules/system/console/ThemeList.php | ThemeList.handle | public function handle()
{
$themeManager = ThemeManager::instance();
$updateManager = UpdateManager::instance();
foreach (Theme::all() as $theme) {
$flag = $theme->isActiveTheme() ? '[*] ' : '[-] ';
$themeId = $theme->getId();
$themeName = $themeManager->findByDirName($themeId) ?: $themeId;
$this->info($flag . $themeName);
}
if ($this->option('include-marketplace')) {
// @todo List everything in the marketplace - not just popular.
$popularThemes = $updateManager->requestPopularProducts('theme');
foreach ($popularThemes as $popularTheme) {
if (!$themeManager->isInstalled($popularTheme['code'])) {
$this->info('[ ] '.$popularTheme['code']);
}
}
}
$this->info(PHP_EOL."[*] Active [-] Installed [ ] Not installed");
} | php | public function handle()
{
$themeManager = ThemeManager::instance();
$updateManager = UpdateManager::instance();
foreach (Theme::all() as $theme) {
$flag = $theme->isActiveTheme() ? '[*] ' : '[-] ';
$themeId = $theme->getId();
$themeName = $themeManager->findByDirName($themeId) ?: $themeId;
$this->info($flag . $themeName);
}
if ($this->option('include-marketplace')) {
// @todo List everything in the marketplace - not just popular.
$popularThemes = $updateManager->requestPopularProducts('theme');
foreach ($popularThemes as $popularTheme) {
if (!$themeManager->isInstalled($popularTheme['code'])) {
$this->info('[ ] '.$popularTheme['code']);
}
}
}
$this->info(PHP_EOL."[*] Active [-] Installed [ ] Not installed");
} | [
"public",
"function",
"handle",
"(",
")",
"{",
"$",
"themeManager",
"=",
"ThemeManager",
"::",
"instance",
"(",
")",
";",
"$",
"updateManager",
"=",
"UpdateManager",
"::",
"instance",
"(",
")",
";",
"foreach",
"(",
"Theme",
"::",
"all",
"(",
")",
"as",
... | Execute the console command. | [
"Execute",
"the",
"console",
"command",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/console/ThemeList.php#L32-L58 | train | Handle all active themes | [
30522,
2270,
3853,
5047,
1006,
1007,
1063,
1002,
4323,
24805,
4590,
1027,
4323,
24805,
4590,
1024,
1024,
6013,
1006,
1007,
1025,
1002,
10651,
24805,
4590,
1027,
10651,
24805,
4590,
1024,
1024,
6013,
1006,
1007,
1025,
18921,
6776,
1006,
4323... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/View/Concerns/ManagesEvents.php | ManagesEvents.composer | public function composer($views, $callback)
{
$composers = [];
foreach ((array) $views as $view) {
$composers[] = $this->addViewEvent($view, $callback, 'composing: ');
}
return $composers;
} | php | public function composer($views, $callback)
{
$composers = [];
foreach ((array) $views as $view) {
$composers[] = $this->addViewEvent($view, $callback, 'composing: ');
}
return $composers;
} | [
"public",
"function",
"composer",
"(",
"$",
"views",
",",
"$",
"callback",
")",
"{",
"$",
"composers",
"=",
"[",
"]",
";",
"foreach",
"(",
"(",
"array",
")",
"$",
"views",
"as",
"$",
"view",
")",
"{",
"$",
"composers",
"[",
"]",
"=",
"$",
"this",... | Register a view composer event.
@param array|string $views
@param \Closure|string $callback
@return array | [
"Register",
"a",
"view",
"composer",
"event",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/View/Concerns/ManagesEvents.php#L53-L62 | train | Add view composer | [
30522,
2270,
3853,
4543,
1006,
1002,
5328,
1010,
1002,
2655,
5963,
1007,
1063,
1002,
9929,
1027,
1031,
1033,
1025,
18921,
6776,
1006,
1006,
9140,
1007,
1002,
5328,
2004,
1002,
3193,
1007,
1063,
1002,
9929,
1031,
1033,
1027,
1002,
2023,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/HttpKernel/Debug/TraceableEventDispatcher.php | TraceableEventDispatcher.beforeDispatch | protected function beforeDispatch(string $eventName, $event)
{
switch ($eventName) {
case KernelEvents::REQUEST:
$this->stopwatch->openSection();
break;
case KernelEvents::VIEW:
case KernelEvents::RESPONSE:
// stop only if a controller has been executed
if ($this->stopwatch->isStarted('controller')) {
$this->stopwatch->stop('controller');
}
break;
case KernelEvents::TERMINATE:
$token = $event->getResponse()->headers->get('X-Debug-Token');
// There is a very special case when using built-in AppCache class as kernel wrapper, in the case
// of an ESI request leading to a `stale` response [B] inside a `fresh` cached response [A].
// In this case, `$token` contains the [B] debug token, but the open `stopwatch` section ID
// is equal to the [A] debug token. Trying to reopen section with the [B] token throws an exception
// which must be caught.
try {
$this->stopwatch->openSection($token);
} catch (\LogicException $e) {
}
break;
}
} | php | protected function beforeDispatch(string $eventName, $event)
{
switch ($eventName) {
case KernelEvents::REQUEST:
$this->stopwatch->openSection();
break;
case KernelEvents::VIEW:
case KernelEvents::RESPONSE:
// stop only if a controller has been executed
if ($this->stopwatch->isStarted('controller')) {
$this->stopwatch->stop('controller');
}
break;
case KernelEvents::TERMINATE:
$token = $event->getResponse()->headers->get('X-Debug-Token');
// There is a very special case when using built-in AppCache class as kernel wrapper, in the case
// of an ESI request leading to a `stale` response [B] inside a `fresh` cached response [A].
// In this case, `$token` contains the [B] debug token, but the open `stopwatch` section ID
// is equal to the [A] debug token. Trying to reopen section with the [B] token throws an exception
// which must be caught.
try {
$this->stopwatch->openSection($token);
} catch (\LogicException $e) {
}
break;
}
} | [
"protected",
"function",
"beforeDispatch",
"(",
"string",
"$",
"eventName",
",",
"$",
"event",
")",
"{",
"switch",
"(",
"$",
"eventName",
")",
"{",
"case",
"KernelEvents",
"::",
"REQUEST",
":",
"$",
"this",
"->",
"stopwatch",
"->",
"openSection",
"(",
")",... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/Debug/TraceableEventDispatcher.php#L29-L55 | train | Before dispatch event | [
30522,
5123,
3853,
2077,
10521,
4502,
10649,
1006,
5164,
1002,
2724,
18442,
1010,
1002,
2724,
1007,
1063,
6942,
1006,
1002,
2724,
18442,
1007,
1063,
2553,
16293,
18697,
7666,
1024,
1024,
5227,
1024,
1002,
2023,
1011,
1028,
2644,
18866,
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... |
walkor/Workerman | Events/Select.php | Select.clearAllTimer | public function clearAllTimer()
{
$this->_scheduler = new \SplPriorityQueue();
$this->_scheduler->setExtractFlags(\SplPriorityQueue::EXTR_BOTH);
$this->_eventTimer = array();
} | php | public function clearAllTimer()
{
$this->_scheduler = new \SplPriorityQueue();
$this->_scheduler->setExtractFlags(\SplPriorityQueue::EXTR_BOTH);
$this->_eventTimer = array();
} | [
"public",
"function",
"clearAllTimer",
"(",
")",
"{",
"$",
"this",
"->",
"_scheduler",
"=",
"new",
"\\",
"SplPriorityQueue",
"(",
")",
";",
"$",
"this",
"->",
"_scheduler",
"->",
"setExtractFlags",
"(",
"\\",
"SplPriorityQueue",
"::",
"EXTR_BOTH",
")",
";",
... | {@inheritdoc} | [
"{"
] | 13649907f05014fcfffcfccaef01e63ad3339351 | https://github.com/walkor/Workerman/blob/13649907f05014fcfffcfccaef01e63ad3339351/Events/Select.php#L253-L258 | train | Clear all timer | [
30522,
2270,
3853,
3154,
8095,
7292,
2099,
1006,
1007,
1063,
1002,
2023,
1011,
1028,
1035,
6134,
2099,
1027,
2047,
1032,
11867,
14277,
9488,
15780,
4226,
5657,
1006,
1007,
1025,
1002,
2023,
1011,
1028,
1035,
6134,
2099,
1011,
1028,
2275,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/OptionsResolver/OptionsResolver.php | OptionsResolver.addAllowedValues | public function addAllowedValues($option, $allowedValues)
{
if ($this->locked) {
throw new AccessException('Allowed values cannot be added from a lazy option or normalizer.');
}
if (!isset($this->defined[$option])) {
throw new UndefinedOptionsException(sprintf('The option "%s" does not exist. Defined options are: "%s".', $option, implode('", "', array_keys($this->defined))));
}
if (!\is_array($allowedValues)) {
$allowedValues = [$allowedValues];
}
if (!isset($this->allowedValues[$option])) {
$this->allowedValues[$option] = $allowedValues;
} else {
$this->allowedValues[$option] = array_merge($this->allowedValues[$option], $allowedValues);
}
// Make sure the option is processed
unset($this->resolved[$option]);
return $this;
} | php | public function addAllowedValues($option, $allowedValues)
{
if ($this->locked) {
throw new AccessException('Allowed values cannot be added from a lazy option or normalizer.');
}
if (!isset($this->defined[$option])) {
throw new UndefinedOptionsException(sprintf('The option "%s" does not exist. Defined options are: "%s".', $option, implode('", "', array_keys($this->defined))));
}
if (!\is_array($allowedValues)) {
$allowedValues = [$allowedValues];
}
if (!isset($this->allowedValues[$option])) {
$this->allowedValues[$option] = $allowedValues;
} else {
$this->allowedValues[$option] = array_merge($this->allowedValues[$option], $allowedValues);
}
// Make sure the option is processed
unset($this->resolved[$option]);
return $this;
} | [
"public",
"function",
"addAllowedValues",
"(",
"$",
"option",
",",
"$",
"allowedValues",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"locked",
")",
"{",
"throw",
"new",
"AccessException",
"(",
"'Allowed values cannot be added from a lazy option or normalizer.'",
")",
";... | Adds allowed values for an option.
The values are merged with the allowed values defined previously.
Instead of passing values, you may also pass a closures with the
following signature:
function ($value) {
// return true or false
}
The closure receives the value as argument and should return true to
accept the value and false to reject the value.
@param string $option The option name
@param mixed $allowedValues One or more acceptable values/closures
@return $this
@throws UndefinedOptionsException If the option is undefined
@throws AccessException If called from a lazy option or normalizer | [
"Adds",
"allowed",
"values",
"for",
"an",
"option",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/OptionsResolver/OptionsResolver.php#L606-L630 | train | Add allowed values for an option | [
30522,
2270,
3853,
5587,
8095,
15096,
10175,
15808,
1006,
1002,
5724,
1010,
1002,
3039,
10175,
15808,
1007,
1063,
2065,
1006,
1002,
2023,
1011,
1028,
5299,
1007,
1063,
5466,
2047,
3229,
10288,
24422,
1006,
1005,
3039,
5300,
3685,
2022,
2794... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Classification/Ensemble/RandomForest.php | RandomForest.getFeatureImportances | public function getFeatureImportances(): array
{
// Traverse each tree and sum importance of the columns
$sum = [];
foreach ($this->classifiers as $tree) {
/** @var DecisionTree $tree */
$importances = $tree->getFeatureImportances();
foreach ($importances as $column => $importance) {
if (array_key_exists($column, $sum)) {
$sum[$column] += $importance;
} else {
$sum[$column] = $importance;
}
}
}
// Normalize & sort the importance values
$total = array_sum($sum);
array_walk($sum, function (&$importance) use ($total): void {
$importance /= $total;
});
arsort($sum);
return $sum;
} | php | public function getFeatureImportances(): array
{
// Traverse each tree and sum importance of the columns
$sum = [];
foreach ($this->classifiers as $tree) {
/** @var DecisionTree $tree */
$importances = $tree->getFeatureImportances();
foreach ($importances as $column => $importance) {
if (array_key_exists($column, $sum)) {
$sum[$column] += $importance;
} else {
$sum[$column] = $importance;
}
}
}
// Normalize & sort the importance values
$total = array_sum($sum);
array_walk($sum, function (&$importance) use ($total): void {
$importance /= $total;
});
arsort($sum);
return $sum;
} | [
"public",
"function",
"getFeatureImportances",
"(",
")",
":",
"array",
"{",
"// Traverse each tree and sum importance of the columns",
"$",
"sum",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"classifiers",
"as",
"$",
"tree",
")",
"{",
"/** @var Decision... | This will return an array including an importance value for
each column in the given dataset. Importance values for a column
is the average importance of that column in all trees in the forest | [
"This",
"will",
"return",
"an",
"array",
"including",
"an",
"importance",
"value",
"for",
"each",
"column",
"in",
"the",
"given",
"dataset",
".",
"Importance",
"values",
"for",
"a",
"column",
"is",
"the",
"average",
"importance",
"of",
"that",
"column",
"in"... | f6aa1a59b0525b8fca3d2786d661ab3e70904016 | https://github.com/php-ai/php-ml/blob/f6aa1a59b0525b8fca3d2786d661ab3e70904016/src/Classification/Ensemble/RandomForest.php#L86-L111 | train | Returns the feature importances of all columns in the tree | [
30522,
2270,
3853,
2131,
7959,
4017,
5397,
5714,
6442,
26755,
1006,
1007,
1024,
9140,
1063,
1013,
1013,
20811,
2169,
3392,
1998,
7680,
5197,
1997,
1996,
7753,
1002,
7680,
1027,
1031,
1033,
1025,
18921,
6776,
1006,
1002,
2023,
1011,
1028,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Cache/RedisTaggedCache.php | RedisTaggedCache.increment | public function increment($key, $value = 1)
{
$this->pushStandardKeys($this->tags->getNamespace(), $key);
parent::increment($key, $value);
} | php | public function increment($key, $value = 1)
{
$this->pushStandardKeys($this->tags->getNamespace(), $key);
parent::increment($key, $value);
} | [
"public",
"function",
"increment",
"(",
"$",
"key",
",",
"$",
"value",
"=",
"1",
")",
"{",
"$",
"this",
"->",
"pushStandardKeys",
"(",
"$",
"this",
"->",
"tags",
"->",
"getNamespace",
"(",
")",
",",
"$",
"key",
")",
";",
"parent",
"::",
"increment",
... | Increment the value of an item in the cache.
@param string $key
@param mixed $value
@return void | [
"Increment",
"the",
"value",
"of",
"an",
"item",
"in",
"the",
"cache",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Cache/RedisTaggedCache.php#L46-L51 | train | Increment the value of a tag | [
30522,
2270,
3853,
4297,
28578,
4765,
1006,
1002,
3145,
1010,
1002,
3643,
1027,
1015,
1007,
1063,
1002,
2023,
1011,
1028,
5245,
21515,
4232,
14839,
2015,
1006,
1002,
2023,
1011,
1028,
22073,
1011,
1028,
2131,
18442,
23058,
1006,
1007,
1010,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Container/Container.php | Container.extend | public function extend($abstract, Closure $closure)
{
$abstract = $this->getAlias($abstract);
if (isset($this->instances[$abstract])) {
$this->instances[$abstract] = $closure($this->instances[$abstract], $this);
$this->rebound($abstract);
} else {
$this->extenders[$abstract][] = $closure;
if ($this->resolved($abstract)) {
$this->rebound($abstract);
}
}
} | php | public function extend($abstract, Closure $closure)
{
$abstract = $this->getAlias($abstract);
if (isset($this->instances[$abstract])) {
$this->instances[$abstract] = $closure($this->instances[$abstract], $this);
$this->rebound($abstract);
} else {
$this->extenders[$abstract][] = $closure;
if ($this->resolved($abstract)) {
$this->rebound($abstract);
}
}
} | [
"public",
"function",
"extend",
"(",
"$",
"abstract",
",",
"Closure",
"$",
"closure",
")",
"{",
"$",
"abstract",
"=",
"$",
"this",
"->",
"getAlias",
"(",
"$",
"abstract",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"instances",
"[",
"$",
... | "Extend" an abstract type in the container.
@param string $abstract
@param \Closure $closure
@return void
@throws \InvalidArgumentException | [
"Extend",
"an",
"abstract",
"type",
"in",
"the",
"container",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Container/Container.php#L369-L384 | train | Extends an abstract with a closure | [
30522,
2270,
3853,
7949,
1006,
1002,
10061,
1010,
8503,
1002,
8503,
1007,
1063,
1002,
10061,
1027,
1002,
2023,
1011,
1028,
2131,
22786,
2015,
1006,
1002,
10061,
1007,
1025,
2065,
1006,
26354,
3388,
1006,
1002,
2023,
1011,
1028,
12107,
1031,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/UserCountry/API.php | API.getCity | public function getCity($idSite, $period, $date, $segment = false)
{
$dataTable = $this->getDataTable(Archiver::CITY_RECORD_NAME, $idSite, $period, $date, $segment);
$separator = Archiver::LOCATION_SEPARATOR;
$unk = Visit::UNKNOWN_CODE;
$dataTables = [$dataTable];
if ($dataTable instanceof DataTable\Map) {
$dataTables = $dataTable->getDataTables();
}
foreach ($dataTables as $dt) {
$archiveDate = $dt->getMetadata(DataTable::ARCHIVED_DATE_METADATA_NAME);
// convert fips region codes to iso if required
if ($this->shouldRegionCodesBeConvertedToIso($archiveDate, $date, $period)) {
$dt->filter('GroupBy', array(
'label',
function ($label) use ($separator, $unk) {
$regionCode = getElementFromStringArray($label, $separator, 1, '');
$countryCode = getElementFromStringArray($label, $separator, 2, '');
list($countryCode, $regionCode) = GeoIp2::convertRegionCodeToIso($countryCode,
$regionCode, true);
$splitLabel = explode($separator, $label);
if (isset($splitLabel[1])) {
$splitLabel[1] = $regionCode;
}
if (isset($splitLabel[2])) {
$splitLabel[2] = strtolower($countryCode);
}
return implode($separator, $splitLabel);
}
));
} else {
$dt->filter('GroupBy', array(
'label',
function ($label) {
if (substr($label, -5) == '|1|ti') {
return substr($label, 0, -5) . '|14|cn';
}
return $label;
}
));
}
}
$segments = array('city', 'regionCode', 'countryCode');
$dataTable->filter('AddSegmentByLabel', array($segments, Archiver::LOCATION_SEPARATOR));
// split the label and put the elements into the 'city_name', 'region', 'country',
// 'lat' & 'long' metadata fields
$strUnknown = Piwik::translate('General_Unknown');
$dataTable->filter('ColumnCallbackAddMetadata',
array('label', 'city_name', __NAMESPACE__ . '\getElementFromStringArray',
array($separator, 0, $strUnknown)));
$dataTable->filter('MetadataCallbackAddMetadata',
array('city_name', 'city', function ($city) use ($strUnknown) {
if ($city == $strUnknown) {
return "xx";
} else {
return false;
}
}));
$dataTable->filter('ColumnCallbackAddMetadata',
array('label', 'region', __NAMESPACE__ . '\getElementFromStringArray', array($separator, 1, $unk)));
$dataTable->filter('ColumnCallbackAddMetadata',
array('label', 'country', __NAMESPACE__ . '\getElementFromStringArray', array($separator, 2, $unk)));
// backwards compatibility: for reports that have lat|long in label
$dataTable->filter('ColumnCallbackAddMetadata',
array('label', 'lat', __NAMESPACE__ . '\getElementFromStringArray', array($separator, 3, false)));
$dataTable->filter('ColumnCallbackAddMetadata',
array('label', 'long', __NAMESPACE__ . '\getElementFromStringArray', array($separator, 4, false)));
// add country name & region name metadata
$dataTable->filter('MetadataCallbackAddMetadata',
array('country', 'country_name', __NAMESPACE__ . '\countryTranslate', $applyToSummaryRow = false));
$getRegionName = '\\Piwik\\Plugins\\UserCountry\\getRegionNameFromCodes';
$dataTable->filter('MetadataCallbackAddMetadata', array(
array('country', 'region'), 'region_name', $getRegionName, $applyToSummaryRow = false));
// add the country flag as a url to the 'logo' metadata field
$dataTable->filter('MetadataCallbackAddMetadata', array('country', 'logo', __NAMESPACE__ . '\getFlagFromCode'));
// prettify the label
$dataTable->filter('ColumnCallbackReplace', array('label', __NAMESPACE__ . '\getPrettyCityName'));
$dataTable->queueFilter('ReplaceSummaryRowLabel');
return $dataTable;
} | php | public function getCity($idSite, $period, $date, $segment = false)
{
$dataTable = $this->getDataTable(Archiver::CITY_RECORD_NAME, $idSite, $period, $date, $segment);
$separator = Archiver::LOCATION_SEPARATOR;
$unk = Visit::UNKNOWN_CODE;
$dataTables = [$dataTable];
if ($dataTable instanceof DataTable\Map) {
$dataTables = $dataTable->getDataTables();
}
foreach ($dataTables as $dt) {
$archiveDate = $dt->getMetadata(DataTable::ARCHIVED_DATE_METADATA_NAME);
// convert fips region codes to iso if required
if ($this->shouldRegionCodesBeConvertedToIso($archiveDate, $date, $period)) {
$dt->filter('GroupBy', array(
'label',
function ($label) use ($separator, $unk) {
$regionCode = getElementFromStringArray($label, $separator, 1, '');
$countryCode = getElementFromStringArray($label, $separator, 2, '');
list($countryCode, $regionCode) = GeoIp2::convertRegionCodeToIso($countryCode,
$regionCode, true);
$splitLabel = explode($separator, $label);
if (isset($splitLabel[1])) {
$splitLabel[1] = $regionCode;
}
if (isset($splitLabel[2])) {
$splitLabel[2] = strtolower($countryCode);
}
return implode($separator, $splitLabel);
}
));
} else {
$dt->filter('GroupBy', array(
'label',
function ($label) {
if (substr($label, -5) == '|1|ti') {
return substr($label, 0, -5) . '|14|cn';
}
return $label;
}
));
}
}
$segments = array('city', 'regionCode', 'countryCode');
$dataTable->filter('AddSegmentByLabel', array($segments, Archiver::LOCATION_SEPARATOR));
// split the label and put the elements into the 'city_name', 'region', 'country',
// 'lat' & 'long' metadata fields
$strUnknown = Piwik::translate('General_Unknown');
$dataTable->filter('ColumnCallbackAddMetadata',
array('label', 'city_name', __NAMESPACE__ . '\getElementFromStringArray',
array($separator, 0, $strUnknown)));
$dataTable->filter('MetadataCallbackAddMetadata',
array('city_name', 'city', function ($city) use ($strUnknown) {
if ($city == $strUnknown) {
return "xx";
} else {
return false;
}
}));
$dataTable->filter('ColumnCallbackAddMetadata',
array('label', 'region', __NAMESPACE__ . '\getElementFromStringArray', array($separator, 1, $unk)));
$dataTable->filter('ColumnCallbackAddMetadata',
array('label', 'country', __NAMESPACE__ . '\getElementFromStringArray', array($separator, 2, $unk)));
// backwards compatibility: for reports that have lat|long in label
$dataTable->filter('ColumnCallbackAddMetadata',
array('label', 'lat', __NAMESPACE__ . '\getElementFromStringArray', array($separator, 3, false)));
$dataTable->filter('ColumnCallbackAddMetadata',
array('label', 'long', __NAMESPACE__ . '\getElementFromStringArray', array($separator, 4, false)));
// add country name & region name metadata
$dataTable->filter('MetadataCallbackAddMetadata',
array('country', 'country_name', __NAMESPACE__ . '\countryTranslate', $applyToSummaryRow = false));
$getRegionName = '\\Piwik\\Plugins\\UserCountry\\getRegionNameFromCodes';
$dataTable->filter('MetadataCallbackAddMetadata', array(
array('country', 'region'), 'region_name', $getRegionName, $applyToSummaryRow = false));
// add the country flag as a url to the 'logo' metadata field
$dataTable->filter('MetadataCallbackAddMetadata', array('country', 'logo', __NAMESPACE__ . '\getFlagFromCode'));
// prettify the label
$dataTable->filter('ColumnCallbackReplace', array('label', __NAMESPACE__ . '\getPrettyCityName'));
$dataTable->queueFilter('ReplaceSummaryRowLabel');
return $dataTable;
} | [
"public",
"function",
"getCity",
"(",
"$",
"idSite",
",",
"$",
"period",
",",
"$",
"date",
",",
"$",
"segment",
"=",
"false",
")",
"{",
"$",
"dataTable",
"=",
"$",
"this",
"->",
"getDataTable",
"(",
"Archiver",
"::",
"CITY_RECORD_NAME",
",",
"$",
"idSi... | Returns visit information for every city with at least one visit.
@param int|string $idSite
@param string $period
@param string $date
@param string|bool $segment
@return DataTable | [
"Returns",
"visit",
"information",
"for",
"every",
"city",
"with",
"at",
"least",
"one",
"visit",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/UserCountry/API.php#L182-L280 | train | Get City Location | [
30522,
2270,
3853,
2131,
12972,
1006,
1002,
8909,
28032,
2063,
1010,
1002,
2558,
1010,
1002,
3058,
1010,
1002,
6903,
1027,
6270,
1007,
1063,
1002,
2951,
10880,
1027,
1002,
2023,
1011,
1028,
2131,
2850,
29336,
3085,
1006,
8756,
2099,
1024,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/Updates/2.10.0-b5.php | Updates_2_10_0_b5.getFirstDayOfArchivedDeviceDetectorData | public static function getFirstDayOfArchivedDeviceDetectorData()
{
static $deviceDetectionBlobAvailableDate;
if (empty($deviceDetectionBlobAvailableDate)) {
$archiveBlobTables = self::getAllArchiveBlobTables();
$deviceDetectionBlobAvailableDate = null;
foreach ($archiveBlobTables as $table) {
// Look for all day archives and try to find that with the lowest date
$deviceDetectionBlobAvailableDate = Db::get()->fetchOne(sprintf("SELECT date1 FROM %s WHERE name = 'DevicesDetection_browserVersions' AND period = 1 ORDER BY date1 ASC LIMIT 1", $table));
if (!empty($deviceDetectionBlobAvailableDate)) {
break;
}
}
$deviceDetectionBlobAvailableDate = strtotime($deviceDetectionBlobAvailableDate);
}
return $deviceDetectionBlobAvailableDate;
} | php | public static function getFirstDayOfArchivedDeviceDetectorData()
{
static $deviceDetectionBlobAvailableDate;
if (empty($deviceDetectionBlobAvailableDate)) {
$archiveBlobTables = self::getAllArchiveBlobTables();
$deviceDetectionBlobAvailableDate = null;
foreach ($archiveBlobTables as $table) {
// Look for all day archives and try to find that with the lowest date
$deviceDetectionBlobAvailableDate = Db::get()->fetchOne(sprintf("SELECT date1 FROM %s WHERE name = 'DevicesDetection_browserVersions' AND period = 1 ORDER BY date1 ASC LIMIT 1", $table));
if (!empty($deviceDetectionBlobAvailableDate)) {
break;
}
}
$deviceDetectionBlobAvailableDate = strtotime($deviceDetectionBlobAvailableDate);
}
return $deviceDetectionBlobAvailableDate;
} | [
"public",
"static",
"function",
"getFirstDayOfArchivedDeviceDetectorData",
"(",
")",
"{",
"static",
"$",
"deviceDetectionBlobAvailableDate",
";",
"if",
"(",
"empty",
"(",
"$",
"deviceDetectionBlobAvailableDate",
")",
")",
"{",
"$",
"archiveBlobTables",
"=",
"self",
":... | Find the first day on which DevicesDetection archives were generated
@return int Timestamp | [
"Find",
"the",
"first",
"day",
"on",
"which",
"DevicesDetection",
"archives",
"were",
"generated"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Updates/2.10.0-b5.php#L156-L178 | train | Returns the date of the first day of archive device detection data | [
30522,
2270,
10763,
3853,
2131,
8873,
12096,
10259,
11253,
2906,
5428,
7178,
24844,
6610,
3207,
26557,
4263,
2850,
2696,
1006,
1007,
1063,
10763,
1002,
5080,
3207,
26557,
3508,
16558,
16429,
12462,
11733,
23242,
3686,
1025,
2065,
1006,
4064,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
z-song/laravel-admin | src/Grid/Tools/TotalRow.php | TotalRow.render | public function render()
{
$columns = $this->getGrid()->columns()->flatMap(function (Column $column) {
$name = $column->getName();
$total = ($display = Arr::get($this->columns, $name)) ? $this->total($name, $display) : '';
return [$name => $total];
})->toArray();
return view('admin::grid.total-row', compact('columns'));
} | php | public function render()
{
$columns = $this->getGrid()->columns()->flatMap(function (Column $column) {
$name = $column->getName();
$total = ($display = Arr::get($this->columns, $name)) ? $this->total($name, $display) : '';
return [$name => $total];
})->toArray();
return view('admin::grid.total-row', compact('columns'));
} | [
"public",
"function",
"render",
"(",
")",
"{",
"$",
"columns",
"=",
"$",
"this",
"->",
"getGrid",
"(",
")",
"->",
"columns",
"(",
")",
"->",
"flatMap",
"(",
"function",
"(",
"Column",
"$",
"column",
")",
"{",
"$",
"name",
"=",
"$",
"column",
"->",
... | Render total-row.
@return \Illuminate\Contracts\View\Factory|\Illuminate\View\View | [
"Render",
"total",
"-",
"row",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid/Tools/TotalRow.php#L62-L73 | train | Render total row | [
30522,
2270,
3853,
17552,
1006,
1007,
1063,
1002,
7753,
1027,
1002,
2023,
1011,
1028,
2131,
16523,
3593,
1006,
1007,
1011,
1028,
7753,
1006,
1007,
1011,
1028,
4257,
2863,
2361,
1006,
3853,
1006,
5930,
1002,
5930,
1007,
1063,
1002,
2171,
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/Config/ConfigFileFinder.php | ConfigFileFinder.detectInFolder | protected function detectInFolder($folder, $lookup = null)
{
$folder = rtrim($folder, '/');
$path = trim(Folder::getRelativePath($folder), '/');
$base = $path === $folder ? '' : ($path ? substr($folder, 0, -strlen($path)) : $folder . '/');
$list = [];
if (is_dir($folder)) {
$iterator = new \DirectoryIterator($folder);
/** @var \DirectoryIterator $directory */
foreach ($iterator as $directory) {
if (!$directory->isDir() || $directory->isDot()) {
continue;
}
$name = $directory->getFilename();
$find = ($lookup ?: $name) . '.yaml';
$filename = "{$path}/{$name}/{$find}";
if (file_exists($base . $filename)) {
$basename = $this->base . $name;
$list[$basename] = ['file' => $filename, 'modified' => filemtime($base . $filename)];
}
}
}
return $list;
} | php | protected function detectInFolder($folder, $lookup = null)
{
$folder = rtrim($folder, '/');
$path = trim(Folder::getRelativePath($folder), '/');
$base = $path === $folder ? '' : ($path ? substr($folder, 0, -strlen($path)) : $folder . '/');
$list = [];
if (is_dir($folder)) {
$iterator = new \DirectoryIterator($folder);
/** @var \DirectoryIterator $directory */
foreach ($iterator as $directory) {
if (!$directory->isDir() || $directory->isDot()) {
continue;
}
$name = $directory->getFilename();
$find = ($lookup ?: $name) . '.yaml';
$filename = "{$path}/{$name}/{$find}";
if (file_exists($base . $filename)) {
$basename = $this->base . $name;
$list[$basename] = ['file' => $filename, 'modified' => filemtime($base . $filename)];
}
}
}
return $list;
} | [
"protected",
"function",
"detectInFolder",
"(",
"$",
"folder",
",",
"$",
"lookup",
"=",
"null",
")",
"{",
"$",
"folder",
"=",
"rtrim",
"(",
"$",
"folder",
",",
"'/'",
")",
";",
"$",
"path",
"=",
"trim",
"(",
"Folder",
"::",
"getRelativePath",
"(",
"$... | Detects all directories with the lookup file and returns them with last modification time.
@param string $folder Location to look up from.
@param string $lookup Filename to be located (defaults to directory name).
@return array
@internal | [
"Detects",
"all",
"directories",
"with",
"the",
"lookup",
"file",
"and",
"returns",
"them",
"with",
"last",
"modification",
"time",
"."
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Config/ConfigFileFinder.php#L194-L223 | train | Detects all files in a folder and returns an array of array with the filename and modification time as key | [
30522,
5123,
3853,
11487,
2378,
10371,
2121,
1006,
1002,
19622,
1010,
1002,
2298,
6279,
1027,
19701,
1007,
1063,
1002,
19622,
1027,
19387,
20026,
1006,
1002,
19622,
1010,
1005,
1013,
1005,
1007,
1025,
1002,
4130,
1027,
12241,
1006,
19622,
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/Filesystem/Folder.php | Folder.getRelativePathDotDot | public static function getRelativePathDotDot($path, $base)
{
// Normalize paths.
$base = preg_replace('![\\\/]+!', '/', $base);
$path = preg_replace('![\\\/]+!', '/', $path);
if ($path === $base) {
return '';
}
$baseParts = explode('/', ltrim($base, '/'));
$pathParts = explode('/', ltrim($path, '/'));
array_pop($baseParts);
$lastPart = array_pop($pathParts);
foreach ($baseParts as $i => $directory) {
if (isset($pathParts[$i]) && $pathParts[$i] === $directory) {
unset($baseParts[$i], $pathParts[$i]);
} else {
break;
}
}
$pathParts[] = $lastPart;
$path = str_repeat('../', count($baseParts)) . implode('/', $pathParts);
return '' === $path
|| strpos($path, '/') === 0
|| false !== ($colonPos = strpos($path, ':')) && ($colonPos < ($slashPos = strpos($path, '/')) || false === $slashPos)
? "./$path" : $path;
} | php | public static function getRelativePathDotDot($path, $base)
{
// Normalize paths.
$base = preg_replace('![\\\/]+!', '/', $base);
$path = preg_replace('![\\\/]+!', '/', $path);
if ($path === $base) {
return '';
}
$baseParts = explode('/', ltrim($base, '/'));
$pathParts = explode('/', ltrim($path, '/'));
array_pop($baseParts);
$lastPart = array_pop($pathParts);
foreach ($baseParts as $i => $directory) {
if (isset($pathParts[$i]) && $pathParts[$i] === $directory) {
unset($baseParts[$i], $pathParts[$i]);
} else {
break;
}
}
$pathParts[] = $lastPart;
$path = str_repeat('../', count($baseParts)) . implode('/', $pathParts);
return '' === $path
|| strpos($path, '/') === 0
|| false !== ($colonPos = strpos($path, ':')) && ($colonPos < ($slashPos = strpos($path, '/')) || false === $slashPos)
? "./$path" : $path;
} | [
"public",
"static",
"function",
"getRelativePathDotDot",
"(",
"$",
"path",
",",
"$",
"base",
")",
"{",
"// Normalize paths.",
"$",
"base",
"=",
"preg_replace",
"(",
"'![\\\\\\/]+!'",
",",
"'/'",
",",
"$",
"base",
")",
";",
"$",
"path",
"=",
"preg_replace",
... | Get relative path between target and base path. If path isn't relative, return full path.
@param string $path
@param string $base
@return string | [
"Get",
"relative",
"path",
"between",
"target",
"and",
"base",
"path",
".",
"If",
"path",
"isn",
"t",
"relative",
"return",
"full",
"path",
"."
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Filesystem/Folder.php#L143-L172 | train | Returns the relative path to the file. | [
30522,
2270,
10763,
3853,
2131,
16570,
8082,
15069,
27364,
27364,
1006,
1002,
4130,
1010,
1002,
2918,
1007,
1063,
1013,
1013,
3671,
4697,
10425,
1012,
1002,
2918,
1027,
3653,
2290,
1035,
5672,
1006,
1005,
999,
1031,
1032,
1032,
1032,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/CssSelector/XPath/XPathExpr.php | XPathExpr.join | public function join(string $combiner, self $expr): self
{
$path = $this->__toString().$combiner;
if ('*/' !== $expr->path) {
$path .= $expr->path;
}
$this->path = $path;
$this->element = $expr->element;
$this->condition = $expr->condition;
return $this;
} | php | public function join(string $combiner, self $expr): self
{
$path = $this->__toString().$combiner;
if ('*/' !== $expr->path) {
$path .= $expr->path;
}
$this->path = $path;
$this->element = $expr->element;
$this->condition = $expr->condition;
return $this;
} | [
"public",
"function",
"join",
"(",
"string",
"$",
"combiner",
",",
"self",
"$",
"expr",
")",
":",
"self",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"__toString",
"(",
")",
".",
"$",
"combiner",
";",
"if",
"(",
"'*/'",
"!==",
"$",
"expr",
"->",
"p... | Joins another XPathExpr with a combiner.
@return $this | [
"Joins",
"another",
"XPathExpr",
"with",
"a",
"combiner",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/CssSelector/XPath/XPathExpr.php#L80-L93 | train | Joins the path element condition and path of the current tree with the given combiner. | [
30522,
2270,
3853,
3693,
1006,
5164,
1002,
11506,
2099,
1010,
2969,
1002,
4654,
18098,
1007,
1024,
2969,
1063,
1002,
4130,
1027,
1002,
2023,
1011,
1028,
1035,
1035,
2000,
3367,
4892,
1006,
1007,
1012,
1002,
11506,
2099,
1025,
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... |
matomo-org/matomo | core/DataTable/Filter/PivotByDimension.php | PivotByDimension.getIntersectedTable | private function getIntersectedTable(DataTable $table, Row $row)
{
if ($this->isPivotDimensionSubtable()) {
return $this->loadSubtable($table, $row);
}
if ($this->isFetchingBySegmentEnabled) {
$segment = $row->getMetadata('segment');
if (empty($segment)) {
$segmentValue = $row->getMetadata('segmentValue');
if ($segmentValue === false) {
$segmentValue = $row->getColumn('label');
}
$segmentName = $this->thisReportDimensionSegment->getSegment();
if (empty($segmentName)) {
throw new \Exception("Invalid segment found when pivoting: " . $this->thisReportDimensionSegment->getName());
}
$segment = $segmentName . "==" . urlencode($segmentValue);
}
return $this->fetchIntersectedWithThisBySegment($table, $segment);
}
// should never occur, unless checkSupportedPivot() fails to catch an unsupported pivot
throw new Exception("Unexpected error, cannot fetch intersected table.");
} | php | private function getIntersectedTable(DataTable $table, Row $row)
{
if ($this->isPivotDimensionSubtable()) {
return $this->loadSubtable($table, $row);
}
if ($this->isFetchingBySegmentEnabled) {
$segment = $row->getMetadata('segment');
if (empty($segment)) {
$segmentValue = $row->getMetadata('segmentValue');
if ($segmentValue === false) {
$segmentValue = $row->getColumn('label');
}
$segmentName = $this->thisReportDimensionSegment->getSegment();
if (empty($segmentName)) {
throw new \Exception("Invalid segment found when pivoting: " . $this->thisReportDimensionSegment->getName());
}
$segment = $segmentName . "==" . urlencode($segmentValue);
}
return $this->fetchIntersectedWithThisBySegment($table, $segment);
}
// should never occur, unless checkSupportedPivot() fails to catch an unsupported pivot
throw new Exception("Unexpected error, cannot fetch intersected table.");
} | [
"private",
"function",
"getIntersectedTable",
"(",
"DataTable",
"$",
"table",
",",
"Row",
"$",
"row",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isPivotDimensionSubtable",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"loadSubtable",
"(",
"$",
"table",
... | An intersected table is a table that describes visits by a certain dimension for the visits
represented by a row in another table. This method fetches intersected tables either via
subtable or by using a segment. Read the class docs for more info. | [
"An",
"intersected",
"table",
"is",
"a",
"table",
"that",
"describes",
"visits",
"by",
"a",
"certain",
"dimension",
"for",
"the",
"visits",
"represented",
"by",
"a",
"row",
"in",
"another",
"table",
".",
"This",
"method",
"fetches",
"intersected",
"tables",
... | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/DataTable/Filter/PivotByDimension.php#L265-L291 | train | Returns intersected table | [
30522,
2797,
3853,
2131,
18447,
2545,
22471,
2098,
10880,
1006,
2951,
10880,
1002,
2795,
1010,
5216,
1002,
5216,
1007,
1063,
2065,
1006,
1002,
2023,
1011,
1028,
2003,
8197,
22994,
22172,
6132,
8496,
12083,
10880,
1006,
1007,
1007,
1063,
270... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
z-song/laravel-admin | src/Show.php | Show.overwriteExistingRelation | protected function overwriteExistingRelation($name)
{
if ($this->relations->isEmpty()) {
return;
}
$this->relations = $this->relations->filter(
function (Relation $relation) use ($name) {
return $relation->getName() != $name;
}
);
} | php | protected function overwriteExistingRelation($name)
{
if ($this->relations->isEmpty()) {
return;
}
$this->relations = $this->relations->filter(
function (Relation $relation) use ($name) {
return $relation->getName() != $name;
}
);
} | [
"protected",
"function",
"overwriteExistingRelation",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"relations",
"->",
"isEmpty",
"(",
")",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"relations",
"=",
"$",
"this",
"->",
"relations",
"... | Overwrite existing relation.
@param string $name | [
"Overwrite",
"existing",
"relation",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Show.php#L276-L287 | train | Overwrite existing relation | [
30522,
5123,
3853,
2058,
26373,
10288,
2923,
2075,
16570,
3370,
1006,
1002,
2171,
1007,
1063,
2065,
1006,
1002,
2023,
1011,
1028,
4262,
1011,
1028,
2003,
6633,
13876,
2100,
1006,
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... |
laravel/framework | src/Illuminate/Database/Schema/Blueprint.php | Blueprint.tinyInteger | public function tinyInteger($column, $autoIncrement = false, $unsigned = false)
{
return $this->addColumn('tinyInteger', $column, compact('autoIncrement', 'unsigned'));
} | php | public function tinyInteger($column, $autoIncrement = false, $unsigned = false)
{
return $this->addColumn('tinyInteger', $column, compact('autoIncrement', 'unsigned'));
} | [
"public",
"function",
"tinyInteger",
"(",
"$",
"column",
",",
"$",
"autoIncrement",
"=",
"false",
",",
"$",
"unsigned",
"=",
"false",
")",
"{",
"return",
"$",
"this",
"->",
"addColumn",
"(",
"'tinyInteger'",
",",
"$",
"column",
",",
"compact",
"(",
"'aut... | Create a new tiny integer (1-byte) column on the table.
@param string $column
@param bool $autoIncrement
@param bool $unsigned
@return \Illuminate\Database\Schema\ColumnDefinition | [
"Create",
"a",
"new",
"tiny",
"integer",
"(",
"1",
"-",
"byte",
")",
"column",
"on",
"the",
"table",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Schema/Blueprint.php#L678-L681 | train | Add tiny integer column | [
30522,
2270,
3853,
4714,
18447,
26320,
1006,
1002,
5930,
1010,
1002,
8285,
2378,
16748,
3672,
1027,
6270,
1010,
1002,
27121,
1027,
6270,
1007,
1063,
2709,
1002,
2023,
1011,
1028,
5587,
25778,
2819,
2078,
1006,
1005,
4714,
18447,
26320,
1005... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/DomCrawler/Form.php | Form.disableValidation | public function disableValidation()
{
foreach ($this->fields->all() as $field) {
if ($field instanceof Field\ChoiceFormField) {
$field->disableValidation();
}
}
return $this;
} | php | public function disableValidation()
{
foreach ($this->fields->all() as $field) {
if ($field instanceof Field\ChoiceFormField) {
$field->disableValidation();
}
}
return $this;
} | [
"public",
"function",
"disableValidation",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"fields",
"->",
"all",
"(",
")",
"as",
"$",
"field",
")",
"{",
"if",
"(",
"$",
"field",
"instanceof",
"Field",
"\\",
"ChoiceFormField",
")",
"{",
"$",
"field",... | Disables validation.
@return self | [
"Disables",
"validation",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DomCrawler/Form.php#L361-L370 | train | Disable validation for all choice fields | [
30522,
2270,
3853,
4487,
19150,
10175,
8524,
3508,
1006,
1007,
1063,
18921,
6776,
1006,
1002,
2023,
1011,
1028,
4249,
1011,
1028,
2035,
1006,
1007,
2004,
1002,
2492,
1007,
1063,
2065,
1006,
1002,
2492,
6013,
11253,
2492,
1032,
3601,
14192,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/HTML/QuickForm2/Controller/Action/Jump.php | HTML_QuickForm2_Controller_Action_Jump.splitUri | protected static function splitUri($uri)
{
if (false === ($qm = strpos($uri, '?'))) {
return array($uri, '');
} else {
return array(substr($uri, 0, $qm), substr($uri, $qm));
}
} | php | protected static function splitUri($uri)
{
if (false === ($qm = strpos($uri, '?'))) {
return array($uri, '');
} else {
return array(substr($uri, 0, $qm), substr($uri, $qm));
}
} | [
"protected",
"static",
"function",
"splitUri",
"(",
"$",
"uri",
")",
"{",
"if",
"(",
"false",
"===",
"(",
"$",
"qm",
"=",
"strpos",
"(",
"$",
"uri",
",",
"'?'",
")",
")",
")",
"{",
"return",
"array",
"(",
"$",
"uri",
",",
"''",
")",
";",
"}",
... | Splits (part of) the URI into path and query components
@param string String of the form 'foo?bar'
@return array Array of the form array('foo', '?bar) | [
"Splits",
"(",
"part",
"of",
")",
"the",
"URI",
"into",
"path",
"and",
"query",
"components"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/HTML/QuickForm2/Controller/Action/Jump.php#L67-L74 | train | Splits the URI into its components | [
30522,
5123,
10763,
3853,
3975,
9496,
1006,
1002,
24471,
2072,
1007,
1063,
2065,
1006,
6270,
1027,
1027,
1027,
1006,
1002,
1053,
2213,
1027,
2358,
14536,
2891,
1006,
1002,
24471,
2072,
1010,
1005,
1029,
1005,
1007,
1007,
1007,
1063,
2709,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Console/Scheduling/CommandBuilder.php | CommandBuilder.ensureCorrectUser | protected function ensureCorrectUser(Event $event, $command)
{
return $event->user && ! windows_os() ? 'sudo -u '.$event->user.' -- sh -c \''.$command.'\'' : $command;
} | php | protected function ensureCorrectUser(Event $event, $command)
{
return $event->user && ! windows_os() ? 'sudo -u '.$event->user.' -- sh -c \''.$command.'\'' : $command;
} | [
"protected",
"function",
"ensureCorrectUser",
"(",
"Event",
"$",
"event",
",",
"$",
"command",
")",
"{",
"return",
"$",
"event",
"->",
"user",
"&&",
"!",
"windows_os",
"(",
")",
"?",
"'sudo -u '",
".",
"$",
"event",
"->",
"user",
".",
"' -- sh -c \\''",
... | Finalize the event's command syntax with the correct user.
@param \Illuminate\Console\Scheduling\Event $event
@param string $command
@return string | [
"Finalize",
"the",
"event",
"s",
"command",
"syntax",
"with",
"the",
"correct",
"user",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Console/Scheduling/CommandBuilder.php#L67-L70 | train | Ensure correct user | [
30522,
5123,
3853,
5676,
27108,
2890,
22675,
2121,
1006,
2724,
1002,
2724,
1010,
1002,
3094,
1007,
1063,
2709,
1002,
2724,
1011,
1028,
5310,
1004,
1004,
999,
3645,
1035,
9808,
1006,
30524,
1011,
1039,
1032,
1005,
1005,
1012,
1002,
3094,
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... |
z-song/laravel-admin | src/Grid/Column.php | Column.view | public function view($view)
{
return $this->display(function ($value) use ($view) {
$model = $this;
return view($view, compact('model', 'value'))->render();
});
} | php | public function view($view)
{
return $this->display(function ($value) use ($view) {
$model = $this;
return view($view, compact('model', 'value'))->render();
});
} | [
"public",
"function",
"view",
"(",
"$",
"view",
")",
"{",
"return",
"$",
"this",
"->",
"display",
"(",
"function",
"(",
"$",
"value",
")",
"use",
"(",
"$",
"view",
")",
"{",
"$",
"model",
"=",
"$",
"this",
";",
"return",
"view",
"(",
"$",
"view",... | Render this column with the given view.
@param string $view
@return $this | [
"Render",
"this",
"column",
"with",
"the",
"given",
"view",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid/Column.php#L385-L392 | train | View the value of the field | [
30522,
2270,
3853,
3193,
1006,
1002,
3193,
1007,
1063,
2709,
1002,
2023,
1011,
1028,
4653,
1006,
3853,
1006,
1002,
3643,
1007,
2224,
1006,
1002,
3193,
1007,
1063,
1002,
2944,
1027,
1002,
2023,
1025,
2709,
3193,
1006,
1002,
3193,
1010,
923... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Auth/SessionGuard.php | SessionGuard.attemptBasic | protected function attemptBasic(Request $request, $field, $extraConditions = [])
{
if (! $request->getUser()) {
return false;
}
return $this->attempt(array_merge(
$this->basicCredentials($request, $field), $extraConditions
));
} | php | protected function attemptBasic(Request $request, $field, $extraConditions = [])
{
if (! $request->getUser()) {
return false;
}
return $this->attempt(array_merge(
$this->basicCredentials($request, $field), $extraConditions
));
} | [
"protected",
"function",
"attemptBasic",
"(",
"Request",
"$",
"request",
",",
"$",
"field",
",",
"$",
"extraConditions",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"$",
"request",
"->",
"getUser",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"retur... | Attempt to authenticate using basic authentication.
@param \Symfony\Component\HttpFoundation\Request $request
@param string $field
@param array $extraConditions
@return bool | [
"Attempt",
"to",
"authenticate",
"using",
"basic",
"authentication",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Auth/SessionGuard.php#L303-L312 | train | Attempt to authenticate with basic credentials | [
30522,
5123,
3853,
3535,
22083,
2594,
1006,
5227,
1002,
5227,
1010,
1002,
2492,
1010,
1002,
4469,
8663,
20562,
2015,
1027,
1031,
1033,
1007,
1063,
2065,
1006,
999,
1002,
5227,
1011,
1028,
2131,
20330,
1006,
1007,
1007,
1063,
2709,
6270,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/Zend/Mime/Decode.php | Zend_Mime_Decode.splitMime | public static function splitMime($body, $boundary)
{
// TODO: we're ignoring \r for now - is this function fast enough and is it safe to asume noone needs \r?
$body = str_replace("\r", '', $body);
$start = 0;
$res = array();
// find every mime part limiter and cut out the
// string before it.
// the part before the first boundary string is discarded:
$p = strpos($body, '--' . $boundary . "\n", $start);
if ($p === false) {
// no parts found!
return array();
}
// position after first boundary line
$start = $p + 3 + strlen($boundary);
while (($p = strpos($body, '--' . $boundary . "\n", $start)) !== false) {
$res[] = substr($body, $start, $p-$start);
$start = $p + 3 + strlen($boundary);
}
// no more parts, find end boundary
$p = strpos($body, '--' . $boundary . '--', $start);
if ($p===false) {
throw new Zend_Exception('Not a valid Mime Message: End Missing');
}
// the remaining part also needs to be parsed:
$res[] = substr($body, $start, $p-$start);
return $res;
} | php | public static function splitMime($body, $boundary)
{
// TODO: we're ignoring \r for now - is this function fast enough and is it safe to asume noone needs \r?
$body = str_replace("\r", '', $body);
$start = 0;
$res = array();
// find every mime part limiter and cut out the
// string before it.
// the part before the first boundary string is discarded:
$p = strpos($body, '--' . $boundary . "\n", $start);
if ($p === false) {
// no parts found!
return array();
}
// position after first boundary line
$start = $p + 3 + strlen($boundary);
while (($p = strpos($body, '--' . $boundary . "\n", $start)) !== false) {
$res[] = substr($body, $start, $p-$start);
$start = $p + 3 + strlen($boundary);
}
// no more parts, find end boundary
$p = strpos($body, '--' . $boundary . '--', $start);
if ($p===false) {
throw new Zend_Exception('Not a valid Mime Message: End Missing');
}
// the remaining part also needs to be parsed:
$res[] = substr($body, $start, $p-$start);
return $res;
} | [
"public",
"static",
"function",
"splitMime",
"(",
"$",
"body",
",",
"$",
"boundary",
")",
"{",
"// TODO: we're ignoring \\r for now - is this function fast enough and is it safe to asume noone needs \\r?",
"$",
"body",
"=",
"str_replace",
"(",
"\"\\r\"",
",",
"''",
",",
"... | Explode MIME multipart string into seperate parts
Parts consist of the header and the body of each MIME part.
@param string $body raw body of message
@param string $boundary boundary as found in content-type
@return array parts with content of each part, empty if no parts found
@throws Zend_Exception | [
"Explode",
"MIME",
"multipart",
"string",
"into",
"seperate",
"parts"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Mime/Decode.php#L45-L78 | train | Split the MIME part into its parts | [
30522,
2270,
10763,
3853,
3975,
4328,
4168,
1006,
1002,
2303,
1010,
1002,
6192,
1007,
1063,
1013,
1013,
28681,
2080,
1024,
2057,
1005,
2128,
9217,
1032,
1054,
2005,
2085,
1011,
2003,
2023,
3853,
3435,
2438,
1998,
2003,
2009,
3647,
2000,
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... |
octobercms/october | modules/backend/widgets/Lists.php | Lists.getRecords | protected function getRecords()
{
$query = $this->prepareQuery();
if ($this->showTree) {
$records = $query->getNested();
}
elseif ($this->showPagination) {
$method = $this->showPageNumbers ? 'paginate' : 'simplePaginate';
$currentPageNumber = $this->getCurrentPageNumber($query);
$records = $query->{$method}($this->recordsPerPage, $currentPageNumber);
}
else {
$records = $query->get();
}
/**
* @event backend.list.extendRecords
* Provides an opportunity to modify and / or return the `$records` Collection object before the widget uses it.
*
* Example usage:
*
* Event::listen('backend.list.extendRecords', function($listWidget, $records) {
* $model = MyModel::where('always_include', true)->first();
* $records->prepend($model);
* });
*
* Or
*
* $listWidget->bindEvent('list.extendRecords', function ($records) {
* $model = MyModel::where('always_include', true)->first();
* $records->prepend($model);
* });
*
*/
if ($event = $this->fireSystemEvent('backend.list.extendRecords', [&$records])) {
$records = $event;
}
return $this->records = $records;
} | php | protected function getRecords()
{
$query = $this->prepareQuery();
if ($this->showTree) {
$records = $query->getNested();
}
elseif ($this->showPagination) {
$method = $this->showPageNumbers ? 'paginate' : 'simplePaginate';
$currentPageNumber = $this->getCurrentPageNumber($query);
$records = $query->{$method}($this->recordsPerPage, $currentPageNumber);
}
else {
$records = $query->get();
}
/**
* @event backend.list.extendRecords
* Provides an opportunity to modify and / or return the `$records` Collection object before the widget uses it.
*
* Example usage:
*
* Event::listen('backend.list.extendRecords', function($listWidget, $records) {
* $model = MyModel::where('always_include', true)->first();
* $records->prepend($model);
* });
*
* Or
*
* $listWidget->bindEvent('list.extendRecords', function ($records) {
* $model = MyModel::where('always_include', true)->first();
* $records->prepend($model);
* });
*
*/
if ($event = $this->fireSystemEvent('backend.list.extendRecords', [&$records])) {
$records = $event;
}
return $this->records = $records;
} | [
"protected",
"function",
"getRecords",
"(",
")",
"{",
"$",
"query",
"=",
"$",
"this",
"->",
"prepareQuery",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"showTree",
")",
"{",
"$",
"records",
"=",
"$",
"query",
"->",
"getNested",
"(",
")",
";",
"}",... | Returns all the records from the supplied model, after filtering.
@return Collection | [
"Returns",
"all",
"the",
"records",
"from",
"the",
"supplied",
"model",
"after",
"filtering",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/Lists.php#L579-L619 | train | Get records from the database | [
30522,
5123,
3853,
2131,
2890,
27108,
5104,
1006,
1007,
1063,
1002,
23032,
1027,
1002,
2023,
1011,
1028,
7374,
4226,
2854,
1006,
1007,
1025,
2065,
1006,
1002,
2023,
1011,
1028,
2265,
13334,
1007,
1063,
1002,
2636,
1027,
1002,
23032,
1011,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Form/Util/OrderedHashMap.php | OrderedHashMap.offsetUnset | public function offsetUnset($key)
{
if (false !== ($position = array_search((string) $key, $this->orderedKeys))) {
array_splice($this->orderedKeys, $position, 1);
unset($this->elements[$key]);
foreach ($this->managedCursors as $i => $cursor) {
if ($cursor >= $position) {
--$this->managedCursors[$i];
}
}
}
} | php | public function offsetUnset($key)
{
if (false !== ($position = array_search((string) $key, $this->orderedKeys))) {
array_splice($this->orderedKeys, $position, 1);
unset($this->elements[$key]);
foreach ($this->managedCursors as $i => $cursor) {
if ($cursor >= $position) {
--$this->managedCursors[$i];
}
}
}
} | [
"public",
"function",
"offsetUnset",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"false",
"!==",
"(",
"$",
"position",
"=",
"array_search",
"(",
"(",
"string",
")",
"$",
"key",
",",
"$",
"this",
"->",
"orderedKeys",
")",
")",
")",
"{",
"array_splice",
"(",... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Util/OrderedHashMap.php#L145-L157 | train | Unsets an element from the list | [
30522,
2270,
3853,
16396,
4609,
13462,
1006,
1002,
3145,
1007,
1063,
2065,
1006,
6270,
999,
1027,
1027,
1006,
1002,
2597,
1027,
9140,
1035,
3945,
1006,
1006,
5164,
1007,
1002,
3145,
1010,
1002,
2023,
1011,
1028,
3641,
14839,
2015,
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... |
matomo-org/matomo | libs/HTML/QuickForm2/Renderer.php | HTML_QuickForm2_Renderer.factory | final public static function factory($type)
{
$type = strtolower($type);
if (!isset(self::$_types[$type])) {
throw new HTML_QuickForm2_InvalidArgumentException(
"Renderer type '$type' is not known"
);
}
list ($className, $includeFile) = self::$_types[$type];
if (!class_exists($className)) {
HTML_QuickForm2_Loader::loadClass($className, $includeFile);
}
if (!class_exists('HTML_QuickForm2_Renderer_Proxy')) {
HTML_QuickForm2_Loader::loadClass('HTML_QuickForm2_Renderer_Proxy');
}
return new HTML_QuickForm2_Renderer_Proxy(new $className, self::$_pluginClasses[$type]);
} | php | final public static function factory($type)
{
$type = strtolower($type);
if (!isset(self::$_types[$type])) {
throw new HTML_QuickForm2_InvalidArgumentException(
"Renderer type '$type' is not known"
);
}
list ($className, $includeFile) = self::$_types[$type];
if (!class_exists($className)) {
HTML_QuickForm2_Loader::loadClass($className, $includeFile);
}
if (!class_exists('HTML_QuickForm2_Renderer_Proxy')) {
HTML_QuickForm2_Loader::loadClass('HTML_QuickForm2_Renderer_Proxy');
}
return new HTML_QuickForm2_Renderer_Proxy(new $className, self::$_pluginClasses[$type]);
} | [
"final",
"public",
"static",
"function",
"factory",
"(",
"$",
"type",
")",
"{",
"$",
"type",
"=",
"strtolower",
"(",
"$",
"type",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"self",
"::",
"$",
"_types",
"[",
"$",
"type",
"]",
")",
")",
"{",
"throw",
... | Creates a new renderer instance of the given type
A renderer is always wrapped by a Proxy, which handles calling its
"published" methods and methods of its plugins. Registered plugins are
added automagically to the existing renderer instances so that
<code>
$foo = HTML_QuickForm2_Renderer::factory('foo');
// Plugin implementing bar() method
HTML_QuickForm2_Renderer::registerPlugin('foo', 'Plugin_Foo_Bar');
$foo->bar();
</code>
will work.
@param string Type name (treated case-insensitively)
@return HTML_QuickForm2_Renderer_Proxy A renderer instance of the given
type wrapped by a Proxy
@throws HTML_QuickForm2_InvalidArgumentException If type name is unknown
@throws HTML_QuickForm2_NotFoundException If class for the renderer can
not be found and/or loaded from file | [
"Creates",
"a",
"new",
"renderer",
"instance",
"of",
"the",
"given",
"type"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/HTML/QuickForm2/Renderer.php#L131-L148 | train | Returns a renderer object of the given type | [
30522,
2345,
2270,
10763,
3853,
4713,
1006,
1002,
2828,
1007,
1063,
1002,
2828,
1027,
2358,
5339,
12898,
13777,
1006,
1002,
2828,
1007,
1025,
2065,
1006,
999,
26354,
3388,
1006,
2969,
1024,
1024,
1002,
1035,
4127,
1031,
1002,
2828,
1033,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Database/Query/Builder.php | Builder.parseSub | protected function parseSub($query)
{
if ($query instanceof self || $query instanceof EloquentBuilder) {
return [$query->toSql(), $query->getBindings()];
} elseif (is_string($query)) {
return [$query, []];
} else {
throw new InvalidArgumentException;
}
} | php | protected function parseSub($query)
{
if ($query instanceof self || $query instanceof EloquentBuilder) {
return [$query->toSql(), $query->getBindings()];
} elseif (is_string($query)) {
return [$query, []];
} else {
throw new InvalidArgumentException;
}
} | [
"protected",
"function",
"parseSub",
"(",
"$",
"query",
")",
"{",
"if",
"(",
"$",
"query",
"instanceof",
"self",
"||",
"$",
"query",
"instanceof",
"EloquentBuilder",
")",
"{",
"return",
"[",
"$",
"query",
"->",
"toSql",
"(",
")",
",",
"$",
"query",
"->... | Parse the subquery into SQL and bindings.
@param mixed $query
@return array | [
"Parse",
"the",
"subquery",
"into",
"SQL",
"and",
"bindings",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Query/Builder.php#L321-L330 | train | Parse sub query | [
30522,
5123,
3853,
11968,
8583,
12083,
1006,
1002,
23032,
1007,
1063,
2065,
1006,
1002,
23032,
6013,
11253,
2969,
1064,
1064,
1002,
23032,
6013,
11253,
3449,
2080,
15417,
8569,
23891,
2099,
1007,
1063,
2709,
1031,
1002,
23032,
1011,
1028,
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/EventDispatcher.php | EventDispatcher.postPendingEventsTo | public function postPendingEventsTo($plugin)
{
foreach ($this->pendingEvents as $eventInfo) {
list($eventName, $eventParams) = $eventInfo;
$this->postEvent($eventName, $eventParams, $pending = false, array($plugin));
}
} | php | public function postPendingEventsTo($plugin)
{
foreach ($this->pendingEvents as $eventInfo) {
list($eventName, $eventParams) = $eventInfo;
$this->postEvent($eventName, $eventParams, $pending = false, array($plugin));
}
} | [
"public",
"function",
"postPendingEventsTo",
"(",
"$",
"plugin",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"pendingEvents",
"as",
"$",
"eventInfo",
")",
"{",
"list",
"(",
"$",
"eventName",
",",
"$",
"eventParams",
")",
"=",
"$",
"eventInfo",
";",
"$",... | Re-posts all pending events to the given plugin.
@param Plugin $plugin | [
"Re",
"-",
"posts",
"all",
"pending",
"events",
"to",
"the",
"given",
"plugin",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/EventDispatcher.php#L176-L182 | train | Post pending events to a specific plugin | [
30522,
2270,
3853,
2695,
11837,
4667,
18697,
7666,
3406,
1006,
1002,
13354,
2378,
1007,
1063,
18921,
6776,
1006,
1002,
2023,
1011,
1028,
14223,
18697,
7666,
2004,
1002,
2724,
2378,
14876,
1007,
1063,
2862,
1006,
1002,
2724,
18442,
1010,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Pagination/LengthAwarePaginator.php | LengthAwarePaginator.elements | protected function elements()
{
$window = UrlWindow::make($this);
return array_filter([
$window['first'],
is_array($window['slider']) ? '...' : null,
$window['slider'],
is_array($window['last']) ? '...' : null,
$window['last'],
]);
} | php | protected function elements()
{
$window = UrlWindow::make($this);
return array_filter([
$window['first'],
is_array($window['slider']) ? '...' : null,
$window['slider'],
is_array($window['last']) ? '...' : null,
$window['last'],
]);
} | [
"protected",
"function",
"elements",
"(",
")",
"{",
"$",
"window",
"=",
"UrlWindow",
"::",
"make",
"(",
"$",
"this",
")",
";",
"return",
"array_filter",
"(",
"[",
"$",
"window",
"[",
"'first'",
"]",
",",
"is_array",
"(",
"$",
"window",
"[",
"'slider'",... | Get the array of elements to pass to the view.
@return array | [
"Get",
"the",
"array",
"of",
"elements",
"to",
"pass",
"to",
"the",
"view",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Pagination/LengthAwarePaginator.php#L103-L114 | train | Return array of elements | [
30522,
5123,
3853,
3787,
1006,
1007,
1063,
1002,
3332,
1027,
24471,
2140,
11101,
5004,
1024,
1024,
2191,
1006,
1002,
2023,
1007,
1025,
2709,
9140,
1035,
11307,
1006,
1031,
1002,
3332,
1031,
1005,
2034,
1005,
1033,
1010,
2003,
1035,
9140,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Console/Output/ConsoleOutput.php | ConsoleOutput.section | public function section(): ConsoleSectionOutput
{
return new ConsoleSectionOutput($this->getStream(), $this->consoleSectionOutputs, $this->getVerbosity(), $this->isDecorated(), $this->getFormatter());
} | php | public function section(): ConsoleSectionOutput
{
return new ConsoleSectionOutput($this->getStream(), $this->consoleSectionOutputs, $this->getVerbosity(), $this->isDecorated(), $this->getFormatter());
} | [
"public",
"function",
"section",
"(",
")",
":",
"ConsoleSectionOutput",
"{",
"return",
"new",
"ConsoleSectionOutput",
"(",
"$",
"this",
"->",
"getStream",
"(",
")",
",",
"$",
"this",
"->",
"consoleSectionOutputs",
",",
"$",
"this",
"->",
"getVerbosity",
"(",
... | Creates a new output section. | [
"Creates",
"a",
"new",
"output",
"section",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Console/Output/ConsoleOutput.php#L55-L58 | train | Create a new ConsoleSectionOutput object | [
30522,
2270,
3853,
2930,
1006,
1007,
1024,
22659,
18491,
5833,
18780,
1063,
2709,
2047,
22659,
18491,
5833,
18780,
1006,
1002,
2023,
1011,
1028,
4152,
25379,
1006,
1007,
1010,
1002,
2023,
1011,
1028,
22659,
18491,
5833,
18780,
2015,
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... |
getgrav/grav | system/src/Grav/Framework/Uri/UriPartsFilter.php | UriPartsFilter.filterPort | public static function filterPort($port = null)
{
if (null === $port || (\is_int($port) && ($port >= 1 && $port <= 65535))) {
return $port;
}
throw new \InvalidArgumentException('Uri port must be null or an integer between 1 and 65535');
} | php | public static function filterPort($port = null)
{
if (null === $port || (\is_int($port) && ($port >= 1 && $port <= 65535))) {
return $port;
}
throw new \InvalidArgumentException('Uri port must be null or an integer between 1 and 65535');
} | [
"public",
"static",
"function",
"filterPort",
"(",
"$",
"port",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"port",
"||",
"(",
"\\",
"is_int",
"(",
"$",
"port",
")",
"&&",
"(",
"$",
"port",
">=",
"1",
"&&",
"$",
"port",
"<=",
"65535",
... | Filter Uri port.
This method
@param int|null $port
@return int|null
@throws \InvalidArgumentException If the port is invalid. | [
"Filter",
"Uri",
"port",
"."
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Framework/Uri/UriPartsFilter.php#L85-L92 | train | Filter the port | [
30522,
2270,
10763,
3853,
11307,
6442,
1006,
1002,
3417,
1027,
19701,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
1027,
1002,
3417,
1064,
1064,
1006,
1032,
2003,
1035,
20014,
1006,
1002,
3417,
1007,
1004,
1004,
1006,
1002,
3417,
1028,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/Plugin/Report.php | Report.getMetricsDocumentation | protected function getMetricsDocumentation()
{
$translations = Metrics::getDefaultMetricsDocumentation();
$documentation = array();
foreach ($this->metrics as $metric) {
if (!empty($translations[$metric])) {
$documentation[$metric] = $translations[$metric];
}
}
$processedMetrics = $this->processedMetrics ?: array();
foreach ($processedMetrics as $processedMetric) {
if (is_string($processedMetric) && !empty($translations[$processedMetric])) {
$documentation[$processedMetric] = $translations[$processedMetric];
} elseif ($processedMetric instanceof ProcessedMetric) {
$name = $processedMetric->getName();
$metricDocs = $processedMetric->getDocumentation();
if (empty($metricDocs)) {
$metricDocs = @$translations[$name];
}
if (!empty($metricDocs)) {
$documentation[$processedMetric->getName()] = $metricDocs;
}
}
}
return $documentation;
} | php | protected function getMetricsDocumentation()
{
$translations = Metrics::getDefaultMetricsDocumentation();
$documentation = array();
foreach ($this->metrics as $metric) {
if (!empty($translations[$metric])) {
$documentation[$metric] = $translations[$metric];
}
}
$processedMetrics = $this->processedMetrics ?: array();
foreach ($processedMetrics as $processedMetric) {
if (is_string($processedMetric) && !empty($translations[$processedMetric])) {
$documentation[$processedMetric] = $translations[$processedMetric];
} elseif ($processedMetric instanceof ProcessedMetric) {
$name = $processedMetric->getName();
$metricDocs = $processedMetric->getDocumentation();
if (empty($metricDocs)) {
$metricDocs = @$translations[$name];
}
if (!empty($metricDocs)) {
$documentation[$processedMetric->getName()] = $metricDocs;
}
}
}
return $documentation;
} | [
"protected",
"function",
"getMetricsDocumentation",
"(",
")",
"{",
"$",
"translations",
"=",
"Metrics",
"::",
"getDefaultMetricsDocumentation",
"(",
")",
";",
"$",
"documentation",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"metrics",
"as"... | Returns an array of metric documentations and their corresponding translations. Eg
`array('nb_visits' => 'If a visitor comes to your website for the first time or if they visit a page more than 30 minutes after...')`.
By default the given {@link $metrics} are used and their corresponding translations are looked up automatically.
If there is a metric documentation not found, you should add the default metric documentation translation for
this metric using the {@hook Metrics.getDefaultMetricDocumentationTranslations} event. If you want to overwrite
any default metric translation you should overwrite this method, call this parent method to get all default
translations and overwrite any custom metric translations.
@return array
@api | [
"Returns",
"an",
"array",
"of",
"metric",
"documentations",
"and",
"their",
"corresponding",
"translations",
".",
"Eg",
"array",
"(",
"nb_visits",
"=",
">",
"If",
"a",
"visitor",
"comes",
"to",
"your",
"website",
"for",
"the",
"first",
"time",
"or",
"if",
... | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Plugin/Report.php#L482-L511 | train | Returns the metrics documentation | [
30522,
5123,
3853,
2131,
12589,
16150,
10085,
27417,
12516,
1006,
1007,
1063,
1002,
11913,
1027,
12046,
2015,
1024,
1024,
2131,
3207,
7011,
11314,
12589,
16150,
10085,
27417,
12516,
1006,
1007,
1025,
1002,
12653,
1027,
9140,
1006,
1007,
1025,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/Plugin/SettingsProvider.php | SettingsProvider.getAllSystemSettings | public function getAllSystemSettings()
{
$cacheId = CacheId::languageAware('AllSystemSettings');
$cache = PiwikCache::getTransientCache();
if (!$cache->contains($cacheId)) {
$pluginNames = $this->pluginManager->getActivatedPlugins();
$byPluginName = array();
foreach ($pluginNames as $plugin) {
$component = $this->getSystemSettings($plugin);
if (!empty($component)) {
$byPluginName[$plugin] = $component;
}
}
$cache->save($cacheId, $byPluginName);
}
return $cache->fetch($cacheId);
} | php | public function getAllSystemSettings()
{
$cacheId = CacheId::languageAware('AllSystemSettings');
$cache = PiwikCache::getTransientCache();
if (!$cache->contains($cacheId)) {
$pluginNames = $this->pluginManager->getActivatedPlugins();
$byPluginName = array();
foreach ($pluginNames as $plugin) {
$component = $this->getSystemSettings($plugin);
if (!empty($component)) {
$byPluginName[$plugin] = $component;
}
}
$cache->save($cacheId, $byPluginName);
}
return $cache->fetch($cacheId);
} | [
"public",
"function",
"getAllSystemSettings",
"(",
")",
"{",
"$",
"cacheId",
"=",
"CacheId",
"::",
"languageAware",
"(",
"'AllSystemSettings'",
")",
";",
"$",
"cache",
"=",
"PiwikCache",
"::",
"getTransientCache",
"(",
")",
";",
"if",
"(",
"!",
"$",
"cache",... | Returns all available system settings. A plugin has to specify a file named `SystemSettings.php` containing a
class named `SystemSettings` that extends `Piwik\Settings\Plugin\SystemSettings` in order to be considered as
a system setting. Otherwise the settings for a plugin won't be available.
@return SystemSettings[] An array containing array([pluginName] => [setting instance]). | [
"Returns",
"all",
"available",
"system",
"settings",
".",
"A",
"plugin",
"has",
"to",
"specify",
"a",
"file",
"named",
"SystemSettings",
".",
"php",
"containing",
"a",
"class",
"named",
"SystemSettings",
"that",
"extends",
"Piwik",
"\\",
"Settings",
"\\",
"Plu... | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Plugin/SettingsProvider.php#L84-L105 | train | Returns all system settings | [
30522,
2270,
3853,
2131,
8095,
29390,
18319,
3070,
2015,
1006,
1007,
1063,
1002,
17053,
3593,
1027,
17053,
3593,
1024,
1024,
2653,
10830,
2890,
1006,
1005,
2035,
29390,
18319,
3070,
2015,
1005,
1007,
1025,
1002,
17053,
1027,
14255,
9148,
22... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/Zend/Cache/Backend/ZendPlatform.php | Zend_Cache_Backend_ZendPlatform.save | public function save($data, $id, $tags = array(), $specificLifetime = false)
{
if (!($specificLifetime === false)) {
$this->_log("Zend_Cache_Backend_ZendPlatform::save() : non false specifc lifetime is unsuported for this backend");
}
$lifetime = $this->_directives['lifetime'];
$result1 = output_cache_put($id, array($data, time()));
$result2 = (count($tags) == 0);
foreach ($tags as $tag) {
$tagid = self::TAGS_PREFIX.$tag;
$old_tags = output_cache_get($tagid, $lifetime);
if ($old_tags === false) {
$old_tags = array();
}
$old_tags[$id] = $id;
output_cache_remove_key($tagid);
$result2 = output_cache_put($tagid, $old_tags);
}
return $result1 && $result2;
} | php | public function save($data, $id, $tags = array(), $specificLifetime = false)
{
if (!($specificLifetime === false)) {
$this->_log("Zend_Cache_Backend_ZendPlatform::save() : non false specifc lifetime is unsuported for this backend");
}
$lifetime = $this->_directives['lifetime'];
$result1 = output_cache_put($id, array($data, time()));
$result2 = (count($tags) == 0);
foreach ($tags as $tag) {
$tagid = self::TAGS_PREFIX.$tag;
$old_tags = output_cache_get($tagid, $lifetime);
if ($old_tags === false) {
$old_tags = array();
}
$old_tags[$id] = $id;
output_cache_remove_key($tagid);
$result2 = output_cache_put($tagid, $old_tags);
}
return $result1 && $result2;
} | [
"public",
"function",
"save",
"(",
"$",
"data",
",",
"$",
"id",
",",
"$",
"tags",
"=",
"array",
"(",
")",
",",
"$",
"specificLifetime",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"(",
"$",
"specificLifetime",
"===",
"false",
")",
")",
"{",
"$",
"thi... | Save some string datas into a cache record
Note : $data is always "string" (serialization is done by the
core not by the backend)
@param string $data Data to cache
@param string $id Cache id
@param array $tags Array of strings, the cache record will be tagged by each string entry
@param int $specificLifetime If != false, set a specific lifetime for this cache record (null => infinite lifetime)
@return boolean true if no problem | [
"Save",
"some",
"string",
"datas",
"into",
"a",
"cache",
"record"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Cache/Backend/ZendPlatform.php#L130-L152 | train | Save cache data | [
30522,
2270,
3853,
3828,
1006,
1002,
2951,
1010,
1002,
8909,
1010,
1002,
22073,
1027,
9140,
1006,
1007,
1010,
1002,
3563,
15509,
7292,
1027,
6270,
1007,
1063,
2065,
1006,
999,
1006,
1002,
3563,
15509,
7292,
1027,
1027,
1027,
6270,
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... |
laravel/framework | src/Illuminate/Routing/Router.php | Router.updateGroupStack | protected function updateGroupStack(array $attributes)
{
if (! empty($this->groupStack)) {
$attributes = $this->mergeWithLastGroup($attributes);
}
$this->groupStack[] = $attributes;
} | php | protected function updateGroupStack(array $attributes)
{
if (! empty($this->groupStack)) {
$attributes = $this->mergeWithLastGroup($attributes);
}
$this->groupStack[] = $attributes;
} | [
"protected",
"function",
"updateGroupStack",
"(",
"array",
"$",
"attributes",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"groupStack",
")",
")",
"{",
"$",
"attributes",
"=",
"$",
"this",
"->",
"mergeWithLastGroup",
"(",
"$",
"attributes",
... | Update the group stack with the given attributes.
@param array $attributes
@return void | [
"Update",
"the",
"group",
"stack",
"with",
"the",
"given",
"attributes",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Routing/Router.php#L384-L391 | train | Update the group stack with the attributes | [
30522,
5123,
3853,
10651,
17058,
9153,
3600,
1006,
9140,
1002,
12332,
1007,
1063,
2065,
1006,
999,
4064,
1006,
1002,
2023,
1011,
1028,
2967,
2696,
3600,
1007,
1007,
1063,
1002,
12332,
1027,
1002,
2023,
1011,
1028,
13590,
24415,
8523,
2102,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getgrav/grav | system/src/Grav/Common/Data/Validation.php | Validation.typeUrl | public static function typeUrl($value, array $params, array $field)
{
return self::typeText($value, $params, $field) && filter_var($value, FILTER_VALIDATE_URL);
} | php | public static function typeUrl($value, array $params, array $field)
{
return self::typeText($value, $params, $field) && filter_var($value, FILTER_VALIDATE_URL);
} | [
"public",
"static",
"function",
"typeUrl",
"(",
"$",
"value",
",",
"array",
"$",
"params",
",",
"array",
"$",
"field",
")",
"{",
"return",
"self",
"::",
"typeText",
"(",
"$",
"value",
",",
"$",
"params",
",",
"$",
"field",
")",
"&&",
"filter_var",
"(... | HTML5 input: url
@param mixed $value Value to be validated.
@param array $params Validation parameters.
@param array $field Blueprint for the field.
@return bool True if validation succeeded. | [
"HTML5",
"input",
":",
"url"
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Data/Validation.php#L434-L437 | train | Type a value to a URL | [
30522,
2270,
10763,
3853,
2828,
3126,
2140,
1006,
1002,
3643,
1010,
9140,
1002,
11498,
5244,
1010,
9140,
1002,
2492,
1007,
1063,
2709,
2969,
1024,
1024,
2828,
18209,
1006,
1002,
3643,
1010,
1002,
11498,
5244,
1010,
1002,
2492,
1007,
1004,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Broadcasting/Broadcasters/Broadcaster.php | Broadcaster.retrieveChannelOptions | protected function retrieveChannelOptions($channel)
{
foreach ($this->channelOptions as $pattern => $options) {
if (! $this->channelNameMatchesPattern($channel, $pattern)) {
continue;
}
return $options;
}
return [];
} | php | protected function retrieveChannelOptions($channel)
{
foreach ($this->channelOptions as $pattern => $options) {
if (! $this->channelNameMatchesPattern($channel, $pattern)) {
continue;
}
return $options;
}
return [];
} | [
"protected",
"function",
"retrieveChannelOptions",
"(",
"$",
"channel",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"channelOptions",
"as",
"$",
"pattern",
"=>",
"$",
"options",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"channelNameMatchesPattern",
"(",
... | Retrieve options for a certain channel.
@param string $channel
@return array | [
"Retrieve",
"options",
"for",
"a",
"certain",
"channel",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Broadcasting/Broadcasters/Broadcaster.php#L305-L316 | train | Retrieve Channel Options | [
30522,
5123,
3853,
12850,
26058,
7361,
9285,
1006,
1002,
3149,
1007,
1063,
18921,
6776,
1006,
1002,
2023,
1011,
1028,
3149,
7361,
9285,
2004,
1002,
5418,
1027,
1028,
1002,
7047,
1007,
1063,
2065,
1006,
999,
1002,
2023,
1011,
1028,
3149,
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... |
overtrue/wechat | src/OpenPlatform/Authorizer/MiniProgram/Code/Client.php | Client.commit | public function commit(int $templateId, string $extJson, string $version, string $description)
{
return $this->httpPostJson('wxa/commit', [
'template_id' => $templateId,
'ext_json' => $extJson,
'user_version' => $version,
'user_desc' => $description,
]);
} | php | public function commit(int $templateId, string $extJson, string $version, string $description)
{
return $this->httpPostJson('wxa/commit', [
'template_id' => $templateId,
'ext_json' => $extJson,
'user_version' => $version,
'user_desc' => $description,
]);
} | [
"public",
"function",
"commit",
"(",
"int",
"$",
"templateId",
",",
"string",
"$",
"extJson",
",",
"string",
"$",
"version",
",",
"string",
"$",
"description",
")",
"{",
"return",
"$",
"this",
"->",
"httpPostJson",
"(",
"'wxa/commit'",
",",
"[",
"'template... | @param int $templateId
@param string $extJson
@param string $version
@param string $description
@return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
@throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException | [
"@param",
"int",
"$templateId",
"@param",
"string",
"$extJson",
"@param",
"string",
"$version",
"@param",
"string",
"$description"
] | 120c72faaa93c270365bc75c73c362d5fd583209 | https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/OpenPlatform/Authorizer/MiniProgram/Code/Client.php#L33-L41 | train | Commit a new template | [
30522,
2270,
3853,
10797,
1006,
20014,
1002,
23561,
3593,
1010,
5164,
1002,
4654,
2102,
22578,
2239,
1010,
5164,
1002,
2544,
1010,
5164,
1002,
6412,
1007,
1063,
2709,
1002,
2023,
1011,
1028,
8299,
19894,
22578,
2239,
1006,
1005,
1059,
18684... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Database/Eloquent/Relations/Concerns/AsPivot.php | AsPivot.newQueryForRestoration | public function newQueryForRestoration($ids)
{
if (is_array($ids)) {
return $this->newQueryForCollectionRestoration($ids);
}
if (! Str::contains($ids, ':')) {
return parent::newQueryForRestoration($ids);
}
$segments = explode(':', $ids);
return $this->newQueryWithoutScopes()
->where($segments[0], $segments[1])
->where($segments[2], $segments[3]);
} | php | public function newQueryForRestoration($ids)
{
if (is_array($ids)) {
return $this->newQueryForCollectionRestoration($ids);
}
if (! Str::contains($ids, ':')) {
return parent::newQueryForRestoration($ids);
}
$segments = explode(':', $ids);
return $this->newQueryWithoutScopes()
->where($segments[0], $segments[1])
->where($segments[2], $segments[3]);
} | [
"public",
"function",
"newQueryForRestoration",
"(",
"$",
"ids",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"ids",
")",
")",
"{",
"return",
"$",
"this",
"->",
"newQueryForCollectionRestoration",
"(",
"$",
"ids",
")",
";",
"}",
"if",
"(",
"!",
"Str",
":... | Get a new query to restore one or more models by their queueable IDs.
@param array<int> $ids
@return \Illuminate\Database\Eloquent\Builder | [
"Get",
"a",
"new",
"query",
"to",
"restore",
"one",
"or",
"more",
"models",
"by",
"their",
"queueable",
"IDs",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Relations/Concerns/AsPivot.php#L262-L277 | train | Return a new Query for restoration | [
30522,
2270,
3853,
2047,
4226,
2854,
29278,
28533,
21223,
1006,
1002,
8909,
2015,
1007,
1063,
2065,
1006,
2003,
1035,
9140,
1006,
1002,
8909,
2015,
1007,
1007,
1063,
2709,
1002,
2023,
1011,
1028,
2047,
4226,
2854,
29278,
26895,
18491,
28533... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Cache/RetrievesMultipleKeys.php | RetrievesMultipleKeys.putMany | public function putMany(array $values, $seconds)
{
$manyResult = null;
foreach ($values as $key => $value) {
$result = $this->put($key, $value, $seconds);
$manyResult = is_null($manyResult) ? $result : $result && $manyResult;
}
return $manyResult ?: false;
} | php | public function putMany(array $values, $seconds)
{
$manyResult = null;
foreach ($values as $key => $value) {
$result = $this->put($key, $value, $seconds);
$manyResult = is_null($manyResult) ? $result : $result && $manyResult;
}
return $manyResult ?: false;
} | [
"public",
"function",
"putMany",
"(",
"array",
"$",
"values",
",",
"$",
"seconds",
")",
"{",
"$",
"manyResult",
"=",
"null",
";",
"foreach",
"(",
"$",
"values",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
... | Store multiple items in the cache for a given number of seconds.
@param array $values
@param int $seconds
@return bool | [
"Store",
"multiple",
"items",
"in",
"the",
"cache",
"for",
"a",
"given",
"number",
"of",
"seconds",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Cache/RetrievesMultipleKeys.php#L33-L44 | train | Put many values to the cache | [
30522,
2270,
3853,
2404,
2386,
2100,
1006,
9140,
1002,
5300,
1010,
1002,
3823,
1007,
1063,
1002,
2116,
6072,
11314,
1027,
19701,
1025,
18921,
6776,
1006,
1002,
5300,
2004,
1002,
3145,
1027,
1028,
1002,
3643,
1007,
1063,
1002,
2765,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Validation/Concerns/ValidatesAttributes.php | ValidatesAttributes.getExistCount | protected function getExistCount($connection, $table, $column, $value, $parameters)
{
$verifier = $this->getPresenceVerifierFor($connection);
$extra = $this->getExtraConditions(
array_values(array_slice($parameters, 2))
);
if ($this->currentRule instanceof Exists) {
$extra = array_merge($extra, $this->currentRule->queryCallbacks());
}
return is_array($value)
? $verifier->getMultiCount($table, $column, $value, $extra)
: $verifier->getCount($table, $column, $value, null, null, $extra);
} | php | protected function getExistCount($connection, $table, $column, $value, $parameters)
{
$verifier = $this->getPresenceVerifierFor($connection);
$extra = $this->getExtraConditions(
array_values(array_slice($parameters, 2))
);
if ($this->currentRule instanceof Exists) {
$extra = array_merge($extra, $this->currentRule->queryCallbacks());
}
return is_array($value)
? $verifier->getMultiCount($table, $column, $value, $extra)
: $verifier->getCount($table, $column, $value, null, null, $extra);
} | [
"protected",
"function",
"getExistCount",
"(",
"$",
"connection",
",",
"$",
"table",
",",
"$",
"column",
",",
"$",
"value",
",",
"$",
"parameters",
")",
"{",
"$",
"verifier",
"=",
"$",
"this",
"->",
"getPresenceVerifierFor",
"(",
"$",
"connection",
")",
... | Get the number of records that exist in storage.
@param mixed $connection
@param string $table
@param string $column
@param mixed $value
@param array $parameters
@return int | [
"Get",
"the",
"number",
"of",
"records",
"that",
"exist",
"in",
"storage",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Validation/Concerns/ValidatesAttributes.php#L672-L687 | train | Get exist count | [
30522,
5123,
3853,
2131,
10288,
2923,
3597,
16671,
1006,
1002,
4434,
1010,
1002,
2795,
1010,
1002,
5930,
1010,
1002,
3643,
1010,
1002,
11709,
1007,
1063,
1002,
2310,
3089,
8873,
2121,
1027,
1002,
2023,
1011,
1028,
2131,
28994,
10127,
6299,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Translation/Loader/PoFileLoader.php | PoFileLoader.addMessage | private function addMessage(array &$messages, array $item)
{
if (\is_array($item['translated'])) {
$messages[stripcslashes($item['ids']['singular'])] = stripcslashes($item['translated'][0]);
if (isset($item['ids']['plural'])) {
$plurals = $item['translated'];
// PO are by definition indexed so sort by index.
ksort($plurals);
// Make sure every index is filled.
end($plurals);
$count = key($plurals);
// Fill missing spots with '-'.
$empties = array_fill(0, $count + 1, '-');
$plurals += $empties;
ksort($plurals);
$messages[stripcslashes($item['ids']['plural'])] = stripcslashes(implode('|', $plurals));
}
} elseif (!empty($item['ids']['singular'])) {
$messages[stripcslashes($item['ids']['singular'])] = stripcslashes($item['translated']);
}
} | php | private function addMessage(array &$messages, array $item)
{
if (\is_array($item['translated'])) {
$messages[stripcslashes($item['ids']['singular'])] = stripcslashes($item['translated'][0]);
if (isset($item['ids']['plural'])) {
$plurals = $item['translated'];
// PO are by definition indexed so sort by index.
ksort($plurals);
// Make sure every index is filled.
end($plurals);
$count = key($plurals);
// Fill missing spots with '-'.
$empties = array_fill(0, $count + 1, '-');
$plurals += $empties;
ksort($plurals);
$messages[stripcslashes($item['ids']['plural'])] = stripcslashes(implode('|', $plurals));
}
} elseif (!empty($item['ids']['singular'])) {
$messages[stripcslashes($item['ids']['singular'])] = stripcslashes($item['translated']);
}
} | [
"private",
"function",
"addMessage",
"(",
"array",
"&",
"$",
"messages",
",",
"array",
"$",
"item",
")",
"{",
"if",
"(",
"\\",
"is_array",
"(",
"$",
"item",
"[",
"'translated'",
"]",
")",
")",
"{",
"$",
"messages",
"[",
"stripcslashes",
"(",
"$",
"it... | Save a translation item to the messages.
A .po file could contain by error missing plural indexes. We need to
fix these before saving them. | [
"Save",
"a",
"translation",
"item",
"to",
"the",
"messages",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Translation/Loader/PoFileLoader.php#L127-L147 | train | Adds an item to the messages array | [
30522,
2797,
3853,
5587,
7834,
3736,
3351,
1006,
9140,
1004,
1002,
7696,
1010,
9140,
1002,
8875,
1007,
1063,
2065,
1006,
1032,
2003,
1035,
9140,
1006,
1002,
8875,
1031,
1005,
5421,
1005,
1033,
1007,
1007,
1063,
1002,
7696,
1031,
6167,
616... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getgrav/grav | system/src/Grav/Common/Data/Validation.php | Validation.typeCheckbox | public static function typeCheckbox($value, array $params, array $field)
{
$value = (string)$value;
$field_value = (string)($field['value'] ?? '1');
return $value === $field_value;
} | php | public static function typeCheckbox($value, array $params, array $field)
{
$value = (string)$value;
$field_value = (string)($field['value'] ?? '1');
return $value === $field_value;
} | [
"public",
"static",
"function",
"typeCheckbox",
"(",
"$",
"value",
",",
"array",
"$",
"params",
",",
"array",
"$",
"field",
")",
"{",
"$",
"value",
"=",
"(",
"string",
")",
"$",
"value",
";",
"$",
"field_value",
"=",
"(",
"string",
")",
"(",
"$",
"... | HTML5 input: checkbox
@param mixed $value Value to be validated.
@param array $params Validation parameters.
@param array $field Blueprint for the field.
@return bool True if validation succeeded. | [
"HTML5",
"input",
":",
"checkbox"
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Data/Validation.php#L261-L267 | train | Type checkbox. | [
30522,
30524,
8758,
1006,
1002,
3643,
1010,
9140,
1002,
11498,
5244,
1010,
9140,
1002,
2492,
1007,
1063,
1002,
3643,
1027,
1006,
5164,
1007,
1002,
3643,
1025,
1002,
2492,
1035,
3643,
1027,
1006,
5164,
1007,
1006,
1002,
2492,
1031,
1005,
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... |
laravel/framework | src/Illuminate/Validation/Validator.php | Validator.validated | public function validated()
{
if ($this->invalid()) {
throw new ValidationException($this);
}
$results = [];
$missingValue = Str::random(10);
foreach (array_keys($this->getRules()) as $key) {
$value = data_get($this->getData(), $key, $missingValue);
if ($value !== $missingValue) {
Arr::set($results, $key, $value);
}
}
return $results;
} | php | public function validated()
{
if ($this->invalid()) {
throw new ValidationException($this);
}
$results = [];
$missingValue = Str::random(10);
foreach (array_keys($this->getRules()) as $key) {
$value = data_get($this->getData(), $key, $missingValue);
if ($value !== $missingValue) {
Arr::set($results, $key, $value);
}
}
return $results;
} | [
"public",
"function",
"validated",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"invalid",
"(",
")",
")",
"{",
"throw",
"new",
"ValidationException",
"(",
"$",
"this",
")",
";",
"}",
"$",
"results",
"=",
"[",
"]",
";",
"$",
"missingValue",
"=",
"St... | Get the attributes and values that were validated.
@return array
@throws \Illuminate\Validation\ValidationException | [
"Get",
"the",
"attributes",
"and",
"values",
"that",
"were",
"validated",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Validation/Validator.php#L328-L347 | train | Return array of all the rules that have been validated | [
30522,
2270,
3853,
9398,
4383,
1006,
1007,
1063,
2065,
1006,
1002,
2023,
1011,
1028,
19528,
1006,
1007,
1007,
1063,
5466,
2047,
27354,
10288,
24422,
1006,
1002,
2023,
1007,
1025,
1065,
1002,
3463,
1027,
1031,
1033,
1025,
1002,
4394,
10175,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getgrav/grav | system/src/Grav/Common/Data/Blueprints.php | Blueprints.get | public function get($type)
{
if (!isset($this->instances[$type])) {
$this->instances[$type] = $this->loadFile($type);
}
return $this->instances[$type];
} | php | public function get($type)
{
if (!isset($this->instances[$type])) {
$this->instances[$type] = $this->loadFile($type);
}
return $this->instances[$type];
} | [
"public",
"function",
"get",
"(",
"$",
"type",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"instances",
"[",
"$",
"type",
"]",
")",
")",
"{",
"$",
"this",
"->",
"instances",
"[",
"$",
"type",
"]",
"=",
"$",
"this",
"->",
"loadFil... | Get blueprint.
@param string $type Blueprint type.
@return Blueprint
@throws \RuntimeException | [
"Get",
"blueprint",
"."
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Data/Blueprints.php#L39-L46 | train | Get the instance of the given type. | [
30522,
2270,
3853,
2131,
1006,
1002,
2828,
1007,
1063,
2065,
1006,
999,
26354,
3388,
1006,
1002,
2023,
1011,
1028,
12107,
1031,
1002,
2828,
1033,
1007,
1007,
1063,
1002,
2023,
1011,
1028,
12107,
1031,
1002,
2828,
1033,
1027,
1002,
2023,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
overtrue/wechat | src/Payment/Redpack/Client.php | Client.sendGroup | public function sendGroup(array $params)
{
$base = [
'amt_type' => 'ALL_RAND',
'wxappid' => $this->app['config']->app_id,
];
return $this->safeRequest('mmpaymkttransfers/sendgroupredpack', array_merge($base, $params));
} | php | public function sendGroup(array $params)
{
$base = [
'amt_type' => 'ALL_RAND',
'wxappid' => $this->app['config']->app_id,
];
return $this->safeRequest('mmpaymkttransfers/sendgroupredpack', array_merge($base, $params));
} | [
"public",
"function",
"sendGroup",
"(",
"array",
"$",
"params",
")",
"{",
"$",
"base",
"=",
"[",
"'amt_type'",
"=>",
"'ALL_RAND'",
",",
"'wxappid'",
"=>",
"$",
"this",
"->",
"app",
"[",
"'config'",
"]",
"->",
"app_id",
",",
"]",
";",
"return",
"$",
"... | Send group redpack.
@param array $params
@return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string
@throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException | [
"Send",
"group",
"redpack",
"."
] | 120c72faaa93c270365bc75c73c362d5fd583209 | https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/Payment/Redpack/Client.php#L73-L81 | train | Send Group Redpack | [
30522,
2270,
3853,
4604,
17058,
1006,
9140,
1002,
11498,
5244,
1007,
1063,
1002,
2918,
1027,
1031,
1005,
2572,
2102,
1035,
2828,
1005,
1027,
1028,
1005,
2035,
1035,
14566,
1005,
1010,
1005,
1059,
18684,
9397,
3593,
1005,
1027,
1028,
1002,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Routing/RouteGroup.php | RouteGroup.merge | public static function merge($new, $old)
{
if (isset($new['domain'])) {
unset($old['domain']);
}
$new = array_merge(static::formatAs($new, $old), [
'namespace' => static::formatNamespace($new, $old),
'prefix' => static::formatPrefix($new, $old),
'where' => static::formatWhere($new, $old),
]);
return array_merge_recursive(Arr::except(
$old, ['namespace', 'prefix', 'where', 'as']
), $new);
} | php | public static function merge($new, $old)
{
if (isset($new['domain'])) {
unset($old['domain']);
}
$new = array_merge(static::formatAs($new, $old), [
'namespace' => static::formatNamespace($new, $old),
'prefix' => static::formatPrefix($new, $old),
'where' => static::formatWhere($new, $old),
]);
return array_merge_recursive(Arr::except(
$old, ['namespace', 'prefix', 'where', 'as']
), $new);
} | [
"public",
"static",
"function",
"merge",
"(",
"$",
"new",
",",
"$",
"old",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"new",
"[",
"'domain'",
"]",
")",
")",
"{",
"unset",
"(",
"$",
"old",
"[",
"'domain'",
"]",
")",
";",
"}",
"$",
"new",
"=",
"ar... | Merge route groups into a new array.
@param array $new
@param array $old
@return array | [
"Merge",
"route",
"groups",
"into",
"a",
"new",
"array",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Routing/RouteGroup.php#L16-L31 | train | Merge new and old array with new values | [
30522,
2270,
10763,
3853,
13590,
1006,
1002,
2047,
1010,
1002,
2214,
1007,
1063,
2065,
1006,
26354,
3388,
1006,
1002,
2047,
1031,
1005,
5884,
1005,
1033,
1007,
1007,
1063,
4895,
13462,
1006,
1002,
2214,
1031,
1005,
5884,
1005,
1033,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/Transitions/API.php | API.addExternalReferrers | private function addExternalReferrers($logAggregator, &$report, $idaction, $actionType, $limitBeforeGrouping)
{
$data = $this->queryExternalReferrers(
$idaction, $actionType, $logAggregator, $limitBeforeGrouping);
$report['pageMetrics']['entries'] = 0;
$report['referrers'] = array();
foreach ($data->getRows() as $row) {
$referrerId = $row->getColumn('label');
$visits = $row->getColumn(Metrics::INDEX_NB_VISITS);
if ($visits) {
// load details (i.e. subtables)
$details = array();
$subTable = $row->getSubtable();
if ($subTable) {
foreach ($subTable->getRows() as $subRow) {
$details[] = array(
'label' => $subRow->getColumn('label'),
'referrals' => $subRow->getColumn(Metrics::INDEX_NB_VISITS)
);
}
}
$report['referrers'][] = array(
'label' => $this->getReferrerLabel($referrerId),
'shortName' => \Piwik\Plugins\Referrers\getReferrerTypeFromShortName($referrerId),
'visits' => $visits,
'details' => $details
);
$report['pageMetrics']['entries'] += $visits;
}
}
// if there's no data for referrers, ResponseBuilder::handleMultiDimensionalArray
// does not detect the multi dimensional array and the data is rendered differently, which
// causes an exception.
if (count($report['referrers']) == 0) {
$report['referrers'][] = array(
'label' => $this->getReferrerLabel(Common::REFERRER_TYPE_DIRECT_ENTRY),
'shortName' => \Piwik\Plugins\Referrers\getReferrerTypeLabel(Common::REFERRER_TYPE_DIRECT_ENTRY),
'visits' => 0
);
}
} | php | private function addExternalReferrers($logAggregator, &$report, $idaction, $actionType, $limitBeforeGrouping)
{
$data = $this->queryExternalReferrers(
$idaction, $actionType, $logAggregator, $limitBeforeGrouping);
$report['pageMetrics']['entries'] = 0;
$report['referrers'] = array();
foreach ($data->getRows() as $row) {
$referrerId = $row->getColumn('label');
$visits = $row->getColumn(Metrics::INDEX_NB_VISITS);
if ($visits) {
// load details (i.e. subtables)
$details = array();
$subTable = $row->getSubtable();
if ($subTable) {
foreach ($subTable->getRows() as $subRow) {
$details[] = array(
'label' => $subRow->getColumn('label'),
'referrals' => $subRow->getColumn(Metrics::INDEX_NB_VISITS)
);
}
}
$report['referrers'][] = array(
'label' => $this->getReferrerLabel($referrerId),
'shortName' => \Piwik\Plugins\Referrers\getReferrerTypeFromShortName($referrerId),
'visits' => $visits,
'details' => $details
);
$report['pageMetrics']['entries'] += $visits;
}
}
// if there's no data for referrers, ResponseBuilder::handleMultiDimensionalArray
// does not detect the multi dimensional array and the data is rendered differently, which
// causes an exception.
if (count($report['referrers']) == 0) {
$report['referrers'][] = array(
'label' => $this->getReferrerLabel(Common::REFERRER_TYPE_DIRECT_ENTRY),
'shortName' => \Piwik\Plugins\Referrers\getReferrerTypeLabel(Common::REFERRER_TYPE_DIRECT_ENTRY),
'visits' => 0
);
}
} | [
"private",
"function",
"addExternalReferrers",
"(",
"$",
"logAggregator",
",",
"&",
"$",
"report",
",",
"$",
"idaction",
",",
"$",
"actionType",
",",
"$",
"limitBeforeGrouping",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"queryExternalReferrers",
"(",
"$... | Add the external referrers to the report:
direct entries, websites, campaigns, search engines
@param LogAggregator $logAggregator
@param $report
@param $idaction
@param string $actionType
@param $limitBeforeGrouping | [
"Add",
"the",
"external",
"referrers",
"to",
"the",
"report",
":",
"direct",
"entries",
"websites",
"campaigns",
"search",
"engines"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Transitions/API.php#L516-L558 | train | Add external referrers to the report | [
30522,
2797,
3853,
5587,
10288,
16451,
2389,
2890,
7512,
14544,
2015,
1006,
1002,
8833,
8490,
17603,
20697,
2953,
1010,
1004,
1002,
3189,
1010,
1002,
16096,
7542,
1010,
1002,
2895,
13874,
1010,
1002,
5787,
4783,
29278,
13910,
22107,
2075,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/cms/controllers/Index.php | Index.index | public function index()
{
$this->addJs('/modules/cms/assets/js/october.cmspage.js', 'core');
$this->addJs('/modules/cms/assets/js/october.dragcomponents.js', 'core');
$this->addJs('/modules/cms/assets/js/october.tokenexpander.js', 'core');
$this->addCss('/modules/cms/assets/css/october.components.css', 'core');
// Preload the code editor class as it could be needed
// before it loads dynamically.
$this->addJs('/modules/backend/formwidgets/codeeditor/assets/js/build-min.js', 'core');
$this->bodyClass = 'compact-container';
$this->pageTitle = 'cms::lang.cms.menu_label';
$this->pageTitleTemplate = '%s '.trans($this->pageTitle);
if (Request::ajax() && Request::input('formWidgetAlias')) {
$this->bindFormWidgetToController();
}
} | php | public function index()
{
$this->addJs('/modules/cms/assets/js/october.cmspage.js', 'core');
$this->addJs('/modules/cms/assets/js/october.dragcomponents.js', 'core');
$this->addJs('/modules/cms/assets/js/october.tokenexpander.js', 'core');
$this->addCss('/modules/cms/assets/css/october.components.css', 'core');
// Preload the code editor class as it could be needed
// before it loads dynamically.
$this->addJs('/modules/backend/formwidgets/codeeditor/assets/js/build-min.js', 'core');
$this->bodyClass = 'compact-container';
$this->pageTitle = 'cms::lang.cms.menu_label';
$this->pageTitleTemplate = '%s '.trans($this->pageTitle);
if (Request::ajax() && Request::input('formWidgetAlias')) {
$this->bindFormWidgetToController();
}
} | [
"public",
"function",
"index",
"(",
")",
"{",
"$",
"this",
"->",
"addJs",
"(",
"'/modules/cms/assets/js/october.cmspage.js'",
",",
"'core'",
")",
";",
"$",
"this",
"->",
"addJs",
"(",
"'/modules/cms/assets/js/october.dragcomponents.js'",
",",
"'core'",
")",
";",
"... | Index page action
@return void | [
"Index",
"page",
"action"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/controllers/Index.php#L103-L121 | train | This method is called when the code editor is being displayed. | [
30522,
2270,
3853,
5950,
1006,
1007,
1063,
1002,
2023,
1011,
1028,
5587,
22578,
1006,
1005,
1013,
14184,
1013,
4642,
2015,
1013,
7045,
1013,
1046,
2015,
1013,
2255,
1012,
4642,
13102,
4270,
1012,
1046,
2015,
1005,
1010,
1005,
4563,
1005,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
z-song/laravel-admin | src/Middleware/Authenticate.php | Authenticate.shouldPassThrough | protected function shouldPassThrough($request)
{
$excepts = config('admin.auth.excepts', [
'auth/login',
'auth/logout',
]);
return collect($excepts)
->map('admin_base_path')
->contains(function ($except) use ($request) {
if ($except !== '/') {
$except = trim($except, '/');
}
return $request->is($except);
});
} | php | protected function shouldPassThrough($request)
{
$excepts = config('admin.auth.excepts', [
'auth/login',
'auth/logout',
]);
return collect($excepts)
->map('admin_base_path')
->contains(function ($except) use ($request) {
if ($except !== '/') {
$except = trim($except, '/');
}
return $request->is($except);
});
} | [
"protected",
"function",
"shouldPassThrough",
"(",
"$",
"request",
")",
"{",
"$",
"excepts",
"=",
"config",
"(",
"'admin.auth.excepts'",
",",
"[",
"'auth/login'",
",",
"'auth/logout'",
",",
"]",
")",
";",
"return",
"collect",
"(",
"$",
"excepts",
")",
"->",
... | Determine if the request has a URI that should pass through verification.
@param \Illuminate\Http\Request $request
@return bool | [
"Determine",
"if",
"the",
"request",
"has",
"a",
"URI",
"that",
"should",
"pass",
"through",
"verification",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Middleware/Authenticate.php#L37-L53 | train | Returns true if the request should pass through the except list | [
30522,
5123,
3853,
2323,
15194,
2705,
22494,
5603,
1006,
1002,
5227,
1007,
1063,
1002,
3272,
2015,
1027,
9530,
8873,
2290,
1006,
1005,
4748,
10020,
1012,
8740,
2705,
1012,
3272,
2015,
1005,
1010,
1031,
1005,
8740,
2705,
1013,
8833,
2378,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/traits/FormModelSaver.php | FormModelSaver.setModelAttributes | protected function setModelAttributes($model, $saveData)
{
$this->modelsToSave[] = $model;
if (!is_array($saveData)) {
return;
}
if ($model instanceof HalcyonModel) {
$model->fill($saveData);
return;
}
$attributesToPurge = [];
$singularTypes = ['belongsTo', 'hasOne', 'morphTo', 'morphOne'];
foreach ($saveData as $attribute => $value) {
$isNested = $attribute == 'pivot' || (
$model->hasRelation($attribute) &&
in_array($model->getRelationType($attribute), $singularTypes)
);
if ($isNested && is_array($value)) {
$this->setModelAttributes($model->{$attribute}, $value);
}
elseif ($value !== FormField::NO_SAVE_DATA) {
if (Str::startsWith($attribute, '_')) {
$attributesToPurge[] = $attribute;
}
$model->{$attribute} = $value;
}
}
if ($attributesToPurge) {
$this->deferPurgedSaveAttributes($model, $attributesToPurge);
}
} | php | protected function setModelAttributes($model, $saveData)
{
$this->modelsToSave[] = $model;
if (!is_array($saveData)) {
return;
}
if ($model instanceof HalcyonModel) {
$model->fill($saveData);
return;
}
$attributesToPurge = [];
$singularTypes = ['belongsTo', 'hasOne', 'morphTo', 'morphOne'];
foreach ($saveData as $attribute => $value) {
$isNested = $attribute == 'pivot' || (
$model->hasRelation($attribute) &&
in_array($model->getRelationType($attribute), $singularTypes)
);
if ($isNested && is_array($value)) {
$this->setModelAttributes($model->{$attribute}, $value);
}
elseif ($value !== FormField::NO_SAVE_DATA) {
if (Str::startsWith($attribute, '_')) {
$attributesToPurge[] = $attribute;
}
$model->{$attribute} = $value;
}
}
if ($attributesToPurge) {
$this->deferPurgedSaveAttributes($model, $attributesToPurge);
}
} | [
"protected",
"function",
"setModelAttributes",
"(",
"$",
"model",
",",
"$",
"saveData",
")",
"{",
"$",
"this",
"->",
"modelsToSave",
"[",
"]",
"=",
"$",
"model",
";",
"if",
"(",
"!",
"is_array",
"(",
"$",
"saveData",
")",
")",
"{",
"return",
";",
"}"... | Sets a data collection to a model attributes, relations are also set.
@param \October\Rain\Database\Model $model Model to fill.
@param array $saveData Attribute values to fill model.
@return void | [
"Sets",
"a",
"data",
"collection",
"to",
"a",
"model",
"attributes",
"relations",
"are",
"also",
"set",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/traits/FormModelSaver.php#L52-L88 | train | Set Model Attributes | [
30522,
5123,
3853,
2275,
5302,
9247,
19321,
3089,
8569,
4570,
1006,
1002,
2944,
1010,
1002,
5552,
6790,
1007,
1063,
1002,
2023,
1011,
1028,
4275,
13122,
10696,
1031,
1033,
1027,
1002,
2944,
1025,
2065,
1006,
999,
2003,
1035,
9140,
1006,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/DataTable/Renderer/Xml.php | Xml.renderDataTable | protected function renderDataTable($array, $prefixLine = "")
{
$columnsHaveInvalidChars = $this->areTableLabelsInvalidXmlTagNames(reset($array));
$out = '';
foreach ($array as $rowId => $row) {
if (!is_array($row)) {
$value = self::formatValueXml($row);
if (strlen($value) == 0) {
$out .= $prefixLine . "\t\t<$rowId />\n";
} else {
$out .= $prefixLine . "\t\t<$rowId>" . $value . "</$rowId>\n";
}
continue;
}
// Handing case idgoal=7, creating a new array for that one
$rowAttribute = '';
if (strstr($rowId, '=') !== false) {
$rowAttribute = explode('=', $rowId);
$rowAttribute = " " . $rowAttribute[0] . "='" . $rowAttribute[1] . "'";
}
$out .= $prefixLine . "\t<row$rowAttribute>";
if (count($row) === 1
&& key($row) === 0
) {
$value = self::formatValueXml(current($row));
$out .= $prefixLine . $value;
} else {
$out .= "\n";
foreach ($row as $name => $value) {
// handle the recursive dataTable case by XML outputting the recursive table
if (is_array($value)) {
if (is_array(reset($value))) {
$value = "\n" . $this->renderDataTable($value, $prefixLine . "\t\t");
} else {
$value = "\n" . $this->renderArray($value, $prefixLine . "\t\t");
}
$value .= $prefixLine . "\t\t";
} else {
$value = self::formatValueXml($value);
}
list($tagStart, $tagEnd) = $this->getTagStartAndEndFor($name, $columnsHaveInvalidChars);
if (strlen($value) == 0) {
$out .= $prefixLine . "\t\t<$tagStart />\n";
} else {
$out .= $prefixLine . "\t\t<$tagStart>" . $value . "</$tagEnd>\n";
}
}
$out .= "\t";
}
$out .= $prefixLine . "</row>\n";
}
return $out;
} | php | protected function renderDataTable($array, $prefixLine = "")
{
$columnsHaveInvalidChars = $this->areTableLabelsInvalidXmlTagNames(reset($array));
$out = '';
foreach ($array as $rowId => $row) {
if (!is_array($row)) {
$value = self::formatValueXml($row);
if (strlen($value) == 0) {
$out .= $prefixLine . "\t\t<$rowId />\n";
} else {
$out .= $prefixLine . "\t\t<$rowId>" . $value . "</$rowId>\n";
}
continue;
}
// Handing case idgoal=7, creating a new array for that one
$rowAttribute = '';
if (strstr($rowId, '=') !== false) {
$rowAttribute = explode('=', $rowId);
$rowAttribute = " " . $rowAttribute[0] . "='" . $rowAttribute[1] . "'";
}
$out .= $prefixLine . "\t<row$rowAttribute>";
if (count($row) === 1
&& key($row) === 0
) {
$value = self::formatValueXml(current($row));
$out .= $prefixLine . $value;
} else {
$out .= "\n";
foreach ($row as $name => $value) {
// handle the recursive dataTable case by XML outputting the recursive table
if (is_array($value)) {
if (is_array(reset($value))) {
$value = "\n" . $this->renderDataTable($value, $prefixLine . "\t\t");
} else {
$value = "\n" . $this->renderArray($value, $prefixLine . "\t\t");
}
$value .= $prefixLine . "\t\t";
} else {
$value = self::formatValueXml($value);
}
list($tagStart, $tagEnd) = $this->getTagStartAndEndFor($name, $columnsHaveInvalidChars);
if (strlen($value) == 0) {
$out .= $prefixLine . "\t\t<$tagStart />\n";
} else {
$out .= $prefixLine . "\t\t<$tagStart>" . $value . "</$tagEnd>\n";
}
}
$out .= "\t";
}
$out .= $prefixLine . "</row>\n";
}
return $out;
} | [
"protected",
"function",
"renderDataTable",
"(",
"$",
"array",
",",
"$",
"prefixLine",
"=",
"\"\"",
")",
"{",
"$",
"columnsHaveInvalidChars",
"=",
"$",
"this",
"->",
"areTableLabelsInvalidXmlTagNames",
"(",
"reset",
"(",
"$",
"array",
")",
")",
";",
"$",
"ou... | Computes the output for the given data array
@param array $array
@param string $prefixLine
@return string | [
"Computes",
"the",
"output",
"for",
"the",
"given",
"data",
"array"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/DataTable/Renderer/Xml.php#L339-L396 | train | Render the data table | [
30522,
5123,
3853,
17552,
2850,
29336,
3085,
1006,
1002,
9140,
1010,
1002,
17576,
4179,
1027,
1000,
1000,
1007,
1063,
1002,
7753,
30524,
2595,
19968,
15900,
18442,
2015,
1006,
25141,
1006,
1002,
9140,
1007,
1007,
1025,
1002,
2041,
1027,
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... |
getgrav/grav | system/src/Grav/Common/User/Traits/UserTrait.php | UserTrait.authorize | public function authorize(string $action, string $scope = null): bool
{
if (!$this->get('authenticated')) {
return false;
}
if ($this->get('state', 'enabled') !== 'enabled') {
return false;
}
if (null !== $scope) {
$action = $scope . '.' . $action;
}
$config = Grav::instance()['config'];
$authorized = false;
//Check group access level
$groups = (array)$this->get('groups');
foreach ($groups as $group) {
$permission = $config->get("groups.{$group}.access.{$action}");
$authorized = Utils::isPositive($permission);
if ($authorized === true) {
break;
}
}
//Check user access level
$access = $this->get('access');
if ($access && Utils::getDotNotation($access, $action) !== null) {
$permission = $this->get("access.{$action}");
$authorized = Utils::isPositive($permission);
}
return $authorized;
} | php | public function authorize(string $action, string $scope = null): bool
{
if (!$this->get('authenticated')) {
return false;
}
if ($this->get('state', 'enabled') !== 'enabled') {
return false;
}
if (null !== $scope) {
$action = $scope . '.' . $action;
}
$config = Grav::instance()['config'];
$authorized = false;
//Check group access level
$groups = (array)$this->get('groups');
foreach ($groups as $group) {
$permission = $config->get("groups.{$group}.access.{$action}");
$authorized = Utils::isPositive($permission);
if ($authorized === true) {
break;
}
}
//Check user access level
$access = $this->get('access');
if ($access && Utils::getDotNotation($access, $action) !== null) {
$permission = $this->get("access.{$action}");
$authorized = Utils::isPositive($permission);
}
return $authorized;
} | [
"public",
"function",
"authorize",
"(",
"string",
"$",
"action",
",",
"string",
"$",
"scope",
"=",
"null",
")",
":",
"bool",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"get",
"(",
"'authenticated'",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(... | Checks user authorization to the action.
@param string $action
@param string|null $scope
@return bool | [
"Checks",
"user",
"authorization",
"to",
"the",
"action",
"."
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/User/Traits/UserTrait.php#L68-L103 | train | Authorize the current user with the given action | [
30522,
2270,
3853,
3166,
4697,
1006,
5164,
1002,
2895,
1010,
5164,
1002,
9531,
30524,
1002,
2023,
1011,
1028,
2131,
1006,
1005,
14469,
4383,
1005,
1007,
1007,
1063,
2709,
6270,
1025,
1065,
2065,
1006,
1002,
2023,
1011,
1028,
2131,
1006,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/Zend/Mail/Storage/Imap.php | Zend_Mail_Storage_Imap.createFolder | public function createFolder($name, $parentFolder = null)
{
// TODO: we assume / as the hierarchy delim - need to get that from the folder class!
if ($parentFolder instanceof Zend_Mail_Storage_Folder) {
$folder = $parentFolder->getGlobalName() . '/' . $name;
} else if ($parentFolder != null) {
$folder = $parentFolder . '/' . $name;
} else {
$folder = $name;
}
if (!$this->_protocol->create($folder)) {
/**
* @see Zend_Mail_Storage_Exception
*/
// require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('cannot create folder');
}
} | php | public function createFolder($name, $parentFolder = null)
{
// TODO: we assume / as the hierarchy delim - need to get that from the folder class!
if ($parentFolder instanceof Zend_Mail_Storage_Folder) {
$folder = $parentFolder->getGlobalName() . '/' . $name;
} else if ($parentFolder != null) {
$folder = $parentFolder . '/' . $name;
} else {
$folder = $name;
}
if (!$this->_protocol->create($folder)) {
/**
* @see Zend_Mail_Storage_Exception
*/
// require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('cannot create folder');
}
} | [
"public",
"function",
"createFolder",
"(",
"$",
"name",
",",
"$",
"parentFolder",
"=",
"null",
")",
"{",
"// TODO: we assume / as the hierarchy delim - need to get that from the folder class!",
"if",
"(",
"$",
"parentFolder",
"instanceof",
"Zend_Mail_Storage_Folder",
")",
"... | create a new folder
This method also creates parent folders if necessary. Some mail storages may restrict, which folder
may be used as parent or which chars may be used in the folder name
@param string $name global name of folder, local name if $parentFolder is set
@param string|Zend_Mail_Storage_Folder $parentFolder parent folder for new folder, else root folder is parent
@return null
@throws Zend_Mail_Storage_Exception | [
"create",
"a",
"new",
"folder"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Mail/Storage/Imap.php#L494-L512 | train | create folder in local folder | [
30522,
2270,
3853,
3443,
10371,
2121,
1006,
1002,
2171,
1010,
1002,
6687,
10371,
2121,
1027,
19701,
1007,
1063,
1013,
1013,
28681,
2080,
1024,
2057,
7868,
1013,
2004,
1996,
12571,
3972,
5714,
1011,
2342,
30524,
5653,
1035,
5527,
1035,
19622... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/system/engine/loader.php | Loader.config | public function config($route) {
$this->registry->get('event')->trigger('config/' . $route . '/before', array(&$route));
$this->registry->get('config')->load($route);
$this->registry->get('event')->trigger('config/' . $route . '/after', array(&$route));
} | php | public function config($route) {
$this->registry->get('event')->trigger('config/' . $route . '/before', array(&$route));
$this->registry->get('config')->load($route);
$this->registry->get('event')->trigger('config/' . $route . '/after', array(&$route));
} | [
"public",
"function",
"config",
"(",
"$",
"route",
")",
"{",
"$",
"this",
"->",
"registry",
"->",
"get",
"(",
"'event'",
")",
"->",
"trigger",
"(",
"'config/'",
".",
"$",
"route",
".",
"'/before'",
",",
"array",
"(",
"&",
"$",
"route",
")",
")",
";... | Config
@param string $route | [
"Config"
] | e7933b56ba05aafb3655c6b490c9733cd18b5c69 | https://github.com/opencart/opencart/blob/e7933b56ba05aafb3655c6b490c9733cd18b5c69/upload/system/engine/loader.php#L184-L190 | train | Load a config route | [
30522,
2270,
3853,
9530,
8873,
2290,
1006,
1002,
2799,
1007,
1063,
1002,
2023,
1011,
1028,
15584,
1011,
1028,
2131,
1006,
1005,
2724,
1005,
1007,
1011,
1028,
9495,
1006,
1005,
9530,
8873,
2290,
1013,
1005,
1012,
1002,
2799,
1012,
1005,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Console/Helper/Table.php | Table.renderRow | private function renderRow(array $row, string $cellFormat)
{
$rowContent = $this->renderColumnSeparator(self::BORDER_OUTSIDE);
$columns = $this->getRowColumns($row);
$last = \count($columns) - 1;
foreach ($columns as $i => $column) {
$rowContent .= $this->renderCell($row, $column, $cellFormat);
$rowContent .= $this->renderColumnSeparator($last === $i ? self::BORDER_OUTSIDE : self::BORDER_INSIDE);
}
$this->output->writeln($rowContent);
} | php | private function renderRow(array $row, string $cellFormat)
{
$rowContent = $this->renderColumnSeparator(self::BORDER_OUTSIDE);
$columns = $this->getRowColumns($row);
$last = \count($columns) - 1;
foreach ($columns as $i => $column) {
$rowContent .= $this->renderCell($row, $column, $cellFormat);
$rowContent .= $this->renderColumnSeparator($last === $i ? self::BORDER_OUTSIDE : self::BORDER_INSIDE);
}
$this->output->writeln($rowContent);
} | [
"private",
"function",
"renderRow",
"(",
"array",
"$",
"row",
",",
"string",
"$",
"cellFormat",
")",
"{",
"$",
"rowContent",
"=",
"$",
"this",
"->",
"renderColumnSeparator",
"(",
"self",
"::",
"BORDER_OUTSIDE",
")",
";",
"$",
"columns",
"=",
"$",
"this",
... | Renders table row.
Example:
| 9971-5-0210-0 | A Tale of Two Cities | Charles Dickens | | [
"Renders",
"table",
"row",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Console/Helper/Table.php#L456-L466 | train | Render a row | [
30522,
2797,
3853,
17552,
10524,
1006,
9140,
1002,
5216,
1010,
5164,
1002,
3526,
14192,
4017,
1007,
1063,
1002,
5216,
8663,
6528,
2102,
1027,
1002,
2023,
1011,
1028,
17552,
25778,
2819,
12325,
28689,
4263,
1006,
2969,
1024,
1024,
3675,
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... |
laravel/framework | src/Illuminate/Routing/Pipeline.php | Pipeline.prepareDestination | protected function prepareDestination(Closure $destination)
{
return function ($passable) use ($destination) {
try {
return $destination($passable);
} catch (Exception $e) {
return $this->handleException($passable, $e);
} catch (Throwable $e) {
return $this->handleException($passable, new FatalThrowableError($e));
}
};
} | php | protected function prepareDestination(Closure $destination)
{
return function ($passable) use ($destination) {
try {
return $destination($passable);
} catch (Exception $e) {
return $this->handleException($passable, $e);
} catch (Throwable $e) {
return $this->handleException($passable, new FatalThrowableError($e));
}
};
} | [
"protected",
"function",
"prepareDestination",
"(",
"Closure",
"$",
"destination",
")",
"{",
"return",
"function",
"(",
"$",
"passable",
")",
"use",
"(",
"$",
"destination",
")",
"{",
"try",
"{",
"return",
"$",
"destination",
"(",
"$",
"passable",
")",
";"... | Get the final piece of the Closure onion.
@param \Closure $destination
@return \Closure | [
"Get",
"the",
"final",
"piece",
"of",
"the",
"Closure",
"onion",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Routing/Pipeline.php#L26-L37 | train | Prepare destination closure | [
30522,
5123,
3853,
4810,
4355,
12758,
1006,
8503,
1002,
7688,
1007,
1063,
2709,
3853,
1006,
1002,
3413,
3085,
1007,
2224,
1006,
1002,
7688,
1007,
1063,
3046,
1063,
2709,
1002,
7688,
1006,
1002,
3413,
3085,
1007,
1025,
1065,
4608,
1006,
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... |
matomo-org/matomo | plugins/Referrers/API.php | API.removeSubtableMetadata | private function removeSubtableMetadata($dataTable)
{
if ($dataTable instanceof DataTable\Map) {
foreach ($dataTable->getDataTables() as $childTable) {
$this->removeSubtableMetadata($childTable);
}
} else {
foreach ($dataTable->getRows() as $row) {
$row->deleteMetadata('idsubdatatable_in_db');
}
}
} | php | private function removeSubtableMetadata($dataTable)
{
if ($dataTable instanceof DataTable\Map) {
foreach ($dataTable->getDataTables() as $childTable) {
$this->removeSubtableMetadata($childTable);
}
} else {
foreach ($dataTable->getRows() as $row) {
$row->deleteMetadata('idsubdatatable_in_db');
}
}
} | [
"private",
"function",
"removeSubtableMetadata",
"(",
"$",
"dataTable",
")",
"{",
"if",
"(",
"$",
"dataTable",
"instanceof",
"DataTable",
"\\",
"Map",
")",
"{",
"foreach",
"(",
"$",
"dataTable",
"->",
"getDataTables",
"(",
")",
"as",
"$",
"childTable",
")",
... | Removes idsubdatatable_in_db metadata from a DataTable. Used by Social tables since
they use fake subtable IDs.
@param DataTable $dataTable | [
"Removes",
"idsubdatatable_in_db",
"metadata",
"from",
"a",
"DataTable",
".",
"Used",
"by",
"Social",
"tables",
"since",
"they",
"use",
"fake",
"subtable",
"IDs",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Referrers/API.php#L542-L553 | train | Remove subtable metadata | [
30522,
2797,
3853,
20362,
12083,
10880,
11368,
8447,
2696,
1006,
1002,
2951,
10880,
1007,
1063,
2065,
1006,
1002,
2951,
10880,
6013,
11253,
2951,
10880,
1032,
4949,
1007,
1063,
18921,
6776,
1006,
1002,
2951,
10880,
1011,
1028,
2131,
2850,
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 | plugins/DevicesDetection/API.php | API.getOsFamilies | public function getOsFamilies($idSite, $period, $date, $segment = false)
{
$dataTable = $this->getDataTable('DevicesDetection_os', $idSite, $period, $date, $segment);
// handle legacy archives
if ($dataTable instanceof DataTable\Map || !$dataTable->getRowsCount()) {
$versionDataTable = $this->getDataTable('DevicesDetection_osVersions', $idSite, $period, $date, $segment);
$dataTable = $this->mergeDataTables($dataTable, $versionDataTable);
}
$dataTable->filter('GroupBy', array('label', __NAMESPACE__ . '\getOSFamilyFullName'));
$dataTable->filter('ColumnCallbackAddMetadata', array('label', 'logo', __NAMESPACE__ . '\getOsFamilyLogo'));
return $dataTable;
} | php | public function getOsFamilies($idSite, $period, $date, $segment = false)
{
$dataTable = $this->getDataTable('DevicesDetection_os', $idSite, $period, $date, $segment);
// handle legacy archives
if ($dataTable instanceof DataTable\Map || !$dataTable->getRowsCount()) {
$versionDataTable = $this->getDataTable('DevicesDetection_osVersions', $idSite, $period, $date, $segment);
$dataTable = $this->mergeDataTables($dataTable, $versionDataTable);
}
$dataTable->filter('GroupBy', array('label', __NAMESPACE__ . '\getOSFamilyFullName'));
$dataTable->filter('ColumnCallbackAddMetadata', array('label', 'logo', __NAMESPACE__ . '\getOsFamilyLogo'));
return $dataTable;
} | [
"public",
"function",
"getOsFamilies",
"(",
"$",
"idSite",
",",
"$",
"period",
",",
"$",
"date",
",",
"$",
"segment",
"=",
"false",
")",
"{",
"$",
"dataTable",
"=",
"$",
"this",
"->",
"getDataTable",
"(",
"'DevicesDetection_os'",
",",
"$",
"idSite",
",",... | Gets datatable displaying number of visits by OS family (eg. Windows, Android, Linux)
@param int $idSite
@param string $period
@param string $date
@param bool|string $segment
@return DataTable | [
"Gets",
"datatable",
"displaying",
"number",
"of",
"visits",
"by",
"OS",
"family",
"(",
"eg",
".",
"Windows",
"Android",
"Linux",
")"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/DevicesDetection/API.php#L146-L159 | train | Get OS families | [
30522,
2270,
3853,
2131,
2891,
7011,
4328,
11983,
1006,
1002,
8909,
28032,
2063,
1010,
1002,
2558,
1010,
1002,
3058,
1010,
1002,
6903,
1027,
6270,
1007,
1063,
1002,
2951,
10880,
1027,
1002,
2023,
1011,
1028,
2131,
2850,
29336,
3085,
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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.