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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
symfony/symfony | src/Symfony/Component/HttpClient/HttpClientTrait.php | HttpClientTrait.jsonEncode | private static function jsonEncode($value, int $flags = null, int $maxDepth = 512): string
{
$flags = $flags ?? (JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT | JSON_PRESERVE_ZERO_FRACTION);
if (!\is_array($value) && !$value instanceof \JsonSerializable) {
throw new InvalidArgumentException(sprintf('Option "json" must be array or JsonSerializable, %s given.', \is_object($value) ? \get_class($value) : \gettype($value)));
}
try {
$value = json_encode($value, $flags | (\PHP_VERSION_ID >= 70300 ? JSON_THROW_ON_ERROR : 0), $maxDepth);
} catch (\JsonException $e) {
throw new InvalidArgumentException(sprintf('Invalid value for "json" option: %s.', $e->getMessage()));
}
if (\PHP_VERSION_ID < 70300 && JSON_ERROR_NONE !== json_last_error() && (false === $value || !($flags & JSON_PARTIAL_OUTPUT_ON_ERROR))) {
throw new InvalidArgumentException(sprintf('Invalid value for "json" option: %s.', json_last_error_msg()));
}
return $value;
} | php | private static function jsonEncode($value, int $flags = null, int $maxDepth = 512): string
{
$flags = $flags ?? (JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT | JSON_PRESERVE_ZERO_FRACTION);
if (!\is_array($value) && !$value instanceof \JsonSerializable) {
throw new InvalidArgumentException(sprintf('Option "json" must be array or JsonSerializable, %s given.', \is_object($value) ? \get_class($value) : \gettype($value)));
}
try {
$value = json_encode($value, $flags | (\PHP_VERSION_ID >= 70300 ? JSON_THROW_ON_ERROR : 0), $maxDepth);
} catch (\JsonException $e) {
throw new InvalidArgumentException(sprintf('Invalid value for "json" option: %s.', $e->getMessage()));
}
if (\PHP_VERSION_ID < 70300 && JSON_ERROR_NONE !== json_last_error() && (false === $value || !($flags & JSON_PARTIAL_OUTPUT_ON_ERROR))) {
throw new InvalidArgumentException(sprintf('Invalid value for "json" option: %s.', json_last_error_msg()));
}
return $value;
} | [
"private",
"static",
"function",
"jsonEncode",
"(",
"$",
"value",
",",
"int",
"$",
"flags",
"=",
"null",
",",
"int",
"$",
"maxDepth",
"=",
"512",
")",
":",
"string",
"{",
"$",
"flags",
"=",
"$",
"flags",
"??",
"(",
"JSON_HEX_TAG",
"|",
"JSON_HEX_APOS",... | @param array|\JsonSerializable $value
@throws InvalidArgumentException When the value cannot be json-encoded | [
"@param",
"array|",
"\\",
"JsonSerializable",
"$value"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpClient/HttpClientTrait.php#L295-L314 | train | Encodes the given value with the JSON encoding. | [
30522,
2797,
10763,
3853,
1046,
3385,
2368,
16044,
1006,
1002,
30524,
2595,
1035,
23713,
1064,
1046,
3385,
1035,
2002,
2595,
1035,
22035,
2102,
1064,
1046,
3385,
1035,
7969,
1035,
5717,
1035,
12884,
1007,
1025,
2065,
1006,
999,
1032,
2003,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
z-song/laravel-admin | src/Form/Field/Tags.php | Tags.prepare | public function prepare($value)
{
$value = array_filter($value, 'strlen');
if ($this->keyAsValue) {
return is_null($this->saveAction) ? $value : ($this->saveAction)($value);
}
if (is_array($value) && !Arr::isAssoc($value)) {
$value = implode(',', $value);
}
return $value;
} | php | public function prepare($value)
{
$value = array_filter($value, 'strlen');
if ($this->keyAsValue) {
return is_null($this->saveAction) ? $value : ($this->saveAction)($value);
}
if (is_array($value) && !Arr::isAssoc($value)) {
$value = implode(',', $value);
}
return $value;
} | [
"public",
"function",
"prepare",
"(",
"$",
"value",
")",
"{",
"$",
"value",
"=",
"array_filter",
"(",
"$",
"value",
",",
"'strlen'",
")",
";",
"if",
"(",
"$",
"this",
"->",
"keyAsValue",
")",
"{",
"return",
"is_null",
"(",
"$",
"this",
"->",
"saveAct... | {@inheritdoc} | [
"{"
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Form/Field/Tags.php#L132-L145 | train | Prepare value for output | [
30522,
2270,
3853,
7374,
1006,
1002,
3643,
1007,
1063,
1002,
3643,
1027,
9140,
1035,
11307,
1006,
1002,
3643,
1010,
1005,
2358,
20927,
2078,
1005,
1007,
1025,
2065,
1006,
1002,
2023,
1011,
1028,
3145,
3022,
10175,
5657,
1007,
1063,
2709,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
z-song/laravel-admin | src/Show/Field.php | Field.setValue | public function setValue(Model $model)
{
if ($this->relation) {
if (!$relationValue = $model->{$this->relation}) {
return $this;
}
$this->value = $relationValue;
} else {
$this->value = $model->getAttribute($this->name);
}
return $this;
} | php | public function setValue(Model $model)
{
if ($this->relation) {
if (!$relationValue = $model->{$this->relation}) {
return $this;
}
$this->value = $relationValue;
} else {
$this->value = $model->getAttribute($this->name);
}
return $this;
} | [
"public",
"function",
"setValue",
"(",
"Model",
"$",
"model",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"relation",
")",
"{",
"if",
"(",
"!",
"$",
"relationValue",
"=",
"$",
"model",
"->",
"{",
"$",
"this",
"->",
"relation",
"}",
")",
"{",
"return",
... | Set value for this field.
@param Model $model
@return $this | [
"Set",
"value",
"for",
"this",
"field",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Show/Field.php#L422-L435 | train | Set Value of the attribute | [
30522,
2270,
3853,
2275,
10175,
5657,
1006,
2944,
1002,
2944,
1007,
1063,
2065,
1006,
1002,
2023,
1011,
1028,
7189,
1007,
1063,
2065,
1006,
999,
1002,
7189,
10175,
5657,
1027,
1002,
2944,
1011,
1028,
1063,
1002,
2023,
1011,
1028,
7189,
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/Security/Core/User/User.php | User.isEqualTo | public function isEqualTo(UserInterface $user)
{
if (!$user instanceof self) {
return false;
}
if ($this->getPassword() !== $user->getPassword()) {
return false;
}
if ($this->getSalt() !== $user->getSalt()) {
return false;
}
if ($this->getUsername() !== $user->getUsername()) {
return false;
}
if ($this->isAccountNonExpired() !== $user->isAccountNonExpired()) {
return false;
}
if ($this->isAccountNonLocked() !== $user->isAccountNonLocked()) {
return false;
}
if ($this->isCredentialsNonExpired() !== $user->isCredentialsNonExpired()) {
return false;
}
if ($this->isEnabled() !== $user->isEnabled()) {
return false;
}
return true;
} | php | public function isEqualTo(UserInterface $user)
{
if (!$user instanceof self) {
return false;
}
if ($this->getPassword() !== $user->getPassword()) {
return false;
}
if ($this->getSalt() !== $user->getSalt()) {
return false;
}
if ($this->getUsername() !== $user->getUsername()) {
return false;
}
if ($this->isAccountNonExpired() !== $user->isAccountNonExpired()) {
return false;
}
if ($this->isAccountNonLocked() !== $user->isAccountNonLocked()) {
return false;
}
if ($this->isCredentialsNonExpired() !== $user->isCredentialsNonExpired()) {
return false;
}
if ($this->isEnabled() !== $user->isEnabled()) {
return false;
}
return true;
} | [
"public",
"function",
"isEqualTo",
"(",
"UserInterface",
"$",
"user",
")",
"{",
"if",
"(",
"!",
"$",
"user",
"instanceof",
"self",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"getPassword",
"(",
")",
"!==",
"$",
"user",
"->",... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Security/Core/User/User.php#L124-L159 | train | Returns true if the user is equal to this one. | [
30522,
2270,
3853,
2003,
2063,
26426,
3406,
1006,
5310,
18447,
2121,
12172,
1002,
5310,
1007,
1063,
2065,
1006,
999,
1002,
5310,
6013,
11253,
2969,
1007,
1063,
2709,
6270,
1025,
1065,
2065,
1006,
1002,
2023,
1011,
1028,
2131,
15194,
18351,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Transport/Sendmail.php | Zend_Mail_Transport_Sendmail._handleMailErrors | public function _handleMailErrors($errno, $errstr, $errfile = null, $errline = null, array $errcontext = null)
{
$this->_errstr = $errstr;
return true;
} | php | public function _handleMailErrors($errno, $errstr, $errfile = null, $errline = null, array $errcontext = null)
{
$this->_errstr = $errstr;
return true;
} | [
"public",
"function",
"_handleMailErrors",
"(",
"$",
"errno",
",",
"$",
"errstr",
",",
"$",
"errfile",
"=",
"null",
",",
"$",
"errline",
"=",
"null",
",",
"array",
"$",
"errcontext",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"_errstr",
"=",
"$",
"err... | Temporary error handler for PHP native mail().
@param int $errno
@param string $errstr
@param string $errfile
@param string $errline
@param array $errcontext
@return true | [
"Temporary",
"error",
"handler",
"for",
"PHP",
"native",
"mail",
"()",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Mail/Transport/Sendmail.php#L214-L218 | train | Handle mail errors | [
30522,
2270,
3853,
1035,
5047,
21397,
2121,
29165,
2015,
1006,
1002,
9413,
19139,
1010,
1002,
9413,
12096,
2099,
1010,
1002,
9413,
12881,
9463,
1027,
19701,
1010,
1002,
9413,
19403,
2063,
1027,
19701,
1010,
9140,
1002,
9413,
29566,
10111,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/Zend/Db/Select.php | Zend_Db_Select.orHaving | public function orHaving($cond, $value = null, $type = null)
{
if ($value !== null) {
$cond = $this->_adapter->quoteInto($cond, $value, $type);
}
if ($this->_parts[self::HAVING]) {
$this->_parts[self::HAVING][] = self::SQL_OR . " ($cond)";
} else {
$this->_parts[self::HAVING][] = "($cond)";
}
return $this;
} | php | public function orHaving($cond, $value = null, $type = null)
{
if ($value !== null) {
$cond = $this->_adapter->quoteInto($cond, $value, $type);
}
if ($this->_parts[self::HAVING]) {
$this->_parts[self::HAVING][] = self::SQL_OR . " ($cond)";
} else {
$this->_parts[self::HAVING][] = "($cond)";
}
return $this;
} | [
"public",
"function",
"orHaving",
"(",
"$",
"cond",
",",
"$",
"value",
"=",
"null",
",",
"$",
"type",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"value",
"!==",
"null",
")",
"{",
"$",
"cond",
"=",
"$",
"this",
"->",
"_adapter",
"->",
"quoteInto",
"("... | Adds a HAVING condition to the query by OR.
Otherwise identical to orHaving().
@param string $cond The HAVING condition.
@param mixed $value OPTIONAL The value to quote into the condition.
@param int $type OPTIONAL The type of the given value
@return Zend_Db_Select This Zend_Db_Select object.
@see having() | [
"Adds",
"a",
"HAVING",
"condition",
"to",
"the",
"query",
"by",
"OR",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Select.php#L560-L573 | train | Add having clause to the query | [
30522,
2270,
3853,
2030,
3270,
6455,
1006,
1002,
9530,
2094,
1010,
1002,
3643,
1027,
19701,
1010,
1002,
2828,
1027,
19701,
1007,
1063,
2065,
1006,
1002,
3643,
999,
1027,
1027,
19701,
1007,
1063,
1002,
9530,
2094,
1027,
1002,
2023,
1011,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/Piwik.php | Piwik.checkValidLoginString | public static function checkValidLoginString($userLogin)
{
if (!SettingsPiwik::isUserCredentialsSanityCheckEnabled()
&& !empty($userLogin)
) {
return;
}
$loginMinimumLength = 2;
$loginMaximumLength = 100;
$l = strlen($userLogin);
if (!($l >= $loginMinimumLength
&& $l <= $loginMaximumLength
&& (preg_match('/^[A-Za-zÄäÖöÜüß0-9_.@+-]*$/D', $userLogin) > 0))
) {
throw new Exception(Piwik::translate('UsersManager_ExceptionInvalidLoginFormat', array($loginMinimumLength, $loginMaximumLength)));
}
} | php | public static function checkValidLoginString($userLogin)
{
if (!SettingsPiwik::isUserCredentialsSanityCheckEnabled()
&& !empty($userLogin)
) {
return;
}
$loginMinimumLength = 2;
$loginMaximumLength = 100;
$l = strlen($userLogin);
if (!($l >= $loginMinimumLength
&& $l <= $loginMaximumLength
&& (preg_match('/^[A-Za-zÄäÖöÜüß0-9_.@+-]*$/D', $userLogin) > 0))
) {
throw new Exception(Piwik::translate('UsersManager_ExceptionInvalidLoginFormat', array($loginMinimumLength, $loginMaximumLength)));
}
} | [
"public",
"static",
"function",
"checkValidLoginString",
"(",
"$",
"userLogin",
")",
"{",
"if",
"(",
"!",
"SettingsPiwik",
"::",
"isUserCredentialsSanityCheckEnabled",
"(",
")",
"&&",
"!",
"empty",
"(",
"$",
"userLogin",
")",
")",
"{",
"return",
";",
"}",
"$... | Returns `true` if the login is valid.
_Warning: does not check if the login already exists! You must use UsersManager_API->userExists as well._
@param string $userLogin
@throws Exception
@return bool | [
"Returns",
"true",
"if",
"the",
"login",
"is",
"valid",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Piwik.php#L666-L682 | train | Check if a user login string is valid | [
30522,
2270,
10763,
3853,
4638,
10175,
3593,
21197,
7076,
18886,
3070,
1006,
1002,
5310,
21197,
2378,
1007,
1063,
2065,
1006,
999,
10906,
8197,
30524,
1006,
1002,
5310,
21197,
2378,
1007,
1007,
1063,
2709,
1025,
1065,
1002,
8833,
2378,
2530... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
overtrue/wechat | src/OfficialAccount/Card/JssdkClient.php | JssdkClient.attachExtension | public function attachExtension($cardId, array $extension = [])
{
$timestamp = time();
$nonce = str_random(6);
$ticket = $this->getTicket()['ticket'];
$ext = array_merge(['timestamp' => $timestamp, 'nonce_str' => $nonce], Arr::only(
$extension,
['code', 'openid', 'outer_id', 'balance', 'fixed_begintimestamp', 'outer_str']
));
$ext['signature'] = $this->dictionaryOrderSignature($ticket, $timestamp, $cardId, $ext['code'] ?? '', $ext['openid'] ?? '', $nonce);
return [
'cardId' => $cardId,
'cardExt' => json_encode($ext),
];
} | php | public function attachExtension($cardId, array $extension = [])
{
$timestamp = time();
$nonce = str_random(6);
$ticket = $this->getTicket()['ticket'];
$ext = array_merge(['timestamp' => $timestamp, 'nonce_str' => $nonce], Arr::only(
$extension,
['code', 'openid', 'outer_id', 'balance', 'fixed_begintimestamp', 'outer_str']
));
$ext['signature'] = $this->dictionaryOrderSignature($ticket, $timestamp, $cardId, $ext['code'] ?? '', $ext['openid'] ?? '', $nonce);
return [
'cardId' => $cardId,
'cardExt' => json_encode($ext),
];
} | [
"public",
"function",
"attachExtension",
"(",
"$",
"cardId",
",",
"array",
"$",
"extension",
"=",
"[",
"]",
")",
"{",
"$",
"timestamp",
"=",
"time",
"(",
")",
";",
"$",
"nonce",
"=",
"str_random",
"(",
"6",
")",
";",
"$",
"ticket",
"=",
"$",
"this"... | 生成 js添加到卡包 需要的 card_list 项.
@param string $cardId
@param array $extension
@return array
@throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
@throws \Psr\SimpleCache\InvalidArgumentException | [
"生成",
"js添加到卡包",
"需要的",
"card_list",
"项",
"."
] | 120c72faaa93c270365bc75c73c362d5fd583209 | https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/OfficialAccount/Card/JssdkClient.php#L65-L82 | train | Attaches the extension to the card | [
30522,
2270,
3853,
29489,
18413,
6132,
3258,
1006,
1002,
4003,
3593,
1010,
9140,
1002,
5331,
1027,
1031,
1033,
1007,
1063,
1002,
2335,
15464,
2361,
1027,
2051,
1006,
1007,
1025,
1002,
2512,
3401,
1027,
2358,
2099,
1035,
6721,
1006,
1020,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getgrav/grav | system/src/Grav/Common/Config/CompiledBase.php | CompiledBase.loadFiles | protected function loadFiles()
{
$this->createObject();
$list = array_reverse($this->files);
foreach ($list as $files) {
foreach ($files as $name => $item) {
$this->loadFile($name, $this->path . $item['file']);
}
}
$this->finalizeObject();
return true;
} | php | protected function loadFiles()
{
$this->createObject();
$list = array_reverse($this->files);
foreach ($list as $files) {
foreach ($files as $name => $item) {
$this->loadFile($name, $this->path . $item['file']);
}
}
$this->finalizeObject();
return true;
} | [
"protected",
"function",
"loadFiles",
"(",
")",
"{",
"$",
"this",
"->",
"createObject",
"(",
")",
";",
"$",
"list",
"=",
"array_reverse",
"(",
"$",
"this",
"->",
"files",
")",
";",
"foreach",
"(",
"$",
"list",
"as",
"$",
"files",
")",
"{",
"foreach",... | Load and join all configuration files.
@return bool
@internal | [
"Load",
"and",
"join",
"all",
"configuration",
"files",
"."
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Config/CompiledBase.php#L170-L184 | train | Load files from the files list | [
30522,
5123,
3853,
7170,
8873,
4244,
1006,
1007,
1063,
1002,
2023,
1011,
1028,
3443,
16429,
20614,
1006,
1007,
1025,
1002,
2862,
1027,
9140,
1035,
7901,
1006,
1002,
2023,
1011,
1028,
6764,
1007,
1025,
18921,
6776,
1006,
1002,
2862,
2004,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Support/Facades/Storage.php | Storage.fake | public static function fake($disk = null)
{
$disk = $disk ?: self::$app['config']->get('filesystems.default');
(new Filesystem)->cleanDirectory(
$root = storage_path('framework/testing/disks/'.$disk)
);
static::set($disk, $fake = self::createLocalDriver(['root' => $root]));
return $fake;
} | php | public static function fake($disk = null)
{
$disk = $disk ?: self::$app['config']->get('filesystems.default');
(new Filesystem)->cleanDirectory(
$root = storage_path('framework/testing/disks/'.$disk)
);
static::set($disk, $fake = self::createLocalDriver(['root' => $root]));
return $fake;
} | [
"public",
"static",
"function",
"fake",
"(",
"$",
"disk",
"=",
"null",
")",
"{",
"$",
"disk",
"=",
"$",
"disk",
"?",
":",
"self",
"::",
"$",
"app",
"[",
"'config'",
"]",
"->",
"get",
"(",
"'filesystems.default'",
")",
";",
"(",
"new",
"Filesystem",
... | Replace the given disk with a local testing disk.
@param string|null $disk
@return \Illuminate\Filesystem\Filesystem | [
"Replace",
"the",
"given",
"disk",
"with",
"a",
"local",
"testing",
"disk",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Support/Facades/Storage.php#L21-L32 | train | Create a fake disk | [
30522,
2270,
10763,
3853,
8275,
1006,
1002,
9785,
1027,
19701,
1007,
1063,
1002,
9785,
1027,
1002,
9785,
1029,
1024,
2969,
1024,
1024,
1002,
10439,
1031,
1005,
9530,
8873,
2290,
1005,
1033,
1011,
1028,
2131,
1006,
1005,
6764,
27268,
6633,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.orWhereDate | public function orWhereDate($column, $operator, $value = null)
{
[$value, $operator] = $this->prepareValueAndOperator(
$value, $operator, func_num_args() === 2
);
return $this->whereDate($column, $operator, $value, 'or');
} | php | public function orWhereDate($column, $operator, $value = null)
{
[$value, $operator] = $this->prepareValueAndOperator(
$value, $operator, func_num_args() === 2
);
return $this->whereDate($column, $operator, $value, 'or');
} | [
"public",
"function",
"orWhereDate",
"(",
"$",
"column",
",",
"$",
"operator",
",",
"$",
"value",
"=",
"null",
")",
"{",
"[",
"$",
"value",
",",
"$",
"operator",
"]",
"=",
"$",
"this",
"->",
"prepareValueAndOperator",
"(",
"$",
"value",
",",
"$",
"op... | Add an "or where date" statement to the query.
@param string $column
@param string $operator
@param \DateTimeInterface|string $value
@return \Illuminate\Database\Query\Builder|static | [
"Add",
"an",
"or",
"where",
"date",
"statement",
"to",
"the",
"query",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Query/Builder.php#L1134-L1141 | train | Add a or where date statement to the query. | [
30522,
2270,
3853,
2030,
2860,
27190,
3686,
1006,
1002,
5930,
1010,
1002,
6872,
1010,
1002,
3643,
1027,
19701,
1007,
1063,
1031,
1002,
3643,
1010,
1002,
6872,
1033,
1027,
1002,
2023,
1011,
1028,
7374,
10175,
5657,
28574,
4842,
8844,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Foundation/AliasLoader.php | AliasLoader.formatFacadeStub | protected function formatFacadeStub($alias, $stub)
{
$replacements = [
str_replace('/', '\\', dirname(str_replace('\\', '/', $alias))),
class_basename($alias),
substr($alias, strlen(static::$facadeNamespace)),
];
return str_replace(
['DummyNamespace', 'DummyClass', 'DummyTarget'], $replacements, $stub
);
} | php | protected function formatFacadeStub($alias, $stub)
{
$replacements = [
str_replace('/', '\\', dirname(str_replace('\\', '/', $alias))),
class_basename($alias),
substr($alias, strlen(static::$facadeNamespace)),
];
return str_replace(
['DummyNamespace', 'DummyClass', 'DummyTarget'], $replacements, $stub
);
} | [
"protected",
"function",
"formatFacadeStub",
"(",
"$",
"alias",
",",
"$",
"stub",
")",
"{",
"$",
"replacements",
"=",
"[",
"str_replace",
"(",
"'/'",
",",
"'\\\\'",
",",
"dirname",
"(",
"str_replace",
"(",
"'\\\\'",
",",
"'/'",
",",
"$",
"alias",
")",
... | Format the facade stub with the proper namespace and class.
@param string $alias
@param string $stub
@return string | [
"Format",
"the",
"facade",
"stub",
"with",
"the",
"proper",
"namespace",
"and",
"class",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Foundation/AliasLoader.php#L121-L132 | train | Format the facade stub | [
30522,
5123,
3853,
4289,
7011,
21869,
3367,
12083,
1006,
1002,
14593,
1010,
1002,
24646,
2497,
1007,
1063,
1002,
23936,
1027,
1031,
2358,
2099,
1035,
5672,
1006,
1005,
1013,
1005,
1010,
1005,
1032,
1032,
1005,
1010,
16101,
18442,
1006,
2358... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getgrav/grav | system/src/Grav/Common/Grav.php | Grav.setLocale | public function setLocale()
{
// Initialize Locale if set and configured.
if ($this['language']->enabled() && $this['config']->get('system.languages.override_locale')) {
$language = $this['language']->getLanguage();
setlocale(LC_ALL, \strlen($language) < 3 ? ($language . '_' . strtoupper($language)) : $language);
} elseif ($this['config']->get('system.default_locale')) {
setlocale(LC_ALL, $this['config']->get('system.default_locale'));
}
} | php | public function setLocale()
{
// Initialize Locale if set and configured.
if ($this['language']->enabled() && $this['config']->get('system.languages.override_locale')) {
$language = $this['language']->getLanguage();
setlocale(LC_ALL, \strlen($language) < 3 ? ($language . '_' . strtoupper($language)) : $language);
} elseif ($this['config']->get('system.default_locale')) {
setlocale(LC_ALL, $this['config']->get('system.default_locale'));
}
} | [
"public",
"function",
"setLocale",
"(",
")",
"{",
"// Initialize Locale if set and configured.",
"if",
"(",
"$",
"this",
"[",
"'language'",
"]",
"->",
"enabled",
"(",
")",
"&&",
"$",
"this",
"[",
"'config'",
"]",
"->",
"get",
"(",
"'system.languages.override_loc... | Set the system locale based on the language and configuration | [
"Set",
"the",
"system",
"locale",
"based",
"on",
"the",
"language",
"and",
"configuration"
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Grav.php#L262-L271 | train | Set Locale if language and default locale are set | [
30522,
2270,
3853,
2275,
4135,
9289,
2063,
1006,
1007,
1063,
1013,
1013,
3988,
30524,
1006,
1005,
2291,
1012,
4155,
1012,
2058,
15637,
1035,
2334,
2063,
1005,
1007,
1007,
1063,
1002,
2653,
1027,
1002,
2023,
1031,
1005,
2653,
1005,
1033,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/Columns/Dimension.php | Dimension.getModule | public function getModule()
{
$id = $this->getId();
if (empty($id)) {
throw new Exception("Invalid dimension ID: '$id'.");
}
$parts = explode('.', $id);
return reset($parts);
} | php | public function getModule()
{
$id = $this->getId();
if (empty($id)) {
throw new Exception("Invalid dimension ID: '$id'.");
}
$parts = explode('.', $id);
return reset($parts);
} | [
"public",
"function",
"getModule",
"(",
")",
"{",
"$",
"id",
"=",
"$",
"this",
"->",
"getId",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"id",
")",
")",
"{",
"throw",
"new",
"Exception",
"(",
"\"Invalid dimension ID: '$id'.\"",
")",
";",
"}",
"$",
... | Returns the name of the plugin that contains this Dimension.
@return string
@throws Exception if the Dimension is not located within a Plugin module.
@api | [
"Returns",
"the",
"name",
"of",
"the",
"plugin",
"that",
"contains",
"this",
"Dimension",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Columns/Dimension.php#L840-L849 | train | Get module. | [
30522,
2270,
3853,
2131,
5302,
8566,
2571,
1006,
1007,
1063,
1002,
8909,
1027,
1002,
2023,
1011,
1028,
2131,
3593,
1006,
1007,
1025,
2065,
1006,
4064,
1006,
1002,
8909,
1007,
1007,
1063,
5466,
2047,
6453,
1006,
1000,
19528,
9812,
8909,
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/Yaml/Unescaper.php | Unescaper.unescapeCharacter | private function unescapeCharacter(string $value): string
{
switch ($value[1]) {
case '0':
return "\x0";
case 'a':
return "\x7";
case 'b':
return "\x8";
case 't':
return "\t";
case "\t":
return "\t";
case 'n':
return "\n";
case 'v':
return "\xB";
case 'f':
return "\xC";
case 'r':
return "\r";
case 'e':
return "\x1B";
case ' ':
return ' ';
case '"':
return '"';
case '/':
return '/';
case '\\':
return '\\';
case 'N':
// U+0085 NEXT LINE
return "\xC2\x85";
case '_':
// U+00A0 NO-BREAK SPACE
return "\xC2\xA0";
case 'L':
// U+2028 LINE SEPARATOR
return "\xE2\x80\xA8";
case 'P':
// U+2029 PARAGRAPH SEPARATOR
return "\xE2\x80\xA9";
case 'x':
return self::utf8chr(hexdec(substr($value, 2, 2)));
case 'u':
return self::utf8chr(hexdec(substr($value, 2, 4)));
case 'U':
return self::utf8chr(hexdec(substr($value, 2, 8)));
default:
throw new ParseException(sprintf('Found unknown escape character "%s".', $value));
}
} | php | private function unescapeCharacter(string $value): string
{
switch ($value[1]) {
case '0':
return "\x0";
case 'a':
return "\x7";
case 'b':
return "\x8";
case 't':
return "\t";
case "\t":
return "\t";
case 'n':
return "\n";
case 'v':
return "\xB";
case 'f':
return "\xC";
case 'r':
return "\r";
case 'e':
return "\x1B";
case ' ':
return ' ';
case '"':
return '"';
case '/':
return '/';
case '\\':
return '\\';
case 'N':
// U+0085 NEXT LINE
return "\xC2\x85";
case '_':
// U+00A0 NO-BREAK SPACE
return "\xC2\xA0";
case 'L':
// U+2028 LINE SEPARATOR
return "\xE2\x80\xA8";
case 'P':
// U+2029 PARAGRAPH SEPARATOR
return "\xE2\x80\xA9";
case 'x':
return self::utf8chr(hexdec(substr($value, 2, 2)));
case 'u':
return self::utf8chr(hexdec(substr($value, 2, 4)));
case 'U':
return self::utf8chr(hexdec(substr($value, 2, 8)));
default:
throw new ParseException(sprintf('Found unknown escape character "%s".', $value));
}
} | [
"private",
"function",
"unescapeCharacter",
"(",
"string",
"$",
"value",
")",
":",
"string",
"{",
"switch",
"(",
"$",
"value",
"[",
"1",
"]",
")",
"{",
"case",
"'0'",
":",
"return",
"\"\\x0\"",
";",
"case",
"'a'",
":",
"return",
"\"\\x7\"",
";",
"case"... | Unescapes a character that was found in a double-quoted string.
@param string $value An escaped character
@return string The unescaped character | [
"Unescapes",
"a",
"character",
"that",
"was",
"found",
"in",
"a",
"double",
"-",
"quoted",
"string",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Yaml/Unescaper.php#L67-L119 | train | Unescapes a character | [
30522,
2797,
3853,
16655,
15782,
5051,
7507,
22648,
3334,
1006,
5164,
1002,
3643,
1007,
1024,
5164,
1063,
6942,
1006,
1002,
3643,
1031,
1015,
1033,
1007,
1063,
2553,
1005,
1014,
1005,
1024,
2709,
1000,
1032,
1060,
2692,
1000,
1025,
2553,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/DataAccess/Model.php | Model.getArchiveIdsForDeletedSites | public function getArchiveIdsForDeletedSites($archiveTableName, $oldestToKeep)
{
$sql = "SELECT DISTINCT idarchive FROM " . $archiveTableName . " a "
. " LEFT JOIN " . Common::prefixTable('site') . " s USING (idsite)"
. " WHERE s.idsite IS NULL"
. " AND ts_archived < ?";
$rows = Db::fetchAll($sql, array($oldestToKeep));
return array_column($rows, 'idarchive');
} | php | public function getArchiveIdsForDeletedSites($archiveTableName, $oldestToKeep)
{
$sql = "SELECT DISTINCT idarchive FROM " . $archiveTableName . " a "
. " LEFT JOIN " . Common::prefixTable('site') . " s USING (idsite)"
. " WHERE s.idsite IS NULL"
. " AND ts_archived < ?";
$rows = Db::fetchAll($sql, array($oldestToKeep));
return array_column($rows, 'idarchive');
} | [
"public",
"function",
"getArchiveIdsForDeletedSites",
"(",
"$",
"archiveTableName",
",",
"$",
"oldestToKeep",
")",
"{",
"$",
"sql",
"=",
"\"SELECT DISTINCT idarchive FROM \"",
".",
"$",
"archiveTableName",
".",
"\" a \"",
".",
"\" LEFT JOIN \"",
".",
"Common",
"::",
... | Get a list of IDs of archives that don't have any matching rows in the site table. Excludes temporary archives
that may still be in use, as specified by the $oldestToKeep passed in.
@param string $archiveTableName
@param string $oldestToKeep Datetime string
@return array of IDs | [
"Get",
"a",
"list",
"of",
"IDs",
"of",
"archives",
"that",
"don",
"t",
"have",
"any",
"matching",
"rows",
"in",
"the",
"site",
"table",
".",
"Excludes",
"temporary",
"archives",
"that",
"may",
"still",
"be",
"in",
"use",
"as",
"specified",
"by",
"the",
... | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/DataAccess/Model.php#L343-L353 | train | Get archive ids for deleted sites | [
30522,
2270,
3853,
2131,
2906,
5428,
3726,
9821,
3877,
12260,
3064,
28032,
2229,
1006,
1002,
8756,
10880,
18442,
1010,
1002,
4587,
18715,
4402,
2361,
1007,
1063,
1002,
29296,
1027,
1000,
7276,
5664,
16096,
11140,
3512,
2013,
1000,
1012,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Console/Helper/Table.php | Table.fillCells | private function fillCells($row)
{
$newRow = [];
foreach ($row as $column => $cell) {
$newRow[] = $cell;
if ($cell instanceof TableCell && $cell->getColspan() > 1) {
foreach (range($column + 1, $column + $cell->getColspan() - 1) as $position) {
// insert empty value at column position
$newRow[] = '';
}
}
}
return $newRow ?: $row;
} | php | private function fillCells($row)
{
$newRow = [];
foreach ($row as $column => $cell) {
$newRow[] = $cell;
if ($cell instanceof TableCell && $cell->getColspan() > 1) {
foreach (range($column + 1, $column + $cell->getColspan() - 1) as $position) {
// insert empty value at column position
$newRow[] = '';
}
}
}
return $newRow ?: $row;
} | [
"private",
"function",
"fillCells",
"(",
"$",
"row",
")",
"{",
"$",
"newRow",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"row",
"as",
"$",
"column",
"=>",
"$",
"cell",
")",
"{",
"$",
"newRow",
"[",
"]",
"=",
"$",
"cell",
";",
"if",
"(",
"$",
"c... | fill cells for a row that contains colspan > 1. | [
"fill",
"cells",
"for",
"a",
"row",
"that",
"contains",
"colspan",
">",
"1",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Console/Helper/Table.php#L635-L649 | train | Fill cells in row | [
30522,
2797,
3853,
6039,
29109,
4877,
1006,
1002,
5216,
1007,
1063,
1002,
2047,
10524,
1027,
1031,
1033,
1025,
18921,
6776,
1006,
1002,
5216,
2004,
1002,
5930,
1027,
1028,
1002,
3526,
1007,
1063,
1002,
2047,
10524,
1031,
1033,
1027,
1002,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Config/Definition/Builder/NodeDefinition.php | NodeDefinition.merge | protected function merge()
{
if (null === $this->merge) {
$this->merge = new MergeBuilder($this);
}
return $this->merge;
} | php | protected function merge()
{
if (null === $this->merge) {
$this->merge = new MergeBuilder($this);
}
return $this->merge;
} | [
"protected",
"function",
"merge",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"merge",
")",
"{",
"$",
"this",
"->",
"merge",
"=",
"new",
"MergeBuilder",
"(",
"$",
"this",
")",
";",
"}",
"return",
"$",
"this",
"->",
"merge",
";",
"... | Gets the builder for merging rules.
@return MergeBuilder | [
"Gets",
"the",
"builder",
"for",
"merging",
"rules",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Config/Definition/Builder/NodeDefinition.php#L320-L327 | train | Get merge builder | [
30522,
5123,
3853,
13590,
1006,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
1027,
1002,
2023,
1011,
1028,
13590,
1007,
1063,
1002,
2023,
1011,
1028,
13590,
1027,
2047,
13590,
8569,
23891,
2099,
1006,
1002,
2023,
1007,
1025,
1065,
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... |
z-song/laravel-admin | src/Form.php | Form.pushField | public function pushField(Field $field)
{
$field->setForm($this);
$this->builder->fields()->push($field);
return $this;
} | php | public function pushField(Field $field)
{
$field->setForm($this);
$this->builder->fields()->push($field);
return $this;
} | [
"public",
"function",
"pushField",
"(",
"Field",
"$",
"field",
")",
"{",
"$",
"field",
"->",
"setForm",
"(",
"$",
"this",
")",
";",
"$",
"this",
"->",
"builder",
"->",
"fields",
"(",
")",
"->",
"push",
"(",
"$",
"field",
")",
";",
"return",
"$",
... | @param Field $field
@return $this | [
"@param",
"Field",
"$field"
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Form.php#L222-L229 | train | Push a field onto the form s fields stack | [
30522,
2270,
3853,
5245,
3790,
1006,
2492,
1002,
2492,
1007,
1063,
1002,
2492,
1011,
1028,
2275,
14192,
1006,
1002,
2023,
1007,
1025,
1002,
2023,
1011,
1028,
12508,
1011,
1028,
4249,
1006,
1007,
1011,
1028,
5245,
1006,
1002,
2492,
1007,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/HttpClient/MockHttpClient.php | MockHttpClient.request | public function request(string $method, string $url, array $options = []): ResponseInterface
{
[$url, $options] = $this->prepareRequest($method, $url, $options, ['base_uri' => $this->baseUri], true);
$url = implode('', $url);
if (null === $this->responseFactory) {
$response = new MockResponse();
} elseif (\is_callable($this->responseFactory)) {
$response = ($this->responseFactory)($method, $url, $options);
} elseif (!$this->responseFactory->valid()) {
throw new TransportException('The response factory iterator passed to MockHttpClient is empty.');
} else {
$response = $this->responseFactory->current();
$this->responseFactory->next();
}
return MockResponse::fromRequest($method, $url, $options, $response);
} | php | public function request(string $method, string $url, array $options = []): ResponseInterface
{
[$url, $options] = $this->prepareRequest($method, $url, $options, ['base_uri' => $this->baseUri], true);
$url = implode('', $url);
if (null === $this->responseFactory) {
$response = new MockResponse();
} elseif (\is_callable($this->responseFactory)) {
$response = ($this->responseFactory)($method, $url, $options);
} elseif (!$this->responseFactory->valid()) {
throw new TransportException('The response factory iterator passed to MockHttpClient is empty.');
} else {
$response = $this->responseFactory->current();
$this->responseFactory->next();
}
return MockResponse::fromRequest($method, $url, $options, $response);
} | [
"public",
"function",
"request",
"(",
"string",
"$",
"method",
",",
"string",
"$",
"url",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
":",
"ResponseInterface",
"{",
"[",
"$",
"url",
",",
"$",
"options",
"]",
"=",
"$",
"this",
"->",
"prepareRequ... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpClient/MockHttpClient.php#L55-L72 | train | Makes a request to the mock server | [
30522,
2270,
3853,
5227,
1006,
5164,
1002,
4118,
1010,
5164,
1002,
24471,
2140,
1010,
9140,
1002,
7047,
1027,
1031,
1033,
1007,
1024,
3433,
18447,
2121,
12172,
1063,
1031,
1002,
24471,
2140,
1010,
1002,
7047,
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... |
symfony/symfony | src/Symfony/Component/Cache/DependencyInjection/CachePoolPrunerPass.php | CachePoolPrunerPass.process | public function process(ContainerBuilder $container)
{
if (!$container->hasDefinition($this->cacheCommandServiceId)) {
return;
}
$services = [];
foreach ($container->findTaggedServiceIds($this->cachePoolTag) as $id => $tags) {
$class = $container->getParameterBag()->resolveValue($container->getDefinition($id)->getClass());
if (!$reflection = $container->getReflectionClass($class)) {
throw new InvalidArgumentException(sprintf('Class "%s" used for service "%s" cannot be found.', $class, $id));
}
if ($reflection->implementsInterface(PruneableInterface::class)) {
$services[$id] = new Reference($id);
}
}
$container->getDefinition($this->cacheCommandServiceId)->replaceArgument(0, new IteratorArgument($services));
} | php | public function process(ContainerBuilder $container)
{
if (!$container->hasDefinition($this->cacheCommandServiceId)) {
return;
}
$services = [];
foreach ($container->findTaggedServiceIds($this->cachePoolTag) as $id => $tags) {
$class = $container->getParameterBag()->resolveValue($container->getDefinition($id)->getClass());
if (!$reflection = $container->getReflectionClass($class)) {
throw new InvalidArgumentException(sprintf('Class "%s" used for service "%s" cannot be found.', $class, $id));
}
if ($reflection->implementsInterface(PruneableInterface::class)) {
$services[$id] = new Reference($id);
}
}
$container->getDefinition($this->cacheCommandServiceId)->replaceArgument(0, new IteratorArgument($services));
} | [
"public",
"function",
"process",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"if",
"(",
"!",
"$",
"container",
"->",
"hasDefinition",
"(",
"$",
"this",
"->",
"cacheCommandServiceId",
")",
")",
"{",
"return",
";",
"}",
"$",
"services",
"=",
"[",
... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Cache/DependencyInjection/CachePoolPrunerPass.php#L38-L59 | train | Replace the iterator argument with a new iterator argument. | [
30522,
2270,
3853,
2832,
1006,
11661,
8569,
23891,
2099,
1002,
11661,
1007,
1063,
2065,
1006,
999,
1002,
11661,
1011,
1028,
2038,
3207,
16294,
22753,
1006,
1002,
2023,
1011,
1028,
17053,
9006,
2386,
5104,
2121,
7903,
7416,
2094,
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... |
octobercms/october | modules/backend/classes/FormField.php | FormField.hasAttribute | public function hasAttribute($name, $position = 'field')
{
if (!isset($this->attributes[$position])) {
return false;
}
return array_key_exists($name, $this->attributes[$position]);
} | php | public function hasAttribute($name, $position = 'field')
{
if (!isset($this->attributes[$position])) {
return false;
}
return array_key_exists($name, $this->attributes[$position]);
} | [
"public",
"function",
"hasAttribute",
"(",
"$",
"name",
",",
"$",
"position",
"=",
"'field'",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"attributes",
"[",
"$",
"position",
"]",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
... | Checks if the field has the supplied [unfiltered] attribute.
@param string $name
@param string $position
@return bool | [
"Checks",
"if",
"the",
"field",
"has",
"the",
"supplied",
"[",
"unfiltered",
"]",
"attribute",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/classes/FormField.php#L409-L416 | train | Has attribute? | [
30522,
2270,
3853,
2038,
19321,
3089,
8569,
2618,
1006,
1002,
2171,
1010,
1002,
2597,
1027,
1005,
2492,
1005,
1007,
1063,
2065,
1006,
999,
26354,
3388,
1006,
1002,
2023,
1011,
1028,
12332,
1031,
1002,
2597,
1033,
1007,
1007,
1063,
2709,
6... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
dompdf/dompdf | lib/Cpdf.php | Cpdf.ellipse | function ellipse(
$x0,
$y0,
$r1,
$r2 = 0,
$angle = 0,
$nSeg = 8,
$astart = 0,
$afinish = 360,
$close = true,
$fill = false,
$stroke = true,
$incomplete = false
) {
if ($r1 == 0) {
return;
}
if ($r2 == 0) {
$r2 = $r1;
}
if ($nSeg < 2) {
$nSeg = 2;
}
$astart = deg2rad((float)$astart);
$afinish = deg2rad((float)$afinish);
$totalAngle = $afinish - $astart;
$dt = $totalAngle / $nSeg;
$dtm = $dt / 3;
if ($angle != 0) {
$a = -1 * deg2rad((float)$angle);
$this->addContent(
sprintf("\n q %.3F %.3F %.3F %.3F %.3F %.3F cm", cos($a), -sin($a), sin($a), cos($a), $x0, $y0)
);
$x0 = 0;
$y0 = 0;
}
$t1 = $astart;
$a0 = $x0 + $r1 * cos($t1);
$b0 = $y0 + $r2 * sin($t1);
$c0 = -$r1 * sin($t1);
$d0 = $r2 * cos($t1);
if (!$incomplete) {
$this->addContent(sprintf("\n%.3F %.3F m ", $a0, $b0));
}
for ($i = 1; $i <= $nSeg; $i++) {
// draw this bit of the total curve
$t1 = $i * $dt + $astart;
$a1 = $x0 + $r1 * cos($t1);
$b1 = $y0 + $r2 * sin($t1);
$c1 = -$r1 * sin($t1);
$d1 = $r2 * cos($t1);
$this->addContent(
sprintf(
"\n%.3F %.3F %.3F %.3F %.3F %.3F c",
($a0 + $c0 * $dtm),
($b0 + $d0 * $dtm),
($a1 - $c1 * $dtm),
($b1 - $d1 * $dtm),
$a1,
$b1
)
);
$a0 = $a1;
$b0 = $b1;
$c0 = $c1;
$d0 = $d1;
}
if (!$incomplete) {
if ($fill) {
$this->addContent(' f');
}
if ($stroke) {
if ($close) {
$this->addContent(' s'); // small 's' signifies closing the path as well
} else {
$this->addContent(' S');
}
}
}
if ($angle != 0) {
$this->addContent(' Q');
}
} | php | function ellipse(
$x0,
$y0,
$r1,
$r2 = 0,
$angle = 0,
$nSeg = 8,
$astart = 0,
$afinish = 360,
$close = true,
$fill = false,
$stroke = true,
$incomplete = false
) {
if ($r1 == 0) {
return;
}
if ($r2 == 0) {
$r2 = $r1;
}
if ($nSeg < 2) {
$nSeg = 2;
}
$astart = deg2rad((float)$astart);
$afinish = deg2rad((float)$afinish);
$totalAngle = $afinish - $astart;
$dt = $totalAngle / $nSeg;
$dtm = $dt / 3;
if ($angle != 0) {
$a = -1 * deg2rad((float)$angle);
$this->addContent(
sprintf("\n q %.3F %.3F %.3F %.3F %.3F %.3F cm", cos($a), -sin($a), sin($a), cos($a), $x0, $y0)
);
$x0 = 0;
$y0 = 0;
}
$t1 = $astart;
$a0 = $x0 + $r1 * cos($t1);
$b0 = $y0 + $r2 * sin($t1);
$c0 = -$r1 * sin($t1);
$d0 = $r2 * cos($t1);
if (!$incomplete) {
$this->addContent(sprintf("\n%.3F %.3F m ", $a0, $b0));
}
for ($i = 1; $i <= $nSeg; $i++) {
// draw this bit of the total curve
$t1 = $i * $dt + $astart;
$a1 = $x0 + $r1 * cos($t1);
$b1 = $y0 + $r2 * sin($t1);
$c1 = -$r1 * sin($t1);
$d1 = $r2 * cos($t1);
$this->addContent(
sprintf(
"\n%.3F %.3F %.3F %.3F %.3F %.3F c",
($a0 + $c0 * $dtm),
($b0 + $d0 * $dtm),
($a1 - $c1 * $dtm),
($b1 - $d1 * $dtm),
$a1,
$b1
)
);
$a0 = $a1;
$b0 = $b1;
$c0 = $c1;
$d0 = $d1;
}
if (!$incomplete) {
if ($fill) {
$this->addContent(' f');
}
if ($stroke) {
if ($close) {
$this->addContent(' s'); // small 's' signifies closing the path as well
} else {
$this->addContent(' S');
}
}
}
if ($angle != 0) {
$this->addContent(' Q');
}
} | [
"function",
"ellipse",
"(",
"$",
"x0",
",",
"$",
"y0",
",",
"$",
"r1",
",",
"$",
"r2",
"=",
"0",
",",
"$",
"angle",
"=",
"0",
",",
"$",
"nSeg",
"=",
"8",
",",
"$",
"astart",
"=",
"0",
",",
"$",
"afinish",
"=",
"360",
",",
"$",
"close",
"=... | draw an ellipse
note that the part and filled ellipse are just special cases of this function
draws an ellipse in the current line style
centered at $x0,$y0, radii $r1,$r2
if $r2 is not set, then a circle is drawn
from $astart to $afinish, measured in degrees, running anti-clockwise from the right hand side of the ellipse.
nSeg is not allowed to be less than 2, as this will simply draw a line (and will even draw a
pretty crappy shape at 2, as we are approximating with bezier curves.
@param $x0
@param $y0
@param $r1
@param int $r2
@param int $angle
@param int $nSeg
@param int $astart
@param int $afinish
@param bool $close
@param bool $fill
@param bool $stroke
@param bool $incomplete | [
"draw",
"an",
"ellipse",
"note",
"that",
"the",
"part",
"and",
"filled",
"ellipse",
"are",
"just",
"special",
"cases",
"of",
"this",
"function"
] | 75f13c700009be21a1965dc2c5b68a8708c22ba2 | https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/lib/Cpdf.php#L3386-L3483 | train | Draw the ellipse | [
30522,
3853,
3449,
15000,
3366,
1006,
1002,
1060,
2692,
1010,
1002,
1061,
2692,
1010,
1002,
1054,
2487,
1010,
1002,
1054,
2475,
1027,
1014,
1010,
1002,
6466,
1027,
1014,
1010,
1002,
24978,
13910,
1027,
1022,
1010,
1002,
2004,
7559,
2102,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/UserCountry/Reports/Base.php | Base.checkIfNoDataForGeoIpReport | protected function checkIfNoDataForGeoIpReport(ViewDataTable $view)
{
$view->config->filters[] = function ($dataTable) use ($view) {
// if there's only one row whose label is 'Unknown', display a message saying there's no data
if ($dataTable->getRowsCount() == 1
&& $dataTable->getFirstRow()->getColumn('label') == Piwik::translate('General_Unknown')
) {
$footerMessage = Piwik::translate('UserCountry_NoDataForGeoIPReport1');
$userCountry = new UserCountry();
// if GeoIP is working, don't display this part of the message
if (!$userCountry->isGeoIPWorking()) {
$params = array('module' => 'UserCountry', 'action' => 'adminIndex');
$footerMessage .= ' ' . Piwik::translate('UserCountry_NoDataForGeoIPReport2',
array('<a target="_blank" href="' . Url::getCurrentQueryStringWithParametersModified($params) . '">',
'</a>',
'<a rel="noreferrer noopener" target="_blank" href="http://dev.maxmind.com/geoip/geolite?rId=piwik">',
'</a>'));
} else {
$footerMessage .= ' ' . Piwik::translate('UserCountry_ToGeolocateOldVisits',
array('<a rel="noreferrer noopener" target="_blank" href="https://matomo.org/faq/how-to/#faq_167">', '</a>'));
}
$view->config->show_footer_message = $footerMessage;
}
};
} | php | protected function checkIfNoDataForGeoIpReport(ViewDataTable $view)
{
$view->config->filters[] = function ($dataTable) use ($view) {
// if there's only one row whose label is 'Unknown', display a message saying there's no data
if ($dataTable->getRowsCount() == 1
&& $dataTable->getFirstRow()->getColumn('label') == Piwik::translate('General_Unknown')
) {
$footerMessage = Piwik::translate('UserCountry_NoDataForGeoIPReport1');
$userCountry = new UserCountry();
// if GeoIP is working, don't display this part of the message
if (!$userCountry->isGeoIPWorking()) {
$params = array('module' => 'UserCountry', 'action' => 'adminIndex');
$footerMessage .= ' ' . Piwik::translate('UserCountry_NoDataForGeoIPReport2',
array('<a target="_blank" href="' . Url::getCurrentQueryStringWithParametersModified($params) . '">',
'</a>',
'<a rel="noreferrer noopener" target="_blank" href="http://dev.maxmind.com/geoip/geolite?rId=piwik">',
'</a>'));
} else {
$footerMessage .= ' ' . Piwik::translate('UserCountry_ToGeolocateOldVisits',
array('<a rel="noreferrer noopener" target="_blank" href="https://matomo.org/faq/how-to/#faq_167">', '</a>'));
}
$view->config->show_footer_message = $footerMessage;
}
};
} | [
"protected",
"function",
"checkIfNoDataForGeoIpReport",
"(",
"ViewDataTable",
"$",
"view",
")",
"{",
"$",
"view",
"->",
"config",
"->",
"filters",
"[",
"]",
"=",
"function",
"(",
"$",
"dataTable",
")",
"use",
"(",
"$",
"view",
")",
"{",
"// if there's only o... | Checks if a datatable for a view is empty and if so, displays a message in the footer
telling users to configure GeoIP. | [
"Checks",
"if",
"a",
"datatable",
"for",
"a",
"view",
"is",
"empty",
"and",
"if",
"so",
"displays",
"a",
"message",
"in",
"the",
"footer",
"telling",
"users",
"to",
"configure",
"GeoIP",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/UserCountry/Reports/Base.php#L37-L63 | train | Check if there s no data for GeoIP | [
30522,
5123,
3853,
4638,
10128,
3630,
2850,
2696,
29278,
3351,
10448,
28139,
6442,
1006,
3193,
2850,
29336,
3085,
1002,
3193,
1007,
1063,
1002,
3193,
1011,
1028,
9530,
8873,
2290,
1011,
1028,
17736,
1031,
1033,
1027,
3853,
1006,
1002,
2951,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/FlexCollection.php | FlexCollection.render | public function render(string $layout = null, array $context = [])
{
if (null === $layout) {
$layout = 'default';
}
$type = $this->getFlexType();
$grav = Grav::instance();
/** @var Debugger $debugger */
$debugger = $grav['debugger'];
$debugger->startTimer('flex-collection-' . ($debugKey = uniqid($type, false)), 'Render Collection ' . $type . ' (' . $layout . ')');
$cache = $key = null;
foreach ($context as $value) {
if (!\is_scalar($value)) {
$key = false;
}
}
if ($key !== false) {
$key = md5($this->getCacheKey() . '.' . $layout . json_encode($context));
$cache = $this->getCache('render');
}
try {
$data = $cache ? $cache->get($key) : null;
$block = $data ? HtmlBlock::fromArray($data) : null;
} catch (InvalidArgumentException $e) {
$debugger->addException($e);
$block = null;
} catch (\InvalidArgumentException $e) {
$debugger->addException($e);
$block = null;
}
$checksum = $this->getCacheChecksum();
if ($block && $checksum !== $block->getChecksum()) {
$block = null;
}
if (!$block) {
$block = HtmlBlock::create($key);
$block->setChecksum($checksum);
if ($key === false) {
$block->disableCache();
}
$grav->fireEvent('onFlexCollectionRender', new Event([
'collection' => $this,
'layout' => &$layout,
'context' => &$context
]));
$output = $this->getTemplate($layout)->render(
['grav' => $grav, 'config' => $grav['config'], 'block' => $block, 'collection' => $this, 'layout' => $layout] + $context
);
if ($debugger->enabled()) {
$output = "\n<!–– START {$type} collection ––>\n{$output}\n<!–– END {$type} collection ––>\n";
}
$block->setContent($output);
try {
$cache && $block->isCached() && $cache->set($key, $block->toArray());
} catch (InvalidArgumentException $e) {
$debugger->addException($e);
}
}
$debugger->stopTimer('flex-collection-' . $debugKey);
return $block;
} | php | public function render(string $layout = null, array $context = [])
{
if (null === $layout) {
$layout = 'default';
}
$type = $this->getFlexType();
$grav = Grav::instance();
/** @var Debugger $debugger */
$debugger = $grav['debugger'];
$debugger->startTimer('flex-collection-' . ($debugKey = uniqid($type, false)), 'Render Collection ' . $type . ' (' . $layout . ')');
$cache = $key = null;
foreach ($context as $value) {
if (!\is_scalar($value)) {
$key = false;
}
}
if ($key !== false) {
$key = md5($this->getCacheKey() . '.' . $layout . json_encode($context));
$cache = $this->getCache('render');
}
try {
$data = $cache ? $cache->get($key) : null;
$block = $data ? HtmlBlock::fromArray($data) : null;
} catch (InvalidArgumentException $e) {
$debugger->addException($e);
$block = null;
} catch (\InvalidArgumentException $e) {
$debugger->addException($e);
$block = null;
}
$checksum = $this->getCacheChecksum();
if ($block && $checksum !== $block->getChecksum()) {
$block = null;
}
if (!$block) {
$block = HtmlBlock::create($key);
$block->setChecksum($checksum);
if ($key === false) {
$block->disableCache();
}
$grav->fireEvent('onFlexCollectionRender', new Event([
'collection' => $this,
'layout' => &$layout,
'context' => &$context
]));
$output = $this->getTemplate($layout)->render(
['grav' => $grav, 'config' => $grav['config'], 'block' => $block, 'collection' => $this, 'layout' => $layout] + $context
);
if ($debugger->enabled()) {
$output = "\n<!–– START {$type} collection ––>\n{$output}\n<!–– END {$type} collection ––>\n";
}
$block->setContent($output);
try {
$cache && $block->isCached() && $cache->set($key, $block->toArray());
} catch (InvalidArgumentException $e) {
$debugger->addException($e);
}
}
$debugger->stopTimer('flex-collection-' . $debugKey);
return $block;
} | [
"public",
"function",
"render",
"(",
"string",
"$",
"layout",
"=",
"null",
",",
"array",
"$",
"context",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"layout",
")",
"{",
"$",
"layout",
"=",
"'default'",
";",
"}",
"$",
"type",
"=",
"$",... | {@inheritdoc}
@see FlexCollectionInterface::render() | [
"{"
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Framework/Flex/FlexCollection.php#L264-L339 | train | Render the collection | [
30522,
2270,
3853,
17552,
1006,
5164,
1002,
9621,
1027,
19701,
1010,
9140,
1002,
6123,
1027,
1031,
1033,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
1027,
1002,
9621,
1007,
1063,
1002,
9621,
1027,
1005,
12398,
1005,
1025,
1065,
1002,
2828,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/backend/widgets/MediaManager.php | MediaManager.findFiles | protected function findFiles($searchTerm, $filter, $sortBy)
{
$filter = $filter !== self::FILTER_EVERYTHING ? $filter : null;
return MediaLibrary::instance()->findFiles($searchTerm, $sortBy, $filter);
} | php | protected function findFiles($searchTerm, $filter, $sortBy)
{
$filter = $filter !== self::FILTER_EVERYTHING ? $filter : null;
return MediaLibrary::instance()->findFiles($searchTerm, $sortBy, $filter);
} | [
"protected",
"function",
"findFiles",
"(",
"$",
"searchTerm",
",",
"$",
"filter",
",",
"$",
"sortBy",
")",
"{",
"$",
"filter",
"=",
"$",
"filter",
"!==",
"self",
"::",
"FILTER_EVERYTHING",
"?",
"$",
"filter",
":",
"null",
";",
"return",
"MediaLibrary",
"... | Finds files from within the media library based on supplied criteria,
returns an array of MediaLibraryItem objects.
@param string $searchTerm
@param string $filter
@param string $sortBy
@param array[System\Classes\MediaLibraryItem] | [
"Finds",
"files",
"from",
"within",
"the",
"media",
"library",
"based",
"on",
"supplied",
"criteria",
"returns",
"an",
"array",
"of",
"MediaLibraryItem",
"objects",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/MediaManager.php#L870-L875 | train | Find files in the library | [
30522,
5123,
3853,
2424,
8873,
4244,
1006,
1002,
3945,
3334,
2213,
1010,
1002,
11307,
1010,
1002,
4066,
3762,
1007,
1063,
1002,
11307,
1027,
1002,
11307,
999,
1027,
1027,
2969,
1024,
1024,
11307,
1035,
2673,
1029,
1002,
11307,
1024,
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... |
getgrav/grav | system/src/Grav/Common/Page/Page.php | Page.currentPosition | public function currentPosition()
{
$parent = $this->parent();
$collection = $parent ? $parent->collection('content', false) : null;
if ($collection instanceof Collection) {
return $collection->currentPosition($this->path());
}
return 1;
} | php | public function currentPosition()
{
$parent = $this->parent();
$collection = $parent ? $parent->collection('content', false) : null;
if ($collection instanceof Collection) {
return $collection->currentPosition($this->path());
}
return 1;
} | [
"public",
"function",
"currentPosition",
"(",
")",
"{",
"$",
"parent",
"=",
"$",
"this",
"->",
"parent",
"(",
")",
";",
"$",
"collection",
"=",
"$",
"parent",
"?",
"$",
"parent",
"->",
"collection",
"(",
"'content'",
",",
"false",
")",
":",
"null",
"... | Returns the item in the current position.
@return int the index of the current page. | [
"Returns",
"the",
"item",
"in",
"the",
"current",
"position",
"."
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L2494-L2503 | train | Get the position of the current file | [
30522,
2270,
3853,
2783,
26994,
1006,
1007,
1063,
1002,
6687,
1027,
1002,
2023,
1011,
1028,
6687,
1006,
1007,
1025,
1002,
3074,
1027,
1002,
6687,
1029,
1002,
6687,
1011,
1028,
3074,
1006,
1005,
4180,
1005,
1010,
6270,
1007,
1024,
19701,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
dompdf/dompdf | src/Helpers.php | Helpers.dompdf_debug | public static function dompdf_debug($type, $msg)
{
global $_DOMPDF_DEBUG_TYPES, $_dompdf_show_warnings, $_dompdf_debug;
if (isset($_DOMPDF_DEBUG_TYPES[$type]) && ($_dompdf_show_warnings || $_dompdf_debug)) {
$arr = debug_backtrace();
echo basename($arr[0]["file"]) . " (" . $arr[0]["line"] . "): " . $arr[1]["function"] . ": ";
Helpers::pre_r($msg);
}
} | php | public static function dompdf_debug($type, $msg)
{
global $_DOMPDF_DEBUG_TYPES, $_dompdf_show_warnings, $_dompdf_debug;
if (isset($_DOMPDF_DEBUG_TYPES[$type]) && ($_dompdf_show_warnings || $_dompdf_debug)) {
$arr = debug_backtrace();
echo basename($arr[0]["file"]) . " (" . $arr[0]["line"] . "): " . $arr[1]["function"] . ": ";
Helpers::pre_r($msg);
}
} | [
"public",
"static",
"function",
"dompdf_debug",
"(",
"$",
"type",
",",
"$",
"msg",
")",
"{",
"global",
"$",
"_DOMPDF_DEBUG_TYPES",
",",
"$",
"_dompdf_show_warnings",
",",
"$",
"_dompdf_debug",
";",
"if",
"(",
"isset",
"(",
"$",
"_DOMPDF_DEBUG_TYPES",
"[",
"$... | Print debug messages
@param string $type The type of debug messages to print
@param string $msg The message to show | [
"Print",
"debug",
"messages"
] | 75f13c700009be21a1965dc2c5b68a8708c22ba2 | https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/src/Helpers.php#L477-L486 | train | Debug function for the dompdf page | [
30522,
2270,
10763,
3853,
14383,
17299,
2546,
1035,
2139,
8569,
2290,
1006,
1002,
2828,
1010,
1002,
5796,
2290,
1007,
1063,
3795,
1002,
1035,
14383,
17299,
2546,
1035,
2139,
8569,
2290,
1035,
4127,
1010,
1002,
1035,
14383,
17299,
2546,
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... |
z-song/laravel-admin | src/Form/Field/Select.php | Select.loadRemoteOptions | protected function loadRemoteOptions($url, $parameters = [], $options = [])
{
$ajaxOptions = [
'url' => $url.'?'.http_build_query($parameters),
];
$configs = array_merge([
'allowClear' => true,
'placeholder' => [
'id' => '',
'text' => trans('admin.choose'),
],
], $this->config);
$configs = json_encode($configs);
$configs = substr($configs, 1, strlen($configs) - 2);
$ajaxOptions = json_encode(array_merge($ajaxOptions, $options));
$this->script = <<<EOT
$.ajax($ajaxOptions).done(function(data) {
var select = $("{$this->getElementClassSelector()}");
select.select2({
data: data,
$configs
});
var value = select.data('value') + '';
if (value) {
value = value.split(',');
select.select2('val', value);
}
});
EOT;
return $this;
} | php | protected function loadRemoteOptions($url, $parameters = [], $options = [])
{
$ajaxOptions = [
'url' => $url.'?'.http_build_query($parameters),
];
$configs = array_merge([
'allowClear' => true,
'placeholder' => [
'id' => '',
'text' => trans('admin.choose'),
],
], $this->config);
$configs = json_encode($configs);
$configs = substr($configs, 1, strlen($configs) - 2);
$ajaxOptions = json_encode(array_merge($ajaxOptions, $options));
$this->script = <<<EOT
$.ajax($ajaxOptions).done(function(data) {
var select = $("{$this->getElementClassSelector()}");
select.select2({
data: data,
$configs
});
var value = select.data('value') + '';
if (value) {
value = value.split(',');
select.select2('val', value);
}
});
EOT;
return $this;
} | [
"protected",
"function",
"loadRemoteOptions",
"(",
"$",
"url",
",",
"$",
"parameters",
"=",
"[",
"]",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"ajaxOptions",
"=",
"[",
"'url'",
"=>",
"$",
"url",
".",
"'?'",
".",
"http_build_query",
"(",
"$"... | Load options from remote.
@param string $url
@param array $parameters
@param array $options
@return $this | [
"Load",
"options",
"from",
"remote",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Form/Field/Select.php#L242-L282 | train | Load remote options | [
30522,
5123,
3853,
7170,
28578,
12184,
7361,
9285,
1006,
1002,
24471,
2140,
1010,
1002,
11709,
1027,
1031,
1033,
1010,
1002,
7047,
1027,
1031,
1033,
1007,
1063,
1002,
18176,
7361,
9285,
1027,
1031,
1005,
24471,
2140,
1005,
1027,
1028,
1002,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/backend/widgets/Lists.php | Lists.isSortable | protected function isSortable($column = null)
{
if ($column === null) {
return (count($this->getSortableColumns()) > 0);
}
return array_key_exists($column, $this->getSortableColumns());
} | php | protected function isSortable($column = null)
{
if ($column === null) {
return (count($this->getSortableColumns()) > 0);
}
return array_key_exists($column, $this->getSortableColumns());
} | [
"protected",
"function",
"isSortable",
"(",
"$",
"column",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"column",
"===",
"null",
")",
"{",
"return",
"(",
"count",
"(",
"$",
"this",
"->",
"getSortableColumns",
"(",
")",
")",
">",
"0",
")",
";",
"}",
"retu... | Returns true if the column can be sorted. | [
"Returns",
"true",
"if",
"the",
"column",
"can",
"be",
"sorted",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/Lists.php#L1541-L1548 | train | return true if the column is sortable | [
30522,
5123,
3853,
26354,
11589,
3085,
1006,
1002,
5930,
1027,
19701,
1007,
1063,
2065,
1006,
1002,
5930,
1027,
1027,
1027,
19701,
1007,
1063,
2709,
1006,
4175,
1006,
1002,
2023,
1011,
1028,
4152,
11589,
3085,
25778,
2819,
3619,
1006,
1007,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/VarDumper/Dumper/ServerDumper.php | ServerDumper.dump | public function dump(Data $data)
{
if (!$this->connection->write($data) && $this->wrappedDumper) {
$this->wrappedDumper->dump($data);
}
} | php | public function dump(Data $data)
{
if (!$this->connection->write($data) && $this->wrappedDumper) {
$this->wrappedDumper->dump($data);
}
} | [
"public",
"function",
"dump",
"(",
"Data",
"$",
"data",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"connection",
"->",
"write",
"(",
"$",
"data",
")",
"&&",
"$",
"this",
"->",
"wrappedDumper",
")",
"{",
"$",
"this",
"->",
"wrappedDumper",
"->",
"... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/VarDumper/Dumper/ServerDumper.php#L47-L52 | train | Dump data to the database | [
30522,
2270,
3853,
15653,
1006,
2951,
1002,
2951,
1007,
1063,
2065,
1006,
999,
1002,
2023,
1011,
1028,
4434,
1011,
1028,
4339,
1006,
1002,
2951,
1007,
1004,
1004,
1002,
2023,
1011,
1028,
5058,
8566,
8737,
2121,
1007,
1063,
1002,
2023,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Database/Migrations/Migrator.php | Migrator.resetMigrations | protected function resetMigrations(array $migrations, array $paths, $pretend = false)
{
// Since the getRan method that retrieves the migration name just gives us the
// migration name, we will format the names into objects with the name as a
// property on the objects so that we can pass it to the rollback method.
$migrations = collect($migrations)->map(function ($m) {
return (object) ['migration' => $m];
})->all();
return $this->rollbackMigrations(
$migrations, $paths, compact('pretend')
);
} | php | protected function resetMigrations(array $migrations, array $paths, $pretend = false)
{
// Since the getRan method that retrieves the migration name just gives us the
// migration name, we will format the names into objects with the name as a
// property on the objects so that we can pass it to the rollback method.
$migrations = collect($migrations)->map(function ($m) {
return (object) ['migration' => $m];
})->all();
return $this->rollbackMigrations(
$migrations, $paths, compact('pretend')
);
} | [
"protected",
"function",
"resetMigrations",
"(",
"array",
"$",
"migrations",
",",
"array",
"$",
"paths",
",",
"$",
"pretend",
"=",
"false",
")",
"{",
"// Since the getRan method that retrieves the migration name just gives us the",
"// migration name, we will format the names i... | Reset the given migrations.
@param array $migrations
@param array $paths
@param bool $pretend
@return array | [
"Reset",
"the",
"given",
"migrations",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Migrations/Migrator.php#L321-L333 | train | Reset the migrations | [
30522,
5123,
3853,
25141,
4328,
29397,
2015,
1006,
9140,
1002,
9230,
2015,
1010,
9140,
1002,
10425,
1010,
1002,
9811,
1027,
6270,
1007,
1063,
1013,
1013,
2144,
1996,
2131,
5521,
4118,
2008,
12850,
2015,
1996,
9230,
2171,
2074,
3957,
2149,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/system/traits/ViewMaker.php | ViewMaker.makeLayoutPartial | public function makeLayoutPartial($partial, $params = [])
{
if (!File::isLocalPath($partial) && !File::isPathSymbol($partial)) {
$folder = strpos($partial, '/') !== false ? dirname($partial) . '/' : '';
$partial = $folder . '_' . strtolower(basename($partial));
}
return $this->makeLayout($partial, $params);
} | php | public function makeLayoutPartial($partial, $params = [])
{
if (!File::isLocalPath($partial) && !File::isPathSymbol($partial)) {
$folder = strpos($partial, '/') !== false ? dirname($partial) . '/' : '';
$partial = $folder . '_' . strtolower(basename($partial));
}
return $this->makeLayout($partial, $params);
} | [
"public",
"function",
"makeLayoutPartial",
"(",
"$",
"partial",
",",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"File",
"::",
"isLocalPath",
"(",
"$",
"partial",
")",
"&&",
"!",
"File",
"::",
"isPathSymbol",
"(",
"$",
"partial",
")",
")"... | Renders a layout partial
@param string $partial The view to load.
@param array $params Parameter variables to pass to the view.
@return string The layout partial contents | [
"Renders",
"a",
"layout",
"partial"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/traits/ViewMaker.php#L165-L173 | train | This method is used to create layout partial | [
30522,
2270,
3853,
2191,
8485,
5833,
19362,
20925,
1006,
1002,
7704,
1010,
1002,
11498,
5244,
1027,
1031,
1033,
1007,
1063,
2065,
1006,
999,
5371,
1024,
1024,
2003,
4135,
9289,
15069,
1006,
1002,
7704,
1007,
1004,
1004,
999,
5371,
1024,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/Tracker/PageUrl.php | PageUrl.cleanupHostAndHashTag | protected static function cleanupHostAndHashTag($parsedUrl, $idSite = false)
{
if (empty($parsedUrl)) {
return $parsedUrl;
}
if (!empty($parsedUrl['host'])) {
$parsedUrl['host'] = Common::mb_strtolower($parsedUrl['host']);
}
if (!empty($parsedUrl['fragment'])) {
$parsedUrl['fragment'] = PageUrl::processUrlFragment($parsedUrl['fragment'], $idSite);
}
return $parsedUrl;
} | php | protected static function cleanupHostAndHashTag($parsedUrl, $idSite = false)
{
if (empty($parsedUrl)) {
return $parsedUrl;
}
if (!empty($parsedUrl['host'])) {
$parsedUrl['host'] = Common::mb_strtolower($parsedUrl['host']);
}
if (!empty($parsedUrl['fragment'])) {
$parsedUrl['fragment'] = PageUrl::processUrlFragment($parsedUrl['fragment'], $idSite);
}
return $parsedUrl;
} | [
"protected",
"static",
"function",
"cleanupHostAndHashTag",
"(",
"$",
"parsedUrl",
",",
"$",
"idSite",
"=",
"false",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"parsedUrl",
")",
")",
"{",
"return",
"$",
"parsedUrl",
";",
"}",
"if",
"(",
"!",
"empty",
"(",... | Will cleanup the hostname (some browser do not strolower the hostname),
and deal ith the hash tag on incoming URLs based on website setting.
@param $parsedUrl
@param $idSite int|bool The site ID of the current visit. This parameter is
only used by the tracker to see if we should remove
the URL fragment for this site.
@return array | [
"Will",
"cleanup",
"the",
"hostname",
"(",
"some",
"browser",
"do",
"not",
"strolower",
"the",
"hostname",
")",
"and",
"deal",
"ith",
"the",
"hash",
"tag",
"on",
"incoming",
"URLs",
"based",
"on",
"website",
"setting",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Tracker/PageUrl.php#L170-L185 | train | This function is used to cleanup the host and hash tag of a parsed URL | [
30522,
5123,
10763,
3853,
27686,
15006,
5794,
17516,
4095,
15900,
1006,
1002,
11968,
6924,
3126,
2140,
1010,
1002,
8909,
28032,
2063,
1027,
6270,
1007,
1063,
2065,
1006,
4064,
1006,
1002,
11968,
6924,
3126,
2140,
1007,
1007,
1063,
2709,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/VarDumper/Dumper/AbstractDumper.php | AbstractDumper.echoLine | protected function echoLine($line, $depth, $indentPad)
{
if (-1 !== $depth) {
fwrite($this->outputStream, str_repeat($indentPad, $depth).$line."\n");
}
} | php | protected function echoLine($line, $depth, $indentPad)
{
if (-1 !== $depth) {
fwrite($this->outputStream, str_repeat($indentPad, $depth).$line."\n");
}
} | [
"protected",
"function",
"echoLine",
"(",
"$",
"line",
",",
"$",
"depth",
",",
"$",
"indentPad",
")",
"{",
"if",
"(",
"-",
"1",
"!==",
"$",
"depth",
")",
"{",
"fwrite",
"(",
"$",
"this",
"->",
"outputStream",
",",
"str_repeat",
"(",
"$",
"indentPad",... | Generic line dumper callback.
@param string $line The line to write
@param int $depth The recursive depth in the dumped structure
@param string $indentPad The line indent pad | [
"Generic",
"line",
"dumper",
"callback",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/VarDumper/Dumper/AbstractDumper.php#L178-L183 | train | Echoes a line to the output stream | [
30522,
5123,
3853,
9052,
4179,
1006,
1002,
2240,
1010,
1002,
5995,
1010,
1002,
27427,
4765,
15455,
1007,
1063,
2065,
1006,
1011,
1015,
999,
1027,
1027,
1002,
5995,
1007,
1063,
1042,
26373,
1006,
1002,
2023,
1011,
1028,
27852,
25379,
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... |
symfony/symfony | src/Symfony/Component/Lock/Store/CombinedStore.php | CombinedStore.delete | public function delete(Key $key)
{
foreach ($this->stores as $store) {
try {
$store->delete($key);
} catch (\Exception $e) {
$this->logger->notice('One store failed to delete the "{resource}" lock.', ['resource' => $key, 'store' => $store, 'exception' => $e]);
}
}
} | php | public function delete(Key $key)
{
foreach ($this->stores as $store) {
try {
$store->delete($key);
} catch (\Exception $e) {
$this->logger->notice('One store failed to delete the "{resource}" lock.', ['resource' => $key, 'store' => $store, 'exception' => $e]);
}
}
} | [
"public",
"function",
"delete",
"(",
"Key",
"$",
"key",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"stores",
"as",
"$",
"store",
")",
"{",
"try",
"{",
"$",
"store",
"->",
"delete",
"(",
"$",
"key",
")",
";",
"}",
"catch",
"(",
"\\",
"Exception"... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Lock/Store/CombinedStore.php#L147-L156 | train | Delete a lock | [
30522,
2270,
3853,
3972,
12870,
1006,
3145,
1002,
3145,
1007,
1063,
18921,
6776,
1006,
1002,
2023,
1011,
1028,
5324,
2004,
1002,
3573,
1007,
1063,
3046,
1063,
1002,
3573,
1011,
1028,
3972,
12870,
1006,
1002,
3145,
1007,
1025,
1065,
4608,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/Zend/Db/Statement/Pdo.php | Zend_Db_Statement_Pdo.fetchColumn | public function fetchColumn($col = 0)
{
try {
return $this->_stmt->fetchColumn($col);
} catch (PDOException $e) {
// require_once 'Zend/Db/Statement/Exception.php';
throw new Zend_Db_Statement_Exception($e->getMessage(), $e->getCode(), $e);
}
} | php | public function fetchColumn($col = 0)
{
try {
return $this->_stmt->fetchColumn($col);
} catch (PDOException $e) {
// require_once 'Zend/Db/Statement/Exception.php';
throw new Zend_Db_Statement_Exception($e->getMessage(), $e->getCode(), $e);
}
} | [
"public",
"function",
"fetchColumn",
"(",
"$",
"col",
"=",
"0",
")",
"{",
"try",
"{",
"return",
"$",
"this",
"->",
"_stmt",
"->",
"fetchColumn",
"(",
"$",
"col",
")",
";",
"}",
"catch",
"(",
"PDOException",
"$",
"e",
")",
"{",
"// require_once 'Zend/Db... | Returns a single column from the next row of a result set.
@param int $col OPTIONAL Position of the column to fetch.
@return string
@throws Zend_Db_Statement_Exception | [
"Returns",
"a",
"single",
"column",
"from",
"the",
"next",
"row",
"of",
"a",
"result",
"set",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Statement/Pdo.php#L305-L313 | train | Fetch a single column from the result set | [
30522,
2270,
3853,
18584,
25778,
2819,
2078,
1006,
1002,
8902,
1027,
1014,
1007,
1063,
3046,
1063,
2709,
1002,
2023,
1011,
1028,
1035,
2358,
20492,
1011,
1028,
18584,
25778,
2819,
2078,
1006,
1002,
8902,
1007,
1025,
1065,
4608,
1006,
22851,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Validation/Validator.php | Validator.getPrimaryAttribute | protected function getPrimaryAttribute($attribute)
{
foreach ($this->implicitAttributes as $unparsed => $parsed) {
if (in_array($attribute, $parsed)) {
return $unparsed;
}
}
return $attribute;
} | php | protected function getPrimaryAttribute($attribute)
{
foreach ($this->implicitAttributes as $unparsed => $parsed) {
if (in_array($attribute, $parsed)) {
return $unparsed;
}
}
return $attribute;
} | [
"protected",
"function",
"getPrimaryAttribute",
"(",
"$",
"attribute",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"implicitAttributes",
"as",
"$",
"unparsed",
"=>",
"$",
"parsed",
")",
"{",
"if",
"(",
"in_array",
"(",
"$",
"attribute",
",",
"$",
"parsed"... | Get the primary attribute name.
For example, if "name.0" is given, "name.*" will be returned.
@param string $attribute
@return string | [
"Get",
"the",
"primary",
"attribute",
"name",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Validation/Validator.php#L443-L452 | train | Get primary attribute | [
30522,
5123,
3853,
2131,
18098,
9581,
20444,
4779,
3089,
8569,
2618,
1006,
1002,
17961,
1007,
1063,
18921,
6776,
1006,
1002,
2023,
1011,
1028,
24655,
19321,
3089,
8569,
4570,
2004,
1002,
4895,
19362,
6924,
1027,
1028,
1002,
11968,
6924,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/backend/classes/BackendController.php | BackendController.passToCmsController | protected function passToCmsController($url)
{
if (class_exists('\Cms\Classes\Controller')) {
return App::make('Cms\Classes\Controller')->run($url);
} else {
return Response::make(View::make('backend::404'), 404);
}
} | php | protected function passToCmsController($url)
{
if (class_exists('\Cms\Classes\Controller')) {
return App::make('Cms\Classes\Controller')->run($url);
} else {
return Response::make(View::make('backend::404'), 404);
}
} | [
"protected",
"function",
"passToCmsController",
"(",
"$",
"url",
")",
"{",
"if",
"(",
"class_exists",
"(",
"'\\Cms\\Classes\\Controller'",
")",
")",
"{",
"return",
"App",
"::",
"make",
"(",
"'Cms\\Classes\\Controller'",
")",
"->",
"run",
"(",
"$",
"url",
")",
... | Pass unhandled URLs to the CMS Controller, if it exists
@param string $url
@return Response | [
"Pass",
"unhandled",
"URLs",
"to",
"the",
"CMS",
"Controller",
"if",
"it",
"exists"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/classes/BackendController.php#L69-L76 | train | Pass to CMS Controller | [
30522,
5123,
3853,
3413,
3406,
27487,
9363,
3372,
26611,
1006,
1002,
24471,
2140,
1007,
1063,
2065,
1006,
2465,
1035,
6526,
1006,
1005,
1032,
4642,
2015,
1032,
4280,
1032,
11486,
1005,
1007,
1007,
1063,
2709,
10439,
1024,
1024,
2191,
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/PropertyInfo/Extractor/ReflectionExtractor.php | ReflectionExtractor.isInitializable | public function isInitializable(string $class, string $property, array $context = []): ?bool
{
try {
$reflectionClass = new \ReflectionClass($class);
} catch (\ReflectionException $e) {
return null;
}
if (!$reflectionClass->isInstantiable()) {
return false;
}
if ($constructor = $reflectionClass->getConstructor()) {
foreach ($constructor->getParameters() as $parameter) {
if ($property === $parameter->name) {
return true;
}
}
} elseif ($parentClass = $reflectionClass->getParentClass()) {
return $this->isInitializable($parentClass->getName(), $property);
}
return false;
} | php | public function isInitializable(string $class, string $property, array $context = []): ?bool
{
try {
$reflectionClass = new \ReflectionClass($class);
} catch (\ReflectionException $e) {
return null;
}
if (!$reflectionClass->isInstantiable()) {
return false;
}
if ($constructor = $reflectionClass->getConstructor()) {
foreach ($constructor->getParameters() as $parameter) {
if ($property === $parameter->name) {
return true;
}
}
} elseif ($parentClass = $reflectionClass->getParentClass()) {
return $this->isInitializable($parentClass->getName(), $property);
}
return false;
} | [
"public",
"function",
"isInitializable",
"(",
"string",
"$",
"class",
",",
"string",
"$",
"property",
",",
"array",
"$",
"context",
"=",
"[",
"]",
")",
":",
"?",
"bool",
"{",
"try",
"{",
"$",
"reflectionClass",
"=",
"new",
"\\",
"ReflectionClass",
"(",
... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php#L187-L210 | train | Returns true if the class is initializable. | [
30522,
2270,
3853,
2003,
5498,
20925,
21335,
3468,
1006,
5164,
1002,
2465,
1010,
5164,
1002,
3200,
1010,
9140,
1002,
6123,
1027,
1031,
1033,
1007,
1024,
1029,
22017,
2140,
1063,
3046,
1063,
1002,
9185,
26266,
1027,
2047,
1032,
9185,
26266,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
walkor/Workerman | Events/Ev.php | Ev.timerCallback | public function timerCallback($event)
{
$param = $event->data;
$timer_id = $param[4];
if ($param[2] === self::EV_TIMER_ONCE) {
$this->_eventTimer[$timer_id]->stop();
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($event)
{
$param = $event->data;
$timer_id = $param[4];
if ($param[2] === self::EV_TIMER_ONCE) {
$this->_eventTimer[$timer_id]->stop();
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",
"(",
"$",
"event",
")",
"{",
"$",
"param",
"=",
"$",
"event",
"->",
"data",
";",
"$",
"timer_id",
"=",
"$",
"param",
"[",
"4",
"]",
";",
"if",
"(",
"$",
"param",
"[",
"2",
"]",
"===",
"self",
"::",
"EV_TIMER... | Timer callback.
@param \EvWatcher $event | [
"Timer",
"callback",
"."
] | 13649907f05014fcfffcfccaef01e63ad3339351 | https://github.com/walkor/Workerman/blob/13649907f05014fcfffcfccaef01e63ad3339351/Events/Ev.php#L131-L148 | train | Timer Callback Callback | [
30522,
2270,
3853,
25309,
9289,
20850,
8684,
1006,
1002,
2724,
1007,
1063,
1002,
11498,
2213,
1027,
1002,
2724,
1011,
1028,
2951,
1025,
1002,
25309,
1035,
8909,
1027,
1002,
11498,
2213,
1031,
1018,
1033,
1025,
2065,
1006,
1002,
11498,
2213,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
z-song/laravel-admin | src/Form/Field/UploadField.php | UploadField.renameIfExists | public function renameIfExists(UploadedFile $file)
{
if ($this->storage->exists("{$this->getDirectory()}/$this->name")) {
$this->name = $this->generateUniqueName($file);
}
} | php | public function renameIfExists(UploadedFile $file)
{
if ($this->storage->exists("{$this->getDirectory()}/$this->name")) {
$this->name = $this->generateUniqueName($file);
}
} | [
"public",
"function",
"renameIfExists",
"(",
"UploadedFile",
"$",
"file",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"storage",
"->",
"exists",
"(",
"\"{$this->getDirectory()}/$this->name\"",
")",
")",
"{",
"$",
"this",
"->",
"name",
"=",
"$",
"this",
"->",
"... | If name already exists, rename it.
@param $file
@return void | [
"If",
"name",
"already",
"exists",
"rename",
"it",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Form/Field/UploadField.php#L313-L318 | train | Rename file if it already exists in the directory | [
30522,
2270,
3853,
30524,
2023,
1011,
1028,
5527,
1011,
1028,
6526,
1006,
1000,
1063,
1002,
2023,
1011,
1028,
2131,
4305,
2890,
16761,
2100,
1006,
1007,
1065,
1013,
1002,
2023,
1011,
1028,
2171,
1000,
1007,
1007,
1063,
1002,
2023,
1011,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/backend/traits/FormModelWidget.php | FormModelWidget.getRelationType | protected function getRelationType()
{
list($model, $attribute) = $this->resolveModelAttribute($this->valueFrom);
return $model->getRelationType($attribute);
} | php | protected function getRelationType()
{
list($model, $attribute) = $this->resolveModelAttribute($this->valueFrom);
return $model->getRelationType($attribute);
} | [
"protected",
"function",
"getRelationType",
"(",
")",
"{",
"list",
"(",
"$",
"model",
",",
"$",
"attribute",
")",
"=",
"$",
"this",
"->",
"resolveModelAttribute",
"(",
"$",
"this",
"->",
"valueFrom",
")",
";",
"return",
"$",
"model",
"->",
"getRelationType... | Returns the value as a relation type from the model,
supports nesting via HTML array.
@return Relation | [
"Returns",
"the",
"value",
"as",
"a",
"relation",
"type",
"from",
"the",
"model",
"supports",
"nesting",
"via",
"HTML",
"array",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/traits/FormModelWidget.php#L96-L100 | train | Get the relation type | [
30522,
5123,
3853,
2131,
16570,
3370,
13874,
1006,
1007,
1063,
2862,
1006,
1002,
2944,
1010,
1002,
17961,
1007,
1027,
1002,
2023,
1011,
1028,
10663,
5302,
9247,
19321,
3089,
8569,
2618,
1006,
1002,
2023,
1011,
1028,
3643,
19699,
5358,
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... |
dompdf/dompdf | src/Css/Stylesheet.php | Stylesheet._parse_font_face | private function _parse_font_face($str)
{
$descriptors = $this->_parse_properties($str);
preg_match_all("/(url|local)\s*\([\"\']?([^\"\'\)]+)[\"\']?\)\s*(format\s*\([\"\']?([^\"\'\)]+)[\"\']?\))?/i", $descriptors->src, $src);
$sources = array();
$valid_sources = array();
foreach ($src[0] as $i => $value) {
$source = array(
"local" => strtolower($src[1][$i]) === "local",
"uri" => $src[2][$i],
"format" => strtolower($src[4][$i]),
"path" => Helpers::build_url($this->_protocol, $this->_base_host, $this->_base_path, $src[2][$i]),
);
if (!$source["local"] && in_array($source["format"], array("", "truetype"))) {
$valid_sources[] = $source;
}
$sources[] = $source;
}
// No valid sources
if (empty($valid_sources)) {
return;
}
$style = array(
"family" => $descriptors->get_font_family_raw(),
"weight" => $descriptors->font_weight,
"style" => $descriptors->font_style,
);
$this->getFontMetrics()->registerFont($style, $valid_sources[0]["path"], $this->_dompdf->getHttpContext());
} | php | private function _parse_font_face($str)
{
$descriptors = $this->_parse_properties($str);
preg_match_all("/(url|local)\s*\([\"\']?([^\"\'\)]+)[\"\']?\)\s*(format\s*\([\"\']?([^\"\'\)]+)[\"\']?\))?/i", $descriptors->src, $src);
$sources = array();
$valid_sources = array();
foreach ($src[0] as $i => $value) {
$source = array(
"local" => strtolower($src[1][$i]) === "local",
"uri" => $src[2][$i],
"format" => strtolower($src[4][$i]),
"path" => Helpers::build_url($this->_protocol, $this->_base_host, $this->_base_path, $src[2][$i]),
);
if (!$source["local"] && in_array($source["format"], array("", "truetype"))) {
$valid_sources[] = $source;
}
$sources[] = $source;
}
// No valid sources
if (empty($valid_sources)) {
return;
}
$style = array(
"family" => $descriptors->get_font_family_raw(),
"weight" => $descriptors->font_weight,
"style" => $descriptors->font_style,
);
$this->getFontMetrics()->registerFont($style, $valid_sources[0]["path"], $this->_dompdf->getHttpContext());
} | [
"private",
"function",
"_parse_font_face",
"(",
"$",
"str",
")",
"{",
"$",
"descriptors",
"=",
"$",
"this",
"->",
"_parse_properties",
"(",
"$",
"str",
")",
";",
"preg_match_all",
"(",
"\"/(url|local)\\s*\\([\\\"\\']?([^\\\"\\'\\)]+)[\\\"\\']?\\)\\s*(format\\s*\\([\\\"\\'... | parse @font-face{} sections
http://www.w3.org/TR/css3-fonts/#the-font-face-rule
@param string $str CSS @font-face rules | [
"parse",
"@font",
"-",
"face",
"{}",
"sections",
"http",
":",
"//",
"www",
".",
"w3",
".",
"org",
"/",
"TR",
"/",
"css3",
"-",
"fonts",
"/",
"#the",
"-",
"font",
"-",
"face",
"-",
"rule"
] | 75f13c700009be21a1965dc2c5b68a8708c22ba2 | https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/src/Css/Stylesheet.php#L1502-L1538 | train | Parse font face | [
30522,
2797,
3853,
1035,
11968,
3366,
1035,
15489,
1035,
2227,
1006,
1002,
2358,
2099,
1007,
1063,
1002,
4078,
23235,
5668,
1027,
1002,
2023,
1011,
1028,
1035,
11968,
3366,
1035,
5144,
1006,
1002,
2358,
2099,
1007,
1025,
3653,
2290,
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/View/Compilers/BladeCompiler.php | BladeCompiler.compile | public function compile($path = null)
{
if ($path) {
$this->setPath($path);
}
if (! is_null($this->cachePath)) {
$contents = $this->compileString(
$this->files->get($this->getPath())
);
if (! empty($this->getPath())) {
$tokens = $this->getOpenAndClosingPhpTokens($contents);
// If the tokens we retrieved from the compiled contents have at least
// one opening tag and if that last token isn't the closing tag, we
// need to close the statement before adding the path at the end.
if ($tokens->isNotEmpty() && $tokens->last() !== T_CLOSE_TAG) {
$contents .= ' ?>';
}
$contents .= "<?php /**PATH {$this->getPath()} ENDPATH**/ ?>";
}
$this->files->put(
$this->getCompiledPath($this->getPath()), $contents
);
}
} | php | public function compile($path = null)
{
if ($path) {
$this->setPath($path);
}
if (! is_null($this->cachePath)) {
$contents = $this->compileString(
$this->files->get($this->getPath())
);
if (! empty($this->getPath())) {
$tokens = $this->getOpenAndClosingPhpTokens($contents);
// If the tokens we retrieved from the compiled contents have at least
// one opening tag and if that last token isn't the closing tag, we
// need to close the statement before adding the path at the end.
if ($tokens->isNotEmpty() && $tokens->last() !== T_CLOSE_TAG) {
$contents .= ' ?>';
}
$contents .= "<?php /**PATH {$this->getPath()} ENDPATH**/ ?>";
}
$this->files->put(
$this->getCompiledPath($this->getPath()), $contents
);
}
} | [
"public",
"function",
"compile",
"(",
"$",
"path",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"path",
")",
"{",
"$",
"this",
"->",
"setPath",
"(",
"$",
"path",
")",
";",
"}",
"if",
"(",
"!",
"is_null",
"(",
"$",
"this",
"->",
"cachePath",
")",
")",... | Compile the view at the given path.
@param string $path
@return void | [
"Compile",
"the",
"view",
"at",
"the",
"given",
"path",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/View/Compilers/BladeCompiler.php#L115-L143 | train | Compiles the file and returns the result as a string. | [
30522,
2270,
3853,
4012,
22090,
1006,
1002,
4130,
1027,
19701,
1007,
1063,
2065,
1006,
1002,
4130,
1007,
1063,
1002,
2023,
1011,
1028,
2275,
15069,
1006,
1002,
4130,
1007,
1025,
1065,
2065,
1006,
999,
2003,
1035,
19701,
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... |
laravel/framework | src/Illuminate/Validation/Concerns/ValidatesAttributes.php | ValidatesAttributes.allFailingRequired | protected function allFailingRequired(array $attributes)
{
foreach ($attributes as $key) {
if ($this->validateRequired($key, $this->getValue($key))) {
return false;
}
}
return true;
} | php | protected function allFailingRequired(array $attributes)
{
foreach ($attributes as $key) {
if ($this->validateRequired($key, $this->getValue($key))) {
return false;
}
}
return true;
} | [
"protected",
"function",
"allFailingRequired",
"(",
"array",
"$",
"attributes",
")",
"{",
"foreach",
"(",
"$",
"attributes",
"as",
"$",
"key",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"validateRequired",
"(",
"$",
"key",
",",
"$",
"this",
"->",
"getValue"... | Determine if all of the given attributes fail the required test.
@param array $attributes
@return bool | [
"Determine",
"if",
"all",
"of",
"the",
"given",
"attributes",
"fail",
"the",
"required",
"test",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Validation/Concerns/ValidatesAttributes.php#L1475-L1484 | train | All Failing Required | [
30522,
5123,
3853,
2035,
7011,
16281,
2890,
15549,
5596,
1006,
9140,
1002,
12332,
1007,
1063,
18921,
6776,
1006,
1002,
12332,
2004,
1002,
3145,
1007,
1063,
2065,
1006,
1002,
2023,
1011,
1028,
9398,
24932,
2063,
15549,
5596,
1006,
1002,
3145... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/UsersManager/API.php | API.getUser | public function getUser($userLogin)
{
Piwik::checkUserHasSuperUserAccessOrIsTheUser($userLogin);
$this->checkUserExists($userLogin);
$user = $this->model->getUser($userLogin);
$user = $this->userFilter->filterUser($user);
$user = $this->enrichUser($user);
return $user;
} | php | public function getUser($userLogin)
{
Piwik::checkUserHasSuperUserAccessOrIsTheUser($userLogin);
$this->checkUserExists($userLogin);
$user = $this->model->getUser($userLogin);
$user = $this->userFilter->filterUser($user);
$user = $this->enrichUser($user);
return $user;
} | [
"public",
"function",
"getUser",
"(",
"$",
"userLogin",
")",
"{",
"Piwik",
"::",
"checkUserHasSuperUserAccessOrIsTheUser",
"(",
"$",
"userLogin",
")",
";",
"$",
"this",
"->",
"checkUserExists",
"(",
"$",
"userLogin",
")",
";",
"$",
"user",
"=",
"$",
"this",
... | Returns the user information (login, password hash, alias, email, date_registered, etc.)
@param string $userLogin the user login
@return array the user information | [
"Returns",
"the",
"user",
"information",
"(",
"login",
"password",
"hash",
"alias",
"email",
"date_registered",
"etc",
".",
")"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/UsersManager/API.php#L573-L584 | train | Returns the user object for the given login | [
30522,
2270,
3853,
2131,
20330,
1006,
1002,
5310,
21197,
2378,
1007,
1063,
14255,
9148,
2243,
1024,
1024,
4638,
20330,
14949,
6342,
4842,
20330,
6305,
9623,
21748,
2923,
5369,
20330,
1006,
1002,
5310,
21197,
2378,
1007,
1025,
1002,
2023,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Bundle/FrameworkBundle/Templating/Helper/FormHelper.php | FormHelper.block | public function block(FormView $view, $blockName, array $variables = [])
{
return $this->renderer->renderBlock($view, $blockName, $variables);
} | php | public function block(FormView $view, $blockName, array $variables = [])
{
return $this->renderer->renderBlock($view, $blockName, $variables);
} | [
"public",
"function",
"block",
"(",
"FormView",
"$",
"view",
",",
"$",
"blockName",
",",
"array",
"$",
"variables",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"renderer",
"->",
"renderBlock",
"(",
"$",
"view",
",",
"$",
"blockName",
",",
"... | Renders a block of the template.
@param FormView $view The view for determining the used themes
@param string $blockName The name of the block to render
@param array $variables The variable to pass to the template
@return string The HTML markup | [
"Renders",
"a",
"block",
"of",
"the",
"template",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/FormHelper.php#L220-L223 | train | Render a block | [
30522,
2270,
3853,
3796,
1006,
2433,
8584,
1002,
3193,
1010,
1002,
3796,
18442,
1010,
9140,
1002,
10857,
1027,
1031,
1033,
1007,
1063,
2709,
1002,
2023,
1011,
1028,
17552,
2121,
1011,
1028,
17552,
23467,
1006,
1002,
3193,
1010,
1002,
3796,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Scheduler/Scheduler.php | Scheduler.rescheduleTaskAndRunTomorrow | public function rescheduleTaskAndRunTomorrow(Task $task)
{
$this->logger->debug('Rescheduling task and setting first run for tomorrow {task}', array('task' => $task->getName()));
$this->timetable->rescheduleTaskAndRunTomorrow($task);
} | php | public function rescheduleTaskAndRunTomorrow(Task $task)
{
$this->logger->debug('Rescheduling task and setting first run for tomorrow {task}', array('task' => $task->getName()));
$this->timetable->rescheduleTaskAndRunTomorrow($task);
} | [
"public",
"function",
"rescheduleTaskAndRunTomorrow",
"(",
"Task",
"$",
"task",
")",
"{",
"$",
"this",
"->",
"logger",
"->",
"debug",
"(",
"'Rescheduling task and setting first run for tomorrow {task}'",
",",
"array",
"(",
"'task'",
"=>",
"$",
"task",
"->",
"getName... | Determines a task's scheduled time and persists it, overwriting the previous scheduled time.
Call this method if your task's scheduled time has changed due to, for example, an option that
was changed.
The task will be run the first time tomorrow.
@param Task $task Describes the scheduled task being rescheduled.
@api | [
"Determines",
"a",
"task",
"s",
"scheduled",
"time",
"and",
"persists",
"it",
"overwriting",
"the",
"previous",
"scheduled",
"time",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Scheduler/Scheduler.php#L194-L199 | train | Reschedules a task and sets the first run for tomorrow | [
30522,
2270,
3853,
24501,
7690,
9307,
10230,
9126,
13626,
16671,
19506,
28597,
1006,
4708,
1002,
4708,
1007,
1063,
1002,
2023,
1011,
1028,
8833,
4590,
1011,
1028,
2139,
8569,
2290,
1006,
1005,
24501,
7690,
18639,
2290,
4708,
1998,
4292,
203... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/CssSelector/Parser/TokenStream.php | TokenStream.getNextIdentifier | public function getNextIdentifier()
{
$next = $this->getNext();
if (!$next->isIdentifier()) {
throw SyntaxErrorException::unexpectedToken('identifier', $next);
}
return $next->getValue();
} | php | public function getNextIdentifier()
{
$next = $this->getNext();
if (!$next->isIdentifier()) {
throw SyntaxErrorException::unexpectedToken('identifier', $next);
}
return $next->getValue();
} | [
"public",
"function",
"getNextIdentifier",
"(",
")",
"{",
"$",
"next",
"=",
"$",
"this",
"->",
"getNext",
"(",
")",
";",
"if",
"(",
"!",
"$",
"next",
"->",
"isIdentifier",
"(",
")",
")",
"{",
"throw",
"SyntaxErrorException",
"::",
"unexpectedToken",
"(",... | Returns nex identifier token.
@return string The identifier token value
@throws SyntaxErrorException If next token is not an identifier | [
"Returns",
"nex",
"identifier",
"token",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/CssSelector/Parser/TokenStream.php#L131-L140 | train | Returns the identifier of the next token | [
30522,
2270,
3853,
2131,
2638,
18413,
5178,
16778,
8873,
2121,
1006,
1007,
1063,
1002,
2279,
1027,
1002,
2023,
1011,
1028,
2131,
2638,
18413,
1006,
1007,
1025,
2065,
1006,
999,
1002,
2279,
1011,
1028,
2003,
5178,
16778,
8873,
2121,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/ReportRenderer.php | ReportRenderer.processTableFormat | protected static function processTableFormat($reportMetadata, $report, $reportColumns)
{
$finalReport = $report;
if (empty($reportMetadata['dimension'])) {
$simpleReportMetrics = $report->getFirstRow();
if ($simpleReportMetrics) {
$finalReport = new Simple();
foreach ($simpleReportMetrics->getColumns() as $metricId => $metric) {
$newRow = new Row();
$newRow->addColumn("label", $reportColumns[$metricId]);
$newRow->addColumn("value", $metric);
$finalReport->addRow($newRow);
}
}
$reportColumns = array(
'label' => Piwik::translate('General_Name'),
'value' => Piwik::translate('General_Value'),
);
}
return array(
$finalReport,
$reportColumns,
);
} | php | protected static function processTableFormat($reportMetadata, $report, $reportColumns)
{
$finalReport = $report;
if (empty($reportMetadata['dimension'])) {
$simpleReportMetrics = $report->getFirstRow();
if ($simpleReportMetrics) {
$finalReport = new Simple();
foreach ($simpleReportMetrics->getColumns() as $metricId => $metric) {
$newRow = new Row();
$newRow->addColumn("label", $reportColumns[$metricId]);
$newRow->addColumn("value", $metric);
$finalReport->addRow($newRow);
}
}
$reportColumns = array(
'label' => Piwik::translate('General_Name'),
'value' => Piwik::translate('General_Value'),
);
}
return array(
$finalReport,
$reportColumns,
);
} | [
"protected",
"static",
"function",
"processTableFormat",
"(",
"$",
"reportMetadata",
",",
"$",
"report",
",",
"$",
"reportColumns",
")",
"{",
"$",
"finalReport",
"=",
"$",
"report",
";",
"if",
"(",
"empty",
"(",
"$",
"reportMetadata",
"[",
"'dimension'",
"]"... | Convert a dimension-less report to a multi-row two-column data table
@static
@param $reportMetadata array
@param $report DataTable
@param $reportColumns array
@return array DataTable $report & array $columns | [
"Convert",
"a",
"dimension",
"-",
"less",
"report",
"to",
"a",
"multi",
"-",
"row",
"two",
"-",
"column",
"data",
"table"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/ReportRenderer.php#L222-L247 | train | Process the table format | [
30522,
5123,
10763,
3853,
2832,
10880,
14192,
30524,
1005,
9812,
1005,
1033,
1007,
1007,
1063,
1002,
16325,
13699,
11589,
12589,
2015,
1027,
1002,
3189,
1011,
1028,
2131,
8873,
12096,
10524,
1006,
1007,
1025,
2065,
1006,
1002,
16325,
13699,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/PropertyInfo/Extractor/ReflectionExtractor.php | ReflectionExtractor.extractFromConstructor | private function extractFromConstructor(string $class, string $property): ?array
{
try {
$reflectionClass = new \ReflectionClass($class);
} catch (\ReflectionException $e) {
return null;
}
$constructor = $reflectionClass->getConstructor();
if (!$constructor) {
return null;
}
foreach ($constructor->getParameters() as $parameter) {
if ($property !== $parameter->name) {
continue;
}
$reflectionType = $parameter->getType();
return $reflectionType ? [$this->extractFromReflectionType($reflectionType, $constructor)] : null;
}
if ($parentClass = $reflectionClass->getParentClass()) {
return $this->extractFromConstructor($parentClass->getName(), $property);
}
return null;
} | php | private function extractFromConstructor(string $class, string $property): ?array
{
try {
$reflectionClass = new \ReflectionClass($class);
} catch (\ReflectionException $e) {
return null;
}
$constructor = $reflectionClass->getConstructor();
if (!$constructor) {
return null;
}
foreach ($constructor->getParameters() as $parameter) {
if ($property !== $parameter->name) {
continue;
}
$reflectionType = $parameter->getType();
return $reflectionType ? [$this->extractFromReflectionType($reflectionType, $constructor)] : null;
}
if ($parentClass = $reflectionClass->getParentClass()) {
return $this->extractFromConstructor($parentClass->getName(), $property);
}
return null;
} | [
"private",
"function",
"extractFromConstructor",
"(",
"string",
"$",
"class",
",",
"string",
"$",
"property",
")",
":",
"?",
"array",
"{",
"try",
"{",
"$",
"reflectionClass",
"=",
"new",
"\\",
"ReflectionClass",
"(",
"$",
"class",
")",
";",
"}",
"catch",
... | Tries to extract type information from constructor.
@return Type[]|null | [
"Tries",
"to",
"extract",
"type",
"information",
"from",
"constructor",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php#L265-L293 | train | Extract the type of the parameter from the constructor | [
30522,
2797,
3853,
14817,
19699,
5358,
8663,
3367,
6820,
16761,
1006,
5164,
1002,
2465,
1010,
5164,
1002,
3200,
1007,
1024,
1029,
9140,
1063,
3046,
1063,
1002,
9185,
26266,
1027,
2047,
1032,
9185,
26266,
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... |
matomo-org/matomo | core/ArchiveProcessor/Rules.php | Rules.getSelectableDoneFlagValues | public static function getSelectableDoneFlagValues()
{
$possibleValues = array(ArchiveWriter::DONE_OK, ArchiveWriter::DONE_OK_TEMPORARY);
if (!Rules::isRequestAuthorizedToArchive()) {
//If request is not authorized to archive then fetch also invalidated archives
$possibleValues[] = ArchiveWriter::DONE_INVALIDATED;
}
return $possibleValues;
} | php | public static function getSelectableDoneFlagValues()
{
$possibleValues = array(ArchiveWriter::DONE_OK, ArchiveWriter::DONE_OK_TEMPORARY);
if (!Rules::isRequestAuthorizedToArchive()) {
//If request is not authorized to archive then fetch also invalidated archives
$possibleValues[] = ArchiveWriter::DONE_INVALIDATED;
}
return $possibleValues;
} | [
"public",
"static",
"function",
"getSelectableDoneFlagValues",
"(",
")",
"{",
"$",
"possibleValues",
"=",
"array",
"(",
"ArchiveWriter",
"::",
"DONE_OK",
",",
"ArchiveWriter",
"::",
"DONE_OK_TEMPORARY",
")",
";",
"if",
"(",
"!",
"Rules",
"::",
"isRequestAuthorized... | Returns done flag values allowed to be selected
@return string | [
"Returns",
"done",
"flag",
"values",
"allowed",
"to",
"be",
"selected"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/ArchiveProcessor/Rules.php#L296-L306 | train | Returns an array of flags which are selectable to archive | [
30522,
2270,
10763,
3853,
4152,
12260,
23576,
5280,
12879,
17802,
10175,
15808,
1006,
1007,
1063,
1002,
2825,
10175,
15808,
1027,
9140,
1006,
8756,
15994,
1024,
1024,
30524,
7929,
1035,
5741,
1007,
1025,
2065,
1006,
999,
3513,
1024,
1024,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Validation/Concerns/ValidatesAttributes.php | ValidatesAttributes.validateRequiredWithoutAll | public function validateRequiredWithoutAll($attribute, $value, $parameters)
{
if ($this->allFailingRequired($parameters)) {
return $this->validateRequired($attribute, $value);
}
return true;
} | php | public function validateRequiredWithoutAll($attribute, $value, $parameters)
{
if ($this->allFailingRequired($parameters)) {
return $this->validateRequired($attribute, $value);
}
return true;
} | [
"public",
"function",
"validateRequiredWithoutAll",
"(",
"$",
"attribute",
",",
"$",
"value",
",",
"$",
"parameters",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"allFailingRequired",
"(",
"$",
"parameters",
")",
")",
"{",
"return",
"$",
"this",
"->",
"validat... | Validate that an attribute exists when all other attributes do not.
@param string $attribute
@param mixed $value
@param mixed $parameters
@return bool | [
"Validate",
"that",
"an",
"attribute",
"exists",
"when",
"all",
"other",
"attributes",
"do",
"not",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Validation/Concerns/ValidatesAttributes.php#L1443-L1450 | train | Required without all | [
30522,
2270,
3853,
9398,
24932,
2063,
15549,
5596,
24415,
5833,
8095,
1006,
1002,
17961,
1010,
1002,
3643,
1010,
1002,
11709,
1007,
1063,
2065,
1006,
1002,
2023,
1011,
1028,
2035,
7011,
16281,
2890,
15549,
5596,
1006,
1002,
11709,
1007,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Database/Eloquent/Relations/Relation.php | Relation.morphMap | public static function morphMap(array $map = null, $merge = true)
{
$map = static::buildMorphMapFromModels($map);
if (is_array($map)) {
static::$morphMap = $merge && static::$morphMap
? $map + static::$morphMap : $map;
}
return static::$morphMap;
} | php | public static function morphMap(array $map = null, $merge = true)
{
$map = static::buildMorphMapFromModels($map);
if (is_array($map)) {
static::$morphMap = $merge && static::$morphMap
? $map + static::$morphMap : $map;
}
return static::$morphMap;
} | [
"public",
"static",
"function",
"morphMap",
"(",
"array",
"$",
"map",
"=",
"null",
",",
"$",
"merge",
"=",
"true",
")",
"{",
"$",
"map",
"=",
"static",
"::",
"buildMorphMapFromModels",
"(",
"$",
"map",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"map"... | Set or get the morph map for polymorphic relations.
@param array|null $map
@param bool $merge
@return array | [
"Set",
"or",
"get",
"the",
"morph",
"map",
"for",
"polymorphic",
"relations",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Relations/Relation.php#L333-L343 | train | Get the morph map from the models | [
30522,
2270,
10763,
3853,
22822,
8458,
2863,
2361,
1006,
9140,
1002,
4949,
1027,
19701,
1010,
1002,
13590,
1027,
2995,
1007,
1063,
1002,
4949,
1027,
10763,
1024,
1024,
3857,
5302,
14536,
22444,
14376,
21716,
5302,
9247,
2015,
1006,
1002,
49... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/Annotations/AnnotationList.php | AnnotationList.save | public function save($idSite)
{
$this->checkIdSiteIsLoaded($idSite);
$optionName = self::getAnnotationCollectionOptionName($idSite);
Option::set($optionName, serialize($this->annotations[$idSite]));
} | php | public function save($idSite)
{
$this->checkIdSiteIsLoaded($idSite);
$optionName = self::getAnnotationCollectionOptionName($idSite);
Option::set($optionName, serialize($this->annotations[$idSite]));
} | [
"public",
"function",
"save",
"(",
"$",
"idSite",
")",
"{",
"$",
"this",
"->",
"checkIdSiteIsLoaded",
"(",
"$",
"idSite",
")",
";",
"$",
"optionName",
"=",
"self",
"::",
"getAnnotationCollectionOptionName",
"(",
"$",
"idSite",
")",
";",
"Option",
"::",
"se... | Persists the annotations list for a site, overwriting whatever exists.
@param int $idSite The ID of the site to save annotations for.
@throws Exception if $idSite is not an ID that was supplied upon construction. | [
"Persists",
"the",
"annotations",
"list",
"for",
"a",
"site",
"overwriting",
"whatever",
"exists",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Annotations/AnnotationList.php#L105-L111 | train | Save the annotation collection | [
30522,
2270,
3853,
3828,
1006,
1002,
8909,
28032,
2063,
1007,
1063,
1002,
2023,
1011,
1028,
4638,
9821,
4221,
2483,
17468,
1006,
1002,
8909,
28032,
2063,
1007,
1025,
1002,
5724,
18442,
1027,
2969,
1024,
1024,
2131,
11639,
17287,
3508,
26895... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/RedisStore.php | RedisStore.evaluate | private function evaluate(string $script, string $resource, array $args)
{
if (
$this->redis instanceof \Redis ||
$this->redis instanceof \RedisCluster ||
$this->redis instanceof RedisProxy ||
$this->redis instanceof RedisClusterProxy
) {
return $this->redis->eval($script, array_merge([$resource], $args), 1);
}
if ($this->redis instanceof \RedisArray) {
return $this->redis->_instance($this->redis->_target($resource))->eval($script, array_merge([$resource], $args), 1);
}
if ($this->redis instanceof \Predis\Client) {
return $this->redis->eval(...array_merge([$script, 1, $resource], $args));
}
throw new InvalidArgumentException(sprintf('%s() expects being initialized with a Redis, RedisArray, RedisCluster or Predis\Client, %s given', __METHOD__, \is_object($this->redis) ? \get_class($this->redis) : \gettype($this->redis)));
} | php | private function evaluate(string $script, string $resource, array $args)
{
if (
$this->redis instanceof \Redis ||
$this->redis instanceof \RedisCluster ||
$this->redis instanceof RedisProxy ||
$this->redis instanceof RedisClusterProxy
) {
return $this->redis->eval($script, array_merge([$resource], $args), 1);
}
if ($this->redis instanceof \RedisArray) {
return $this->redis->_instance($this->redis->_target($resource))->eval($script, array_merge([$resource], $args), 1);
}
if ($this->redis instanceof \Predis\Client) {
return $this->redis->eval(...array_merge([$script, 1, $resource], $args));
}
throw new InvalidArgumentException(sprintf('%s() expects being initialized with a Redis, RedisArray, RedisCluster or Predis\Client, %s given', __METHOD__, \is_object($this->redis) ? \get_class($this->redis) : \gettype($this->redis)));
} | [
"private",
"function",
"evaluate",
"(",
"string",
"$",
"script",
",",
"string",
"$",
"resource",
",",
"array",
"$",
"args",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"redis",
"instanceof",
"\\",
"Redis",
"||",
"$",
"this",
"->",
"redis",
"instanceof",
"\... | Evaluates a script in the corresponding redis client.
@return mixed | [
"Evaluates",
"a",
"script",
"in",
"the",
"corresponding",
"redis",
"client",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Lock/Store/RedisStore.php#L132-L152 | train | Evaluate the script | [
30522,
2797,
3853,
16157,
1006,
5164,
1002,
5896,
1010,
5164,
1002,
7692,
1010,
9140,
1002,
12098,
5620,
1007,
1063,
2065,
1006,
1002,
2023,
1011,
1028,
2417,
2483,
6013,
11253,
1032,
2417,
2483,
1064,
1064,
1002,
2023,
1011,
1028,
2417,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Validator/ViolationMapper/ViolationMapper.php | ViolationMapper.reconstructPath | private function reconstructPath(ViolationPath $violationPath, FormInterface $origin)
{
$propertyPathBuilder = new PropertyPathBuilder($violationPath);
$it = $violationPath->getIterator();
$scope = $origin;
// Remember the current index in the builder
$i = 0;
// Expand elements that map to a form (like "children[address]")
for ($it->rewind(); $it->valid() && $it->mapsForm(); $it->next()) {
if (!$scope->has($it->current())) {
// Scope relates to a form that does not exist
// Bail out
break;
}
// Process child form
$scope = $scope->get($it->current());
if ($scope->getConfig()->getInheritData()) {
// Form inherits its parent data
// Cut the piece out of the property path and proceed
$propertyPathBuilder->remove($i);
} elseif (!$scope->getConfig()->getMapped()) {
// Form is not mapped
// Set the form as new origin and strip everything
// we have so far in the path
$origin = $scope;
$propertyPathBuilder->remove(0, $i + 1);
$i = 0;
} else {
/* @var \Symfony\Component\PropertyAccess\PropertyPathInterface $propertyPath */
$propertyPath = $scope->getPropertyPath();
if (null === $propertyPath) {
// Property path of a mapped form is null
// Should not happen, bail out
break;
}
$propertyPathBuilder->replace($i, 1, $propertyPath);
$i += $propertyPath->getLength();
}
}
$finalPath = $propertyPathBuilder->getPropertyPath();
return null !== $finalPath ? new RelativePath($origin, $finalPath) : null;
} | php | private function reconstructPath(ViolationPath $violationPath, FormInterface $origin)
{
$propertyPathBuilder = new PropertyPathBuilder($violationPath);
$it = $violationPath->getIterator();
$scope = $origin;
// Remember the current index in the builder
$i = 0;
// Expand elements that map to a form (like "children[address]")
for ($it->rewind(); $it->valid() && $it->mapsForm(); $it->next()) {
if (!$scope->has($it->current())) {
// Scope relates to a form that does not exist
// Bail out
break;
}
// Process child form
$scope = $scope->get($it->current());
if ($scope->getConfig()->getInheritData()) {
// Form inherits its parent data
// Cut the piece out of the property path and proceed
$propertyPathBuilder->remove($i);
} elseif (!$scope->getConfig()->getMapped()) {
// Form is not mapped
// Set the form as new origin and strip everything
// we have so far in the path
$origin = $scope;
$propertyPathBuilder->remove(0, $i + 1);
$i = 0;
} else {
/* @var \Symfony\Component\PropertyAccess\PropertyPathInterface $propertyPath */
$propertyPath = $scope->getPropertyPath();
if (null === $propertyPath) {
// Property path of a mapped form is null
// Should not happen, bail out
break;
}
$propertyPathBuilder->replace($i, 1, $propertyPath);
$i += $propertyPath->getLength();
}
}
$finalPath = $propertyPathBuilder->getPropertyPath();
return null !== $finalPath ? new RelativePath($origin, $finalPath) : null;
} | [
"private",
"function",
"reconstructPath",
"(",
"ViolationPath",
"$",
"violationPath",
",",
"FormInterface",
"$",
"origin",
")",
"{",
"$",
"propertyPathBuilder",
"=",
"new",
"PropertyPathBuilder",
"(",
"$",
"violationPath",
")",
";",
"$",
"it",
"=",
"$",
"violati... | Reconstructs a property path from a violation path and a form tree.
@param ViolationPath $violationPath The violation path
@param FormInterface $origin The root form of the tree
@return RelativePath The reconstructed path | [
"Reconstructs",
"a",
"property",
"path",
"from",
"a",
"violation",
"path",
"and",
"a",
"form",
"tree",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationMapper.php#L220-L269 | train | Reconstructs the path from the violation path | [
30522,
2797,
3853,
28667,
5644,
18300,
15069,
1006,
11371,
15069,
1002,
11371,
15069,
1010,
2433,
18447,
2121,
12172,
1002,
4761,
1007,
1063,
1002,
3200,
15069,
8569,
23891,
2099,
1027,
2047,
3200,
15069,
8569,
23891,
2099,
1006,
1002,
11371,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/Zend/Cache/Backend/File.php | Zend_Cache_Backend_File.remove | public function remove($id)
{
$file = $this->_file($id);
$boolRemove = $this->_remove($file);
$boolMetadata = $this->_delMetadatas($id);
return $boolMetadata && $boolRemove;
} | php | public function remove($id)
{
$file = $this->_file($id);
$boolRemove = $this->_remove($file);
$boolMetadata = $this->_delMetadatas($id);
return $boolMetadata && $boolRemove;
} | [
"public",
"function",
"remove",
"(",
"$",
"id",
")",
"{",
"$",
"file",
"=",
"$",
"this",
"->",
"_file",
"(",
"$",
"id",
")",
";",
"$",
"boolRemove",
"=",
"$",
"this",
"->",
"_remove",
"(",
"$",
"file",
")",
";",
"$",
"boolMetadata",
"=",
"$",
"... | Remove a cache record
@param string $id cache id
@return boolean true if no problem | [
"Remove",
"a",
"cache",
"record"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Cache/Backend/File.php#L259-L265 | train | Remove a file and its associated metadata | [
30522,
2270,
3853,
6366,
1006,
1002,
8909,
1007,
1063,
1002,
5371,
1027,
1002,
2023,
1011,
1028,
1035,
5371,
1006,
1002,
8909,
1007,
1025,
1002,
22017,
20974,
6633,
21818,
1027,
1002,
2023,
1011,
1028,
1035,
6366,
1006,
1002,
5371,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Cookie/CookieJar.php | CookieJar.make | public function make($name, $value, $minutes = 0, $path = null, $domain = null, $secure = null, $httpOnly = true, $raw = false, $sameSite = null)
{
[$path, $domain, $secure, $sameSite] = $this->getPathAndDomain($path, $domain, $secure, $sameSite);
$time = ($minutes == 0) ? 0 : $this->availableAt($minutes * 60);
return new Cookie($name, $value, $time, $path, $domain, $secure, $httpOnly, $raw, $sameSite);
} | php | public function make($name, $value, $minutes = 0, $path = null, $domain = null, $secure = null, $httpOnly = true, $raw = false, $sameSite = null)
{
[$path, $domain, $secure, $sameSite] = $this->getPathAndDomain($path, $domain, $secure, $sameSite);
$time = ($minutes == 0) ? 0 : $this->availableAt($minutes * 60);
return new Cookie($name, $value, $time, $path, $domain, $secure, $httpOnly, $raw, $sameSite);
} | [
"public",
"function",
"make",
"(",
"$",
"name",
",",
"$",
"value",
",",
"$",
"minutes",
"=",
"0",
",",
"$",
"path",
"=",
"null",
",",
"$",
"domain",
"=",
"null",
",",
"$",
"secure",
"=",
"null",
",",
"$",
"httpOnly",
"=",
"true",
",",
"$",
"raw... | Create a new cookie instance.
@param string $name
@param string $value
@param int $minutes
@param string $path
@param string $domain
@param bool|null $secure
@param bool $httpOnly
@param bool $raw
@param string|null $sameSite
@return \Symfony\Component\HttpFoundation\Cookie | [
"Create",
"a",
"new",
"cookie",
"instance",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Cookie/CookieJar.php#L64-L71 | train | Create a new cookie | [
30522,
2270,
3853,
2191,
1006,
1002,
2171,
1010,
1002,
3643,
1010,
1002,
2781,
30524,
2135,
1027,
2995,
1010,
1002,
6315,
1027,
6270,
1010,
1002,
2168,
28032,
2063,
1027,
19701,
1007,
1063,
1031,
1002,
4130,
1010,
1002,
5884,
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... |
getgrav/grav | system/src/Grav/Common/Plugins.php | Plugins.get | public static function get($name)
{
$blueprints = new Blueprints('plugins://');
$blueprint = $blueprints->get("{$name}/blueprints");
// Load default configuration.
$file = CompiledYamlFile::instance("plugins://{$name}/{$name}" . YAML_EXT);
// ensure this is a valid plugin
if (!$file->exists()) {
return null;
}
$obj = new Data((array)$file->content(), $blueprint);
// Override with user configuration.
$obj->merge(Grav::instance()['config']->get('plugins.' . $name) ?: []);
// Save configuration always to user/config.
$file = CompiledYamlFile::instance("config://plugins/{$name}.yaml");
$obj->file($file);
return $obj;
} | php | public static function get($name)
{
$blueprints = new Blueprints('plugins://');
$blueprint = $blueprints->get("{$name}/blueprints");
// Load default configuration.
$file = CompiledYamlFile::instance("plugins://{$name}/{$name}" . YAML_EXT);
// ensure this is a valid plugin
if (!$file->exists()) {
return null;
}
$obj = new Data((array)$file->content(), $blueprint);
// Override with user configuration.
$obj->merge(Grav::instance()['config']->get('plugins.' . $name) ?: []);
// Save configuration always to user/config.
$file = CompiledYamlFile::instance("config://plugins/{$name}.yaml");
$obj->file($file);
return $obj;
} | [
"public",
"static",
"function",
"get",
"(",
"$",
"name",
")",
"{",
"$",
"blueprints",
"=",
"new",
"Blueprints",
"(",
"'plugins://'",
")",
";",
"$",
"blueprint",
"=",
"$",
"blueprints",
"->",
"get",
"(",
"\"{$name}/blueprints\"",
")",
";",
"// Load default co... | Get a plugin by name
@param string $name
@return Data|null | [
"Get",
"a",
"plugin",
"by",
"name"
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Plugins.php#L158-L181 | train | Get a plugin by name | [
30522,
2270,
10763,
3853,
2131,
1006,
1002,
2171,
1007,
1063,
1002,
2630,
16550,
2015,
1027,
2047,
2630,
16550,
2015,
1006,
1005,
13354,
7076,
1024,
1013,
1013,
1005,
1007,
1025,
1002,
2630,
16550,
1027,
1002,
2630,
16550,
2015,
1011,
1028,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Cookie/Middleware/EncryptCookies.php | EncryptCookies.encrypt | protected function encrypt(Response $response)
{
foreach ($response->headers->getCookies() as $cookie) {
if ($this->isDisabled($cookie->getName())) {
continue;
}
$response->headers->setCookie($this->duplicate(
$cookie, $this->encrypter->encrypt($cookie->getValue(), static::serialized($cookie->getName()))
));
}
return $response;
} | php | protected function encrypt(Response $response)
{
foreach ($response->headers->getCookies() as $cookie) {
if ($this->isDisabled($cookie->getName())) {
continue;
}
$response->headers->setCookie($this->duplicate(
$cookie, $this->encrypter->encrypt($cookie->getValue(), static::serialized($cookie->getName()))
));
}
return $response;
} | [
"protected",
"function",
"encrypt",
"(",
"Response",
"$",
"response",
")",
"{",
"foreach",
"(",
"$",
"response",
"->",
"headers",
"->",
"getCookies",
"(",
")",
"as",
"$",
"cookie",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isDisabled",
"(",
"$",
"cookie... | Encrypt the cookies on an outgoing response.
@param \Symfony\Component\HttpFoundation\Response $response
@return \Symfony\Component\HttpFoundation\Response | [
"Encrypt",
"the",
"cookies",
"on",
"an",
"outgoing",
"response",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Cookie/Middleware/EncryptCookies.php#L131-L144 | train | Encrypts all cookies in response | [
30522,
5123,
3853,
4372,
26775,
22571,
2102,
1006,
3433,
1002,
3433,
1007,
1063,
18921,
6776,
1006,
1002,
3433,
1011,
1028,
20346,
2015,
1011,
1028,
2131,
3597,
23212,
2229,
1006,
1007,
2004,
1002,
17387,
1007,
1063,
2065,
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... |
symfony/symfony | src/Symfony/Component/Cache/Adapter/ChainAdapter.php | ChainAdapter.clear | public function clear()
{
$cleared = true;
$i = $this->adapterCount;
while ($i--) {
$cleared = $this->adapters[$i]->clear() && $cleared;
}
return $cleared;
} | php | public function clear()
{
$cleared = true;
$i = $this->adapterCount;
while ($i--) {
$cleared = $this->adapters[$i]->clear() && $cleared;
}
return $cleared;
} | [
"public",
"function",
"clear",
"(",
")",
"{",
"$",
"cleared",
"=",
"true",
";",
"$",
"i",
"=",
"$",
"this",
"->",
"adapterCount",
";",
"while",
"(",
"$",
"i",
"--",
")",
"{",
"$",
"cleared",
"=",
"$",
"this",
"->",
"adapters",
"[",
"$",
"i",
"]... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Cache/Adapter/ChainAdapter.php#L196-L206 | train | Clear all adapters | [
30522,
2270,
3853,
3154,
1006,
1007,
1063,
1002,
5985,
1027,
2995,
1025,
1002,
1045,
1027,
1002,
2023,
1011,
1028,
15581,
2121,
3597,
16671,
1025,
2096,
1006,
1002,
1045,
1011,
1011,
1007,
1063,
1002,
5985,
1027,
1002,
2023,
1011,
1028,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Queue/RedisQueue.php | RedisQueue.migrateExpiredJobs | public function migrateExpiredJobs($from, $to)
{
return $this->getConnection()->eval(
LuaScripts::migrateExpiredJobs(), 3, $from, $to, $to.':notify', $this->currentTime()
);
} | php | public function migrateExpiredJobs($from, $to)
{
return $this->getConnection()->eval(
LuaScripts::migrateExpiredJobs(), 3, $from, $to, $to.':notify', $this->currentTime()
);
} | [
"public",
"function",
"migrateExpiredJobs",
"(",
"$",
"from",
",",
"$",
"to",
")",
"{",
"return",
"$",
"this",
"->",
"getConnection",
"(",
")",
"->",
"eval",
"(",
"LuaScripts",
"::",
"migrateExpiredJobs",
"(",
")",
",",
"3",
",",
"$",
"from",
",",
"$",... | Migrate the delayed jobs that are ready to the regular queue.
@param string $from
@param string $to
@return array | [
"Migrate",
"the",
"delayed",
"jobs",
"that",
"are",
"ready",
"to",
"the",
"regular",
"queue",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Queue/RedisQueue.php#L205-L210 | train | Migrate expired jobs | [
30522,
2270,
3853,
22806,
10288,
21649,
5558,
5910,
1006,
1002,
2013,
1010,
1002,
2000,
1007,
1063,
2709,
1002,
2023,
1011,
1028,
2131,
8663,
2638,
7542,
1006,
1007,
1011,
1028,
9345,
2140,
1006,
11320,
3022,
23235,
2015,
1024,
1024,
22806,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Console/Parser.php | Parser.parameters | protected static function parameters(array $tokens)
{
$arguments = [];
$options = [];
foreach ($tokens as $token) {
if (preg_match('/-{2,}(.*)/', $token, $matches)) {
$options[] = static::parseOption($matches[1]);
} else {
$arguments[] = static::parseArgument($token);
}
}
return [$arguments, $options];
} | php | protected static function parameters(array $tokens)
{
$arguments = [];
$options = [];
foreach ($tokens as $token) {
if (preg_match('/-{2,}(.*)/', $token, $matches)) {
$options[] = static::parseOption($matches[1]);
} else {
$arguments[] = static::parseArgument($token);
}
}
return [$arguments, $options];
} | [
"protected",
"static",
"function",
"parameters",
"(",
"array",
"$",
"tokens",
")",
"{",
"$",
"arguments",
"=",
"[",
"]",
";",
"$",
"options",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"tokens",
"as",
"$",
"token",
")",
"{",
"if",
"(",
"preg_match",
... | Extract all of the parameters from the tokens.
@param array $tokens
@return array | [
"Extract",
"all",
"of",
"the",
"parameters",
"from",
"the",
"tokens",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Console/Parser.php#L60-L75 | train | Parse parameters from tokens | [
30522,
5123,
10763,
3853,
11709,
1006,
9140,
1002,
19204,
2015,
1007,
1063,
1002,
9918,
1027,
1031,
1033,
1025,
1002,
7047,
1027,
1031,
1033,
1025,
18921,
6776,
1006,
1002,
19204,
2015,
2004,
1002,
19204,
1007,
1063,
2065,
1006,
3653,
2290,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Protocol/Imap.php | Zend_Mail_Protocol_Imap.requestAndResponse | public function requestAndResponse($command, $tokens = array(), $dontParse = false)
{
$this->sendRequest($command, $tokens, $tag);
$response = $this->readResponse($tag, $dontParse);
return $response;
} | php | public function requestAndResponse($command, $tokens = array(), $dontParse = false)
{
$this->sendRequest($command, $tokens, $tag);
$response = $this->readResponse($tag, $dontParse);
return $response;
} | [
"public",
"function",
"requestAndResponse",
"(",
"$",
"command",
",",
"$",
"tokens",
"=",
"array",
"(",
")",
",",
"$",
"dontParse",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"sendRequest",
"(",
"$",
"command",
",",
"$",
"tokens",
",",
"$",
"tag",
")... | send a request and get response at once
@param string $command command as in sendRequest()
@param array $tokens parameters as in sendRequest()
@param bool $dontParse if true unparsed lines are returned instead of tokens
@return mixed response as in readResponse()
@throws Zend_Mail_Protocol_Exception | [
"send",
"a",
"request",
"and",
"get",
"response",
"at",
"once"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Mail/Protocol/Imap.php#L385-L391 | train | Sends a request and returns the response | [
30522,
2270,
3853,
5227,
5685,
6072,
26029,
3366,
1006,
1002,
3094,
1010,
1002,
19204,
2015,
1027,
9140,
1006,
1007,
1010,
1002,
2123,
25856,
11650,
2063,
1027,
6270,
1007,
1063,
1002,
2023,
1011,
1028,
4604,
2890,
15500,
1006,
1002,
3094,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/system/traits/ViewMaker.php | ViewMaker.makeFileContents | public function makeFileContents($filePath, $extraParams = [])
{
if (!strlen($filePath) ||
!File::isFile($filePath) ||
(!File::isLocalPath($filePath) && Config::get('cms.restrictBaseDir', true))
) {
return '';
}
if (!is_array($extraParams)) {
$extraParams = [];
}
$vars = array_merge($this->vars, $extraParams);
$obLevel = ob_get_level();
ob_start();
extract($vars);
// We'll evaluate the contents of the view inside a try/catch block so we can
// flush out any stray output that might get out before an error occurs or
// an exception is thrown. This prevents any partial views from leaking.
try {
include $filePath;
}
catch (Exception $e) {
$this->handleViewException($e, $obLevel);
}
catch (Throwable $e) {
$this->handleViewException(new FatalThrowableError($e), $obLevel);
}
return ob_get_clean();
} | php | public function makeFileContents($filePath, $extraParams = [])
{
if (!strlen($filePath) ||
!File::isFile($filePath) ||
(!File::isLocalPath($filePath) && Config::get('cms.restrictBaseDir', true))
) {
return '';
}
if (!is_array($extraParams)) {
$extraParams = [];
}
$vars = array_merge($this->vars, $extraParams);
$obLevel = ob_get_level();
ob_start();
extract($vars);
// We'll evaluate the contents of the view inside a try/catch block so we can
// flush out any stray output that might get out before an error occurs or
// an exception is thrown. This prevents any partial views from leaking.
try {
include $filePath;
}
catch (Exception $e) {
$this->handleViewException($e, $obLevel);
}
catch (Throwable $e) {
$this->handleViewException(new FatalThrowableError($e), $obLevel);
}
return ob_get_clean();
} | [
"public",
"function",
"makeFileContents",
"(",
"$",
"filePath",
",",
"$",
"extraParams",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"strlen",
"(",
"$",
"filePath",
")",
"||",
"!",
"File",
"::",
"isFile",
"(",
"$",
"filePath",
")",
"||",
"(",
"!",
"Fi... | Includes a file path using output buffering.
Ensures that vars are available.
@param string $filePath Absolute path to the view file.
@param array $extraParams Parameters that should be available to the view.
@return string | [
"Includes",
"a",
"file",
"path",
"using",
"output",
"buffering",
".",
"Ensures",
"that",
"vars",
"are",
"available",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/traits/ViewMaker.php#L222-L257 | train | Returns the contents of a view file | [
30522,
2270,
3853,
2191,
8873,
2571,
8663,
6528,
3215,
1006,
1002,
5371,
15069,
1010,
1002,
4469,
28689,
5244,
1027,
1031,
1033,
1007,
1063,
2065,
1006,
999,
2358,
20927,
2078,
1006,
1002,
5371,
15069,
1007,
1064,
1064,
999,
5371,
1024,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/backend/formwidgets/TagList.php | TagList.prepareVars | public function prepareVars()
{
$this->vars['placeholder'] = $this->placeholder;
$this->vars['useKey'] = $this->useKey;
$this->vars['field'] = $this->formField;
$this->vars['fieldOptions'] = $this->getFieldOptions();
$this->vars['selectedValues'] = $this->getLoadValue();
$this->vars['customSeparators'] = $this->getCustomSeparators();
} | php | public function prepareVars()
{
$this->vars['placeholder'] = $this->placeholder;
$this->vars['useKey'] = $this->useKey;
$this->vars['field'] = $this->formField;
$this->vars['fieldOptions'] = $this->getFieldOptions();
$this->vars['selectedValues'] = $this->getLoadValue();
$this->vars['customSeparators'] = $this->getCustomSeparators();
} | [
"public",
"function",
"prepareVars",
"(",
")",
"{",
"$",
"this",
"->",
"vars",
"[",
"'placeholder'",
"]",
"=",
"$",
"this",
"->",
"placeholder",
";",
"$",
"this",
"->",
"vars",
"[",
"'useKey'",
"]",
"=",
"$",
"this",
"->",
"useKey",
";",
"$",
"this",... | Prepares the form widget view data | [
"Prepares",
"the",
"form",
"widget",
"view",
"data"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/formwidgets/TagList.php#L93-L101 | train | Prepare form field variables | [
30522,
2270,
3853,
7374,
10755,
2015,
1006,
1007,
1063,
1002,
2023,
1011,
1028,
13075,
2015,
1031,
1005,
2173,
14528,
1005,
1033,
1027,
1002,
2023,
1011,
1028,
2173,
14528,
1025,
1002,
2023,
1011,
1028,
13075,
2015,
1031,
1005,
2224,
14839,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/Menu/MenuAbstract.php | MenuAbstract.menuCompare | protected function menuCompare($itemOne, $itemTwo)
{
if (!is_array($itemOne) && !is_array($itemTwo)) {
return 0;
}
if (!is_array($itemOne) && is_array($itemTwo)) {
return -1;
}
if (is_array($itemOne) && !is_array($itemTwo)) {
return 1;
}
if (!isset($itemOne['_order']) && !isset($itemTwo['_order'])) {
return 0;
}
if (!isset($itemOne['_order']) && isset($itemTwo['_order'])) {
return -1;
}
if (isset($itemOne['_order']) && !isset($itemTwo['_order'])) {
return 1;
}
if ($itemOne['_order'] == $itemTwo['_order']) {
return strcmp(
@$itemOne['_name'],
@$itemTwo['_name']);
}
return ($itemOne['_order'] < $itemTwo['_order']) ? -1 : 1;
} | php | protected function menuCompare($itemOne, $itemTwo)
{
if (!is_array($itemOne) && !is_array($itemTwo)) {
return 0;
}
if (!is_array($itemOne) && is_array($itemTwo)) {
return -1;
}
if (is_array($itemOne) && !is_array($itemTwo)) {
return 1;
}
if (!isset($itemOne['_order']) && !isset($itemTwo['_order'])) {
return 0;
}
if (!isset($itemOne['_order']) && isset($itemTwo['_order'])) {
return -1;
}
if (isset($itemOne['_order']) && !isset($itemTwo['_order'])) {
return 1;
}
if ($itemOne['_order'] == $itemTwo['_order']) {
return strcmp(
@$itemOne['_name'],
@$itemTwo['_name']);
}
return ($itemOne['_order'] < $itemTwo['_order']) ? -1 : 1;
} | [
"protected",
"function",
"menuCompare",
"(",
"$",
"itemOne",
",",
"$",
"itemTwo",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"itemOne",
")",
"&&",
"!",
"is_array",
"(",
"$",
"itemTwo",
")",
")",
"{",
"return",
"0",
";",
"}",
"if",
"(",
"!",
... | Compares two menu entries. Used for ordering.
@param array $itemOne
@param array $itemTwo
@return boolean | [
"Compares",
"two",
"menu",
"entries",
".",
"Used",
"for",
"ordering",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Menu/MenuAbstract.php#L332-L365 | train | Compare two menu items | [
30522,
5123,
3853,
12183,
9006,
19362,
2063,
1006,
1002,
8875,
5643,
1010,
1002,
8875,
2102,
12155,
1007,
1063,
2065,
1006,
999,
2003,
1035,
9140,
1006,
1002,
8875,
5643,
1007,
1004,
1004,
999,
2003,
1035,
9140,
1006,
1002,
8875,
2102,
12... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Cache/Adapter/ChainAdapter.php | ChainAdapter.commit | public function commit()
{
$committed = true;
$i = $this->adapterCount;
while ($i--) {
$committed = $this->adapters[$i]->commit() && $committed;
}
return $committed;
} | php | public function commit()
{
$committed = true;
$i = $this->adapterCount;
while ($i--) {
$committed = $this->adapters[$i]->commit() && $committed;
}
return $committed;
} | [
"public",
"function",
"commit",
"(",
")",
"{",
"$",
"committed",
"=",
"true",
";",
"$",
"i",
"=",
"$",
"this",
"->",
"adapterCount",
";",
"while",
"(",
"$",
"i",
"--",
")",
"{",
"$",
"committed",
"=",
"$",
"this",
"->",
"adapters",
"[",
"$",
"i",... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Cache/Adapter/ChainAdapter.php#L271-L281 | train | Commit all adapters | [
30522,
2270,
3853,
10797,
1006,
1007,
1063,
1002,
5462,
1027,
2995,
1025,
1002,
1045,
1027,
1002,
2023,
1011,
1028,
15581,
2121,
3597,
16671,
1025,
2096,
1006,
1002,
1045,
1011,
1011,
1007,
1063,
1002,
5462,
1027,
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... |
octobercms/october | modules/backend/traits/WidgetMaker.php | WidgetMaker.makeFormWidget | public function makeFormWidget($class, $fieldConfig = [], $widgetConfig = [])
{
$controller = property_exists($this, 'controller') && $this->controller
? $this->controller
: $this;
if (!class_exists($class)) {
throw new SystemException(Lang::get('backend::lang.widget.not_registered', [
'name' => $class
]));
}
if (is_string($fieldConfig)) {
$fieldConfig = ['name' => $fieldConfig];
}
if (is_array($fieldConfig)) {
$formField = new FormField(
array_get($fieldConfig, 'name'),
array_get($fieldConfig, 'label')
);
$formField->displayAs('widget', $fieldConfig);
}
else {
$formField = $fieldConfig;
}
return new $class($controller, $formField, $widgetConfig);
} | php | public function makeFormWidget($class, $fieldConfig = [], $widgetConfig = [])
{
$controller = property_exists($this, 'controller') && $this->controller
? $this->controller
: $this;
if (!class_exists($class)) {
throw new SystemException(Lang::get('backend::lang.widget.not_registered', [
'name' => $class
]));
}
if (is_string($fieldConfig)) {
$fieldConfig = ['name' => $fieldConfig];
}
if (is_array($fieldConfig)) {
$formField = new FormField(
array_get($fieldConfig, 'name'),
array_get($fieldConfig, 'label')
);
$formField->displayAs('widget', $fieldConfig);
}
else {
$formField = $fieldConfig;
}
return new $class($controller, $formField, $widgetConfig);
} | [
"public",
"function",
"makeFormWidget",
"(",
"$",
"class",
",",
"$",
"fieldConfig",
"=",
"[",
"]",
",",
"$",
"widgetConfig",
"=",
"[",
"]",
")",
"{",
"$",
"controller",
"=",
"property_exists",
"(",
"$",
"this",
",",
"'controller'",
")",
"&&",
"$",
"thi... | Makes a form widget object with the supplied form field and widget configuration.
@param string $class Widget class name
@param mixed $fieldConfig A field name, an array of config or a FormField object.
@param array $widgetConfig An array of config.
@return \Backend\Classes\FormWidgetBase The widget object | [
"Makes",
"a",
"form",
"widget",
"object",
"with",
"the",
"supplied",
"form",
"field",
"and",
"widget",
"configuration",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/traits/WidgetMaker.php#L46-L74 | train | Create a FormWidget | [
30522,
2270,
3853,
2191,
14192,
9148,
24291,
1006,
1002,
2465,
1010,
1002,
2492,
8663,
8873,
2290,
1027,
1031,
1033,
1010,
1002,
15536,
24291,
8663,
8873,
2290,
1027,
1031,
1033,
1007,
1063,
1002,
11486,
1027,
3200,
1035,
6526,
1006,
1002,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/UsersManager/API.php | API.userEmailExists | public function userEmailExists($userEmail)
{
Piwik::checkUserIsNotAnonymous();
Piwik::checkUserHasSomeViewAccess();
return $this->model->userEmailExists($userEmail);
} | php | public function userEmailExists($userEmail)
{
Piwik::checkUserIsNotAnonymous();
Piwik::checkUserHasSomeViewAccess();
return $this->model->userEmailExists($userEmail);
} | [
"public",
"function",
"userEmailExists",
"(",
"$",
"userEmail",
")",
"{",
"Piwik",
"::",
"checkUserIsNotAnonymous",
"(",
")",
";",
"Piwik",
"::",
"checkUserHasSomeViewAccess",
"(",
")",
";",
"return",
"$",
"this",
"->",
"model",
"->",
"userEmailExists",
"(",
"... | Returns true if user with given email (userEmail) is known in the database, or the Super User
@param string $userEmail
@return bool true if the user is known | [
"Returns",
"true",
"if",
"user",
"with",
"given",
"email",
"(",
"userEmail",
")",
"is",
"known",
"in",
"the",
"database",
"or",
"the",
"Super",
"User"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/UsersManager/API.php#L997-L1003 | train | Checks if a user email exists in the database | [
30522,
2270,
3853,
5310,
14545,
9463,
9048,
12837,
1006,
1002,
5310,
14545,
4014,
1007,
1063,
14255,
9148,
2243,
1024,
1024,
4638,
20330,
2483,
17048,
6761,
4890,
30524,
12837,
1006,
1002,
5310,
14545,
4014,
1007,
1025,
1065,
102,
0,
0,
0... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/AssetManager.php | AssetManager.getJsInclusionDirective | public function getJsInclusionDirective()
{
$result = "<script type=\"text/javascript\">\n" . Translate::getJavascriptTranslations() . "\n</script>";
if ($this->isMergedAssetsDisabled()) {
$this->getMergedCoreJSAsset()->delete();
$this->getMergedNonCoreJSAsset()->delete();
$result .= $this->getIndividualCoreAndNonCoreJsIncludes();
} else {
$result .= sprintf(self::JS_IMPORT_DIRECTIVE, self::GET_CORE_JS_MODULE_ACTION);
$result .= sprintf(self::JS_IMPORT_DIRECTIVE, self::GET_NON_CORE_JS_MODULE_ACTION);
}
return $result;
} | php | public function getJsInclusionDirective()
{
$result = "<script type=\"text/javascript\">\n" . Translate::getJavascriptTranslations() . "\n</script>";
if ($this->isMergedAssetsDisabled()) {
$this->getMergedCoreJSAsset()->delete();
$this->getMergedNonCoreJSAsset()->delete();
$result .= $this->getIndividualCoreAndNonCoreJsIncludes();
} else {
$result .= sprintf(self::JS_IMPORT_DIRECTIVE, self::GET_CORE_JS_MODULE_ACTION);
$result .= sprintf(self::JS_IMPORT_DIRECTIVE, self::GET_NON_CORE_JS_MODULE_ACTION);
}
return $result;
} | [
"public",
"function",
"getJsInclusionDirective",
"(",
")",
"{",
"$",
"result",
"=",
"\"<script type=\\\"text/javascript\\\">\\n\"",
".",
"Translate",
"::",
"getJavascriptTranslations",
"(",
")",
".",
"\"\\n</script>\"",
";",
"if",
"(",
"$",
"this",
"->",
"isMergedAsse... | Return JS file inclusion directive(s) using the markup <script>
@return string | [
"Return",
"JS",
"file",
"inclusion",
"directive",
"(",
"s",
")",
"using",
"the",
"markup",
"<script",
">"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/AssetManager.php#L119-L134 | train | Get JavaScript inclusion directive | [
30522,
2270,
3853,
2131,
22578,
2378,
20464,
14499,
4305,
2890,
15277,
1006,
1007,
1063,
1002,
2765,
1027,
1000,
1026,
5896,
2828,
1027,
1032,
1000,
3793,
1013,
9262,
22483,
1032,
1000,
1028,
1032,
1050,
1000,
1012,
17637,
1024,
1024,
2131,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Handler/PdoSessionHandler.php | PdoSessionHandler.rollback | private function rollback()
{
// We only need to rollback if we are in a transaction. Otherwise the resulting
// error would hide the real problem why rollback was called. We might not be
// in a transaction when not using the transactional locking behavior or when
// two callbacks (e.g. destroy and write) are invoked that both fail.
if ($this->inTransaction) {
if ('sqlite' === $this->driver) {
$this->pdo->exec('ROLLBACK');
} else {
$this->pdo->rollBack();
}
$this->inTransaction = false;
}
} | php | private function rollback()
{
// We only need to rollback if we are in a transaction. Otherwise the resulting
// error would hide the real problem why rollback was called. We might not be
// in a transaction when not using the transactional locking behavior or when
// two callbacks (e.g. destroy and write) are invoked that both fail.
if ($this->inTransaction) {
if ('sqlite' === $this->driver) {
$this->pdo->exec('ROLLBACK');
} else {
$this->pdo->rollBack();
}
$this->inTransaction = false;
}
} | [
"private",
"function",
"rollback",
"(",
")",
"{",
"// We only need to rollback if we are in a transaction. Otherwise the resulting",
"// error would hide the real problem why rollback was called. We might not be",
"// in a transaction when not using the transactional locking behavior or when",
"//... | Helper method to rollback a transaction. | [
"Helper",
"method",
"to",
"rollback",
"a",
"transaction",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php#L584-L598 | train | Rollbacks the transaction if we are in a transaction | [
30522,
2797,
3853,
4897,
5963,
1006,
1007,
1063,
1013,
1013,
2057,
2069,
2342,
2000,
4897,
5963,
2065,
2057,
2024,
1999,
1037,
12598,
1012,
4728,
1996,
4525,
1013,
1013,
7561,
2052,
5342,
1996,
2613,
3291,
2339,
4897,
5963,
2001,
2170,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Queue/BeanstalkdQueue.php | BeanstalkdQueue.size | public function size($queue = null)
{
$queue = $this->getQueue($queue);
return (int) $this->pheanstalk->statsTube($queue)->current_jobs_ready;
} | php | public function size($queue = null)
{
$queue = $this->getQueue($queue);
return (int) $this->pheanstalk->statsTube($queue)->current_jobs_ready;
} | [
"public",
"function",
"size",
"(",
"$",
"queue",
"=",
"null",
")",
"{",
"$",
"queue",
"=",
"$",
"this",
"->",
"getQueue",
"(",
"$",
"queue",
")",
";",
"return",
"(",
"int",
")",
"$",
"this",
"->",
"pheanstalk",
"->",
"statsTube",
"(",
"$",
"queue",... | Get the size of the queue.
@param string $queue
@return int | [
"Get",
"the",
"size",
"of",
"the",
"queue",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Queue/BeanstalkdQueue.php#L63-L68 | train | Get the number of jobs ready | [
30522,
2270,
3853,
2946,
1006,
1002,
24240,
1027,
19701,
1007,
1063,
1002,
24240,
1027,
1002,
2023,
1011,
1028,
2131,
4226,
5657,
1006,
1002,
24240,
1007,
1025,
2709,
1006,
20014,
1007,
1002,
2023,
1011,
1028,
6887,
11219,
9153,
13687,
1011... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/Mail.php | Mail.sanitiseString | function sanitiseString($string)
{
$search = array('–', '’');
$replace = array('-', '\'');
$string = str_replace($search, $replace, $string);
return $string;
} | php | function sanitiseString($string)
{
$search = array('–', '’');
$replace = array('-', '\'');
$string = str_replace($search, $replace, $string);
return $string;
} | [
"function",
"sanitiseString",
"(",
"$",
"string",
")",
"{",
"$",
"search",
"=",
"array",
"(",
"'–', ",
"'",
"');",
"",
"",
"$",
"replace",
"=",
"array",
"(",
"'-'",
",",
"'\\''",
")",
";",
"$",
"string",
"=",
"str_replace",
"(",
"$",
"search",
",",... | Replaces characters known to appear incorrectly in some email clients
@param $string
@return mixed | [
"Replaces",
"characters",
"known",
"to",
"appear",
"incorrectly",
"in",
"some",
"email",
"clients"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Mail.php#L184-L190 | train | Sanitize a string | [
30522,
3853,
2624,
13706,
4355,
4892,
1006,
1002,
5164,
1007,
1063,
1002,
3945,
1027,
9140,
1006,
1005,
1516,
1005,
1010,
1005,
1521,
1005,
1007,
1025,
1002,
5672,
1027,
9140,
1006,
1005,
1011,
1005,
1010,
1005,
1032,
1005,
1005,
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/VarDumper/Dumper/HtmlDumper.php | HtmlDumper.setDisplayOptions | public function setDisplayOptions(array $displayOptions)
{
$this->headerIsDumped = false;
$this->displayOptions = $displayOptions + $this->displayOptions;
} | php | public function setDisplayOptions(array $displayOptions)
{
$this->headerIsDumped = false;
$this->displayOptions = $displayOptions + $this->displayOptions;
} | [
"public",
"function",
"setDisplayOptions",
"(",
"array",
"$",
"displayOptions",
")",
"{",
"$",
"this",
"->",
"headerIsDumped",
"=",
"false",
";",
"$",
"this",
"->",
"displayOptions",
"=",
"$",
"displayOptions",
"+",
"$",
"this",
"->",
"displayOptions",
";",
... | Configures display options.
@param array $displayOptions A map of display options to customize the behavior | [
"Configures",
"display",
"options",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php#L111-L115 | train | Set the display options for the page | [
30522,
2270,
3853,
2275,
10521,
13068,
7361,
9285,
1006,
9140,
1002,
4653,
7361,
9285,
1007,
1063,
1002,
2023,
1011,
1028,
20346,
2483,
8566,
8737,
2098,
1027,
6270,
1025,
1002,
2023,
1011,
1028,
4653,
7361,
9285,
1027,
1002,
4653,
7361,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/DataTable/Row.php | Row.addColumns | public function addColumns($columns)
{
foreach ($columns as $name => $value) {
try {
$this->addColumn($name, $value);
} catch (Exception $e) {
}
}
if (!empty($e)) {
throw $e;
}
} | php | public function addColumns($columns)
{
foreach ($columns as $name => $value) {
try {
$this->addColumn($name, $value);
} catch (Exception $e) {
}
}
if (!empty($e)) {
throw $e;
}
} | [
"public",
"function",
"addColumns",
"(",
"$",
"columns",
")",
"{",
"foreach",
"(",
"$",
"columns",
"as",
"$",
"name",
"=>",
"$",
"value",
")",
"{",
"try",
"{",
"$",
"this",
"->",
"addColumn",
"(",
"$",
"name",
",",
"$",
"value",
")",
";",
"}",
"c... | Add many columns to this row.
@param array $columns Name/Value pairs, e.g., `array('name' => $value , ...)`
@throws Exception if any column name does not exist.
@return void | [
"Add",
"many",
"columns",
"to",
"this",
"row",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/DataTable/Row.php#L406-L418 | train | Add Columns to the Grammar | [
30522,
2270,
3853,
5587,
25778,
2819,
3619,
1006,
1002,
7753,
1007,
1063,
18921,
6776,
1006,
1002,
7753,
30524,
1007,
1063,
3046,
1063,
1002,
2023,
1011,
1028,
5587,
25778,
2819,
2078,
1006,
1002,
2171,
1010,
1002,
3643,
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/Bundle/SecurityBundle/DependencyInjection/Compiler/AddSessionDomainConstraintPass.php | AddSessionDomainConstraintPass.process | public function process(ContainerBuilder $container)
{
if (!$container->hasParameter('session.storage.options') || !$container->has('security.http_utils')) {
return;
}
$sessionOptions = $container->getParameter('session.storage.options');
$domainRegexp = empty($sessionOptions['cookie_domain']) ? '%s' : sprintf('(?:%%s|(?:.+\.)?%s)', preg_quote(trim($sessionOptions['cookie_domain'], '.')));
if ('auto' === ($sessionOptions['cookie_secure'] ?? null)) {
$secureDomainRegexp = sprintf('{^https://%s$}i', $domainRegexp);
$domainRegexp = 'https?://'.$domainRegexp;
} else {
$secureDomainRegexp = null;
$domainRegexp = (empty($sessionOptions['cookie_secure']) ? 'https?://' : 'https://').$domainRegexp;
}
$container->findDefinition('security.http_utils')
->addArgument(sprintf('{^%s$}i', $domainRegexp))
->addArgument($secureDomainRegexp);
} | php | public function process(ContainerBuilder $container)
{
if (!$container->hasParameter('session.storage.options') || !$container->has('security.http_utils')) {
return;
}
$sessionOptions = $container->getParameter('session.storage.options');
$domainRegexp = empty($sessionOptions['cookie_domain']) ? '%s' : sprintf('(?:%%s|(?:.+\.)?%s)', preg_quote(trim($sessionOptions['cookie_domain'], '.')));
if ('auto' === ($sessionOptions['cookie_secure'] ?? null)) {
$secureDomainRegexp = sprintf('{^https://%s$}i', $domainRegexp);
$domainRegexp = 'https?://'.$domainRegexp;
} else {
$secureDomainRegexp = null;
$domainRegexp = (empty($sessionOptions['cookie_secure']) ? 'https?://' : 'https://').$domainRegexp;
}
$container->findDefinition('security.http_utils')
->addArgument(sprintf('{^%s$}i', $domainRegexp))
->addArgument($secureDomainRegexp);
} | [
"public",
"function",
"process",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"if",
"(",
"!",
"$",
"container",
"->",
"hasParameter",
"(",
"'session.storage.options'",
")",
"||",
"!",
"$",
"container",
"->",
"has",
"(",
"'security.http_utils'",
")",
")... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Compiler/AddSessionDomainConstraintPass.php#L27-L47 | train | Adds the session domain and secure cookie domain to the security. http_utils security service. | [
30522,
2270,
3853,
2832,
1006,
11661,
8569,
23891,
2099,
1002,
11661,
1007,
1063,
2065,
1006,
999,
1002,
11661,
1011,
1028,
2038,
28689,
22828,
1006,
1005,
5219,
1012,
5527,
1012,
7047,
1005,
1007,
1064,
1064,
999,
1002,
11661,
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... |
getgrav/grav | system/src/Grav/Common/Page/Pages.php | Pages.resetPages | public function resetPages($pages_dir)
{
$this->recurse($pages_dir);
$this->buildRoutes();
// cache if needed
if ($this->grav['config']->get('system.cache.enabled')) {
/** @var Cache $cache */
$cache = $this->grav['cache'];
/** @var Taxonomy $taxonomy */
$taxonomy = $this->grav['taxonomy'];
// save pages, routes, taxonomy, and sort to cache
$cache->save($this->pages_cache_id, [$this->instances, $this->routes, $this->children, $taxonomy->taxonomy(), $this->sort]);
}
} | php | public function resetPages($pages_dir)
{
$this->recurse($pages_dir);
$this->buildRoutes();
// cache if needed
if ($this->grav['config']->get('system.cache.enabled')) {
/** @var Cache $cache */
$cache = $this->grav['cache'];
/** @var Taxonomy $taxonomy */
$taxonomy = $this->grav['taxonomy'];
// save pages, routes, taxonomy, and sort to cache
$cache->save($this->pages_cache_id, [$this->instances, $this->routes, $this->children, $taxonomy->taxonomy(), $this->sort]);
}
} | [
"public",
"function",
"resetPages",
"(",
"$",
"pages_dir",
")",
"{",
"$",
"this",
"->",
"recurse",
"(",
"$",
"pages_dir",
")",
";",
"$",
"this",
"->",
"buildRoutes",
"(",
")",
";",
"// cache if needed",
"if",
"(",
"$",
"this",
"->",
"grav",
"[",
"'conf... | Accessible method to manually reset the pages cache
@param string $pages_dir | [
"Accessible",
"method",
"to",
"manually",
"reset",
"the",
"pages",
"cache"
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Pages.php#L1002-L1017 | train | Recurse through pages and build routes and save to cache | [
30522,
2270,
3853,
25141,
13704,
2015,
1006,
1002,
5530,
1035,
16101,
1007,
1063,
1002,
2023,
1011,
1028,
28667,
28393,
1006,
1002,
5530,
1035,
16101,
1007,
1025,
1002,
2023,
1011,
1028,
3857,
22494,
4570,
1006,
1007,
1025,
1013,
1013,
1705... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/SessionValueResolver.php | SessionValueResolver.supports | public function supports(Request $request, ArgumentMetadata $argument)
{
if (!$request->hasSession()) {
return false;
}
$type = $argument->getType();
if (SessionInterface::class !== $type && !is_subclass_of($type, SessionInterface::class)) {
return false;
}
return $request->getSession() instanceof $type;
} | php | public function supports(Request $request, ArgumentMetadata $argument)
{
if (!$request->hasSession()) {
return false;
}
$type = $argument->getType();
if (SessionInterface::class !== $type && !is_subclass_of($type, SessionInterface::class)) {
return false;
}
return $request->getSession() instanceof $type;
} | [
"public",
"function",
"supports",
"(",
"Request",
"$",
"request",
",",
"ArgumentMetadata",
"$",
"argument",
")",
"{",
"if",
"(",
"!",
"$",
"request",
"->",
"hasSession",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"type",
"=",
"$",
"argument"... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/SessionValueResolver.php#L29-L41 | train | Returns true if the session supports the given request and argument metadata | [
30522,
2270,
3853,
6753,
1006,
5227,
1002,
5227,
1010,
6685,
11368,
8447,
2696,
1002,
6685,
1007,
1063,
2065,
1006,
999,
1002,
5227,
30524,
1006,
1002,
2828,
1010,
5219,
18447,
2121,
12172,
1024,
1024,
2465,
1007,
1007,
1063,
2709,
6270,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Mail/TransportManager.php | TransportManager.createSesDriver | protected function createSesDriver()
{
$config = array_merge($this->app['config']->get('services.ses', []), [
'version' => 'latest', 'service' => 'email',
]);
return new SesTransport(
new SesClient($this->addSesCredentials($config)),
$config['options'] ?? []
);
} | php | protected function createSesDriver()
{
$config = array_merge($this->app['config']->get('services.ses', []), [
'version' => 'latest', 'service' => 'email',
]);
return new SesTransport(
new SesClient($this->addSesCredentials($config)),
$config['options'] ?? []
);
} | [
"protected",
"function",
"createSesDriver",
"(",
")",
"{",
"$",
"config",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"app",
"[",
"'config'",
"]",
"->",
"get",
"(",
"'services.ses'",
",",
"[",
"]",
")",
",",
"[",
"'version'",
"=>",
"'latest'",
",",
"'s... | Create an instance of the Amazon SES Swift Transport driver.
@return \Illuminate\Mail\Transport\SesTransport | [
"Create",
"an",
"instance",
"of",
"the",
"Amazon",
"SES",
"Swift",
"Transport",
"driver",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Mail/TransportManager.php#L75-L85 | train | Create a SesTransport | [
30522,
5123,
3853,
9005,
2229,
23663,
2099,
1006,
1007,
1063,
1002,
9530,
8873,
2290,
1027,
9140,
1035,
13590,
1006,
1002,
2023,
1011,
1028,
10439,
1031,
1005,
9530,
8873,
2290,
1005,
1033,
1011,
1028,
2131,
1006,
1005,
2578,
1012,
7367,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/models/ExportModel.php | ExportModel.encodeArrayValue | protected function encodeArrayValue($data, $delimeter = '|')
{
$newData = [];
foreach ($data as $value) {
if (is_array($value)) {
$newData[] = 'Array';
}
else {
$newData[] = str_replace($delimeter, '\\'.$delimeter, $value);
}
}
return implode($delimeter, $newData);
} | php | protected function encodeArrayValue($data, $delimeter = '|')
{
$newData = [];
foreach ($data as $value) {
if (is_array($value)) {
$newData[] = 'Array';
}
else {
$newData[] = str_replace($delimeter, '\\'.$delimeter, $value);
}
}
return implode($delimeter, $newData);
} | [
"protected",
"function",
"encodeArrayValue",
"(",
"$",
"data",
",",
"$",
"delimeter",
"=",
"'|'",
")",
"{",
"$",
"newData",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"data",
"as",
"$",
"value",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"value",
")"... | Implodes a single dimension array using pipes (|)
Multi dimensional arrays are not allowed.
@return string | [
"Implodes",
"a",
"single",
"dimension",
"array",
"using",
"pipes",
"(",
"|",
")",
"Multi",
"dimensional",
"arrays",
"are",
"not",
"allowed",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/models/ExportModel.php#L190-L203 | train | Encode array value | [
30522,
5123,
3853,
4372,
16044,
2906,
9447,
10175,
5657,
1006,
1002,
2951,
1010,
1002,
3972,
19198,
1027,
1005,
1064,
1005,
1007,
1063,
1002,
2047,
2850,
2696,
1027,
1031,
1033,
1025,
18921,
6776,
1006,
1002,
2951,
2004,
1002,
3643,
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... |
z-song/laravel-admin | src/Grid.php | Grid.build | public function build()
{
if ($this->builded) {
return;
}
$collection = $this->processFilter(false);
$data = $collection->toArray();
$this->prependRowSelectorColumn();
$this->appendActionsColumn();
Column::setOriginalGridModels($collection);
$this->columns->map(function (Column $column) use (&$data) {
$data = $column->fill($data);
$this->columnNames[] = $column->getName();
});
$this->buildRows($data);
$this->builded = true;
} | php | public function build()
{
if ($this->builded) {
return;
}
$collection = $this->processFilter(false);
$data = $collection->toArray();
$this->prependRowSelectorColumn();
$this->appendActionsColumn();
Column::setOriginalGridModels($collection);
$this->columns->map(function (Column $column) use (&$data) {
$data = $column->fill($data);
$this->columnNames[] = $column->getName();
});
$this->buildRows($data);
$this->builded = true;
} | [
"public",
"function",
"build",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"builded",
")",
"{",
"return",
";",
"}",
"$",
"collection",
"=",
"$",
"this",
"->",
"processFilter",
"(",
"false",
")",
";",
"$",
"data",
"=",
"$",
"collection",
"->",
"toA... | Build the grid.
@return void | [
"Build",
"the",
"grid",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid.php#L569-L593 | train | Build rows from filter | [
30522,
2270,
3853,
3857,
1006,
1007,
1063,
2065,
1006,
1002,
2023,
1011,
1028,
3857,
2098,
1007,
1063,
2709,
1025,
1065,
1002,
3074,
1027,
1002,
2023,
1011,
1028,
2832,
8873,
21928,
1006,
6270,
1007,
1025,
1002,
2951,
1027,
1002,
3074,
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 | plugins/CoreHome/DataTableRowAction/RowEvolution.php | RowEvolution.getRowEvolutionGraph | public function getRowEvolutionGraph($graphType = false, $metrics = false)
{
// set up the view data table
$view = Factory::build($graphType ? : $this->graphType, $this->apiMethod,
$controllerAction = 'CoreHome.getRowEvolutionGraph', $forceDefault = true);
$view->setDataTable($this->dataTable);
if (!empty($this->graphMetrics)) { // In row Evolution popover, this is empty
$view->config->columns_to_display = array_keys($metrics ? : $this->graphMetrics);
}
$view->requestConfig->request_parameters_to_modify['label'] = '';
$view->config->show_goals = false;
$view->config->show_search = false;
$view->config->show_all_views_icons = false;
$view->config->show_related_reports = false;
$view->config->show_series_picker = false;
$view->config->show_footer_message = false;
foreach ($this->availableMetrics as $metric => $metadata) {
$view->config->translations[$metric] = $metadata['name'];
}
$view->config->external_series_toggle = 'RowEvolutionSeriesToggle';
$view->config->external_series_toggle_show_all = $this->initiallyShowAllMetrics;
return $view;
} | php | public function getRowEvolutionGraph($graphType = false, $metrics = false)
{
// set up the view data table
$view = Factory::build($graphType ? : $this->graphType, $this->apiMethod,
$controllerAction = 'CoreHome.getRowEvolutionGraph', $forceDefault = true);
$view->setDataTable($this->dataTable);
if (!empty($this->graphMetrics)) { // In row Evolution popover, this is empty
$view->config->columns_to_display = array_keys($metrics ? : $this->graphMetrics);
}
$view->requestConfig->request_parameters_to_modify['label'] = '';
$view->config->show_goals = false;
$view->config->show_search = false;
$view->config->show_all_views_icons = false;
$view->config->show_related_reports = false;
$view->config->show_series_picker = false;
$view->config->show_footer_message = false;
foreach ($this->availableMetrics as $metric => $metadata) {
$view->config->translations[$metric] = $metadata['name'];
}
$view->config->external_series_toggle = 'RowEvolutionSeriesToggle';
$view->config->external_series_toggle_show_all = $this->initiallyShowAllMetrics;
return $view;
} | [
"public",
"function",
"getRowEvolutionGraph",
"(",
"$",
"graphType",
"=",
"false",
",",
"$",
"metrics",
"=",
"false",
")",
"{",
"// set up the view data table",
"$",
"view",
"=",
"Factory",
"::",
"build",
"(",
"$",
"graphType",
"?",
":",
"$",
"this",
"->",
... | Generic method to get an evolution graph or a sparkline for the row evolution popover.
Do as much as possible from outside the controller.
@param string|bool $graphType
@param array|bool $metrics
@return Factory | [
"Generic",
"method",
"to",
"get",
"an",
"evolution",
"graph",
"or",
"a",
"sparkline",
"for",
"the",
"row",
"evolution",
"popover",
".",
"Do",
"as",
"much",
"as",
"possible",
"from",
"outside",
"the",
"controller",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/CoreHome/DataTableRowAction/RowEvolution.php#L197-L224 | train | Get the row evolution graph | [
30522,
2270,
3853,
2131,
10524,
6777,
4747,
13700,
14413,
1006,
1002,
10629,
13874,
1027,
6270,
1010,
1002,
12046,
2015,
1027,
6270,
1007,
1063,
1013,
1013,
2275,
2039,
1996,
3193,
2951,
2795,
1002,
3193,
1027,
4713,
1024,
1024,
3857,
1006,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getgrav/grav | system/src/Grav/Common/Twig/TwigExtension.php | TwigExtension.modulusFilter | public function modulusFilter($number, $divider, $items = null)
{
if (\is_string($number)) {
$number = strlen($number);
}
$remainder = $number % $divider;
if (\is_array($items)) {
return $items[$remainder] ?? $items[0];
}
return $remainder;
} | php | public function modulusFilter($number, $divider, $items = null)
{
if (\is_string($number)) {
$number = strlen($number);
}
$remainder = $number % $divider;
if (\is_array($items)) {
return $items[$remainder] ?? $items[0];
}
return $remainder;
} | [
"public",
"function",
"modulusFilter",
"(",
"$",
"number",
",",
"$",
"divider",
",",
"$",
"items",
"=",
"null",
")",
"{",
"if",
"(",
"\\",
"is_string",
"(",
"$",
"number",
")",
")",
"{",
"$",
"number",
"=",
"strlen",
"(",
"$",
"number",
")",
";",
... | Returns the modulus of an integer
@param string|int $number
@param int $divider
@param array $items array of items to select from to return
@return int | [
"Returns",
"the",
"modulus",
"of",
"an",
"integer"
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Twig/TwigExtension.php#L283-L296 | train | Returns the modulus of the number | [
30522,
2270,
3853,
16913,
11627,
8873,
21928,
1006,
1002,
2193,
1010,
1002,
11443,
2099,
1010,
1002,
5167,
1027,
19701,
1007,
1063,
2065,
1006,
1032,
2003,
1035,
5164,
1006,
1002,
2193,
1007,
1007,
1063,
1002,
2193,
1027,
2358,
20927,
2078,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Database/Query/Builder.php | Builder.get | public function get($columns = ['*'])
{
return collect($this->onceWithColumns(Arr::wrap($columns), function () {
return $this->processor->processSelect($this, $this->runSelect());
}));
} | php | public function get($columns = ['*'])
{
return collect($this->onceWithColumns(Arr::wrap($columns), function () {
return $this->processor->processSelect($this, $this->runSelect());
}));
} | [
"public",
"function",
"get",
"(",
"$",
"columns",
"=",
"[",
"'*'",
"]",
")",
"{",
"return",
"collect",
"(",
"$",
"this",
"->",
"onceWithColumns",
"(",
"Arr",
"::",
"wrap",
"(",
"$",
"columns",
")",
",",
"function",
"(",
")",
"{",
"return",
"$",
"th... | Execute the query as a "select" statement.
@param array|string $columns
@return \Illuminate\Support\Collection | [
"Execute",
"the",
"query",
"as",
"a",
"select",
"statement",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Query/Builder.php#L2109-L2114 | train | Get all records from the database. | [
30522,
2270,
3853,
2131,
1006,
1002,
7753,
1027,
1031,
1005,
1008,
1005,
1033,
1007,
1063,
2709,
8145,
1006,
1002,
2023,
1011,
1028,
2320,
24415,
25778,
2819,
3619,
1006,
12098,
2099,
1024,
1024,
10236,
1006,
1002,
7753,
1007,
1010,
3853,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/Zend/Cache/Frontend/Page.php | Zend_Cache_Frontend_Page._flush | public function _flush($data)
{
if ($this->_cancel) {
return $data;
}
$contentType = null;
$storedHeaders = array();
$headersList = headers_list();
foreach($this->_specificOptions['memorize_headers'] as $key=>$headerName) {
foreach ($headersList as $headerSent) {
$tmp = explode(':', $headerSent);
$headerSentName = trim(array_shift($tmp));
if (strtolower($headerName) == strtolower($headerSentName)) {
$headerSentValue = trim(implode(':', $tmp));
$storedHeaders[] = array($headerSentName, $headerSentValue);
}
}
}
$array = array(
'data' => $data,
'headers' => $storedHeaders
);
$this->save($array, null, $this->_activeOptions['tags'], $this->_activeOptions['specific_lifetime'], $this->_activeOptions['priority']);
return $data;
} | php | public function _flush($data)
{
if ($this->_cancel) {
return $data;
}
$contentType = null;
$storedHeaders = array();
$headersList = headers_list();
foreach($this->_specificOptions['memorize_headers'] as $key=>$headerName) {
foreach ($headersList as $headerSent) {
$tmp = explode(':', $headerSent);
$headerSentName = trim(array_shift($tmp));
if (strtolower($headerName) == strtolower($headerSentName)) {
$headerSentValue = trim(implode(':', $tmp));
$storedHeaders[] = array($headerSentName, $headerSentValue);
}
}
}
$array = array(
'data' => $data,
'headers' => $storedHeaders
);
$this->save($array, null, $this->_activeOptions['tags'], $this->_activeOptions['specific_lifetime'], $this->_activeOptions['priority']);
return $data;
} | [
"public",
"function",
"_flush",
"(",
"$",
"data",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_cancel",
")",
"{",
"return",
"$",
"data",
";",
"}",
"$",
"contentType",
"=",
"null",
";",
"$",
"storedHeaders",
"=",
"array",
"(",
")",
";",
"$",
"headersLi... | callback for output buffering
(shouldn't really be called manually)
@param string $data Buffered output
@return string Data to send to browser | [
"callback",
"for",
"output",
"buffering",
"(",
"shouldn",
"t",
"really",
"be",
"called",
"manually",
")"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Cache/Frontend/Page.php#L309-L333 | train | Flushes the data to the cache | [
30522,
2270,
3853,
1035,
13862,
1006,
1002,
2951,
1007,
1063,
2065,
1006,
30524,
1002,
4180,
13874,
1027,
19701,
1025,
1002,
8250,
4974,
2545,
1027,
9140,
1006,
1007,
1025,
1002,
20346,
14540,
2923,
1027,
20346,
2015,
1035,
2862,
1006,
1007... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Stopwatch/Section.php | Section.startEvent | public function startEvent($name, $category)
{
if (!isset($this->events[$name])) {
$this->events[$name] = new StopwatchEvent($this->origin ?: microtime(true) * 1000, $category, $this->morePrecision);
}
return $this->events[$name]->start();
} | php | public function startEvent($name, $category)
{
if (!isset($this->events[$name])) {
$this->events[$name] = new StopwatchEvent($this->origin ?: microtime(true) * 1000, $category, $this->morePrecision);
}
return $this->events[$name]->start();
} | [
"public",
"function",
"startEvent",
"(",
"$",
"name",
",",
"$",
"category",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"events",
"[",
"$",
"name",
"]",
")",
")",
"{",
"$",
"this",
"->",
"events",
"[",
"$",
"name",
"]",
"=",
"new... | Starts an event.
@param string $name The event name
@param string $category The event category
@return StopwatchEvent The event | [
"Starts",
"an",
"event",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Stopwatch/Section.php#L118-L125 | train | Start a new event | [
30522,
2270,
3853,
2707,
18697,
3372,
1006,
1002,
2171,
1010,
1002,
4696,
1007,
1063,
2065,
1006,
999,
26354,
3388,
1006,
1002,
2023,
1011,
1028,
2824,
1031,
1002,
2171,
1033,
1007,
1007,
1063,
1002,
2023,
1011,
1028,
2824,
1031,
1002,
21... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Form/Form.php | Form.isRequired | public function isRequired()
{
if (null === $this->parent || $this->parent->isRequired()) {
return $this->config->getRequired();
}
return false;
} | php | public function isRequired()
{
if (null === $this->parent || $this->parent->isRequired()) {
return $this->config->getRequired();
}
return false;
} | [
"public",
"function",
"isRequired",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"parent",
"||",
"$",
"this",
"->",
"parent",
"->",
"isRequired",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"config",
"->",
"getRequired",
"(",
")",... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Form.php#L242-L249 | train | return true if this node is required | [
30522,
2270,
3853,
2003,
2890,
15549,
5596,
1006,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
1027,
1002,
2023,
1011,
1028,
6687,
1064,
1064,
1002,
2023,
1011,
1028,
6687,
1011,
1028,
2003,
2890,
15549,
5596,
1006,
1007,
1007,
1063,
2709,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Routing/Loader/GlobFileLoader.php | GlobFileLoader.load | public function load($resource, $type = null)
{
$collection = new RouteCollection();
foreach ($this->glob($resource, false, $globResource) as $path => $info) {
$collection->addCollection($this->import($path));
}
$collection->addResource($globResource);
return $collection;
} | php | public function load($resource, $type = null)
{
$collection = new RouteCollection();
foreach ($this->glob($resource, false, $globResource) as $path => $info) {
$collection->addCollection($this->import($path));
}
$collection->addResource($globResource);
return $collection;
} | [
"public",
"function",
"load",
"(",
"$",
"resource",
",",
"$",
"type",
"=",
"null",
")",
"{",
"$",
"collection",
"=",
"new",
"RouteCollection",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"glob",
"(",
"$",
"resource",
",",
"false",
",",
"$",
"... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Routing/Loader/GlobFileLoader.php#L27-L38 | train | Load all routes from a resource | [
30522,
2270,
3853,
7170,
1006,
1002,
7692,
1010,
1002,
2828,
1027,
19701,
1007,
1063,
1002,
3074,
1027,
2047,
2799,
26895,
18491,
1006,
1007,
1025,
18921,
6776,
1006,
1002,
2023,
1011,
1028,
1043,
4135,
2497,
1006,
1002,
7692,
1010,
6270,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Model.php | Model.getAllKnownUrlsForAllSites | public function getAllKnownUrlsForAllSites()
{
$db = $this->getDb();
$mainUrls = $db->fetchAll("SELECT idsite, main_url as url FROM " . Common::prefixTable("site"));
$aliasUrls = $db->fetchAll("SELECT idsite, url FROM " . Common::prefixTable("site_url"));
return array_merge($mainUrls, $aliasUrls);
} | php | public function getAllKnownUrlsForAllSites()
{
$db = $this->getDb();
$mainUrls = $db->fetchAll("SELECT idsite, main_url as url FROM " . Common::prefixTable("site"));
$aliasUrls = $db->fetchAll("SELECT idsite, url FROM " . Common::prefixTable("site_url"));
return array_merge($mainUrls, $aliasUrls);
} | [
"public",
"function",
"getAllKnownUrlsForAllSites",
"(",
")",
"{",
"$",
"db",
"=",
"$",
"this",
"->",
"getDb",
"(",
")",
";",
"$",
"mainUrls",
"=",
"$",
"db",
"->",
"fetchAll",
"(",
"\"SELECT idsite, main_url as url FROM \"",
".",
"Common",
"::",
"prefixTable"... | Returns the list of alias URLs registered for the given idSite.
The website ID must be valid when calling this method!
@param int $idSite
@return array list of alias URLs | [
"Returns",
"the",
"list",
"of",
"alias",
"URLs",
"registered",
"for",
"the",
"given",
"idSite",
".",
"The",
"website",
"ID",
"must",
"be",
"valid",
"when",
"calling",
"this",
"method!"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/SitesManager/Model.php#L304-L311 | train | Get all known urls for all sites | [
30522,
2270,
3853,
2131,
8095,
2243,
19779,
11231,
12190,
22747,
6525,
12718,
7616,
1006,
1007,
1063,
1002,
16962,
1027,
1002,
2023,
1011,
1028,
2131,
18939,
1006,
1007,
1025,
1002,
2364,
3126,
4877,
1027,
1002,
16962,
1011,
1028,
18584,
80... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getgrav/grav | system/src/Grav/Common/Data/Validation.php | Validation.validateRequired | public static function validateRequired($value, $params)
{
if (is_scalar($value)) {
return (bool) $params !== true || $value !== '';
}
return (bool) $params !== true || !empty($value);
} | php | public static function validateRequired($value, $params)
{
if (is_scalar($value)) {
return (bool) $params !== true || $value !== '';
}
return (bool) $params !== true || !empty($value);
} | [
"public",
"static",
"function",
"validateRequired",
"(",
"$",
"value",
",",
"$",
"params",
")",
"{",
"if",
"(",
"is_scalar",
"(",
"$",
"value",
")",
")",
"{",
"return",
"(",
"bool",
")",
"$",
"params",
"!==",
"true",
"||",
"$",
"value",
"!==",
"''",
... | HTML5 attributes (min, max and range are handled inside the types) | [
"HTML5",
"attributes",
"(",
"min",
"max",
"and",
"range",
"are",
"handled",
"inside",
"the",
"types",
")"
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Data/Validation.php#L707-L714 | train | Validate required value | [
30522,
2270,
10763,
3853,
9398,
24932,
2063,
15549,
5596,
1006,
1002,
3643,
1010,
1002,
11498,
5244,
1007,
1063,
2065,
1006,
2003,
1035,
26743,
2099,
1006,
1002,
3643,
1007,
1007,
1063,
2709,
1006,
22017,
2140,
1007,
1002,
11498,
5244,
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... |
octobercms/october | modules/backend/behaviors/ListController.php | ListController.listMakePartial | public function listMakePartial($partial, $params = [])
{
$contents = $this->controller->makePartial('list_'.$partial, $params + $this->vars, false);
if (!$contents) {
$contents = $this->makePartial($partial, $params);
}
return $contents;
} | php | public function listMakePartial($partial, $params = [])
{
$contents = $this->controller->makePartial('list_'.$partial, $params + $this->vars, false);
if (!$contents) {
$contents = $this->makePartial($partial, $params);
}
return $contents;
} | [
"public",
"function",
"listMakePartial",
"(",
"$",
"partial",
",",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"$",
"contents",
"=",
"$",
"this",
"->",
"controller",
"->",
"makePartial",
"(",
"'list_'",
".",
"$",
"partial",
",",
"$",
"params",
"+",
"$",
... | Controller accessor for making partials within this behavior.
@param string $partial
@param array $params
@return string Partial contents | [
"Controller",
"accessor",
"for",
"making",
"partials",
"within",
"this",
"behavior",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/behaviors/ListController.php#L389-L397 | train | Make partial for list_. | [
30522,
2270,
3853,
2862,
2863,
3489,
19362,
20925,
1006,
1002,
7704,
1010,
1002,
11498,
5244,
1027,
1031,
1033,
1007,
1063,
1002,
8417,
1027,
1002,
2023,
1011,
1028,
11486,
1011,
1028,
2191,
19362,
20925,
1006,
1005,
2862,
1035,
1005,
1012,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Security/Core/Authentication/RememberMe/InMemoryTokenProvider.php | InMemoryTokenProvider.loadTokenBySeries | public function loadTokenBySeries($series)
{
if (!isset($this->tokens[$series])) {
throw new TokenNotFoundException('No token found.');
}
return $this->tokens[$series];
} | php | public function loadTokenBySeries($series)
{
if (!isset($this->tokens[$series])) {
throw new TokenNotFoundException('No token found.');
}
return $this->tokens[$series];
} | [
"public",
"function",
"loadTokenBySeries",
"(",
"$",
"series",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"tokens",
"[",
"$",
"series",
"]",
")",
")",
"{",
"throw",
"new",
"TokenNotFoundException",
"(",
"'No token found.'",
")",
";",
"}",... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Security/Core/Authentication/RememberMe/InMemoryTokenProvider.php#L28-L35 | train | Load a token by series | [
30522,
2270,
3853,
7170,
18715,
2368,
3762,
8043,
3111,
1006,
1002,
2186,
1007,
1063,
2065,
1006,
999,
26354,
3388,
1006,
1002,
2023,
1011,
1028,
19204,
2015,
1031,
1002,
2186,
1033,
1007,
1007,
1063,
5466,
2047,
19204,
17048,
14876,
8630,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/Tracker/Visit.php | Visit.triggerHookOnDimensions | private function triggerHookOnDimensions($dimensions, $hook, $valuesToUpdate = null)
{
$visitor = $this->makeVisitorFacade();
/** @var Action $action */
$action = $this->request->getMetadata('Actions', 'action');
foreach ($dimensions as $dimension) {
$value = $dimension->$hook($this->request, $visitor, $action);
if ($value !== false) {
$fieldName = $dimension->getColumnName();
$visitor->setVisitorColumn($fieldName, $value);
if (is_float($value)) {
$value = Common::forceDotAsSeparatorForDecimalPoint($value);
}
if ($valuesToUpdate !== null) {
$valuesToUpdate[$fieldName] = $value;
} else {
$this->visitProperties->setProperty($fieldName, $value);
}
}
}
return $valuesToUpdate;
} | php | private function triggerHookOnDimensions($dimensions, $hook, $valuesToUpdate = null)
{
$visitor = $this->makeVisitorFacade();
/** @var Action $action */
$action = $this->request->getMetadata('Actions', 'action');
foreach ($dimensions as $dimension) {
$value = $dimension->$hook($this->request, $visitor, $action);
if ($value !== false) {
$fieldName = $dimension->getColumnName();
$visitor->setVisitorColumn($fieldName, $value);
if (is_float($value)) {
$value = Common::forceDotAsSeparatorForDecimalPoint($value);
}
if ($valuesToUpdate !== null) {
$valuesToUpdate[$fieldName] = $value;
} else {
$this->visitProperties->setProperty($fieldName, $value);
}
}
}
return $valuesToUpdate;
} | [
"private",
"function",
"triggerHookOnDimensions",
"(",
"$",
"dimensions",
",",
"$",
"hook",
",",
"$",
"valuesToUpdate",
"=",
"null",
")",
"{",
"$",
"visitor",
"=",
"$",
"this",
"->",
"makeVisitorFacade",
"(",
")",
";",
"/** @var Action $action */",
"$",
"actio... | @param VisitDimension[] $dimensions
@param string $hook
@param Visitor $visitor
@param Action|null $action
@param array|null $valuesToUpdate If null, $this->visitorInfo will be updated
@return array|null The updated $valuesToUpdate or null if no $valuesToUpdate given | [
"@param",
"VisitDimension",
"[]",
"$dimensions",
"@param",
"string",
"$hook",
"@param",
"Visitor",
"$visitor",
"@param",
"Action|null",
"$action",
"@param",
"array|null",
"$valuesToUpdate",
"If",
"null",
"$this",
"-",
">",
"visitorInfo",
"will",
"be",
"updated"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Tracker/Visit.php#L452-L479 | train | Trigger a hook on each dimension of the tree | [
30522,
2797,
3853,
9495,
6806,
16366,
16089,
3549,
27466,
1006,
1002,
9646,
1010,
1002,
8103,
1010,
1002,
5300,
24826,
17299,
3686,
1027,
19701,
1007,
1063,
1002,
10367,
1027,
1002,
2023,
1011,
1028,
2191,
11365,
15660,
7011,
21869,
1006,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
z-song/laravel-admin | src/Form/Field/Tags.php | Tags.pluck | public function pluck($visibleColumn, $key)
{
if (!empty($visibleColumn) && !empty($key)) {
$this->keyAsValue = true;
}
$this->visibleColumn = $visibleColumn;
$this->key = $key;
return $this;
} | php | public function pluck($visibleColumn, $key)
{
if (!empty($visibleColumn) && !empty($key)) {
$this->keyAsValue = true;
}
$this->visibleColumn = $visibleColumn;
$this->key = $key;
return $this;
} | [
"public",
"function",
"pluck",
"(",
"$",
"visibleColumn",
",",
"$",
"key",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"visibleColumn",
")",
"&&",
"!",
"empty",
"(",
"$",
"key",
")",
")",
"{",
"$",
"this",
"->",
"keyAsValue",
"=",
"true",
";",
"... | Set visible column and key of data.
@param $visibleColumn
@param $key
@return $this | [
"Set",
"visible",
"column",
"and",
"key",
"of",
"data",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Form/Field/Tags.php#L77-L87 | train | Plucks the value of a column and key from a column. | [
30522,
2270,
3853,
20228,
12722,
1006,
1002,
5710,
25778,
2819,
2078,
1010,
1002,
3145,
1007,
1063,
2065,
1006,
999,
4064,
1006,
1002,
5710,
25778,
2819,
2078,
1007,
1004,
1004,
999,
4064,
1006,
1002,
3145,
1007,
1007,
1063,
1002,
2023,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Bundle/FrameworkBundle/Controller/ControllerNameParser.php | ControllerNameParser.findAlternative | private function findAlternative(string $nonExistentBundleName): ?string
{
$bundleNames = array_map(function (BundleInterface $b) {
return $b->getName();
}, $this->kernel->getBundles());
$alternative = null;
$shortest = null;
foreach ($bundleNames as $bundleName) {
// if there's a partial match, return it immediately
if (false !== strpos($bundleName, $nonExistentBundleName)) {
return $bundleName;
}
$lev = levenshtein($nonExistentBundleName, $bundleName);
if ($lev <= \strlen($nonExistentBundleName) / 3 && (null === $alternative || $lev < $shortest)) {
$alternative = $bundleName;
$shortest = $lev;
}
}
return $alternative;
} | php | private function findAlternative(string $nonExistentBundleName): ?string
{
$bundleNames = array_map(function (BundleInterface $b) {
return $b->getName();
}, $this->kernel->getBundles());
$alternative = null;
$shortest = null;
foreach ($bundleNames as $bundleName) {
// if there's a partial match, return it immediately
if (false !== strpos($bundleName, $nonExistentBundleName)) {
return $bundleName;
}
$lev = levenshtein($nonExistentBundleName, $bundleName);
if ($lev <= \strlen($nonExistentBundleName) / 3 && (null === $alternative || $lev < $shortest)) {
$alternative = $bundleName;
$shortest = $lev;
}
}
return $alternative;
} | [
"private",
"function",
"findAlternative",
"(",
"string",
"$",
"nonExistentBundleName",
")",
":",
"?",
"string",
"{",
"$",
"bundleNames",
"=",
"array_map",
"(",
"function",
"(",
"BundleInterface",
"$",
"b",
")",
"{",
"return",
"$",
"b",
"->",
"getName",
"(",
... | Attempts to find a bundle that is *similar* to the given bundle name. | [
"Attempts",
"to",
"find",
"a",
"bundle",
"that",
"is",
"*",
"similar",
"*",
"to",
"the",
"given",
"bundle",
"name",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/FrameworkBundle/Controller/ControllerNameParser.php#L119-L141 | train | Find the alternative bundle name | [
30522,
2797,
3853,
2424,
2389,
16451,
8082,
1006,
5164,
1002,
3904,
9048,
16173,
2102,
27265,
20844,
4168,
1007,
1024,
1029,
5164,
1063,
1002,
14012,
18442,
2015,
1027,
9140,
1035,
4949,
1006,
3853,
1006,
14012,
18447,
2121,
12172,
1002,
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/Foundation/Application.php | Application.path | public function path($path = '')
{
$appPath = $this->appPath ?: $this->basePath.DIRECTORY_SEPARATOR.'app';
return $appPath.($path ? DIRECTORY_SEPARATOR.$path : $path);
} | php | public function path($path = '')
{
$appPath = $this->appPath ?: $this->basePath.DIRECTORY_SEPARATOR.'app';
return $appPath.($path ? DIRECTORY_SEPARATOR.$path : $path);
} | [
"public",
"function",
"path",
"(",
"$",
"path",
"=",
"''",
")",
"{",
"$",
"appPath",
"=",
"$",
"this",
"->",
"appPath",
"?",
":",
"$",
"this",
"->",
"basePath",
".",
"DIRECTORY_SEPARATOR",
".",
"'app'",
";",
"return",
"$",
"appPath",
".",
"(",
"$",
... | Get the path to the application "app" directory.
@param string $path
@return string | [
"Get",
"the",
"path",
"to",
"the",
"application",
"app",
"directory",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Foundation/Application.php#L302-L307 | train | Get the path to the root directory of the current context | [
30522,
30524,
1005,
10439,
1005,
1025,
2709,
1002,
10439,
15069,
1012,
1006,
1002,
4130,
1029,
14176,
1035,
19802,
25879,
2953,
1012,
1002,
4130,
1024,
1002,
4130,
1007,
1025,
1065,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Routing/Route.php | Route.bind | public function bind(Request $request)
{
$this->compileRoute();
$this->parameters = (new RouteParameterBinder($this))
->parameters($request);
$this->originalParameters = $this->parameters;
return $this;
} | php | public function bind(Request $request)
{
$this->compileRoute();
$this->parameters = (new RouteParameterBinder($this))
->parameters($request);
$this->originalParameters = $this->parameters;
return $this;
} | [
"public",
"function",
"bind",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"this",
"->",
"compileRoute",
"(",
")",
";",
"$",
"this",
"->",
"parameters",
"=",
"(",
"new",
"RouteParameterBinder",
"(",
"$",
"this",
")",
")",
"->",
"parameters",
"(",
"$"... | Bind the route to a given request for execution.
@param \Illuminate\Http\Request $request
@return $this | [
"Bind",
"the",
"route",
"to",
"a",
"given",
"request",
"for",
"execution",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Routing/Route.php#L303-L313 | train | Binds the route to the parameters of the current request | [
30522,
2270,
3853,
14187,
1006,
5227,
1002,
5227,
1007,
1063,
1002,
2023,
1011,
1028,
21624,
5833,
2063,
1006,
1007,
1025,
1002,
2023,
1011,
1028,
11709,
1027,
1006,
2047,
2799,
28689,
22828,
8428,
4063,
1006,
1002,
2023,
1007,
1007,
1011,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.