repo stringclasses 21 values | path stringlengths 10 100 | func_name stringlengths 6 71 | original_string stringlengths 115 97k | language stringclasses 1 value | code stringlengths 115 97k | code_tokens listlengths 27 7.5k | docstring stringlengths 6 1.88k | docstring_tokens listlengths 1 177 | sha stringclasses 21 values | url stringlengths 100 189 | partition stringclasses 1 value | summary stringlengths 9 340 | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
getgrav/grav | system/src/Grav/Common/Debugger.php | Debugger.addAssets | public function addAssets()
{
if ($this->enabled()) {
// Only add assets if Page is HTML
$page = $this->grav['page'];
if ($page->templateFormat() !== 'html') {
return $this;
}
/** @var Assets $assets */
$assets = $this->grav['assets'];
// Add jquery library
$assets->add('jquery', 101);
$this->renderer = $this->debugbar->getJavascriptRenderer();
$this->renderer->setIncludeVendors(false);
// Get the required CSS files
list($css_files, $js_files) = $this->renderer->getAssets(null, JavascriptRenderer::RELATIVE_URL);
foreach ((array)$css_files as $css) {
$assets->addCss($css);
}
$assets->addCss('/system/assets/debugger.css');
foreach ((array)$js_files as $js) {
$assets->addJs($js);
}
}
return $this;
} | php | public function addAssets()
{
if ($this->enabled()) {
// Only add assets if Page is HTML
$page = $this->grav['page'];
if ($page->templateFormat() !== 'html') {
return $this;
}
/** @var Assets $assets */
$assets = $this->grav['assets'];
// Add jquery library
$assets->add('jquery', 101);
$this->renderer = $this->debugbar->getJavascriptRenderer();
$this->renderer->setIncludeVendors(false);
// Get the required CSS files
list($css_files, $js_files) = $this->renderer->getAssets(null, JavascriptRenderer::RELATIVE_URL);
foreach ((array)$css_files as $css) {
$assets->addCss($css);
}
$assets->addCss('/system/assets/debugger.css');
foreach ((array)$js_files as $js) {
$assets->addJs($js);
}
}
return $this;
} | [
"public",
"function",
"addAssets",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"enabled",
"(",
")",
")",
"{",
"// Only add assets if Page is HTML",
"$",
"page",
"=",
"$",
"this",
"->",
"grav",
"[",
"'page'",
"]",
";",
"if",
"(",
"$",
"page",
"->",
"... | Add the debugger assets to the Grav Assets
@return $this | [
"Add",
"the",
"debugger",
"assets",
"to",
"the",
"Grav",
"Assets"
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Debugger.php#L143-L176 | train | Add assets to debugbar | [
30522,
2270,
3853,
5587,
27241,
3215,
1006,
1007,
1063,
2065,
1006,
1002,
2023,
1011,
1028,
9124,
1006,
1007,
1007,
1063,
1013,
1013,
2069,
5587,
7045,
2065,
3931,
2003,
16129,
1002,
3931,
1027,
1002,
2023,
1011,
1028,
24665,
11431,
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... |
getgrav/grav | system/src/Grav/Common/Page/Medium/Medium.php | Medium.textParsedownElement | protected function textParsedownElement(array $attributes, $reset = true)
{
$text = empty($attributes['title']) ? empty($attributes['alt']) ? $this->get('filename') : $attributes['alt'] : $attributes['title'];
$element = [
'name' => 'p',
'attributes' => $attributes,
'text' => $text
];
if ($reset) {
$this->reset();
}
return $element;
} | php | protected function textParsedownElement(array $attributes, $reset = true)
{
$text = empty($attributes['title']) ? empty($attributes['alt']) ? $this->get('filename') : $attributes['alt'] : $attributes['title'];
$element = [
'name' => 'p',
'attributes' => $attributes,
'text' => $text
];
if ($reset) {
$this->reset();
}
return $element;
} | [
"protected",
"function",
"textParsedownElement",
"(",
"array",
"$",
"attributes",
",",
"$",
"reset",
"=",
"true",
")",
"{",
"$",
"text",
"=",
"empty",
"(",
"$",
"attributes",
"[",
"'title'",
"]",
")",
"?",
"empty",
"(",
"$",
"attributes",
"[",
"'alt'",
... | Parsedown element for text display mode
@param array $attributes
@param bool $reset
@return array | [
"Parsedown",
"element",
"for",
"text",
"display",
"mode"
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Medium/Medium.php#L448-L463 | train | Parse text element | [
30522,
5123,
3853,
3793,
19362,
6924,
12384,
12260,
3672,
30524,
1005,
1033,
1007,
1029,
4064,
1006,
1002,
12332,
1031,
1005,
12456,
1005,
1033,
1007,
1029,
1002,
2023,
1011,
1028,
2131,
1006,
1005,
5371,
18442,
1005,
1007,
1024,
1002,
1233... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Factory.php | HTML_QuickForm2_Factory.registerElement | public static function registerElement($type, $className, $includeFile = null)
{
self::$elementTypes[strtolower($type)] = array($className, $includeFile);
} | php | public static function registerElement($type, $className, $includeFile = null)
{
self::$elementTypes[strtolower($type)] = array($className, $includeFile);
} | [
"public",
"static",
"function",
"registerElement",
"(",
"$",
"type",
",",
"$",
"className",
",",
"$",
"includeFile",
"=",
"null",
")",
"{",
"self",
"::",
"$",
"elementTypes",
"[",
"strtolower",
"(",
"$",
"type",
")",
"]",
"=",
"array",
"(",
"$",
"class... | Registers a new element type
@param string Type name (treated case-insensitively)
@param string Class name
@param string File containing the class, leave empty if class already loaded | [
"Registers",
"a",
"new",
"element",
"type"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/HTML/QuickForm2/Factory.php#L131-L134 | train | Register an element type | [
30522,
2270,
10763,
3853,
4236,
12260,
3672,
1006,
1002,
2828,
1010,
1002,
2465,
18442,
1010,
1002,
2421,
8873,
2571,
1027,
19701,
1007,
1063,
2969,
1024,
1024,
1002,
5783,
13874,
2015,
1031,
2358,
5339,
12898,
13777,
1006,
1002,
2828,
1007... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php | AbstractNormalizer.getAllowedAttributes | protected function getAllowedAttributes($classOrObject, array $context, $attributesAsString = false)
{
$allowExtraAttributes = $context[self::ALLOW_EXTRA_ATTRIBUTES] ?? $this->defaultContext[self::ALLOW_EXTRA_ATTRIBUTES];
if (!$this->classMetadataFactory) {
if (!$allowExtraAttributes) {
throw new LogicException(sprintf('A class metadata factory must be provided in the constructor when setting "%s" to false.', self::ALLOW_EXTRA_ATTRIBUTES));
}
return false;
}
$tmpGroups = $context[self::GROUPS] ?? $this->defaultContext[self::GROUPS] ?? null;
$groups = (\is_array($tmpGroups) || is_scalar($tmpGroups)) ? (array) $tmpGroups : false;
if (false === $groups && $allowExtraAttributes) {
return false;
}
$allowedAttributes = [];
foreach ($this->classMetadataFactory->getMetadataFor($classOrObject)->getAttributesMetadata() as $attributeMetadata) {
$name = $attributeMetadata->getName();
if (
(false === $groups || array_intersect($attributeMetadata->getGroups(), $groups)) &&
$this->isAllowedAttribute($classOrObject, $name, null, $context)
) {
$allowedAttributes[] = $attributesAsString ? $name : $attributeMetadata;
}
}
return $allowedAttributes;
} | php | protected function getAllowedAttributes($classOrObject, array $context, $attributesAsString = false)
{
$allowExtraAttributes = $context[self::ALLOW_EXTRA_ATTRIBUTES] ?? $this->defaultContext[self::ALLOW_EXTRA_ATTRIBUTES];
if (!$this->classMetadataFactory) {
if (!$allowExtraAttributes) {
throw new LogicException(sprintf('A class metadata factory must be provided in the constructor when setting "%s" to false.', self::ALLOW_EXTRA_ATTRIBUTES));
}
return false;
}
$tmpGroups = $context[self::GROUPS] ?? $this->defaultContext[self::GROUPS] ?? null;
$groups = (\is_array($tmpGroups) || is_scalar($tmpGroups)) ? (array) $tmpGroups : false;
if (false === $groups && $allowExtraAttributes) {
return false;
}
$allowedAttributes = [];
foreach ($this->classMetadataFactory->getMetadataFor($classOrObject)->getAttributesMetadata() as $attributeMetadata) {
$name = $attributeMetadata->getName();
if (
(false === $groups || array_intersect($attributeMetadata->getGroups(), $groups)) &&
$this->isAllowedAttribute($classOrObject, $name, null, $context)
) {
$allowedAttributes[] = $attributesAsString ? $name : $attributeMetadata;
}
}
return $allowedAttributes;
} | [
"protected",
"function",
"getAllowedAttributes",
"(",
"$",
"classOrObject",
",",
"array",
"$",
"context",
",",
"$",
"attributesAsString",
"=",
"false",
")",
"{",
"$",
"allowExtraAttributes",
"=",
"$",
"context",
"[",
"self",
"::",
"ALLOW_EXTRA_ATTRIBUTES",
"]",
... | Gets attributes to normalize using groups.
@param string|object $classOrObject
@param array $context
@param bool $attributesAsString If false, return an array of {@link AttributeMetadataInterface}
@throws LogicException if the 'allow_extra_attributes' context variable is false and no class metadata factory is provided
@return string[]|AttributeMetadataInterface[]|bool | [
"Gets",
"attributes",
"to",
"normalize",
"using",
"groups",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php#L346-L376 | train | Get all the allowed attributes for the given class or object | [
30522,
5123,
3853,
2131,
8095,
15096,
19321,
3089,
8569,
4570,
1006,
1002,
2465,
14604,
2497,
20614,
1010,
9140,
1002,
6123,
1010,
1002,
12332,
12054,
18886,
3070,
1027,
6270,
1007,
1063,
1002,
3499,
10288,
6494,
19321,
3089,
8569,
4570,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/cms/classes/Router.php | Router.getCachedUrlFileName | protected function getCachedUrlFileName($url, &$urlList)
{
$key = $this->getUrlListCacheKey();
$urlList = Cache::get($key, false);
if ($urlList
&& ($urlList = @unserialize(@base64_decode($urlList)))
&& is_array($urlList)
&& array_key_exists($url, $urlList)
) {
return $urlList[$url];
}
return null;
} | php | protected function getCachedUrlFileName($url, &$urlList)
{
$key = $this->getUrlListCacheKey();
$urlList = Cache::get($key, false);
if ($urlList
&& ($urlList = @unserialize(@base64_decode($urlList)))
&& is_array($urlList)
&& array_key_exists($url, $urlList)
) {
return $urlList[$url];
}
return null;
} | [
"protected",
"function",
"getCachedUrlFileName",
"(",
"$",
"url",
",",
"&",
"$",
"urlList",
")",
"{",
"$",
"key",
"=",
"$",
"this",
"->",
"getUrlListCacheKey",
"(",
")",
";",
"$",
"urlList",
"=",
"Cache",
"::",
"get",
"(",
"$",
"key",
",",
"false",
"... | Tries to load a page file name corresponding to a specified URL from the cache.
@param string $url Specifies the requested URL.
@param array &$urlList The URL list loaded from the cache
@return mixed Returns the page file name if the URL exists in the cache. Otherwise returns null. | [
"Tries",
"to",
"load",
"a",
"page",
"file",
"name",
"corresponding",
"to",
"a",
"specified",
"URL",
"from",
"the",
"cache",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/Router.php#L339-L353 | train | Get cached url file name | [
30522,
5123,
3853,
2131,
3540,
7690,
3126,
10270,
9463,
18442,
1006,
1002,
24471,
2140,
1010,
1004,
1002,
24471,
21711,
2102,
1007,
1063,
1002,
3145,
1027,
1002,
2023,
1011,
1028,
2131,
3126,
21711,
13535,
15395,
14839,
1006,
1007,
1025,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
z-song/laravel-admin | src/Controllers/UserController.php | UserController.form | public function form()
{
$userModel = config('admin.database.users_model');
$permissionModel = config('admin.database.permissions_model');
$roleModel = config('admin.database.roles_model');
$form = new Form(new $userModel());
$form->display('id', 'ID');
if (request()->isMethod('POST')) {
$userTable = config('admin.database.users_table');
$userNameRules = "required|unique:{$userTable}";
} else {
$userNameRules = 'required';
}
$form->text('username', trans('admin.username'))->rules($userNameRules);
$form->text('name', trans('admin.name'))->rules('required');
$form->image('avatar', trans('admin.avatar'));
$form->password('password', trans('admin.password'))->rules('required|confirmed');
$form->password('password_confirmation', trans('admin.password_confirmation'))->rules('required')
->default(function ($form) {
return $form->model()->password;
});
$form->ignore(['password_confirmation']);
$form->multipleSelect('roles', trans('admin.roles'))->options($roleModel::all()->pluck('name', 'id'));
$form->multipleSelect('permissions', trans('admin.permissions'))->options($permissionModel::all()->pluck('name', 'id'));
$form->display('created_at', trans('admin.created_at'));
$form->display('updated_at', trans('admin.updated_at'));
$form->saving(function (Form $form) {
if ($form->password && $form->model()->password != $form->password) {
$form->password = bcrypt($form->password);
}
});
return $form;
} | php | public function form()
{
$userModel = config('admin.database.users_model');
$permissionModel = config('admin.database.permissions_model');
$roleModel = config('admin.database.roles_model');
$form = new Form(new $userModel());
$form->display('id', 'ID');
if (request()->isMethod('POST')) {
$userTable = config('admin.database.users_table');
$userNameRules = "required|unique:{$userTable}";
} else {
$userNameRules = 'required';
}
$form->text('username', trans('admin.username'))->rules($userNameRules);
$form->text('name', trans('admin.name'))->rules('required');
$form->image('avatar', trans('admin.avatar'));
$form->password('password', trans('admin.password'))->rules('required|confirmed');
$form->password('password_confirmation', trans('admin.password_confirmation'))->rules('required')
->default(function ($form) {
return $form->model()->password;
});
$form->ignore(['password_confirmation']);
$form->multipleSelect('roles', trans('admin.roles'))->options($roleModel::all()->pluck('name', 'id'));
$form->multipleSelect('permissions', trans('admin.permissions'))->options($permissionModel::all()->pluck('name', 'id'));
$form->display('created_at', trans('admin.created_at'));
$form->display('updated_at', trans('admin.updated_at'));
$form->saving(function (Form $form) {
if ($form->password && $form->model()->password != $form->password) {
$form->password = bcrypt($form->password);
}
});
return $form;
} | [
"public",
"function",
"form",
"(",
")",
"{",
"$",
"userModel",
"=",
"config",
"(",
"'admin.database.users_model'",
")",
";",
"$",
"permissionModel",
"=",
"config",
"(",
"'admin.database.permissions_model'",
")",
";",
"$",
"roleModel",
"=",
"config",
"(",
"'admin... | Make a form builder.
@return Form | [
"Make",
"a",
"form",
"builder",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Controllers/UserController.php#L138-L179 | train | Form for user administration | [
30522,
2270,
3853,
2433,
1006,
1007,
1063,
1002,
5310,
5302,
9247,
1027,
9530,
8873,
2290,
1006,
1005,
4748,
10020,
1012,
7809,
1012,
5198,
1035,
2944,
1005,
1007,
1025,
1002,
6656,
5302,
9247,
1027,
9530,
8873,
2290,
1006,
1005,
4748,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
dompdf/dompdf | src/Css/Style.php | Style.set_outline | function set_outline($val)
{
$important = isset($this->_important_props["outline"]);
$props = array(
"outline_style",
"outline_width",
"outline_color",
);
foreach ($props as $prop) {
$_val = self::$_defaults[$prop];
if (!isset($this->_important_props[$prop]) || $important) {
//see __set and __get, on all assignments clear cache!
$this->_prop_cache[$prop] = null;
if ($important) {
$this->_important_props[$prop] = true;
}
$this->_props[$prop] = $_val;
}
}
$val = preg_replace("/\s*\,\s*/", ",", $val); // when rgb() has spaces
$arr = explode(" ", $val);
foreach ($arr as $value) {
$value = trim($value);
if (in_array($value, self::$BORDER_STYLES)) {
$this->set_outline_style($value);
} else if (preg_match("/[.0-9]+(?:px|pt|pc|em|ex|%|in|mm|cm)|(?:thin|medium|thick)/", $value)) {
$this->set_outline_width($value);
} else {
// must be color
$this->set_outline_color($value);
}
}
//see __set and __get, on all assignments clear cache, not needed on direct set through __set
$this->_prop_cache["outline"] = null;
$this->_props["outline"] = $val;
} | php | function set_outline($val)
{
$important = isset($this->_important_props["outline"]);
$props = array(
"outline_style",
"outline_width",
"outline_color",
);
foreach ($props as $prop) {
$_val = self::$_defaults[$prop];
if (!isset($this->_important_props[$prop]) || $important) {
//see __set and __get, on all assignments clear cache!
$this->_prop_cache[$prop] = null;
if ($important) {
$this->_important_props[$prop] = true;
}
$this->_props[$prop] = $_val;
}
}
$val = preg_replace("/\s*\,\s*/", ",", $val); // when rgb() has spaces
$arr = explode(" ", $val);
foreach ($arr as $value) {
$value = trim($value);
if (in_array($value, self::$BORDER_STYLES)) {
$this->set_outline_style($value);
} else if (preg_match("/[.0-9]+(?:px|pt|pc|em|ex|%|in|mm|cm)|(?:thin|medium|thick)/", $value)) {
$this->set_outline_width($value);
} else {
// must be color
$this->set_outline_color($value);
}
}
//see __set and __get, on all assignments clear cache, not needed on direct set through __set
$this->_prop_cache["outline"] = null;
$this->_props["outline"] = $val;
} | [
"function",
"set_outline",
"(",
"$",
"val",
")",
"{",
"$",
"important",
"=",
"isset",
"(",
"$",
"this",
"->",
"_important_props",
"[",
"\"outline\"",
"]",
")",
";",
"$",
"props",
"=",
"array",
"(",
"\"outline_style\"",
",",
"\"outline_width\"",
",",
"\"out... | Sets the outline styles
@link http://www.w3.org/TR/CSS21/ui.html#dynamic-outlines
@param string $val | [
"Sets",
"the",
"outline",
"styles"
] | 75f13c700009be21a1965dc2c5b68a8708c22ba2 | https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/src/Css/Style.php#L2411-L2452 | train | set the outline of the page | [
30522,
3853,
2275,
1035,
12685,
1006,
1002,
11748,
1007,
1063,
1002,
2590,
1027,
26354,
3388,
1006,
1002,
2023,
1011,
1028,
1035,
2590,
1035,
24387,
1031,
1000,
12685,
1000,
1033,
1007,
1025,
1002,
24387,
1027,
9140,
1006,
1000,
12685,
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... |
slimphp/Slim | Slim/App.php | App.redirect | public function redirect($from, $to, $status = 302)
{
$handler = function ($request, ResponseInterface $response) use ($to, $status) {
return $response->withHeader('Location', (string)$to)->withStatus($status);
};
return $this->get($from, $handler);
} | php | public function redirect($from, $to, $status = 302)
{
$handler = function ($request, ResponseInterface $response) use ($to, $status) {
return $response->withHeader('Location', (string)$to)->withStatus($status);
};
return $this->get($from, $handler);
} | [
"public",
"function",
"redirect",
"(",
"$",
"from",
",",
"$",
"to",
",",
"$",
"status",
"=",
"302",
")",
"{",
"$",
"handler",
"=",
"function",
"(",
"$",
"request",
",",
"ResponseInterface",
"$",
"response",
")",
"use",
"(",
"$",
"to",
",",
"$",
"st... | Add a route that sends an HTTP redirect
@param string $from
@param string|UriInterface $to
@param int $status
@return RouteInterface | [
"Add",
"a",
"route",
"that",
"sends",
"an",
"HTTP",
"redirect"
] | ccef5f7d8bcd469d59cbe64f6210d83764f91543 | https://github.com/slimphp/Slim/blob/ccef5f7d8bcd469d59cbe64f6210d83764f91543/Slim/App.php#L243-L250 | train | Redirect to another location | [
30522,
2270,
3853,
2417,
7442,
6593,
1006,
1002,
2013,
1010,
1002,
2000,
30524,
1063,
2709,
1002,
3433,
1011,
1028,
2007,
4974,
2121,
1006,
1005,
3295,
1005,
1010,
1006,
5164,
1007,
1002,
2000,
1007,
1011,
1028,
2007,
9153,
5809,
1006,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
z-song/laravel-admin | src/Grid.php | Grid.handleExportRequest | protected function handleExportRequest($forceExport = false)
{
if (!$scope = request(Exporter::$queryName)) {
return;
}
// clear output buffer.
if (ob_get_length()) {
ob_end_clean();
}
$this->model()->usePaginate(false);
if ($this->builder) {
call_user_func($this->builder, $this);
$this->getExporter($scope)->export();
}
if ($forceExport) {
$this->getExporter($scope)->export();
}
} | php | protected function handleExportRequest($forceExport = false)
{
if (!$scope = request(Exporter::$queryName)) {
return;
}
// clear output buffer.
if (ob_get_length()) {
ob_end_clean();
}
$this->model()->usePaginate(false);
if ($this->builder) {
call_user_func($this->builder, $this);
$this->getExporter($scope)->export();
}
if ($forceExport) {
$this->getExporter($scope)->export();
}
} | [
"protected",
"function",
"handleExportRequest",
"(",
"$",
"forceExport",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"$",
"scope",
"=",
"request",
"(",
"Exporter",
"::",
"$",
"queryName",
")",
")",
"{",
"return",
";",
"}",
"// clear output buffer.",
"if",
"(",... | Handle export request.
@param bool $forceExport | [
"Handle",
"export",
"request",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid.php#L225-L247 | train | Handle export request | [
30522,
5123,
3853,
5047,
10288,
6442,
2890,
15500,
1006,
1002,
2486,
10288,
6442,
1027,
30524,
1024,
1024,
1002,
23032,
18442,
1007,
1007,
1063,
2709,
1025,
1065,
1013,
1013,
3154,
6434,
17698,
1012,
2065,
1006,
27885,
1035,
2131,
1035,
309... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Bridge/Doctrine/DependencyInjection/AbstractDoctrineExtension.php | AbstractDoctrineExtension.loadCacheDriver | protected function loadCacheDriver($cacheName, $objectManagerName, array $cacheDriver, ContainerBuilder $container)
{
$cacheDriverServiceId = $this->getObjectManagerElementName($objectManagerName.'_'.$cacheName);
switch ($cacheDriver['type']) {
case 'service':
$container->setAlias($cacheDriverServiceId, new Alias($cacheDriver['id'], false));
return $cacheDriverServiceId;
case 'memcached':
$memcachedClass = !empty($cacheDriver['class']) ? $cacheDriver['class'] : '%'.$this->getObjectManagerElementName('cache.memcached.class').'%';
$memcachedInstanceClass = !empty($cacheDriver['instance_class']) ? $cacheDriver['instance_class'] : '%'.$this->getObjectManagerElementName('cache.memcached_instance.class').'%';
$memcachedHost = !empty($cacheDriver['host']) ? $cacheDriver['host'] : '%'.$this->getObjectManagerElementName('cache.memcached_host').'%';
$memcachedPort = !empty($cacheDriver['port']) ? $cacheDriver['port'] : '%'.$this->getObjectManagerElementName('cache.memcached_port').'%';
$cacheDef = new Definition($memcachedClass);
$memcachedInstance = new Definition($memcachedInstanceClass);
$memcachedInstance->setPrivate(true);
$memcachedInstance->addMethodCall('addServer', [
$memcachedHost, $memcachedPort,
]);
$container->setDefinition($this->getObjectManagerElementName(sprintf('%s_memcached_instance', $objectManagerName)), $memcachedInstance);
$cacheDef->addMethodCall('setMemcached', [new Reference($this->getObjectManagerElementName(sprintf('%s_memcached_instance', $objectManagerName)))]);
break;
case 'redis':
$redisClass = !empty($cacheDriver['class']) ? $cacheDriver['class'] : '%'.$this->getObjectManagerElementName('cache.redis.class').'%';
$redisInstanceClass = !empty($cacheDriver['instance_class']) ? $cacheDriver['instance_class'] : '%'.$this->getObjectManagerElementName('cache.redis_instance.class').'%';
$redisHost = !empty($cacheDriver['host']) ? $cacheDriver['host'] : '%'.$this->getObjectManagerElementName('cache.redis_host').'%';
$redisPort = !empty($cacheDriver['port']) ? $cacheDriver['port'] : '%'.$this->getObjectManagerElementName('cache.redis_port').'%';
$cacheDef = new Definition($redisClass);
$redisInstance = new Definition($redisInstanceClass);
$redisInstance->setPrivate(true);
$redisInstance->addMethodCall('connect', [
$redisHost, $redisPort,
]);
$container->setDefinition($this->getObjectManagerElementName(sprintf('%s_redis_instance', $objectManagerName)), $redisInstance);
$cacheDef->addMethodCall('setRedis', [new Reference($this->getObjectManagerElementName(sprintf('%s_redis_instance', $objectManagerName)))]);
break;
case 'apc':
case 'apcu':
case 'array':
case 'xcache':
case 'wincache':
case 'zenddata':
$cacheDef = new Definition('%'.$this->getObjectManagerElementName(sprintf('cache.%s.class', $cacheDriver['type'])).'%');
break;
default:
throw new \InvalidArgumentException(sprintf('"%s" is an unrecognized Doctrine cache driver.', $cacheDriver['type']));
}
$cacheDef->setPublic(false);
if (!isset($cacheDriver['namespace'])) {
// generate a unique namespace for the given application
if ($container->hasParameter('cache.prefix.seed')) {
$seed = '.'.$container->getParameterBag()->resolveValue($container->getParameter('cache.prefix.seed'));
} else {
$seed = '_'.$container->getParameter('kernel.project_dir');
}
$seed .= '.'.$container->getParameter('kernel.container_class');
$namespace = 'sf_'.$this->getMappingResourceExtension().'_'.$objectManagerName.'_'.ContainerBuilder::hash($seed);
$cacheDriver['namespace'] = $namespace;
}
$cacheDef->addMethodCall('setNamespace', [$cacheDriver['namespace']]);
$container->setDefinition($cacheDriverServiceId, $cacheDef);
return $cacheDriverServiceId;
} | php | protected function loadCacheDriver($cacheName, $objectManagerName, array $cacheDriver, ContainerBuilder $container)
{
$cacheDriverServiceId = $this->getObjectManagerElementName($objectManagerName.'_'.$cacheName);
switch ($cacheDriver['type']) {
case 'service':
$container->setAlias($cacheDriverServiceId, new Alias($cacheDriver['id'], false));
return $cacheDriverServiceId;
case 'memcached':
$memcachedClass = !empty($cacheDriver['class']) ? $cacheDriver['class'] : '%'.$this->getObjectManagerElementName('cache.memcached.class').'%';
$memcachedInstanceClass = !empty($cacheDriver['instance_class']) ? $cacheDriver['instance_class'] : '%'.$this->getObjectManagerElementName('cache.memcached_instance.class').'%';
$memcachedHost = !empty($cacheDriver['host']) ? $cacheDriver['host'] : '%'.$this->getObjectManagerElementName('cache.memcached_host').'%';
$memcachedPort = !empty($cacheDriver['port']) ? $cacheDriver['port'] : '%'.$this->getObjectManagerElementName('cache.memcached_port').'%';
$cacheDef = new Definition($memcachedClass);
$memcachedInstance = new Definition($memcachedInstanceClass);
$memcachedInstance->setPrivate(true);
$memcachedInstance->addMethodCall('addServer', [
$memcachedHost, $memcachedPort,
]);
$container->setDefinition($this->getObjectManagerElementName(sprintf('%s_memcached_instance', $objectManagerName)), $memcachedInstance);
$cacheDef->addMethodCall('setMemcached', [new Reference($this->getObjectManagerElementName(sprintf('%s_memcached_instance', $objectManagerName)))]);
break;
case 'redis':
$redisClass = !empty($cacheDriver['class']) ? $cacheDriver['class'] : '%'.$this->getObjectManagerElementName('cache.redis.class').'%';
$redisInstanceClass = !empty($cacheDriver['instance_class']) ? $cacheDriver['instance_class'] : '%'.$this->getObjectManagerElementName('cache.redis_instance.class').'%';
$redisHost = !empty($cacheDriver['host']) ? $cacheDriver['host'] : '%'.$this->getObjectManagerElementName('cache.redis_host').'%';
$redisPort = !empty($cacheDriver['port']) ? $cacheDriver['port'] : '%'.$this->getObjectManagerElementName('cache.redis_port').'%';
$cacheDef = new Definition($redisClass);
$redisInstance = new Definition($redisInstanceClass);
$redisInstance->setPrivate(true);
$redisInstance->addMethodCall('connect', [
$redisHost, $redisPort,
]);
$container->setDefinition($this->getObjectManagerElementName(sprintf('%s_redis_instance', $objectManagerName)), $redisInstance);
$cacheDef->addMethodCall('setRedis', [new Reference($this->getObjectManagerElementName(sprintf('%s_redis_instance', $objectManagerName)))]);
break;
case 'apc':
case 'apcu':
case 'array':
case 'xcache':
case 'wincache':
case 'zenddata':
$cacheDef = new Definition('%'.$this->getObjectManagerElementName(sprintf('cache.%s.class', $cacheDriver['type'])).'%');
break;
default:
throw new \InvalidArgumentException(sprintf('"%s" is an unrecognized Doctrine cache driver.', $cacheDriver['type']));
}
$cacheDef->setPublic(false);
if (!isset($cacheDriver['namespace'])) {
// generate a unique namespace for the given application
if ($container->hasParameter('cache.prefix.seed')) {
$seed = '.'.$container->getParameterBag()->resolveValue($container->getParameter('cache.prefix.seed'));
} else {
$seed = '_'.$container->getParameter('kernel.project_dir');
}
$seed .= '.'.$container->getParameter('kernel.container_class');
$namespace = 'sf_'.$this->getMappingResourceExtension().'_'.$objectManagerName.'_'.ContainerBuilder::hash($seed);
$cacheDriver['namespace'] = $namespace;
}
$cacheDef->addMethodCall('setNamespace', [$cacheDriver['namespace']]);
$container->setDefinition($cacheDriverServiceId, $cacheDef);
return $cacheDriverServiceId;
} | [
"protected",
"function",
"loadCacheDriver",
"(",
"$",
"cacheName",
",",
"$",
"objectManagerName",
",",
"array",
"$",
"cacheDriver",
",",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"cacheDriverServiceId",
"=",
"$",
"this",
"->",
"getObjectManagerElementName... | Loads a cache driver.
@param string $cacheName The cache driver name
@param string $objectManagerName The object manager name
@param array $cacheDriver The cache driver mapping
@param ContainerBuilder $container The ContainerBuilder instance
@return string
@throws \InvalidArgumentException | [
"Loads",
"a",
"cache",
"driver",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bridge/Doctrine/DependencyInjection/AbstractDoctrineExtension.php#L312-L381 | train | Loads the cache driver | [
30522,
5123,
3853,
7170,
3540,
7690,
24352,
1006,
1002,
17053,
18442,
1010,
1002,
4874,
24805,
4590,
18442,
1010,
9140,
1002,
17053,
23663,
2099,
1010,
11661,
8569,
23891,
2099,
1002,
11661,
1007,
1063,
1002,
17053,
23663,
22573,
2099,
7903,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/Common.php | Common.sanitizeInputValues | public static function sanitizeInputValues($value, $alreadyStripslashed = false)
{
if (is_numeric($value)) {
return $value;
} elseif (is_string($value)) {
$value = self::sanitizeString($value);
} elseif (is_array($value)) {
foreach (array_keys($value) as $key) {
$newKey = $key;
$newKey = self::sanitizeInputValues($newKey, $alreadyStripslashed);
if ($key != $newKey) {
$value[$newKey] = $value[$key];
unset($value[$key]);
}
$value[$newKey] = self::sanitizeInputValues($value[$newKey], $alreadyStripslashed);
}
} elseif (!is_null($value)
&& !is_bool($value)
) {
throw new Exception("The value to escape has not a supported type. Value = " . var_export($value, true));
}
return $value;
} | php | public static function sanitizeInputValues($value, $alreadyStripslashed = false)
{
if (is_numeric($value)) {
return $value;
} elseif (is_string($value)) {
$value = self::sanitizeString($value);
} elseif (is_array($value)) {
foreach (array_keys($value) as $key) {
$newKey = $key;
$newKey = self::sanitizeInputValues($newKey, $alreadyStripslashed);
if ($key != $newKey) {
$value[$newKey] = $value[$key];
unset($value[$key]);
}
$value[$newKey] = self::sanitizeInputValues($value[$newKey], $alreadyStripslashed);
}
} elseif (!is_null($value)
&& !is_bool($value)
) {
throw new Exception("The value to escape has not a supported type. Value = " . var_export($value, true));
}
return $value;
} | [
"public",
"static",
"function",
"sanitizeInputValues",
"(",
"$",
"value",
",",
"$",
"alreadyStripslashed",
"=",
"false",
")",
"{",
"if",
"(",
"is_numeric",
"(",
"$",
"value",
")",
")",
"{",
"return",
"$",
"value",
";",
"}",
"elseif",
"(",
"is_string",
"(... | Sanitizes a string to help avoid XSS vulnerabilities.
This function is automatically called when {@link getRequestVar()} is called,
so you should not normally have to use it.
This function should be used when outputting data that isn't escaped and was
obtained from the user (for example when using the `|raw` twig filter on goal names).
_NOTE: Sanitized input should not be used directly in an SQL query; SQL placeholders
should still be used._
**Implementation Details**
- [htmlspecialchars](http://php.net/manual/en/function.htmlspecialchars.php) is used to escape text.
- Single quotes are not escaped so **Piwik's amazing community** will still be
**Piwik's amazing community**.
- Use of the `magic_quotes` setting will not break this method.
- Boolean, numeric and null values are not modified.
@param mixed $value The variable to be sanitized. If an array is supplied, the contents
of the array will be sanitized recursively. The keys of the array
will also be sanitized.
@param bool $alreadyStripslashed Implementation detail, ignore.
@throws Exception If `$value` is of an incorrect type.
@return mixed The sanitized value.
@api | [
"Sanitizes",
"a",
"string",
"to",
"help",
"avoid",
"XSS",
"vulnerabilities",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Common.php#L322-L345 | train | Sanitize input values | [
30522,
2270,
10763,
3853,
2624,
25090,
4371,
2378,
18780,
10175,
15808,
1006,
1002,
3643,
1010,
1002,
2525,
3367,
29443,
14540,
11823,
2098,
1027,
6270,
1007,
1063,
2065,
1006,
2003,
1035,
16371,
25531,
1006,
1002,
3643,
1007,
1007,
1063,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getgrav/grav | system/src/Grav/Console/Gpm/IndexCommand.php | IndexCommand.installed | private function installed($package)
{
$package = $list[$package->slug] ?? $package;
$type = ucfirst(preg_replace('/s$/', '', $package->package_type));
$method = 'is' . $type . 'Installed';
$installed = $this->gpm->{$method}($package->slug);
return !$installed ? '<magenta>not installed</magenta>' : '<cyan>installed</cyan>';
} | php | private function installed($package)
{
$package = $list[$package->slug] ?? $package;
$type = ucfirst(preg_replace('/s$/', '', $package->package_type));
$method = 'is' . $type . 'Installed';
$installed = $this->gpm->{$method}($package->slug);
return !$installed ? '<magenta>not installed</magenta>' : '<cyan>installed</cyan>';
} | [
"private",
"function",
"installed",
"(",
"$",
"package",
")",
"{",
"$",
"package",
"=",
"$",
"list",
"[",
"$",
"package",
"->",
"slug",
"]",
"??",
"$",
"package",
";",
"$",
"type",
"=",
"ucfirst",
"(",
"preg_replace",
"(",
"'/s$/'",
",",
"''",
",",
... | @param Package $package
@return string | [
"@param",
"Package",
"$package"
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Console/Gpm/IndexCommand.php#L180-L188 | train | Check if package is installed | [
30522,
2797,
3853,
5361,
1006,
1002,
7427,
1007,
1063,
1002,
7427,
1027,
1002,
2862,
1031,
1002,
7427,
1011,
1028,
23667,
1033,
1029,
1029,
1002,
7427,
1025,
1002,
2828,
1027,
15384,
8873,
12096,
1006,
3653,
2290,
1035,
5672,
1006,
1005,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
z-song/laravel-admin | src/Console/MakeCommand.php | MakeCommand.replaceClass | protected function replaceClass($stub, $name)
{
$stub = parent::replaceClass($stub, $name);
return str_replace(
[
'DummyModelNamespace',
'DummyModel',
'DummyGrid',
'DummyShow',
'DummyForm',
],
[
$this->option('model'),
class_basename($this->option('model')),
$this->indentCodes($this->generator->generateGrid()),
$this->indentCodes($this->generator->generateShow()),
$this->indentCodes($this->generator->generateForm()),
],
$stub
);
} | php | protected function replaceClass($stub, $name)
{
$stub = parent::replaceClass($stub, $name);
return str_replace(
[
'DummyModelNamespace',
'DummyModel',
'DummyGrid',
'DummyShow',
'DummyForm',
],
[
$this->option('model'),
class_basename($this->option('model')),
$this->indentCodes($this->generator->generateGrid()),
$this->indentCodes($this->generator->generateShow()),
$this->indentCodes($this->generator->generateForm()),
],
$stub
);
} | [
"protected",
"function",
"replaceClass",
"(",
"$",
"stub",
",",
"$",
"name",
")",
"{",
"$",
"stub",
"=",
"parent",
"::",
"replaceClass",
"(",
"$",
"stub",
",",
"$",
"name",
")",
";",
"return",
"str_replace",
"(",
"[",
"'DummyModelNamespace'",
",",
"'Dumm... | Replace the class name for the given stub.
@param string $stub
@param string $name
@return string | [
"Replace",
"the",
"class",
"name",
"for",
"the",
"given",
"stub",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Console/MakeCommand.php#L100-L121 | train | Replace the class with the new name | [
30522,
5123,
3853,
5672,
26266,
1006,
1002,
24646,
2497,
1010,
1002,
2171,
1007,
1063,
1002,
24646,
2497,
1027,
6687,
1024,
1024,
5672,
26266,
1006,
1002,
24646,
2497,
1010,
1002,
2171,
1007,
1025,
2709,
2358,
2099,
1035,
5672,
1006,
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... |
laravel/framework | src/Illuminate/Queue/Console/RetryCommand.php | RetryCommand.getJobIds | protected function getJobIds()
{
$ids = (array) $this->argument('id');
if (count($ids) === 1 && $ids[0] === 'all') {
$ids = Arr::pluck($this->laravel['queue.failer']->all(), 'id');
}
return $ids;
} | php | protected function getJobIds()
{
$ids = (array) $this->argument('id');
if (count($ids) === 1 && $ids[0] === 'all') {
$ids = Arr::pluck($this->laravel['queue.failer']->all(), 'id');
}
return $ids;
} | [
"protected",
"function",
"getJobIds",
"(",
")",
"{",
"$",
"ids",
"=",
"(",
"array",
")",
"$",
"this",
"->",
"argument",
"(",
"'id'",
")",
";",
"if",
"(",
"count",
"(",
"$",
"ids",
")",
"===",
"1",
"&&",
"$",
"ids",
"[",
"0",
"]",
"===",
"'all'"... | Get the job IDs to be retried.
@return array | [
"Get",
"the",
"job",
"IDs",
"to",
"be",
"retried",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Queue/Console/RetryCommand.php#L51-L60 | train | Get all job ids | [
30522,
5123,
3853,
2131,
5558,
17062,
2015,
1006,
1007,
1063,
1002,
8909,
2015,
1027,
1006,
9140,
1007,
1002,
2023,
1011,
1028,
6685,
1006,
1005,
8909,
1005,
1007,
1025,
2065,
1006,
4175,
1006,
1002,
8909,
2015,
1007,
1027,
1027,
1027,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/system/classes/MarkupManager.php | MarkupManager.makeTwigFunctions | public function makeTwigFunctions($functions = [])
{
if (!is_array($functions)) {
$functions = [];
}
foreach ($this->listFunctions() as $name => $callable) {
/*
* Handle a wildcard function
*/
if (strpos($name, '*') !== false && $this->isWildCallable($callable)) {
$callable = function ($name) use ($callable) {
$arguments = array_slice(func_get_args(), 1);
$method = $this->isWildCallable($callable, Str::camel($name));
return call_user_func_array($method, $arguments);
};
}
if (!is_callable($callable)) {
throw new ApplicationException(sprintf('The markup function for %s is not callable.', $name));
}
$functions[] = new Twig_SimpleFunction($name, $callable, ['is_safe' => ['html']]);
}
return $functions;
} | php | public function makeTwigFunctions($functions = [])
{
if (!is_array($functions)) {
$functions = [];
}
foreach ($this->listFunctions() as $name => $callable) {
/*
* Handle a wildcard function
*/
if (strpos($name, '*') !== false && $this->isWildCallable($callable)) {
$callable = function ($name) use ($callable) {
$arguments = array_slice(func_get_args(), 1);
$method = $this->isWildCallable($callable, Str::camel($name));
return call_user_func_array($method, $arguments);
};
}
if (!is_callable($callable)) {
throw new ApplicationException(sprintf('The markup function for %s is not callable.', $name));
}
$functions[] = new Twig_SimpleFunction($name, $callable, ['is_safe' => ['html']]);
}
return $functions;
} | [
"public",
"function",
"makeTwigFunctions",
"(",
"$",
"functions",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"functions",
")",
")",
"{",
"$",
"functions",
"=",
"[",
"]",
";",
"}",
"foreach",
"(",
"$",
"this",
"->",
"listFunctions"... | Makes a set of Twig functions for use in a twig extension.
@param array $functions Current collection
@return array | [
"Makes",
"a",
"set",
"of",
"Twig",
"functions",
"for",
"use",
"in",
"a",
"twig",
"extension",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/MarkupManager.php#L223-L250 | train | Make Twig functions | [
30522,
2270,
3853,
2191,
2102,
16279,
11263,
27989,
2015,
1006,
1002,
4972,
1027,
1031,
1033,
1007,
1063,
2065,
1006,
999,
2003,
1035,
9140,
1006,
1002,
4972,
1007,
1007,
1063,
1002,
4972,
1027,
1031,
1033,
1025,
1065,
18921,
6776,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/backend/widgets/Lists.php | Lists.validateModel | protected function validateModel()
{
if (!$this->model) {
throw new ApplicationException(Lang::get(
'backend::lang.list.missing_model',
['class'=>get_class($this->controller)]
));
}
if (!$this->model instanceof Model) {
throw new ApplicationException(Lang::get(
'backend::lang.model.invalid_class',
['model'=>get_class($this->model), 'class'=>get_class($this->controller)]
));
}
return $this->model;
} | php | protected function validateModel()
{
if (!$this->model) {
throw new ApplicationException(Lang::get(
'backend::lang.list.missing_model',
['class'=>get_class($this->controller)]
));
}
if (!$this->model instanceof Model) {
throw new ApplicationException(Lang::get(
'backend::lang.model.invalid_class',
['model'=>get_class($this->model), 'class'=>get_class($this->controller)]
));
}
return $this->model;
} | [
"protected",
"function",
"validateModel",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"model",
")",
"{",
"throw",
"new",
"ApplicationException",
"(",
"Lang",
"::",
"get",
"(",
"'backend::lang.list.missing_model'",
",",
"[",
"'class'",
"=>",
"get_class",
... | Validate the supplied form model.
@return void | [
"Validate",
"the",
"supplied",
"form",
"model",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/Lists.php#L313-L330 | train | Validate Model and return the model | [
30522,
5123,
3853,
9398,
3686,
5302,
9247,
1006,
1007,
1063,
2065,
1006,
999,
1002,
2023,
1011,
1028,
2944,
1007,
1063,
5466,
2047,
4646,
10288,
24422,
1006,
11374,
1024,
1024,
2131,
1006,
1005,
2067,
10497,
1024,
1024,
11374,
1012,
2862,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/AcceptHeader.php | AcceptHeader.filter | public function filter($pattern)
{
return new self(array_filter($this->items, function (AcceptHeaderItem $item) use ($pattern) {
return preg_match($pattern, $item->getValue());
}));
} | php | public function filter($pattern)
{
return new self(array_filter($this->items, function (AcceptHeaderItem $item) use ($pattern) {
return preg_match($pattern, $item->getValue());
}));
} | [
"public",
"function",
"filter",
"(",
"$",
"pattern",
")",
"{",
"return",
"new",
"self",
"(",
"array_filter",
"(",
"$",
"this",
"->",
"items",
",",
"function",
"(",
"AcceptHeaderItem",
"$",
"item",
")",
"use",
"(",
"$",
"pattern",
")",
"{",
"return",
"p... | Filters items on their value using given regex.
@param string $pattern
@return self | [
"Filters",
"items",
"on",
"their",
"value",
"using",
"given",
"regex",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpFoundation/AcceptHeader.php#L134-L139 | train | Filter accept header items by a regular expression | [
30522,
2270,
3853,
11307,
1006,
1002,
5418,
1007,
1063,
2709,
2047,
2969,
1006,
9140,
1035,
11307,
1006,
1002,
2023,
1011,
1028,
5167,
1010,
3853,
1006,
5138,
4974,
11124,
18532,
1002,
8875,
1007,
2224,
1006,
1002,
5418,
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/Mail/PendingMail.php | PendingMail.queue | public function queue(MailableContract $mailable)
{
$mailable = $this->fill($mailable);
if (isset($mailable->delay)) {
return $this->mailer->later($mailable->delay, $mailable);
}
return $this->mailer->queue($mailable);
} | php | public function queue(MailableContract $mailable)
{
$mailable = $this->fill($mailable);
if (isset($mailable->delay)) {
return $this->mailer->later($mailable->delay, $mailable);
}
return $this->mailer->queue($mailable);
} | [
"public",
"function",
"queue",
"(",
"MailableContract",
"$",
"mailable",
")",
"{",
"$",
"mailable",
"=",
"$",
"this",
"->",
"fill",
"(",
"$",
"mailable",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"mailable",
"->",
"delay",
")",
")",
"{",
"return",
"$",... | Push the given mailable onto the queue.
@param \Illuminate\Contracts\Mail\Mailable $mailable;
@return mixed | [
"Push",
"the",
"given",
"mailable",
"onto",
"the",
"queue",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Mail/PendingMail.php#L147-L156 | train | Queue a message to the queue. | [
30522,
2270,
3853,
24240,
1006,
5653,
3085,
8663,
6494,
6593,
1002,
5653,
3085,
1007,
1063,
1002,
5653,
3085,
1027,
1002,
2023,
1011,
1028,
6039,
1006,
1002,
5653,
3085,
1007,
1025,
2065,
1006,
26354,
3388,
1006,
1002,
5653,
3085,
1011,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/Zend/Cache/Core.php | Zend_Cache_Core._setOption | private function _setOption($name, $value)
{
if (!is_string($name) || !array_key_exists($name, $this->_options)) {
Zend_Cache::throwException("Incorrect option name : $name");
}
if ($name == 'lifetime' && empty($value)) {
$value = null;
}
$this->_options[$name] = $value;
} | php | private function _setOption($name, $value)
{
if (!is_string($name) || !array_key_exists($name, $this->_options)) {
Zend_Cache::throwException("Incorrect option name : $name");
}
if ($name == 'lifetime' && empty($value)) {
$value = null;
}
$this->_options[$name] = $value;
} | [
"private",
"function",
"_setOption",
"(",
"$",
"name",
",",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"name",
")",
"||",
"!",
"array_key_exists",
"(",
"$",
"name",
",",
"$",
"this",
"->",
"_options",
")",
")",
"{",
"Zend_Cache",
... | Set an option
@param string $name Name of the option
@param mixed $value Value of the option
@throws Zend_Cache_Exception
@return void | [
"Set",
"an",
"option"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Cache/Core.php#L260-L269 | train | Set option value | [
30522,
2797,
3853,
1035,
2275,
7361,
3508,
1006,
1002,
2171,
1010,
1002,
3643,
1007,
1063,
2065,
1006,
999,
2003,
1035,
5164,
1006,
1002,
2171,
1007,
1064,
1064,
999,
9140,
1035,
3145,
1035,
6526,
1006,
1002,
2171,
1010,
1002,
2023,
1011,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
slimphp/Slim | Slim/Route.php | Route.run | public function run(ServerRequestInterface $request, ResponseInterface $response)
{
// Finalise route now that we are about to run it
$this->finalize();
// Traverse middleware stack and fetch updated response
return $this->callMiddlewareStack($request, $response);
} | php | public function run(ServerRequestInterface $request, ResponseInterface $response)
{
// Finalise route now that we are about to run it
$this->finalize();
// Traverse middleware stack and fetch updated response
return $this->callMiddlewareStack($request, $response);
} | [
"public",
"function",
"run",
"(",
"ServerRequestInterface",
"$",
"request",
",",
"ResponseInterface",
"$",
"response",
")",
"{",
"// Finalise route now that we are about to run it",
"$",
"this",
"->",
"finalize",
"(",
")",
";",
"// Traverse middleware stack and fetch update... | {@inheritdoc} | [
"{"
] | ccef5f7d8bcd469d59cbe64f6210d83764f91543 | https://github.com/slimphp/Slim/blob/ccef5f7d8bcd469d59cbe64f6210d83764f91543/Slim/Route.php#L270-L277 | train | Run the route | [
30522,
2270,
3853,
2448,
1006,
8241,
2890,
15500,
18447,
2121,
12172,
1002,
5227,
1010,
3433,
18447,
2121,
12172,
1002,
3433,
1007,
1063,
1013,
1013,
2345,
5562,
2799,
2085,
2008,
2057,
2024,
2055,
2000,
2448,
2009,
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/Seeder.php | Seeder.call | public function call($class, $silent = false)
{
$classes = Arr::wrap($class);
foreach ($classes as $class) {
if ($silent === false && isset($this->command)) {
$this->command->getOutput()->writeln("<info>Seeding:</info> $class");
}
$this->resolve($class)->__invoke();
}
return $this;
} | php | public function call($class, $silent = false)
{
$classes = Arr::wrap($class);
foreach ($classes as $class) {
if ($silent === false && isset($this->command)) {
$this->command->getOutput()->writeln("<info>Seeding:</info> $class");
}
$this->resolve($class)->__invoke();
}
return $this;
} | [
"public",
"function",
"call",
"(",
"$",
"class",
",",
"$",
"silent",
"=",
"false",
")",
"{",
"$",
"classes",
"=",
"Arr",
"::",
"wrap",
"(",
"$",
"class",
")",
";",
"foreach",
"(",
"$",
"classes",
"as",
"$",
"class",
")",
"{",
"if",
"(",
"$",
"s... | Seed the given connection from the given path.
@param array|string $class
@param bool $silent
@return $this | [
"Seed",
"the",
"given",
"connection",
"from",
"the",
"given",
"path",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Seeder.php#L33-L46 | train | Call all seeders of a class | [
30522,
2270,
3853,
2655,
1006,
1002,
2465,
1010,
1002,
4333,
1027,
6270,
1007,
1063,
1002,
4280,
1027,
12098,
2099,
1024,
1024,
10236,
30524,
2065,
1006,
1002,
4333,
1027,
1027,
1027,
6270,
1004,
1004,
26354,
3388,
1006,
1002,
2023,
1011,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/Zend/Validate/File/Md5.php | Zend_Validate_File_Md5.isValid | public function isValid($value, $file = null)
{
// Is file readable ?
// require_once 'Zend/Loader.php';
if (!Zend_Loader::isReadable($value)) {
return $this->_throw($file, self::NOT_FOUND);
}
$hashes = array_unique(array_keys($this->_hash));
$filehash = hash_file('md5', $value);
if ($filehash === false) {
return $this->_throw($file, self::NOT_DETECTED);
}
foreach($hashes as $hash) {
if ($filehash === $hash) {
return true;
}
}
return $this->_throw($file, self::DOES_NOT_MATCH);
} | php | public function isValid($value, $file = null)
{
// Is file readable ?
// require_once 'Zend/Loader.php';
if (!Zend_Loader::isReadable($value)) {
return $this->_throw($file, self::NOT_FOUND);
}
$hashes = array_unique(array_keys($this->_hash));
$filehash = hash_file('md5', $value);
if ($filehash === false) {
return $this->_throw($file, self::NOT_DETECTED);
}
foreach($hashes as $hash) {
if ($filehash === $hash) {
return true;
}
}
return $this->_throw($file, self::DOES_NOT_MATCH);
} | [
"public",
"function",
"isValid",
"(",
"$",
"value",
",",
"$",
"file",
"=",
"null",
")",
"{",
"// Is file readable ?",
"// require_once 'Zend/Loader.php';",
"if",
"(",
"!",
"Zend_Loader",
"::",
"isReadable",
"(",
"$",
"value",
")",
")",
"{",
"return",
"$",
"t... | Defined by Zend_Validate_Interface
Returns true if and only if the given file confirms the set hash
@param string $value Filename to check for hash
@param array $file File data from Zend_File_Transfer
@return boolean | [
"Defined",
"by",
"Zend_Validate_Interface"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Validate/File/Md5.php#L161-L182 | train | Check if value is valid | [
30522,
2270,
3853,
2003,
10175,
3593,
1006,
1002,
3643,
1010,
1002,
5371,
1027,
19701,
1007,
1063,
1013,
1013,
2003,
5371,
3191,
3085,
1029,
1013,
1013,
5478,
1035,
2320,
1005,
16729,
2094,
1013,
7170,
2121,
1012,
25718,
1005,
1025,
2065,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
walkor/Workerman | Worker.php | Worker.saveMasterPid | protected static function saveMasterPid()
{
if (static::$_OS !== OS_TYPE_LINUX) {
return;
}
static::$_masterPid = posix_getpid();
if (false === file_put_contents(static::$pidFile, static::$_masterPid)) {
throw new Exception('can not save pid to ' . static::$pidFile);
}
} | php | protected static function saveMasterPid()
{
if (static::$_OS !== OS_TYPE_LINUX) {
return;
}
static::$_masterPid = posix_getpid();
if (false === file_put_contents(static::$pidFile, static::$_masterPid)) {
throw new Exception('can not save pid to ' . static::$pidFile);
}
} | [
"protected",
"static",
"function",
"saveMasterPid",
"(",
")",
"{",
"if",
"(",
"static",
"::",
"$",
"_OS",
"!==",
"OS_TYPE_LINUX",
")",
"{",
"return",
";",
"}",
"static",
"::",
"$",
"_masterPid",
"=",
"posix_getpid",
"(",
")",
";",
"if",
"(",
"false",
"... | Save pid.
@throws Exception | [
"Save",
"pid",
"."
] | 13649907f05014fcfffcfccaef01e63ad3339351 | https://github.com/walkor/Workerman/blob/13649907f05014fcfffcfccaef01e63ad3339351/Worker.php#L1211-L1221 | train | Save master pid to pid file | [
30522,
5123,
10763,
3853,
3828,
8706,
23267,
1006,
1007,
1063,
2065,
1006,
10763,
1024,
1024,
1002,
1035,
9808,
999,
1027,
1027,
9808,
1035,
2828,
1035,
11603,
1007,
1063,
2709,
1025,
1065,
10763,
1024,
1024,
1002,
1035,
3040,
23267,
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/DataTable/Renderer/Xml.php | Xml.renderTable | protected function renderTable($table, $returnOnlyDataTableXml = false, $prefixLines = '')
{
$array = $this->getArrayFromDataTable($table);
if ($table instanceof Map) {
$out = $this->renderDataTableMap($table, $array, $prefixLines);
if ($returnOnlyDataTableXml) {
return $out;
}
$out = "<results>\n$out</results>";
return $out;
}
// integer value of ZERO is a value we want to display
if ($array != 0 && empty($array)) {
if ($returnOnlyDataTableXml) {
throw new Exception("Illegal state, what xml shall we return?");
}
$out = "<result />";
return $out;
}
if ($table instanceof Simple) {
if (is_array($array)) {
$out = $this->renderDataTableSimple($array);
} else {
$out = $array;
}
if ($returnOnlyDataTableXml) {
return $out;
}
if (is_array($array)) {
$out = "<result>\n" . $out . "</result>";
} else {
$value = self::formatValueXml($out);
if ($value === '') {
$out = "<result />";
} else {
$out = "<result>" . $value . "</result>";
}
}
return $out;
}
if ($table instanceof DataTable) {
$out = $this->renderDataTable($array);
if ($returnOnlyDataTableXml) {
return $out;
}
$out = "<result>\n$out</result>";
return $out;
}
if (is_array($array)) {
$out = $this->renderArray($array, $prefixLines . "\t");
if ($returnOnlyDataTableXml) {
return $out;
}
return "<result>\n$out</result>";
}
} | php | protected function renderTable($table, $returnOnlyDataTableXml = false, $prefixLines = '')
{
$array = $this->getArrayFromDataTable($table);
if ($table instanceof Map) {
$out = $this->renderDataTableMap($table, $array, $prefixLines);
if ($returnOnlyDataTableXml) {
return $out;
}
$out = "<results>\n$out</results>";
return $out;
}
// integer value of ZERO is a value we want to display
if ($array != 0 && empty($array)) {
if ($returnOnlyDataTableXml) {
throw new Exception("Illegal state, what xml shall we return?");
}
$out = "<result />";
return $out;
}
if ($table instanceof Simple) {
if (is_array($array)) {
$out = $this->renderDataTableSimple($array);
} else {
$out = $array;
}
if ($returnOnlyDataTableXml) {
return $out;
}
if (is_array($array)) {
$out = "<result>\n" . $out . "</result>";
} else {
$value = self::formatValueXml($out);
if ($value === '') {
$out = "<result />";
} else {
$out = "<result>" . $value . "</result>";
}
}
return $out;
}
if ($table instanceof DataTable) {
$out = $this->renderDataTable($array);
if ($returnOnlyDataTableXml) {
return $out;
}
$out = "<result>\n$out</result>";
return $out;
}
if (is_array($array)) {
$out = $this->renderArray($array, $prefixLines . "\t");
if ($returnOnlyDataTableXml) {
return $out;
}
return "<result>\n$out</result>";
}
} | [
"protected",
"function",
"renderTable",
"(",
"$",
"table",
",",
"$",
"returnOnlyDataTableXml",
"=",
"false",
",",
"$",
"prefixLines",
"=",
"''",
")",
"{",
"$",
"array",
"=",
"$",
"this",
"->",
"getArrayFromDataTable",
"(",
"$",
"table",
")",
";",
"if",
"... | Computes the output for the given data table
@param DataTable|DataTable/Map $table
@param bool $returnOnlyDataTableXml
@param string $prefixLines
@return array|string
@throws Exception | [
"Computes",
"the",
"output",
"for",
"the",
"given",
"data",
"table"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/DataTable/Renderer/Xml.php#L67-L127 | train | Render the table | [
30522,
5123,
3853,
17552,
10880,
1006,
1002,
2795,
1010,
1002,
2709,
2239,
2135,
2850,
29336,
3085,
2595,
19968,
1027,
6270,
1010,
1002,
17576,
12735,
1027,
1005,
1005,
1007,
1063,
1002,
9140,
1027,
1002,
2023,
1011,
1028,
2131,
2906,
9447,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Auth/Database/HasPermissions.php | HasPermissions.allPermissions | public function allPermissions() : Collection
{
return $this->roles()->with('permissions')->get()->pluck('permissions')->flatten()->merge($this->permissions);
} | php | public function allPermissions() : Collection
{
return $this->roles()->with('permissions')->get()->pluck('permissions')->flatten()->merge($this->permissions);
} | [
"public",
"function",
"allPermissions",
"(",
")",
":",
"Collection",
"{",
"return",
"$",
"this",
"->",
"roles",
"(",
")",
"->",
"with",
"(",
"'permissions'",
")",
"->",
"get",
"(",
")",
"->",
"pluck",
"(",
"'permissions'",
")",
"->",
"flatten",
"(",
")... | Get all permissions of user.
@return mixed | [
"Get",
"all",
"permissions",
"of",
"user",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Auth/Database/HasPermissions.php#L14-L17 | train | Get all permissions of the user | [
30522,
2270,
3853,
2035,
4842,
25481,
2015,
1006,
1007,
1024,
3074,
1063,
2709,
1002,
2023,
1011,
1028,
4395,
1006,
1007,
1011,
1028,
2007,
1006,
1005,
6656,
2015,
1005,
1007,
1011,
1028,
2131,
1006,
1007,
1011,
1028,
20228,
12722,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Container/Container.php | Container.fireResolvingCallbacks | protected function fireResolvingCallbacks($abstract, $object)
{
$this->fireCallbackArray($object, $this->globalResolvingCallbacks);
$this->fireCallbackArray(
$object, $this->getCallbacksForType($abstract, $object, $this->resolvingCallbacks)
);
$this->fireAfterResolvingCallbacks($abstract, $object);
} | php | protected function fireResolvingCallbacks($abstract, $object)
{
$this->fireCallbackArray($object, $this->globalResolvingCallbacks);
$this->fireCallbackArray(
$object, $this->getCallbacksForType($abstract, $object, $this->resolvingCallbacks)
);
$this->fireAfterResolvingCallbacks($abstract, $object);
} | [
"protected",
"function",
"fireResolvingCallbacks",
"(",
"$",
"abstract",
",",
"$",
"object",
")",
"{",
"$",
"this",
"->",
"fireCallbackArray",
"(",
"$",
"object",
",",
"$",
"this",
"->",
"globalResolvingCallbacks",
")",
";",
"$",
"this",
"->",
"fireCallbackArr... | Fire all of the resolving callbacks.
@param string $abstract
@param mixed $object
@return void | [
"Fire",
"all",
"of",
"the",
"resolving",
"callbacks",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Container/Container.php#L1023-L1032 | train | Fires all resolving callbacks for an object | [
30522,
5123,
3853,
2543,
6072,
4747,
6455,
9289,
20850,
8684,
2015,
1006,
1002,
10061,
1010,
1002,
4874,
1007,
1063,
1002,
2023,
1011,
1028,
2543,
9289,
20850,
8684,
2906,
9447,
1006,
1002,
4874,
1010,
1002,
2023,
1011,
1028,
3795,
6072,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/system/controllers/Updates.php | Updates.onCheckForUpdates | public function onCheckForUpdates()
{
try {
$manager = UpdateManager::instance();
$result = $manager->requestUpdateList();
$result = $this->processUpdateLists($result);
$result = $this->processImportantUpdates($result);
$this->vars['core'] = array_get($result, 'core', false);
$this->vars['hasUpdates'] = array_get($result, 'hasUpdates', false);
$this->vars['hasImportantUpdates'] = array_get($result, 'hasImportantUpdates', false);
$this->vars['pluginList'] = array_get($result, 'plugins', []);
$this->vars['themeList'] = array_get($result, 'themes', []);
}
catch (Exception $ex) {
$this->handleError($ex);
}
return ['#updateContainer' => $this->makePartial('update_list')];
} | php | public function onCheckForUpdates()
{
try {
$manager = UpdateManager::instance();
$result = $manager->requestUpdateList();
$result = $this->processUpdateLists($result);
$result = $this->processImportantUpdates($result);
$this->vars['core'] = array_get($result, 'core', false);
$this->vars['hasUpdates'] = array_get($result, 'hasUpdates', false);
$this->vars['hasImportantUpdates'] = array_get($result, 'hasImportantUpdates', false);
$this->vars['pluginList'] = array_get($result, 'plugins', []);
$this->vars['themeList'] = array_get($result, 'themes', []);
}
catch (Exception $ex) {
$this->handleError($ex);
}
return ['#updateContainer' => $this->makePartial('update_list')];
} | [
"public",
"function",
"onCheckForUpdates",
"(",
")",
"{",
"try",
"{",
"$",
"manager",
"=",
"UpdateManager",
"::",
"instance",
"(",
")",
";",
"$",
"result",
"=",
"$",
"manager",
"->",
"requestUpdateList",
"(",
")",
";",
"$",
"result",
"=",
"$",
"this",
... | Contacts the update server for a list of necessary updates. | [
"Contacts",
"the",
"update",
"server",
"for",
"a",
"list",
"of",
"necessary",
"updates",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/controllers/Updates.php#L324-L344 | train | onCheckForUpdates Callback for update_list | [
30522,
2270,
3853,
2006,
5403,
3600,
29278,
6279,
27122,
1006,
1007,
1063,
3046,
1063,
1002,
3208,
1027,
10651,
24805,
4590,
1024,
1024,
6013,
1006,
1007,
1025,
1002,
2765,
1027,
1002,
3208,
1011,
1028,
5227,
6279,
13701,
9863,
1006,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Http/Request.php | Request.is | public function is(...$patterns)
{
$path = $this->decodedPath();
foreach ($patterns as $pattern) {
if (Str::is($pattern, $path)) {
return true;
}
}
return false;
} | php | public function is(...$patterns)
{
$path = $this->decodedPath();
foreach ($patterns as $pattern) {
if (Str::is($pattern, $path)) {
return true;
}
}
return false;
} | [
"public",
"function",
"is",
"(",
"...",
"$",
"patterns",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"decodedPath",
"(",
")",
";",
"foreach",
"(",
"$",
"patterns",
"as",
"$",
"pattern",
")",
"{",
"if",
"(",
"Str",
"::",
"is",
"(",
"$",
"patter... | Determine if the current request URI matches a pattern.
@param mixed ...$patterns
@return bool | [
"Determine",
"if",
"the",
"current",
"request",
"URI",
"matches",
"a",
"pattern",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Http/Request.php#L185-L196 | train | Checks if the path matches one of the patterns | [
30522,
2270,
3853,
2003,
1006,
1012,
1012,
1012,
1002,
7060,
1007,
1063,
1002,
4130,
1027,
1002,
2023,
1011,
1028,
21933,
5732,
15069,
1006,
1007,
1025,
18921,
6776,
1006,
1002,
7060,
2004,
1002,
5418,
1007,
1063,
2065,
1006,
2358,
2099,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/Login/Controller.php | Controller.resetPassword | function resetPassword()
{
$infoMessage = null;
$formErrors = null;
$form = new FormResetPassword();
if ($form->validate()) {
$nonce = $form->getSubmitValue('form_nonce');
if (Nonce::verifyNonce('Login.login', $nonce)) {
$formErrors = $this->resetPasswordFirstStep($form);
if (empty($formErrors)) {
$infoMessage = Piwik::translate('Login_ConfirmationLinkSent');
}
} else {
$formErrors = array($this->getMessageExceptionNoAccess());
}
} else {
// if invalid, display error
$formData = $form->getFormData();
$formErrors = $formData['errors'];
}
$view = new View('@Login/resetPassword');
$view->infoMessage = $infoMessage;
$view->formErrors = $formErrors;
return $view->render();
} | php | function resetPassword()
{
$infoMessage = null;
$formErrors = null;
$form = new FormResetPassword();
if ($form->validate()) {
$nonce = $form->getSubmitValue('form_nonce');
if (Nonce::verifyNonce('Login.login', $nonce)) {
$formErrors = $this->resetPasswordFirstStep($form);
if (empty($formErrors)) {
$infoMessage = Piwik::translate('Login_ConfirmationLinkSent');
}
} else {
$formErrors = array($this->getMessageExceptionNoAccess());
}
} else {
// if invalid, display error
$formData = $form->getFormData();
$formErrors = $formData['errors'];
}
$view = new View('@Login/resetPassword');
$view->infoMessage = $infoMessage;
$view->formErrors = $formErrors;
return $view->render();
} | [
"function",
"resetPassword",
"(",
")",
"{",
"$",
"infoMessage",
"=",
"null",
";",
"$",
"formErrors",
"=",
"null",
";",
"$",
"form",
"=",
"new",
"FormResetPassword",
"(",
")",
";",
"if",
"(",
"$",
"form",
"->",
"validate",
"(",
")",
")",
"{",
"$",
"... | Reset password action. Stores new password as hash and sends email
to confirm use. | [
"Reset",
"password",
"action",
".",
"Stores",
"new",
"password",
"as",
"hash",
"and",
"sends",
"email",
"to",
"confirm",
"use",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Login/Controller.php#L367-L394 | train | This method is used to reset the password. | [
30522,
3853,
25141,
15194,
18351,
1006,
1007,
1063,
1002,
18558,
7834,
3736,
3351,
1027,
19701,
1025,
1002,
2280,
29165,
2015,
1027,
19701,
1025,
1002,
2433,
1027,
2047,
2433,
6072,
3388,
15194,
18351,
1006,
1007,
1025,
2065,
1006,
1002,
24... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/LanguagesManager/API.php | API.isLanguageAvailable | public function isLanguageAvailable($languageCode)
{
return $languageCode !== false
&& Filesystem::isValidFilename($languageCode)
&& in_array($languageCode, $this->getAvailableLanguages());
} | php | public function isLanguageAvailable($languageCode)
{
return $languageCode !== false
&& Filesystem::isValidFilename($languageCode)
&& in_array($languageCode, $this->getAvailableLanguages());
} | [
"public",
"function",
"isLanguageAvailable",
"(",
"$",
"languageCode",
")",
"{",
"return",
"$",
"languageCode",
"!==",
"false",
"&&",
"Filesystem",
"::",
"isValidFilename",
"(",
"$",
"languageCode",
")",
"&&",
"in_array",
"(",
"$",
"languageCode",
",",
"$",
"t... | Returns true if specified language is available
@param string $languageCode
@return bool true if language available; false otherwise | [
"Returns",
"true",
"if",
"specified",
"language",
"is",
"available"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/LanguagesManager/API.php#L44-L49 | train | Returns true if language code is available in the language list | [
30522,
2270,
3853,
25340,
3070,
6692,
3351,
12462,
11733,
3468,
1006,
1002,
2653,
16044,
1007,
1063,
2709,
1002,
2653,
16044,
999,
1027,
1027,
6270,
1004,
1004,
6764,
27268,
6633,
1024,
1024,
2003,
10175,
3593,
8873,
20844,
4168,
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... |
getgrav/grav | system/src/Grav/Common/Scheduler/IntervalTrait.php | IntervalTrait.monthly | public function monthly($month = '*', $day = 1, $hour = 0, $minute = 0)
{
if (\is_string($hour)) {
$parts = explode(':', $hour);
$hour = $parts[0];
$minute = $parts[1] ?? '0';
}
$c = $this->validateCronSequence($minute, $hour, $day, $month);
return $this->at("{$c['minute']} {$c['hour']} {$c['day']} {$c['month']} *");
} | php | public function monthly($month = '*', $day = 1, $hour = 0, $minute = 0)
{
if (\is_string($hour)) {
$parts = explode(':', $hour);
$hour = $parts[0];
$minute = $parts[1] ?? '0';
}
$c = $this->validateCronSequence($minute, $hour, $day, $month);
return $this->at("{$c['minute']} {$c['hour']} {$c['day']} {$c['month']} *");
} | [
"public",
"function",
"monthly",
"(",
"$",
"month",
"=",
"'*'",
",",
"$",
"day",
"=",
"1",
",",
"$",
"hour",
"=",
"0",
",",
"$",
"minute",
"=",
"0",
")",
"{",
"if",
"(",
"\\",
"is_string",
"(",
"$",
"hour",
")",
")",
"{",
"$",
"parts",
"=",
... | Set the execution time to once a month.
@param int|string $month
@param int|string $day
@param int|string $hour
@param int|string $minute
@return self | [
"Set",
"the",
"execution",
"time",
"to",
"once",
"a",
"month",
"."
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Scheduler/IntervalTrait.php#L101-L111 | train | Set the current time to the given monthly | [
30522,
2270,
3853,
7058,
1006,
1002,
3204,
1027,
1005,
1008,
1005,
1010,
1002,
2154,
1027,
1015,
1010,
1002,
3178,
1027,
1014,
1010,
1002,
3371,
1027,
1014,
1007,
1063,
2065,
1006,
1032,
2003,
1035,
5164,
1006,
1002,
3178,
1007,
1007,
106... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/View/Compilers/Concerns/CompilesJson.php | CompilesJson.compileJson | protected function compileJson($expression)
{
$parts = explode(',', $this->stripParentheses($expression));
$options = isset($parts[1]) ? trim($parts[1]) : $this->encodingOptions;
$depth = isset($parts[2]) ? trim($parts[2]) : 512;
return "<?php echo json_encode($parts[0], $options, $depth) ?>";
} | php | protected function compileJson($expression)
{
$parts = explode(',', $this->stripParentheses($expression));
$options = isset($parts[1]) ? trim($parts[1]) : $this->encodingOptions;
$depth = isset($parts[2]) ? trim($parts[2]) : 512;
return "<?php echo json_encode($parts[0], $options, $depth) ?>";
} | [
"protected",
"function",
"compileJson",
"(",
"$",
"expression",
")",
"{",
"$",
"parts",
"=",
"explode",
"(",
"','",
",",
"$",
"this",
"->",
"stripParentheses",
"(",
"$",
"expression",
")",
")",
";",
"$",
"options",
"=",
"isset",
"(",
"$",
"parts",
"[",... | Compile the JSON statement into valid PHP.
@param string $expression
@return string | [
"Compile",
"the",
"JSON",
"statement",
"into",
"valid",
"PHP",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/View/Compilers/Concerns/CompilesJson.php#L20-L29 | train | Compiles the JSON expression into valid PHP. | [
30522,
5123,
3853,
4012,
22090,
22578,
2239,
1006,
1002,
3670,
1007,
1063,
1002,
3033,
1027,
15044,
1006,
1005,
1010,
1005,
1010,
1002,
2023,
1011,
1028,
6167,
19362,
4765,
15689,
2229,
1006,
1002,
3670,
1007,
1007,
1025,
1002,
7047,
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... |
getgrav/grav | system/src/Grav/Framework/Collection/AbstractIndexCollection.php | AbstractIndexCollection.add | public function add($element)
{
if (!$this->isAllowedElement($element)) {
throw new \InvalidArgumentException('Invalid argument $element');
}
$this->entries[$element->getKey()] = $this->getElementMeta($element);
return true;
} | php | public function add($element)
{
if (!$this->isAllowedElement($element)) {
throw new \InvalidArgumentException('Invalid argument $element');
}
$this->entries[$element->getKey()] = $this->getElementMeta($element);
return true;
} | [
"public",
"function",
"add",
"(",
"$",
"element",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isAllowedElement",
"(",
"$",
"element",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'Invalid argument $element'",
")",
";",
"}",
"$",... | {@inheritDoc} | [
"{"
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Framework/Collection/AbstractIndexCollection.php#L259-L268 | train | Add an element to the list | [
30522,
2270,
3853,
5587,
1006,
1002,
5783,
1007,
1063,
2065,
1006,
999,
1002,
2023,
1011,
1028,
18061,
7174,
15557,
12260,
3672,
1006,
1002,
5783,
1007,
1007,
1063,
5466,
2047,
1032,
19528,
2906,
22850,
15781,
2595,
24422,
1006,
1005,
19528... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
slimphp/Slim | Slim/Http/Headers.php | Headers.set | public function set($key, $value)
{
if (!is_array($value)) {
$value = [$value];
}
parent::set($this->normalizeKey($key), [
'value' => $value,
'originalKey' => $key
]);
} | php | public function set($key, $value)
{
if (!is_array($value)) {
$value = [$value];
}
parent::set($this->normalizeKey($key), [
'value' => $value,
'originalKey' => $key
]);
} | [
"public",
"function",
"set",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"value",
")",
")",
"{",
"$",
"value",
"=",
"[",
"$",
"value",
"]",
";",
"}",
"parent",
"::",
"set",
"(",
"$",
"this",
"->",
"norm... | Set HTTP header value
This method sets a header value. It replaces
any values that may already exist for the header name.
@param string $key The case-insensitive header name
@param array|string $value The header value | [
"Set",
"HTTP",
"header",
"value"
] | ccef5f7d8bcd469d59cbe64f6210d83764f91543 | https://github.com/slimphp/Slim/blob/ccef5f7d8bcd469d59cbe64f6210d83764f91543/Slim/Http/Headers.php#L117-L126 | train | Set the value of the key in the cache | [
30522,
2270,
3853,
2275,
1006,
1002,
3145,
1010,
1002,
3643,
1007,
1063,
2065,
1006,
999,
2003,
1035,
9140,
1006,
1002,
3643,
30524,
1002,
3643,
1010,
1005,
2434,
14839,
1005,
1027,
1028,
1002,
3145,
1033,
1007,
1025,
1065,
102,
0,
0,
0... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/system/behaviors/SettingsModel.php | SettingsModel.getFieldConfig | public function getFieldConfig()
{
if ($this->fieldConfig !== null) {
return $this->fieldConfig;
}
return $this->fieldConfig = $this->makeConfig($this->model->settingsFields);
} | php | public function getFieldConfig()
{
if ($this->fieldConfig !== null) {
return $this->fieldConfig;
}
return $this->fieldConfig = $this->makeConfig($this->model->settingsFields);
} | [
"public",
"function",
"getFieldConfig",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"fieldConfig",
"!==",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"fieldConfig",
";",
"}",
"return",
"$",
"this",
"->",
"fieldConfig",
"=",
"$",
"this",
"->",
"make... | Returns the field configuration used by this model. | [
"Returns",
"the",
"field",
"configuration",
"used",
"by",
"this",
"model",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/behaviors/SettingsModel.php#L242-L249 | train | Get field config | [
30522,
2270,
3853,
2131,
3790,
8663,
8873,
2290,
1006,
1007,
1063,
2065,
1006,
1002,
2023,
1011,
1028,
2492,
8663,
8873,
2290,
999,
1027,
1027,
19701,
1007,
1063,
2709,
1002,
2023,
1011,
1028,
2492,
8663,
8873,
2290,
1025,
1065,
2709,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/API/DocumentationGenerator.php | DocumentationGenerator.getParametersString | protected function getParametersString($class, $name)
{
$aParameters = Proxy::getInstance()->getParametersList($class, $name);
$asParameters = array();
foreach ($aParameters as $nameVariable => $defaultValue) {
// Do not show API parameters starting with _
// They are supposed to be used only in internal API calls
if (strpos($nameVariable, '_') === 0) {
continue;
}
$str = $nameVariable;
if (!($defaultValue instanceof NoDefaultValue)) {
if (is_array($defaultValue)) {
$str .= " = 'Array'";
} else {
$str .= " = '$defaultValue'";
}
}
$asParameters[] = $str;
}
$sParameters = implode(", ", $asParameters);
return "($sParameters)";
} | php | protected function getParametersString($class, $name)
{
$aParameters = Proxy::getInstance()->getParametersList($class, $name);
$asParameters = array();
foreach ($aParameters as $nameVariable => $defaultValue) {
// Do not show API parameters starting with _
// They are supposed to be used only in internal API calls
if (strpos($nameVariable, '_') === 0) {
continue;
}
$str = $nameVariable;
if (!($defaultValue instanceof NoDefaultValue)) {
if (is_array($defaultValue)) {
$str .= " = 'Array'";
} else {
$str .= " = '$defaultValue'";
}
}
$asParameters[] = $str;
}
$sParameters = implode(", ", $asParameters);
return "($sParameters)";
} | [
"protected",
"function",
"getParametersString",
"(",
"$",
"class",
",",
"$",
"name",
")",
"{",
"$",
"aParameters",
"=",
"Proxy",
"::",
"getInstance",
"(",
")",
"->",
"getParametersList",
"(",
"$",
"class",
",",
"$",
"name",
")",
";",
"$",
"asParameters",
... | Returns the methods $class.$name parameters (and default value if provided) as a string.
@param string $class The class name
@param string $name The method name
@return string For example "(idSite, period, date = 'today')" | [
"Returns",
"the",
"methods",
"$class",
".",
"$name",
"parameters",
"(",
"and",
"default",
"value",
"if",
"provided",
")",
"as",
"a",
"string",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/API/DocumentationGenerator.php#L319-L341 | train | Returns the parameters string for the given class and name | [
30522,
5123,
3853,
2131,
28689,
22828,
4757,
18886,
3070,
1006,
1002,
2465,
1010,
1002,
2171,
1007,
1063,
1002,
9706,
5400,
22828,
2015,
1027,
24540,
1024,
1024,
2131,
7076,
26897,
1006,
1007,
1011,
1028,
2131,
28689,
22828,
14540,
2923,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Queue/Worker.php | Worker.stop | public function stop($status = 0)
{
$this->events->dispatch(new Events\WorkerStopping($status));
exit($status);
} | php | public function stop($status = 0)
{
$this->events->dispatch(new Events\WorkerStopping($status));
exit($status);
} | [
"public",
"function",
"stop",
"(",
"$",
"status",
"=",
"0",
")",
"{",
"$",
"this",
"->",
"events",
"->",
"dispatch",
"(",
"new",
"Events",
"\\",
"WorkerStopping",
"(",
"$",
"status",
")",
")",
";",
"exit",
"(",
"$",
"status",
")",
";",
"}"
] | Stop listening and bail out of the script.
@param int $status
@return void | [
"Stop",
"listening",
"and",
"bail",
"out",
"of",
"the",
"script",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Queue/Worker.php#L561-L566 | train | Stop the worker | [
30522,
2270,
3853,
2644,
1006,
1002,
3570,
1027,
1014,
1007,
1063,
1002,
2023,
1011,
1028,
2824,
1011,
1028,
18365,
1006,
2047,
2824,
1032,
3667,
14399,
4691,
1006,
1002,
3570,
1007,
1007,
1025,
6164,
1006,
1002,
3570,
1007,
1025,
1065,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Messenger/Transport/AmqpExt/AmqpTransport.php | AmqpTransport.ack | public function ack(Envelope $envelope): void
{
($this->receiver ?? $this->getReceiver())->ack($envelope);
} | php | public function ack(Envelope $envelope): void
{
($this->receiver ?? $this->getReceiver())->ack($envelope);
} | [
"public",
"function",
"ack",
"(",
"Envelope",
"$",
"envelope",
")",
":",
"void",
"{",
"(",
"$",
"this",
"->",
"receiver",
"??",
"$",
"this",
"->",
"getReceiver",
"(",
")",
")",
"->",
"ack",
"(",
"$",
"envelope",
")",
";",
"}"
] | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Messenger/Transport/AmqpExt/AmqpTransport.php#L50-L53 | train | Acknowledge an incoming message | [
30522,
2270,
3853,
9353,
2243,
1006,
11255,
1002,
11255,
1007,
1024,
11675,
1063,
1006,
1002,
2023,
1011,
1028,
8393,
1029,
1029,
1002,
2023,
1011,
1028,
2131,
2890,
3401,
16402,
1006,
1007,
1007,
1011,
1028,
9353,
2243,
1006,
1002,
11255,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Support/Collection.php | Collection.diffKeysUsing | public function diffKeysUsing($items, callable $callback)
{
return new static(array_diff_ukey($this->items, $this->getArrayableItems($items), $callback));
} | php | public function diffKeysUsing($items, callable $callback)
{
return new static(array_diff_ukey($this->items, $this->getArrayableItems($items), $callback));
} | [
"public",
"function",
"diffKeysUsing",
"(",
"$",
"items",
",",
"callable",
"$",
"callback",
")",
"{",
"return",
"new",
"static",
"(",
"array_diff_ukey",
"(",
"$",
"this",
"->",
"items",
",",
"$",
"this",
"->",
"getArrayableItems",
"(",
"$",
"items",
")",
... | Get the items in the collection whose keys are not present in the given items.
@param mixed $items
@param callable $callback
@return static | [
"Get",
"the",
"items",
"in",
"the",
"collection",
"whose",
"keys",
"are",
"not",
"present",
"in",
"the",
"given",
"items",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Support/Collection.php#L403-L406 | train | Get array with keys that are not present in the array using the given callback | [
30522,
2270,
3853,
4487,
4246,
14839,
13203,
2075,
1006,
1002,
5167,
1010,
2655,
3085,
1002,
2655,
5963,
1007,
1063,
2709,
2047,
10763,
1006,
9140,
1035,
4487,
4246,
1035,
2866,
3240,
1006,
1002,
2023,
1011,
1028,
5167,
1010,
1002,
2023,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/BrowserKit/Client.php | Client.click | public function click(Link $link)
{
if ($link instanceof Form) {
return $this->submit($link);
}
return $this->request($link->getMethod(), $link->getUri());
} | php | public function click(Link $link)
{
if ($link instanceof Form) {
return $this->submit($link);
}
return $this->request($link->getMethod(), $link->getUri());
} | [
"public",
"function",
"click",
"(",
"Link",
"$",
"link",
")",
"{",
"if",
"(",
"$",
"link",
"instanceof",
"Form",
")",
"{",
"return",
"$",
"this",
"->",
"submit",
"(",
"$",
"link",
")",
";",
"}",
"return",
"$",
"this",
"->",
"request",
"(",
"$",
"... | Clicks on a given link.
@return Crawler | [
"Clicks",
"on",
"a",
"given",
"link",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/BrowserKit/Client.php#L286-L293 | train | Clicks a link | [
30522,
2270,
3853,
11562,
1006,
4957,
1002,
4957,
1007,
1063,
2065,
1006,
1002,
4957,
6013,
11253,
2433,
1007,
1063,
2709,
1002,
2023,
1011,
1028,
12040,
1006,
1002,
4957,
1007,
1025,
1065,
2709,
1002,
2023,
1011,
1028,
5227,
1006,
1002,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/system/models/LogSetting.php | LogSetting.initSettingsData | public function initSettingsData()
{
$this->log_events = true;
$this->log_requests = false;
$this->log_theme = false;
} | php | public function initSettingsData()
{
$this->log_events = true;
$this->log_requests = false;
$this->log_theme = false;
} | [
"public",
"function",
"initSettingsData",
"(",
")",
"{",
"$",
"this",
"->",
"log_events",
"=",
"true",
";",
"$",
"this",
"->",
"log_requests",
"=",
"false",
";",
"$",
"this",
"->",
"log_theme",
"=",
"false",
";",
"}"
] | Initialize the seed data for this model. This only executes when the
model is first created or reset to default.
@return void | [
"Initialize",
"the",
"seed",
"data",
"for",
"this",
"model",
".",
"This",
"only",
"executes",
"when",
"the",
"model",
"is",
"first",
"created",
"or",
"reset",
"to",
"default",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/models/LogSetting.php#L63-L68 | train | Initialize the settings data | [
30522,
2270,
3853,
1999,
12762,
18319,
3070,
16150,
6790,
1006,
1007,
1063,
1002,
2023,
1011,
1028,
8833,
1035,
2824,
1027,
2995,
1025,
1002,
2023,
1011,
1028,
8833,
1035,
11186,
1027,
6270,
1025,
1002,
2023,
1011,
1028,
8833,
1035,
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... |
walkor/Workerman | Worker.php | Worker.stop | public function stop()
{
// Try to emit onWorkerStop callback.
if ($this->onWorkerStop) {
try {
call_user_func($this->onWorkerStop, $this);
} catch (\Exception $e) {
static::log($e);
exit(250);
} catch (\Error $e) {
static::log($e);
exit(250);
}
}
// Remove listener for server socket.
$this->unlisten();
// Close all connections for the worker.
if (!static::$_gracefulStop) {
foreach ($this->connections as $connection) {
$connection->close();
}
}
// Clear callback.
$this->onMessage = $this->onClose = $this->onError = $this->onBufferDrain = $this->onBufferFull = null;
} | php | public function stop()
{
// Try to emit onWorkerStop callback.
if ($this->onWorkerStop) {
try {
call_user_func($this->onWorkerStop, $this);
} catch (\Exception $e) {
static::log($e);
exit(250);
} catch (\Error $e) {
static::log($e);
exit(250);
}
}
// Remove listener for server socket.
$this->unlisten();
// Close all connections for the worker.
if (!static::$_gracefulStop) {
foreach ($this->connections as $connection) {
$connection->close();
}
}
// Clear callback.
$this->onMessage = $this->onClose = $this->onError = $this->onBufferDrain = $this->onBufferFull = null;
} | [
"public",
"function",
"stop",
"(",
")",
"{",
"// Try to emit onWorkerStop callback.",
"if",
"(",
"$",
"this",
"->",
"onWorkerStop",
")",
"{",
"try",
"{",
"call_user_func",
"(",
"$",
"this",
"->",
"onWorkerStop",
",",
"$",
"this",
")",
";",
"}",
"catch",
"(... | Stop current worker instance.
@return void | [
"Stop",
"current",
"worker",
"instance",
"."
] | 13649907f05014fcfffcfccaef01e63ad3339351 | https://github.com/walkor/Workerman/blob/13649907f05014fcfffcfccaef01e63ad3339351/Worker.php#L2365-L2389 | train | Stop the worker | [
30522,
2270,
3853,
2644,
1006,
1007,
1063,
1013,
1013,
3046,
2000,
12495,
2102,
2006,
6198,
2545,
14399,
2655,
5963,
1012,
2065,
1006,
1002,
2023,
1011,
1028,
2006,
6198,
2545,
14399,
1007,
1063,
3046,
1063,
2655,
1035,
5310,
1035,
4569,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/backend/behaviors/ListController.php | ListController.index | public function index()
{
$this->controller->pageTitle = $this->controller->pageTitle ?: Lang::get($this->getConfig(
'title',
'backend::lang.list.default_title'
));
$this->controller->bodyClass = 'slim-container';
$this->makeLists();
} | php | public function index()
{
$this->controller->pageTitle = $this->controller->pageTitle ?: Lang::get($this->getConfig(
'title',
'backend::lang.list.default_title'
));
$this->controller->bodyClass = 'slim-container';
$this->makeLists();
} | [
"public",
"function",
"index",
"(",
")",
"{",
"$",
"this",
"->",
"controller",
"->",
"pageTitle",
"=",
"$",
"this",
"->",
"controller",
"->",
"pageTitle",
"?",
":",
"Lang",
"::",
"get",
"(",
"$",
"this",
"->",
"getConfig",
"(",
"'title'",
",",
"'backen... | Index Controller action.
@return void | [
"Index",
"Controller",
"action",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/behaviors/ListController.php#L271-L279 | train | Index page. | [
30522,
2270,
3853,
5950,
1006,
1007,
1063,
1002,
2023,
1011,
1028,
11486,
1011,
1028,
3931,
3775,
9286,
1027,
1002,
2023,
1011,
1028,
11486,
1011,
1028,
3931,
3775,
9286,
1029,
1024,
11374,
1024,
1024,
2131,
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... |
symfony/symfony | src/Symfony/Bridge/Doctrine/DependencyInjection/AbstractDoctrineExtension.php | AbstractDoctrineExtension.validateAutoMapping | private function validateAutoMapping(array $managerConfigs)
{
$autoMappedManager = null;
foreach ($managerConfigs as $name => $manager) {
if (!$manager['auto_mapping']) {
continue;
}
if (null !== $autoMappedManager) {
throw new \LogicException(sprintf('You cannot enable "auto_mapping" on more than one manager at the same time (found in "%s" and %s").', $autoMappedManager, $name));
}
$autoMappedManager = $name;
}
return $autoMappedManager;
} | php | private function validateAutoMapping(array $managerConfigs)
{
$autoMappedManager = null;
foreach ($managerConfigs as $name => $manager) {
if (!$manager['auto_mapping']) {
continue;
}
if (null !== $autoMappedManager) {
throw new \LogicException(sprintf('You cannot enable "auto_mapping" on more than one manager at the same time (found in "%s" and %s").', $autoMappedManager, $name));
}
$autoMappedManager = $name;
}
return $autoMappedManager;
} | [
"private",
"function",
"validateAutoMapping",
"(",
"array",
"$",
"managerConfigs",
")",
"{",
"$",
"autoMappedManager",
"=",
"null",
";",
"foreach",
"(",
"$",
"managerConfigs",
"as",
"$",
"name",
"=>",
"$",
"manager",
")",
"{",
"if",
"(",
"!",
"$",
"manager... | Search for a manager that is declared as 'auto_mapping' = true.
@return string|null The name of the manager. If no one manager is found, returns null
@throws \LogicException | [
"Search",
"for",
"a",
"manager",
"that",
"is",
"declared",
"as",
"auto_mapping",
"=",
"true",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bridge/Doctrine/DependencyInjection/AbstractDoctrineExtension.php#L451-L467 | train | Validate auto mapping | [
30522,
2797,
3853,
9398,
3686,
4887,
20389,
29098,
2075,
1006,
9140,
1002,
3208,
8663,
8873,
5620,
1007,
1063,
1002,
8285,
2863,
11469,
24805,
4590,
1027,
19701,
1025,
18921,
6776,
1006,
1002,
3208,
8663,
8873,
5620,
2004,
1002,
2171,
1027,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Database/Eloquent/Model.php | Model.registerGlobalScopes | public function registerGlobalScopes($builder)
{
foreach ($this->getGlobalScopes() as $identifier => $scope) {
$builder->withGlobalScope($identifier, $scope);
}
return $builder;
} | php | public function registerGlobalScopes($builder)
{
foreach ($this->getGlobalScopes() as $identifier => $scope) {
$builder->withGlobalScope($identifier, $scope);
}
return $builder;
} | [
"public",
"function",
"registerGlobalScopes",
"(",
"$",
"builder",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"getGlobalScopes",
"(",
")",
"as",
"$",
"identifier",
"=>",
"$",
"scope",
")",
"{",
"$",
"builder",
"->",
"withGlobalScope",
"(",
"$",
"identifi... | Register the global scopes for this builder instance.
@param \Illuminate\Database\Eloquent\Builder $builder
@return \Illuminate\Database\Eloquent\Builder | [
"Register",
"the",
"global",
"scopes",
"for",
"this",
"builder",
"instance",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Model.php#L984-L991 | train | Register Global Scopes | [
30522,
2270,
3853,
4236,
23296,
16429,
9777,
16186,
2015,
1006,
1002,
12508,
1007,
1063,
18921,
6776,
1006,
1002,
2023,
1011,
1028,
2131,
23296,
16429,
9777,
16186,
2015,
1006,
1007,
2004,
1002,
8909,
4765,
18095,
1027,
1028,
1002,
9531,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/system/behaviors/SettingsModel.php | SettingsModel.setSettingsValue | public function setSettingsValue($key, $value)
{
if ($this->isKeyAllowed($key)) {
return;
}
$this->fieldValues[$key] = $value;
} | php | public function setSettingsValue($key, $value)
{
if ($this->isKeyAllowed($key)) {
return;
}
$this->fieldValues[$key] = $value;
} | [
"public",
"function",
"setSettingsValue",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isKeyAllowed",
"(",
"$",
"key",
")",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"fieldValues",
"[",
"$",
"key",
"]",
"=",
... | Set a single setting value, if allowed. | [
"Set",
"a",
"single",
"setting",
"value",
"if",
"allowed",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/behaviors/SettingsModel.php#L153-L160 | train | Set the value of a setting field. | [
30522,
2270,
3853,
4520,
18319,
3070,
2015,
10175,
5657,
1006,
1002,
3145,
1010,
1002,
3643,
1007,
1063,
2065,
1006,
1002,
2023,
1011,
1028,
2003,
14839,
8095,
15096,
1006,
1002,
3145,
1007,
1007,
1063,
2709,
1025,
1065,
1002,
2023,
1011,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/cms/classes/Page.php | Page.getLayoutOptions | public function getLayoutOptions()
{
if (!($theme = Theme::getEditTheme())) {
throw new ApplicationException(Lang::get('cms::lang.theme.edit.not_found'));
}
$layouts = Layout::listInTheme($theme, true);
$result = [];
$result[null] = Lang::get('cms::lang.page.no_layout');
foreach ($layouts as $layout) {
$baseName = $layout->getBaseFileName();
if (FileDefinitions::isPathIgnored($baseName)) {
continue;
}
$result[$baseName] = strlen($layout->name) ? $layout->name : $baseName;
}
return $result;
} | php | public function getLayoutOptions()
{
if (!($theme = Theme::getEditTheme())) {
throw new ApplicationException(Lang::get('cms::lang.theme.edit.not_found'));
}
$layouts = Layout::listInTheme($theme, true);
$result = [];
$result[null] = Lang::get('cms::lang.page.no_layout');
foreach ($layouts as $layout) {
$baseName = $layout->getBaseFileName();
if (FileDefinitions::isPathIgnored($baseName)) {
continue;
}
$result[$baseName] = strlen($layout->name) ? $layout->name : $baseName;
}
return $result;
} | [
"public",
"function",
"getLayoutOptions",
"(",
")",
"{",
"if",
"(",
"!",
"(",
"$",
"theme",
"=",
"Theme",
"::",
"getEditTheme",
"(",
")",
")",
")",
"{",
"throw",
"new",
"ApplicationException",
"(",
"Lang",
"::",
"get",
"(",
"'cms::lang.theme.edit.not_found'"... | Returns a list of layouts available in the theme.
This method is used by the form widget.
@return array Returns an array of strings. | [
"Returns",
"a",
"list",
"of",
"layouts",
"available",
"in",
"the",
"theme",
".",
"This",
"method",
"is",
"used",
"by",
"the",
"form",
"widget",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/Page.php#L77-L98 | train | Get layout options | [
30522,
2270,
3853,
2131,
8485,
5833,
7361,
9285,
1006,
1007,
1063,
2065,
1006,
999,
1006,
1002,
4323,
1027,
4323,
1024,
1024,
2131,
2098,
12474,
29122,
2063,
1006,
1007,
1007,
1007,
1063,
5466,
2047,
4646,
10288,
24422,
1006,
11374,
1024,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
z-song/laravel-admin | src/Form/Field/Tags.php | Tags.pluck | public function pluck($visibleColumn, $key)
{
if (!empty($visibleColumn) && !empty($key)) {
$this->keyAsValue = true;
}
$this->visibleColumn = $visibleColumn;
$this->key = $key;
return $this;
} | php | public function pluck($visibleColumn, $key)
{
if (!empty($visibleColumn) && !empty($key)) {
$this->keyAsValue = true;
}
$this->visibleColumn = $visibleColumn;
$this->key = $key;
return $this;
} | [
"public",
"function",
"pluck",
"(",
"$",
"visibleColumn",
",",
"$",
"key",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"visibleColumn",
")",
"&&",
"!",
"empty",
"(",
"$",
"key",
")",
")",
"{",
"$",
"this",
"->",
"keyAsValue",
"=",
"true",
";",
"... | Set visible column and key of data.
@param $visibleColumn
@param $key
@return $this | [
"Set",
"visible",
"column",
"and",
"key",
"of",
"data",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Form/Field/Tags.php#L77-L87 | train | Plucks the value of a column and key from a column. | [
30522,
2270,
3853,
20228,
12722,
1006,
1002,
5710,
25778,
2819,
2078,
1010,
1002,
3145,
1007,
1063,
2065,
1006,
999,
4064,
1006,
1002,
5710,
25778,
2819,
2078,
1007,
1004,
1004,
999,
4064,
1006,
1002,
3145,
1007,
1007,
1063,
1002,
2023,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
overtrue/wechat | src/OfficialAccount/Card/ServiceProvider.php | ServiceProvider.register | public function register(Container $app)
{
$app['card'] = function ($app) {
return new Card($app);
};
$app['card.client'] = function ($app) {
return new Client($app);
};
$app['card.coin'] = function ($app) {
return new CoinClient($app);
};
$app['card.sub_merchant'] = function ($app) {
return new SubMerchantClient($app);
};
$app['card.code'] = function ($app) {
return new CodeClient($app);
};
$app['card.movie_ticket'] = function ($app) {
return new MovieTicketClient($app);
};
$app['card.member_card'] = function ($app) {
return new MemberCardClient($app);
};
$app['card.general_card'] = function ($app) {
return new GeneralCardClient($app);
};
$app['card.boarding_pass'] = function ($app) {
return new BoardingPassClient($app);
};
$app['card.meeting_ticket'] = function ($app) {
return new MeetingTicketClient($app);
};
$app['card.jssdk'] = function ($app) {
return new JssdkClient($app);
};
} | php | public function register(Container $app)
{
$app['card'] = function ($app) {
return new Card($app);
};
$app['card.client'] = function ($app) {
return new Client($app);
};
$app['card.coin'] = function ($app) {
return new CoinClient($app);
};
$app['card.sub_merchant'] = function ($app) {
return new SubMerchantClient($app);
};
$app['card.code'] = function ($app) {
return new CodeClient($app);
};
$app['card.movie_ticket'] = function ($app) {
return new MovieTicketClient($app);
};
$app['card.member_card'] = function ($app) {
return new MemberCardClient($app);
};
$app['card.general_card'] = function ($app) {
return new GeneralCardClient($app);
};
$app['card.boarding_pass'] = function ($app) {
return new BoardingPassClient($app);
};
$app['card.meeting_ticket'] = function ($app) {
return new MeetingTicketClient($app);
};
$app['card.jssdk'] = function ($app) {
return new JssdkClient($app);
};
} | [
"public",
"function",
"register",
"(",
"Container",
"$",
"app",
")",
"{",
"$",
"app",
"[",
"'card'",
"]",
"=",
"function",
"(",
"$",
"app",
")",
"{",
"return",
"new",
"Card",
"(",
"$",
"app",
")",
";",
"}",
";",
"$",
"app",
"[",
"'card.client'",
... | {@inheritdoc}. | [
"{"
] | 120c72faaa93c270365bc75c73c362d5fd583209 | https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/OfficialAccount/Card/ServiceProvider.php#L27-L72 | train | Register the services | [
30522,
2270,
3853,
4236,
1006,
11661,
1002,
10439,
1007,
1063,
1002,
10439,
1031,
1005,
4003,
1005,
1033,
1027,
3853,
1006,
1002,
10439,
1007,
1063,
2709,
2047,
4003,
1006,
1002,
10439,
1007,
1025,
1065,
1025,
1002,
10439,
1031,
1005,
4003,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/EloquentUserProvider.php | EloquentUserProvider.updateRememberToken | public function updateRememberToken(UserContract $user, $token)
{
$user->setRememberToken($token);
$timestamps = $user->timestamps;
$user->timestamps = false;
$user->save();
$user->timestamps = $timestamps;
} | php | public function updateRememberToken(UserContract $user, $token)
{
$user->setRememberToken($token);
$timestamps = $user->timestamps;
$user->timestamps = false;
$user->save();
$user->timestamps = $timestamps;
} | [
"public",
"function",
"updateRememberToken",
"(",
"UserContract",
"$",
"user",
",",
"$",
"token",
")",
"{",
"$",
"user",
"->",
"setRememberToken",
"(",
"$",
"token",
")",
";",
"$",
"timestamps",
"=",
"$",
"user",
"->",
"timestamps",
";",
"$",
"user",
"->... | Update the "remember me" token for the given user in storage.
@param \Illuminate\Contracts\Auth\Authenticatable|\Illuminate\Database\Eloquent\Model $user
@param string $token
@return void | [
"Update",
"the",
"remember",
"me",
"token",
"for",
"the",
"given",
"user",
"in",
"storage",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Auth/EloquentUserProvider.php#L87-L98 | train | Update the remember me token for a user | [
30522,
2270,
3853,
10651,
28578,
6633,
21201,
7520,
1006,
5310,
8663,
6494,
6593,
1002,
5310,
1010,
1002,
19204,
1007,
1063,
1002,
5310,
1011,
1028,
2275,
28578,
6633,
21201,
7520,
1006,
1002,
19204,
1007,
1025,
1002,
2335,
15464,
4523,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Console/Helper/QuestionHelper.php | QuestionHelper.writeError | protected function writeError(OutputInterface $output, \Exception $error)
{
if (null !== $this->getHelperSet() && $this->getHelperSet()->has('formatter')) {
$message = $this->getHelperSet()->get('formatter')->formatBlock($error->getMessage(), 'error');
} else {
$message = '<error>'.$error->getMessage().'</error>';
}
$output->writeln($message);
} | php | protected function writeError(OutputInterface $output, \Exception $error)
{
if (null !== $this->getHelperSet() && $this->getHelperSet()->has('formatter')) {
$message = $this->getHelperSet()->get('formatter')->formatBlock($error->getMessage(), 'error');
} else {
$message = '<error>'.$error->getMessage().'</error>';
}
$output->writeln($message);
} | [
"protected",
"function",
"writeError",
"(",
"OutputInterface",
"$",
"output",
",",
"\\",
"Exception",
"$",
"error",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"this",
"->",
"getHelperSet",
"(",
")",
"&&",
"$",
"this",
"->",
"getHelperSet",
"(",
")",
"->",
... | Outputs an error message. | [
"Outputs",
"an",
"error",
"message",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Console/Helper/QuestionHelper.php#L183-L192 | train | Write error message to output | [
30522,
5123,
3853,
4339,
2121,
29165,
1006,
6434,
18447,
2121,
12172,
1002,
6434,
1010,
1032,
6453,
1002,
7561,
1007,
1063,
2065,
1006,
19701,
999,
1027,
1027,
1002,
2023,
1011,
1028,
2131,
16001,
7347,
3388,
1006,
1007,
1004,
1004,
1002,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Messenger/Transport/Serialization/Serializer.php | Serializer.decode | public function decode(array $encodedEnvelope): Envelope
{
if (empty($encodedEnvelope['body']) || empty($encodedEnvelope['headers'])) {
throw new MessageDecodingFailedException('Encoded envelope should have at least a "body" and some "headers".');
}
if (empty($encodedEnvelope['headers']['type'])) {
throw new MessageDecodingFailedException('Encoded envelope does not have a "type" header.');
}
$stamps = $this->decodeStamps($encodedEnvelope);
$serializerStamp = $this->findFirstSerializerStamp($stamps);
$context = $this->context;
if (null !== $serializerStamp) {
$context = $serializerStamp->getContext() + $context;
}
try {
$message = $this->serializer->deserialize($encodedEnvelope['body'], $encodedEnvelope['headers']['type'], $this->format, $context);
} catch (UnexpectedValueException $e) {
throw new MessageDecodingFailedException(sprintf('Could not decode message: %s.', $e->getMessage()), $e->getCode(), $e);
}
return new Envelope($message, $stamps);
} | php | public function decode(array $encodedEnvelope): Envelope
{
if (empty($encodedEnvelope['body']) || empty($encodedEnvelope['headers'])) {
throw new MessageDecodingFailedException('Encoded envelope should have at least a "body" and some "headers".');
}
if (empty($encodedEnvelope['headers']['type'])) {
throw new MessageDecodingFailedException('Encoded envelope does not have a "type" header.');
}
$stamps = $this->decodeStamps($encodedEnvelope);
$serializerStamp = $this->findFirstSerializerStamp($stamps);
$context = $this->context;
if (null !== $serializerStamp) {
$context = $serializerStamp->getContext() + $context;
}
try {
$message = $this->serializer->deserialize($encodedEnvelope['body'], $encodedEnvelope['headers']['type'], $this->format, $context);
} catch (UnexpectedValueException $e) {
throw new MessageDecodingFailedException(sprintf('Could not decode message: %s.', $e->getMessage()), $e->getCode(), $e);
}
return new Envelope($message, $stamps);
} | [
"public",
"function",
"decode",
"(",
"array",
"$",
"encodedEnvelope",
")",
":",
"Envelope",
"{",
"if",
"(",
"empty",
"(",
"$",
"encodedEnvelope",
"[",
"'body'",
"]",
")",
"||",
"empty",
"(",
"$",
"encodedEnvelope",
"[",
"'headers'",
"]",
")",
")",
"{",
... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Messenger/Transport/Serialization/Serializer.php#L63-L88 | train | Decodes an array of encoded envelope into an Envelope | [
30522,
2270,
3853,
21933,
3207,
1006,
9140,
1002,
12359,
2368,
15985,
17635,
1007,
1024,
11255,
1063,
2065,
1006,
4064,
1006,
1002,
12359,
2368,
30524,
2015,
1005,
1033,
1007,
1007,
1063,
5466,
2047,
4471,
3207,
3597,
4667,
7011,
18450,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
overtrue/wechat | src/OfficialAccount/Card/Client.php | Client.updateStock | protected function updateStock($cardId, $amount, $action = 'increase')
{
$key = 'increase' === $action ? 'increase_stock_value' : 'reduce_stock_value';
$params = [
'card_id' => $cardId,
$key => abs($amount),
];
return $this->httpPostJson('card/modifystock', $params);
} | php | protected function updateStock($cardId, $amount, $action = 'increase')
{
$key = 'increase' === $action ? 'increase_stock_value' : 'reduce_stock_value';
$params = [
'card_id' => $cardId,
$key => abs($amount),
];
return $this->httpPostJson('card/modifystock', $params);
} | [
"protected",
"function",
"updateStock",
"(",
"$",
"cardId",
",",
"$",
"amount",
",",
"$",
"action",
"=",
"'increase'",
")",
"{",
"$",
"key",
"=",
"'increase'",
"===",
"$",
"action",
"?",
"'increase_stock_value'",
":",
"'reduce_stock_value'",
";",
"$",
"param... | 修改库存接口.
@param string $cardId
@param int $amount
@param string $action
@return mixed | [
"修改库存接口",
"."
] | 120c72faaa93c270365bc75c73c362d5fd583209 | https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/OfficialAccount/Card/Client.php#L349-L358 | train | Update stock value of a card | [
30522,
5123,
3853,
14409,
17406,
1006,
1002,
4003,
3593,
1010,
1002,
3815,
1010,
1002,
2895,
1027,
1005,
3623,
1005,
1007,
1063,
1002,
3145,
1027,
1005,
3623,
1005,
1027,
1027,
1027,
1002,
2895,
1029,
1005,
3623,
1035,
4518,
1035,
3643,
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/classes/MediaViewHelper.php | MediaViewHelper.processHtml | public function processHtml($html)
{
if (!is_string($html)) {
return $html;
}
$mediaTags = $this->extractMediaTags($html);
foreach ($mediaTags as $tagInfo) {
$pattern = preg_quote($tagInfo['declaration']);
$generatedMarkup = $this->generateMediaTagMarkup($tagInfo['type'], $tagInfo['src']);
$html = mb_ereg_replace($pattern, $generatedMarkup, $html);
}
return $html;
} | php | public function processHtml($html)
{
if (!is_string($html)) {
return $html;
}
$mediaTags = $this->extractMediaTags($html);
foreach ($mediaTags as $tagInfo) {
$pattern = preg_quote($tagInfo['declaration']);
$generatedMarkup = $this->generateMediaTagMarkup($tagInfo['type'], $tagInfo['src']);
$html = mb_ereg_replace($pattern, $generatedMarkup, $html);
}
return $html;
} | [
"public",
"function",
"processHtml",
"(",
"$",
"html",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"html",
")",
")",
"{",
"return",
"$",
"html",
";",
"}",
"$",
"mediaTags",
"=",
"$",
"this",
"->",
"extractMediaTags",
"(",
"$",
"html",
")",
";"... | Replaces audio and video tags inserted by the Media Manager with players markup.
@param string $html Specifies the HTML string to process.
@return string Returns the processed HTML string. | [
"Replaces",
"audio",
"and",
"video",
"tags",
"inserted",
"by",
"the",
"Media",
"Manager",
"with",
"players",
"markup",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/MediaViewHelper.php#L22-L36 | train | Process HTML content | [
30522,
2270,
3853,
2832,
11039,
19968,
1006,
1002,
16129,
1007,
1063,
2065,
1006,
999,
2003,
1035,
5164,
1006,
1002,
16129,
1007,
1007,
1063,
2709,
1002,
16129,
1025,
1065,
1002,
2865,
15900,
2015,
1027,
1002,
2023,
1011,
1028,
14817,
16969... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/Updater/Migration/Db/Factory.php | Factory.changeColumn | public function changeColumn($table, $oldColumnName, $newColumnName, $columnType)
{
$table = $this->prefixTable($table);
return $this->container->make('Piwik\Updater\Migration\Db\ChangeColumn', array(
'table' => $table, 'oldColumnName' => $oldColumnName,
'newColumnName' => $newColumnName, 'columnType' => $columnType
));
} | php | public function changeColumn($table, $oldColumnName, $newColumnName, $columnType)
{
$table = $this->prefixTable($table);
return $this->container->make('Piwik\Updater\Migration\Db\ChangeColumn', array(
'table' => $table, 'oldColumnName' => $oldColumnName,
'newColumnName' => $newColumnName, 'columnType' => $columnType
));
} | [
"public",
"function",
"changeColumn",
"(",
"$",
"table",
",",
"$",
"oldColumnName",
",",
"$",
"newColumnName",
",",
"$",
"columnType",
")",
"{",
"$",
"table",
"=",
"$",
"this",
"->",
"prefixTable",
"(",
"$",
"table",
")",
";",
"return",
"$",
"this",
"-... | Changes the column name and column type of an existing database table column.
@param string $table Unprefixed database table name, eg 'log_visit'.
@param string $oldColumnName The current name of the column that shall be renamed/changed, eg 'column_name'.
@param string $newColumnName The new name of the column, eg 'new_column_name'.
@param string $columnType The updated type the new column should have, eg 'VARCHAR(200) NOT NULL'.
@return ChangeColumn | [
"Changes",
"the",
"column",
"name",
"and",
"column",
"type",
"of",
"an",
"existing",
"database",
"table",
"column",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Updater/Migration/Db/Factory.php#L189-L197 | train | Changes a database column. | [
30522,
2270,
3853,
2689,
25778,
2819,
2078,
1006,
1002,
2795,
1010,
1002,
2214,
25778,
2819,
9516,
4168,
1010,
1002,
2047,
25778,
2819,
9516,
4168,
1010,
1002,
5930,
13874,
1007,
1063,
1002,
2795,
1027,
1002,
2023,
1011,
1028,
17576,
10880,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Validation/Concerns/ValidatesAttributes.php | ValidatesAttributes.validateMimes | public function validateMimes($attribute, $value, $parameters)
{
if (! $this->isValidFileInstance($value)) {
return false;
}
if ($this->shouldBlockPhpUpload($value, $parameters)) {
return false;
}
return $value->getPath() !== '' && in_array($value->guessExtension(), $parameters);
} | php | public function validateMimes($attribute, $value, $parameters)
{
if (! $this->isValidFileInstance($value)) {
return false;
}
if ($this->shouldBlockPhpUpload($value, $parameters)) {
return false;
}
return $value->getPath() !== '' && in_array($value->guessExtension(), $parameters);
} | [
"public",
"function",
"validateMimes",
"(",
"$",
"attribute",
",",
"$",
"value",
",",
"$",
"parameters",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isValidFileInstance",
"(",
"$",
"value",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"$"... | Validate the guessed extension of a file upload is in a set of file extensions.
@param string $attribute
@param mixed $value
@param array $parameters
@return bool | [
"Validate",
"the",
"guessed",
"extension",
"of",
"a",
"file",
"upload",
"is",
"in",
"a",
"set",
"of",
"file",
"extensions",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Validation/Concerns/ValidatesAttributes.php#L1133-L1144 | train | Validate the file extension | [
30522,
2270,
3853,
9398,
3686,
4328,
7834,
1006,
1002,
17961,
1010,
1002,
3643,
1010,
1002,
11709,
1007,
1063,
2065,
1006,
999,
1002,
2023,
1011,
1028,
2003,
10175,
3593,
8873,
19856,
12693,
3401,
1006,
1002,
3643,
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/Mail/Transport/SparkPostTransport.php | SparkPostTransport.send | public function send(Swift_Mime_SimpleMessage $message, &$failedRecipients = null)
{
$this->beforeSendPerformed($message);
$recipients = $this->getRecipients($message);
$message->setBcc([]);
$response = $this->client->request('POST', $this->getEndpoint(), [
'headers' => [
'Authorization' => $this->key,
],
'json' => array_merge([
'recipients' => $recipients,
'content' => [
'email_rfc822' => $message->toString(),
],
], $this->options),
]);
$message->getHeaders()->addTextHeader(
'X-SparkPost-Transmission-ID', $this->getTransmissionId($response)
);
$this->sendPerformed($message);
return $this->numberOfRecipients($message);
} | php | public function send(Swift_Mime_SimpleMessage $message, &$failedRecipients = null)
{
$this->beforeSendPerformed($message);
$recipients = $this->getRecipients($message);
$message->setBcc([]);
$response = $this->client->request('POST', $this->getEndpoint(), [
'headers' => [
'Authorization' => $this->key,
],
'json' => array_merge([
'recipients' => $recipients,
'content' => [
'email_rfc822' => $message->toString(),
],
], $this->options),
]);
$message->getHeaders()->addTextHeader(
'X-SparkPost-Transmission-ID', $this->getTransmissionId($response)
);
$this->sendPerformed($message);
return $this->numberOfRecipients($message);
} | [
"public",
"function",
"send",
"(",
"Swift_Mime_SimpleMessage",
"$",
"message",
",",
"&",
"$",
"failedRecipients",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"beforeSendPerformed",
"(",
"$",
"message",
")",
";",
"$",
"recipients",
"=",
"$",
"this",
"->",
"ge... | {@inheritdoc} | [
"{"
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Mail/Transport/SparkPostTransport.php#L49-L76 | train | Sends a Swift_Mime_SimpleMessage to the SparkPost. | [
30522,
2270,
3853,
4604,
1006,
9170,
1035,
2771,
4168,
1035,
3722,
7834,
3736,
3351,
1002,
4471,
1010,
1004,
1002,
3478,
2890,
6895,
14756,
7666,
1027,
19701,
1007,
1063,
1002,
2023,
1011,
1028,
2077,
5054,
18927,
2121,
29021,
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... |
matomo-org/matomo | core/Period/Year.php | Year.toString | public function toString($format = 'ignored')
{
$this->generate();
$stringMonth = array();
foreach ($this->subperiods as $month) {
$stringMonth[] = $month->getDateStart()->toString("Y") . "-" . $month->getDateStart()->toString("m") . "-01";
}
return $stringMonth;
} | php | public function toString($format = 'ignored')
{
$this->generate();
$stringMonth = array();
foreach ($this->subperiods as $month) {
$stringMonth[] = $month->getDateStart()->toString("Y") . "-" . $month->getDateStart()->toString("m") . "-01";
}
return $stringMonth;
} | [
"public",
"function",
"toString",
"(",
"$",
"format",
"=",
"'ignored'",
")",
"{",
"$",
"this",
"->",
"generate",
"(",
")",
";",
"$",
"stringMonth",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"subperiods",
"as",
"$",
"month",
")",... | Returns the current period as a string
@param string $format
@return array | [
"Returns",
"the",
"current",
"period",
"as",
"a",
"string"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Period/Year.php#L81-L91 | train | Returns the string of the months | [
30522,
2270,
3853,
2000,
3367,
4892,
1006,
1002,
4289,
1027,
1005,
6439,
1005,
1007,
1063,
1002,
2023,
1011,
1028,
9699,
1006,
1007,
1025,
1002,
5164,
9629,
2232,
1027,
9140,
1006,
1007,
1025,
18921,
6776,
1006,
1002,
2023,
1011,
1028,
49... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.passes | public function passes()
{
$this->messages = new MessageBag;
$this->distinctValues = [];
// We'll spin through each rule, validating the attributes attached to that
// rule. Any error messages will be added to the containers with each of
// the other error messages, returning true if we don't have messages.
foreach ($this->rules as $attribute => $rules) {
$attribute = str_replace('\.', '->', $attribute);
foreach ($rules as $rule) {
$this->validateAttribute($attribute, $rule);
if ($this->shouldStopValidating($attribute)) {
break;
}
}
}
// Here we will spin through all of the "after" hooks on this validator and
// fire them off. This gives the callbacks a chance to perform all kinds
// of other validation that needs to get wrapped up in this operation.
foreach ($this->after as $after) {
call_user_func($after);
}
return $this->messages->isEmpty();
} | php | public function passes()
{
$this->messages = new MessageBag;
$this->distinctValues = [];
// We'll spin through each rule, validating the attributes attached to that
// rule. Any error messages will be added to the containers with each of
// the other error messages, returning true if we don't have messages.
foreach ($this->rules as $attribute => $rules) {
$attribute = str_replace('\.', '->', $attribute);
foreach ($rules as $rule) {
$this->validateAttribute($attribute, $rule);
if ($this->shouldStopValidating($attribute)) {
break;
}
}
}
// Here we will spin through all of the "after" hooks on this validator and
// fire them off. This gives the callbacks a chance to perform all kinds
// of other validation that needs to get wrapped up in this operation.
foreach ($this->after as $after) {
call_user_func($after);
}
return $this->messages->isEmpty();
} | [
"public",
"function",
"passes",
"(",
")",
"{",
"$",
"this",
"->",
"messages",
"=",
"new",
"MessageBag",
";",
"$",
"this",
"->",
"distinctValues",
"=",
"[",
"]",
";",
"// We'll spin through each rule, validating the attributes attached to that",
"// rule. Any error messa... | Determine if the data passes the validation rules.
@return bool | [
"Determine",
"if",
"the",
"data",
"passes",
"the",
"validation",
"rules",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Validation/Validator.php#L264-L293 | train | Returns true if all validation passes | [
30522,
2270,
3853,
5235,
1006,
1007,
1063,
1002,
2023,
1011,
1028,
7696,
1027,
2047,
4471,
16078,
1025,
1002,
2023,
1011,
1028,
5664,
10175,
15808,
1027,
1031,
1033,
1025,
1013,
1013,
2057,
1005,
2222,
6714,
2083,
2169,
3627,
1010,
9398,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/VersionManager.php | VersionManager.listNewVersions | public function listNewVersions($plugin)
{
$code = is_string($plugin) ? $plugin : $this->pluginManager->getIdentifier($plugin);
if (!$this->hasVersionFile($code)) {
return [];
}
$databaseVersion = $this->getDatabaseVersion($code);
return $this->getNewFileVersions($code, $databaseVersion);
} | php | public function listNewVersions($plugin)
{
$code = is_string($plugin) ? $plugin : $this->pluginManager->getIdentifier($plugin);
if (!$this->hasVersionFile($code)) {
return [];
}
$databaseVersion = $this->getDatabaseVersion($code);
return $this->getNewFileVersions($code, $databaseVersion);
} | [
"public",
"function",
"listNewVersions",
"(",
"$",
"plugin",
")",
"{",
"$",
"code",
"=",
"is_string",
"(",
"$",
"plugin",
")",
"?",
"$",
"plugin",
":",
"$",
"this",
"->",
"pluginManager",
"->",
"getIdentifier",
"(",
"$",
"plugin",
")",
";",
"if",
"(",
... | Returns a list of unapplied plugin versions. | [
"Returns",
"a",
"list",
"of",
"unapplied",
"plugin",
"versions",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/VersionManager.php#L111-L121 | train | List new versions of a plugin | [
30522,
2270,
3853,
2862,
2638,
2860,
27774,
2015,
1006,
1002,
13354,
2378,
1007,
1063,
1002,
3642,
1027,
2003,
1035,
5164,
1006,
1002,
13354,
2378,
1007,
1029,
1002,
13354,
2378,
1024,
1002,
2023,
1011,
1028,
13354,
2378,
24805,
4590,
1011,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
overtrue/wechat | src/Payment/ProfitSharing/Client.php | Client.markOrderAsFinished | public function markOrderAsFinished(array $params)
{
$params['appid'] = $this->app['config']->app_id;
$params['sub_appid'] = null;
return $this->safeRequest(
'secapi/pay/profitsharingfinish', $params
);
} | php | public function markOrderAsFinished(array $params)
{
$params['appid'] = $this->app['config']->app_id;
$params['sub_appid'] = null;
return $this->safeRequest(
'secapi/pay/profitsharingfinish', $params
);
} | [
"public",
"function",
"markOrderAsFinished",
"(",
"array",
"$",
"params",
")",
"{",
"$",
"params",
"[",
"'appid'",
"]",
"=",
"$",
"this",
"->",
"app",
"[",
"'config'",
"]",
"->",
"app_id",
";",
"$",
"params",
"[",
"'sub_appid'",
"]",
"=",
"null",
";",
... | Finish profit sharing.
完结分账.
@param array $params | [
"Finish",
"profit",
"sharing",
".",
"完结分账",
"."
] | 120c72faaa93c270365bc75c73c362d5fd583209 | https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/Payment/ProfitSharing/Client.php#L135-L143 | train | Mark order as finished | [
30522,
2270,
3853,
28003,
26764,
3022,
16294,
13295,
1006,
9140,
1002,
11498,
5244,
1007,
1063,
1002,
11498,
5244,
1031,
1005,
10439,
3593,
1005,
1033,
1027,
1002,
2023,
1011,
1028,
10439,
1031,
1005,
9530,
8873,
2290,
1005,
1033,
1011,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Validation/Validator.php | Validator.addDependentExtension | public function addDependentExtension($rule, $extension)
{
$this->addExtension($rule, $extension);
$this->dependentRules[] = Str::studly($rule);
} | php | public function addDependentExtension($rule, $extension)
{
$this->addExtension($rule, $extension);
$this->dependentRules[] = Str::studly($rule);
} | [
"public",
"function",
"addDependentExtension",
"(",
"$",
"rule",
",",
"$",
"extension",
")",
"{",
"$",
"this",
"->",
"addExtension",
"(",
"$",
"rule",
",",
"$",
"extension",
")",
";",
"$",
"this",
"->",
"dependentRules",
"[",
"]",
"=",
"Str",
"::",
"st... | Register a custom dependent validator extension.
@param string $rule
@param \Closure|string $extension
@return void | [
"Register",
"a",
"custom",
"dependent",
"validator",
"extension",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Validation/Validator.php#L952-L957 | train | Add a dependent extension to the hierarchy | [
30522,
2270,
3853,
5587,
3207,
11837,
16454,
10288,
29048,
1006,
1002,
3627,
1010,
1002,
5331,
1007,
1063,
1002,
2023,
1011,
1028,
5587,
10288,
29048,
1006,
1002,
3627,
1010,
1002,
5331,
1007,
1025,
1002,
2023,
1011,
1028,
7790,
6820,
4244,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/backend/formwidgets/Relation.php | Relation.makeRenderFormField | protected function makeRenderFormField()
{
return $this->renderFormField = RelationBase::noConstraints(function () {
$field = clone $this->formField;
$relationObject = $this->getRelationObject();
$query = $relationObject->newQuery();
list($model, $attribute) = $this->resolveModelAttribute($this->valueFrom);
$relationType = $model->getRelationType($attribute);
$relationModel = $model->makeRelation($attribute);
if (in_array($relationType, ['belongsToMany', 'morphToMany', 'morphedByMany', 'hasMany'])) {
$field->type = 'checkboxlist';
}
elseif (in_array($relationType, ['belongsTo', 'hasOne'])) {
$field->type = 'dropdown';
}
// It is safe to assume that if the model and related model are of
// the exact same class, then it cannot be related to itself
if ($model->exists && (get_class($model) == get_class($relationModel))) {
$query->where($relationModel->getKeyName(), '<>', $model->getKey());
}
if ($scopeMethod = $this->scope) {
$query->$scopeMethod($model);
}
// Even though "no constraints" is applied, belongsToMany constrains the query
// by joining its pivot table. Remove all joins from the query.
$query->getQuery()->getQuery()->joins = [];
// Determine if the model uses a tree trait
$treeTraits = ['October\Rain\Database\Traits\NestedTree', 'October\Rain\Database\Traits\SimpleTree'];
$usesTree = count(array_intersect($treeTraits, class_uses($relationModel))) > 0;
// The "sqlSelect" config takes precedence over "nameFrom".
// A virtual column called "selection" will contain the result.
// Tree models must select all columns to return parent columns, etc.
if ($this->sqlSelect) {
$nameFrom = 'selection';
$selectColumn = $usesTree ? '*' : $relationModel->getKeyName();
$result = $query->select($selectColumn, Db::raw($this->sqlSelect . ' AS ' . $nameFrom));
}
else {
$nameFrom = $this->nameFrom;
$result = $query->getQuery()->get();
}
// Some simpler relations can specify a custom local or foreign "other" key,
// which can be detected and implemented here automagically.
$primaryKeyName = in_array($relationType, ['hasMany', 'belongsTo', 'hasOne'])
? $relationObject->getOtherKey()
: $relationModel->getKeyName();
$field->options = $usesTree
? $result->listsNested($nameFrom, $primaryKeyName)
: $result->lists($nameFrom, $primaryKeyName);
return $field;
});
} | php | protected function makeRenderFormField()
{
return $this->renderFormField = RelationBase::noConstraints(function () {
$field = clone $this->formField;
$relationObject = $this->getRelationObject();
$query = $relationObject->newQuery();
list($model, $attribute) = $this->resolveModelAttribute($this->valueFrom);
$relationType = $model->getRelationType($attribute);
$relationModel = $model->makeRelation($attribute);
if (in_array($relationType, ['belongsToMany', 'morphToMany', 'morphedByMany', 'hasMany'])) {
$field->type = 'checkboxlist';
}
elseif (in_array($relationType, ['belongsTo', 'hasOne'])) {
$field->type = 'dropdown';
}
// It is safe to assume that if the model and related model are of
// the exact same class, then it cannot be related to itself
if ($model->exists && (get_class($model) == get_class($relationModel))) {
$query->where($relationModel->getKeyName(), '<>', $model->getKey());
}
if ($scopeMethod = $this->scope) {
$query->$scopeMethod($model);
}
// Even though "no constraints" is applied, belongsToMany constrains the query
// by joining its pivot table. Remove all joins from the query.
$query->getQuery()->getQuery()->joins = [];
// Determine if the model uses a tree trait
$treeTraits = ['October\Rain\Database\Traits\NestedTree', 'October\Rain\Database\Traits\SimpleTree'];
$usesTree = count(array_intersect($treeTraits, class_uses($relationModel))) > 0;
// The "sqlSelect" config takes precedence over "nameFrom".
// A virtual column called "selection" will contain the result.
// Tree models must select all columns to return parent columns, etc.
if ($this->sqlSelect) {
$nameFrom = 'selection';
$selectColumn = $usesTree ? '*' : $relationModel->getKeyName();
$result = $query->select($selectColumn, Db::raw($this->sqlSelect . ' AS ' . $nameFrom));
}
else {
$nameFrom = $this->nameFrom;
$result = $query->getQuery()->get();
}
// Some simpler relations can specify a custom local or foreign "other" key,
// which can be detected and implemented here automagically.
$primaryKeyName = in_array($relationType, ['hasMany', 'belongsTo', 'hasOne'])
? $relationObject->getOtherKey()
: $relationModel->getKeyName();
$field->options = $usesTree
? $result->listsNested($nameFrom, $primaryKeyName)
: $result->lists($nameFrom, $primaryKeyName);
return $field;
});
} | [
"protected",
"function",
"makeRenderFormField",
"(",
")",
"{",
"return",
"$",
"this",
"->",
"renderFormField",
"=",
"RelationBase",
"::",
"noConstraints",
"(",
"function",
"(",
")",
"{",
"$",
"field",
"=",
"clone",
"$",
"this",
"->",
"formField",
";",
"$",
... | Makes the form object used for rendering a simple field type | [
"Makes",
"the",
"form",
"object",
"used",
"for",
"rendering",
"a",
"simple",
"field",
"type"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/formwidgets/Relation.php#L93-L155 | train | Makes the form field that will be rendered | [
30522,
5123,
3853,
9338,
10497,
2121,
14192,
3790,
1006,
1007,
1063,
2709,
1002,
2023,
1011,
1028,
17552,
14192,
3790,
1027,
7189,
15058,
1024,
1024,
2053,
8663,
20528,
18447,
2015,
1006,
3853,
1006,
1007,
1063,
1002,
2492,
1027,
17598,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/ExampleCommand/Commands/HelloWorld.php | HelloWorld.execute | protected function execute(InputInterface $input, OutputInterface $output)
{
$name = $input->getOption('name');
$message = sprintf('<info>HelloWorld: %s</info>', $name);
$output->writeln($message);
} | php | protected function execute(InputInterface $input, OutputInterface $output)
{
$name = $input->getOption('name');
$message = sprintf('<info>HelloWorld: %s</info>', $name);
$output->writeln($message);
} | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"$",
"name",
"=",
"$",
"input",
"->",
"getOption",
"(",
"'name'",
")",
";",
"$",
"message",
"=",
"sprintf",
"(",
"'<info>HelloWorld: %s<... | The actual task is defined in this method. Here you can access any option or argument that was defined on the
command line via $input and write anything to the console via $output argument.
In case anything went wrong during the execution you should throw an exception to make sure the user will get a
useful error message and to make sure the command does not exit with the status code 0.
Ideally, the actual command is quite short as it acts like a controller. It should only receive the input values,
execute the task by calling a method of another class and output any useful information.
Execute the command like: ./console examplecommand:helloworld --name="The Piwik Team" | [
"The",
"actual",
"task",
"is",
"defined",
"in",
"this",
"method",
".",
"Here",
"you",
"can",
"access",
"any",
"option",
"or",
"argument",
"that",
"was",
"defined",
"on",
"the",
"command",
"line",
"via",
"$input",
"and",
"write",
"anything",
"to",
"the",
... | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/ExampleCommand/Commands/HelloWorld.php#L47-L54 | train | Display the message of the user | [
30522,
5123,
3853,
15389,
1006,
7953,
18447,
2121,
12172,
1002,
7953,
1010,
6434,
18447,
2121,
12172,
1002,
6434,
1007,
1063,
1002,
2171,
1027,
1002,
7953,
1011,
1028,
2131,
7361,
3508,
1006,
1005,
2171,
1005,
1007,
1025,
1002,
4471,
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... |
walkor/Workerman | Connection/TcpConnection.php | TcpConnection.getRemoteIp | public function getRemoteIp()
{
$pos = strrpos($this->_remoteAddress, ':');
if ($pos) {
return substr($this->_remoteAddress, 0, $pos);
}
return '';
} | php | public function getRemoteIp()
{
$pos = strrpos($this->_remoteAddress, ':');
if ($pos) {
return substr($this->_remoteAddress, 0, $pos);
}
return '';
} | [
"public",
"function",
"getRemoteIp",
"(",
")",
"{",
"$",
"pos",
"=",
"strrpos",
"(",
"$",
"this",
"->",
"_remoteAddress",
",",
"':'",
")",
";",
"if",
"(",
"$",
"pos",
")",
"{",
"return",
"substr",
"(",
"$",
"this",
"->",
"_remoteAddress",
",",
"0",
... | Get remote IP.
@return string | [
"Get",
"remote",
"IP",
"."
] | 13649907f05014fcfffcfccaef01e63ad3339351 | https://github.com/walkor/Workerman/blob/13649907f05014fcfffcfccaef01e63ad3339351/Connection/TcpConnection.php#L425-L432 | train | Returns the remote IP address | [
30522,
2270,
3853,
2131,
28578,
12184,
11514,
1006,
1007,
1063,
1002,
13433,
2015,
1027,
2358,
12171,
6873,
2015,
1006,
1002,
2023,
1011,
1028,
1035,
6556,
4215,
16200,
4757,
1010,
1005,
1024,
1005,
1007,
1025,
2065,
1006,
1002,
13433,
2015... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Database/Connection.php | Connection.withFreshQueryLog | protected function withFreshQueryLog($callback)
{
$loggingQueries = $this->loggingQueries;
// First we will back up the value of the logging queries property and then
// we'll be ready to run callbacks. This query log will also get cleared
// so we will have a new log of all the queries that are executed now.
$this->enableQueryLog();
$this->queryLog = [];
// Now we'll execute this callback and capture the result. Once it has been
// executed we will restore the value of query logging and give back the
// value of the callback so the original callers can have the results.
$result = $callback();
$this->loggingQueries = $loggingQueries;
return $result;
} | php | protected function withFreshQueryLog($callback)
{
$loggingQueries = $this->loggingQueries;
// First we will back up the value of the logging queries property and then
// we'll be ready to run callbacks. This query log will also get cleared
// so we will have a new log of all the queries that are executed now.
$this->enableQueryLog();
$this->queryLog = [];
// Now we'll execute this callback and capture the result. Once it has been
// executed we will restore the value of query logging and give back the
// value of the callback so the original callers can have the results.
$result = $callback();
$this->loggingQueries = $loggingQueries;
return $result;
} | [
"protected",
"function",
"withFreshQueryLog",
"(",
"$",
"callback",
")",
"{",
"$",
"loggingQueries",
"=",
"$",
"this",
"->",
"loggingQueries",
";",
"// First we will back up the value of the logging queries property and then",
"// we'll be ready to run callbacks. This query log wil... | Execute the given callback in "dry run" mode.
@param \Closure $callback
@return array | [
"Execute",
"the",
"given",
"callback",
"in",
"dry",
"run",
"mode",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Connection.php#L542-L561 | train | Executes the given callback and resets the query log. | [
30522,
5123,
3853,
2007,
19699,
9953,
4226,
23320,
8649,
1006,
1002,
2655,
5963,
1007,
1063,
1002,
15899,
4226,
5134,
1027,
1002,
2023,
1011,
1028,
15899,
4226,
5134,
1025,
1013,
1013,
2034,
2057,
2097,
2067,
2039,
1996,
3643,
1997,
1996,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/SitesManager/API.php | API.setKeepURLFragmentsGlobal | public function setKeepURLFragmentsGlobal($enabled)
{
Piwik::checkUserHasSuperUserAccess();
// update option
Option::set(self::OPTION_KEEP_URL_FRAGMENTS_GLOBAL, $enabled);
// make sure tracker cache will reflect change
Cache::deleteTrackerCache();
} | php | public function setKeepURLFragmentsGlobal($enabled)
{
Piwik::checkUserHasSuperUserAccess();
// update option
Option::set(self::OPTION_KEEP_URL_FRAGMENTS_GLOBAL, $enabled);
// make sure tracker cache will reflect change
Cache::deleteTrackerCache();
} | [
"public",
"function",
"setKeepURLFragmentsGlobal",
"(",
"$",
"enabled",
")",
"{",
"Piwik",
"::",
"checkUserHasSuperUserAccess",
"(",
")",
";",
"// update option",
"Option",
"::",
"set",
"(",
"self",
"::",
"OPTION_KEEP_URL_FRAGMENTS_GLOBAL",
",",
"$",
"enabled",
")",... | Sets whether the default behavior should be to keep URL fragments when
tracking or not.
@param $enabled bool If true, the default behavior will be to keep URL
fragments when tracking. If false, the default
behavior will be to remove them. | [
"Sets",
"whether",
"the",
"default",
"behavior",
"should",
"be",
"to",
"keep",
"URL",
"fragments",
"when",
"tracking",
"or",
"not",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/SitesManager/API.php#L1111-L1120 | train | Sets whether URL fragments should be kept in the global context | [
30522,
2270,
3853,
2275,
20553,
5311,
10270,
29181,
8163,
23296,
16429,
2389,
1006,
1002,
9124,
1007,
1063,
14255,
9148,
2243,
1024,
1024,
4638,
20330,
14949,
6342,
4842,
20330,
6305,
9623,
2015,
1006,
1007,
1025,
1013,
1013,
10651,
5724,
5... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Config/Loader/Loader.php | Loader.import | public function import($resource, $type = null)
{
return $this->resolve($resource, $type)->load($resource, $type);
} | php | public function import($resource, $type = null)
{
return $this->resolve($resource, $type)->load($resource, $type);
} | [
"public",
"function",
"import",
"(",
"$",
"resource",
",",
"$",
"type",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"resolve",
"(",
"$",
"resource",
",",
"$",
"type",
")",
"->",
"load",
"(",
"$",
"resource",
",",
"$",
"type",
")",
";",
"}... | Imports a resource.
@param mixed $resource A resource
@param string|null $type The resource type or null if unknown
@return mixed | [
"Imports",
"a",
"resource",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Config/Loader/Loader.php#L49-L52 | train | Import a resource into the current context | [
30522,
2270,
3853,
12324,
1006,
1002,
7692,
1010,
1002,
2828,
1027,
19701,
1007,
1063,
2709,
1002,
2023,
1011,
1028,
10663,
1006,
1002,
7692,
1010,
1002,
2828,
1007,
1011,
1028,
7170,
1006,
1002,
7692,
1010,
1002,
2828,
1007,
1025,
1065,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Database/Connectors/ConnectionFactory.php | ConnectionFactory.createReadWriteConnection | protected function createReadWriteConnection(array $config)
{
$connection = $this->createSingleConnection($this->getWriteConfig($config));
return $connection->setReadPdo($this->createReadPdo($config));
} | php | protected function createReadWriteConnection(array $config)
{
$connection = $this->createSingleConnection($this->getWriteConfig($config));
return $connection->setReadPdo($this->createReadPdo($config));
} | [
"protected",
"function",
"createReadWriteConnection",
"(",
"array",
"$",
"config",
")",
"{",
"$",
"connection",
"=",
"$",
"this",
"->",
"createSingleConnection",
"(",
"$",
"this",
"->",
"getWriteConfig",
"(",
"$",
"config",
")",
")",
";",
"return",
"$",
"con... | Create a single database connection instance.
@param array $config
@return \Illuminate\Database\Connection | [
"Create",
"a",
"single",
"database",
"connection",
"instance",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Connectors/ConnectionFactory.php#L86-L91 | train | Create a connection to read and write. | [
30522,
5123,
3853,
3443,
16416,
2094,
26373,
8663,
2638,
7542,
1006,
9140,
1002,
9530,
8873,
2290,
1007,
1063,
1002,
4434,
1027,
1002,
2023,
1011,
1028,
9005,
2075,
2571,
8663,
2638,
7542,
1006,
1002,
2023,
1011,
1028,
2131,
26373,
8663,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/API/RowEvolution.php | RowEvolution.getMultiRowEvolution | private function getMultiRowEvolution(DataTable\Map $dataTable, $metadata, $apiModule, $apiAction, $labels, $column,
$legendAppendMetric = true,
$labelUseAbsoluteUrl = true)
{
if (!isset($metadata['metrics'][$column])) {
// invalid column => use the first one that's available
$metrics = array_keys($metadata['metrics']);
$column = reset($metrics);
}
// get the processed label and logo (if any) for every requested label
$actualLabels = $logos = array();
foreach ($labels as $labelIdx => $label) {
foreach ($dataTable->getDataTables() as $table) {
$labelRow = $this->getRowEvolutionRowFromLabelIdx($table, $labelIdx);
if ($labelRow) {
$actualLabels[$labelIdx] = $this->getRowUrlForEvolutionLabel(
$labelRow, $apiModule, $apiAction, $labelUseAbsoluteUrl);
$prettyLabel = $labelRow->getColumn('label_html');
if ($prettyLabel !== false) {
$actualLabels[$labelIdx] = $prettyLabel;
}
$logos[$labelIdx] = $labelRow->getMetadata('logo');
if (!empty($actualLabels[$labelIdx])) {
break;
}
}
}
if (empty($actualLabels[$labelIdx])) {
$cleanLabel = $this->cleanOriginalLabel($label);
$actualLabels[$labelIdx] = $cleanLabel;
}
}
// convert rows to be array($column.'_'.$labelIdx => $value) as opposed to
// array('label' => $label, 'column' => $value).
$dataTableMulti = $dataTable->getEmptyClone();
foreach ($dataTable->getDataTables() as $tableLabel => $table) {
$newRow = new Row();
foreach ($labels as $labelIdx => $label) {
$row = $this->getRowEvolutionRowFromLabelIdx($table, $labelIdx);
$value = 0;
if ($row) {
$value = $row->getColumn($column);
$value = floatVal(str_replace(',', '.', $value));
}
if ($value == '') {
$value = 0;
}
$newLabel = $column . '_' . (int)$labelIdx;
$newRow->addColumn($newLabel, $value);
}
$newTable = $table->getEmptyClone();
if (!empty($labels)) { // only add a row if the row has data (no labels === no data)
$newTable->addRow($newRow);
}
$dataTableMulti->addTable($newTable, $tableLabel);
}
// the available metrics for the report are returned as metadata / columns
$metadata['columns'] = $metadata['metrics'];
// metadata / metrics should document the rows that are compared
// this way, UI code can be reused
$metadata['metrics'] = array();
foreach ($actualLabels as $labelIndex => $label) {
if ($legendAppendMetric) {
$label .= ' (' . $metadata['columns'][$column] . ')';
}
$metricName = $column . '_' . $labelIndex;
$metadata['metrics'][$metricName] = $label;
if (!empty($logos[$labelIndex])) {
$metadata['logos'][$metricName] = $logos[$labelIndex];
}
}
$this->enhanceRowEvolutionMetaData($metadata, $dataTableMulti);
return array(
'column' => $column,
'reportData' => $dataTableMulti,
'metadata' => $metadata
);
} | php | private function getMultiRowEvolution(DataTable\Map $dataTable, $metadata, $apiModule, $apiAction, $labels, $column,
$legendAppendMetric = true,
$labelUseAbsoluteUrl = true)
{
if (!isset($metadata['metrics'][$column])) {
// invalid column => use the first one that's available
$metrics = array_keys($metadata['metrics']);
$column = reset($metrics);
}
// get the processed label and logo (if any) for every requested label
$actualLabels = $logos = array();
foreach ($labels as $labelIdx => $label) {
foreach ($dataTable->getDataTables() as $table) {
$labelRow = $this->getRowEvolutionRowFromLabelIdx($table, $labelIdx);
if ($labelRow) {
$actualLabels[$labelIdx] = $this->getRowUrlForEvolutionLabel(
$labelRow, $apiModule, $apiAction, $labelUseAbsoluteUrl);
$prettyLabel = $labelRow->getColumn('label_html');
if ($prettyLabel !== false) {
$actualLabels[$labelIdx] = $prettyLabel;
}
$logos[$labelIdx] = $labelRow->getMetadata('logo');
if (!empty($actualLabels[$labelIdx])) {
break;
}
}
}
if (empty($actualLabels[$labelIdx])) {
$cleanLabel = $this->cleanOriginalLabel($label);
$actualLabels[$labelIdx] = $cleanLabel;
}
}
// convert rows to be array($column.'_'.$labelIdx => $value) as opposed to
// array('label' => $label, 'column' => $value).
$dataTableMulti = $dataTable->getEmptyClone();
foreach ($dataTable->getDataTables() as $tableLabel => $table) {
$newRow = new Row();
foreach ($labels as $labelIdx => $label) {
$row = $this->getRowEvolutionRowFromLabelIdx($table, $labelIdx);
$value = 0;
if ($row) {
$value = $row->getColumn($column);
$value = floatVal(str_replace(',', '.', $value));
}
if ($value == '') {
$value = 0;
}
$newLabel = $column . '_' . (int)$labelIdx;
$newRow->addColumn($newLabel, $value);
}
$newTable = $table->getEmptyClone();
if (!empty($labels)) { // only add a row if the row has data (no labels === no data)
$newTable->addRow($newRow);
}
$dataTableMulti->addTable($newTable, $tableLabel);
}
// the available metrics for the report are returned as metadata / columns
$metadata['columns'] = $metadata['metrics'];
// metadata / metrics should document the rows that are compared
// this way, UI code can be reused
$metadata['metrics'] = array();
foreach ($actualLabels as $labelIndex => $label) {
if ($legendAppendMetric) {
$label .= ' (' . $metadata['columns'][$column] . ')';
}
$metricName = $column . '_' . $labelIndex;
$metadata['metrics'][$metricName] = $label;
if (!empty($logos[$labelIndex])) {
$metadata['logos'][$metricName] = $logos[$labelIndex];
}
}
$this->enhanceRowEvolutionMetaData($metadata, $dataTableMulti);
return array(
'column' => $column,
'reportData' => $dataTableMulti,
'metadata' => $metadata
);
} | [
"private",
"function",
"getMultiRowEvolution",
"(",
"DataTable",
"\\",
"Map",
"$",
"dataTable",
",",
"$",
"metadata",
",",
"$",
"apiModule",
",",
"$",
"apiAction",
",",
"$",
"labels",
",",
"$",
"column",
",",
"$",
"legendAppendMetric",
"=",
"true",
",",
"$... | Get row evolution for a multiple labels | [
"Get",
"row",
"evolution",
"for",
"a",
"multiple",
"labels"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/API/RowEvolution.php#L417-L512 | train | Returns multi row evolution | [
30522,
2797,
3853,
2131,
12274,
7096,
9711,
8545,
6767,
7630,
3508,
1006,
2951,
10880,
1032,
4949,
1002,
2951,
10880,
1010,
1002,
27425,
1010,
1002,
17928,
5302,
8566,
2571,
1010,
1002,
17928,
18908,
3258,
1010,
1002,
10873,
1010,
1002,
593... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Transfer/Client.php | Client.toBankCard | public function toBankCard(array $params)
{
foreach (['bank_code', 'partner_trade_no', 'enc_bank_no', 'enc_true_name', 'amount'] as $key) {
if (empty($params[$key])) {
throw new RuntimeException(\sprintf('"%s" is required.', $key));
}
}
$publicKey = file_get_contents($this->app['config']->get('rsa_public_key_path'));
$params['enc_bank_no'] = rsa_public_encrypt($params['enc_bank_no'], $publicKey);
$params['enc_true_name'] = rsa_public_encrypt($params['enc_true_name'], $publicKey);
return $this->safeRequest('mmpaysptrans/pay_bank', $params);
} | php | public function toBankCard(array $params)
{
foreach (['bank_code', 'partner_trade_no', 'enc_bank_no', 'enc_true_name', 'amount'] as $key) {
if (empty($params[$key])) {
throw new RuntimeException(\sprintf('"%s" is required.', $key));
}
}
$publicKey = file_get_contents($this->app['config']->get('rsa_public_key_path'));
$params['enc_bank_no'] = rsa_public_encrypt($params['enc_bank_no'], $publicKey);
$params['enc_true_name'] = rsa_public_encrypt($params['enc_true_name'], $publicKey);
return $this->safeRequest('mmpaysptrans/pay_bank', $params);
} | [
"public",
"function",
"toBankCard",
"(",
"array",
"$",
"params",
")",
"{",
"foreach",
"(",
"[",
"'bank_code'",
",",
"'partner_trade_no'",
",",
"'enc_bank_no'",
",",
"'enc_true_name'",
",",
"'amount'",
"]",
"as",
"$",
"key",
")",
"{",
"if",
"(",
"empty",
"(... | Send MerchantPay to BankCard.
@param array $params
@return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string
@throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
@throws \EasyWeChat\Kernel\Exceptions\RuntimeException | [
"Send",
"MerchantPay",
"to",
"BankCard",
"."
] | 120c72faaa93c270365bc75c73c362d5fd583209 | https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/Payment/Transfer/Client.php#L99-L113 | train | Pay bank card | [
30522,
2270,
3853,
2000,
9299,
11522,
1006,
9140,
1002,
11498,
5244,
1007,
1063,
18921,
6776,
1006,
1031,
1005,
2924,
1035,
3642,
1005,
1010,
1005,
4256,
1035,
3119,
1035,
2053,
1005,
1010,
1005,
4372,
2278,
1035,
2924,
1035,
2053,
1005,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Database/Connection.php | Connection.handleQueryException | protected function handleQueryException($e, $query, $bindings, Closure $callback)
{
if ($this->transactions >= 1) {
throw $e;
}
return $this->tryAgainIfCausedByLostConnection(
$e, $query, $bindings, $callback
);
} | php | protected function handleQueryException($e, $query, $bindings, Closure $callback)
{
if ($this->transactions >= 1) {
throw $e;
}
return $this->tryAgainIfCausedByLostConnection(
$e, $query, $bindings, $callback
);
} | [
"protected",
"function",
"handleQueryException",
"(",
"$",
"e",
",",
"$",
"query",
",",
"$",
"bindings",
",",
"Closure",
"$",
"callback",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"transactions",
">=",
"1",
")",
"{",
"throw",
"$",
"e",
";",
"}",
"retur... | Handle a query exception.
@param \Exception $e
@param string $query
@param array $bindings
@param \Closure $callback
@return mixed
@throws \Exception | [
"Handle",
"a",
"query",
"exception",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Connection.php#L711-L720 | train | Handle query exception | [
30522,
5123,
3853,
5047,
4226,
2854,
10288,
24422,
1006,
1002,
1041,
1010,
1002,
23032,
1010,
1002,
8031,
2015,
1010,
8503,
1002,
2655,
5963,
1007,
1063,
2065,
1006,
1002,
2023,
1011,
1028,
11817,
1028,
1027,
1015,
1007,
1063,
5466,
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/VarDumper/Dumper/CliDumper.php | CliDumper.isWindowsTrueColor | private function isWindowsTrueColor()
{
$result = 183 <= getenv('ANSICON_VER')
|| 'ON' === getenv('ConEmuANSI')
|| 'xterm' === getenv('TERM')
|| 'Hyper' === getenv('TERM_PROGRAM');
if (!$result && \PHP_VERSION_ID >= 70200) {
$version = sprintf(
'%s.%s.%s',
PHP_WINDOWS_VERSION_MAJOR,
PHP_WINDOWS_VERSION_MINOR,
PHP_WINDOWS_VERSION_BUILD
);
$result = $version >= '10.0.15063';
}
return $result;
} | php | private function isWindowsTrueColor()
{
$result = 183 <= getenv('ANSICON_VER')
|| 'ON' === getenv('ConEmuANSI')
|| 'xterm' === getenv('TERM')
|| 'Hyper' === getenv('TERM_PROGRAM');
if (!$result && \PHP_VERSION_ID >= 70200) {
$version = sprintf(
'%s.%s.%s',
PHP_WINDOWS_VERSION_MAJOR,
PHP_WINDOWS_VERSION_MINOR,
PHP_WINDOWS_VERSION_BUILD
);
$result = $version >= '10.0.15063';
}
return $result;
} | [
"private",
"function",
"isWindowsTrueColor",
"(",
")",
"{",
"$",
"result",
"=",
"183",
"<=",
"getenv",
"(",
"'ANSICON_VER'",
")",
"||",
"'ON'",
"===",
"getenv",
"(",
"'ConEmuANSI'",
")",
"||",
"'xterm'",
"===",
"getenv",
"(",
"'TERM'",
")",
"||",
"'Hyper'"... | Returns true if the Windows terminal supports true color.
Note that this does not check an output stream, but relies on environment
variables from known implementations, or a PHP and Windows version that
supports true color.
@return bool | [
"Returns",
"true",
"if",
"the",
"Windows",
"terminal",
"supports",
"true",
"color",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/VarDumper/Dumper/CliDumper.php#L615-L633 | train | Returns true if the current environment is on windows true color | [
30522,
2797,
3853,
2003,
11101,
15568,
16344,
5657,
18717,
1006,
1007,
1063,
1002,
2765,
1027,
18677,
1026,
1027,
2131,
2368,
2615,
1006,
1005,
2019,
19570,
2239,
1035,
2310,
2099,
1005,
1007,
1064,
1064,
1005,
2006,
1005,
1027,
1027,
1027,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
guzzle/guzzle | src/Handler/CurlFactory.php | CurlFactory.finish | public static function finish(
callable $handler,
EasyHandle $easy,
CurlFactoryInterface $factory
) {
if (isset($easy->options['on_stats'])) {
self::invokeStats($easy);
}
if (!$easy->response || $easy->errno) {
return self::finishError($handler, $easy, $factory);
}
// Return the response if it is present and there is no error.
$factory->release($easy);
// Rewind the body of the response if possible.
$body = $easy->response->getBody();
if ($body->isSeekable()) {
$body->rewind();
}
return new FulfilledPromise($easy->response);
} | php | public static function finish(
callable $handler,
EasyHandle $easy,
CurlFactoryInterface $factory
) {
if (isset($easy->options['on_stats'])) {
self::invokeStats($easy);
}
if (!$easy->response || $easy->errno) {
return self::finishError($handler, $easy, $factory);
}
// Return the response if it is present and there is no error.
$factory->release($easy);
// Rewind the body of the response if possible.
$body = $easy->response->getBody();
if ($body->isSeekable()) {
$body->rewind();
}
return new FulfilledPromise($easy->response);
} | [
"public",
"static",
"function",
"finish",
"(",
"callable",
"$",
"handler",
",",
"EasyHandle",
"$",
"easy",
",",
"CurlFactoryInterface",
"$",
"factory",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"easy",
"->",
"options",
"[",
"'on_stats'",
"]",
")",
")",
"{"... | Completes a cURL transaction, either returning a response promise or a
rejected promise.
@param callable $handler
@param EasyHandle $easy
@param CurlFactoryInterface $factory Dictates how the handle is released
@return \GuzzleHttp\Promise\PromiseInterface | [
"Completes",
"a",
"cURL",
"transaction",
"either",
"returning",
"a",
"response",
"promise",
"or",
"a",
"rejected",
"promise",
"."
] | bf595424e4d442a190582e088985dc835a789071 | https://github.com/guzzle/guzzle/blob/bf595424e4d442a190582e088985dc835a789071/src/Handler/CurlFactory.php#L95-L118 | train | Finish the request | [
30522,
2270,
10763,
3853,
3926,
1006,
2655,
3085,
1002,
28213,
1010,
3733,
11774,
2571,
1002,
3733,
1010,
15390,
21450,
18447,
2121,
12172,
1002,
4713,
1007,
1063,
2065,
1006,
26354,
3388,
1006,
1002,
3733,
1011,
1028,
7047,
1031,
1005,
200... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
PHPMailer/PHPMailer | src/PHPMailer.php | PHPMailer.isQmail | public function isQmail()
{
$ini_sendmail_path = ini_get('sendmail_path');
if (false === stripos($ini_sendmail_path, 'qmail')) {
$this->Sendmail = '/var/qmail/bin/qmail-inject';
} else {
$this->Sendmail = $ini_sendmail_path;
}
$this->Mailer = 'qmail';
} | php | public function isQmail()
{
$ini_sendmail_path = ini_get('sendmail_path');
if (false === stripos($ini_sendmail_path, 'qmail')) {
$this->Sendmail = '/var/qmail/bin/qmail-inject';
} else {
$this->Sendmail = $ini_sendmail_path;
}
$this->Mailer = 'qmail';
} | [
"public",
"function",
"isQmail",
"(",
")",
"{",
"$",
"ini_sendmail_path",
"=",
"ini_get",
"(",
"'sendmail_path'",
")",
";",
"if",
"(",
"false",
"===",
"stripos",
"(",
"$",
"ini_sendmail_path",
",",
"'qmail'",
")",
")",
"{",
"$",
"this",
"->",
"Sendmail",
... | Send messages using qmail. | [
"Send",
"messages",
"using",
"qmail",
"."
] | 3d7132341659a8a201adbc3ba11b1e202ee2857c | https://github.com/PHPMailer/PHPMailer/blob/3d7132341659a8a201adbc3ba11b1e202ee2857c/src/PHPMailer.php#L925-L935 | train | Is Qmail? - Ensures that the sendmail path is set in the current context | [
30522,
2270,
3853,
2003,
4160,
21397,
1006,
1007,
1063,
1002,
1999,
2072,
1035,
4604,
21397,
1035,
4130,
1027,
1999,
2072,
1035,
2131,
1006,
1005,
4604,
21397,
1035,
4130,
1005,
1007,
1025,
2065,
1006,
6270,
1027,
1027,
1027,
6167,
2891,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/Zend/Db/Adapter/Sqlsrv.php | Zend_Db_Adapter_Sqlsrv.lastInsertId | public function lastInsertId($tableName = null, $primaryKey = null)
{
if ($tableName) {
$tableName = $this->quote($tableName);
$sql = 'SELECT IDENT_CURRENT (' . $tableName . ') as Current_Identity';
return (string) $this->fetchOne($sql);
}
if ($this->_lastInsertId > 0) {
return (string) $this->_lastInsertId;
}
$sql = $this->_lastInsertSQL;
return (string) $this->fetchOne($sql);
} | php | public function lastInsertId($tableName = null, $primaryKey = null)
{
if ($tableName) {
$tableName = $this->quote($tableName);
$sql = 'SELECT IDENT_CURRENT (' . $tableName . ') as Current_Identity';
return (string) $this->fetchOne($sql);
}
if ($this->_lastInsertId > 0) {
return (string) $this->_lastInsertId;
}
$sql = $this->_lastInsertSQL;
return (string) $this->fetchOne($sql);
} | [
"public",
"function",
"lastInsertId",
"(",
"$",
"tableName",
"=",
"null",
",",
"$",
"primaryKey",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"tableName",
")",
"{",
"$",
"tableName",
"=",
"$",
"this",
"->",
"quote",
"(",
"$",
"tableName",
")",
";",
"$",
... | Gets the last ID generated automatically by an IDENTITY/AUTOINCREMENT column.
As a convention, on RDBMS brands that support sequences
(e.g. Oracle, PostgreSQL, DB2), this method forms the name of a sequence
from the arguments and returns the last id generated by that sequence.
On RDBMS brands that support IDENTITY/AUTOINCREMENT columns, this method
returns the last value generated for such a column, and the table name
argument is disregarded.
@param string $tableName OPTIONAL Name of table.
@param string $primaryKey OPTIONAL Name of primary key column.
@return string | [
"Gets",
"the",
"last",
"ID",
"generated",
"automatically",
"by",
"an",
"IDENTITY",
"/",
"AUTOINCREMENT",
"column",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Adapter/Sqlsrv.php#L334-L348 | train | Return last insert ID | [
30522,
2270,
3853,
2197,
7076,
8743,
3593,
1006,
1002,
2795,
18442,
1027,
19701,
1010,
1002,
3078,
14839,
1027,
19701,
1007,
1063,
2065,
1006,
1002,
2795,
18442,
1007,
1063,
1002,
2795,
18442,
1027,
1002,
2023,
1011,
1028,
14686,
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... |
matomo-org/matomo | libs/Zend/Db/Adapter/Pdo/Pgsql.php | Zend_Db_Adapter_Pdo_Pgsql.lastSequenceId | public function lastSequenceId($sequenceName)
{
$this->_connect();
$sequenceName = str_replace($this->getQuoteIdentifierSymbol(), '', (string) $sequenceName);
$value = $this->fetchOne("SELECT CURRVAL("
. $this->quote($this->quoteIdentifier($sequenceName, true))
. ")");
return $value;
} | php | public function lastSequenceId($sequenceName)
{
$this->_connect();
$sequenceName = str_replace($this->getQuoteIdentifierSymbol(), '', (string) $sequenceName);
$value = $this->fetchOne("SELECT CURRVAL("
. $this->quote($this->quoteIdentifier($sequenceName, true))
. ")");
return $value;
} | [
"public",
"function",
"lastSequenceId",
"(",
"$",
"sequenceName",
")",
"{",
"$",
"this",
"->",
"_connect",
"(",
")",
";",
"$",
"sequenceName",
"=",
"str_replace",
"(",
"$",
"this",
"->",
"getQuoteIdentifierSymbol",
"(",
")",
",",
"''",
",",
"(",
"string",
... | Return the most recent value from the specified sequence in the database.
This is supported only on RDBMS brands that support sequences
(e.g. Oracle, PostgreSQL, DB2). Other RDBMS brands return null.
@param string $sequenceName
@return string | [
"Return",
"the",
"most",
"recent",
"value",
"from",
"the",
"specified",
"sequence",
"in",
"the",
"database",
".",
"This",
"is",
"supported",
"only",
"on",
"RDBMS",
"brands",
"that",
"support",
"sequences",
"(",
"e",
".",
"g",
".",
"Oracle",
"PostgreSQL",
"... | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Adapter/Pdo/Pgsql.php#L281-L289 | train | Get last sequence id | [
30522,
2270,
3853,
16180,
2063,
4226,
5897,
3593,
1006,
1002,
5537,
18442,
1007,
1063,
1002,
2023,
1011,
1028,
1035,
7532,
1006,
1007,
1025,
1002,
5537,
18442,
1027,
2358,
2099,
1035,
5672,
1006,
1002,
2023,
1011,
1028,
2131,
28940,
12184,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getgrav/grav | system/src/Grav/Common/Grav.php | Grav.setup | public function setup(string $environment = null)
{
if (isset($this->initialized['setup'])) {
return $this;
}
$this->initialized['setup'] = true;
$this->measureTime('_setup', 'Site Setup', function () use ($environment) {
// Force environment if passed to the method.
if ($environment) {
Setup::$environment = $environment;
}
$this['setup'];
$this['streams'];
});
return $this;
} | php | public function setup(string $environment = null)
{
if (isset($this->initialized['setup'])) {
return $this;
}
$this->initialized['setup'] = true;
$this->measureTime('_setup', 'Site Setup', function () use ($environment) {
// Force environment if passed to the method.
if ($environment) {
Setup::$environment = $environment;
}
$this['setup'];
$this['streams'];
});
return $this;
} | [
"public",
"function",
"setup",
"(",
"string",
"$",
"environment",
"=",
"null",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"initialized",
"[",
"'setup'",
"]",
")",
")",
"{",
"return",
"$",
"this",
";",
"}",
"$",
"this",
"->",
"initialized",... | Setup Grav instance using specific environment.
Initializes Grav streams by
@param string|null $environment
@return $this | [
"Setup",
"Grav",
"instance",
"using",
"specific",
"environment",
"."
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Grav.php#L152-L171 | train | Setup method. | [
30522,
2270,
3853,
16437,
1006,
5164,
1002,
4044,
1027,
19701,
1007,
1063,
2065,
1006,
26354,
3388,
1006,
1002,
2023,
1011,
1028,
3988,
3550,
1031,
1005,
16437,
1005,
1033,
1007,
1007,
1063,
2709,
1002,
2023,
1025,
1065,
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... |
getgrav/grav | system/src/Grav/Framework/Flex/Storage/SimpleStorage.php | SimpleStorage.updateRows | public function updateRows(array $rows): array
{
if (null === $this->data) {
$this->buildIndex();
}
$list = [];
foreach ($rows as $key => $row) {
$key = (string)$key;
if ($this->hasKey($key)) {
$this->data[$key] = $list[$key] = $row;
}
}
if ($list) {
$this->save();
}
return $list;
} | php | public function updateRows(array $rows): array
{
if (null === $this->data) {
$this->buildIndex();
}
$list = [];
foreach ($rows as $key => $row) {
$key = (string)$key;
if ($this->hasKey($key)) {
$this->data[$key] = $list[$key] = $row;
}
}
if ($list) {
$this->save();
}
return $list;
} | [
"public",
"function",
"updateRows",
"(",
"array",
"$",
"rows",
")",
":",
"array",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"data",
")",
"{",
"$",
"this",
"->",
"buildIndex",
"(",
")",
";",
"}",
"$",
"list",
"=",
"[",
"]",
";",
"foreach",... | {@inheritdoc}
@see FlexStorageInterface::updateRows() | [
"{"
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Framework/Flex/Storage/SimpleStorage.php#L136-L155 | train | Update rows of the table | [
30522,
2270,
3853,
10651,
10524,
2015,
1006,
9140,
1002,
10281,
1007,
1024,
9140,
1063,
2065,
1006,
19701,
1027,
1027,
1027,
1002,
2023,
1011,
1028,
2951,
1007,
1063,
1002,
2023,
1011,
1028,
3857,
22254,
10288,
1006,
1007,
1025,
1065,
1002,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
dompdf/dompdf | src/FrameDecorator/AbstractFrameDecorator.php | AbstractFrameDecorator.reset | function reset()
{
$this->_frame->reset();
$this->_counters = array();
$this->_cached_parent = null; //clear get_parent() cache
// Reset all children
foreach ($this->get_children() as $child) {
$child->reset();
}
} | php | function reset()
{
$this->_frame->reset();
$this->_counters = array();
$this->_cached_parent = null; //clear get_parent() cache
// Reset all children
foreach ($this->get_children() as $child) {
$child->reset();
}
} | [
"function",
"reset",
"(",
")",
"{",
"$",
"this",
"->",
"_frame",
"->",
"reset",
"(",
")",
";",
"$",
"this",
"->",
"_counters",
"=",
"array",
"(",
")",
";",
"$",
"this",
"->",
"_cached_parent",
"=",
"null",
";",
"//clear get_parent() cache",
"// Reset all... | Delegate calls to decorated frame object | [
"Delegate",
"calls",
"to",
"decorated",
"frame",
"object"
] | 75f13c700009be21a1965dc2c5b68a8708c22ba2 | https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/src/FrameDecorator/AbstractFrameDecorator.php#L177-L189 | train | Reset all frame counters and children | [
30522,
3853,
25141,
1006,
1007,
1063,
1002,
2023,
1011,
1028,
1035,
4853,
1011,
1028,
25141,
1006,
1007,
1025,
1002,
2023,
1011,
1028,
1035,
24094,
1027,
9140,
1006,
1007,
1025,
1002,
2023,
1011,
1028,
1035,
17053,
2094,
1035,
6687,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Database/Eloquent/Concerns/HasRelationships.php | HasRelationships.newMorphMany | protected function newMorphMany(Builder $query, Model $parent, $type, $id, $localKey)
{
return new MorphMany($query, $parent, $type, $id, $localKey);
} | php | protected function newMorphMany(Builder $query, Model $parent, $type, $id, $localKey)
{
return new MorphMany($query, $parent, $type, $id, $localKey);
} | [
"protected",
"function",
"newMorphMany",
"(",
"Builder",
"$",
"query",
",",
"Model",
"$",
"parent",
",",
"$",
"type",
",",
"$",
"id",
",",
"$",
"localKey",
")",
"{",
"return",
"new",
"MorphMany",
"(",
"$",
"query",
",",
"$",
"parent",
",",
"$",
"type... | Instantiate a new MorphMany relationship.
@param \Illuminate\Database\Eloquent\Builder $query
@param \Illuminate\Database\Eloquent\Model $parent
@param string $type
@param string $id
@param string $localKey
@return \Illuminate\Database\Eloquent\Relations\MorphMany | [
"Instantiate",
"a",
"new",
"MorphMany",
"relationship",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Concerns/HasRelationships.php#L431-L434 | train | Create a new MorphMany record | [
30522,
5123,
3853,
2047,
5302,
14536,
13890,
2100,
1006,
12508,
1002,
23032,
1010,
2944,
1002,
6687,
1010,
1002,
2828,
1010,
1002,
8909,
1010,
1002,
2334,
14839,
1007,
1063,
2709,
2047,
22822,
8458,
2386,
2100,
1006,
1002,
23032,
1010,
1002... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/cms/classes/CmsCompoundObject.php | CmsCompoundObject.getComponent | public function getComponent($componentName)
{
if (!($componentSection = $this->hasComponent($componentName))) {
return null;
}
return ComponentManager::instance()->makeComponent(
$componentName,
null,
$this->settings['components'][$componentSection]
);
} | php | public function getComponent($componentName)
{
if (!($componentSection = $this->hasComponent($componentName))) {
return null;
}
return ComponentManager::instance()->makeComponent(
$componentName,
null,
$this->settings['components'][$componentSection]
);
} | [
"public",
"function",
"getComponent",
"(",
"$",
"componentName",
")",
"{",
"if",
"(",
"!",
"(",
"$",
"componentSection",
"=",
"$",
"this",
"->",
"hasComponent",
"(",
"$",
"componentName",
")",
")",
")",
"{",
"return",
"null",
";",
"}",
"return",
"Compone... | Returns a component by its name.
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.
@param string $componentName Specifies the component name.
@return \Cms\Classes\ComponentBase Returns the component instance or null. | [
"Returns",
"a",
"component",
"by",
"its",
"name",
".",
"This",
"method",
"is",
"used",
"only",
"in",
"the",
"back",
"-",
"end",
"and",
"for",
"internal",
"system",
"needs",
"when",
"the",
"standard",
"way",
"to",
"access",
"components",
"is",
"not",
"an"... | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/CmsCompoundObject.php#L216-L227 | train | Returns a component object | [
30522,
2270,
3853,
2131,
9006,
29513,
3372,
1006,
1002,
6922,
18442,
1007,
1063,
2065,
1006,
999,
1006,
1002,
6177,
18491,
1027,
1002,
2023,
1011,
1028,
2038,
9006,
29513,
3372,
1006,
1002,
6922,
18442,
1007,
1007,
1007,
1063,
2709,
19701,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Toolbar.php | Toolbar.init | public function init()
{
$this->fillFromConfig([
'buttons',
'search',
]);
/*
* Prepare the search widget (optional)
*/
if (isset($this->search)) {
if (is_string($this->search)) {
$searchConfig = $this->makeConfig(['partial' => $this->search]);
}
else {
$searchConfig = $this->makeConfig($this->search);
}
$searchConfig->alias = $this->alias . 'Search';
$this->searchWidget = $this->makeWidget('Backend\Widgets\Search', $searchConfig);
$this->searchWidget->bindToController();
}
} | php | public function init()
{
$this->fillFromConfig([
'buttons',
'search',
]);
/*
* Prepare the search widget (optional)
*/
if (isset($this->search)) {
if (is_string($this->search)) {
$searchConfig = $this->makeConfig(['partial' => $this->search]);
}
else {
$searchConfig = $this->makeConfig($this->search);
}
$searchConfig->alias = $this->alias . 'Search';
$this->searchWidget = $this->makeWidget('Backend\Widgets\Search', $searchConfig);
$this->searchWidget->bindToController();
}
} | [
"public",
"function",
"init",
"(",
")",
"{",
"$",
"this",
"->",
"fillFromConfig",
"(",
"[",
"'buttons'",
",",
"'search'",
",",
"]",
")",
";",
"/*\n * Prepare the search widget (optional)\n */",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"search"... | Initialize the widget, called by the constructor and free from its parameters. | [
"Initialize",
"the",
"widget",
"called",
"by",
"the",
"constructor",
"and",
"free",
"from",
"its",
"parameters",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/Toolbar.php#L50-L73 | train | Initializes the search widget | [
30522,
2270,
3853,
1999,
4183,
1006,
1007,
1063,
1002,
2023,
1011,
1028,
6039,
19699,
5358,
8663,
8873,
2290,
1006,
1031,
1005,
11287,
1005,
1010,
1005,
3945,
1005,
1010,
1033,
1007,
1025,
1013,
1008,
1008,
7374,
1996,
3945,
15536,
24291,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/ArchiveProcessor/Rules.php | Rules.getDoneFlags | public static function getDoneFlags(array $plugins, Segment $segment)
{
$doneFlags = array();
$doneAllPlugins = self::getDoneFlagArchiveContainsAllPlugins($segment);
$doneFlags[$doneAllPlugins] = $doneAllPlugins;
$plugins = array_unique($plugins);
foreach ($plugins as $plugin) {
$doneOnePlugin = self::getDoneFlagArchiveContainsOnePlugin($segment, $plugin);
$doneFlags[$plugin] = $doneOnePlugin;
}
return $doneFlags;
} | php | public static function getDoneFlags(array $plugins, Segment $segment)
{
$doneFlags = array();
$doneAllPlugins = self::getDoneFlagArchiveContainsAllPlugins($segment);
$doneFlags[$doneAllPlugins] = $doneAllPlugins;
$plugins = array_unique($plugins);
foreach ($plugins as $plugin) {
$doneOnePlugin = self::getDoneFlagArchiveContainsOnePlugin($segment, $plugin);
$doneFlags[$plugin] = $doneOnePlugin;
}
return $doneFlags;
} | [
"public",
"static",
"function",
"getDoneFlags",
"(",
"array",
"$",
"plugins",
",",
"Segment",
"$",
"segment",
")",
"{",
"$",
"doneFlags",
"=",
"array",
"(",
")",
";",
"$",
"doneAllPlugins",
"=",
"self",
"::",
"getDoneFlagArchiveContainsAllPlugins",
"(",
"$",
... | Return done flags used to tell how the archiving process for a specific archive was completed,
@param array $plugins
@param $segment
@return array | [
"Return",
"done",
"flags",
"used",
"to",
"tell",
"how",
"the",
"archiving",
"process",
"for",
"a",
"specific",
"archive",
"was",
"completed"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/ArchiveProcessor/Rules.php#L101-L113 | train | Get done flags | [
30522,
2270,
10763,
3853,
2131,
5280,
12879,
17802,
2015,
1006,
9140,
1002,
13354,
7076,
1010,
6903,
1002,
6903,
1007,
1063,
1002,
2589,
10258,
26454,
1027,
9140,
1006,
1007,
1025,
1002,
2589,
8095,
24759,
15916,
7076,
1027,
2969,
1024,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Dotenv/Dotenv.php | Dotenv.load | public function load(string $path, string ...$extraPaths): void
{
$this->doLoad(false, \func_get_args());
} | php | public function load(string $path, string ...$extraPaths): void
{
$this->doLoad(false, \func_get_args());
} | [
"public",
"function",
"load",
"(",
"string",
"$",
"path",
",",
"string",
"...",
"$",
"extraPaths",
")",
":",
"void",
"{",
"$",
"this",
"->",
"doLoad",
"(",
"false",
",",
"\\",
"func_get_args",
"(",
")",
")",
";",
"}"
] | Loads one or several .env files.
@param string $path A file to load
@param ...string $extraPaths A list of additional files to load
@throws FormatException when a file has a syntax error
@throws PathException when a file does not exist or is not readable | [
"Loads",
"one",
"or",
"several",
".",
"env",
"files",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Dotenv/Dotenv.php#L63-L66 | train | Load a tree of terms into the current language. | [
30522,
2270,
3853,
7170,
1006,
5164,
1002,
4130,
1010,
5164,
1012,
1012,
1012,
1002,
4469,
15069,
2015,
1007,
1024,
11675,
1063,
1002,
2023,
1011,
1028,
2079,
11066,
1006,
6270,
1010,
1032,
4569,
2278,
1035,
2131,
1035,
12098,
5620,
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/ReportRenderer/Csv.php | Csv.sendToBrowserInline | public function sendToBrowserInline($filename)
{
ReportRenderer::sendToBrowser(
$filename,
ReportRenderer::CSV_FORMAT,
"application/" . ReportRenderer::CSV_FORMAT,
$this->getRenderedReport()
);
} | php | public function sendToBrowserInline($filename)
{
ReportRenderer::sendToBrowser(
$filename,
ReportRenderer::CSV_FORMAT,
"application/" . ReportRenderer::CSV_FORMAT,
$this->getRenderedReport()
);
} | [
"public",
"function",
"sendToBrowserInline",
"(",
"$",
"filename",
")",
"{",
"ReportRenderer",
"::",
"sendToBrowser",
"(",
"$",
"filename",
",",
"ReportRenderer",
"::",
"CSV_FORMAT",
",",
"\"application/\"",
".",
"ReportRenderer",
"::",
"CSV_FORMAT",
",",
"$",
"th... | Output rendering to browser
@param string $filename without path & without format extension | [
"Output",
"rendering",
"to",
"browser"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/ReportRenderer/Csv.php#L72-L80 | train | Sends the report to browser inline | [
30522,
2270,
3853,
4604,
3406,
12618,
9333,
23282,
4179,
1006,
1002,
5371,
18442,
1007,
1063,
3189,
7389,
4063,
2121,
1024,
1024,
4604,
3406,
12618,
9333,
2121,
1006,
1002,
5371,
18442,
1010,
3189,
7389,
4063,
2121,
1024,
1024,
20116,
2615,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/ConstraintViolationListNormalizer.php | ConstraintViolationListNormalizer.normalize | public function normalize($object, $format = null, array $context = [])
{
$violations = [];
$messages = [];
foreach ($object as $violation) {
$propertyPath = $this->nameConverter ? $this->nameConverter->normalize($violation->getPropertyPath(), null, $format, $context) : $violation->getPropertyPath();
$violationEntry = [
'propertyPath' => $propertyPath,
'title' => $violation->getMessage(),
'parameters' => $violation->getParameters(),
];
if (null !== $code = $violation->getCode()) {
$violationEntry['type'] = sprintf('urn:uuid:%s', $code);
}
$violations[] = $violationEntry;
$prefix = $propertyPath ? sprintf('%s: ', $propertyPath) : '';
$messages[] = $prefix.$violation->getMessage();
}
$result = [
'type' => $context[self::TYPE] ?? $this->defaultContext[self::TYPE] ?? 'https://symfony.com/errors/validation',
'title' => $context[self::TITLE] ?? $this->defaultContext[self::TITLE] ?? 'Validation Failed',
];
if (null !== $status = ($context[self::STATUS] ?? $this->defaultContext[self::STATUS] ?? null)) {
$result['status'] = $status;
}
if ($messages) {
$result['detail'] = implode("\n", $messages);
}
if (null !== $instance = ($context[self::INSTANCE] ?? $this->defaultContext[self::INSTANCE] ?? null)) {
$result['instance'] = $instance;
}
return $result + ['violations' => $violations];
} | php | public function normalize($object, $format = null, array $context = [])
{
$violations = [];
$messages = [];
foreach ($object as $violation) {
$propertyPath = $this->nameConverter ? $this->nameConverter->normalize($violation->getPropertyPath(), null, $format, $context) : $violation->getPropertyPath();
$violationEntry = [
'propertyPath' => $propertyPath,
'title' => $violation->getMessage(),
'parameters' => $violation->getParameters(),
];
if (null !== $code = $violation->getCode()) {
$violationEntry['type'] = sprintf('urn:uuid:%s', $code);
}
$violations[] = $violationEntry;
$prefix = $propertyPath ? sprintf('%s: ', $propertyPath) : '';
$messages[] = $prefix.$violation->getMessage();
}
$result = [
'type' => $context[self::TYPE] ?? $this->defaultContext[self::TYPE] ?? 'https://symfony.com/errors/validation',
'title' => $context[self::TITLE] ?? $this->defaultContext[self::TITLE] ?? 'Validation Failed',
];
if (null !== $status = ($context[self::STATUS] ?? $this->defaultContext[self::STATUS] ?? null)) {
$result['status'] = $status;
}
if ($messages) {
$result['detail'] = implode("\n", $messages);
}
if (null !== $instance = ($context[self::INSTANCE] ?? $this->defaultContext[self::INSTANCE] ?? null)) {
$result['instance'] = $instance;
}
return $result + ['violations' => $violations];
} | [
"public",
"function",
"normalize",
"(",
"$",
"object",
",",
"$",
"format",
"=",
"null",
",",
"array",
"$",
"context",
"=",
"[",
"]",
")",
"{",
"$",
"violations",
"=",
"[",
"]",
";",
"$",
"messages",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"objec... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Serializer/Normalizer/ConstraintViolationListNormalizer.php#L45-L82 | train | Normalize the object | [
30522,
2270,
3853,
3671,
4697,
1006,
1002,
4874,
1010,
1002,
4289,
1027,
19701,
1010,
9140,
1002,
6123,
1027,
1031,
1033,
1007,
1063,
1002,
13302,
1027,
1031,
1033,
1025,
1002,
7696,
1027,
1031,
1033,
1025,
18921,
6776,
1006,
1002,
4874,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/Zend/Cache/Frontend/File.php | Zend_Cache_Frontend_File.setMasterFiles | public function setMasterFiles(array $masterFiles)
{
$this->_specificOptions['master_file'] = null; // to keep a compatibility
$this->_specificOptions['master_files'] = null;
$this->_masterFile_mtimes = array();
clearstatcache();
$i = 0;
foreach ($masterFiles as $masterFile) {
if (file_exists($masterFile)) {
$mtime = filemtime($masterFile);
} else {
$mtime = false;
}
if (!$this->_specificOptions['ignore_missing_master_files'] && !$mtime) {
Zend_Cache::throwException('Unable to read master_file : ' . $masterFile);
}
$this->_masterFile_mtimes[$i] = $mtime;
$this->_specificOptions['master_files'][$i] = $masterFile;
if ($i === 0) { // to keep a compatibility
$this->_specificOptions['master_file'] = $masterFile;
}
$i++;
}
} | php | public function setMasterFiles(array $masterFiles)
{
$this->_specificOptions['master_file'] = null; // to keep a compatibility
$this->_specificOptions['master_files'] = null;
$this->_masterFile_mtimes = array();
clearstatcache();
$i = 0;
foreach ($masterFiles as $masterFile) {
if (file_exists($masterFile)) {
$mtime = filemtime($masterFile);
} else {
$mtime = false;
}
if (!$this->_specificOptions['ignore_missing_master_files'] && !$mtime) {
Zend_Cache::throwException('Unable to read master_file : ' . $masterFile);
}
$this->_masterFile_mtimes[$i] = $mtime;
$this->_specificOptions['master_files'][$i] = $masterFile;
if ($i === 0) { // to keep a compatibility
$this->_specificOptions['master_file'] = $masterFile;
}
$i++;
}
} | [
"public",
"function",
"setMasterFiles",
"(",
"array",
"$",
"masterFiles",
")",
"{",
"$",
"this",
"->",
"_specificOptions",
"[",
"'master_file'",
"]",
"=",
"null",
";",
"// to keep a compatibility",
"$",
"this",
"->",
"_specificOptions",
"[",
"'master_files'",
"]",... | Change the master_files option
@param array $masterFiles the complete paths and name of the master files | [
"Change",
"the",
"master_files",
"option"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Cache/Frontend/File.php#L104-L131 | train | Set master files | [
30522,
2270,
3853,
2275,
8706,
8873,
4244,
1006,
9140,
1002,
3040,
8873,
4244,
1007,
1063,
1002,
2023,
1011,
1028,
1035,
3563,
7361,
9285,
1031,
1005,
3040,
1035,
5371,
1005,
1033,
1027,
19701,
1025,
1013,
1013,
2000,
2562,
1037,
21778,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Security/Http/RememberMe/AbstractRememberMeServices.php | AbstractRememberMeServices.encodeCookie | protected function encodeCookie(array $cookieParts)
{
foreach ($cookieParts as $cookiePart) {
if (false !== strpos($cookiePart, self::COOKIE_DELIMITER)) {
throw new \InvalidArgumentException(sprintf('$cookieParts should not contain the cookie delimiter "%s"', self::COOKIE_DELIMITER));
}
}
return base64_encode(implode(self::COOKIE_DELIMITER, $cookieParts));
} | php | protected function encodeCookie(array $cookieParts)
{
foreach ($cookieParts as $cookiePart) {
if (false !== strpos($cookiePart, self::COOKIE_DELIMITER)) {
throw new \InvalidArgumentException(sprintf('$cookieParts should not contain the cookie delimiter "%s"', self::COOKIE_DELIMITER));
}
}
return base64_encode(implode(self::COOKIE_DELIMITER, $cookieParts));
} | [
"protected",
"function",
"encodeCookie",
"(",
"array",
"$",
"cookieParts",
")",
"{",
"foreach",
"(",
"$",
"cookieParts",
"as",
"$",
"cookiePart",
")",
"{",
"if",
"(",
"false",
"!==",
"strpos",
"(",
"$",
"cookiePart",
",",
"self",
"::",
"COOKIE_DELIMITER",
... | Encodes the cookie parts.
@return string
@throws \InvalidArgumentException When $cookieParts contain the cookie delimiter. Extending class should either remove or escape it. | [
"Encodes",
"the",
"cookie",
"parts",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Security/Http/RememberMe/AbstractRememberMeServices.php#L254-L263 | train | Encodes the cookie parts | [
30522,
5123,
3853,
4372,
16044,
3597,
23212,
2063,
1006,
9140,
1002,
17387,
26950,
1007,
1063,
18921,
6776,
1006,
1002,
17387,
26950,
2004,
1002,
17387,
19362,
2102,
1007,
1063,
2065,
1006,
6270,
999,
1027,
1027,
2358,
14536,
2891,
1006,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Validation/Concerns/ValidatesAttributes.php | ValidatesAttributes.failsRatioCheck | protected function failsRatioCheck($parameters, $width, $height)
{
if (! isset($parameters['ratio'])) {
return false;
}
[$numerator, $denominator] = array_replace(
[1, 1], array_filter(sscanf($parameters['ratio'], '%f/%d'))
);
$precision = 1 / max($width, $height);
return abs($numerator / $denominator - $width / $height) > $precision;
} | php | protected function failsRatioCheck($parameters, $width, $height)
{
if (! isset($parameters['ratio'])) {
return false;
}
[$numerator, $denominator] = array_replace(
[1, 1], array_filter(sscanf($parameters['ratio'], '%f/%d'))
);
$precision = 1 / max($width, $height);
return abs($numerator / $denominator - $width / $height) > $precision;
} | [
"protected",
"function",
"failsRatioCheck",
"(",
"$",
"parameters",
",",
"$",
"width",
",",
"$",
"height",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"parameters",
"[",
"'ratio'",
"]",
")",
")",
"{",
"return",
"false",
";",
"}",
"[",
"$",
"numerato... | Determine if the given parameters fail a dimension ratio check.
@param array $parameters
@param int $width
@param int $height
@return bool | [
"Determine",
"if",
"the",
"given",
"parameters",
"fail",
"a",
"dimension",
"ratio",
"check",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Validation/Concerns/ValidatesAttributes.php#L546-L559 | train | Checks if the ratio is too high | [
30522,
5123,
3853,
11896,
8609,
3695,
5403,
3600,
1006,
1002,
11709,
1010,
1002,
9381,
1010,
1002,
4578,
1007,
1063,
2065,
1006,
999,
26354,
3388,
1006,
1002,
11709,
1031,
1005,
6463,
1005,
1033,
1007,
1007,
1063,
2709,
6270,
1025,
1065,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/Db/Adapter/Mysqli.php | Mysqli.getClientVersion | public function getClientVersion()
{
$this->_connect();
$version = $this->_connection->server_version;
$major = (int)($version / 10000);
$minor = (int)($version % 10000 / 100);
$revision = (int)($version % 100);
return $major . '.' . $minor . '.' . $revision;
} | php | public function getClientVersion()
{
$this->_connect();
$version = $this->_connection->server_version;
$major = (int)($version / 10000);
$minor = (int)($version % 10000 / 100);
$revision = (int)($version % 100);
return $major . '.' . $minor . '.' . $revision;
} | [
"public",
"function",
"getClientVersion",
"(",
")",
"{",
"$",
"this",
"->",
"_connect",
"(",
")",
";",
"$",
"version",
"=",
"$",
"this",
"->",
"_connection",
"->",
"server_version",
";",
"$",
"major",
"=",
"(",
"int",
")",
"(",
"$",
"version",
"/",
"... | Get client version
@return string | [
"Get",
"client",
"version"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Db/Adapter/Mysqli.php#L233-L243 | train | Get client version | [
30522,
2270,
3853,
2131,
20464,
11638,
27774,
1006,
1007,
1063,
1002,
2023,
1011,
1028,
1035,
7532,
1006,
1007,
1025,
1002,
2544,
1027,
1002,
2023,
1011,
1028,
1035,
4434,
1011,
1028,
8241,
1035,
2544,
1025,
1002,
2350,
1027,
1006,
20014,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Foundation/Application.php | Application.bootstrapWith | public function bootstrapWith(array $bootstrappers)
{
$this->hasBeenBootstrapped = true;
foreach ($bootstrappers as $bootstrapper) {
$this['events']->dispatch('bootstrapping: '.$bootstrapper, [$this]);
$this->make($bootstrapper)->bootstrap($this);
$this['events']->dispatch('bootstrapped: '.$bootstrapper, [$this]);
}
} | php | public function bootstrapWith(array $bootstrappers)
{
$this->hasBeenBootstrapped = true;
foreach ($bootstrappers as $bootstrapper) {
$this['events']->dispatch('bootstrapping: '.$bootstrapper, [$this]);
$this->make($bootstrapper)->bootstrap($this);
$this['events']->dispatch('bootstrapped: '.$bootstrapper, [$this]);
}
} | [
"public",
"function",
"bootstrapWith",
"(",
"array",
"$",
"bootstrappers",
")",
"{",
"$",
"this",
"->",
"hasBeenBootstrapped",
"=",
"true",
";",
"foreach",
"(",
"$",
"bootstrappers",
"as",
"$",
"bootstrapper",
")",
"{",
"$",
"this",
"[",
"'events'",
"]",
"... | Run the given array of bootstrap classes.
@param string[] $bootstrappers
@return void | [
"Run",
"the",
"given",
"array",
"of",
"bootstrap",
"classes",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Foundation/Application.php#L203-L214 | train | bootstraps the current class with the given bootstrappers | [
30522,
2270,
3853,
6879,
6494,
28400,
8939,
1006,
9140,
1002,
6879,
6494,
18620,
2015,
1007,
1063,
1002,
2023,
1011,
1028,
2038,
11306,
27698,
17206,
20528,
11469,
1027,
2995,
1025,
18921,
6776,
1006,
1002,
6879,
6494,
18620,
2015,
2004,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/cms/classes/Content.php | Content.getParsedMarkupAttribute | public function getParsedMarkupAttribute()
{
if (array_key_exists('parsedMarkup', $this->attributes)) {
return $this->attributes['parsedMarkup'];
}
return $this->attributes['parsedMarkup'] = $this->parseMarkup();
} | php | public function getParsedMarkupAttribute()
{
if (array_key_exists('parsedMarkup', $this->attributes)) {
return $this->attributes['parsedMarkup'];
}
return $this->attributes['parsedMarkup'] = $this->parseMarkup();
} | [
"public",
"function",
"getParsedMarkupAttribute",
"(",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"'parsedMarkup'",
",",
"$",
"this",
"->",
"attributes",
")",
")",
"{",
"return",
"$",
"this",
"->",
"attributes",
"[",
"'parsedMarkup'",
"]",
";",
"}",
"retu... | Returns a default value for parsedMarkup attribute.
@return string | [
"Returns",
"a",
"default",
"value",
"for",
"parsedMarkup",
"attribute",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/Content.php#L43-L50 | train | Get ParsedMarkup Attribute | [
30522,
2270,
3853,
2131,
19362,
6924,
10665,
6279,
19321,
3089,
8569,
2618,
1006,
1007,
1063,
2065,
1006,
9140,
1035,
3145,
1035,
6526,
1006,
1005,
11968,
6924,
10665,
6279,
1005,
1010,
1002,
2023,
1011,
1028,
12332,
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... |
matomo-org/matomo | core/Archive/ArchivePurger.php | ArchivePurger.purgeArchivesWithPeriodRange | public function purgeArchivesWithPeriodRange(Date $date)
{
$numericTable = ArchiveTableCreator::getNumericTable($date);
$blobTable = ArchiveTableCreator::getBlobTable($date);
$deletedCount = $this->model->deleteArchivesWithPeriod(
$numericTable, $blobTable, Piwik::$idPeriods['range'], $this->purgeCustomRangesOlderThan);
$level = $deletedCount == 0 ? LogLevel::DEBUG : LogLevel::INFO;
$this->logger->log($level, "Purged {count} range archive rows from {numericTable} & {blobTable}.", array(
'count' => $deletedCount,
'numericTable' => $numericTable,
'blobTable' => $blobTable
));
$this->logger->debug(" [ purged archives older than {threshold} ]", array('threshold' => $this->purgeCustomRangesOlderThan));
return $deletedCount;
} | php | public function purgeArchivesWithPeriodRange(Date $date)
{
$numericTable = ArchiveTableCreator::getNumericTable($date);
$blobTable = ArchiveTableCreator::getBlobTable($date);
$deletedCount = $this->model->deleteArchivesWithPeriod(
$numericTable, $blobTable, Piwik::$idPeriods['range'], $this->purgeCustomRangesOlderThan);
$level = $deletedCount == 0 ? LogLevel::DEBUG : LogLevel::INFO;
$this->logger->log($level, "Purged {count} range archive rows from {numericTable} & {blobTable}.", array(
'count' => $deletedCount,
'numericTable' => $numericTable,
'blobTable' => $blobTable
));
$this->logger->debug(" [ purged archives older than {threshold} ]", array('threshold' => $this->purgeCustomRangesOlderThan));
return $deletedCount;
} | [
"public",
"function",
"purgeArchivesWithPeriodRange",
"(",
"Date",
"$",
"date",
")",
"{",
"$",
"numericTable",
"=",
"ArchiveTableCreator",
"::",
"getNumericTable",
"(",
"$",
"date",
")",
";",
"$",
"blobTable",
"=",
"ArchiveTableCreator",
"::",
"getBlobTable",
"(",... | Deleting "Custom Date Range" reports after 1 day, since they can be re-processed and would take up un-necessary space.
@param $date Date
@return int The total number of rows deleted from both the numeric & blob table. | [
"Deleting",
"Custom",
"Date",
"Range",
"reports",
"after",
"1",
"day",
"since",
"they",
"can",
"be",
"re",
"-",
"processed",
"and",
"would",
"take",
"up",
"un",
"-",
"necessary",
"space",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Archive/ArchivePurger.php#L252-L270 | train | Purges all archives with a period range. | [
30522,
2270,
3853,
24694,
2906,
5428,
6961,
24415,
4842,
3695,
24914,
3351,
1006,
3058,
1002,
3058,
1007,
1063,
1002,
16371,
25531,
10880,
1027,
8756,
10880,
16748,
8844,
1024,
1024,
2131,
19172,
22420,
10880,
1006,
1002,
3058,
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 | libs/Zend/Db/Adapter/Pdo/Mysql.php | Zend_Db_Adapter_Pdo_Mysql._connect | protected function _connect()
{
if ($this->_connection) {
return;
}
if (!empty($this->_config['charset'])) {
$initCommand = "SET NAMES '" . $this->_config['charset'] . "'";
$this->_config['driver_options'][1002] = $initCommand; // 1002 = PDO::MYSQL_ATTR_INIT_COMMAND
}
parent::_connect();
} | php | protected function _connect()
{
if ($this->_connection) {
return;
}
if (!empty($this->_config['charset'])) {
$initCommand = "SET NAMES '" . $this->_config['charset'] . "'";
$this->_config['driver_options'][1002] = $initCommand; // 1002 = PDO::MYSQL_ATTR_INIT_COMMAND
}
parent::_connect();
} | [
"protected",
"function",
"_connect",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_connection",
")",
"{",
"return",
";",
"}",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"_config",
"[",
"'charset'",
"]",
")",
")",
"{",
"$",
"initCommand",
"="... | Creates a PDO object and connects to the database.
@return void
@throws Zend_Db_Adapter_Exception | [
"Creates",
"a",
"PDO",
"object",
"and",
"connects",
"to",
"the",
"database",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Adapter/Pdo/Mysql.php#L98-L110 | train | Connection to the database | [
30522,
5123,
3853,
1035,
7532,
1006,
1007,
1063,
2065,
1006,
1002,
2023,
1011,
1028,
1035,
4434,
1007,
1063,
2709,
1025,
1065,
2065,
1006,
999,
4064,
1006,
1002,
2023,
1011,
1028,
1035,
9530,
8873,
2290,
1031,
1005,
25869,
13462,
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... |
barryvdh/laravel-debugbar | src/LaravelDebugbar.php | LaravelDebugbar.addCollector | public function addCollector(DataCollectorInterface $collector)
{
parent::addCollector($collector);
if (method_exists($collector, 'useHtmlVarDumper')) {
$collector->useHtmlVarDumper();
}
return $this;
} | php | public function addCollector(DataCollectorInterface $collector)
{
parent::addCollector($collector);
if (method_exists($collector, 'useHtmlVarDumper')) {
$collector->useHtmlVarDumper();
}
return $this;
} | [
"public",
"function",
"addCollector",
"(",
"DataCollectorInterface",
"$",
"collector",
")",
"{",
"parent",
"::",
"addCollector",
"(",
"$",
"collector",
")",
";",
"if",
"(",
"method_exists",
"(",
"$",
"collector",
",",
"'useHtmlVarDumper'",
")",
")",
"{",
"$",
... | Adds a data collector
@param DataCollectorInterface $collector
@throws DebugBarException
@return $this | [
"Adds",
"a",
"data",
"collector"
] | 2d195779ea4f809f69764a795e2ec371dbb76a96 | https://github.com/barryvdh/laravel-debugbar/blob/2d195779ea4f809f69764a795e2ec371dbb76a96/src/LaravelDebugbar.php#L508-L517 | train | Add collector to the data source | [
30522,
2270,
3853,
5587,
26895,
22471,
2953,
1006,
2951,
26895,
22471,
28741,
3334,
12172,
1002,
10018,
1007,
1063,
6687,
1024,
1024,
5587,
26895,
22471,
2953,
1006,
1002,
10018,
1007,
1025,
2065,
1006,
4118,
1035,
6526,
1006,
1002,
10018,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Messenger/Transport/AmqpExt/AmqpReceiver.php | AmqpReceiver.ack | public function ack(Envelope $envelope): void
{
try {
$stamp = $this->findAmqpStamp($envelope);
$this->connection->ack(
$stamp->getAmqpEnvelope(),
$stamp->getQueueName()
);
} catch (\AMQPException $exception) {
throw new TransportException($exception->getMessage(), 0, $exception);
}
} | php | public function ack(Envelope $envelope): void
{
try {
$stamp = $this->findAmqpStamp($envelope);
$this->connection->ack(
$stamp->getAmqpEnvelope(),
$stamp->getQueueName()
);
} catch (\AMQPException $exception) {
throw new TransportException($exception->getMessage(), 0, $exception);
}
} | [
"public",
"function",
"ack",
"(",
"Envelope",
"$",
"envelope",
")",
":",
"void",
"{",
"try",
"{",
"$",
"stamp",
"=",
"$",
"this",
"->",
"findAmqpStamp",
"(",
"$",
"envelope",
")",
";",
"$",
"this",
"->",
"connection",
"->",
"ack",
"(",
"$",
"stamp",
... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Messenger/Transport/AmqpExt/AmqpReceiver.php#L81-L93 | train | Acknowledge an AMQP message | [
30522,
2270,
3853,
9353,
2243,
1006,
11255,
1002,
11255,
1007,
1024,
11675,
30524,
3286,
4160,
11837,
15985,
17635,
1006,
1007,
1010,
1002,
11359,
1011,
1028,
2131,
4226,
24997,
14074,
1006,
1007,
1007,
1025,
1065,
4608,
1006,
1032,
2572,
4... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/DataArray.php | DataArray.doSumVisitsMetrics | protected function doSumVisitsMetrics($newRowToAdd, &$oldRowToUpdate)
{
// Pre 1.2 format: string indexed rows are returned from the DB
// Left here for Backward compatibility with plugins doing custom SQL queries using these metrics as string
if (!isset($newRowToAdd[Metrics::INDEX_NB_VISITS])) {
$oldRowToUpdate[Metrics::INDEX_NB_VISITS] += $newRowToAdd['nb_visits'];
$oldRowToUpdate[Metrics::INDEX_NB_ACTIONS] += $newRowToAdd['nb_actions'];
$oldRowToUpdate[Metrics::INDEX_NB_UNIQ_VISITORS] += $newRowToAdd['nb_uniq_visitors'];
$oldRowToUpdate[Metrics::INDEX_NB_USERS] += $newRowToAdd['nb_users'];
$oldRowToUpdate[Metrics::INDEX_MAX_ACTIONS] = (float)max($newRowToAdd['max_actions'], $oldRowToUpdate[Metrics::INDEX_MAX_ACTIONS]);
$oldRowToUpdate[Metrics::INDEX_SUM_VISIT_LENGTH] += $newRowToAdd['sum_visit_length'];
$oldRowToUpdate[Metrics::INDEX_BOUNCE_COUNT] += $newRowToAdd['bounce_count'];
$oldRowToUpdate[Metrics::INDEX_NB_VISITS_CONVERTED] += $newRowToAdd['nb_visits_converted'];
return;
}
// Edge case fail safe
if (!isset($oldRowToUpdate[Metrics::INDEX_NB_VISITS])) {
return;
}
$oldRowToUpdate[Metrics::INDEX_NB_VISITS] += $newRowToAdd[Metrics::INDEX_NB_VISITS];
$oldRowToUpdate[Metrics::INDEX_NB_ACTIONS] += $newRowToAdd[Metrics::INDEX_NB_ACTIONS];
$oldRowToUpdate[Metrics::INDEX_NB_UNIQ_VISITORS] += $newRowToAdd[Metrics::INDEX_NB_UNIQ_VISITORS];
// In case the existing Row had no action metrics (eg. Custom Variable XYZ with "visit" scope)
// but the new Row has action metrics (eg. same Custom Variable XYZ this time with a "page" scope)
if (!isset($oldRowToUpdate[Metrics::INDEX_MAX_ACTIONS])) {
$toZero = array(
Metrics::INDEX_NB_USERS,
Metrics::INDEX_MAX_ACTIONS,
Metrics::INDEX_SUM_VISIT_LENGTH,
Metrics::INDEX_BOUNCE_COUNT,
Metrics::INDEX_NB_VISITS_CONVERTED
);
foreach ($toZero as $metric) {
$oldRowToUpdate[$metric] = 0;
}
}
$oldRowToUpdate[Metrics::INDEX_NB_USERS] += $newRowToAdd[Metrics::INDEX_NB_USERS];
$oldRowToUpdate[Metrics::INDEX_MAX_ACTIONS] = (float)max($newRowToAdd[Metrics::INDEX_MAX_ACTIONS], $oldRowToUpdate[Metrics::INDEX_MAX_ACTIONS]);
$oldRowToUpdate[Metrics::INDEX_SUM_VISIT_LENGTH] += $newRowToAdd[Metrics::INDEX_SUM_VISIT_LENGTH];
$oldRowToUpdate[Metrics::INDEX_BOUNCE_COUNT] += $newRowToAdd[Metrics::INDEX_BOUNCE_COUNT];
$oldRowToUpdate[Metrics::INDEX_NB_VISITS_CONVERTED] += $newRowToAdd[Metrics::INDEX_NB_VISITS_CONVERTED];
} | php | protected function doSumVisitsMetrics($newRowToAdd, &$oldRowToUpdate)
{
// Pre 1.2 format: string indexed rows are returned from the DB
// Left here for Backward compatibility with plugins doing custom SQL queries using these metrics as string
if (!isset($newRowToAdd[Metrics::INDEX_NB_VISITS])) {
$oldRowToUpdate[Metrics::INDEX_NB_VISITS] += $newRowToAdd['nb_visits'];
$oldRowToUpdate[Metrics::INDEX_NB_ACTIONS] += $newRowToAdd['nb_actions'];
$oldRowToUpdate[Metrics::INDEX_NB_UNIQ_VISITORS] += $newRowToAdd['nb_uniq_visitors'];
$oldRowToUpdate[Metrics::INDEX_NB_USERS] += $newRowToAdd['nb_users'];
$oldRowToUpdate[Metrics::INDEX_MAX_ACTIONS] = (float)max($newRowToAdd['max_actions'], $oldRowToUpdate[Metrics::INDEX_MAX_ACTIONS]);
$oldRowToUpdate[Metrics::INDEX_SUM_VISIT_LENGTH] += $newRowToAdd['sum_visit_length'];
$oldRowToUpdate[Metrics::INDEX_BOUNCE_COUNT] += $newRowToAdd['bounce_count'];
$oldRowToUpdate[Metrics::INDEX_NB_VISITS_CONVERTED] += $newRowToAdd['nb_visits_converted'];
return;
}
// Edge case fail safe
if (!isset($oldRowToUpdate[Metrics::INDEX_NB_VISITS])) {
return;
}
$oldRowToUpdate[Metrics::INDEX_NB_VISITS] += $newRowToAdd[Metrics::INDEX_NB_VISITS];
$oldRowToUpdate[Metrics::INDEX_NB_ACTIONS] += $newRowToAdd[Metrics::INDEX_NB_ACTIONS];
$oldRowToUpdate[Metrics::INDEX_NB_UNIQ_VISITORS] += $newRowToAdd[Metrics::INDEX_NB_UNIQ_VISITORS];
// In case the existing Row had no action metrics (eg. Custom Variable XYZ with "visit" scope)
// but the new Row has action metrics (eg. same Custom Variable XYZ this time with a "page" scope)
if (!isset($oldRowToUpdate[Metrics::INDEX_MAX_ACTIONS])) {
$toZero = array(
Metrics::INDEX_NB_USERS,
Metrics::INDEX_MAX_ACTIONS,
Metrics::INDEX_SUM_VISIT_LENGTH,
Metrics::INDEX_BOUNCE_COUNT,
Metrics::INDEX_NB_VISITS_CONVERTED
);
foreach ($toZero as $metric) {
$oldRowToUpdate[$metric] = 0;
}
}
$oldRowToUpdate[Metrics::INDEX_NB_USERS] += $newRowToAdd[Metrics::INDEX_NB_USERS];
$oldRowToUpdate[Metrics::INDEX_MAX_ACTIONS] = (float)max($newRowToAdd[Metrics::INDEX_MAX_ACTIONS], $oldRowToUpdate[Metrics::INDEX_MAX_ACTIONS]);
$oldRowToUpdate[Metrics::INDEX_SUM_VISIT_LENGTH] += $newRowToAdd[Metrics::INDEX_SUM_VISIT_LENGTH];
$oldRowToUpdate[Metrics::INDEX_BOUNCE_COUNT] += $newRowToAdd[Metrics::INDEX_BOUNCE_COUNT];
$oldRowToUpdate[Metrics::INDEX_NB_VISITS_CONVERTED] += $newRowToAdd[Metrics::INDEX_NB_VISITS_CONVERTED];
} | [
"protected",
"function",
"doSumVisitsMetrics",
"(",
"$",
"newRowToAdd",
",",
"&",
"$",
"oldRowToUpdate",
")",
"{",
"// Pre 1.2 format: string indexed rows are returned from the DB",
"// Left here for Backward compatibility with plugins doing custom SQL queries using these metrics as string... | Adds the given row $newRowToAdd to the existing $oldRowToUpdate passed by reference
The rows are php arrays Name => value
@param array $newRowToAdd
@param array $oldRowToUpdate
@param bool $onlyMetricsAvailableInActionsTable
@return void | [
"Adds",
"the",
"given",
"row",
"$newRowToAdd",
"to",
"the",
"existing",
"$oldRowToUpdate",
"passed",
"by",
"reference",
"The",
"rows",
"are",
"php",
"arrays",
"Name",
"=",
">",
"value"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/DataArray.php#L83-L128 | train | Sums visits metrics | [
30522,
5123,
3853,
9998,
2819,
11365,
12762,
12589,
2015,
1006,
1002,
2047,
10524,
3406,
4215,
2094,
1010,
1004,
1002,
2214,
10524,
24826,
17299,
3686,
1007,
1063,
1013,
1013,
3653,
1015,
1012,
1016,
4289,
1024,
5164,
25331,
10281,
2024,
25... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
dompdf/dompdf | src/Css/AttributeTranslator.php | AttributeTranslator._set_input_width | static protected function _set_input_width(\DOMElement $node, $value)
{
if (empty($value)) { return null; }
if ($node->hasAttribute("type") && in_array(strtolower($node->getAttribute("type")), array("text","password"))) {
return sprintf("width: %Fem", (((int)$value * .65)+2));
} else {
return sprintf("width: %upx;", (int)$value);
}
} | php | static protected function _set_input_width(\DOMElement $node, $value)
{
if (empty($value)) { return null; }
if ($node->hasAttribute("type") && in_array(strtolower($node->getAttribute("type")), array("text","password"))) {
return sprintf("width: %Fem", (((int)$value * .65)+2));
} else {
return sprintf("width: %upx;", (int)$value);
}
} | [
"static",
"protected",
"function",
"_set_input_width",
"(",
"\\",
"DOMElement",
"$",
"node",
",",
"$",
"value",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"value",
")",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"$",
"node",
"->",
"hasAttribute",
... | @param \DOMElement $node
@param string $value
@return null|string | [
"@param",
"\\",
"DOMElement",
"$node",
"@param",
"string",
"$value"
] | 75f13c700009be21a1965dc2c5b68a8708c22ba2 | https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/src/Css/AttributeTranslator.php#L521-L530 | train | _set_input_width - Set width of input element | [
30522,
10763,
5123,
3853,
1035,
2275,
1035,
7953,
1035,
9381,
1006,
1032,
8514,
16930,
4765,
1002,
13045,
1010,
1002,
3643,
1007,
1063,
2065,
1006,
4064,
1006,
1002,
3643,
1007,
1007,
1063,
2709,
19701,
1025,
1065,
2065,
1006,
1002,
13045,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/DebugFormatterHelper.php | DebugFormatterHelper.start | public function start($id, $message, $prefix = 'RUN')
{
$this->started[$id] = ['border' => ++$this->count % \count($this->colors)];
return sprintf("%s<bg=blue;fg=white> %s </> <fg=blue>%s</>\n", $this->getBorder($id), $prefix, $message);
} | php | public function start($id, $message, $prefix = 'RUN')
{
$this->started[$id] = ['border' => ++$this->count % \count($this->colors)];
return sprintf("%s<bg=blue;fg=white> %s </> <fg=blue>%s</>\n", $this->getBorder($id), $prefix, $message);
} | [
"public",
"function",
"start",
"(",
"$",
"id",
",",
"$",
"message",
",",
"$",
"prefix",
"=",
"'RUN'",
")",
"{",
"$",
"this",
"->",
"started",
"[",
"$",
"id",
"]",
"=",
"[",
"'border'",
"=>",
"++",
"$",
"this",
"->",
"count",
"%",
"\\",
"count",
... | Starts a debug formatting session.
@param string $id The id of the formatting session
@param string $message The message to display
@param string $prefix The prefix to use
@return string | [
"Starts",
"a",
"debug",
"formatting",
"session",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Console/Helper/DebugFormatterHelper.php#L36-L41 | train | Starts a new message in the header | [
30522,
2270,
3853,
2707,
1006,
1002,
8909,
1010,
1002,
4471,
1010,
1002,
17576,
1027,
1005,
2448,
1005,
1007,
1063,
1002,
2023,
1011,
1028,
2318,
1031,
1002,
8909,
1033,
1027,
1031,
1005,
3675,
1005,
1027,
1028,
1009,
1009,
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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.