repo stringclasses 21 values | path stringlengths 10 105 | func_name stringlengths 6 64 | original_string stringlengths 105 15.6k | language stringclasses 1 value | code stringlengths 105 15.6k | code_tokens listlengths 29 2.15k | docstring stringlengths 11 2.85k | docstring_tokens listlengths 1 290 | sha stringclasses 21 values | url stringlengths 100 194 | partition stringclasses 1 value | summary stringlengths 8 319 | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
laravel/framework | src/Illuminate/Database/Eloquent/Builder.php | Builder.delete | public function delete()
{
if (isset($this->onDelete)) {
return call_user_func($this->onDelete, $this);
}
return $this->toBase()->delete();
} | php | public function delete()
{
if (isset($this->onDelete)) {
return call_user_func($this->onDelete, $this);
}
return $this->toBase()->delete();
} | [
"public",
"function",
"delete",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"onDelete",
")",
")",
"{",
"return",
"call_user_func",
"(",
"$",
"this",
"->",
"onDelete",
",",
"$",
"this",
")",
";",
"}",
"return",
"$",
"this",
"->",
"toB... | Delete a record from the database.
@return mixed | [
"Delete",
"a",
"record",
"from",
"the",
"database",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Builder.php#L883-L890 | train | Delete the record | [
30522,
2270,
3853,
3972,
12870,
1006,
1007,
1063,
2065,
1006,
26354,
3388,
1006,
1002,
2023,
1011,
1028,
2006,
9247,
12870,
1007,
1007,
1063,
2709,
2655,
1035,
5310,
1035,
4569,
2278,
1006,
1002,
2023,
1011,
1028,
2006,
9247,
12870,
1010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spatie/laravel-permission | src/Traits/HasRoles.php | HasRoles.scopeRole | public function scopeRole(Builder $query, $roles, $guard = null): Builder
{
if ($roles instanceof Collection) {
$roles = $roles->all();
}
if (! is_array($roles)) {
$roles = [$roles];
}
$roles = array_map(function ($role) use ($guard) {
if ($role instanceof Role) {
return $role;
}
$method = is_numeric($role) ? 'findById' : 'findByName';
$guard = $guard ?: $this->getDefaultGuardName();
return $this->getRoleClass()->{$method}($role, $guard);
}, $roles);
return $query->whereHas('roles', function ($query) use ($roles) {
$query->where(function ($query) use ($roles) {
foreach ($roles as $role) {
$query->orWhere(config('permission.table_names.roles').'.id', $role->id);
}
});
});
} | php | public function scopeRole(Builder $query, $roles, $guard = null): Builder
{
if ($roles instanceof Collection) {
$roles = $roles->all();
}
if (! is_array($roles)) {
$roles = [$roles];
}
$roles = array_map(function ($role) use ($guard) {
if ($role instanceof Role) {
return $role;
}
$method = is_numeric($role) ? 'findById' : 'findByName';
$guard = $guard ?: $this->getDefaultGuardName();
return $this->getRoleClass()->{$method}($role, $guard);
}, $roles);
return $query->whereHas('roles', function ($query) use ($roles) {
$query->where(function ($query) use ($roles) {
foreach ($roles as $role) {
$query->orWhere(config('permission.table_names.roles').'.id', $role->id);
}
});
});
} | [
"public",
"function",
"scopeRole",
"(",
"Builder",
"$",
"query",
",",
"$",
"roles",
",",
"$",
"guard",
"=",
"null",
")",
":",
"Builder",
"{",
"if",
"(",
"$",
"roles",
"instanceof",
"Collection",
")",
"{",
"$",
"roles",
"=",
"$",
"roles",
"->",
"all",... | Scope the model query to certain roles only.
@param \Illuminate\Database\Eloquent\Builder $query
@param string|array|\Spatie\Permission\Contracts\Role|\Illuminate\Support\Collection $roles
@param string $guard
@return \Illuminate\Database\Eloquent\Builder | [
"Scope",
"the",
"model",
"query",
"to",
"certain",
"roles",
"only",
"."
] | 81dbe9d372d70c255b66a2727a235076509f8d45 | https://github.com/spatie/laravel-permission/blob/81dbe9d372d70c255b66a2727a235076509f8d45/src/Traits/HasRoles.php#L60-L88 | train | Scope the query to only include roles. | [
30522,
2270,
3853,
9531,
13153,
2063,
1006,
12508,
1002,
23032,
1010,
1002,
4395,
1010,
1002,
3457,
1027,
19701,
1007,
1024,
12508,
1063,
2065,
1006,
1002,
4395,
6013,
11253,
3074,
1007,
1063,
1002,
4395,
1027,
1002,
4395,
1011,
1028,
2035,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Validators/BaseValidator.php | BaseValidator.check | public static function check($name, $value, $validators)
{
foreach ($validators as $validator) {
try {
$validator->validate($value);
} catch (\Exception $e) {
throw new Exception(strip_tags($name) . ': ' . $e->getMessage(), $e->getCode());
}
}
} | php | public static function check($name, $value, $validators)
{
foreach ($validators as $validator) {
try {
$validator->validate($value);
} catch (\Exception $e) {
throw new Exception(strip_tags($name) . ': ' . $e->getMessage(), $e->getCode());
}
}
} | [
"public",
"static",
"function",
"check",
"(",
"$",
"name",
",",
"$",
"value",
",",
"$",
"validators",
")",
"{",
"foreach",
"(",
"$",
"validators",
"as",
"$",
"validator",
")",
"{",
"try",
"{",
"$",
"validator",
"->",
"validate",
"(",
"$",
"value",
")... | Lets you easily check a value against multiple validators.
@param string $name The name/description of the field you want to validate the value for.
The name will be prefixed in case there is any error.
@param mixed $value The value which needs to be tested
@param BaseValidator[] $validators | [
"Lets",
"you",
"easily",
"check",
"a",
"value",
"against",
"multiple",
"validators",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Validators/BaseValidator.php#L38-L47 | train | Check if value passes all the validators | [
30522,
2270,
10763,
3853,
4638,
1006,
1002,
2171,
1010,
1002,
3643,
1010,
1002,
9398,
18926,
1007,
1063,
18921,
6776,
1006,
1002,
9398,
18926,
2004,
1002,
9398,
8844,
1007,
1063,
3046,
1063,
1002,
9398,
8844,
1011,
1028,
9398,
3686,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
z-song/laravel-admin | src/Traits/ModelTree.php | ModelTree.delete | public function delete()
{
$this->where($this->parentColumn, $this->getKey())->delete();
return parent::delete();
} | php | public function delete()
{
$this->where($this->parentColumn, $this->getKey())->delete();
return parent::delete();
} | [
"public",
"function",
"delete",
"(",
")",
"{",
"$",
"this",
"->",
"where",
"(",
"$",
"this",
"->",
"parentColumn",
",",
"$",
"this",
"->",
"getKey",
"(",
")",
")",
"->",
"delete",
"(",
")",
";",
"return",
"parent",
"::",
"delete",
"(",
")",
";",
... | {@inheritdoc} | [
"{"
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Traits/ModelTree.php#L283-L288 | train | Delete the record in the database | [
30522,
2270,
3853,
3972,
12870,
1006,
1007,
1063,
1002,
2023,
1011,
1028,
2073,
1006,
1002,
2023,
1011,
1028,
6687,
25778,
2819,
2078,
1010,
1002,
2023,
1011,
1028,
2131,
14839,
1006,
1007,
1007,
1011,
1028,
3972,
12870,
1006,
1007,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/Segment.php | Segment.combine | public static function combine($segment, $operator, $segmentCondition)
{
if (empty($segment)) {
return $segmentCondition;
}
if (empty($segmentCondition)
|| self::containsCondition($segment, $operator, $segmentCondition)
) {
return $segment;
}
return $segment . $operator . $segmentCondition;
} | php | public static function combine($segment, $operator, $segmentCondition)
{
if (empty($segment)) {
return $segmentCondition;
}
if (empty($segmentCondition)
|| self::containsCondition($segment, $operator, $segmentCondition)
) {
return $segment;
}
return $segment . $operator . $segmentCondition;
} | [
"public",
"static",
"function",
"combine",
"(",
"$",
"segment",
",",
"$",
"operator",
",",
"$",
"segmentCondition",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"segment",
")",
")",
"{",
"return",
"$",
"segmentCondition",
";",
"}",
"if",
"(",
"empty",
"(",
... | Combines this segment with another segment condition, if the segment condition is not already
in the segment.
The combination is naive in that it does not take order of operations into account.
@param string $segment
@param string $operator The operator to use. Should be either SegmentExpression::AND_DELIMITER
or SegmentExpression::OR_DELIMITER.
@param string $segmentCondition The segment condition to add.
@return string
@throws Exception | [
"Combines",
"this",
"segment",
"with",
"another",
"segment",
"condition",
"if",
"the",
"segment",
"condition",
"is",
"not",
"already",
"in",
"the",
"segment",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Segment.php#L371-L384 | train | Combine segment with segment condition | [
30522,
2270,
10763,
3853,
11506,
1006,
1002,
6903,
1010,
1002,
6872,
1010,
1002,
6903,
8663,
20562,
1007,
1063,
2065,
1006,
4064,
1006,
1002,
6903,
1007,
1007,
1063,
2709,
1002,
6903,
8663,
20562,
1025,
1065,
2065,
1006,
4064,
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... |
php-ai/php-ml | src/Tokenization/NGramTokenizer.php | NGramTokenizer.tokenize | public function tokenize(string $text): array
{
$words = [];
preg_match_all('/\w\w+/u', $text, $words);
$nGrams = [];
foreach ($words[0] as $word) {
$this->generateNGrams($word, $nGrams);
}
return $nGrams;
} | php | public function tokenize(string $text): array
{
$words = [];
preg_match_all('/\w\w+/u', $text, $words);
$nGrams = [];
foreach ($words[0] as $word) {
$this->generateNGrams($word, $nGrams);
}
return $nGrams;
} | [
"public",
"function",
"tokenize",
"(",
"string",
"$",
"text",
")",
":",
"array",
"{",
"$",
"words",
"=",
"[",
"]",
";",
"preg_match_all",
"(",
"'/\\w\\w+/u'",
",",
"$",
"text",
",",
"$",
"words",
")",
";",
"$",
"nGrams",
"=",
"[",
"]",
";",
"foreac... | {@inheritdoc} | [
"{"
] | f6aa1a59b0525b8fca3d2786d661ab3e70904016 | https://github.com/php-ai/php-ml/blob/f6aa1a59b0525b8fca3d2786d661ab3e70904016/src/Tokenization/NGramTokenizer.php#L34-L45 | train | Tokenize text into an array of words | [
30522,
2270,
3853,
19204,
4697,
1006,
5164,
1002,
3793,
1007,
1024,
9140,
1063,
1002,
2616,
1027,
1031,
1033,
1025,
3653,
2290,
1035,
2674,
1035,
2035,
1006,
1005,
1013,
1032,
1059,
1032,
1059,
1009,
1013,
1057,
1005,
1010,
1002,
3793,
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... |
PHPMailer/PHPMailer | src/PHPMailer.php | PHPMailer.DKIM_QP | public function DKIM_QP($txt)
{
$line = '';
$len = strlen($txt);
for ($i = 0; $i < $len; ++$i) {
$ord = ord($txt[$i]);
if (((0x21 <= $ord) and ($ord <= 0x3A)) or $ord == 0x3C or ((0x3E <= $ord) and ($ord <= 0x7E))) {
$line .= $txt[$i];
} else {
$line .= '=' . sprintf('%02X', $ord);
}
}
return $line;
} | php | public function DKIM_QP($txt)
{
$line = '';
$len = strlen($txt);
for ($i = 0; $i < $len; ++$i) {
$ord = ord($txt[$i]);
if (((0x21 <= $ord) and ($ord <= 0x3A)) or $ord == 0x3C or ((0x3E <= $ord) and ($ord <= 0x7E))) {
$line .= $txt[$i];
} else {
$line .= '=' . sprintf('%02X', $ord);
}
}
return $line;
} | [
"public",
"function",
"DKIM_QP",
"(",
"$",
"txt",
")",
"{",
"$",
"line",
"=",
"''",
";",
"$",
"len",
"=",
"strlen",
"(",
"$",
"txt",
")",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"$",
"len",
";",
"++",
"$",
"i",
")",
"{",
... | Quoted-Printable-encode a DKIM header.
@param string $txt
@return string | [
"Quoted",
"-",
"Printable",
"-",
"encode",
"a",
"DKIM",
"header",
"."
] | 3d7132341659a8a201adbc3ba11b1e202ee2857c | https://github.com/PHPMailer/PHPMailer/blob/3d7132341659a8a201adbc3ba11b1e202ee2857c/src/PHPMailer.php#L4195-L4209 | train | DKIM_QP - QP - QP - QP - QP - QP - QP - QP - QP - QP - QP - QP - QP - QP - QP - QP - QP - QP - QP - QP - QP - QP - QP - QP - QP - QP - QP - QP - QP - QP - QP - QP | [
30522,
2270,
3853,
1040,
21138,
1035,
1053,
2361,
1006,
1002,
19067,
2102,
1007,
1063,
1002,
2240,
1027,
1005,
1005,
1025,
1002,
18798,
1027,
2358,
20927,
2078,
1006,
1002,
19067,
2102,
1007,
1025,
2005,
1006,
1002,
1045,
1027,
1014,
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... |
octobercms/october | modules/system/classes/UpdateManager.php | UpdateManager.rollbackPlugin | public function rollbackPlugin($name)
{
/*
* Remove the plugin database and version
*/
if (!($plugin = $this->pluginManager->findByIdentifier($name))
&& $this->versionManager->purgePlugin($name)
) {
$this->note('<info>Purged from database:</info> ' . $name);
return $this;
}
if ($this->versionManager->removePlugin($plugin)) {
$this->note('<info>Rolled back:</info> ' . $name);
return $this;
}
$this->note('<error>Unable to find:</error> ' . $name);
return $this;
} | php | public function rollbackPlugin($name)
{
/*
* Remove the plugin database and version
*/
if (!($plugin = $this->pluginManager->findByIdentifier($name))
&& $this->versionManager->purgePlugin($name)
) {
$this->note('<info>Purged from database:</info> ' . $name);
return $this;
}
if ($this->versionManager->removePlugin($plugin)) {
$this->note('<info>Rolled back:</info> ' . $name);
return $this;
}
$this->note('<error>Unable to find:</error> ' . $name);
return $this;
} | [
"public",
"function",
"rollbackPlugin",
"(",
"$",
"name",
")",
"{",
"/*\n * Remove the plugin database and version\n */",
"if",
"(",
"!",
"(",
"$",
"plugin",
"=",
"$",
"this",
"->",
"pluginManager",
"->",
"findByIdentifier",
"(",
"$",
"name",
")",
... | Removes an existing plugin
@param string $name Plugin name.
@return self | [
"Removes",
"an",
"existing",
"plugin"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/UpdateManager.php#L540-L560 | train | Rolls back a plugin | [
30522,
2270,
3853,
4897,
5963,
24759,
15916,
2378,
1006,
1002,
2171,
1007,
1063,
1013,
1008,
1008,
6366,
1996,
13354,
2378,
7809,
1998,
2544,
1008,
1013,
2065,
1006,
999,
1006,
1002,
13354,
2378,
1027,
1002,
2023,
1011,
1028,
13354,
2378,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Bridge/Doctrine/PropertyInfo/DoctrineExtractor.php | DoctrineExtractor.getTypes | public function getTypes($class, $property, array $context = [])
{
try {
$metadata = $this->entityManager ? $this->entityManager->getClassMetadata($class) : $this->classMetadataFactory->getMetadataFor($class);
} catch (MappingException $exception) {
return;
} catch (OrmMappingException $exception) {
return;
}
if ($metadata->hasAssociation($property)) {
$class = $metadata->getAssociationTargetClass($property);
if ($metadata->isSingleValuedAssociation($property)) {
if ($metadata instanceof ClassMetadataInfo) {
$associationMapping = $metadata->getAssociationMapping($property);
$nullable = $this->isAssociationNullable($associationMapping);
} else {
$nullable = false;
}
return [new Type(Type::BUILTIN_TYPE_OBJECT, $nullable, $class)];
}
$collectionKeyType = Type::BUILTIN_TYPE_INT;
if ($metadata instanceof ClassMetadataInfo) {
$associationMapping = $metadata->getAssociationMapping($property);
if (isset($associationMapping['indexBy'])) {
$indexProperty = $associationMapping['indexBy'];
/** @var ClassMetadataInfo $subMetadata */
$subMetadata = $this->entityManager ? $this->entityManager->getClassMetadata($associationMapping['targetEntity']) : $this->classMetadataFactory->getMetadataFor($associationMapping['targetEntity']);
$typeOfField = $subMetadata->getTypeOfField($indexProperty);
if (null === $typeOfField) {
$associationMapping = $subMetadata->getAssociationMapping($indexProperty);
/** @var ClassMetadataInfo $subMetadata */
$indexProperty = $subMetadata->getSingleAssociationReferencedJoinColumnName($indexProperty);
$subMetadata = $this->entityManager ? $this->entityManager->getClassMetadata($associationMapping['targetEntity']) : $this->classMetadataFactory->getMetadataFor($associationMapping['targetEntity']);
$typeOfField = $subMetadata->getTypeOfField($indexProperty);
}
$collectionKeyType = $this->getPhpType($typeOfField);
}
}
return [new Type(
Type::BUILTIN_TYPE_OBJECT,
false,
'Doctrine\Common\Collections\Collection',
true,
new Type($collectionKeyType),
new Type(Type::BUILTIN_TYPE_OBJECT, false, $class)
)];
}
if ($metadata instanceof ClassMetadataInfo && class_exists('Doctrine\ORM\Mapping\Embedded') && isset($metadata->embeddedClasses[$property])) {
return [new Type(Type::BUILTIN_TYPE_OBJECT, false, $metadata->embeddedClasses[$property]['class'])];
}
if ($metadata->hasField($property)) {
$typeOfField = $metadata->getTypeOfField($property);
$nullable = $metadata instanceof ClassMetadataInfo && $metadata->isNullable($property);
switch ($typeOfField) {
case DBALType::DATE:
case DBALType::DATETIME:
case DBALType::DATETIMETZ:
case 'vardatetime':
case DBALType::TIME:
return [new Type(Type::BUILTIN_TYPE_OBJECT, $nullable, 'DateTime')];
case 'date_immutable':
case 'datetime_immutable':
case 'datetimetz_immutable':
case 'time_immutable':
return [new Type(Type::BUILTIN_TYPE_OBJECT, $nullable, 'DateTimeImmutable')];
case 'dateinterval':
return [new Type(Type::BUILTIN_TYPE_OBJECT, $nullable, 'DateInterval')];
case DBALType::TARRAY:
return [new Type(Type::BUILTIN_TYPE_ARRAY, $nullable, null, true)];
case DBALType::SIMPLE_ARRAY:
return [new Type(Type::BUILTIN_TYPE_ARRAY, $nullable, null, true, new Type(Type::BUILTIN_TYPE_INT), new Type(Type::BUILTIN_TYPE_STRING))];
case DBALType::JSON_ARRAY:
return [new Type(Type::BUILTIN_TYPE_ARRAY, $nullable, null, true)];
default:
$builtinType = $this->getPhpType($typeOfField);
return $builtinType ? [new Type($builtinType, $nullable)] : null;
}
}
} | php | public function getTypes($class, $property, array $context = [])
{
try {
$metadata = $this->entityManager ? $this->entityManager->getClassMetadata($class) : $this->classMetadataFactory->getMetadataFor($class);
} catch (MappingException $exception) {
return;
} catch (OrmMappingException $exception) {
return;
}
if ($metadata->hasAssociation($property)) {
$class = $metadata->getAssociationTargetClass($property);
if ($metadata->isSingleValuedAssociation($property)) {
if ($metadata instanceof ClassMetadataInfo) {
$associationMapping = $metadata->getAssociationMapping($property);
$nullable = $this->isAssociationNullable($associationMapping);
} else {
$nullable = false;
}
return [new Type(Type::BUILTIN_TYPE_OBJECT, $nullable, $class)];
}
$collectionKeyType = Type::BUILTIN_TYPE_INT;
if ($metadata instanceof ClassMetadataInfo) {
$associationMapping = $metadata->getAssociationMapping($property);
if (isset($associationMapping['indexBy'])) {
$indexProperty = $associationMapping['indexBy'];
/** @var ClassMetadataInfo $subMetadata */
$subMetadata = $this->entityManager ? $this->entityManager->getClassMetadata($associationMapping['targetEntity']) : $this->classMetadataFactory->getMetadataFor($associationMapping['targetEntity']);
$typeOfField = $subMetadata->getTypeOfField($indexProperty);
if (null === $typeOfField) {
$associationMapping = $subMetadata->getAssociationMapping($indexProperty);
/** @var ClassMetadataInfo $subMetadata */
$indexProperty = $subMetadata->getSingleAssociationReferencedJoinColumnName($indexProperty);
$subMetadata = $this->entityManager ? $this->entityManager->getClassMetadata($associationMapping['targetEntity']) : $this->classMetadataFactory->getMetadataFor($associationMapping['targetEntity']);
$typeOfField = $subMetadata->getTypeOfField($indexProperty);
}
$collectionKeyType = $this->getPhpType($typeOfField);
}
}
return [new Type(
Type::BUILTIN_TYPE_OBJECT,
false,
'Doctrine\Common\Collections\Collection',
true,
new Type($collectionKeyType),
new Type(Type::BUILTIN_TYPE_OBJECT, false, $class)
)];
}
if ($metadata instanceof ClassMetadataInfo && class_exists('Doctrine\ORM\Mapping\Embedded') && isset($metadata->embeddedClasses[$property])) {
return [new Type(Type::BUILTIN_TYPE_OBJECT, false, $metadata->embeddedClasses[$property]['class'])];
}
if ($metadata->hasField($property)) {
$typeOfField = $metadata->getTypeOfField($property);
$nullable = $metadata instanceof ClassMetadataInfo && $metadata->isNullable($property);
switch ($typeOfField) {
case DBALType::DATE:
case DBALType::DATETIME:
case DBALType::DATETIMETZ:
case 'vardatetime':
case DBALType::TIME:
return [new Type(Type::BUILTIN_TYPE_OBJECT, $nullable, 'DateTime')];
case 'date_immutable':
case 'datetime_immutable':
case 'datetimetz_immutable':
case 'time_immutable':
return [new Type(Type::BUILTIN_TYPE_OBJECT, $nullable, 'DateTimeImmutable')];
case 'dateinterval':
return [new Type(Type::BUILTIN_TYPE_OBJECT, $nullable, 'DateInterval')];
case DBALType::TARRAY:
return [new Type(Type::BUILTIN_TYPE_ARRAY, $nullable, null, true)];
case DBALType::SIMPLE_ARRAY:
return [new Type(Type::BUILTIN_TYPE_ARRAY, $nullable, null, true, new Type(Type::BUILTIN_TYPE_INT), new Type(Type::BUILTIN_TYPE_STRING))];
case DBALType::JSON_ARRAY:
return [new Type(Type::BUILTIN_TYPE_ARRAY, $nullable, null, true)];
default:
$builtinType = $this->getPhpType($typeOfField);
return $builtinType ? [new Type($builtinType, $nullable)] : null;
}
}
} | [
"public",
"function",
"getTypes",
"(",
"$",
"class",
",",
"$",
"property",
",",
"array",
"$",
"context",
"=",
"[",
"]",
")",
"{",
"try",
"{",
"$",
"metadata",
"=",
"$",
"this",
"->",
"entityManager",
"?",
"$",
"this",
"->",
"entityManager",
"->",
"ge... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bridge/Doctrine/PropertyInfo/DoctrineExtractor.php#L78-L177 | train | Get types of a class property | [
30522,
2270,
3853,
2131,
13874,
2015,
1006,
1002,
2465,
1010,
1002,
3200,
1010,
9140,
1002,
6123,
1027,
1031,
1033,
1007,
1063,
3046,
1063,
1002,
27425,
1027,
30524,
1028,
2131,
11368,
8447,
2696,
29278,
1006,
1002,
2465,
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... |
symfony/symfony | src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php | NativeSessionStorage.start | public function start()
{
if ($this->started) {
return true;
}
if (\PHP_SESSION_ACTIVE === session_status()) {
throw new \RuntimeException('Failed to start the session: already started by PHP.');
}
if (filter_var(ini_get('session.use_cookies'), FILTER_VALIDATE_BOOLEAN) && headers_sent($file, $line)) {
throw new \RuntimeException(sprintf('Failed to start the session because headers have already been sent by "%s" at line %d.', $file, $line));
}
// ok to try and start the session
if (!session_start()) {
throw new \RuntimeException('Failed to start the session');
}
if (null !== $this->emulateSameSite) {
$originalCookie = SessionUtils::popSessionCookie(session_name(), session_id());
if (null !== $originalCookie) {
header(sprintf('%s; SameSite=%s', $originalCookie, $this->emulateSameSite), false);
}
}
$this->loadSession();
return true;
} | php | public function start()
{
if ($this->started) {
return true;
}
if (\PHP_SESSION_ACTIVE === session_status()) {
throw new \RuntimeException('Failed to start the session: already started by PHP.');
}
if (filter_var(ini_get('session.use_cookies'), FILTER_VALIDATE_BOOLEAN) && headers_sent($file, $line)) {
throw new \RuntimeException(sprintf('Failed to start the session because headers have already been sent by "%s" at line %d.', $file, $line));
}
// ok to try and start the session
if (!session_start()) {
throw new \RuntimeException('Failed to start the session');
}
if (null !== $this->emulateSameSite) {
$originalCookie = SessionUtils::popSessionCookie(session_name(), session_id());
if (null !== $originalCookie) {
header(sprintf('%s; SameSite=%s', $originalCookie, $this->emulateSameSite), false);
}
}
$this->loadSession();
return true;
} | [
"public",
"function",
"start",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"started",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"\\",
"PHP_SESSION_ACTIVE",
"===",
"session_status",
"(",
")",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php#L134-L163 | train | Start the session | [
30522,
2270,
3853,
2707,
1006,
1007,
1063,
2065,
1006,
1002,
2023,
1011,
1028,
2318,
1007,
1063,
2709,
2995,
1025,
1065,
2065,
1006,
1032,
25718,
1035,
5219,
1035,
3161,
1027,
1027,
1027,
5219,
1035,
3570,
1006,
1007,
1007,
1063,
5466,
20... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getgrav/grav | system/src/Grav/Framework/Form/Traits/FormTrait.php | FormTrait.validateUpload | protected function validateUpload(UploadedFileInterface $file): void
{
// Handle bad filenames.
$filename = $file->getClientFilename();
if (!Utils::checkFilename($filename)) {
$grav = Grav::instance();
throw new \RuntimeException(
sprintf($grav['language']->translate('PLUGIN_FORM.FILEUPLOAD_UNABLE_TO_UPLOAD', null, true), $filename, 'Bad filename')
);
}
} | php | protected function validateUpload(UploadedFileInterface $file): void
{
// Handle bad filenames.
$filename = $file->getClientFilename();
if (!Utils::checkFilename($filename)) {
$grav = Grav::instance();
throw new \RuntimeException(
sprintf($grav['language']->translate('PLUGIN_FORM.FILEUPLOAD_UNABLE_TO_UPLOAD', null, true), $filename, 'Bad filename')
);
}
} | [
"protected",
"function",
"validateUpload",
"(",
"UploadedFileInterface",
"$",
"file",
")",
":",
"void",
"{",
"// Handle bad filenames.",
"$",
"filename",
"=",
"$",
"file",
"->",
"getClientFilename",
"(",
")",
";",
"if",
"(",
"!",
"Utils",
"::",
"checkFilename",
... | Validate uploaded file.
@param UploadedFileInterface $file | [
"Validate",
"uploaded",
"file",
"."
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Framework/Form/Traits/FormTrait.php#L535-L546 | train | Validate uploaded file | [
30522,
5123,
3853,
9398,
3686,
6279,
11066,
1006,
21345,
8873,
19856,
3334,
12172,
1002,
5371,
1007,
1024,
11675,
1063,
1013,
1013,
5047,
2919,
5371,
18442,
2015,
1012,
1002,
5371,
18442,
1027,
1002,
5371,
1011,
1028,
2131,
20464,
11638,
88... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Asset/PathPackage.php | PathPackage.getUrl | public function getUrl($path)
{
$versionedPath = parent::getUrl($path);
// if absolute or begins with /, we're done
if ($this->isAbsoluteUrl($versionedPath) || ($versionedPath && '/' === $versionedPath[0])) {
return $versionedPath;
}
return $this->getBasePath().ltrim($versionedPath, '/');
} | php | public function getUrl($path)
{
$versionedPath = parent::getUrl($path);
// if absolute or begins with /, we're done
if ($this->isAbsoluteUrl($versionedPath) || ($versionedPath && '/' === $versionedPath[0])) {
return $versionedPath;
}
return $this->getBasePath().ltrim($versionedPath, '/');
} | [
"public",
"function",
"getUrl",
"(",
"$",
"path",
")",
"{",
"$",
"versionedPath",
"=",
"parent",
"::",
"getUrl",
"(",
"$",
"path",
")",
";",
"// if absolute or begins with /, we're done",
"if",
"(",
"$",
"this",
"->",
"isAbsoluteUrl",
"(",
"$",
"versionedPath"... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Asset/PathPackage.php#L54-L64 | train | Get versioned path | [
30522,
2270,
3853,
2131,
3126,
2140,
1006,
1002,
4130,
1007,
1063,
1002,
2544,
2098,
15069,
1027,
6687,
1024,
1024,
2131,
3126,
2140,
1006,
1002,
4130,
1007,
1025,
1013,
1013,
2065,
7619,
2030,
4269,
2007,
1013,
1010,
2057,
1005,
2128,
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... |
getgrav/grav | system/src/Grav/Common/Filesystem/Folder.php | Folder.lastModifiedFile | public static function lastModifiedFile($path, $extensions = 'md|yaml')
{
$last_modified = 0;
/** @var UniformResourceLocator $locator */
$locator = Grav::instance()['locator'];
$flags = \RecursiveDirectoryIterator::SKIP_DOTS;
if ($locator->isStream($path)) {
$directory = $locator->getRecursiveIterator($path, $flags);
} else {
$directory = new \RecursiveDirectoryIterator($path, $flags);
}
$recursive = new \RecursiveIteratorIterator($directory, \RecursiveIteratorIterator::SELF_FIRST);
$iterator = new \RegexIterator($recursive, '/^.+\.'.$extensions.'$/i');
/** @var \RecursiveDirectoryIterator $file */
foreach ($iterator as $filepath => $file) {
try {
$file_modified = $file->getMTime();
if ($file_modified > $last_modified) {
$last_modified = $file_modified;
}
} catch (\Exception $e) {
Grav::instance()['log']->error('Could not process file: ' . $e->getMessage());
}
}
return $last_modified;
} | php | public static function lastModifiedFile($path, $extensions = 'md|yaml')
{
$last_modified = 0;
/** @var UniformResourceLocator $locator */
$locator = Grav::instance()['locator'];
$flags = \RecursiveDirectoryIterator::SKIP_DOTS;
if ($locator->isStream($path)) {
$directory = $locator->getRecursiveIterator($path, $flags);
} else {
$directory = new \RecursiveDirectoryIterator($path, $flags);
}
$recursive = new \RecursiveIteratorIterator($directory, \RecursiveIteratorIterator::SELF_FIRST);
$iterator = new \RegexIterator($recursive, '/^.+\.'.$extensions.'$/i');
/** @var \RecursiveDirectoryIterator $file */
foreach ($iterator as $filepath => $file) {
try {
$file_modified = $file->getMTime();
if ($file_modified > $last_modified) {
$last_modified = $file_modified;
}
} catch (\Exception $e) {
Grav::instance()['log']->error('Could not process file: ' . $e->getMessage());
}
}
return $last_modified;
} | [
"public",
"static",
"function",
"lastModifiedFile",
"(",
"$",
"path",
",",
"$",
"extensions",
"=",
"'md|yaml'",
")",
"{",
"$",
"last_modified",
"=",
"0",
";",
"/** @var UniformResourceLocator $locator */",
"$",
"locator",
"=",
"Grav",
"::",
"instance",
"(",
")",... | Recursively find the last modified time under given path by file.
@param string $path
@param string $extensions which files to search for specifically
@return int | [
"Recursively",
"find",
"the",
"last",
"modified",
"time",
"under",
"given",
"path",
"by",
"file",
"."
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Filesystem/Folder.php#L57-L85 | train | Get the last modified time of a file | [
30522,
2270,
10763,
3853,
2197,
5302,
4305,
10451,
8873,
2571,
1006,
1002,
4130,
1010,
1002,
14305,
30524,
1035,
6310,
1027,
1014,
1025,
1013,
1008,
1008,
1030,
13075,
6375,
6072,
8162,
29109,
24755,
4263,
1002,
8840,
11266,
2953,
1008,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/backend/classes/NavigationManager.php | NavigationManager.registerMenuItems | public function registerMenuItems($owner, array $definitions)
{
if (!$this->items) {
$this->items = [];
}
$this->addMainMenuItems($owner, $definitions);
} | php | public function registerMenuItems($owner, array $definitions)
{
if (!$this->items) {
$this->items = [];
}
$this->addMainMenuItems($owner, $definitions);
} | [
"public",
"function",
"registerMenuItems",
"(",
"$",
"owner",
",",
"array",
"$",
"definitions",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"items",
")",
"{",
"$",
"this",
"->",
"items",
"=",
"[",
"]",
";",
"}",
"$",
"this",
"->",
"addMainMenuItems"... | Registers the back-end menu items.
The argument is an array of the main menu items. The array keys represent the
menu item codes, specific for the plugin/module. Each element in the
array should be an associative array with the following keys:
- label - specifies the menu label localization string key, required.
- icon - an icon name from the Font Awesome icon collection, required.
- url - the back-end relative URL the menu item should point to, required.
- permissions - an array of permissions the back-end user should have, optional.
The item will be displayed if the user has any of the specified permissions.
- order - a position of the item in the menu, optional.
- sideMenu - an array of side menu items, optional. If provided, the array items
should represent the side menu item code, and each value should be an associative
array with the following keys:
- label - specifies the menu label localization string key, required.
- icon - an icon name from the Font Awesome icon collection, required.
- url - the back-end relative URL the menu item should point to, required.
- attributes - an array of attributes and values to apply to the menu item, optional.
- permissions - an array of permissions the back-end user should have, optional.
- counter - an optional numeric value to output near the menu icon. The value should be
a number or a callable returning a number.
- counterLabel - an optional string value to describe the numeric reference in counter.
@param string $owner Specifies the menu items owner plugin or module in the format Author.Plugin.
@param array $definitions An array of the menu item definitions. | [
"Registers",
"the",
"back",
"-",
"end",
"menu",
"items",
".",
"The",
"argument",
"is",
"an",
"array",
"of",
"the",
"main",
"menu",
"items",
".",
"The",
"array",
"keys",
"represent",
"the",
"menu",
"item",
"codes",
"specific",
"for",
"the",
"plugin",
"/",... | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/classes/NavigationManager.php#L185-L192 | train | Registers main menu items | [
30522,
2270,
3853,
4236,
3549,
14663,
6633,
2015,
1006,
1002,
3954,
1010,
9140,
1002,
15182,
1007,
1063,
2065,
1006,
999,
1002,
2023,
1011,
1028,
5167,
1007,
1063,
1002,
2023,
1011,
1028,
5167,
1027,
1031,
1033,
1025,
1065,
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... |
matomo-org/matomo | core/Common.php | Common.getCountry | public static function getCountry($lang, $enableLanguageToCountryGuess, $ip)
{
if (empty($lang) || strlen($lang) < 2 || $lang == self::LANGUAGE_CODE_INVALID) {
return self::LANGUAGE_CODE_INVALID;
}
/** @var RegionDataProvider $dataProvider */
$dataProvider = StaticContainer::get('Piwik\Intl\Data\Provider\RegionDataProvider');
$validCountries = $dataProvider->getCountryList();
return self::extractCountryCodeFromBrowserLanguage($lang, $validCountries, $enableLanguageToCountryGuess);
} | php | public static function getCountry($lang, $enableLanguageToCountryGuess, $ip)
{
if (empty($lang) || strlen($lang) < 2 || $lang == self::LANGUAGE_CODE_INVALID) {
return self::LANGUAGE_CODE_INVALID;
}
/** @var RegionDataProvider $dataProvider */
$dataProvider = StaticContainer::get('Piwik\Intl\Data\Provider\RegionDataProvider');
$validCountries = $dataProvider->getCountryList();
return self::extractCountryCodeFromBrowserLanguage($lang, $validCountries, $enableLanguageToCountryGuess);
} | [
"public",
"static",
"function",
"getCountry",
"(",
"$",
"lang",
",",
"$",
"enableLanguageToCountryGuess",
",",
"$",
"ip",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"lang",
")",
"||",
"strlen",
"(",
"$",
"lang",
")",
"<",
"2",
"||",
"$",
"lang",
"==",
... | Returns the visitor country based on the Browser 'accepted language'
information, but provides a hook for geolocation via IP address.
@param string $lang browser lang
@param bool $enableLanguageToCountryGuess If set to true, some assumption will be made and detection guessed more often, but accuracy could be affected
@param string $ip
@return string 2 letter ISO code | [
"Returns",
"the",
"visitor",
"country",
"based",
"on",
"the",
"Browser",
"accepted",
"language",
"information",
"but",
"provides",
"a",
"hook",
"for",
"geolocation",
"via",
"IP",
"address",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Common.php#L951-L963 | train | Returns the country code for the given language and ip | [
30522,
2270,
10763,
3853,
2131,
3597,
16671,
2854,
1006,
1002,
11374,
1010,
1002,
9585,
25023,
6692,
18150,
24163,
16671,
2854,
22967,
2015,
1010,
1002,
12997,
1007,
1063,
2065,
1006,
4064,
1006,
1002,
11374,
1007,
1064,
1064,
2358,
20927,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
overtrue/wechat | src/Kernel/BaseClient.php | BaseClient.requestRaw | public function requestRaw(string $url, string $method = 'GET', array $options = [])
{
return Response::buildFromPsrResponse($this->request($url, $method, $options, true));
} | php | public function requestRaw(string $url, string $method = 'GET', array $options = [])
{
return Response::buildFromPsrResponse($this->request($url, $method, $options, true));
} | [
"public",
"function",
"requestRaw",
"(",
"string",
"$",
"url",
",",
"string",
"$",
"method",
"=",
"'GET'",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"return",
"Response",
"::",
"buildFromPsrResponse",
"(",
"$",
"this",
"->",
"request",
"(",
... | @param string $url
@param string $method
@param array $options
@return \EasyWeChat\Kernel\Http\Response
@throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException | [
"@param",
"string",
"$url",
"@param",
"string",
"$method",
"@param",
"array",
"$options"
] | 120c72faaa93c270365bc75c73c362d5fd583209 | https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/Kernel/BaseClient.php#L184-L187 | train | Sends a request to the given url and returns a Response object | [
30522,
2270,
3853,
5227,
2527,
2860,
1006,
5164,
1002,
24471,
2140,
1010,
5164,
1002,
4118,
1027,
1005,
2131,
1005,
1010,
9140,
1002,
7047,
1027,
1031,
1033,
1007,
1063,
2709,
3433,
1024,
1024,
3857,
19699,
25377,
21338,
6072,
26029,
3366,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.autoLogin | final public function autoLogin(Request $request): ?TokenInterface
{
if (null === $cookie = $request->cookies->get($this->options['name'])) {
return null;
}
if (null !== $this->logger) {
$this->logger->debug('Remember-me cookie detected.');
}
$cookieParts = $this->decodeCookie($cookie);
try {
$user = $this->processAutoLoginCookie($cookieParts, $request);
if (!$user instanceof UserInterface) {
throw new \RuntimeException('processAutoLoginCookie() must return a UserInterface implementation.');
}
if (null !== $this->logger) {
$this->logger->info('Remember-me cookie accepted.');
}
return new RememberMeToken($user, $this->providerKey, $this->secret);
} catch (CookieTheftException $e) {
$this->loginFail($request, $e);
throw $e;
} catch (UsernameNotFoundException $e) {
if (null !== $this->logger) {
$this->logger->info('User for remember-me cookie not found.', ['exception' => $e]);
}
$this->loginFail($request, $e);
} catch (UnsupportedUserException $e) {
if (null !== $this->logger) {
$this->logger->warning('User class for remember-me cookie not supported.', ['exception' => $e]);
}
$this->loginFail($request, $e);
} catch (AuthenticationException $e) {
if (null !== $this->logger) {
$this->logger->debug('Remember-Me authentication failed.', ['exception' => $e]);
}
$this->loginFail($request, $e);
} catch (\Exception $e) {
$this->loginFail($request, $e);
throw $e;
}
return null;
} | php | final public function autoLogin(Request $request): ?TokenInterface
{
if (null === $cookie = $request->cookies->get($this->options['name'])) {
return null;
}
if (null !== $this->logger) {
$this->logger->debug('Remember-me cookie detected.');
}
$cookieParts = $this->decodeCookie($cookie);
try {
$user = $this->processAutoLoginCookie($cookieParts, $request);
if (!$user instanceof UserInterface) {
throw new \RuntimeException('processAutoLoginCookie() must return a UserInterface implementation.');
}
if (null !== $this->logger) {
$this->logger->info('Remember-me cookie accepted.');
}
return new RememberMeToken($user, $this->providerKey, $this->secret);
} catch (CookieTheftException $e) {
$this->loginFail($request, $e);
throw $e;
} catch (UsernameNotFoundException $e) {
if (null !== $this->logger) {
$this->logger->info('User for remember-me cookie not found.', ['exception' => $e]);
}
$this->loginFail($request, $e);
} catch (UnsupportedUserException $e) {
if (null !== $this->logger) {
$this->logger->warning('User class for remember-me cookie not supported.', ['exception' => $e]);
}
$this->loginFail($request, $e);
} catch (AuthenticationException $e) {
if (null !== $this->logger) {
$this->logger->debug('Remember-Me authentication failed.', ['exception' => $e]);
}
$this->loginFail($request, $e);
} catch (\Exception $e) {
$this->loginFail($request, $e);
throw $e;
}
return null;
} | [
"final",
"public",
"function",
"autoLogin",
"(",
"Request",
"$",
"request",
")",
":",
"?",
"TokenInterface",
"{",
"if",
"(",
"null",
"===",
"$",
"cookie",
"=",
"$",
"request",
"->",
"cookies",
"->",
"get",
"(",
"$",
"this",
"->",
"options",
"[",
"'name... | Implementation of RememberMeServicesInterface. Detects whether a remember-me
cookie was set, decodes it, and hands it to subclasses for further processing.
@throws CookieTheftException
@throws \RuntimeException | [
"Implementation",
"of",
"RememberMeServicesInterface",
".",
"Detects",
"whether",
"a",
"remember",
"-",
"me",
"cookie",
"was",
"set",
"decodes",
"it",
"and",
"hands",
"it",
"to",
"subclasses",
"for",
"further",
"processing",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Security/Http/RememberMe/AbstractRememberMeServices.php#L94-L147 | train | Tries to process the remember - me cookie and returns the token if successful. | [
30522,
2345,
2270,
3853,
8285,
21197,
2378,
1006,
5227,
1002,
5227,
1007,
1024,
1029,
19204,
18447,
2121,
12172,
1063,
2065,
1006,
19701,
1027,
1027,
1027,
1002,
17387,
1027,
1002,
5227,
1011,
1028,
16324,
1011,
1028,
2131,
1006,
1002,
2023... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/CoreHome/Controller.php | Controller.getRowEvolutionPopover | public function getRowEvolutionPopover()
{
$rowEvolution = $this->makeRowEvolution($isMulti = false);
$view = new View('@CoreHome/getRowEvolutionPopover');
return $rowEvolution->renderPopover($this, $view);
} | php | public function getRowEvolutionPopover()
{
$rowEvolution = $this->makeRowEvolution($isMulti = false);
$view = new View('@CoreHome/getRowEvolutionPopover');
return $rowEvolution->renderPopover($this, $view);
} | [
"public",
"function",
"getRowEvolutionPopover",
"(",
")",
"{",
"$",
"rowEvolution",
"=",
"$",
"this",
"->",
"makeRowEvolution",
"(",
"$",
"isMulti",
"=",
"false",
")",
";",
"$",
"view",
"=",
"new",
"View",
"(",
"'@CoreHome/getRowEvolutionPopover'",
")",
";",
... | Render the entire row evolution popover for a single row | [
"Render",
"the",
"entire",
"row",
"evolution",
"popover",
"for",
"a",
"single",
"row"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/CoreHome/Controller.php#L208-L213 | train | Get RowEvolution Popover | [
30522,
2270,
3853,
2131,
10524,
6777,
4747,
13700,
16340,
7840,
1006,
1007,
1063,
1002,
20538,
6767,
7630,
3508,
1027,
1002,
2023,
1011,
1028,
9338,
29385,
6767,
7630,
3508,
1006,
1002,
2003,
12274,
7096,
2072,
1027,
6270,
1007,
1025,
30524... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Validation/Concerns/ValidatesAttributes.php | ValidatesAttributes.validateAfter | public function validateAfter($attribute, $value, $parameters)
{
$this->requireParameterCount(1, $parameters, 'after');
return $this->compareDates($attribute, $value, $parameters, '>');
} | php | public function validateAfter($attribute, $value, $parameters)
{
$this->requireParameterCount(1, $parameters, 'after');
return $this->compareDates($attribute, $value, $parameters, '>');
} | [
"public",
"function",
"validateAfter",
"(",
"$",
"attribute",
",",
"$",
"value",
",",
"$",
"parameters",
")",
"{",
"$",
"this",
"->",
"requireParameterCount",
"(",
"1",
",",
"$",
"parameters",
",",
"'after'",
")",
";",
"return",
"$",
"this",
"->",
"compa... | Validate the date is after a given date.
@param string $attribute
@param mixed $value
@param array $parameters
@return bool | [
"Validate",
"the",
"date",
"is",
"after",
"a",
"given",
"date",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Validation/Concerns/ValidatesAttributes.php#L116-L121 | train | Validate that an attribute is after an attribute value. | [
30522,
2270,
3853,
9398,
3686,
10354,
3334,
1006,
1002,
17961,
1010,
1002,
3643,
1010,
1002,
11709,
1007,
1063,
1002,
2023,
1011,
1028,
5478,
28689,
22828,
3597,
16671,
1006,
1015,
1010,
1002,
11709,
1010,
1005,
2044,
1005,
1007,
1025,
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... |
dompdf/dompdf | src/Css/Style.php | Style.set_background | function set_background($val)
{
$val = trim($val);
$important = isset($this->_important_props["background"]);
if ($val === "none") {
$this->_set_style("background_image", "none", $important);
$this->_set_style("background_color", "transparent", $important);
} else {
$pos = array();
$tmp = preg_replace("/\s*\,\s*/", ",", $val); // when rgb() has spaces
$tmp = preg_split("/\s+/", $tmp);
foreach ($tmp as $attr) {
if (mb_substr($attr, 0, 3) === "url" || $attr === "none") {
$this->_set_style("background_image", $this->_image($attr), $important);
} elseif ($attr === "fixed" || $attr === "scroll") {
$this->_set_style("background_attachment", $attr, $important);
} elseif ($attr === "repeat" || $attr === "repeat-x" || $attr === "repeat-y" || $attr === "no-repeat") {
$this->_set_style("background_repeat", $attr, $important);
} elseif (($col = $this->munge_color($attr)) != null) {
$this->_set_style("background_color", is_array($col) ? $col["hex"] : $col, $important);
} else {
$pos[] = $attr;
}
}
if (count($pos)) {
$this->_set_style("background_position", implode(" ", $pos), $important);
}
}
//see __set and __get, on all assignments clear cache, not needed on direct set through __set
$this->_prop_cache["background"] = null;
$this->_props["background"] = $val;
} | php | function set_background($val)
{
$val = trim($val);
$important = isset($this->_important_props["background"]);
if ($val === "none") {
$this->_set_style("background_image", "none", $important);
$this->_set_style("background_color", "transparent", $important);
} else {
$pos = array();
$tmp = preg_replace("/\s*\,\s*/", ",", $val); // when rgb() has spaces
$tmp = preg_split("/\s+/", $tmp);
foreach ($tmp as $attr) {
if (mb_substr($attr, 0, 3) === "url" || $attr === "none") {
$this->_set_style("background_image", $this->_image($attr), $important);
} elseif ($attr === "fixed" || $attr === "scroll") {
$this->_set_style("background_attachment", $attr, $important);
} elseif ($attr === "repeat" || $attr === "repeat-x" || $attr === "repeat-y" || $attr === "no-repeat") {
$this->_set_style("background_repeat", $attr, $important);
} elseif (($col = $this->munge_color($attr)) != null) {
$this->_set_style("background_color", is_array($col) ? $col["hex"] : $col, $important);
} else {
$pos[] = $attr;
}
}
if (count($pos)) {
$this->_set_style("background_position", implode(" ", $pos), $important);
}
}
//see __set and __get, on all assignments clear cache, not needed on direct set through __set
$this->_prop_cache["background"] = null;
$this->_props["background"] = $val;
} | [
"function",
"set_background",
"(",
"$",
"val",
")",
"{",
"$",
"val",
"=",
"trim",
"(",
"$",
"val",
")",
";",
"$",
"important",
"=",
"isset",
"(",
"$",
"this",
"->",
"_important_props",
"[",
"\"background\"",
"]",
")",
";",
"if",
"(",
"$",
"val",
"=... | Sets the background - combined options
@link http://www.w3.org/TR/CSS21/colors.html#propdef-background
@param string $val | [
"Sets",
"the",
"background",
"-",
"combined",
"options"
] | 75f13c700009be21a1965dc2c5b68a8708c22ba2 | https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/src/Css/Style.php#L1909-L1944 | train | set background property | [
30522,
3853,
2275,
1035,
4281,
1006,
1002,
11748,
1007,
1063,
1002,
11748,
1027,
12241,
1006,
1002,
11748,
1007,
1025,
1002,
2590,
1027,
26354,
3388,
1006,
1002,
2023,
1011,
1028,
1035,
2590,
1035,
24387,
1031,
1000,
4281,
1000,
1033,
1007,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/Plugin/Manager.php | Manager.loadAllPluginsAndGetTheirInfo | public function loadAllPluginsAndGetTheirInfo()
{
/** @var Translator $translator */
$translator = StaticContainer::get('Piwik\Translation\Translator');
$plugins = array();
$listPlugins = array_merge(
$this->readPluginsDirectory(),
$this->pluginList->getActivatedPlugins()
);
$listPlugins = array_unique($listPlugins);
$internetFeaturesEnabled = SettingsPiwik::isInternetEnabled();
foreach ($listPlugins as $pluginName) {
// Hide plugins that are never going to be used
if ($this->isPluginBogus($pluginName)) {
continue;
}
// If the plugin is not core and looks bogus, do not load
if ($this->isPluginThirdPartyAndBogus($pluginName)) {
$info = array(
'invalid' => true,
'activated' => false,
'alwaysActivated' => false,
'uninstallable' => true,
);
} else {
$translator->addDirectory(self::getPluginDirectory($pluginName) . '/lang');
$this->loadPlugin($pluginName);
$info = array(
'activated' => $this->isPluginActivated($pluginName),
'alwaysActivated' => $this->isPluginAlwaysActivated($pluginName),
'uninstallable' => $this->isPluginUninstallable($pluginName),
);
}
$plugins[$pluginName] = $info;
}
$loadedPlugins = $this->getLoadedPlugins();
foreach ($loadedPlugins as $oPlugin) {
$pluginName = $oPlugin->getPluginName();
$info = array(
'info' => $oPlugin->getInformation(),
'activated' => $this->isPluginActivated($pluginName),
'alwaysActivated' => $this->isPluginAlwaysActivated($pluginName),
'missingRequirements' => $oPlugin->getMissingDependenciesAsString(),
'uninstallable' => $this->isPluginUninstallable($pluginName),
);
$plugins[$pluginName] = $info;
}
return $plugins;
} | php | public function loadAllPluginsAndGetTheirInfo()
{
/** @var Translator $translator */
$translator = StaticContainer::get('Piwik\Translation\Translator');
$plugins = array();
$listPlugins = array_merge(
$this->readPluginsDirectory(),
$this->pluginList->getActivatedPlugins()
);
$listPlugins = array_unique($listPlugins);
$internetFeaturesEnabled = SettingsPiwik::isInternetEnabled();
foreach ($listPlugins as $pluginName) {
// Hide plugins that are never going to be used
if ($this->isPluginBogus($pluginName)) {
continue;
}
// If the plugin is not core and looks bogus, do not load
if ($this->isPluginThirdPartyAndBogus($pluginName)) {
$info = array(
'invalid' => true,
'activated' => false,
'alwaysActivated' => false,
'uninstallable' => true,
);
} else {
$translator->addDirectory(self::getPluginDirectory($pluginName) . '/lang');
$this->loadPlugin($pluginName);
$info = array(
'activated' => $this->isPluginActivated($pluginName),
'alwaysActivated' => $this->isPluginAlwaysActivated($pluginName),
'uninstallable' => $this->isPluginUninstallable($pluginName),
);
}
$plugins[$pluginName] = $info;
}
$loadedPlugins = $this->getLoadedPlugins();
foreach ($loadedPlugins as $oPlugin) {
$pluginName = $oPlugin->getPluginName();
$info = array(
'info' => $oPlugin->getInformation(),
'activated' => $this->isPluginActivated($pluginName),
'alwaysActivated' => $this->isPluginAlwaysActivated($pluginName),
'missingRequirements' => $oPlugin->getMissingDependenciesAsString(),
'uninstallable' => $this->isPluginUninstallable($pluginName),
);
$plugins[$pluginName] = $info;
}
return $plugins;
} | [
"public",
"function",
"loadAllPluginsAndGetTheirInfo",
"(",
")",
"{",
"/** @var Translator $translator */",
"$",
"translator",
"=",
"StaticContainer",
"::",
"get",
"(",
"'Piwik\\Translation\\Translator'",
")",
";",
"$",
"plugins",
"=",
"array",
"(",
")",
";",
"$",
"... | Returns info regarding all plugins. Loads plugins that can be loaded.
@return array An array that maps plugin names with arrays of plugin information. Plugin
information consists of the following entries:
- **activated**: Whether the plugin is activated.
- **alwaysActivated**: Whether the plugin should always be activated,
or not.
- **uninstallable**: Whether the plugin is uninstallable or not.
- **invalid**: If the plugin is invalid, this property will be set to true.
If the plugin is not invalid, this property will not exist.
- **info**: If the plugin was loaded, will hold the plugin information.
See {@link Piwik\Plugin::getInformation()}.
@api | [
"Returns",
"info",
"regarding",
"all",
"plugins",
".",
"Loads",
"plugins",
"that",
"can",
"be",
"loaded",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Plugin/Manager.php#L756-L811 | train | Returns the information of all plugins and their status | [
30522,
2270,
3853,
7170,
8095,
24759,
15916,
7076,
5685,
18150,
10760,
15735,
2078,
14876,
1006,
1007,
1063,
1013,
1008,
1008,
1030,
13075,
11403,
1002,
11403,
1008,
1013,
1002,
11403,
1027,
10763,
8663,
18249,
2121,
1024,
1024,
2131,
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/classes/ListColumn.php | ListColumn.evalConfig | protected function evalConfig($config)
{
if (isset($config['width'])) {
$this->width = $config['width'];
}
if (isset($config['cssClass'])) {
$this->cssClass = $config['cssClass'];
}
if (isset($config['searchable'])) {
$this->searchable = $config['searchable'];
}
if (isset($config['sortable'])) {
$this->sortable = $config['sortable'];
}
if (isset($config['clickable'])) {
$this->clickable = $config['clickable'];
}
if (isset($config['invisible'])) {
$this->invisible = $config['invisible'];
}
if (isset($config['valueFrom'])) {
$this->valueFrom = $config['valueFrom'];
}
if (isset($config['default'])) {
$this->defaults = $config['default'];
}
if (isset($config['select'])) {
$this->sqlSelect = $config['select'];
}
if (isset($config['relation'])) {
$this->relation = $config['relation'];
}
if (isset($config['format'])) {
$this->format = $config['format'];
}
if (isset($config['path'])) {
$this->path = $config['path'];
}
if (isset($config['align']) && \in_array($config['align'], ['left', 'right', 'center'])) {
$this->align = $config['align'];
}
return $config;
} | php | protected function evalConfig($config)
{
if (isset($config['width'])) {
$this->width = $config['width'];
}
if (isset($config['cssClass'])) {
$this->cssClass = $config['cssClass'];
}
if (isset($config['searchable'])) {
$this->searchable = $config['searchable'];
}
if (isset($config['sortable'])) {
$this->sortable = $config['sortable'];
}
if (isset($config['clickable'])) {
$this->clickable = $config['clickable'];
}
if (isset($config['invisible'])) {
$this->invisible = $config['invisible'];
}
if (isset($config['valueFrom'])) {
$this->valueFrom = $config['valueFrom'];
}
if (isset($config['default'])) {
$this->defaults = $config['default'];
}
if (isset($config['select'])) {
$this->sqlSelect = $config['select'];
}
if (isset($config['relation'])) {
$this->relation = $config['relation'];
}
if (isset($config['format'])) {
$this->format = $config['format'];
}
if (isset($config['path'])) {
$this->path = $config['path'];
}
if (isset($config['align']) && \in_array($config['align'], ['left', 'right', 'center'])) {
$this->align = $config['align'];
}
return $config;
} | [
"protected",
"function",
"evalConfig",
"(",
"$",
"config",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"config",
"[",
"'width'",
"]",
")",
")",
"{",
"$",
"this",
"->",
"width",
"=",
"$",
"config",
"[",
"'width'",
"]",
";",
"}",
"if",
"(",
"isset",
"(... | Process options and apply them to this object.
@param array $config
@return array | [
"Process",
"options",
"and",
"apply",
"them",
"to",
"this",
"object",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/classes/ListColumn.php#L133-L176 | train | Evaluate the config array | [
30522,
5123,
3853,
9345,
22499,
2078,
8873,
2290,
1006,
1002,
9530,
8873,
2290,
1007,
1063,
2065,
1006,
26354,
3388,
1006,
1002,
9530,
8873,
2290,
1031,
1005,
9381,
1005,
1033,
1007,
1007,
1063,
1002,
2023,
1011,
1028,
9381,
1027,
1002,
9... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Client.php | Client.configureDefaults | private function configureDefaults(array $config)
{
$defaults = [
'allow_redirects' => RedirectMiddleware::$defaultSettings,
'http_errors' => true,
'decode_content' => true,
'verify' => true,
'cookies' => false
];
// Use the standard Linux HTTP_PROXY and HTTPS_PROXY if set.
// We can only trust the HTTP_PROXY environment variable in a CLI
// process due to the fact that PHP has no reliable mechanism to
// get environment variables that start with "HTTP_".
if (php_sapi_name() == 'cli' && getenv('HTTP_PROXY')) {
$defaults['proxy']['http'] = getenv('HTTP_PROXY');
}
if ($proxy = getenv('HTTPS_PROXY')) {
$defaults['proxy']['https'] = $proxy;
}
if ($noProxy = getenv('NO_PROXY')) {
$cleanedNoProxy = str_replace(' ', '', $noProxy);
$defaults['proxy']['no'] = explode(',', $cleanedNoProxy);
}
$this->config = $config + $defaults;
if (!empty($config['cookies']) && $config['cookies'] === true) {
$this->config['cookies'] = new CookieJar();
}
// Add the default user-agent header.
if (!isset($this->config['headers'])) {
$this->config['headers'] = ['User-Agent' => default_user_agent()];
} else {
// Add the User-Agent header if one was not already set.
foreach (array_keys($this->config['headers']) as $name) {
if (strtolower($name) === 'user-agent') {
return;
}
}
$this->config['headers']['User-Agent'] = default_user_agent();
}
} | php | private function configureDefaults(array $config)
{
$defaults = [
'allow_redirects' => RedirectMiddleware::$defaultSettings,
'http_errors' => true,
'decode_content' => true,
'verify' => true,
'cookies' => false
];
// Use the standard Linux HTTP_PROXY and HTTPS_PROXY if set.
// We can only trust the HTTP_PROXY environment variable in a CLI
// process due to the fact that PHP has no reliable mechanism to
// get environment variables that start with "HTTP_".
if (php_sapi_name() == 'cli' && getenv('HTTP_PROXY')) {
$defaults['proxy']['http'] = getenv('HTTP_PROXY');
}
if ($proxy = getenv('HTTPS_PROXY')) {
$defaults['proxy']['https'] = $proxy;
}
if ($noProxy = getenv('NO_PROXY')) {
$cleanedNoProxy = str_replace(' ', '', $noProxy);
$defaults['proxy']['no'] = explode(',', $cleanedNoProxy);
}
$this->config = $config + $defaults;
if (!empty($config['cookies']) && $config['cookies'] === true) {
$this->config['cookies'] = new CookieJar();
}
// Add the default user-agent header.
if (!isset($this->config['headers'])) {
$this->config['headers'] = ['User-Agent' => default_user_agent()];
} else {
// Add the User-Agent header if one was not already set.
foreach (array_keys($this->config['headers']) as $name) {
if (strtolower($name) === 'user-agent') {
return;
}
}
$this->config['headers']['User-Agent'] = default_user_agent();
}
} | [
"private",
"function",
"configureDefaults",
"(",
"array",
"$",
"config",
")",
"{",
"$",
"defaults",
"=",
"[",
"'allow_redirects'",
"=>",
"RedirectMiddleware",
"::",
"$",
"defaultSettings",
",",
"'http_errors'",
"=>",
"true",
",",
"'decode_content'",
"=>",
"true",
... | Configures the default options for a client.
@param array $config | [
"Configures",
"the",
"default",
"options",
"for",
"a",
"client",
"."
] | bf595424e4d442a190582e088985dc835a789071 | https://github.com/guzzle/guzzle/blob/bf595424e4d442a190582e088985dc835a789071/src/Client.php#L158-L204 | train | Configure the default values for the HTTP_PROXY and HTTP_NO_PROXY environment variables. | [
30522,
2797,
3853,
26928,
12879,
23505,
2015,
1006,
9140,
1002,
9530,
8873,
2290,
1007,
1063,
1002,
12398,
2015,
1027,
1031,
1005,
3499,
1035,
2417,
7442,
16649,
1005,
1027,
1028,
2417,
7442,
6593,
4328,
20338,
8059,
1024,
1024,
1002,
12398... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
z-song/laravel-admin | database/migrations/2016_01_04_173148_create_admin_tables.php | CreateAdminTables.down | public function down()
{
Schema::dropIfExists(config('admin.database.users_table'));
Schema::dropIfExists(config('admin.database.roles_table'));
Schema::dropIfExists(config('admin.database.permissions_table'));
Schema::dropIfExists(config('admin.database.menu_table'));
Schema::dropIfExists(config('admin.database.user_permissions_table'));
Schema::dropIfExists(config('admin.database.role_users_table'));
Schema::dropIfExists(config('admin.database.role_permissions_table'));
Schema::dropIfExists(config('admin.database.role_menu_table'));
Schema::dropIfExists(config('admin.database.operation_log_table'));
} | php | public function down()
{
Schema::dropIfExists(config('admin.database.users_table'));
Schema::dropIfExists(config('admin.database.roles_table'));
Schema::dropIfExists(config('admin.database.permissions_table'));
Schema::dropIfExists(config('admin.database.menu_table'));
Schema::dropIfExists(config('admin.database.user_permissions_table'));
Schema::dropIfExists(config('admin.database.role_users_table'));
Schema::dropIfExists(config('admin.database.role_permissions_table'));
Schema::dropIfExists(config('admin.database.role_menu_table'));
Schema::dropIfExists(config('admin.database.operation_log_table'));
} | [
"public",
"function",
"down",
"(",
")",
"{",
"Schema",
"::",
"dropIfExists",
"(",
"config",
"(",
"'admin.database.users_table'",
")",
")",
";",
"Schema",
"::",
"dropIfExists",
"(",
"config",
"(",
"'admin.database.roles_table'",
")",
")",
";",
"Schema",
"::",
"... | Reverse the migrations.
@return void | [
"Reverse",
"the",
"migrations",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/database/migrations/2016_01_04_173148_create_admin_tables.php#L107-L118 | train | Down method to drop all tables in the database | [
30522,
2270,
3853,
2091,
1006,
1007,
1063,
8040,
28433,
1024,
30524,
2795,
1005,
1007,
1007,
1025,
8040,
28433,
1024,
1024,
4530,
29323,
9048,
12837,
1006,
9530,
8873,
2290,
1006,
1005,
4748,
10020,
1012,
7809,
1012,
4395,
1035,
2795,
1005,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Validator/Constraints/CallbackValidator.php | CallbackValidator.validate | public function validate($object, Constraint $constraint)
{
if (!$constraint instanceof Callback) {
throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Callback');
}
$method = $constraint->callback;
if ($method instanceof \Closure) {
$method($object, $this->context, $constraint->payload);
} elseif (\is_array($method)) {
if (!\is_callable($method)) {
if (isset($method[0]) && \is_object($method[0])) {
$method[0] = \get_class($method[0]);
}
throw new ConstraintDefinitionException(sprintf('%s targeted by Callback constraint is not a valid callable', json_encode($method)));
}
$method($object, $this->context, $constraint->payload);
} elseif (null !== $object) {
if (!method_exists($object, $method)) {
throw new ConstraintDefinitionException(sprintf('Method "%s" targeted by Callback constraint does not exist in class %s', $method, \get_class($object)));
}
$reflMethod = new \ReflectionMethod($object, $method);
if ($reflMethod->isStatic()) {
$reflMethod->invoke(null, $object, $this->context, $constraint->payload);
} else {
$reflMethod->invoke($object, $this->context, $constraint->payload);
}
}
} | php | public function validate($object, Constraint $constraint)
{
if (!$constraint instanceof Callback) {
throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Callback');
}
$method = $constraint->callback;
if ($method instanceof \Closure) {
$method($object, $this->context, $constraint->payload);
} elseif (\is_array($method)) {
if (!\is_callable($method)) {
if (isset($method[0]) && \is_object($method[0])) {
$method[0] = \get_class($method[0]);
}
throw new ConstraintDefinitionException(sprintf('%s targeted by Callback constraint is not a valid callable', json_encode($method)));
}
$method($object, $this->context, $constraint->payload);
} elseif (null !== $object) {
if (!method_exists($object, $method)) {
throw new ConstraintDefinitionException(sprintf('Method "%s" targeted by Callback constraint does not exist in class %s', $method, \get_class($object)));
}
$reflMethod = new \ReflectionMethod($object, $method);
if ($reflMethod->isStatic()) {
$reflMethod->invoke(null, $object, $this->context, $constraint->payload);
} else {
$reflMethod->invoke($object, $this->context, $constraint->payload);
}
}
} | [
"public",
"function",
"validate",
"(",
"$",
"object",
",",
"Constraint",
"$",
"constraint",
")",
"{",
"if",
"(",
"!",
"$",
"constraint",
"instanceof",
"Callback",
")",
"{",
"throw",
"new",
"UnexpectedTypeException",
"(",
"$",
"constraint",
",",
"__NAMESPACE__"... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Validator/Constraints/CallbackValidator.php#L29-L60 | train | Validate the object with the callback | [
30522,
2270,
3853,
9398,
3686,
1006,
1002,
4874,
1010,
27142,
1002,
27142,
1007,
1063,
2065,
1006,
999,
1002,
27142,
6013,
11253,
2655,
5963,
1007,
1063,
5466,
2047,
9223,
13874,
10288,
24422,
1006,
1002,
27142,
1010,
1035,
1035,
3415,
1532... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
barryvdh/laravel-debugbar | src/DataFormatter/QueryFormatter.php | QueryFormatter.formatSource | public function formatSource($source)
{
if (! is_object($source)) {
return '';
}
$parts = [];
if ($source->namespace) {
$parts['namespace'] = $source->namespace . '::';
}
$parts['name'] = $source->name;
$parts['line'] = ':' . $source->line;
return implode($parts);
} | php | public function formatSource($source)
{
if (! is_object($source)) {
return '';
}
$parts = [];
if ($source->namespace) {
$parts['namespace'] = $source->namespace . '::';
}
$parts['name'] = $source->name;
$parts['line'] = ':' . $source->line;
return implode($parts);
} | [
"public",
"function",
"formatSource",
"(",
"$",
"source",
")",
"{",
"if",
"(",
"!",
"is_object",
"(",
"$",
"source",
")",
")",
"{",
"return",
"''",
";",
"}",
"$",
"parts",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"source",
"->",
"namespace",
")",
"{",... | Format a source object.
@param object|null $source If the backtrace is disabled, the $source will be null.
@return string | [
"Format",
"a",
"source",
"object",
"."
] | 2d195779ea4f809f69764a795e2ec371dbb76a96 | https://github.com/barryvdh/laravel-debugbar/blob/2d195779ea4f809f69764a795e2ec371dbb76a96/src/DataFormatter/QueryFormatter.php#L59-L75 | train | Formats the source of the exception. | [
30522,
2270,
3853,
11630,
8162,
3401,
1006,
1002,
3120,
1007,
1063,
2065,
1006,
999,
2003,
1035,
4874,
1006,
1002,
3120,
1007,
1007,
1063,
2709,
1005,
1005,
1025,
1065,
1002,
3033,
1027,
1031,
1033,
1025,
2065,
1006,
1002,
3120,
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... |
z-song/laravel-admin | src/Form/Field/UploadField.php | UploadField.disk | public function disk($disk)
{
try {
$this->storage = Storage::disk($disk);
} catch (\Exception $exception) {
if (!array_key_exists($disk, config('filesystems.disks'))) {
admin_error(
'Config error.',
"Disk [$disk] not configured, please add a disk config in `config/filesystems.php`."
);
return $this;
}
throw $exception;
}
return $this;
} | php | public function disk($disk)
{
try {
$this->storage = Storage::disk($disk);
} catch (\Exception $exception) {
if (!array_key_exists($disk, config('filesystems.disks'))) {
admin_error(
'Config error.',
"Disk [$disk] not configured, please add a disk config in `config/filesystems.php`."
);
return $this;
}
throw $exception;
}
return $this;
} | [
"public",
"function",
"disk",
"(",
"$",
"disk",
")",
"{",
"try",
"{",
"$",
"this",
"->",
"storage",
"=",
"Storage",
"::",
"disk",
"(",
"$",
"disk",
")",
";",
"}",
"catch",
"(",
"\\",
"Exception",
"$",
"exception",
")",
"{",
"if",
"(",
"!",
"array... | Set disk for storage.
@param string $disk Disks defined in `config/filesystems.php`.
@throws \Exception
@return $this | [
"Set",
"disk",
"for",
"storage",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Form/Field/UploadField.php#L153-L171 | train | Load the filesystem storage | [
30522,
2270,
3853,
9785,
1006,
1002,
9785,
1007,
1063,
3046,
1063,
1002,
2023,
1011,
1028,
5527,
30524,
6453,
1002,
6453,
1007,
1063,
2065,
1006,
999,
9140,
1035,
3145,
1035,
6526,
1006,
1002,
9785,
1010,
9530,
8873,
2290,
1006,
1005,
676... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/FolderStorage.php | FolderStorage.hasKey | public function hasKey(string $key): bool
{
return $key && strpos($key, '@@') === false && file_exists($this->getPathFromKey($key));
} | php | public function hasKey(string $key): bool
{
return $key && strpos($key, '@@') === false && file_exists($this->getPathFromKey($key));
} | [
"public",
"function",
"hasKey",
"(",
"string",
"$",
"key",
")",
":",
"bool",
"{",
"return",
"$",
"key",
"&&",
"strpos",
"(",
"$",
"key",
",",
"'@@'",
")",
"===",
"false",
"&&",
"file_exists",
"(",
"$",
"this",
"->",
"getPathFromKey",
"(",
"$",
"key",... | {@inheritdoc}
@see FlexStorageInterface::hasKey() | [
"{"
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Framework/Flex/Storage/FolderStorage.php#L72-L75 | train | Has key? | [
30522,
2270,
3853,
2038,
14839,
1006,
5164,
1002,
3145,
1007,
1024,
22017,
2140,
1063,
2709,
1002,
3145,
1004,
1004,
2358,
14536,
2891,
1006,
1002,
3145,
1010,
1005,
1030,
1030,
1005,
1007,
1027,
1027,
1027,
6270,
1004,
1004,
5371,
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... |
getgrav/grav | system/src/Grav/Framework/File/AbstractFile.php | AbstractFile.isWritable | public function isWritable(): bool
{
if (!file_exists($this->filepath)) {
return $this->isWritablePath($this->getPath());
}
return is_writable($this->filepath) && is_file($this->filepath);
} | php | public function isWritable(): bool
{
if (!file_exists($this->filepath)) {
return $this->isWritablePath($this->getPath());
}
return is_writable($this->filepath) && is_file($this->filepath);
} | [
"public",
"function",
"isWritable",
"(",
")",
":",
"bool",
"{",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"this",
"->",
"filepath",
")",
")",
"{",
"return",
"$",
"this",
"->",
"isWritablePath",
"(",
"$",
"this",
"->",
"getPath",
"(",
")",
")",
";",
... | {@inheritdoc}
@see FileInterface::isWritable() | [
"{"
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Framework/File/AbstractFile.php#L242-L249 | train | Is writable path | [
30522,
2270,
3853,
2003,
13088,
6590,
3468,
1006,
1007,
1024,
22017,
2140,
1063,
2065,
1006,
999,
5371,
1035,
6526,
1006,
1002,
2023,
1011,
1028,
5371,
15069,
1007,
1007,
1063,
2709,
1002,
2023,
1011,
1028,
2003,
13088,
6590,
3468,
15069,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Cache/DynamoDbStore.php | DynamoDbStore.isExpired | protected function isExpired(array $item, $expiration = null)
{
$expiration = $expiration ?: Carbon::now();
return isset($item[$this->expirationAttribute]) &&
$expiration->getTimestamp() >= $item[$this->expirationAttribute]['N'];
} | php | protected function isExpired(array $item, $expiration = null)
{
$expiration = $expiration ?: Carbon::now();
return isset($item[$this->expirationAttribute]) &&
$expiration->getTimestamp() >= $item[$this->expirationAttribute]['N'];
} | [
"protected",
"function",
"isExpired",
"(",
"array",
"$",
"item",
",",
"$",
"expiration",
"=",
"null",
")",
"{",
"$",
"expiration",
"=",
"$",
"expiration",
"?",
":",
"Carbon",
"::",
"now",
"(",
")",
";",
"return",
"isset",
"(",
"$",
"item",
"[",
"$",
... | Determine if the given item is expired.
@param array $item
@param \DateTimeInterface|null $expiration
@return bool | [
"Determine",
"if",
"the",
"given",
"item",
"is",
"expired",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Cache/DynamoDbStore.php#L176-L182 | train | Checks if an item is expired | [
30522,
5123,
3853,
2003,
10288,
21649,
1006,
9140,
1002,
8875,
1010,
1002,
4654,
16781,
1027,
19701,
1007,
1063,
1002,
4654,
16781,
1027,
1002,
4654,
16781,
1029,
1024,
6351,
1024,
1024,
2085,
1006,
1007,
1025,
2709,
26354,
30524,
1028,
465... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/Zend/Db/Statement/Db2.php | Zend_Db_Statement_Db2._execute | public function _execute(array $params = null)
{
if (!$this->_stmt) {
return false;
}
$retval = true;
if ($params !== null) {
$retval = @db2_execute($this->_stmt, $params);
} else {
$retval = @db2_execute($this->_stmt);
}
if ($retval === false) {
/**
* @see Zend_Db_Statement_Db2_Exception
*/
// require_once 'Zend/Db/Statement/Db2/Exception.php';
throw new Zend_Db_Statement_Db2_Exception(
db2_stmt_errormsg(),
db2_stmt_error());
}
$this->_keys = array();
if ($field_num = $this->columnCount()) {
for ($i = 0; $i < $field_num; $i++) {
$name = db2_field_name($this->_stmt, $i);
$this->_keys[] = $name;
}
}
$this->_values = array();
if ($this->_keys) {
$this->_values = array_fill(0, count($this->_keys), null);
}
return $retval;
} | php | public function _execute(array $params = null)
{
if (!$this->_stmt) {
return false;
}
$retval = true;
if ($params !== null) {
$retval = @db2_execute($this->_stmt, $params);
} else {
$retval = @db2_execute($this->_stmt);
}
if ($retval === false) {
/**
* @see Zend_Db_Statement_Db2_Exception
*/
// require_once 'Zend/Db/Statement/Db2/Exception.php';
throw new Zend_Db_Statement_Db2_Exception(
db2_stmt_errormsg(),
db2_stmt_error());
}
$this->_keys = array();
if ($field_num = $this->columnCount()) {
for ($i = 0; $i < $field_num; $i++) {
$name = db2_field_name($this->_stmt, $i);
$this->_keys[] = $name;
}
}
$this->_values = array();
if ($this->_keys) {
$this->_values = array_fill(0, count($this->_keys), null);
}
return $retval;
} | [
"public",
"function",
"_execute",
"(",
"array",
"$",
"params",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"_stmt",
")",
"{",
"return",
"false",
";",
"}",
"$",
"retval",
"=",
"true",
";",
"if",
"(",
"$",
"params",
"!==",
"null",
")"... | Executes a prepared statement.
@param array $params OPTIONAL Values to bind to parameter placeholders.
@return bool
@throws Zend_Db_Statement_Db2_Exception | [
"Executes",
"a",
"prepared",
"statement",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Statement/Db2.php#L194-L231 | train | Execute the statement and return the result as an array | [
30522,
2270,
3853,
1035,
15389,
1006,
9140,
1002,
11498,
5244,
1027,
19701,
1007,
1063,
2065,
1006,
999,
1002,
2023,
1011,
1028,
1035,
2358,
20492,
1007,
1063,
2709,
6270,
1025,
1065,
1002,
2128,
9189,
2389,
1027,
2995,
1025,
2065,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/backend/controllers/Users.php | Users.myaccount_onSave | public function myaccount_onSave()
{
$result = $this->asExtension('FormController')->update_onSave($this->user->id, 'myaccount');
/*
* If the password or login name has been updated, reauthenticate the user
*/
$loginChanged = $this->user->login != post('User[login]');
$passwordChanged = strlen(post('User[password]'));
if ($loginChanged || $passwordChanged) {
BackendAuth::login($this->user->reload(), true);
}
return $result;
} | php | public function myaccount_onSave()
{
$result = $this->asExtension('FormController')->update_onSave($this->user->id, 'myaccount');
/*
* If the password or login name has been updated, reauthenticate the user
*/
$loginChanged = $this->user->login != post('User[login]');
$passwordChanged = strlen(post('User[password]'));
if ($loginChanged || $passwordChanged) {
BackendAuth::login($this->user->reload(), true);
}
return $result;
} | [
"public",
"function",
"myaccount_onSave",
"(",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"asExtension",
"(",
"'FormController'",
")",
"->",
"update_onSave",
"(",
"$",
"this",
"->",
"user",
"->",
"id",
",",
"'myaccount'",
")",
";",
"/*\n * If t... | Proxy update onSave event | [
"Proxy",
"update",
"onSave",
"event"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/controllers/Users.php#L147-L161 | train | Update the myaccount field | [
30522,
2270,
3853,
2026,
6305,
3597,
16671,
1035,
2006,
3736,
3726,
1006,
1007,
1063,
1002,
2765,
1027,
1002,
2023,
1011,
1028,
2004,
10288,
29048,
1006,
1005,
2433,
8663,
13181,
10820,
1005,
1007,
1011,
1028,
10651,
1035,
2006,
3736,
3726,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Lock/Store/FlockStore.php | FlockStore.delete | public function delete(Key $key)
{
// The lock is maybe not acquired.
if (!$key->hasState(__CLASS__)) {
return;
}
$handle = $key->getState(__CLASS__);
flock($handle, LOCK_UN | LOCK_NB);
fclose($handle);
$key->removeState(__CLASS__);
} | php | public function delete(Key $key)
{
// The lock is maybe not acquired.
if (!$key->hasState(__CLASS__)) {
return;
}
$handle = $key->getState(__CLASS__);
flock($handle, LOCK_UN | LOCK_NB);
fclose($handle);
$key->removeState(__CLASS__);
} | [
"public",
"function",
"delete",
"(",
"Key",
"$",
"key",
")",
"{",
"// The lock is maybe not acquired.",
"if",
"(",
"!",
"$",
"key",
"->",
"hasState",
"(",
"__CLASS__",
")",
")",
"{",
"return",
";",
"}",
"$",
"handle",
"=",
"$",
"key",
"->",
"getState",
... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Lock/Store/FlockStore.php#L117-L130 | train | Delete the key | [
30522,
2270,
3853,
3972,
12870,
1006,
3145,
1002,
3145,
1007,
1063,
1013,
1013,
1996,
5843,
2003,
2672,
2025,
3734,
1012,
2065,
1006,
999,
1002,
3145,
1011,
1028,
2038,
9153,
2618,
1006,
1035,
1035,
2465,
1035,
1035,
1007,
1007,
1063,
270... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Config/Definition/Builder/NodeBuilder.php | NodeBuilder.getNodeClass | protected function getNodeClass($type)
{
$type = strtolower($type);
if (!isset($this->nodeMapping[$type])) {
throw new \RuntimeException(sprintf('The node type "%s" is not registered.', $type));
}
$class = $this->nodeMapping[$type];
if (!class_exists($class)) {
throw new \RuntimeException(sprintf('The node class "%s" does not exist.', $class));
}
return $class;
} | php | protected function getNodeClass($type)
{
$type = strtolower($type);
if (!isset($this->nodeMapping[$type])) {
throw new \RuntimeException(sprintf('The node type "%s" is not registered.', $type));
}
$class = $this->nodeMapping[$type];
if (!class_exists($class)) {
throw new \RuntimeException(sprintf('The node class "%s" does not exist.', $class));
}
return $class;
} | [
"protected",
"function",
"getNodeClass",
"(",
"$",
"type",
")",
"{",
"$",
"type",
"=",
"strtolower",
"(",
"$",
"type",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"nodeMapping",
"[",
"$",
"type",
"]",
")",
")",
"{",
"throw",
"new",
... | Returns the class name of the node definition.
@param string $type The node type
@return string The node definition class name
@throws \RuntimeException When the node type is not registered
@throws \RuntimeException When the node class is not found | [
"Returns",
"the",
"class",
"name",
"of",
"the",
"node",
"definition",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Config/Definition/Builder/NodeBuilder.php#L222-L237 | train | Returns the node class name for the given type | [
30522,
5123,
3853,
2131,
3630,
3207,
26266,
1006,
1002,
2828,
1007,
1063,
1002,
2828,
1027,
2358,
5339,
12898,
13777,
1006,
1002,
2828,
1007,
1025,
2065,
1006,
999,
26354,
3388,
1006,
1002,
2023,
1011,
1028,
13045,
2863,
14853,
1031,
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/backend/classes/FormTabs.php | FormTabs.getPaneCssClass | public function getPaneCssClass($index = null, $label = null)
{
if (is_string($this->paneCssClass)) {
return $this->paneCssClass;
}
if ($index !== null && isset($this->paneCssClass[$index])) {
return $this->paneCssClass[$index];
}
if ($label !== null && isset($this->paneCssClass[$label])) {
return $this->paneCssClass[$label];
}
} | php | public function getPaneCssClass($index = null, $label = null)
{
if (is_string($this->paneCssClass)) {
return $this->paneCssClass;
}
if ($index !== null && isset($this->paneCssClass[$index])) {
return $this->paneCssClass[$index];
}
if ($label !== null && isset($this->paneCssClass[$label])) {
return $this->paneCssClass[$label];
}
} | [
"public",
"function",
"getPaneCssClass",
"(",
"$",
"index",
"=",
"null",
",",
"$",
"label",
"=",
"null",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"this",
"->",
"paneCssClass",
")",
")",
"{",
"return",
"$",
"this",
"->",
"paneCssClass",
";",
"}",
"... | Returns a tab pane CSS class.
@param string $index
@param string $label
@return string | [
"Returns",
"a",
"tab",
"pane",
"CSS",
"class",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/classes/FormTabs.php#L204-L217 | train | Return the pane CSS classes | [
30522,
2270,
3853,
2131,
9739,
8586,
4757,
26266,
1006,
1002,
5950,
1027,
19701,
1010,
1002,
3830,
1027,
19701,
1007,
1063,
2065,
1006,
2003,
1035,
5164,
1006,
1002,
2023,
1011,
1028,
6090,
8586,
4757,
26266,
1007,
1007,
1063,
2709,
1002,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
dompdf/dompdf | src/Cellmap.php | Cellmap.update_row_group | public function update_row_group(Frame $group, Frame $last_row)
{
$g_key = $group->get_id();
$r_key = $last_row->get_id();
$r_rows = $this->_frames[$g_key]["rows"];
$this->_frames[$g_key]["rows"] = range($this->_frames[$g_key]["rows"][0], end($r_rows));
} | php | public function update_row_group(Frame $group, Frame $last_row)
{
$g_key = $group->get_id();
$r_key = $last_row->get_id();
$r_rows = $this->_frames[$g_key]["rows"];
$this->_frames[$g_key]["rows"] = range($this->_frames[$g_key]["rows"][0], end($r_rows));
} | [
"public",
"function",
"update_row_group",
"(",
"Frame",
"$",
"group",
",",
"Frame",
"$",
"last_row",
")",
"{",
"$",
"g_key",
"=",
"$",
"group",
"->",
"get_id",
"(",
")",
";",
"$",
"r_key",
"=",
"$",
"last_row",
"->",
"get_id",
"(",
")",
";",
"$",
"... | Update a row group after rows have been removed
@param Frame $group The group to update
@param Frame $last_row The last row in the row group | [
"Update",
"a",
"row",
"group",
"after",
"rows",
"have",
"been",
"removed"
] | 75f13c700009be21a1965dc2c5b68a8708c22ba2 | https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/src/Cellmap.php#L797-L804 | train | Update the row group | [
30522,
2270,
3853,
10651,
1035,
5216,
1035,
2177,
1006,
4853,
1002,
2177,
1010,
4853,
1002,
2197,
1035,
5216,
1007,
1063,
1002,
1043,
1035,
3145,
1027,
1002,
2177,
1011,
1028,
2131,
1035,
8909,
1006,
1007,
1025,
1002,
1054,
1035,
3145,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/Zend/Db/Select.php | Zend_Db_Select.joinInner | public function joinInner($name, $cond, $cols = self::SQL_WILDCARD, $schema = null)
{
return $this->_join(self::INNER_JOIN, $name, $cond, $cols, $schema);
} | php | public function joinInner($name, $cond, $cols = self::SQL_WILDCARD, $schema = null)
{
return $this->_join(self::INNER_JOIN, $name, $cond, $cols, $schema);
} | [
"public",
"function",
"joinInner",
"(",
"$",
"name",
",",
"$",
"cond",
",",
"$",
"cols",
"=",
"self",
"::",
"SQL_WILDCARD",
",",
"$",
"schema",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"_join",
"(",
"self",
"::",
"INNER_JOIN",
",",
"$",
... | Add an INNER JOIN table and colums to the query
Rows in both tables are matched according to the expression
in the $cond argument. The result set is comprised
of all cases where rows from the left table match
rows from the right table.
The $name and $cols parameters follow the same logic
as described in the from() method.
@param array|string|Zend_Db_Expr $name The table name.
@param string $cond Join on this condition.
@param array|string $cols The columns to select from the joined table.
@param string $schema The database name to specify, if any.
@return Zend_Db_Select This Zend_Db_Select object. | [
"Add",
"an",
"INNER",
"JOIN",
"table",
"and",
"colums",
"to",
"the",
"query",
"Rows",
"in",
"both",
"tables",
"are",
"matched",
"according",
"to",
"the",
"expression",
"in",
"the",
"$cond",
"argument",
".",
"The",
"result",
"set",
"is",
"comprised",
"of",
... | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Select.php#L334-L337 | train | Inner join of the table and the columns of the table | [
30522,
2270,
3853,
3693,
23111,
2121,
1006,
1002,
2171,
1010,
1002,
9530,
2094,
1010,
1002,
8902,
2015,
1027,
2969,
1024,
1024,
29296,
1035,
3748,
11522,
1010,
1002,
8040,
28433,
1027,
19701,
1007,
1063,
2709,
1002,
2023,
1011,
1028,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/SitesManager/API.php | API.setGlobalExcludedUserAgents | public function setGlobalExcludedUserAgents($excludedUserAgents)
{
Piwik::checkUserHasSuperUserAccess();
// update option
$excludedUserAgents = $this->checkAndReturnCommaSeparatedStringList($excludedUserAgents);
Option::set(self::OPTION_EXCLUDED_USER_AGENTS_GLOBAL, $excludedUserAgents);
// make sure tracker cache will reflect change
Cache::deleteTrackerCache();
} | php | public function setGlobalExcludedUserAgents($excludedUserAgents)
{
Piwik::checkUserHasSuperUserAccess();
// update option
$excludedUserAgents = $this->checkAndReturnCommaSeparatedStringList($excludedUserAgents);
Option::set(self::OPTION_EXCLUDED_USER_AGENTS_GLOBAL, $excludedUserAgents);
// make sure tracker cache will reflect change
Cache::deleteTrackerCache();
} | [
"public",
"function",
"setGlobalExcludedUserAgents",
"(",
"$",
"excludedUserAgents",
")",
"{",
"Piwik",
"::",
"checkUserHasSuperUserAccess",
"(",
")",
";",
"// update option",
"$",
"excludedUserAgents",
"=",
"$",
"this",
"->",
"checkAndReturnCommaSeparatedStringList",
"("... | Sets list of user agent substrings to look for when excluding visits. For more info,
@see getExcludedUserAgentsGlobal.
@param string $excludedUserAgents Comma separated list of strings. Each element is trimmed,
and empty strings are removed. | [
"Sets",
"list",
"of",
"user",
"agent",
"substrings",
"to",
"look",
"for",
"when",
"excluding",
"visits",
".",
"For",
"more",
"info",
"@see",
"getExcludedUserAgentsGlobal",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/SitesManager/API.php#L1050-L1060 | train | Sets the list of excluded user agents that should be excluded from the user agent list. | [
30522,
2270,
3853,
2275,
23296,
16429,
9453,
2595,
20464,
13936,
20330,
4270,
7666,
1006,
1002,
12421,
20330,
4270,
7666,
1007,
1063,
14255,
9148,
2243,
1024,
1024,
4638,
20330,
14949,
6342,
4842,
20330,
6305,
9623,
2015,
1006,
1007,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
z-song/laravel-admin | src/Widgets/Widget.php | Widget.attributeElement | protected function attributeElement($key, $value)
{
if (is_numeric($key)) {
$key = $value;
}
if (!is_null($value)) {
return $key.'="'.htmlentities($value, ENT_QUOTES, 'UTF-8').'"';
}
} | php | protected function attributeElement($key, $value)
{
if (is_numeric($key)) {
$key = $value;
}
if (!is_null($value)) {
return $key.'="'.htmlentities($value, ENT_QUOTES, 'UTF-8').'"';
}
} | [
"protected",
"function",
"attributeElement",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"if",
"(",
"is_numeric",
"(",
"$",
"key",
")",
")",
"{",
"$",
"key",
"=",
"$",
"value",
";",
"}",
"if",
"(",
"!",
"is_null",
"(",
"$",
"value",
")",
")",
... | Build a single attribute element.
@param string $key
@param string $value
@return string | [
"Build",
"a",
"single",
"attribute",
"element",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Widgets/Widget.php#L55-L63 | train | Protected attribute element | [
30522,
5123,
3853,
17961,
12260,
3672,
1006,
1002,
3145,
1010,
1002,
3643,
1007,
1063,
2065,
1006,
2003,
1035,
16371,
25531,
1006,
1002,
3145,
1007,
1007,
1063,
1002,
3145,
1027,
1002,
3643,
1025,
1065,
2065,
1006,
999,
2003,
1035,
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... |
laravel/framework | src/Illuminate/Cache/Console/ForgetCommand.php | ForgetCommand.handle | public function handle()
{
$this->cache->store($this->argument('store'))->forget(
$this->argument('key')
);
$this->info('The ['.$this->argument('key').'] key has been removed from the cache.');
} | php | public function handle()
{
$this->cache->store($this->argument('store'))->forget(
$this->argument('key')
);
$this->info('The ['.$this->argument('key').'] key has been removed from the cache.');
} | [
"public",
"function",
"handle",
"(",
")",
"{",
"$",
"this",
"->",
"cache",
"->",
"store",
"(",
"$",
"this",
"->",
"argument",
"(",
"'store'",
")",
")",
"->",
"forget",
"(",
"$",
"this",
"->",
"argument",
"(",
"'key'",
")",
")",
";",
"$",
"this",
... | Execute the console command.
@return void | [
"Execute",
"the",
"console",
"command",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Cache/Console/ForgetCommand.php#L49-L56 | train | Handle the remove action | [
30522,
2270,
3853,
5047,
1006,
1007,
1063,
1002,
2023,
1011,
1028,
17053,
1011,
1028,
3573,
1006,
1002,
2023,
1011,
1028,
6685,
1006,
1005,
3573,
1005,
1007,
1007,
1011,
1028,
5293,
1006,
1002,
2023,
1011,
1028,
6685,
1006,
1005,
3145,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/HTML/QuickForm2/Element/Select.php | HTML_QuickForm2_Element_Select_OptionContainer.addOption | public function addOption($text, $value, $attributes = null)
{
if (null === $attributes) {
$attributes = array('value' => (string)$value);
} else {
$attributes = self::prepareAttributes($attributes);
if (isset($attributes['selected'])) {
// the 'selected' attribute will be set in __toString()
unset($attributes['selected']);
if (!in_array($value, $this->values)) {
$this->values[] = $value;
}
}
$attributes['value'] = (string)$value;
}
if (!isset($attributes['disabled'])) {
$this->possibleValues[(string)$value] = true;
}
$this->options[] = array('text' => $text, 'attr' => $attributes);
} | php | public function addOption($text, $value, $attributes = null)
{
if (null === $attributes) {
$attributes = array('value' => (string)$value);
} else {
$attributes = self::prepareAttributes($attributes);
if (isset($attributes['selected'])) {
// the 'selected' attribute will be set in __toString()
unset($attributes['selected']);
if (!in_array($value, $this->values)) {
$this->values[] = $value;
}
}
$attributes['value'] = (string)$value;
}
if (!isset($attributes['disabled'])) {
$this->possibleValues[(string)$value] = true;
}
$this->options[] = array('text' => $text, 'attr' => $attributes);
} | [
"public",
"function",
"addOption",
"(",
"$",
"text",
",",
"$",
"value",
",",
"$",
"attributes",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"attributes",
")",
"{",
"$",
"attributes",
"=",
"array",
"(",
"'value'",
"=>",
"(",
"string",
")",
... | Adds a new option
Please note that if you pass 'selected' attribute in the $attributes
parameter then this option's value will be added to <select>'s values.
@param string Option text
@param string 'value' attribute for <option> tag
@param mixed Additional attributes for <option> tag (either as a
string or as an associative array) | [
"Adds",
"a",
"new",
"option"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/HTML/QuickForm2/Element/Select.php#L113-L132 | train | Add option to list | [
30522,
2270,
3853,
5587,
7361,
3508,
1006,
1002,
3793,
1010,
1002,
3643,
1010,
1002,
12332,
1027,
19701,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
1027,
1002,
12332,
1007,
1063,
1002,
12332,
1027,
9140,
1006,
1005,
3643,
1005,
1027,
1028,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Validator/Constraints/ChoiceValidator.php | ChoiceValidator.validate | public function validate($value, Constraint $constraint)
{
if (!$constraint instanceof Choice) {
throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Choice');
}
if (!\is_array($constraint->choices) && !$constraint->callback) {
throw new ConstraintDefinitionException('Either "choices" or "callback" must be specified on constraint Choice');
}
if (null === $value) {
return;
}
if ($constraint->multiple && !\is_array($value)) {
throw new UnexpectedValueException($value, 'array');
}
if ($constraint->callback) {
if (!\is_callable($choices = [$this->context->getObject(), $constraint->callback])
&& !\is_callable($choices = [$this->context->getClassName(), $constraint->callback])
&& !\is_callable($choices = $constraint->callback)
) {
throw new ConstraintDefinitionException('The Choice constraint expects a valid callback');
}
$choices = $choices();
} else {
$choices = $constraint->choices;
}
if (true !== $constraint->strict) {
throw new \RuntimeException('The "strict" option of the Choice constraint should not be used.');
}
if ($constraint->multiple) {
foreach ($value as $_value) {
if (!\in_array($_value, $choices, true)) {
$this->context->buildViolation($constraint->multipleMessage)
->setParameter('{{ value }}', $this->formatValue($_value))
->setParameter('{{ choices }}', $this->formatValues($choices))
->setCode(Choice::NO_SUCH_CHOICE_ERROR)
->setInvalidValue($_value)
->addViolation();
return;
}
}
$count = \count($value);
if (null !== $constraint->min && $count < $constraint->min) {
$this->context->buildViolation($constraint->minMessage)
->setParameter('{{ limit }}', $constraint->min)
->setPlural((int) $constraint->min)
->setCode(Choice::TOO_FEW_ERROR)
->addViolation();
return;
}
if (null !== $constraint->max && $count > $constraint->max) {
$this->context->buildViolation($constraint->maxMessage)
->setParameter('{{ limit }}', $constraint->max)
->setPlural((int) $constraint->max)
->setCode(Choice::TOO_MANY_ERROR)
->addViolation();
return;
}
} elseif (!\in_array($value, $choices, true)) {
$this->context->buildViolation($constraint->message)
->setParameter('{{ value }}', $this->formatValue($value))
->setParameter('{{ choices }}', $this->formatValues($choices))
->setCode(Choice::NO_SUCH_CHOICE_ERROR)
->addViolation();
}
} | php | public function validate($value, Constraint $constraint)
{
if (!$constraint instanceof Choice) {
throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Choice');
}
if (!\is_array($constraint->choices) && !$constraint->callback) {
throw new ConstraintDefinitionException('Either "choices" or "callback" must be specified on constraint Choice');
}
if (null === $value) {
return;
}
if ($constraint->multiple && !\is_array($value)) {
throw new UnexpectedValueException($value, 'array');
}
if ($constraint->callback) {
if (!\is_callable($choices = [$this->context->getObject(), $constraint->callback])
&& !\is_callable($choices = [$this->context->getClassName(), $constraint->callback])
&& !\is_callable($choices = $constraint->callback)
) {
throw new ConstraintDefinitionException('The Choice constraint expects a valid callback');
}
$choices = $choices();
} else {
$choices = $constraint->choices;
}
if (true !== $constraint->strict) {
throw new \RuntimeException('The "strict" option of the Choice constraint should not be used.');
}
if ($constraint->multiple) {
foreach ($value as $_value) {
if (!\in_array($_value, $choices, true)) {
$this->context->buildViolation($constraint->multipleMessage)
->setParameter('{{ value }}', $this->formatValue($_value))
->setParameter('{{ choices }}', $this->formatValues($choices))
->setCode(Choice::NO_SUCH_CHOICE_ERROR)
->setInvalidValue($_value)
->addViolation();
return;
}
}
$count = \count($value);
if (null !== $constraint->min && $count < $constraint->min) {
$this->context->buildViolation($constraint->minMessage)
->setParameter('{{ limit }}', $constraint->min)
->setPlural((int) $constraint->min)
->setCode(Choice::TOO_FEW_ERROR)
->addViolation();
return;
}
if (null !== $constraint->max && $count > $constraint->max) {
$this->context->buildViolation($constraint->maxMessage)
->setParameter('{{ limit }}', $constraint->max)
->setPlural((int) $constraint->max)
->setCode(Choice::TOO_MANY_ERROR)
->addViolation();
return;
}
} elseif (!\in_array($value, $choices, true)) {
$this->context->buildViolation($constraint->message)
->setParameter('{{ value }}', $this->formatValue($value))
->setParameter('{{ choices }}', $this->formatValues($choices))
->setCode(Choice::NO_SUCH_CHOICE_ERROR)
->addViolation();
}
} | [
"public",
"function",
"validate",
"(",
"$",
"value",
",",
"Constraint",
"$",
"constraint",
")",
"{",
"if",
"(",
"!",
"$",
"constraint",
"instanceof",
"Choice",
")",
"{",
"throw",
"new",
"UnexpectedTypeException",
"(",
"$",
"constraint",
",",
"__NAMESPACE__",
... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Validator/Constraints/ChoiceValidator.php#L32-L108 | train | Validates the value against the Choice constraint | [
30522,
2270,
3853,
9398,
3686,
1006,
1002,
3643,
1010,
27142,
1002,
27142,
1007,
1063,
2065,
1006,
999,
1002,
27142,
6013,
11253,
3601,
1007,
1063,
5466,
2047,
9223,
13874,
10288,
24422,
1006,
1002,
27142,
1010,
1035,
1035,
3415,
15327,
103... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Routing/Middleware/ThrottleRequests.php | ThrottleRequests.resolveRequestSignature | protected function resolveRequestSignature($request)
{
if ($user = $request->user()) {
return sha1($user->getAuthIdentifier());
}
if ($route = $request->route()) {
return sha1($route->getDomain().'|'.$request->ip());
}
throw new RuntimeException('Unable to generate the request signature. Route unavailable.');
} | php | protected function resolveRequestSignature($request)
{
if ($user = $request->user()) {
return sha1($user->getAuthIdentifier());
}
if ($route = $request->route()) {
return sha1($route->getDomain().'|'.$request->ip());
}
throw new RuntimeException('Unable to generate the request signature. Route unavailable.');
} | [
"protected",
"function",
"resolveRequestSignature",
"(",
"$",
"request",
")",
"{",
"if",
"(",
"$",
"user",
"=",
"$",
"request",
"->",
"user",
"(",
")",
")",
"{",
"return",
"sha1",
"(",
"$",
"user",
"->",
"getAuthIdentifier",
"(",
")",
")",
";",
"}",
... | Resolve request signature.
@param \Illuminate\Http\Request $request
@return string
@throws \RuntimeException | [
"Resolve",
"request",
"signature",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Routing/Middleware/ThrottleRequests.php#L94-L105 | train | Resolve the request signature | [
30522,
5123,
3853,
10663,
2890,
15500,
5332,
16989,
11244,
1006,
1002,
5227,
1007,
1063,
2065,
1006,
1002,
5310,
1027,
1002,
5227,
1011,
1028,
5310,
1006,
1007,
1007,
1063,
2709,
21146,
2487,
1006,
1002,
5310,
1011,
1028,
2131,
4887,
15222,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
overtrue/wechat | src/OfficialAccount/Broadcasting/Client.php | Client.sendMessage | public function sendMessage(MessageInterface $message, $reception = null, $attributes = [])
{
$message = (new MessageBuilder())->message($message)->with($attributes)->toAll();
if (\is_int($reception)) {
$message->toTag($reception);
} elseif (\is_array($reception)) {
$message->toUsers($reception);
}
return $this->send($message->build());
} | php | public function sendMessage(MessageInterface $message, $reception = null, $attributes = [])
{
$message = (new MessageBuilder())->message($message)->with($attributes)->toAll();
if (\is_int($reception)) {
$message->toTag($reception);
} elseif (\is_array($reception)) {
$message->toUsers($reception);
}
return $this->send($message->build());
} | [
"public",
"function",
"sendMessage",
"(",
"MessageInterface",
"$",
"message",
",",
"$",
"reception",
"=",
"null",
",",
"$",
"attributes",
"=",
"[",
"]",
")",
"{",
"$",
"message",
"=",
"(",
"new",
"MessageBuilder",
"(",
")",
")",
"->",
"message",
"(",
"... | @param \EasyWeChat\Kernel\Contracts\MessageInterface $message
@param mixed $reception
@param array $attributes
@return mixed
@throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
@throws \EasyWeChat\Kernel\Exceptions\RuntimeException | [
"@param",
"\\",
"EasyWeChat",
"\\",
"Kernel",
"\\",
"Contracts",
"\\",
"MessageInterface",
"$message",
"@param",
"mixed",
"$reception",
"@param",
"array",
"$attributes"
] | 120c72faaa93c270365bc75c73c362d5fd583209 | https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/OfficialAccount/Broadcasting/Client.php#L348-L359 | train | Send a message to all users or tags | [
30522,
2270,
3853,
4604,
7834,
3736,
3351,
1006,
4471,
18447,
2121,
12172,
1002,
4471,
1010,
1002,
7684,
1027,
19701,
1010,
1002,
12332,
1027,
1031,
1033,
1007,
1063,
1002,
4471,
1027,
1006,
2047,
4471,
8569,
23891,
2099,
1006,
1007,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/Annotations/API.php | API.getDateRangeForPeriod | public static function getDateRangeForPeriod($date, $period, $lastN = false)
{
if ($date === false) {
return array(false, false);
}
$isMultiplePeriod = Range::isMultiplePeriod($date, $period);
// if the range is just a normal period (or the period is a range in which case lastN is ignored)
if ($period == 'range') {
$oPeriod = new Range('day', $date);
$startDate = $oPeriod->getDateStart();
$endDate = $oPeriod->getDateEnd();
} else if ($lastN == false && !$isMultiplePeriod) {
$oPeriod = Period\Factory::build($period, Date::factory($date));
$startDate = $oPeriod->getDateStart();
$endDate = $oPeriod->getDateEnd();
} else { // if the range includes the last N periods or is a multiple period
if (!$isMultiplePeriod) {
list($date, $lastN) = EvolutionViz::getDateRangeAndLastN($period, $date, $lastN);
}
list($startDate, $endDate) = explode(',', $date);
$startDate = Date::factory($startDate);
$endDate = Date::factory($endDate);
}
return array($startDate, $endDate);
} | php | public static function getDateRangeForPeriod($date, $period, $lastN = false)
{
if ($date === false) {
return array(false, false);
}
$isMultiplePeriod = Range::isMultiplePeriod($date, $period);
// if the range is just a normal period (or the period is a range in which case lastN is ignored)
if ($period == 'range') {
$oPeriod = new Range('day', $date);
$startDate = $oPeriod->getDateStart();
$endDate = $oPeriod->getDateEnd();
} else if ($lastN == false && !$isMultiplePeriod) {
$oPeriod = Period\Factory::build($period, Date::factory($date));
$startDate = $oPeriod->getDateStart();
$endDate = $oPeriod->getDateEnd();
} else { // if the range includes the last N periods or is a multiple period
if (!$isMultiplePeriod) {
list($date, $lastN) = EvolutionViz::getDateRangeAndLastN($period, $date, $lastN);
}
list($startDate, $endDate) = explode(',', $date);
$startDate = Date::factory($startDate);
$endDate = Date::factory($endDate);
}
return array($startDate, $endDate);
} | [
"public",
"static",
"function",
"getDateRangeForPeriod",
"(",
"$",
"date",
",",
"$",
"period",
",",
"$",
"lastN",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"date",
"===",
"false",
")",
"{",
"return",
"array",
"(",
"false",
",",
"false",
")",
";",
"}",
... | Returns start & end dates for the range described by a period and optional lastN
argument.
@param string|bool $date The start date of the period (or the date range of a range
period).
@param string $period The period type ('day', 'week', 'month', 'year' or 'range').
@param bool|int $lastN Whether to include the last N periods in the range or not.
Ignored if period == range.
@return Date[] array of Date objects or array(false, false)
@ignore | [
"Returns",
"start",
"&",
"end",
"dates",
"for",
"the",
"range",
"described",
"by",
"a",
"period",
"and",
"optional",
"lastN",
"argument",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Annotations/API.php#L317-L344 | train | Get the start and end dates for a period | [
30522,
2270,
10763,
3853,
2131,
13701,
24388,
12879,
2953,
4842,
3695,
2094,
1006,
1002,
3058,
1010,
1002,
2558,
1010,
1002,
2197,
2078,
1027,
6270,
1007,
1063,
2065,
1006,
1002,
3058,
1027,
1027,
1027,
6270,
1007,
1063,
2709,
9140,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Validator/Mapping/Loader/FilesLoader.php | FilesLoader.getFileLoaders | protected function getFileLoaders($paths)
{
$loaders = [];
foreach ($paths as $path) {
$loaders[] = $this->getFileLoaderInstance($path);
}
return $loaders;
} | php | protected function getFileLoaders($paths)
{
$loaders = [];
foreach ($paths as $path) {
$loaders[] = $this->getFileLoaderInstance($path);
}
return $loaders;
} | [
"protected",
"function",
"getFileLoaders",
"(",
"$",
"paths",
")",
"{",
"$",
"loaders",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"paths",
"as",
"$",
"path",
")",
"{",
"$",
"loaders",
"[",
"]",
"=",
"$",
"this",
"->",
"getFileLoaderInstance",
"(",
"$"... | Returns an array of file loaders for the given file paths.
@param array $paths An array of file paths
@return LoaderInterface[] The metadata loaders | [
"Returns",
"an",
"array",
"of",
"file",
"loaders",
"for",
"the",
"given",
"file",
"paths",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Validator/Mapping/Loader/FilesLoader.php#L42-L51 | train | Get all file loaders | [
30522,
5123,
3853,
2131,
8873,
2571,
11066,
2545,
1006,
1002,
10425,
1007,
1063,
1002,
7170,
2545,
1027,
1031,
1033,
1025,
18921,
6776,
1006,
1002,
10425,
2004,
1002,
4130,
1007,
1063,
1002,
7170,
2545,
1031,
1033,
1027,
1002,
2023,
1011,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/Annotations/AnnotationList.php | AnnotationList.search | public function search($startDate, $endDate, $idSite = false)
{
if ($idSite) {
$idSites = Site::getIdSitesFromIdSitesString($idSite);
} else {
$idSites = array_keys($this->annotations);
}
// collect annotations that are within the right date range & belong to the right
// site
$result = array();
foreach ($idSites as $idSite) {
if (!isset($this->annotations[$idSite])) {
continue;
}
foreach ($this->annotations[$idSite] as $idNote => $annotation) {
if ($startDate !== false) {
$annotationDate = Date::factory($annotation['date']);
if ($annotationDate->getTimestamp() < $startDate->getTimestamp()
|| $annotationDate->getTimestamp() > $endDate->getTimestamp()
) {
continue;
}
}
$this->augmentAnnotationData($idSite, $idNote, $annotation);
$result[$idSite][] = $annotation;
}
// sort by annotation date
if (!empty($result[$idSite])) {
uasort($result[$idSite], array($this, 'compareAnnotationDate'));
}
}
return $result;
} | php | public function search($startDate, $endDate, $idSite = false)
{
if ($idSite) {
$idSites = Site::getIdSitesFromIdSitesString($idSite);
} else {
$idSites = array_keys($this->annotations);
}
// collect annotations that are within the right date range & belong to the right
// site
$result = array();
foreach ($idSites as $idSite) {
if (!isset($this->annotations[$idSite])) {
continue;
}
foreach ($this->annotations[$idSite] as $idNote => $annotation) {
if ($startDate !== false) {
$annotationDate = Date::factory($annotation['date']);
if ($annotationDate->getTimestamp() < $startDate->getTimestamp()
|| $annotationDate->getTimestamp() > $endDate->getTimestamp()
) {
continue;
}
}
$this->augmentAnnotationData($idSite, $idNote, $annotation);
$result[$idSite][] = $annotation;
}
// sort by annotation date
if (!empty($result[$idSite])) {
uasort($result[$idSite], array($this, 'compareAnnotationDate'));
}
}
return $result;
} | [
"public",
"function",
"search",
"(",
"$",
"startDate",
",",
"$",
"endDate",
",",
"$",
"idSite",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"idSite",
")",
"{",
"$",
"idSites",
"=",
"Site",
"::",
"getIdSitesFromIdSitesString",
"(",
"$",
"idSite",
")",
";",
... | Returns all annotations within a specific date range. The result is
an array that maps site IDs with arrays of annotations within the range.
Note: The date range is inclusive.
@see self::get for info on what attributes stored within annotations.
@param Date|bool $startDate The start of the date range.
@param Date|bool $endDate The end of the date range.
@param array|bool|int|string $idSite IDs of the sites whose annotations to
search through.
@return array Array mapping site IDs with arrays of annotations, eg:
array(
'5' => array(
array(...), // annotation
array(...), // annotation
...
),
'6' => array(
array(...), // annotation
array(...), // annotation
...
),
) | [
"Returns",
"all",
"annotations",
"within",
"a",
"specific",
"date",
"range",
".",
"The",
"result",
"is",
"an",
"array",
"that",
"maps",
"site",
"IDs",
"with",
"arrays",
"of",
"annotations",
"within",
"the",
"range",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Annotations/AnnotationList.php#L234-L270 | train | Search for annotations within a given date range | [
30522,
2270,
3853,
3945,
1006,
1002,
2707,
13701,
1010,
1002,
2203,
13701,
1010,
1002,
8909,
28032,
2063,
1027,
6270,
1007,
1063,
2065,
1006,
1002,
8909,
28032,
2063,
1007,
1063,
1002,
8909,
28032,
2229,
1027,
2609,
1024,
1024,
2131,
9821,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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_body_link | static protected function _set_body_link(\DOMElement $node, $value)
{
$a_list = $node->getElementsByTagName("a");
$value = self::_get_valid_color($value);
foreach ($a_list as $a) {
self::append_style($a, "; color: $value;");
}
return null;
} | php | static protected function _set_body_link(\DOMElement $node, $value)
{
$a_list = $node->getElementsByTagName("a");
$value = self::_get_valid_color($value);
foreach ($a_list as $a) {
self::append_style($a, "; color: $value;");
}
return null;
} | [
"static",
"protected",
"function",
"_set_body_link",
"(",
"\\",
"DOMElement",
"$",
"node",
",",
"$",
"value",
")",
"{",
"$",
"a_list",
"=",
"$",
"node",
"->",
"getElementsByTagName",
"(",
"\"a\"",
")",
";",
"$",
"value",
"=",
"self",
"::",
"_get_valid_colo... | @param \DOMElement $node
@param string $value
@return null | [
"@param",
"\\",
"DOMElement",
"$node",
"@param",
"string",
"$value"
] | 75f13c700009be21a1965dc2c5b68a8708c22ba2 | https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/src/Css/AttributeTranslator.php#L590-L600 | train | Set the color link on the body of the page | [
30522,
10763,
5123,
3853,
1035,
2275,
1035,
2303,
1035,
4957,
1006,
1032,
8514,
16930,
4765,
1002,
13045,
1010,
1002,
3643,
1007,
1063,
1002,
1037,
1035,
2862,
1027,
1002,
13045,
1011,
1028,
2131,
12260,
8163,
3762,
15900,
18442,
1006,
1000... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Filesystem/FilesystemAdapter.php | FilesystemAdapter.prepend | public function prepend($path, $data, $separator = PHP_EOL)
{
if ($this->exists($path)) {
return $this->put($path, $data.$separator.$this->get($path));
}
return $this->put($path, $data);
} | php | public function prepend($path, $data, $separator = PHP_EOL)
{
if ($this->exists($path)) {
return $this->put($path, $data.$separator.$this->get($path));
}
return $this->put($path, $data);
} | [
"public",
"function",
"prepend",
"(",
"$",
"path",
",",
"$",
"data",
",",
"$",
"separator",
"=",
"PHP_EOL",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"exists",
"(",
"$",
"path",
")",
")",
"{",
"return",
"$",
"this",
"->",
"put",
"(",
"$",
"path",
... | Prepend to a file.
@param string $path
@param string $data
@param string $separator
@return bool | [
"Prepend",
"to",
"a",
"file",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Filesystem/FilesystemAdapter.php#L273-L280 | train | Prepends data to a file or directory. | [
30522,
2270,
3853,
17463,
10497,
1006,
1002,
4130,
1010,
1002,
2951,
1010,
1002,
19802,
25879,
2953,
1027,
25718,
1035,
1041,
4747,
1007,
1063,
2065,
1006,
1002,
2023,
1011,
1028,
6526,
1006,
1002,
4130,
1007,
1007,
1063,
2709,
1002,
2023,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
slimphp/Slim | Slim/Http/Request.php | Request.filterMethod | protected function filterMethod($method)
{
if ($method === null) {
return $method;
}
if (!is_string($method)) {
throw new InvalidArgumentException(sprintf(
'Unsupported HTTP method; must be a string, received %s',
(is_object($method) ? get_class($method) : gettype($method))
));
}
$method = strtoupper($method);
if (preg_match("/^[!#$%&'*+.^_`|~0-9a-z-]+$/i", $method) !== 1) {
throw new InvalidMethodException($this, $method);
}
return $method;
} | php | protected function filterMethod($method)
{
if ($method === null) {
return $method;
}
if (!is_string($method)) {
throw new InvalidArgumentException(sprintf(
'Unsupported HTTP method; must be a string, received %s',
(is_object($method) ? get_class($method) : gettype($method))
));
}
$method = strtoupper($method);
if (preg_match("/^[!#$%&'*+.^_`|~0-9a-z-]+$/i", $method) !== 1) {
throw new InvalidMethodException($this, $method);
}
return $method;
} | [
"protected",
"function",
"filterMethod",
"(",
"$",
"method",
")",
"{",
"if",
"(",
"$",
"method",
"===",
"null",
")",
"{",
"return",
"$",
"method",
";",
"}",
"if",
"(",
"!",
"is_string",
"(",
"$",
"method",
")",
")",
"{",
"throw",
"new",
"InvalidArgum... | Validate the HTTP method
@param null|string $method
@return null|string
@throws InvalidArgumentException on invalid HTTP method. | [
"Validate",
"the",
"HTTP",
"method"
] | ccef5f7d8bcd469d59cbe64f6210d83764f91543 | https://github.com/slimphp/Slim/blob/ccef5f7d8bcd469d59cbe64f6210d83764f91543/Slim/Http/Request.php#L331-L350 | train | Filter the HTTP method to the correct format | [
30522,
5123,
3853,
11307,
11368,
6806,
2094,
1006,
1002,
4118,
1007,
1063,
2065,
1006,
1002,
4118,
1027,
1027,
1027,
19701,
1007,
1063,
2709,
1002,
4118,
1025,
1065,
2065,
1006,
999,
2003,
1035,
5164,
1006,
1002,
4118,
1007,
1007,
1063,
5... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Support/Collection.php | Collection.valueRetriever | protected function valueRetriever($value)
{
if ($this->useAsCallable($value)) {
return $value;
}
return function ($item) use ($value) {
return data_get($item, $value);
};
} | php | protected function valueRetriever($value)
{
if ($this->useAsCallable($value)) {
return $value;
}
return function ($item) use ($value) {
return data_get($item, $value);
};
} | [
"protected",
"function",
"valueRetriever",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"useAsCallable",
"(",
"$",
"value",
")",
")",
"{",
"return",
"$",
"value",
";",
"}",
"return",
"function",
"(",
"$",
"item",
")",
"use",
"(",
"$",
... | Get a value retrieving callback.
@param string $value
@return callable | [
"Get",
"a",
"value",
"retrieving",
"callback",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Support/Collection.php#L1860-L1869 | train | Returns a value that can be used to retrieve the value from the cache | [
30522,
5123,
3853,
3643,
13465,
7373,
6299,
1006,
1002,
3643,
1007,
1063,
2065,
1006,
1002,
2023,
1011,
1028,
2224,
3022,
9289,
20470,
2571,
1006,
1002,
3643,
1007,
1007,
1063,
2709,
1002,
3643,
1025,
1065,
2709,
3853,
1006,
1002,
8875,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
z-song/laravel-admin | src/Form/Builder.php | Builder.render | public function render()
{
$this->removeReservedFields();
$tabObj = $this->form->getTab();
if (!$tabObj->isEmpty()) {
$script = <<<'SCRIPT'
var hash = document.location.hash;
if (hash) {
$('.nav-tabs a[href="' + hash + '"]').tab('show');
}
// Change hash for page-reload
$('.nav-tabs a').on('shown.bs.tab', function (e) {
history.pushState(null,null, e.target.hash);
});
if ($('.has-error').length) {
$('.has-error').each(function () {
var tabId = '#'+$(this).closest('.tab-pane').attr('id');
$('li a[href="'+tabId+'"] i').removeClass('hide');
});
var first = $('.has-error:first').closest('.tab-pane').attr('id');
$('li a[href="#'+first+'"]').tab('show');
}
SCRIPT;
Admin::script($script);
}
$data = [
'form' => $this,
'tabObj' => $tabObj,
'width' => $this->width,
];
return view($this->view, $data)->render();
} | php | public function render()
{
$this->removeReservedFields();
$tabObj = $this->form->getTab();
if (!$tabObj->isEmpty()) {
$script = <<<'SCRIPT'
var hash = document.location.hash;
if (hash) {
$('.nav-tabs a[href="' + hash + '"]').tab('show');
}
// Change hash for page-reload
$('.nav-tabs a').on('shown.bs.tab', function (e) {
history.pushState(null,null, e.target.hash);
});
if ($('.has-error').length) {
$('.has-error').each(function () {
var tabId = '#'+$(this).closest('.tab-pane').attr('id');
$('li a[href="'+tabId+'"] i').removeClass('hide');
});
var first = $('.has-error:first').closest('.tab-pane').attr('id');
$('li a[href="#'+first+'"]').tab('show');
}
SCRIPT;
Admin::script($script);
}
$data = [
'form' => $this,
'tabObj' => $tabObj,
'width' => $this->width,
];
return view($this->view, $data)->render();
} | [
"public",
"function",
"render",
"(",
")",
"{",
"$",
"this",
"->",
"removeReservedFields",
"(",
")",
";",
"$",
"tabObj",
"=",
"$",
"this",
"->",
"form",
"->",
"getTab",
"(",
")",
";",
"if",
"(",
"!",
"$",
"tabObj",
"->",
"isEmpty",
"(",
")",
")",
... | Render form.
@return string | [
"Render",
"form",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Form/Builder.php#L564-L604 | train | Render the form | [
30522,
2270,
3853,
17552,
1006,
1007,
1063,
1002,
2023,
1011,
1028,
6366,
6072,
25944,
15155,
1006,
1007,
1025,
1002,
21628,
16429,
3501,
1027,
1002,
2023,
1011,
1028,
2433,
1011,
1028,
2131,
2696,
2497,
1006,
1007,
1025,
2065,
1006,
999,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Bus/Dispatcher.php | Dispatcher.dispatchNow | public function dispatchNow($command, $handler = null)
{
if ($handler || $handler = $this->getCommandHandler($command)) {
$callback = function ($command) use ($handler) {
return $handler->handle($command);
};
} else {
$callback = function ($command) {
return $this->container->call([$command, 'handle']);
};
}
return $this->pipeline->send($command)->through($this->pipes)->then($callback);
} | php | public function dispatchNow($command, $handler = null)
{
if ($handler || $handler = $this->getCommandHandler($command)) {
$callback = function ($command) use ($handler) {
return $handler->handle($command);
};
} else {
$callback = function ($command) {
return $this->container->call([$command, 'handle']);
};
}
return $this->pipeline->send($command)->through($this->pipes)->then($callback);
} | [
"public",
"function",
"dispatchNow",
"(",
"$",
"command",
",",
"$",
"handler",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"handler",
"||",
"$",
"handler",
"=",
"$",
"this",
"->",
"getCommandHandler",
"(",
"$",
"command",
")",
")",
"{",
"$",
"callback",
"... | Dispatch a command to its appropriate handler in the current process.
@param mixed $command
@param mixed $handler
@return mixed | [
"Dispatch",
"a",
"command",
"to",
"its",
"appropriate",
"handler",
"in",
"the",
"current",
"process",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Bus/Dispatcher.php#L86-L99 | train | Dispatches a command to the application | [
30522,
2270,
3853,
18365,
19779,
1006,
1002,
3094,
1010,
1002,
28213,
1027,
19701,
1007,
1063,
2065,
1006,
1002,
28213,
1064,
1064,
1002,
28213,
1027,
1002,
2023,
1011,
1028,
2131,
9006,
2386,
17516,
4859,
3917,
1006,
1002,
3094,
1007,
1007... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/Zend/Mail/Storage/Imap.php | Zend_Mail_Storage_Imap.removeMessage | public function removeMessage($id)
{
if (!$this->_protocol->store(array(Zend_Mail_Storage::FLAG_DELETED), $id, null, '+')) {
/**
* @see Zend_Mail_Storage_Exception
*/
// require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('cannot set deleted flag');
}
// TODO: expunge here or at close? we can handle an error here better and are more fail safe
if (!$this->_protocol->expunge()) {
/**
* @see Zend_Mail_Storage_Exception
*/
// require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('message marked as deleted, but could not expunge');
}
} | php | public function removeMessage($id)
{
if (!$this->_protocol->store(array(Zend_Mail_Storage::FLAG_DELETED), $id, null, '+')) {
/**
* @see Zend_Mail_Storage_Exception
*/
// require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('cannot set deleted flag');
}
// TODO: expunge here or at close? we can handle an error here better and are more fail safe
if (!$this->_protocol->expunge()) {
/**
* @see Zend_Mail_Storage_Exception
*/
// require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('message marked as deleted, but could not expunge');
}
} | [
"public",
"function",
"removeMessage",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"_protocol",
"->",
"store",
"(",
"array",
"(",
"Zend_Mail_Storage",
"::",
"FLAG_DELETED",
")",
",",
"$",
"id",
",",
"null",
",",
"'+'",
")",
")",
"{",... | Remove a message from server. If you're doing that from a web enviroment
you should be careful and use a uniqueid as parameter if possible to
identify the message.
@param int $id number of message
@return null
@throws Zend_Mail_Storage_Exception | [
"Remove",
"a",
"message",
"from",
"server",
".",
"If",
"you",
"re",
"doing",
"that",
"from",
"a",
"web",
"enviroment",
"you",
"should",
"be",
"careful",
"and",
"use",
"a",
"uniqueid",
"as",
"parameter",
"if",
"possible",
"to",
"identify",
"the",
"message",... | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Mail/Storage/Imap.php#L322-L339 | train | Remove a message from the store | [
30522,
2270,
3853,
6366,
7834,
3736,
3351,
1006,
1002,
8909,
1007,
1063,
2065,
1006,
999,
1002,
2023,
1011,
1028,
1035,
8778,
1011,
1028,
3573,
1006,
9140,
1006,
16729,
2094,
1035,
5653,
1035,
5527,
1024,
1024,
5210,
1035,
17159,
1007,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/DependencyInjection/ContainerBuilder.php | ContainerBuilder.getEnv | protected function getEnv($name)
{
$value = parent::getEnv($name);
$bag = $this->getParameterBag();
if (!\is_string($value) || !$bag instanceof EnvPlaceholderParameterBag) {
return $value;
}
$envPlaceholders = $bag->getEnvPlaceholders();
if (isset($envPlaceholders[$name][$value])) {
$bag = new ParameterBag($bag->all());
return $bag->unescapeValue($bag->get("env($name)"));
}
foreach ($envPlaceholders as $env => $placeholders) {
if (isset($placeholders[$value])) {
return $this->getEnv($env);
}
}
$this->resolving["env($name)"] = true;
try {
return $bag->unescapeValue($this->resolveEnvPlaceholders($bag->escapeValue($value), true));
} finally {
unset($this->resolving["env($name)"]);
}
} | php | protected function getEnv($name)
{
$value = parent::getEnv($name);
$bag = $this->getParameterBag();
if (!\is_string($value) || !$bag instanceof EnvPlaceholderParameterBag) {
return $value;
}
$envPlaceholders = $bag->getEnvPlaceholders();
if (isset($envPlaceholders[$name][$value])) {
$bag = new ParameterBag($bag->all());
return $bag->unescapeValue($bag->get("env($name)"));
}
foreach ($envPlaceholders as $env => $placeholders) {
if (isset($placeholders[$value])) {
return $this->getEnv($env);
}
}
$this->resolving["env($name)"] = true;
try {
return $bag->unescapeValue($this->resolveEnvPlaceholders($bag->escapeValue($value), true));
} finally {
unset($this->resolving["env($name)"]);
}
} | [
"protected",
"function",
"getEnv",
"(",
"$",
"name",
")",
"{",
"$",
"value",
"=",
"parent",
"::",
"getEnv",
"(",
"$",
"name",
")",
";",
"$",
"bag",
"=",
"$",
"this",
"->",
"getParameterBag",
"(",
")",
";",
"if",
"(",
"!",
"\\",
"is_string",
"(",
... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DependencyInjection/ContainerBuilder.php#L1590-L1617 | train | Get the value of the environment variable. | [
30522,
5123,
3853,
2131,
2368,
2615,
1006,
1002,
2171,
1007,
1063,
1002,
3643,
1027,
6687,
1024,
1024,
2131,
2368,
2615,
1006,
1002,
2171,
1007,
1025,
1002,
4524,
1027,
1002,
2023,
1011,
1028,
2131,
28689,
22828,
16078,
1006,
1007,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
walkor/Workerman | Events/Event.php | Event.timerCallback | public function timerCallback($fd, $what, $param)
{
$timer_id = $param[4];
if ($param[2] === self::EV_TIMER_ONCE) {
$this->_eventTimer[$timer_id]->del();
unset($this->_eventTimer[$timer_id]);
}
try {
call_user_func_array($param[0], $param[1]);
} catch (\Exception $e) {
Worker::log($e);
exit(250);
} catch (\Error $e) {
Worker::log($e);
exit(250);
}
} | php | public function timerCallback($fd, $what, $param)
{
$timer_id = $param[4];
if ($param[2] === self::EV_TIMER_ONCE) {
$this->_eventTimer[$timer_id]->del();
unset($this->_eventTimer[$timer_id]);
}
try {
call_user_func_array($param[0], $param[1]);
} catch (\Exception $e) {
Worker::log($e);
exit(250);
} catch (\Error $e) {
Worker::log($e);
exit(250);
}
} | [
"public",
"function",
"timerCallback",
"(",
"$",
"fd",
",",
"$",
"what",
",",
"$",
"param",
")",
"{",
"$",
"timer_id",
"=",
"$",
"param",
"[",
"4",
"]",
";",
"if",
"(",
"$",
"param",
"[",
"2",
"]",
"===",
"self",
"::",
"EV_TIMER_ONCE",
")",
"{",
... | Timer callback.
@param null $fd
@param int $what
@param int $timer_id | [
"Timer",
"callback",
"."
] | 13649907f05014fcfffcfccaef01e63ad3339351 | https://github.com/walkor/Workerman/blob/13649907f05014fcfffcfccaef01e63ad3339351/Events/Event.php#L157-L175 | train | Timer Callback Callback | [
30522,
2270,
3853,
25309,
9289,
20850,
8684,
1006,
1002,
1042,
2094,
1010,
1002,
2054,
1010,
1002,
11498,
2213,
1007,
1063,
1002,
25309,
1035,
8909,
1027,
1002,
11498,
2213,
1031,
1018,
1033,
1025,
2065,
1006,
1002,
11498,
2213,
1031,
1016,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
overtrue/wechat | src/OpenPlatform/Application.php | Application.miniProgram | public function miniProgram(string $appId, string $refreshToken = null, AccessToken $accessToken = null): MiniProgram
{
return new MiniProgram($this->getAuthorizerConfig($appId, $refreshToken), $this->getReplaceServices($accessToken) + [
'encryptor' => function () {
return new Encryptor($this['config']['app_id'], $this['config']['token'], $this['config']['aes_key']);
},
'auth' => function ($app) {
return new Client($app, $this);
},
]);
} | php | public function miniProgram(string $appId, string $refreshToken = null, AccessToken $accessToken = null): MiniProgram
{
return new MiniProgram($this->getAuthorizerConfig($appId, $refreshToken), $this->getReplaceServices($accessToken) + [
'encryptor' => function () {
return new Encryptor($this['config']['app_id'], $this['config']['token'], $this['config']['aes_key']);
},
'auth' => function ($app) {
return new Client($app, $this);
},
]);
} | [
"public",
"function",
"miniProgram",
"(",
"string",
"$",
"appId",
",",
"string",
"$",
"refreshToken",
"=",
"null",
",",
"AccessToken",
"$",
"accessToken",
"=",
"null",
")",
":",
"MiniProgram",
"{",
"return",
"new",
"MiniProgram",
"(",
"$",
"this",
"->",
"g... | Creates the miniProgram application.
@param string $appId
@param string|null $refreshToken
@param \EasyWeChat\OpenPlatform\Authorizer\Auth\AccessToken|null $accessToken
@return \EasyWeChat\OpenPlatform\Authorizer\MiniProgram\Application | [
"Creates",
"the",
"miniProgram",
"application",
"."
] | 120c72faaa93c270365bc75c73c362d5fd583209 | https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/OpenPlatform/Application.php#L98-L109 | train | Get MiniProgram instance | [
30522,
2270,
3853,
7163,
21572,
13113,
1006,
5164,
1002,
10439,
3593,
1010,
5164,
1002,
25416,
21898,
18715,
2368,
1027,
19701,
1010,
3229,
18715,
2368,
1002,
3229,
18715,
2368,
1027,
19701,
1007,
1024,
7163,
21572,
13113,
1063,
2709,
2047,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/thrift | lib/php/lib/Transport/TBufferedTransport.php | TBufferedTransport.read | public function read($len)
{
if (TStringFuncFactory::create()->strlen($this->rBuf_) === 0) {
$this->rBuf_ = $this->transport_->read($this->rBufSize_);
}
if (TStringFuncFactory::create()->strlen($this->rBuf_) <= $len) {
$ret = $this->rBuf_;
$this->rBuf_ = '';
return $ret;
}
$ret = TStringFuncFactory::create()->substr($this->rBuf_, 0, $len);
$this->rBuf_ = TStringFuncFactory::create()->substr($this->rBuf_, $len);
return $ret;
} | php | public function read($len)
{
if (TStringFuncFactory::create()->strlen($this->rBuf_) === 0) {
$this->rBuf_ = $this->transport_->read($this->rBufSize_);
}
if (TStringFuncFactory::create()->strlen($this->rBuf_) <= $len) {
$ret = $this->rBuf_;
$this->rBuf_ = '';
return $ret;
}
$ret = TStringFuncFactory::create()->substr($this->rBuf_, 0, $len);
$this->rBuf_ = TStringFuncFactory::create()->substr($this->rBuf_, $len);
return $ret;
} | [
"public",
"function",
"read",
"(",
"$",
"len",
")",
"{",
"if",
"(",
"TStringFuncFactory",
"::",
"create",
"(",
")",
"->",
"strlen",
"(",
"$",
"this",
"->",
"rBuf_",
")",
"===",
"0",
")",
"{",
"$",
"this",
"->",
"rBuf_",
"=",
"$",
"this",
"->",
"t... | @inheritdoc
@param int $len
@return string
@throws TTransportException | [
"@inheritdoc"
] | acdd4226c210336e9e15eb812e5932a645fcd5ce | https://github.com/apache/thrift/blob/acdd4226c210336e9e15eb812e5932a645fcd5ce/lib/php/lib/Transport/TBufferedTransport.php#L149-L166 | train | Read from the stream and return the result as a string. | [
30522,
2270,
3853,
3191,
1006,
1002,
18798,
1007,
1063,
2065,
1006,
24529,
18886,
3070,
11263,
12273,
21450,
1024,
1024,
3443,
1006,
1007,
1011,
1028,
2358,
20927,
2078,
1006,
1002,
2023,
1011,
1028,
21144,
16093,
1035,
1007,
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... |
laravel/framework | src/Illuminate/Database/Schema/Blueprint.php | Blueprint.commandsNamed | protected function commandsNamed(array $names)
{
return collect($this->commands)->filter(function ($command) use ($names) {
return in_array($command->name, $names);
});
} | php | protected function commandsNamed(array $names)
{
return collect($this->commands)->filter(function ($command) use ($names) {
return in_array($command->name, $names);
});
} | [
"protected",
"function",
"commandsNamed",
"(",
"array",
"$",
"names",
")",
"{",
"return",
"collect",
"(",
"$",
"this",
"->",
"commands",
")",
"->",
"filter",
"(",
"function",
"(",
"$",
"command",
")",
"use",
"(",
"$",
"names",
")",
"{",
"return",
"in_a... | Get all of the commands matching the given names.
@param array $names
@return \Illuminate\Support\Collection | [
"Get",
"all",
"of",
"the",
"commands",
"matching",
"the",
"given",
"names",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Schema/Blueprint.php#L163-L168 | train | Get all commands with the given name | [
30522,
5123,
3853,
10954,
18442,
2094,
1006,
9140,
1002,
3415,
1007,
1063,
2709,
8145,
1006,
1002,
2023,
1011,
1028,
10954,
1007,
1011,
1028,
11307,
1006,
3853,
1006,
1002,
3094,
1007,
2224,
1006,
1002,
3415,
1007,
1063,
2709,
1999,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Cache/RedisTaggedCache.php | RedisTaggedCache.deleteValues | protected function deleteValues($referenceKey)
{
$values = array_unique($this->store->connection()->smembers($referenceKey));
if (count($values) > 0) {
foreach (array_chunk($values, 1000) as $valuesChunk) {
call_user_func_array([$this->store->connection(), 'del'], $valuesChunk);
}
}
} | php | protected function deleteValues($referenceKey)
{
$values = array_unique($this->store->connection()->smembers($referenceKey));
if (count($values) > 0) {
foreach (array_chunk($values, 1000) as $valuesChunk) {
call_user_func_array([$this->store->connection(), 'del'], $valuesChunk);
}
}
} | [
"protected",
"function",
"deleteValues",
"(",
"$",
"referenceKey",
")",
"{",
"$",
"values",
"=",
"array_unique",
"(",
"$",
"this",
"->",
"store",
"->",
"connection",
"(",
")",
"->",
"smembers",
"(",
"$",
"referenceKey",
")",
")",
";",
"if",
"(",
"count",... | Delete item keys that have been stored against a reference.
@param string $referenceKey
@return void | [
"Delete",
"item",
"keys",
"that",
"have",
"been",
"stored",
"against",
"a",
"reference",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Cache/RedisTaggedCache.php#L176-L185 | train | Delete all values from the store | [
30522,
5123,
3853,
3972,
12870,
30524,
1007,
1007,
1025,
2065,
1006,
4175,
1006,
1002,
5300,
1007,
1028,
1014,
1007,
1063,
18921,
6776,
1006,
9140,
1035,
20000,
1006,
1002,
5300,
1010,
6694,
1007,
2004,
1002,
5300,
20760,
8950,
1007,
1063,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Auth/Middleware/AuthenticateWithBasicAuth.php | AuthenticateWithBasicAuth.handle | public function handle($request, Closure $next, $guard = null, $field = null)
{
$this->auth->guard($guard)->basic($field ?: 'email');
return $next($request);
} | php | public function handle($request, Closure $next, $guard = null, $field = null)
{
$this->auth->guard($guard)->basic($field ?: 'email');
return $next($request);
} | [
"public",
"function",
"handle",
"(",
"$",
"request",
",",
"Closure",
"$",
"next",
",",
"$",
"guard",
"=",
"null",
",",
"$",
"field",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"auth",
"->",
"guard",
"(",
"$",
"guard",
")",
"->",
"basic",
"(",
"$",... | Handle an incoming request.
@param \Illuminate\Http\Request $request
@param \Closure $next
@param string|null $guard
@param string|null $field
@return mixed
@throws \Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException | [
"Handle",
"an",
"incoming",
"request",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Auth/Middleware/AuthenticateWithBasicAuth.php#L39-L44 | train | Handle the request | [
30522,
2270,
3853,
5047,
1006,
1002,
5227,
1010,
8503,
1002,
2279,
1010,
1002,
3457,
1027,
19701,
1010,
1002,
2492,
1027,
19701,
1007,
1063,
1002,
2023,
1011,
1028,
8740,
2705,
1011,
1028,
3457,
1006,
1002,
3457,
1007,
1011,
1028,
3937,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/Login/SessionInitializer.php | SessionInitializer.getAuthCookie | protected function getAuthCookie($rememberMe)
{
$authCookieExpiry = $rememberMe ? time() + $this->authCookieValidTime : 0;
$cookie = new Cookie($this->authCookieName, $authCookieExpiry, $this->authCookiePath);
return $cookie;
} | php | protected function getAuthCookie($rememberMe)
{
$authCookieExpiry = $rememberMe ? time() + $this->authCookieValidTime : 0;
$cookie = new Cookie($this->authCookieName, $authCookieExpiry, $this->authCookiePath);
return $cookie;
} | [
"protected",
"function",
"getAuthCookie",
"(",
"$",
"rememberMe",
")",
"{",
"$",
"authCookieExpiry",
"=",
"$",
"rememberMe",
"?",
"time",
"(",
")",
"+",
"$",
"this",
"->",
"authCookieValidTime",
":",
"0",
";",
"$",
"cookie",
"=",
"new",
"Cookie",
"(",
"$... | Returns a Cookie instance that manages the browser cookie used to store session
information.
@param bool $rememberMe Whether the authenticated session should be remembered after
the browser is closed or not.
@return Cookie | [
"Returns",
"a",
"Cookie",
"instance",
"that",
"manages",
"the",
"browser",
"cookie",
"used",
"to",
"store",
"session",
"information",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Login/SessionInitializer.php#L153-L158 | train | Get auth cookie | [
30522,
5123,
3853,
2131,
4887,
2705,
3597,
23212,
2063,
1006,
1002,
3342,
4168,
1007,
1063,
1002,
8740,
2705,
3597,
23212,
4402,
2595,
8197,
2854,
1027,
1002,
3342,
4168,
1029,
2051,
1006,
1007,
30524,
1027,
2047,
17387,
1006,
1002,
2023,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
overtrue/wechat | src/OpenPlatform/Authorizer/Aggregate/Account/Client.php | Client.bindTo | public function bindTo(string $openAppId)
{
$params = [
'appid' => $this->app['config']['app_id'],
'open_appid' => $openAppId,
];
return $this->httpPostJson('cgi-bin/open/bind', $params);
} | php | public function bindTo(string $openAppId)
{
$params = [
'appid' => $this->app['config']['app_id'],
'open_appid' => $openAppId,
];
return $this->httpPostJson('cgi-bin/open/bind', $params);
} | [
"public",
"function",
"bindTo",
"(",
"string",
"$",
"openAppId",
")",
"{",
"$",
"params",
"=",
"[",
"'appid'",
"=>",
"$",
"this",
"->",
"app",
"[",
"'config'",
"]",
"[",
"'app_id'",
"]",
",",
"'open_appid'",
"=>",
"$",
"openAppId",
",",
"]",
";",
"re... | 将公众号/小程序绑定到开放平台帐号下.
@param string $openAppId 开放平台帐号appid
@return mixed
@throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException | [
"将公众号",
"/",
"小程序绑定到开放平台帐号下",
"."
] | 120c72faaa93c270365bc75c73c362d5fd583209 | https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/OpenPlatform/Authorizer/Aggregate/Account/Client.php#L48-L56 | train | Bind to open app | [
30522,
2270,
3853,
14187,
3406,
1006,
5164,
1002,
2330,
29098,
3593,
1007,
1063,
1002,
11498,
5244,
1027,
1031,
1005,
10439,
3593,
1005,
1027,
1028,
1002,
2023,
1011,
1028,
10439,
1031,
1005,
9530,
8873,
2290,
1005,
1033,
1031,
1005,
10439,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Cache/Simple/ChainCache.php | ChainCache.getMultiple | public function getMultiple($keys, $default = null)
{
$miss = null !== $default && \is_object($default) ? $default : $this->miss;
return $this->generateItems($this->caches[0]->getMultiple($keys, $miss), 0, $miss, $default);
} | php | public function getMultiple($keys, $default = null)
{
$miss = null !== $default && \is_object($default) ? $default : $this->miss;
return $this->generateItems($this->caches[0]->getMultiple($keys, $miss), 0, $miss, $default);
} | [
"public",
"function",
"getMultiple",
"(",
"$",
"keys",
",",
"$",
"default",
"=",
"null",
")",
"{",
"$",
"miss",
"=",
"null",
"!==",
"$",
"default",
"&&",
"\\",
"is_object",
"(",
"$",
"default",
")",
"?",
"$",
"default",
":",
"$",
"this",
"->",
"mis... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Cache/Simple/ChainCache.php#L86-L91 | train | Get multiple items from cache | [
30522,
2270,
3853,
2131,
12274,
7096,
11514,
2571,
1006,
1002,
6309,
1010,
1002,
12398,
1027,
19701,
1007,
1063,
1002,
3335,
1027,
19701,
999,
1027,
1027,
1002,
12398,
1004,
1004,
1032,
2003,
1035,
4874,
1006,
1002,
12398,
1007,
1029,
1002,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/HttpKernel/Bundle/Bundle.php | Bundle.getContainerExtension | public function getContainerExtension()
{
if (null === $this->extension) {
$extension = $this->createContainerExtension();
if (null !== $extension) {
if (!$extension instanceof ExtensionInterface) {
throw new \LogicException(sprintf('Extension %s must implement Symfony\Component\DependencyInjection\Extension\ExtensionInterface.', \get_class($extension)));
}
// check naming convention
$basename = preg_replace('/Bundle$/', '', $this->getName());
$expectedAlias = Container::underscore($basename);
if ($expectedAlias != $extension->getAlias()) {
throw new \LogicException(sprintf('Users will expect the alias of the default extension of a bundle to be the underscored version of the bundle name ("%s"). You can override "Bundle::getContainerExtension()" if you want to use "%s" or another alias.', $expectedAlias, $extension->getAlias()));
}
$this->extension = $extension;
} else {
$this->extension = false;
}
}
if ($this->extension) {
return $this->extension;
}
} | php | public function getContainerExtension()
{
if (null === $this->extension) {
$extension = $this->createContainerExtension();
if (null !== $extension) {
if (!$extension instanceof ExtensionInterface) {
throw new \LogicException(sprintf('Extension %s must implement Symfony\Component\DependencyInjection\Extension\ExtensionInterface.', \get_class($extension)));
}
// check naming convention
$basename = preg_replace('/Bundle$/', '', $this->getName());
$expectedAlias = Container::underscore($basename);
if ($expectedAlias != $extension->getAlias()) {
throw new \LogicException(sprintf('Users will expect the alias of the default extension of a bundle to be the underscored version of the bundle name ("%s"). You can override "Bundle::getContainerExtension()" if you want to use "%s" or another alias.', $expectedAlias, $extension->getAlias()));
}
$this->extension = $extension;
} else {
$this->extension = false;
}
}
if ($this->extension) {
return $this->extension;
}
} | [
"public",
"function",
"getContainerExtension",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"extension",
")",
"{",
"$",
"extension",
"=",
"$",
"this",
"->",
"createContainerExtension",
"(",
")",
";",
"if",
"(",
"null",
"!==",
"$",
"extensi... | Returns the bundle's container extension.
@return ExtensionInterface|null The container extension
@throws \LogicException | [
"Returns",
"the",
"bundle",
"s",
"container",
"extension",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/Bundle/Bundle.php#L66-L93 | train | Get the bundle s container extension | [
30522,
2270,
3853,
2131,
8663,
18249,
7869,
18413,
6132,
3258,
1006,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
1027,
1002,
2023,
1011,
1028,
5331,
1007,
1063,
1002,
5331,
1027,
1002,
2023,
1011,
1028,
3443,
8663,
18249,
7869,
18413,
6132,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/HttpClient/Response/CurlResponse.php | CurlResponse.select | private static function select(CurlClientState $multi, float $timeout): int
{
return curl_multi_select($multi->handle, $timeout);
} | php | private static function select(CurlClientState $multi, float $timeout): int
{
return curl_multi_select($multi->handle, $timeout);
} | [
"private",
"static",
"function",
"select",
"(",
"CurlClientState",
"$",
"multi",
",",
"float",
"$",
"timeout",
")",
":",
"int",
"{",
"return",
"curl_multi_select",
"(",
"$",
"multi",
"->",
"handle",
",",
"$",
"timeout",
")",
";",
"}"
] | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpClient/Response/CurlResponse.php#L258-L261 | train | Select the next page of items from the multi handle. | [
30522,
2797,
10763,
3853,
7276,
1006,
15390,
20464,
11638,
9153,
2618,
1002,
4800,
1010,
14257,
1002,
2051,
5833,
1007,
1024,
20014,
1063,
2709,
15390,
1035,
4800,
1035,
7276,
1006,
1002,
4800,
1011,
1028,
5047,
1010,
1002,
2051,
5833,
1007... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/PrivacyManager/Controller.php | Controller.getPurgeSettingsFromRequest | private function getPurgeSettingsFromRequest()
{
$settings = array();
// delete logs settings
$settings['delete_logs_enable'] = Common::getRequestVar("enableDeleteLogs", 0);
$settings['delete_logs_schedule_lowest_interval'] = Common::getRequestVar("deleteLowestInterval", 7);
$settings['delete_logs_older_than'] = ((int)Common::getRequestVar("deleteLogsOlderThan", 180) < 1) ?
1 : Common::getRequestVar("deleteOlderThan", 180);
// delete reports settings
$settings['delete_reports_enable'] = Common::getRequestVar("enableDeleteReports", 0);
$deleteReportsOlderThan = Common::getRequestVar("deleteReportsOlderThan", 3);
$settings['delete_reports_older_than'] = $deleteReportsOlderThan < 2 ? 2 : $deleteReportsOlderThan;
$settings['delete_reports_keep_basic_metrics'] = Common::getRequestVar("keepBasic", 0);
$settings['delete_reports_keep_day_reports'] = Common::getRequestVar("keepDay", 0);
$settings['delete_reports_keep_week_reports'] = Common::getRequestVar("keepWeek", 0);
$settings['delete_reports_keep_month_reports'] = Common::getRequestVar("keepMonth", 0);
$settings['delete_reports_keep_year_reports'] = Common::getRequestVar("keepYear", 0);
$settings['delete_reports_keep_range_reports'] = Common::getRequestVar("keepRange", 0);
$settings['delete_reports_keep_segment_reports'] = Common::getRequestVar("keepSegments", 0);
$settings['delete_logs_max_rows_per_query'] = PiwikConfig::getInstance()->Deletelogs['delete_logs_max_rows_per_query'];
return $settings;
} | php | private function getPurgeSettingsFromRequest()
{
$settings = array();
// delete logs settings
$settings['delete_logs_enable'] = Common::getRequestVar("enableDeleteLogs", 0);
$settings['delete_logs_schedule_lowest_interval'] = Common::getRequestVar("deleteLowestInterval", 7);
$settings['delete_logs_older_than'] = ((int)Common::getRequestVar("deleteLogsOlderThan", 180) < 1) ?
1 : Common::getRequestVar("deleteOlderThan", 180);
// delete reports settings
$settings['delete_reports_enable'] = Common::getRequestVar("enableDeleteReports", 0);
$deleteReportsOlderThan = Common::getRequestVar("deleteReportsOlderThan", 3);
$settings['delete_reports_older_than'] = $deleteReportsOlderThan < 2 ? 2 : $deleteReportsOlderThan;
$settings['delete_reports_keep_basic_metrics'] = Common::getRequestVar("keepBasic", 0);
$settings['delete_reports_keep_day_reports'] = Common::getRequestVar("keepDay", 0);
$settings['delete_reports_keep_week_reports'] = Common::getRequestVar("keepWeek", 0);
$settings['delete_reports_keep_month_reports'] = Common::getRequestVar("keepMonth", 0);
$settings['delete_reports_keep_year_reports'] = Common::getRequestVar("keepYear", 0);
$settings['delete_reports_keep_range_reports'] = Common::getRequestVar("keepRange", 0);
$settings['delete_reports_keep_segment_reports'] = Common::getRequestVar("keepSegments", 0);
$settings['delete_logs_max_rows_per_query'] = PiwikConfig::getInstance()->Deletelogs['delete_logs_max_rows_per_query'];
return $settings;
} | [
"private",
"function",
"getPurgeSettingsFromRequest",
"(",
")",
"{",
"$",
"settings",
"=",
"array",
"(",
")",
";",
"// delete logs settings",
"$",
"settings",
"[",
"'delete_logs_enable'",
"]",
"=",
"Common",
"::",
"getRequestVar",
"(",
"\"enableDeleteLogs\"",
",",
... | Utility function. Gets the delete logs/reports settings from the request and uses
them to populate config arrays.
@return array An array containing the data deletion settings. | [
"Utility",
"function",
".",
"Gets",
"the",
"delete",
"logs",
"/",
"reports",
"settings",
"from",
"the",
"request",
"and",
"uses",
"them",
"to",
"populate",
"config",
"arrays",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/PrivacyManager/Controller.php#L48-L72 | train | Returns the settings from the request | [
30522,
2797,
3853,
2131,
5311,
8449,
18319,
3070,
22747,
21716,
2890,
15500,
1006,
1007,
1063,
1002,
10906,
1027,
9140,
1006,
1007,
1025,
1013,
1013,
3972,
12870,
15664,
10906,
1002,
10906,
1031,
1005,
3972,
12870,
1035,
15664,
1035,
9585,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/HTML/QuickForm2/Controller/SessionContainer.php | HTML_QuickForm2_Controller_SessionContainer.getValidationStatus | public function getValidationStatus($pageId)
{
return array_key_exists($pageId, $this->data['valid'])
? $this->data['valid'][$pageId]: null;
} | php | public function getValidationStatus($pageId)
{
return array_key_exists($pageId, $this->data['valid'])
? $this->data['valid'][$pageId]: null;
} | [
"public",
"function",
"getValidationStatus",
"(",
"$",
"pageId",
")",
"{",
"return",
"array_key_exists",
"(",
"$",
"pageId",
",",
"$",
"this",
"->",
"data",
"[",
"'valid'",
"]",
")",
"?",
"$",
"this",
"->",
"data",
"[",
"'valid'",
"]",
"[",
"$",
"pageI... | Returns the page validation status kept in session
@param string Page ID
@return bool | [
"Returns",
"the",
"page",
"validation",
"status",
"kept",
"in",
"session"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/HTML/QuickForm2/Controller/SessionContainer.php#L129-L134 | train | Get Page Validation Status | [
30522,
2270,
3853,
2131,
10175,
8524,
9285,
29336,
2271,
1006,
1002,
3931,
3593,
1007,
1063,
2709,
9140,
1035,
3145,
1035,
6526,
1006,
1002,
3931,
3593,
1010,
1002,
2023,
1011,
1028,
2951,
1031,
1005,
9398,
1005,
1033,
1007,
1029,
1002,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
z-song/laravel-admin | src/Grid/Column.php | Column.sorter | public function sorter()
{
if (!$this->sortable) {
return '';
}
$icon = 'fa-sort';
$type = 'desc';
if ($this->isSorted()) {
$type = $this->sort['type'] == 'desc' ? 'asc' : 'desc';
$icon .= "-amount-{$this->sort['type']}";
}
// set sort value
$sort = ['column' => $this->name, 'type' => $type];
if (isset($this->cast)) {
$sort['cast'] = $this->cast;
}
$query = app('request')->all();
$query = array_merge($query, [$this->grid->model()->getSortName() => $sort]);
$url = url()->current().'?'.http_build_query($query);
return "<a class=\"fa fa-fw $icon\" href=\"$url\"></a>";
} | php | public function sorter()
{
if (!$this->sortable) {
return '';
}
$icon = 'fa-sort';
$type = 'desc';
if ($this->isSorted()) {
$type = $this->sort['type'] == 'desc' ? 'asc' : 'desc';
$icon .= "-amount-{$this->sort['type']}";
}
// set sort value
$sort = ['column' => $this->name, 'type' => $type];
if (isset($this->cast)) {
$sort['cast'] = $this->cast;
}
$query = app('request')->all();
$query = array_merge($query, [$this->grid->model()->getSortName() => $sort]);
$url = url()->current().'?'.http_build_query($query);
return "<a class=\"fa fa-fw $icon\" href=\"$url\"></a>";
} | [
"public",
"function",
"sorter",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"sortable",
")",
"{",
"return",
"''",
";",
"}",
"$",
"icon",
"=",
"'fa-sort'",
";",
"$",
"type",
"=",
"'desc'",
";",
"if",
"(",
"$",
"this",
"->",
"isSorted",
"(",
... | Create the column sorter.
@return string | [
"Create",
"the",
"column",
"sorter",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid/Column.php#L557-L583 | train | Returns the sorter icon | [
30522,
30524,
4066,
3085,
1007,
1063,
2709,
1005,
1005,
1025,
1065,
1002,
12696,
1027,
1005,
6904,
1011,
4066,
1005,
1025,
1002,
2828,
1027,
1005,
4078,
2278,
1005,
1025,
2065,
1006,
1002,
2023,
1011,
1028,
26354,
15613,
1006,
1007,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Intl/Util/Version.php | Version.compare | public static function compare($version1, $version2, $operator, $precision = null)
{
$version1 = self::normalize($version1, $precision);
$version2 = self::normalize($version2, $precision);
return version_compare($version1, $version2, $operator);
} | php | public static function compare($version1, $version2, $operator, $precision = null)
{
$version1 = self::normalize($version1, $precision);
$version2 = self::normalize($version2, $precision);
return version_compare($version1, $version2, $operator);
} | [
"public",
"static",
"function",
"compare",
"(",
"$",
"version1",
",",
"$",
"version2",
",",
"$",
"operator",
",",
"$",
"precision",
"=",
"null",
")",
"{",
"$",
"version1",
"=",
"self",
"::",
"normalize",
"(",
"$",
"version1",
",",
"$",
"precision",
")"... | Compares two versions with an operator.
This method is identical to {@link version_compare()}, except that you
can pass the number of regarded version components in the last argument
$precision.
Examples:
Version::compare('1.2.3', '1.2.4', '==')
// => false
Version::compare('1.2.3', '1.2.4', '==', 2)
// => true
@param string $version1 A version string
@param string $version2 A version string to compare
@param string $operator The comparison operator
@param int|null $precision The number of components to compare. Pass
NULL to compare the versions unchanged.
@return bool Whether the comparison succeeded
@see normalize() | [
"Compares",
"two",
"versions",
"with",
"an",
"operator",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Intl/Util/Version.php#L46-L52 | train | Compare two version numbers using the version_compare function. | [
30522,
2270,
10763,
3853,
12826,
1006,
1002,
2544,
2487,
1010,
1002,
2544,
2475,
1010,
1002,
6872,
1010,
1002,
11718,
1027,
19701,
1007,
1063,
1002,
2544,
2487,
1027,
2969,
1024,
1024,
3671,
4697,
1006,
1002,
2544,
2487,
1010,
1002,
11718,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/HttpKernel/Profiler/Profile.php | Profile.setCollectors | public function setCollectors(array $collectors)
{
$this->collectors = [];
foreach ($collectors as $collector) {
$this->addCollector($collector);
}
} | php | public function setCollectors(array $collectors)
{
$this->collectors = [];
foreach ($collectors as $collector) {
$this->addCollector($collector);
}
} | [
"public",
"function",
"setCollectors",
"(",
"array",
"$",
"collectors",
")",
"{",
"$",
"this",
"->",
"collectors",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"collectors",
"as",
"$",
"collector",
")",
"{",
"$",
"this",
"->",
"addCollector",
"(",
"$",
"co... | Sets the Collectors associated with this profile.
@param DataCollectorInterface[] $collectors | [
"Sets",
"the",
"Collectors",
"associated",
"with",
"this",
"profile",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/Profiler/Profile.php#L263-L269 | train | Set the collectors | [
30522,
2270,
3853,
2275,
26895,
22471,
5668,
1006,
9140,
1002,
14256,
1007,
1063,
1002,
2023,
1011,
1028,
14256,
1027,
1031,
1033,
1025,
18921,
6776,
1006,
1002,
14256,
2004,
1002,
10018,
1007,
1063,
1002,
2023,
1011,
1028,
5587,
26895,
224... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.getBrowserLanguage | public static function getBrowserLanguage($browserLang = null)
{
static $replacementPatterns = array(
// extraneous bits of RFC 3282 that we ignore
'/(\\\\.)/', // quoted-pairs
'/(\s+)/', // CFWcS white space
'/(\([^)]*\))/', // CFWS comments
'/(;q=[0-9.]+)/', // quality
// found in the LANG environment variable
'/\.(.*)/', // charset (e.g., en_CA.UTF-8)
'/^C$/', // POSIX 'C' locale
);
if (is_null($browserLang)) {
$browserLang = self::sanitizeInputValues(@$_SERVER['HTTP_ACCEPT_LANGUAGE']);
if (empty($browserLang) && self::isPhpCliMode()) {
$browserLang = @getenv('LANG');
}
}
if (empty($browserLang)) {
// a fallback might be to infer the language in HTTP_USER_AGENT (i.e., localized build)
$browserLang = "";
} else {
// language tags are case-insensitive per HTTP/1.1 s3.10 but the region may be capitalized per ISO3166-1;
// underscores are not permitted per RFC 4646 or 4647 (which obsolete RFC 1766 and 3066),
// but we guard against a bad user agent which naively uses its locale
$browserLang = strtolower(str_replace('_', '-', $browserLang));
// filters
$browserLang = preg_replace($replacementPatterns, '', $browserLang);
$browserLang = preg_replace('/((^|,)chrome:.*)/', '', $browserLang, 1); // Firefox bug
$browserLang = preg_replace('/(,)(?:en-securid,)|(?:(^|,)en-securid(,|$))/', '$1', $browserLang, 1); // unregistered language tag
$browserLang = str_replace('sr-sp', 'sr-rs', $browserLang); // unofficial (proposed) code in the wild
}
return $browserLang;
} | php | public static function getBrowserLanguage($browserLang = null)
{
static $replacementPatterns = array(
// extraneous bits of RFC 3282 that we ignore
'/(\\\\.)/', // quoted-pairs
'/(\s+)/', // CFWcS white space
'/(\([^)]*\))/', // CFWS comments
'/(;q=[0-9.]+)/', // quality
// found in the LANG environment variable
'/\.(.*)/', // charset (e.g., en_CA.UTF-8)
'/^C$/', // POSIX 'C' locale
);
if (is_null($browserLang)) {
$browserLang = self::sanitizeInputValues(@$_SERVER['HTTP_ACCEPT_LANGUAGE']);
if (empty($browserLang) && self::isPhpCliMode()) {
$browserLang = @getenv('LANG');
}
}
if (empty($browserLang)) {
// a fallback might be to infer the language in HTTP_USER_AGENT (i.e., localized build)
$browserLang = "";
} else {
// language tags are case-insensitive per HTTP/1.1 s3.10 but the region may be capitalized per ISO3166-1;
// underscores are not permitted per RFC 4646 or 4647 (which obsolete RFC 1766 and 3066),
// but we guard against a bad user agent which naively uses its locale
$browserLang = strtolower(str_replace('_', '-', $browserLang));
// filters
$browserLang = preg_replace($replacementPatterns, '', $browserLang);
$browserLang = preg_replace('/((^|,)chrome:.*)/', '', $browserLang, 1); // Firefox bug
$browserLang = preg_replace('/(,)(?:en-securid,)|(?:(^|,)en-securid(,|$))/', '$1', $browserLang, 1); // unregistered language tag
$browserLang = str_replace('sr-sp', 'sr-rs', $browserLang); // unofficial (proposed) code in the wild
}
return $browserLang;
} | [
"public",
"static",
"function",
"getBrowserLanguage",
"(",
"$",
"browserLang",
"=",
"null",
")",
"{",
"static",
"$",
"replacementPatterns",
"=",
"array",
"(",
"// extraneous bits of RFC 3282 that we ignore",
"'/(\\\\\\\\.)/'",
",",
"// quoted-pairs",
"'/(\\s+)/'",
",",
... | Returns the browser language code, eg. "en-gb,en;q=0.5"
@param string|null $browserLang Optional browser language, otherwise taken from the request header
@return string | [
"Returns",
"the",
"browser",
"language",
"code",
"eg",
".",
"en",
"-",
"gb",
"en",
";",
"q",
"=",
"0",
".",
"5"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Common.php#L900-L940 | train | Returns the browser language | [
30522,
2270,
10763,
3853,
2131,
12618,
9333,
2121,
25023,
6692,
3351,
1006,
1002,
16602,
25023,
1027,
19701,
1007,
1063,
10763,
1002,
6110,
4502,
12079,
3619,
1027,
9140,
1006,
1013,
1013,
4469,
23585,
2271,
9017,
1997,
14645,
25256,
2475,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Database/Eloquent/Builder.php | Builder.createNestedWhere | protected function createNestedWhere($whereSlice, $boolean = 'and')
{
$whereGroup = $this->getQuery()->forNestedWhere();
$whereGroup->wheres = $whereSlice;
return ['type' => 'Nested', 'query' => $whereGroup, 'boolean' => $boolean];
} | php | protected function createNestedWhere($whereSlice, $boolean = 'and')
{
$whereGroup = $this->getQuery()->forNestedWhere();
$whereGroup->wheres = $whereSlice;
return ['type' => 'Nested', 'query' => $whereGroup, 'boolean' => $boolean];
} | [
"protected",
"function",
"createNestedWhere",
"(",
"$",
"whereSlice",
",",
"$",
"boolean",
"=",
"'and'",
")",
"{",
"$",
"whereGroup",
"=",
"$",
"this",
"->",
"getQuery",
"(",
")",
"->",
"forNestedWhere",
"(",
")",
";",
"$",
"whereGroup",
"->",
"wheres",
... | Create a where array with nested where conditions.
@param array $whereSlice
@param string $boolean
@return array | [
"Create",
"a",
"where",
"array",
"with",
"nested",
"where",
"conditions",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Builder.php#L1066-L1073 | train | Create a nested where clause | [
30522,
5123,
3853,
3443,
5267,
3064,
2860,
5886,
2063,
1006,
1002,
2073,
30524,
1002,
2073,
17058,
1011,
1028,
2073,
2015,
1027,
1002,
2073,
14540,
6610,
1025,
2709,
1031,
1005,
2828,
1005,
1027,
1028,
1005,
9089,
2098,
1005,
1010,
1005,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/ViewDataTable/Manager.php | Manager.getFooterIconFor | private static function getFooterIconFor($viewDataTableId)
{
$tables = static::getAvailableViewDataTables();
if (!array_key_exists($viewDataTableId, $tables)) {
return;
}
$klass = $tables[$viewDataTableId];
return array(
'id' => $klass::getViewDataTableId(),
'title' => Piwik::translate($klass::FOOTER_ICON_TITLE),
'icon' => $klass::FOOTER_ICON,
);
} | php | private static function getFooterIconFor($viewDataTableId)
{
$tables = static::getAvailableViewDataTables();
if (!array_key_exists($viewDataTableId, $tables)) {
return;
}
$klass = $tables[$viewDataTableId];
return array(
'id' => $klass::getViewDataTableId(),
'title' => Piwik::translate($klass::FOOTER_ICON_TITLE),
'icon' => $klass::FOOTER_ICON,
);
} | [
"private",
"static",
"function",
"getFooterIconFor",
"(",
"$",
"viewDataTableId",
")",
"{",
"$",
"tables",
"=",
"static",
"::",
"getAvailableViewDataTables",
"(",
")",
";",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"viewDataTableId",
",",
"$",
"tables",
")... | Returns an array with information necessary for adding the viewDataTable to the footer.
@param string $viewDataTableId
@return array | [
"Returns",
"an",
"array",
"with",
"information",
"necessary",
"for",
"adding",
"the",
"viewDataTable",
"to",
"the",
"footer",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/ViewDataTable/Manager.php#L219-L234 | train | Returns footer icon for given viewDataTableId | [
30522,
2797,
10763,
3853,
2131,
13064,
22420,
2239,
29278,
1006,
1002,
3193,
2850,
29336,
3085,
3593,
1007,
1063,
1002,
7251,
1027,
10763,
1024,
1024,
2131,
12462,
11733,
3468,
8584,
2850,
29336,
3085,
2015,
1006,
1007,
1025,
2065,
1006,
99... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Foundation/Console/Presets/None.php | None.updatePackageArray | protected static function updatePackageArray(array $packages)
{
unset(
$packages['bootstrap'],
$packages['jquery'],
$packages['popper.js'],
$packages['vue'],
$packages['vue-template-compiler'],
$packages['@babel/preset-react'],
$packages['react'],
$packages['react-dom']
);
return $packages;
} | php | protected static function updatePackageArray(array $packages)
{
unset(
$packages['bootstrap'],
$packages['jquery'],
$packages['popper.js'],
$packages['vue'],
$packages['vue-template-compiler'],
$packages['@babel/preset-react'],
$packages['react'],
$packages['react-dom']
);
return $packages;
} | [
"protected",
"static",
"function",
"updatePackageArray",
"(",
"array",
"$",
"packages",
")",
"{",
"unset",
"(",
"$",
"packages",
"[",
"'bootstrap'",
"]",
",",
"$",
"packages",
"[",
"'jquery'",
"]",
",",
"$",
"packages",
"[",
"'popper.js'",
"]",
",",
"$",
... | Update the given package array.
@param array $packages
@return array | [
"Update",
"the",
"given",
"package",
"array",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Foundation/Console/Presets/None.php#L34-L48 | train | Updates the package array with the new values. | [
30522,
5123,
10763,
3853,
10651,
23947,
4270,
2906,
9447,
1006,
9140,
1002,
14555,
1007,
1063,
4895,
13462,
1006,
1002,
14555,
1031,
1005,
6879,
6494,
2361,
1005,
1033,
1010,
1002,
14555,
1031,
1005,
1046,
4226,
2854,
1005,
1033,
1010,
1002... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
z-song/laravel-admin | src/Grid/Concerns/HasHeader.php | HasHeader.header | public function header(Closure $closure = null)
{
if (!$closure) {
return $this->header;
}
$this->header = $closure;
return $this;
} | php | public function header(Closure $closure = null)
{
if (!$closure) {
return $this->header;
}
$this->header = $closure;
return $this;
} | [
"public",
"function",
"header",
"(",
"Closure",
"$",
"closure",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"closure",
")",
"{",
"return",
"$",
"this",
"->",
"header",
";",
"}",
"$",
"this",
"->",
"header",
"=",
"$",
"closure",
";",
"return",
"$",
... | Set grid header.
@param Closure|null $closure
@return $this|Closure | [
"Set",
"grid",
"header",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid/Concerns/HasHeader.php#L22-L31 | train | Set the header closure | [
30522,
2270,
3853,
20346,
1006,
8503,
1002,
8503,
1027,
19701,
1007,
1063,
2065,
1006,
999,
1002,
8503,
1007,
1063,
2709,
1002,
2023,
1011,
1028,
20346,
1025,
1065,
1002,
2023,
1011,
1028,
20346,
1027,
1002,
8503,
1025,
2709,
1002,
2023,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/backend/widgets/Search.php | Search.prepareVars | public function prepareVars()
{
$this->vars['cssClasses'] = implode(' ', $this->cssClasses);
$this->vars['placeholder'] = Lang::get($this->prompt);
$this->vars['value'] = $this->getActiveTerm();
$this->vars['searchOnEnter'] = $this->searchOnEnter;
} | php | public function prepareVars()
{
$this->vars['cssClasses'] = implode(' ', $this->cssClasses);
$this->vars['placeholder'] = Lang::get($this->prompt);
$this->vars['value'] = $this->getActiveTerm();
$this->vars['searchOnEnter'] = $this->searchOnEnter;
} | [
"public",
"function",
"prepareVars",
"(",
")",
"{",
"$",
"this",
"->",
"vars",
"[",
"'cssClasses'",
"]",
"=",
"implode",
"(",
"' '",
",",
"$",
"this",
"->",
"cssClasses",
")",
";",
"$",
"this",
"->",
"vars",
"[",
"'placeholder'",
"]",
"=",
"Lang",
":... | Prepares the view data | [
"Prepares",
"the",
"view",
"data"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/Search.php#L109-L115 | train | Prepare vars for the page | [
30522,
2270,
3853,
7374,
10755,
2015,
1006,
1007,
1063,
1002,
2023,
1011,
1028,
13075,
2015,
1031,
1005,
20116,
11020,
27102,
2229,
1005,
1033,
1027,
17727,
4135,
3207,
1006,
1005,
1005,
1010,
1002,
2023,
1011,
1028,
20116,
11020,
27102,
22... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/system/classes/VersionManager.php | VersionManager.applyPluginUpdate | protected function applyPluginUpdate($code, $version, $details)
{
if (is_array($details)) {
$comment = array_shift($details);
$scripts = $details;
}
else {
$comment = $details;
$scripts = [];
}
/*
* Apply scripts, if any
*/
foreach ($scripts as $script) {
if ($this->hasDatabaseHistory($code, $version, $script)) {
continue;
}
$this->applyDatabaseScript($code, $version, $script);
}
/*
* Register the comment and update the version
*/
if (!$this->hasDatabaseHistory($code, $version)) {
$this->applyDatabaseComment($code, $version, $comment);
}
$this->setDatabaseVersion($code, $version);
$this->note(sprintf('- <info>v%s: </info> %s', $version, $comment));
} | php | protected function applyPluginUpdate($code, $version, $details)
{
if (is_array($details)) {
$comment = array_shift($details);
$scripts = $details;
}
else {
$comment = $details;
$scripts = [];
}
/*
* Apply scripts, if any
*/
foreach ($scripts as $script) {
if ($this->hasDatabaseHistory($code, $version, $script)) {
continue;
}
$this->applyDatabaseScript($code, $version, $script);
}
/*
* Register the comment and update the version
*/
if (!$this->hasDatabaseHistory($code, $version)) {
$this->applyDatabaseComment($code, $version, $comment);
}
$this->setDatabaseVersion($code, $version);
$this->note(sprintf('- <info>v%s: </info> %s', $version, $comment));
} | [
"protected",
"function",
"applyPluginUpdate",
"(",
"$",
"code",
",",
"$",
"version",
",",
"$",
"details",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"details",
")",
")",
"{",
"$",
"comment",
"=",
"array_shift",
"(",
"$",
"details",
")",
";",
"$",
"sc... | Applies a single version update to a plugin. | [
"Applies",
"a",
"single",
"version",
"update",
"to",
"a",
"plugin",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/VersionManager.php#L126-L158 | train | Apply plugin update | [
30522,
5123,
3853,
6611,
24759,
15916,
2378,
6279,
13701,
1006,
1002,
3642,
1010,
1002,
2544,
1010,
1002,
4751,
1007,
1063,
2065,
1006,
2003,
1035,
9140,
1006,
1002,
4751,
1007,
1007,
1063,
1002,
7615,
1027,
9140,
1035,
5670,
1006,
1002,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/HttpKernel/Profiler/Profiler.php | Profiler.set | public function set(array $collectors = [])
{
$this->collectors = [];
foreach ($collectors as $collector) {
$this->add($collector);
}
} | php | public function set(array $collectors = [])
{
$this->collectors = [];
foreach ($collectors as $collector) {
$this->add($collector);
}
} | [
"public",
"function",
"set",
"(",
"array",
"$",
"collectors",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"collectors",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"collectors",
"as",
"$",
"collector",
")",
"{",
"$",
"this",
"->",
"add",
"(",
"$",
"... | Sets the Collectors associated with this profiler.
@param DataCollectorInterface[] $collectors An array of collectors | [
"Sets",
"the",
"Collectors",
"associated",
"with",
"this",
"profiler",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/Profiler/Profiler.php#L199-L205 | train | Set the collectors | [
30522,
2270,
3853,
2275,
1006,
9140,
1002,
14256,
1027,
1031,
1033,
1007,
1063,
1002,
2023,
1011,
1028,
14256,
1027,
1031,
1033,
1025,
18921,
6776,
1006,
1002,
14256,
2004,
1002,
10018,
1007,
1063,
1002,
2023,
1011,
1028,
5587,
1006,
1002,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
z-song/laravel-admin | src/Form/Field/Image.php | Image.prepare | public function prepare($image)
{
if (request()->has(static::FILE_DELETE_FLAG)) {
return $this->destroy();
}
$this->name = $this->getStoreName($image);
$this->callInterventionMethods($image->getRealPath());
return $this->uploadAndDeleteOriginal($image);
} | php | public function prepare($image)
{
if (request()->has(static::FILE_DELETE_FLAG)) {
return $this->destroy();
}
$this->name = $this->getStoreName($image);
$this->callInterventionMethods($image->getRealPath());
return $this->uploadAndDeleteOriginal($image);
} | [
"public",
"function",
"prepare",
"(",
"$",
"image",
")",
"{",
"if",
"(",
"request",
"(",
")",
"->",
"has",
"(",
"static",
"::",
"FILE_DELETE_FLAG",
")",
")",
"{",
"return",
"$",
"this",
"->",
"destroy",
"(",
")",
";",
"}",
"$",
"this",
"->",
"name"... | @param array|UploadedFile $image
@return string | [
"@param",
"array|UploadedFile",
"$image"
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Form/Field/Image.php#L28-L39 | train | Prepare the image and upload it to the store | [
30522,
2270,
3853,
7374,
1006,
1002,
3746,
1007,
1063,
2065,
1006,
5227,
1006,
1007,
1011,
1028,
2038,
1006,
10763,
1024,
1024,
5371,
1035,
3972,
12870,
1035,
5210,
1007,
1007,
1063,
2709,
1002,
2023,
1011,
1028,
6033,
1006,
1007,
1025,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getgrav/grav | system/src/Grav/Common/GPM/Licenses.php | Licenses.getLicenseFile | public static function getLicenseFile()
{
if (!isset(self::$file)) {
$path = Grav::instance()['locator']->findResource('user-data://') . '/licenses.yaml';
if (!file_exists($path)) {
touch($path);
}
self::$file = CompiledYamlFile::instance($path);
}
return self::$file;
} | php | public static function getLicenseFile()
{
if (!isset(self::$file)) {
$path = Grav::instance()['locator']->findResource('user-data://') . '/licenses.yaml';
if (!file_exists($path)) {
touch($path);
}
self::$file = CompiledYamlFile::instance($path);
}
return self::$file;
} | [
"public",
"static",
"function",
"getLicenseFile",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"self",
"::",
"$",
"file",
")",
")",
"{",
"$",
"path",
"=",
"Grav",
"::",
"instance",
"(",
")",
"[",
"'locator'",
"]",
"->",
"findResource",
"(",
"'user-da... | Get's the License File object
@return \RocketTheme\Toolbox\File\FileInterface | [
"Get",
"s",
"the",
"License",
"File",
"object"
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/GPM/Licenses.php#L110-L122 | train | Get License File | [
30522,
2270,
10763,
3853,
2131,
13231,
12325,
8873,
2571,
1006,
1007,
1063,
2065,
1006,
999,
26354,
3388,
1006,
2969,
1024,
1024,
1002,
5371,
1007,
1007,
1063,
1002,
4130,
1027,
24665,
11431,
1024,
1024,
6013,
1006,
1007,
1031,
1005,
8840,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Notify/Paid.php | Paid.handle | public function handle(Closure $closure)
{
$this->strict(
\call_user_func($closure, $this->getMessage(), [$this, 'fail'])
);
return $this->toResponse();
} | php | public function handle(Closure $closure)
{
$this->strict(
\call_user_func($closure, $this->getMessage(), [$this, 'fail'])
);
return $this->toResponse();
} | [
"public",
"function",
"handle",
"(",
"Closure",
"$",
"closure",
")",
"{",
"$",
"this",
"->",
"strict",
"(",
"\\",
"call_user_func",
"(",
"$",
"closure",
",",
"$",
"this",
"->",
"getMessage",
"(",
")",
",",
"[",
"$",
"this",
",",
"'fail'",
"]",
")",
... | @param \Closure $closure
@return \Symfony\Component\HttpFoundation\Response
@throws \EasyWeChat\Kernel\Exceptions\Exception | [
"@param",
"\\",
"Closure",
"$closure"
] | 120c72faaa93c270365bc75c73c362d5fd583209 | https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/Payment/Notify/Paid.php#L25-L32 | train | Handle the exception and return the response. | [
30522,
2270,
3853,
5047,
1006,
8503,
1002,
8503,
1007,
1063,
1002,
2023,
1011,
1028,
9384,
1006,
1032,
2655,
1035,
5310,
1035,
4569,
2278,
1006,
1002,
8503,
1010,
1002,
2023,
1011,
1028,
2131,
7834,
3736,
3351,
1006,
1007,
30524,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Routing/Router.php | Router.has | public function has($name)
{
$names = is_array($name) ? $name : func_get_args();
foreach ($names as $value) {
if (! $this->routes->hasNamedRoute($value)) {
return false;
}
}
return true;
} | php | public function has($name)
{
$names = is_array($name) ? $name : func_get_args();
foreach ($names as $value) {
if (! $this->routes->hasNamedRoute($value)) {
return false;
}
}
return true;
} | [
"public",
"function",
"has",
"(",
"$",
"name",
")",
"{",
"$",
"names",
"=",
"is_array",
"(",
"$",
"name",
")",
"?",
"$",
"name",
":",
"func_get_args",
"(",
")",
";",
"foreach",
"(",
"$",
"names",
"as",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"$... | Check if a route with the given name exists.
@param string $name
@return bool | [
"Check",
"if",
"a",
"route",
"with",
"the",
"given",
"name",
"exists",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Routing/Router.php#L1058-L1069 | train | Has Route? Name? | [
30522,
2270,
3853,
2038,
1006,
1002,
2171,
30524,
1024,
4569,
2278,
1035,
2131,
1035,
12098,
5620,
1006,
1007,
1025,
18921,
6776,
1006,
1002,
3415,
2004,
1002,
3643,
1007,
1063,
2065,
1006,
999,
1002,
2023,
1011,
1028,
5847,
1011,
1028,
8... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Database/Query/Builder.php | Builder.whereRowValues | public function whereRowValues($columns, $operator, $values, $boolean = 'and')
{
if (count($columns) !== count($values)) {
throw new InvalidArgumentException('The number of columns must match the number of values');
}
$type = 'RowValues';
$this->wheres[] = compact('type', 'columns', 'operator', 'values', 'boolean');
$this->addBinding($this->cleanBindings($values));
return $this;
} | php | public function whereRowValues($columns, $operator, $values, $boolean = 'and')
{
if (count($columns) !== count($values)) {
throw new InvalidArgumentException('The number of columns must match the number of values');
}
$type = 'RowValues';
$this->wheres[] = compact('type', 'columns', 'operator', 'values', 'boolean');
$this->addBinding($this->cleanBindings($values));
return $this;
} | [
"public",
"function",
"whereRowValues",
"(",
"$",
"columns",
",",
"$",
"operator",
",",
"$",
"values",
",",
"$",
"boolean",
"=",
"'and'",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"columns",
")",
"!==",
"count",
"(",
"$",
"values",
")",
")",
"{",
"th... | Adds a where condition using row values.
@param array $columns
@param string $operator
@param array $values
@param string $boolean
@return $this | [
"Adds",
"a",
"where",
"condition",
"using",
"row",
"values",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Query/Builder.php#L1478-L1491 | train | Add a where row values clause to the current query | [
30522,
2270,
3853,
2073,
10524,
10175,
15808,
1006,
1002,
7753,
1010,
1002,
6872,
1010,
1002,
5300,
1010,
1002,
22017,
20898,
1027,
1005,
1998,
1005,
1007,
1063,
2065,
1006,
4175,
1006,
1002,
7753,
1007,
999,
1027,
1027,
4175,
1006,
1002,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/HttpKernel/DependencyInjection/AddAnnotatedClassesToCachePass.php | AddAnnotatedClassesToCachePass.process | public function process(ContainerBuilder $container)
{
$annotatedClasses = $this->kernel->getAnnotatedClassesToCompile();
foreach ($container->getExtensions() as $extension) {
if ($extension instanceof Extension) {
$annotatedClasses = array_merge($annotatedClasses, $extension->getAnnotatedClassesToCompile());
}
}
$existingClasses = $this->getClassesInComposerClassMaps();
$annotatedClasses = $container->getParameterBag()->resolveValue($annotatedClasses);
$this->kernel->setAnnotatedClassCache($this->expandClasses($annotatedClasses, $existingClasses));
} | php | public function process(ContainerBuilder $container)
{
$annotatedClasses = $this->kernel->getAnnotatedClassesToCompile();
foreach ($container->getExtensions() as $extension) {
if ($extension instanceof Extension) {
$annotatedClasses = array_merge($annotatedClasses, $extension->getAnnotatedClassesToCompile());
}
}
$existingClasses = $this->getClassesInComposerClassMaps();
$annotatedClasses = $container->getParameterBag()->resolveValue($annotatedClasses);
$this->kernel->setAnnotatedClassCache($this->expandClasses($annotatedClasses, $existingClasses));
} | [
"public",
"function",
"process",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"annotatedClasses",
"=",
"$",
"this",
"->",
"kernel",
"->",
"getAnnotatedClassesToCompile",
"(",
")",
";",
"foreach",
"(",
"$",
"container",
"->",
"getExtensions",
"(",
... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/DependencyInjection/AddAnnotatedClassesToCachePass.php#L37-L50 | train | Process the container builder and add all annotated classes to the class tree | [
30522,
2270,
3853,
2832,
1006,
11661,
8569,
23891,
2099,
1002,
11661,
1007,
1063,
1002,
5754,
17287,
3064,
26266,
2229,
1027,
1002,
2023,
1011,
1028,
16293,
1011,
1028,
2131,
11639,
17287,
3064,
26266,
4355,
24163,
8737,
9463,
1006,
1007,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Translation/MessageSelector.php | MessageSelector.getPluralIndex | public function getPluralIndex($locale, $number)
{
switch ($locale) {
case 'az':
case 'az_AZ':
case 'bo':
case 'bo_CN':
case 'bo_IN':
case 'dz':
case 'dz_BT':
case 'id':
case 'id_ID':
case 'ja':
case 'ja_JP':
case 'jv':
case 'ka':
case 'ka_GE':
case 'km':
case 'km_KH':
case 'kn':
case 'kn_IN':
case 'ko':
case 'ko_KR':
case 'ms':
case 'ms_MY':
case 'th':
case 'th_TH':
case 'tr':
case 'tr_CY':
case 'tr_TR':
case 'vi':
case 'vi_VN':
case 'zh':
case 'zh_CN':
case 'zh_HK':
case 'zh_SG':
case 'zh_TW':
return 0;
case 'af':
case 'af_ZA':
case 'bn':
case 'bn_BD':
case 'bn_IN':
case 'bg':
case 'bg_BG':
case 'ca':
case 'ca_AD':
case 'ca_ES':
case 'ca_FR':
case 'ca_IT':
case 'da':
case 'da_DK':
case 'de':
case 'de_AT':
case 'de_BE':
case 'de_CH':
case 'de_DE':
case 'de_LI':
case 'de_LU':
case 'el':
case 'el_CY':
case 'el_GR':
case 'en':
case 'en_AG':
case 'en_AU':
case 'en_BW':
case 'en_CA':
case 'en_DK':
case 'en_GB':
case 'en_HK':
case 'en_IE':
case 'en_IN':
case 'en_NG':
case 'en_NZ':
case 'en_PH':
case 'en_SG':
case 'en_US':
case 'en_ZA':
case 'en_ZM':
case 'en_ZW':
case 'eo':
case 'eo_US':
case 'es':
case 'es_AR':
case 'es_BO':
case 'es_CL':
case 'es_CO':
case 'es_CR':
case 'es_CU':
case 'es_DO':
case 'es_EC':
case 'es_ES':
case 'es_GT':
case 'es_HN':
case 'es_MX':
case 'es_NI':
case 'es_PA':
case 'es_PE':
case 'es_PR':
case 'es_PY':
case 'es_SV':
case 'es_US':
case 'es_UY':
case 'es_VE':
case 'et':
case 'et_EE':
case 'eu':
case 'eu_ES':
case 'eu_FR':
case 'fa':
case 'fa_IR':
case 'fi':
case 'fi_FI':
case 'fo':
case 'fo_FO':
case 'fur':
case 'fur_IT':
case 'fy':
case 'fy_DE':
case 'fy_NL':
case 'gl':
case 'gl_ES':
case 'gu':
case 'gu_IN':
case 'ha':
case 'ha_NG':
case 'he':
case 'he_IL':
case 'hu':
case 'hu_HU':
case 'is':
case 'is_IS':
case 'it':
case 'it_CH':
case 'it_IT':
case 'ku':
case 'ku_TR':
case 'lb':
case 'lb_LU':
case 'ml':
case 'ml_IN':
case 'mn':
case 'mn_MN':
case 'mr':
case 'mr_IN':
case 'nah':
case 'nb':
case 'nb_NO':
case 'ne':
case 'ne_NP':
case 'nl':
case 'nl_AW':
case 'nl_BE':
case 'nl_NL':
case 'nn':
case 'nn_NO':
case 'no':
case 'om':
case 'om_ET':
case 'om_KE':
case 'or':
case 'or_IN':
case 'pa':
case 'pa_IN':
case 'pa_PK':
case 'pap':
case 'pap_AN':
case 'pap_AW':
case 'pap_CW':
case 'ps':
case 'ps_AF':
case 'pt':
case 'pt_BR':
case 'pt_PT':
case 'so':
case 'so_DJ':
case 'so_ET':
case 'so_KE':
case 'so_SO':
case 'sq':
case 'sq_AL':
case 'sq_MK':
case 'sv':
case 'sv_FI':
case 'sv_SE':
case 'sw':
case 'sw_KE':
case 'sw_TZ':
case 'ta':
case 'ta_IN':
case 'ta_LK':
case 'te':
case 'te_IN':
case 'tk':
case 'tk_TM':
case 'ur':
case 'ur_IN':
case 'ur_PK':
case 'zu':
case 'zu_ZA':
return ($number == 1) ? 0 : 1;
case 'am':
case 'am_ET':
case 'bh':
case 'fil':
case 'fil_PH':
case 'fr':
case 'fr_BE':
case 'fr_CA':
case 'fr_CH':
case 'fr_FR':
case 'fr_LU':
case 'gun':
case 'hi':
case 'hi_IN':
case 'hy':
case 'hy_AM':
case 'ln':
case 'ln_CD':
case 'mg':
case 'mg_MG':
case 'nso':
case 'nso_ZA':
case 'ti':
case 'ti_ER':
case 'ti_ET':
case 'wa':
case 'wa_BE':
case 'xbr':
return (($number == 0) || ($number == 1)) ? 0 : 1;
case 'be':
case 'be_BY':
case 'bs':
case 'bs_BA':
case 'hr':
case 'hr_HR':
case 'ru':
case 'ru_RU':
case 'ru_UA':
case 'sr':
case 'sr_ME':
case 'sr_RS':
case 'uk':
case 'uk_UA':
return (($number % 10 == 1) && ($number % 100 != 11)) ? 0 : ((($number % 10 >= 2) && ($number % 10 <= 4) && (($number % 100 < 10) || ($number % 100 >= 20))) ? 1 : 2);
case 'cs':
case 'cs_CZ':
case 'sk':
case 'sk_SK':
return ($number == 1) ? 0 : ((($number >= 2) && ($number <= 4)) ? 1 : 2);
case 'ga':
case 'ga_IE':
return ($number == 1) ? 0 : (($number == 2) ? 1 : 2);
case 'lt':
case 'lt_LT':
return (($number % 10 == 1) && ($number % 100 != 11)) ? 0 : ((($number % 10 >= 2) && (($number % 100 < 10) || ($number % 100 >= 20))) ? 1 : 2);
case 'sl':
case 'sl_SI':
return ($number % 100 == 1) ? 0 : (($number % 100 == 2) ? 1 : ((($number % 100 == 3) || ($number % 100 == 4)) ? 2 : 3));
case 'mk':
case 'mk_MK':
return ($number % 10 == 1) ? 0 : 1;
case 'mt':
case 'mt_MT':
return ($number == 1) ? 0 : ((($number == 0) || (($number % 100 > 1) && ($number % 100 < 11))) ? 1 : ((($number % 100 > 10) && ($number % 100 < 20)) ? 2 : 3));
case 'lv':
case 'lv_LV':
return ($number == 0) ? 0 : ((($number % 10 == 1) && ($number % 100 != 11)) ? 1 : 2);
case 'pl':
case 'pl_PL':
return ($number == 1) ? 0 : ((($number % 10 >= 2) && ($number % 10 <= 4) && (($number % 100 < 12) || ($number % 100 > 14))) ? 1 : 2);
case 'cy':
case 'cy_GB':
return ($number == 1) ? 0 : (($number == 2) ? 1 : ((($number == 8) || ($number == 11)) ? 2 : 3));
case 'ro':
case 'ro_RO':
return ($number == 1) ? 0 : ((($number == 0) || (($number % 100 > 0) && ($number % 100 < 20))) ? 1 : 2);
case 'ar':
case 'ar_AE':
case 'ar_BH':
case 'ar_DZ':
case 'ar_EG':
case 'ar_IN':
case 'ar_IQ':
case 'ar_JO':
case 'ar_KW':
case 'ar_LB':
case 'ar_LY':
case 'ar_MA':
case 'ar_OM':
case 'ar_QA':
case 'ar_SA':
case 'ar_SD':
case 'ar_SS':
case 'ar_SY':
case 'ar_TN':
case 'ar_YE':
return ($number == 0) ? 0 : (($number == 1) ? 1 : (($number == 2) ? 2 : ((($number % 100 >= 3) && ($number % 100 <= 10)) ? 3 : ((($number % 100 >= 11) && ($number % 100 <= 99)) ? 4 : 5))));
default:
return 0;
}
} | php | public function getPluralIndex($locale, $number)
{
switch ($locale) {
case 'az':
case 'az_AZ':
case 'bo':
case 'bo_CN':
case 'bo_IN':
case 'dz':
case 'dz_BT':
case 'id':
case 'id_ID':
case 'ja':
case 'ja_JP':
case 'jv':
case 'ka':
case 'ka_GE':
case 'km':
case 'km_KH':
case 'kn':
case 'kn_IN':
case 'ko':
case 'ko_KR':
case 'ms':
case 'ms_MY':
case 'th':
case 'th_TH':
case 'tr':
case 'tr_CY':
case 'tr_TR':
case 'vi':
case 'vi_VN':
case 'zh':
case 'zh_CN':
case 'zh_HK':
case 'zh_SG':
case 'zh_TW':
return 0;
case 'af':
case 'af_ZA':
case 'bn':
case 'bn_BD':
case 'bn_IN':
case 'bg':
case 'bg_BG':
case 'ca':
case 'ca_AD':
case 'ca_ES':
case 'ca_FR':
case 'ca_IT':
case 'da':
case 'da_DK':
case 'de':
case 'de_AT':
case 'de_BE':
case 'de_CH':
case 'de_DE':
case 'de_LI':
case 'de_LU':
case 'el':
case 'el_CY':
case 'el_GR':
case 'en':
case 'en_AG':
case 'en_AU':
case 'en_BW':
case 'en_CA':
case 'en_DK':
case 'en_GB':
case 'en_HK':
case 'en_IE':
case 'en_IN':
case 'en_NG':
case 'en_NZ':
case 'en_PH':
case 'en_SG':
case 'en_US':
case 'en_ZA':
case 'en_ZM':
case 'en_ZW':
case 'eo':
case 'eo_US':
case 'es':
case 'es_AR':
case 'es_BO':
case 'es_CL':
case 'es_CO':
case 'es_CR':
case 'es_CU':
case 'es_DO':
case 'es_EC':
case 'es_ES':
case 'es_GT':
case 'es_HN':
case 'es_MX':
case 'es_NI':
case 'es_PA':
case 'es_PE':
case 'es_PR':
case 'es_PY':
case 'es_SV':
case 'es_US':
case 'es_UY':
case 'es_VE':
case 'et':
case 'et_EE':
case 'eu':
case 'eu_ES':
case 'eu_FR':
case 'fa':
case 'fa_IR':
case 'fi':
case 'fi_FI':
case 'fo':
case 'fo_FO':
case 'fur':
case 'fur_IT':
case 'fy':
case 'fy_DE':
case 'fy_NL':
case 'gl':
case 'gl_ES':
case 'gu':
case 'gu_IN':
case 'ha':
case 'ha_NG':
case 'he':
case 'he_IL':
case 'hu':
case 'hu_HU':
case 'is':
case 'is_IS':
case 'it':
case 'it_CH':
case 'it_IT':
case 'ku':
case 'ku_TR':
case 'lb':
case 'lb_LU':
case 'ml':
case 'ml_IN':
case 'mn':
case 'mn_MN':
case 'mr':
case 'mr_IN':
case 'nah':
case 'nb':
case 'nb_NO':
case 'ne':
case 'ne_NP':
case 'nl':
case 'nl_AW':
case 'nl_BE':
case 'nl_NL':
case 'nn':
case 'nn_NO':
case 'no':
case 'om':
case 'om_ET':
case 'om_KE':
case 'or':
case 'or_IN':
case 'pa':
case 'pa_IN':
case 'pa_PK':
case 'pap':
case 'pap_AN':
case 'pap_AW':
case 'pap_CW':
case 'ps':
case 'ps_AF':
case 'pt':
case 'pt_BR':
case 'pt_PT':
case 'so':
case 'so_DJ':
case 'so_ET':
case 'so_KE':
case 'so_SO':
case 'sq':
case 'sq_AL':
case 'sq_MK':
case 'sv':
case 'sv_FI':
case 'sv_SE':
case 'sw':
case 'sw_KE':
case 'sw_TZ':
case 'ta':
case 'ta_IN':
case 'ta_LK':
case 'te':
case 'te_IN':
case 'tk':
case 'tk_TM':
case 'ur':
case 'ur_IN':
case 'ur_PK':
case 'zu':
case 'zu_ZA':
return ($number == 1) ? 0 : 1;
case 'am':
case 'am_ET':
case 'bh':
case 'fil':
case 'fil_PH':
case 'fr':
case 'fr_BE':
case 'fr_CA':
case 'fr_CH':
case 'fr_FR':
case 'fr_LU':
case 'gun':
case 'hi':
case 'hi_IN':
case 'hy':
case 'hy_AM':
case 'ln':
case 'ln_CD':
case 'mg':
case 'mg_MG':
case 'nso':
case 'nso_ZA':
case 'ti':
case 'ti_ER':
case 'ti_ET':
case 'wa':
case 'wa_BE':
case 'xbr':
return (($number == 0) || ($number == 1)) ? 0 : 1;
case 'be':
case 'be_BY':
case 'bs':
case 'bs_BA':
case 'hr':
case 'hr_HR':
case 'ru':
case 'ru_RU':
case 'ru_UA':
case 'sr':
case 'sr_ME':
case 'sr_RS':
case 'uk':
case 'uk_UA':
return (($number % 10 == 1) && ($number % 100 != 11)) ? 0 : ((($number % 10 >= 2) && ($number % 10 <= 4) && (($number % 100 < 10) || ($number % 100 >= 20))) ? 1 : 2);
case 'cs':
case 'cs_CZ':
case 'sk':
case 'sk_SK':
return ($number == 1) ? 0 : ((($number >= 2) && ($number <= 4)) ? 1 : 2);
case 'ga':
case 'ga_IE':
return ($number == 1) ? 0 : (($number == 2) ? 1 : 2);
case 'lt':
case 'lt_LT':
return (($number % 10 == 1) && ($number % 100 != 11)) ? 0 : ((($number % 10 >= 2) && (($number % 100 < 10) || ($number % 100 >= 20))) ? 1 : 2);
case 'sl':
case 'sl_SI':
return ($number % 100 == 1) ? 0 : (($number % 100 == 2) ? 1 : ((($number % 100 == 3) || ($number % 100 == 4)) ? 2 : 3));
case 'mk':
case 'mk_MK':
return ($number % 10 == 1) ? 0 : 1;
case 'mt':
case 'mt_MT':
return ($number == 1) ? 0 : ((($number == 0) || (($number % 100 > 1) && ($number % 100 < 11))) ? 1 : ((($number % 100 > 10) && ($number % 100 < 20)) ? 2 : 3));
case 'lv':
case 'lv_LV':
return ($number == 0) ? 0 : ((($number % 10 == 1) && ($number % 100 != 11)) ? 1 : 2);
case 'pl':
case 'pl_PL':
return ($number == 1) ? 0 : ((($number % 10 >= 2) && ($number % 10 <= 4) && (($number % 100 < 12) || ($number % 100 > 14))) ? 1 : 2);
case 'cy':
case 'cy_GB':
return ($number == 1) ? 0 : (($number == 2) ? 1 : ((($number == 8) || ($number == 11)) ? 2 : 3));
case 'ro':
case 'ro_RO':
return ($number == 1) ? 0 : ((($number == 0) || (($number % 100 > 0) && ($number % 100 < 20))) ? 1 : 2);
case 'ar':
case 'ar_AE':
case 'ar_BH':
case 'ar_DZ':
case 'ar_EG':
case 'ar_IN':
case 'ar_IQ':
case 'ar_JO':
case 'ar_KW':
case 'ar_LB':
case 'ar_LY':
case 'ar_MA':
case 'ar_OM':
case 'ar_QA':
case 'ar_SA':
case 'ar_SD':
case 'ar_SS':
case 'ar_SY':
case 'ar_TN':
case 'ar_YE':
return ($number == 0) ? 0 : (($number == 1) ? 1 : (($number == 2) ? 2 : ((($number % 100 >= 3) && ($number % 100 <= 10)) ? 3 : ((($number % 100 >= 11) && ($number % 100 <= 99)) ? 4 : 5))));
default:
return 0;
}
} | [
"public",
"function",
"getPluralIndex",
"(",
"$",
"locale",
",",
"$",
"number",
")",
"{",
"switch",
"(",
"$",
"locale",
")",
"{",
"case",
"'az'",
":",
"case",
"'az_AZ'",
":",
"case",
"'bo'",
":",
"case",
"'bo_CN'",
":",
"case",
"'bo_IN'",
":",
"case",
... | Get the index to use for pluralization.
The plural rules are derived from code of the Zend Framework (2010-09-25), which
is subject to the new BSD license (http://framework.zend.com/license/new-bsd)
Copyright (c) 2005-2010 - Zend Technologies USA Inc. (http://www.zend.com)
@param string $locale
@param int $number
@return int | [
"Get",
"the",
"index",
"to",
"use",
"for",
"pluralization",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Translation/MessageSelector.php#L110-L411 | train | Returns the plural index for the given locale | [
30522,
2270,
3853,
2131,
24759,
11137,
22254,
10288,
1006,
1002,
2334,
2063,
1010,
1002,
2193,
1007,
1063,
6942,
1006,
1002,
2334,
2063,
1007,
1063,
2553,
1005,
17207,
1005,
1024,
2553,
1005,
17207,
1035,
17207,
1005,
1024,
2553,
1005,
8945... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/Actions/API.php | API.getPageTitlesFollowingSiteSearch | public function getPageTitlesFollowingSiteSearch($idSite, $period, $date, $segment = false, $expanded = false, $idSubtable = false)
{
Piwik::checkUserHasViewAccess($idSite);
$dataTable = $this->getPageTitles($idSite, $period, $date, $segment, $expanded, $idSubtable);
$this->keepPagesFollowingSearch($dataTable);
return $dataTable;
} | php | public function getPageTitlesFollowingSiteSearch($idSite, $period, $date, $segment = false, $expanded = false, $idSubtable = false)
{
Piwik::checkUserHasViewAccess($idSite);
$dataTable = $this->getPageTitles($idSite, $period, $date, $segment, $expanded, $idSubtable);
$this->keepPagesFollowingSearch($dataTable);
return $dataTable;
} | [
"public",
"function",
"getPageTitlesFollowingSiteSearch",
"(",
"$",
"idSite",
",",
"$",
"period",
",",
"$",
"date",
",",
"$",
"segment",
"=",
"false",
",",
"$",
"expanded",
"=",
"false",
",",
"$",
"idSubtable",
"=",
"false",
")",
"{",
"Piwik",
"::",
"che... | @param int $idSite
@param string $period
@param Date $date
@param bool $segment
@param bool $expanded
@param bool $idSubtable
@return DataTable|DataTable\Map | [
"@param",
"int",
"$idSite",
"@param",
"string",
"$period",
"@param",
"Date",
"$date",
"@param",
"bool",
"$segment",
"@param",
"bool",
"$expanded",
"@param",
"bool",
"$idSubtable"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Actions/API.php#L143-L150 | train | Returns the page titles following a site search. | [
30522,
2270,
3853,
2131,
13704,
27430,
14876,
7174,
9328,
28032,
6810,
2906,
2818,
1006,
1002,
8909,
28032,
2063,
1010,
1002,
2558,
1010,
1002,
3058,
1010,
1002,
6903,
1027,
6270,
1010,
1002,
4423,
1027,
6270,
1010,
1002,
8909,
6342,
19279,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Collection.php | Collection.toExtendedArray | public function toExtendedArray()
{
$items = [];
foreach ($this->items as $path => $slug) {
$page = $this->pages->get($path);
if ($page !== null) {
$items[$page->route()] = $page->toArray();
}
}
return $items;
} | php | public function toExtendedArray()
{
$items = [];
foreach ($this->items as $path => $slug) {
$page = $this->pages->get($path);
if ($page !== null) {
$items[$page->route()] = $page->toArray();
}
}
return $items;
} | [
"public",
"function",
"toExtendedArray",
"(",
")",
"{",
"$",
"items",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"items",
"as",
"$",
"path",
"=>",
"$",
"slug",
")",
"{",
"$",
"page",
"=",
"$",
"this",
"->",
"pages",
"->",
"get",
"(",
... | Get the extended version of this Collection with each page keyed by route
@return array
@throws \Exception | [
"Get",
"the",
"extended",
"version",
"of",
"this",
"Collection",
"with",
"each",
"page",
"keyed",
"by",
"route"
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Collection.php#L618-L629 | train | Return an array of all pages | [
30522,
2270,
3853,
11756,
18413,
21945,
2906,
9447,
1006,
1007,
1063,
1002,
5167,
1027,
1031,
1033,
1025,
18921,
6776,
1006,
1002,
2023,
1011,
1028,
5167,
2004,
1002,
4130,
1027,
1028,
1002,
23667,
1007,
1063,
1002,
3931,
1027,
1002,
2023,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/Zend/Session/SaveHandler/DbTable.php | Zend_Session_SaveHandler_DbTable._getLifetime | protected function _getLifetime(Zend_Db_Table_Row_Abstract $row)
{
$return = $this->_lifetime;
if (!$this->_overrideLifetime) {
$return = (int) $row->{$this->_lifetimeColumn};
}
return $return;
} | php | protected function _getLifetime(Zend_Db_Table_Row_Abstract $row)
{
$return = $this->_lifetime;
if (!$this->_overrideLifetime) {
$return = (int) $row->{$this->_lifetimeColumn};
}
return $return;
} | [
"protected",
"function",
"_getLifetime",
"(",
"Zend_Db_Table_Row_Abstract",
"$",
"row",
")",
"{",
"$",
"return",
"=",
"$",
"this",
"->",
"_lifetime",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"_overrideLifetime",
")",
"{",
"$",
"return",
"=",
"(",
"int",
"... | Retrieve session lifetime considering Zend_Session_SaveHandler_DbTable::OVERRIDE_LIFETIME
@param Zend_Db_Table_Row_Abstract $row
@return int | [
"Retrieve",
"session",
"lifetime",
"considering",
"Zend_Session_SaveHandler_DbTable",
"::",
"OVERRIDE_LIFETIME"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Session/SaveHandler/DbTable.php#L570-L579 | train | Get lifetime of this record | [
30522,
5123,
3853,
1035,
2131,
15509,
7292,
1006,
16729,
2094,
1035,
16962,
1035,
2795,
1035,
5216,
1035,
10061,
1002,
5216,
1007,
1063,
1002,
2709,
1027,
1002,
2023,
1011,
1028,
1035,
6480,
1025,
2065,
1006,
999,
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/Component/Console/Helper/Table.php | Table.calculateNumberOfColumns | private function calculateNumberOfColumns($rows)
{
$columns = [0];
foreach ($rows as $row) {
if ($row instanceof TableSeparator) {
continue;
}
$columns[] = $this->getNumberOfColumns($row);
}
$this->numberOfColumns = max($columns);
} | php | private function calculateNumberOfColumns($rows)
{
$columns = [0];
foreach ($rows as $row) {
if ($row instanceof TableSeparator) {
continue;
}
$columns[] = $this->getNumberOfColumns($row);
}
$this->numberOfColumns = max($columns);
} | [
"private",
"function",
"calculateNumberOfColumns",
"(",
"$",
"rows",
")",
"{",
"$",
"columns",
"=",
"[",
"0",
"]",
";",
"foreach",
"(",
"$",
"rows",
"as",
"$",
"row",
")",
"{",
"if",
"(",
"$",
"row",
"instanceof",
"TableSeparator",
")",
"{",
"continue"... | Calculate number of columns for this table. | [
"Calculate",
"number",
"of",
"columns",
"for",
"this",
"table",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Console/Helper/Table.php#L502-L514 | train | Calculates the numberOfColumns property | [
30522,
2797,
3853,
18422,
19172,
5677,
11253,
25778,
2819,
3619,
1006,
1002,
10281,
1007,
1063,
1002,
7753,
1027,
1031,
1014,
1033,
1025,
18921,
6776,
1006,
1002,
10281,
2004,
1002,
5216,
1007,
1063,
2065,
1006,
1002,
5216,
6013,
11253,
725... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Session/Store.php | Store.flash | public function flash(string $key, $value = true)
{
$this->put($key, $value);
$this->push('_flash.new', $key);
$this->removeFromOldFlashData([$key]);
} | php | public function flash(string $key, $value = true)
{
$this->put($key, $value);
$this->push('_flash.new', $key);
$this->removeFromOldFlashData([$key]);
} | [
"public",
"function",
"flash",
"(",
"string",
"$",
"key",
",",
"$",
"value",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"put",
"(",
"$",
"key",
",",
"$",
"value",
")",
";",
"$",
"this",
"->",
"push",
"(",
"'_flash.new'",
",",
"$",
"key",
")",
";... | Flash a key / value pair to the session.
@param string $key
@param mixed $value
@return void | [
"Flash",
"a",
"key",
"/",
"value",
"pair",
"to",
"the",
"session",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Session/Store.php#L343-L350 | train | Add a flash value to the current session | [
30522,
2270,
3853,
5956,
1006,
5164,
1002,
3145,
1010,
1002,
3643,
1027,
2995,
1007,
1063,
1002,
2023,
1011,
1028,
2404,
1006,
1002,
3145,
1010,
1002,
3643,
1007,
1025,
1002,
2023,
1011,
1028,
5245,
1006,
1005,
1035,
5956,
1012,
2047,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/Archive/DataTableFactory.php | DataTableFactory.makeIndexedByRecordNameDataTable | private function makeIndexedByRecordNameDataTable($blobRow, $keyMetadata)
{
$table = new DataTable\Map();
$table->setKeyName('recordName');
$tableMetadata = array_merge(DataCollection::getDataRowMetadata($blobRow), $keyMetadata);
foreach ($blobRow as $name => $blob) {
$newTable = DataTable::fromSerializedArray($blob);
$newTable->setAllTableMetadata($tableMetadata);
$table->addTable($newTable, $name);
}
return $table;
} | php | private function makeIndexedByRecordNameDataTable($blobRow, $keyMetadata)
{
$table = new DataTable\Map();
$table->setKeyName('recordName');
$tableMetadata = array_merge(DataCollection::getDataRowMetadata($blobRow), $keyMetadata);
foreach ($blobRow as $name => $blob) {
$newTable = DataTable::fromSerializedArray($blob);
$newTable->setAllTableMetadata($tableMetadata);
$table->addTable($newTable, $name);
}
return $table;
} | [
"private",
"function",
"makeIndexedByRecordNameDataTable",
"(",
"$",
"blobRow",
",",
"$",
"keyMetadata",
")",
"{",
"$",
"table",
"=",
"new",
"DataTable",
"\\",
"Map",
"(",
")",
";",
"$",
"table",
"->",
"setKeyName",
"(",
"'recordName'",
")",
";",
"$",
"tab... | Creates a DataTable for every record in an archive data row and puts them
in a DataTable\Map instance.
@param array $blobRow
@return DataTable\Map | [
"Creates",
"a",
"DataTable",
"for",
"every",
"record",
"in",
"an",
"archive",
"data",
"row",
"and",
"puts",
"them",
"in",
"a",
"DataTable",
"\\",
"Map",
"instance",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Archive/DataTableFactory.php#L291-L306 | train | This method is used to make a DataTable indexed by record name. | [
30522,
2797,
3853,
2191,
22254,
10288,
2098,
3762,
2890,
27108,
28911,
7583,
6790,
10880,
1006,
1002,
1038,
4135,
12618,
2860,
1010,
1002,
3145,
11368,
8447,
2696,
1007,
1063,
1002,
2795,
1027,
2047,
2951,
10880,
1032,
4949,
1006,
1007,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
z-song/laravel-admin | src/Grid.php | Grid.setView | public function setView($view, $variables = [])
{
if (!empty($variables)) {
$this->with($variables);
}
$this->view = $view;
} | php | public function setView($view, $variables = [])
{
if (!empty($variables)) {
$this->with($variables);
}
$this->view = $view;
} | [
"public",
"function",
"setView",
"(",
"$",
"view",
",",
"$",
"variables",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"variables",
")",
")",
"{",
"$",
"this",
"->",
"with",
"(",
"$",
"variables",
")",
";",
"}",
"$",
"this",
"->"... | Set a view to render.
@param string $view
@param array $variables | [
"Set",
"a",
"view",
"to",
"render",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid.php#L951-L958 | train | Set the view of the page. | [
30522,
2270,
3853,
2275,
8584,
1006,
1002,
3193,
1010,
1002,
10857,
1027,
1031,
1033,
1007,
1063,
2065,
1006,
999,
4064,
1006,
1002,
10857,
1007,
1007,
1063,
1002,
2023,
1011,
1028,
2007,
1006,
1002,
10857,
1007,
1025,
1065,
1002,
2023,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Form/Extension/Core/DataMapper/RadioListMapper.php | RadioListMapper.mapFormsToData | public function mapFormsToData($radios, &$choice)
{
if (null !== $choice && !\is_string($choice)) {
throw new UnexpectedTypeException($choice, 'null or string');
}
$choice = null;
foreach ($radios as $radio) {
if ($radio->getData()) {
if ('placeholder' === $radio->getName()) {
return;
}
$choice = $radio->getConfig()->getOption('value');
return;
}
}
} | php | public function mapFormsToData($radios, &$choice)
{
if (null !== $choice && !\is_string($choice)) {
throw new UnexpectedTypeException($choice, 'null or string');
}
$choice = null;
foreach ($radios as $radio) {
if ($radio->getData()) {
if ('placeholder' === $radio->getName()) {
return;
}
$choice = $radio->getConfig()->getOption('value');
return;
}
}
} | [
"public",
"function",
"mapFormsToData",
"(",
"$",
"radios",
",",
"&",
"$",
"choice",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"choice",
"&&",
"!",
"\\",
"is_string",
"(",
"$",
"choice",
")",
")",
"{",
"throw",
"new",
"UnexpectedTypeException",
"(",
"$"... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Extension/Core/DataMapper/RadioListMapper.php#L46-L65 | train | Maps the form to the data | [
30522,
2270,
3853,
4949,
22694,
3406,
2850,
2696,
1006,
1002,
22229,
1010,
1004,
1002,
3601,
1007,
1063,
2065,
1006,
19701,
999,
1027,
1027,
1002,
3601,
1004,
1004,
999,
1032,
2003,
1035,
5164,
1006,
1002,
3601,
1007,
1007,
1063,
5466,
20... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Routing/UrlGenerator.php | UrlGenerator.setRequest | public function setRequest(Request $request)
{
$this->request = $request;
$this->cachedRoot = null;
$this->cachedScheme = null;
$this->routeGenerator = null;
} | php | public function setRequest(Request $request)
{
$this->request = $request;
$this->cachedRoot = null;
$this->cachedScheme = null;
$this->routeGenerator = null;
} | [
"public",
"function",
"setRequest",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"this",
"->",
"request",
"=",
"$",
"request",
";",
"$",
"this",
"->",
"cachedRoot",
"=",
"null",
";",
"$",
"this",
"->",
"cachedScheme",
"=",
"null",
";",
"$",
"this",
... | Set the current request instance.
@param \Illuminate\Http\Request $request
@return void | [
"Set",
"the",
"current",
"request",
"instance",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Routing/UrlGenerator.php#L658-L665 | train | Set the request | [
30522,
2270,
3853,
2275,
2890,
15500,
1006,
5227,
1002,
5227,
1007,
1063,
1002,
2023,
1011,
1028,
5227,
1027,
1002,
5227,
1025,
1002,
2023,
1011,
1028,
17053,
22196,
4140,
1027,
19701,
1025,
1002,
2023,
1011,
1028,
17053,
5104,
5403,
4168,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/system/ServiceProvider.php | ServiceProvider.registerAssetBundles | protected function registerAssetBundles()
{
/*
* Register asset bundles
*/
CombineAssets::registerCallback(function ($combiner) {
$combiner->registerBundle('~/modules/system/assets/less/styles.less');
$combiner->registerBundle('~/modules/system/assets/ui/storm.less');
$combiner->registerBundle('~/modules/system/assets/ui/storm.js');
$combiner->registerBundle('~/modules/system/assets/js/framework.js');
$combiner->registerBundle('~/modules/system/assets/js/framework.combined.js');
$combiner->registerBundle('~/modules/system/assets/css/framework.extras.css');
});
} | php | protected function registerAssetBundles()
{
/*
* Register asset bundles
*/
CombineAssets::registerCallback(function ($combiner) {
$combiner->registerBundle('~/modules/system/assets/less/styles.less');
$combiner->registerBundle('~/modules/system/assets/ui/storm.less');
$combiner->registerBundle('~/modules/system/assets/ui/storm.js');
$combiner->registerBundle('~/modules/system/assets/js/framework.js');
$combiner->registerBundle('~/modules/system/assets/js/framework.combined.js');
$combiner->registerBundle('~/modules/system/assets/css/framework.extras.css');
});
} | [
"protected",
"function",
"registerAssetBundles",
"(",
")",
"{",
"/*\n * Register asset bundles\n */",
"CombineAssets",
"::",
"registerCallback",
"(",
"function",
"(",
"$",
"combiner",
")",
"{",
"$",
"combiner",
"->",
"registerBundle",
"(",
"'~/modules/syst... | Register asset bundles | [
"Register",
"asset",
"bundles"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/ServiceProvider.php#L510-L523 | train | Register asset bundles | [
30522,
5123,
3853,
4236,
27241,
2102,
27265,
4244,
1006,
1007,
1063,
1013,
1008,
1008,
4236,
11412,
26825,
1008,
1013,
11506,
27241,
3215,
1024,
1024,
4236,
9289,
20850,
8684,
1006,
3853,
1006,
1002,
11506,
2099,
1007,
1063,
1002,
11506,
20... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Validator/Mapping/Loader/PropertyInfoLoader.php | PropertyInfoLoader.loadClassMetadata | public function loadClassMetadata(ClassMetadata $metadata)
{
$className = $metadata->getClassName();
if (null !== $this->classValidatorRegexp && !preg_match($this->classValidatorRegexp, $className)) {
return false;
}
if (!$properties = $this->listExtractor->getProperties($className)) {
return false;
}
foreach ($properties as $property) {
$types = $this->typeExtractor->getTypes($className, $property);
if (null === $types) {
continue;
}
$hasTypeConstraint = false;
$hasNotNullConstraint = false;
$hasNotBlankConstraint = false;
$allConstraint = null;
foreach ($metadata->getPropertyMetadata($property) as $propertyMetadata) {
foreach ($propertyMetadata->getConstraints() as $constraint) {
if ($constraint instanceof Type) {
$hasTypeConstraint = true;
} elseif ($constraint instanceof NotNull) {
$hasNotNullConstraint = true;
} elseif ($constraint instanceof NotBlank) {
$hasNotBlankConstraint = true;
} elseif ($constraint instanceof All) {
$allConstraint = $constraint;
}
}
}
$builtinTypes = [];
$nullable = false;
$scalar = true;
foreach ($types as $type) {
$builtinTypes[] = $type->getBuiltinType();
if ($scalar && !\in_array($type->getBuiltinType(), [PropertyInfoType::BUILTIN_TYPE_INT, PropertyInfoType::BUILTIN_TYPE_FLOAT, PropertyInfoType::BUILTIN_TYPE_STRING, PropertyInfoType::BUILTIN_TYPE_BOOL], true)) {
$scalar = false;
}
if (!$nullable && $type->isNullable()) {
$nullable = true;
}
}
if (!$hasTypeConstraint) {
if (1 === \count($builtinTypes)) {
if ($types[0]->isCollection() && (null !== $collectionValueType = $types[0]->getCollectionValueType())) {
$this->handleAllConstraint($property, $allConstraint, $collectionValueType, $metadata);
}
$metadata->addPropertyConstraint($property, $this->getTypeConstraint($builtinTypes[0], $types[0]));
} elseif ($scalar) {
$metadata->addPropertyConstraint($property, new Type(['type' => 'scalar']));
}
}
if (!$nullable && !$hasNotBlankConstraint && !$hasNotNullConstraint) {
$metadata->addPropertyConstraint($property, new NotNull());
}
}
return true;
} | php | public function loadClassMetadata(ClassMetadata $metadata)
{
$className = $metadata->getClassName();
if (null !== $this->classValidatorRegexp && !preg_match($this->classValidatorRegexp, $className)) {
return false;
}
if (!$properties = $this->listExtractor->getProperties($className)) {
return false;
}
foreach ($properties as $property) {
$types = $this->typeExtractor->getTypes($className, $property);
if (null === $types) {
continue;
}
$hasTypeConstraint = false;
$hasNotNullConstraint = false;
$hasNotBlankConstraint = false;
$allConstraint = null;
foreach ($metadata->getPropertyMetadata($property) as $propertyMetadata) {
foreach ($propertyMetadata->getConstraints() as $constraint) {
if ($constraint instanceof Type) {
$hasTypeConstraint = true;
} elseif ($constraint instanceof NotNull) {
$hasNotNullConstraint = true;
} elseif ($constraint instanceof NotBlank) {
$hasNotBlankConstraint = true;
} elseif ($constraint instanceof All) {
$allConstraint = $constraint;
}
}
}
$builtinTypes = [];
$nullable = false;
$scalar = true;
foreach ($types as $type) {
$builtinTypes[] = $type->getBuiltinType();
if ($scalar && !\in_array($type->getBuiltinType(), [PropertyInfoType::BUILTIN_TYPE_INT, PropertyInfoType::BUILTIN_TYPE_FLOAT, PropertyInfoType::BUILTIN_TYPE_STRING, PropertyInfoType::BUILTIN_TYPE_BOOL], true)) {
$scalar = false;
}
if (!$nullable && $type->isNullable()) {
$nullable = true;
}
}
if (!$hasTypeConstraint) {
if (1 === \count($builtinTypes)) {
if ($types[0]->isCollection() && (null !== $collectionValueType = $types[0]->getCollectionValueType())) {
$this->handleAllConstraint($property, $allConstraint, $collectionValueType, $metadata);
}
$metadata->addPropertyConstraint($property, $this->getTypeConstraint($builtinTypes[0], $types[0]));
} elseif ($scalar) {
$metadata->addPropertyConstraint($property, new Type(['type' => 'scalar']));
}
}
if (!$nullable && !$hasNotBlankConstraint && !$hasNotNullConstraint) {
$metadata->addPropertyConstraint($property, new NotNull());
}
}
return true;
} | [
"public",
"function",
"loadClassMetadata",
"(",
"ClassMetadata",
"$",
"metadata",
")",
"{",
"$",
"className",
"=",
"$",
"metadata",
"->",
"getClassName",
"(",
")",
";",
"if",
"(",
"null",
"!==",
"$",
"this",
"->",
"classValidatorRegexp",
"&&",
"!",
"preg_mat... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Validator/Mapping/Loader/PropertyInfoLoader.php#L44-L111 | train | Load class metadata | [
30522,
2270,
3853,
7170,
26266,
11368,
8447,
2696,
1006,
2465,
11368,
8447,
2696,
1002,
27425,
1007,
1063,
1002,
2465,
18442,
1027,
1002,
27425,
1011,
1028,
2131,
26266,
18442,
1006,
1007,
1025,
2065,
1006,
19701,
999,
1027,
1027,
1002,
202... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/HttpFoundation/HeaderUtils.php | HeaderUtils.split | public static function split(string $header, string $separators): array
{
$quotedSeparators = preg_quote($separators, '/');
preg_match_all('
/
(?!\s)
(?:
# quoted-string
"(?:[^"\\\\]|\\\\.)*(?:"|\\\\|$)
|
# token
[^"'.$quotedSeparators.']+
)+
(?<!\s)
|
# separator
\s*
(?<separator>['.$quotedSeparators.'])
\s*
/x', trim($header), $matches, PREG_SET_ORDER);
return self::groupParts($matches, $separators);
} | php | public static function split(string $header, string $separators): array
{
$quotedSeparators = preg_quote($separators, '/');
preg_match_all('
/
(?!\s)
(?:
# quoted-string
"(?:[^"\\\\]|\\\\.)*(?:"|\\\\|$)
|
# token
[^"'.$quotedSeparators.']+
)+
(?<!\s)
|
# separator
\s*
(?<separator>['.$quotedSeparators.'])
\s*
/x', trim($header), $matches, PREG_SET_ORDER);
return self::groupParts($matches, $separators);
} | [
"public",
"static",
"function",
"split",
"(",
"string",
"$",
"header",
",",
"string",
"$",
"separators",
")",
":",
"array",
"{",
"$",
"quotedSeparators",
"=",
"preg_quote",
"(",
"$",
"separators",
",",
"'/'",
")",
";",
"preg_match_all",
"(",
"'\n ... | Splits an HTTP header by one or more separators.
Example:
HeaderUtils::split("da, en-gb;q=0.8", ",;")
// => ['da'], ['en-gb', 'q=0.8']]
@param string $header HTTP header value
@param string $separators List of characters to split on, ordered by
precedence, e.g. ",", ";=", or ",;="
@return array Nested array with as many levels as there are characters in
$separators | [
"Splits",
"an",
"HTTP",
"header",
"by",
"one",
"or",
"more",
"separators",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpFoundation/HeaderUtils.php#L46-L69 | train | Splits the header into an array of tokens | [
30522,
2270,
10763,
3853,
3975,
1006,
5164,
1002,
20346,
1010,
5164,
1002,
19802,
25879,
5668,
1007,
1024,
9140,
1063,
1002,
9339,
3366,
28689,
6591,
1027,
3653,
2290,
1035,
14686,
1006,
1002,
19802,
25879,
5668,
1010,
1005,
1013,
1005,
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... |
php-ai/php-ml | src/Helper/Optimizer/ConjugateGradient.php | MP.divs | public static function divs(array $m1, float $m2): array
{
$res = [];
foreach ($m1 as $val) {
$res[] = $val / ($m2 + 1e-32);
}
return $res;
} | php | public static function divs(array $m1, float $m2): array
{
$res = [];
foreach ($m1 as $val) {
$res[] = $val / ($m2 + 1e-32);
}
return $res;
} | [
"public",
"static",
"function",
"divs",
"(",
"array",
"$",
"m1",
",",
"float",
"$",
"m2",
")",
":",
"array",
"{",
"$",
"res",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"m1",
"as",
"$",
"val",
")",
"{",
"$",
"res",
"[",
"]",
"=",
"$",
"val",
... | Element-wise <b>division</b> of a vector with a scalar | [
"Element",
"-",
"wise",
"<b",
">",
"division<",
"/",
"b",
">",
"of",
"a",
"vector",
"with",
"a",
"scalar"
] | f6aa1a59b0525b8fca3d2786d661ab3e70904016 | https://github.com/php-ai/php-ml/blob/f6aa1a59b0525b8fca3d2786d661ab3e70904016/src/Helper/Optimizer/ConjugateGradient.php#L274-L282 | train | Divide two values into an array | [
30522,
2270,
10763,
3853,
4487,
15088,
1006,
9140,
1002,
23290,
1010,
14257,
1002,
25525,
1007,
1024,
9140,
1063,
1002,
24501,
1027,
1031,
1033,
1025,
18921,
6776,
1006,
1002,
23290,
2004,
1002,
11748,
1007,
1063,
1002,
24501,
1031,
1033,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
php-ai/php-ml | src/Classification/NaiveBayes.php | NaiveBayes.getSamplesByLabel | private function getSamplesByLabel(string $label): array
{
$samples = [];
for ($i = 0; $i < $this->sampleCount; ++$i) {
if ($this->targets[$i] == $label) {
$samples[] = $this->samples[$i];
}
}
return $samples;
} | php | private function getSamplesByLabel(string $label): array
{
$samples = [];
for ($i = 0; $i < $this->sampleCount; ++$i) {
if ($this->targets[$i] == $label) {
$samples[] = $this->samples[$i];
}
}
return $samples;
} | [
"private",
"function",
"getSamplesByLabel",
"(",
"string",
"$",
"label",
")",
":",
"array",
"{",
"$",
"samples",
"=",
"[",
"]",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"$",
"this",
"->",
"sampleCount",
";",
"++",
"$",
"i",
")",
... | Return samples belonging to specific label | [
"Return",
"samples",
"belonging",
"to",
"specific",
"label"
] | f6aa1a59b0525b8fca3d2786d661ab3e70904016 | https://github.com/php-ai/php-ml/blob/f6aa1a59b0525b8fca3d2786d661ab3e70904016/src/Classification/NaiveBayes.php#L173-L183 | train | Returns the samples by the given label | [
30522,
2797,
3853,
4152,
16613,
4244,
3762,
20470,
2884,
1006,
5164,
1002,
3830,
1007,
1024,
9140,
1063,
1002,
8168,
1027,
1031,
1033,
1025,
2005,
1006,
1002,
1045,
1027,
1014,
1025,
1002,
1045,
1026,
1002,
2023,
1011,
1028,
7099,
3597,
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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.