repo stringclasses 21 values | path stringlengths 10 100 | func_name stringlengths 6 71 | original_string stringlengths 115 97k | language stringclasses 1 value | code stringlengths 115 97k | code_tokens listlengths 27 7.5k | docstring stringlengths 6 1.88k | docstring_tokens listlengths 1 177 | sha stringclasses 21 values | url stringlengths 100 189 | partition stringclasses 1 value | summary stringlengths 9 340 | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
laravel/framework | src/Illuminate/Routing/UrlGenerator.php | UrlGenerator.temporarySignedRoute | public function temporarySignedRoute($name, $expiration, $parameters = [], $absolute = true)
{
return $this->signedRoute($name, $parameters, $expiration, $absolute);
} | php | public function temporarySignedRoute($name, $expiration, $parameters = [], $absolute = true)
{
return $this->signedRoute($name, $parameters, $expiration, $absolute);
} | [
"public",
"function",
"temporarySignedRoute",
"(",
"$",
"name",
",",
"$",
"expiration",
",",
"$",
"parameters",
"=",
"[",
"]",
",",
"$",
"absolute",
"=",
"true",
")",
"{",
"return",
"$",
"this",
"->",
"signedRoute",
"(",
"$",
"name",
",",
"$",
"paramet... | Create a temporary signed route URL for a named route.
@param string $name
@param \DateTimeInterface|\DateInterval|int $expiration
@param array $parameters
@param bool $absolute
@return string | [
"Create",
"a",
"temporary",
"signed",
"route",
"URL",
"for",
"a",
"named",
"route",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Routing/UrlGenerator.php#L344-L347 | train | Create a temporary signed route | [
30522,
2270,
3853,
5741,
5332,
19225,
22494,
2618,
1006,
1002,
2171,
1010,
1002,
4654,
16781,
1010,
1002,
11709,
1027,
1031,
1033,
1010,
1002,
7619,
1027,
2995,
1007,
1063,
2709,
1002,
2023,
1011,
1028,
2772,
22494,
2618,
1006,
1002,
2171,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/LocationProvider.php | LocationProvider.prettyFormatLocation | public static function prettyFormatLocation($locationInfo, $newline = "\n", $includeExtra = false)
{
if ($locationInfo === false) {
return Piwik::translate('General_Unknown');
}
// add latitude/longitude line
$lines = array();
if (!empty($locationInfo[self::LATITUDE_KEY])
&& !empty($locationInfo[self::LONGITUDE_KEY])
) {
$lines[] = '(' . $locationInfo[self::LATITUDE_KEY] . ', ' . $locationInfo[self::LONGITUDE_KEY] . ')';
}
// add city/state line
$cityState = array();
if (!empty($locationInfo[self::CITY_NAME_KEY])) {
$cityState[] = $locationInfo[self::CITY_NAME_KEY];
}
if (!empty($locationInfo[self::REGION_CODE_KEY])) {
$cityState[] = $locationInfo[self::REGION_CODE_KEY];
} else if (!empty($locationInfo[self::REGION_NAME_KEY])) {
$cityState[] = $locationInfo[self::REGION_NAME_KEY];
}
if (!empty($cityState)) {
$lines[] = implode(', ', $cityState);
}
// add postal code line
if (!empty($locationInfo[self::POSTAL_CODE_KEY])) {
$lines[] = $locationInfo[self::POSTAL_CODE_KEY];
}
// add country line
if (!empty($locationInfo[self::COUNTRY_NAME_KEY])) {
$lines[] = $locationInfo[self::COUNTRY_NAME_KEY];
} else if (!empty($locationInfo[self::COUNTRY_CODE_KEY])) {
$lines[] = $locationInfo[self::COUNTRY_CODE_KEY];
}
// add extra information (ISP/Organization)
if ($includeExtra) {
$lines[] = '';
$unknown = Piwik::translate('General_Unknown');
$org = !empty($locationInfo[self::ORG_KEY]) ? $locationInfo[self::ORG_KEY] : $unknown;
$lines[] = "Org: $org";
$isp = !empty($locationInfo[self::ISP_KEY]) ? $locationInfo[self::ISP_KEY] : $unknown;
$lines[] = "ISP: $isp";
}
return implode($newline, $lines);
} | php | public static function prettyFormatLocation($locationInfo, $newline = "\n", $includeExtra = false)
{
if ($locationInfo === false) {
return Piwik::translate('General_Unknown');
}
// add latitude/longitude line
$lines = array();
if (!empty($locationInfo[self::LATITUDE_KEY])
&& !empty($locationInfo[self::LONGITUDE_KEY])
) {
$lines[] = '(' . $locationInfo[self::LATITUDE_KEY] . ', ' . $locationInfo[self::LONGITUDE_KEY] . ')';
}
// add city/state line
$cityState = array();
if (!empty($locationInfo[self::CITY_NAME_KEY])) {
$cityState[] = $locationInfo[self::CITY_NAME_KEY];
}
if (!empty($locationInfo[self::REGION_CODE_KEY])) {
$cityState[] = $locationInfo[self::REGION_CODE_KEY];
} else if (!empty($locationInfo[self::REGION_NAME_KEY])) {
$cityState[] = $locationInfo[self::REGION_NAME_KEY];
}
if (!empty($cityState)) {
$lines[] = implode(', ', $cityState);
}
// add postal code line
if (!empty($locationInfo[self::POSTAL_CODE_KEY])) {
$lines[] = $locationInfo[self::POSTAL_CODE_KEY];
}
// add country line
if (!empty($locationInfo[self::COUNTRY_NAME_KEY])) {
$lines[] = $locationInfo[self::COUNTRY_NAME_KEY];
} else if (!empty($locationInfo[self::COUNTRY_CODE_KEY])) {
$lines[] = $locationInfo[self::COUNTRY_CODE_KEY];
}
// add extra information (ISP/Organization)
if ($includeExtra) {
$lines[] = '';
$unknown = Piwik::translate('General_Unknown');
$org = !empty($locationInfo[self::ORG_KEY]) ? $locationInfo[self::ORG_KEY] : $unknown;
$lines[] = "Org: $org";
$isp = !empty($locationInfo[self::ISP_KEY]) ? $locationInfo[self::ISP_KEY] : $unknown;
$lines[] = "ISP: $isp";
}
return implode($newline, $lines);
} | [
"public",
"static",
"function",
"prettyFormatLocation",
"(",
"$",
"locationInfo",
",",
"$",
"newline",
"=",
"\"\\n\"",
",",
"$",
"includeExtra",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"locationInfo",
"===",
"false",
")",
"{",
"return",
"Piwik",
"::",
"tra... | Returns a prettified location result.
@param array|false $locationInfo
@param string $newline The line separator (ie, \n or <br/>).
@param bool $includeExtra Whether to include ISP/Organization info.
@return string | [
"Returns",
"a",
"prettified",
"location",
"result",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/UserCountry/LocationProvider.php#L434-L490 | train | Returns a pretty formatted location | [
30522,
2270,
10763,
3853,
3492,
14192,
4017,
4135,
10719,
1006,
1002,
3295,
2378,
14876,
1010,
1002,
2047,
4179,
1027,
1000,
1032,
1050,
1000,
1010,
1002,
2421,
10288,
6494,
1027,
6270,
1007,
1063,
2065,
1006,
1002,
3295,
2378,
14876,
1027,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
z-song/laravel-admin | src/Grid/Model.php | Model.buildData | public function buildData($toArray = true)
{
if (empty($this->data)) {
$collection = $this->get();
if ($this->collectionCallback) {
$collection = call_user_func($this->collectionCallback, $collection);
}
if ($toArray) {
$this->data = $collection->toArray();
} else {
$this->data = $collection;
}
}
return $this->data;
} | php | public function buildData($toArray = true)
{
if (empty($this->data)) {
$collection = $this->get();
if ($this->collectionCallback) {
$collection = call_user_func($this->collectionCallback, $collection);
}
if ($toArray) {
$this->data = $collection->toArray();
} else {
$this->data = $collection;
}
}
return $this->data;
} | [
"public",
"function",
"buildData",
"(",
"$",
"toArray",
"=",
"true",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"data",
")",
")",
"{",
"$",
"collection",
"=",
"$",
"this",
"->",
"get",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"co... | Build.
@param bool $toArray
@return array|Collection|mixed | [
"Build",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid/Model.php#L291-L308 | train | Build the data array | [
30522,
2270,
3853,
3857,
2850,
2696,
1006,
1002,
2000,
2906,
9447,
1027,
2995,
1007,
1063,
2065,
1006,
4064,
1006,
1002,
2023,
1011,
1028,
2951,
1007,
1007,
1063,
1002,
3074,
1027,
1002,
2023,
1011,
1028,
2131,
1006,
1007,
1025,
2065,
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... |
PHPMailer/PHPMailer | src/PHPMailer.php | PHPMailer.encodeHeader | public function encodeHeader($str, $position = 'text')
{
$matchcount = 0;
switch (strtolower($position)) {
case 'phrase':
if (!preg_match('/[\200-\377]/', $str)) {
// Can't use addslashes as we don't know the value of magic_quotes_sybase
$encoded = addcslashes($str, "\0..\37\177\\\"");
if (($str == $encoded) and !preg_match('/[^A-Za-z0-9!#$%&\'*+\/=?^_`{|}~ -]/', $str)) {
return $encoded;
}
return "\"$encoded\"";
}
$matchcount = preg_match_all('/[^\040\041\043-\133\135-\176]/', $str, $matches);
break;
/* @noinspection PhpMissingBreakStatementInspection */
case 'comment':
$matchcount = preg_match_all('/[()"]/', $str, $matches);
//fallthrough
case 'text':
default:
$matchcount += preg_match_all('/[\000-\010\013\014\016-\037\177-\377]/', $str, $matches);
break;
}
//RFCs specify a maximum line length of 78 chars, however mail() will sometimes
//corrupt messages with headers longer than 65 chars. See #818
$lengthsub = 'mail' == $this->Mailer ? 13 : 0;
$maxlen = static::STD_LINE_LENGTH - $lengthsub;
// Try to select the encoding which should produce the shortest output
if ($matchcount > strlen($str) / 3) {
// More than a third of the content will need encoding, so B encoding will be most efficient
$encoding = 'B';
//This calculation is:
// max line length
// - shorten to avoid mail() corruption
// - Q/B encoding char overhead ("` =?<charset>?[QB]?<content>?=`")
// - charset name length
$maxlen = static::STD_LINE_LENGTH - $lengthsub - 8 - strlen($this->CharSet);
if ($this->hasMultiBytes($str)) {
// Use a custom function which correctly encodes and wraps long
// multibyte strings without breaking lines within a character
$encoded = $this->base64EncodeWrapMB($str, "\n");
} else {
$encoded = base64_encode($str);
$maxlen -= $maxlen % 4;
$encoded = trim(chunk_split($encoded, $maxlen, "\n"));
}
$encoded = preg_replace('/^(.*)$/m', ' =?' . $this->CharSet . "?$encoding?\\1?=", $encoded);
} elseif ($matchcount > 0) {
//1 or more chars need encoding, use Q-encode
$encoding = 'Q';
//Recalc max line length for Q encoding - see comments on B encode
$maxlen = static::STD_LINE_LENGTH - $lengthsub - 8 - strlen($this->CharSet);
$encoded = $this->encodeQ($str, $position);
$encoded = $this->wrapText($encoded, $maxlen, true);
$encoded = str_replace('=' . static::$LE, "\n", trim($encoded));
$encoded = preg_replace('/^(.*)$/m', ' =?' . $this->CharSet . "?$encoding?\\1?=", $encoded);
} elseif (strlen($str) > $maxlen) {
//No chars need encoding, but line is too long, so fold it
$encoded = trim($this->wrapText($str, $maxlen, false));
if ($str == $encoded) {
//Wrapping nicely didn't work, wrap hard instead
$encoded = trim(chunk_split($str, static::STD_LINE_LENGTH, static::$LE));
}
$encoded = str_replace(static::$LE, "\n", trim($encoded));
$encoded = preg_replace('/^(.*)$/m', ' \\1', $encoded);
} else {
//No reformatting needed
return $str;
}
return trim(static::normalizeBreaks($encoded));
} | php | public function encodeHeader($str, $position = 'text')
{
$matchcount = 0;
switch (strtolower($position)) {
case 'phrase':
if (!preg_match('/[\200-\377]/', $str)) {
// Can't use addslashes as we don't know the value of magic_quotes_sybase
$encoded = addcslashes($str, "\0..\37\177\\\"");
if (($str == $encoded) and !preg_match('/[^A-Za-z0-9!#$%&\'*+\/=?^_`{|}~ -]/', $str)) {
return $encoded;
}
return "\"$encoded\"";
}
$matchcount = preg_match_all('/[^\040\041\043-\133\135-\176]/', $str, $matches);
break;
/* @noinspection PhpMissingBreakStatementInspection */
case 'comment':
$matchcount = preg_match_all('/[()"]/', $str, $matches);
//fallthrough
case 'text':
default:
$matchcount += preg_match_all('/[\000-\010\013\014\016-\037\177-\377]/', $str, $matches);
break;
}
//RFCs specify a maximum line length of 78 chars, however mail() will sometimes
//corrupt messages with headers longer than 65 chars. See #818
$lengthsub = 'mail' == $this->Mailer ? 13 : 0;
$maxlen = static::STD_LINE_LENGTH - $lengthsub;
// Try to select the encoding which should produce the shortest output
if ($matchcount > strlen($str) / 3) {
// More than a third of the content will need encoding, so B encoding will be most efficient
$encoding = 'B';
//This calculation is:
// max line length
// - shorten to avoid mail() corruption
// - Q/B encoding char overhead ("` =?<charset>?[QB]?<content>?=`")
// - charset name length
$maxlen = static::STD_LINE_LENGTH - $lengthsub - 8 - strlen($this->CharSet);
if ($this->hasMultiBytes($str)) {
// Use a custom function which correctly encodes and wraps long
// multibyte strings without breaking lines within a character
$encoded = $this->base64EncodeWrapMB($str, "\n");
} else {
$encoded = base64_encode($str);
$maxlen -= $maxlen % 4;
$encoded = trim(chunk_split($encoded, $maxlen, "\n"));
}
$encoded = preg_replace('/^(.*)$/m', ' =?' . $this->CharSet . "?$encoding?\\1?=", $encoded);
} elseif ($matchcount > 0) {
//1 or more chars need encoding, use Q-encode
$encoding = 'Q';
//Recalc max line length for Q encoding - see comments on B encode
$maxlen = static::STD_LINE_LENGTH - $lengthsub - 8 - strlen($this->CharSet);
$encoded = $this->encodeQ($str, $position);
$encoded = $this->wrapText($encoded, $maxlen, true);
$encoded = str_replace('=' . static::$LE, "\n", trim($encoded));
$encoded = preg_replace('/^(.*)$/m', ' =?' . $this->CharSet . "?$encoding?\\1?=", $encoded);
} elseif (strlen($str) > $maxlen) {
//No chars need encoding, but line is too long, so fold it
$encoded = trim($this->wrapText($str, $maxlen, false));
if ($str == $encoded) {
//Wrapping nicely didn't work, wrap hard instead
$encoded = trim(chunk_split($str, static::STD_LINE_LENGTH, static::$LE));
}
$encoded = str_replace(static::$LE, "\n", trim($encoded));
$encoded = preg_replace('/^(.*)$/m', ' \\1', $encoded);
} else {
//No reformatting needed
return $str;
}
return trim(static::normalizeBreaks($encoded));
} | [
"public",
"function",
"encodeHeader",
"(",
"$",
"str",
",",
"$",
"position",
"=",
"'text'",
")",
"{",
"$",
"matchcount",
"=",
"0",
";",
"switch",
"(",
"strtolower",
"(",
"$",
"position",
")",
")",
"{",
"case",
"'phrase'",
":",
"if",
"(",
"!",
"preg_m... | Encode a header value (not including its label) optimally.
Picks shortest of Q, B, or none. Result includes folding if needed.
See RFC822 definitions for phrase, comment and text positions.
@param string $str The header value to encode
@param string $position What context the string will be used in
@return string | [
"Encode",
"a",
"header",
"value",
"(",
"not",
"including",
"its",
"label",
")",
"optimally",
".",
"Picks",
"shortest",
"of",
"Q",
"B",
"or",
"none",
".",
"Result",
"includes",
"folding",
"if",
"needed",
".",
"See",
"RFC822",
"definitions",
"for",
"phrase",... | 3d7132341659a8a201adbc3ba11b1e202ee2857c | https://github.com/PHPMailer/PHPMailer/blob/3d7132341659a8a201adbc3ba11b1e202ee2857c/src/PHPMailer.php#L3091-L3165 | train | Encode header string | [
30522,
2270,
3853,
4372,
16044,
4974,
2121,
1006,
1002,
2358,
2099,
1010,
1002,
2597,
1027,
1005,
3793,
1005,
1007,
1063,
1002,
2674,
3597,
16671,
1027,
1014,
1025,
6942,
1006,
2358,
5339,
12898,
13777,
1006,
1002,
2597,
1007,
1007,
1063,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
dompdf/dompdf | src/Css/Style.php | Style.length_in_pt | function length_in_pt($length, $ref_size = null)
{
static $cache = array();
if (!isset($ref_size)) {
$ref_size = self::$default_font_size;
}
if (!is_array($length)) {
$key = $length . "/$ref_size";
//Early check on cache, before converting $length to array
if (isset($cache[$key])) {
return $cache[$key];
}
$length = array($length);
} else {
$key = implode("@", $length) . "/$ref_size";
if (isset($cache[$key])) {
return $cache[$key];
}
}
$ret = 0;
foreach ($length as $l) {
if ($l === "auto") {
return "auto";
}
if ($l === "none") {
return "none";
}
// Assume numeric values are already in points
if (is_numeric($l)) {
$ret += $l;
continue;
}
if ($l === "normal") {
$ret += (float)$ref_size;
continue;
}
// Border lengths
if ($l === "thin") {
$ret += 0.5;
continue;
}
if ($l === "medium") {
$ret += 1.5;
continue;
}
if ($l === "thick") {
$ret += 2.5;
continue;
}
if (($i = mb_strpos($l, "px")) !== false) {
$dpi = $this->_stylesheet->get_dompdf()->getOptions()->getDpi();
$ret += ((float)mb_substr($l, 0, $i) * 72) / $dpi;
continue;
}
if (($i = mb_strpos($l, "pt")) !== false) {
$ret += (float)mb_substr($l, 0, $i);
continue;
}
if (($i = mb_strpos($l, "%")) !== false) {
$ret += (float)mb_substr($l, 0, $i) / 100 * (float)$ref_size;
continue;
}
if (($i = mb_strpos($l, "rem")) !== false) {
if ($this->_stylesheet->get_dompdf()->getTree()->get_root()->get_style() === null) {
// Interpreting it as "em", see https://github.com/dompdf/dompdf/issues/1406
$ret += (float)mb_substr($l, 0, $i) * $this->__get("font_size");
} else {
$ret += (float)mb_substr($l, 0, $i) * $this->_stylesheet->get_dompdf()->getTree()->get_root()->get_style()->font_size;
}
continue;
}
if (($i = mb_strpos($l, "em")) !== false) {
$ret += (float)mb_substr($l, 0, $i) * $this->__get("font_size");
continue;
}
if (($i = mb_strpos($l, "cm")) !== false) {
$ret += (float)mb_substr($l, 0, $i) * 72 / 2.54;
continue;
}
if (($i = mb_strpos($l, "mm")) !== false) {
$ret += (float)mb_substr($l, 0, $i) * 72 / 25.4;
continue;
}
// FIXME: em:ex ratio?
if (($i = mb_strpos($l, "ex")) !== false) {
$ret += (float)mb_substr($l, 0, $i) * $this->__get("font_size") / 2;
continue;
}
if (($i = mb_strpos($l, "in")) !== false) {
$ret += (float)mb_substr($l, 0, $i) * 72;
continue;
}
if (($i = mb_strpos($l, "pc")) !== false) {
$ret += (float)mb_substr($l, 0, $i) * 12;
continue;
}
// Bogus value
$ret += (float)$ref_size;
}
return $cache[$key] = $ret;
} | php | function length_in_pt($length, $ref_size = null)
{
static $cache = array();
if (!isset($ref_size)) {
$ref_size = self::$default_font_size;
}
if (!is_array($length)) {
$key = $length . "/$ref_size";
//Early check on cache, before converting $length to array
if (isset($cache[$key])) {
return $cache[$key];
}
$length = array($length);
} else {
$key = implode("@", $length) . "/$ref_size";
if (isset($cache[$key])) {
return $cache[$key];
}
}
$ret = 0;
foreach ($length as $l) {
if ($l === "auto") {
return "auto";
}
if ($l === "none") {
return "none";
}
// Assume numeric values are already in points
if (is_numeric($l)) {
$ret += $l;
continue;
}
if ($l === "normal") {
$ret += (float)$ref_size;
continue;
}
// Border lengths
if ($l === "thin") {
$ret += 0.5;
continue;
}
if ($l === "medium") {
$ret += 1.5;
continue;
}
if ($l === "thick") {
$ret += 2.5;
continue;
}
if (($i = mb_strpos($l, "px")) !== false) {
$dpi = $this->_stylesheet->get_dompdf()->getOptions()->getDpi();
$ret += ((float)mb_substr($l, 0, $i) * 72) / $dpi;
continue;
}
if (($i = mb_strpos($l, "pt")) !== false) {
$ret += (float)mb_substr($l, 0, $i);
continue;
}
if (($i = mb_strpos($l, "%")) !== false) {
$ret += (float)mb_substr($l, 0, $i) / 100 * (float)$ref_size;
continue;
}
if (($i = mb_strpos($l, "rem")) !== false) {
if ($this->_stylesheet->get_dompdf()->getTree()->get_root()->get_style() === null) {
// Interpreting it as "em", see https://github.com/dompdf/dompdf/issues/1406
$ret += (float)mb_substr($l, 0, $i) * $this->__get("font_size");
} else {
$ret += (float)mb_substr($l, 0, $i) * $this->_stylesheet->get_dompdf()->getTree()->get_root()->get_style()->font_size;
}
continue;
}
if (($i = mb_strpos($l, "em")) !== false) {
$ret += (float)mb_substr($l, 0, $i) * $this->__get("font_size");
continue;
}
if (($i = mb_strpos($l, "cm")) !== false) {
$ret += (float)mb_substr($l, 0, $i) * 72 / 2.54;
continue;
}
if (($i = mb_strpos($l, "mm")) !== false) {
$ret += (float)mb_substr($l, 0, $i) * 72 / 25.4;
continue;
}
// FIXME: em:ex ratio?
if (($i = mb_strpos($l, "ex")) !== false) {
$ret += (float)mb_substr($l, 0, $i) * $this->__get("font_size") / 2;
continue;
}
if (($i = mb_strpos($l, "in")) !== false) {
$ret += (float)mb_substr($l, 0, $i) * 72;
continue;
}
if (($i = mb_strpos($l, "pc")) !== false) {
$ret += (float)mb_substr($l, 0, $i) * 12;
continue;
}
// Bogus value
$ret += (float)$ref_size;
}
return $cache[$key] = $ret;
} | [
"function",
"length_in_pt",
"(",
"$",
"length",
",",
"$",
"ref_size",
"=",
"null",
")",
"{",
"static",
"$",
"cache",
"=",
"array",
"(",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"ref_size",
")",
")",
"{",
"$",
"ref_size",
"=",
"self",
"::",
"$... | Converts any CSS length value into an absolute length in points.
length_in_pt() takes a single length (e.g. '1em') or an array of
lengths and returns an absolute length. If an array is passed, then
the return value is the sum of all elements. If any of the lengths
provided are "auto" or "none" then that value is returned.
If a reference size is not provided, the default font size is used
({@link Style::$default_font_size}).
@param float|string|array $length the numeric length (or string measurement) or array of lengths to resolve
@param float $ref_size an absolute reference size to resolve percentage lengths
@return float|string | [
"Converts",
"any",
"CSS",
"length",
"value",
"into",
"an",
"absolute",
"length",
"in",
"points",
"."
] | 75f13c700009be21a1965dc2c5b68a8708c22ba2 | https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/src/Css/Style.php#L507-L629 | train | Returns the length in pt | [
30522,
3853,
3091,
1035,
1999,
1035,
13866,
1006,
1002,
3091,
1010,
1002,
25416,
1035,
2946,
1027,
19701,
1007,
1063,
10763,
1002,
17053,
1027,
9140,
1006,
1007,
1025,
2065,
1006,
999,
26354,
3388,
1006,
1002,
25416,
1035,
2946,
1007,
1007,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/Updater/Migration/Db/Factory.php | Factory.addIndex | public function addIndex($table, $columnNames, $indexName = '')
{
$table = $this->prefixTable($table);
if (!is_array($columnNames)) {
$columnNames = array($columnNames);
}
return $this->container->make('Piwik\Updater\Migration\Db\AddIndex', array(
'table' => $table, 'columnNames' => $columnNames, 'indexName' => $indexName
));
} | php | public function addIndex($table, $columnNames, $indexName = '')
{
$table = $this->prefixTable($table);
if (!is_array($columnNames)) {
$columnNames = array($columnNames);
}
return $this->container->make('Piwik\Updater\Migration\Db\AddIndex', array(
'table' => $table, 'columnNames' => $columnNames, 'indexName' => $indexName
));
} | [
"public",
"function",
"addIndex",
"(",
"$",
"table",
",",
"$",
"columnNames",
",",
"$",
"indexName",
"=",
"''",
")",
"{",
"$",
"table",
"=",
"$",
"this",
"->",
"prefixTable",
"(",
"$",
"table",
")",
";",
"if",
"(",
"!",
"is_array",
"(",
"$",
"colum... | Adds an index to an existing database table.
This is equivalent to an `ADD INDEX indexname (column_name_1, column_name_2)` in SQL.
It adds a normal index, no unique index.
Note: If no indexName is specified, it will automatically generate a name for this index if which is basically:
`'index_' . implode('_', $columnNames)`. If a column name is eg `column1(10)` then only the first part (`column1`)
will be used. For example when using columns `array('column1', 'column2(10)')` then the index name will be
`index_column1_column2`.
@param string $table Unprefixed database table name, eg 'log_visit'.
@param string[]|string $columnNames Either one or multiple column names, eg array('column_name_1', 'column_name_2').
A column name can be appended by a number bracket eg "column_name_1(10)".
@param string $indexName If specified, the given index name will be used instead of the automatically generated one.
@return AddIndex | [
"Adds",
"an",
"index",
"to",
"an",
"existing",
"database",
"table",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Updater/Migration/Db/Factory.php#L255-L266 | train | Adds an index to the database table | [
30522,
2270,
3853,
5587,
22254,
10288,
1006,
1002,
2795,
1010,
1002,
5930,
18442,
2015,
1010,
1002,
5950,
18442,
1027,
1005,
1005,
1007,
1063,
1002,
2795,
1027,
1002,
2023,
1011,
1028,
17576,
10880,
1006,
1002,
2795,
1007,
1025,
2065,
1006,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/DecorateTrait.php | DecorateTrait.decorate | final public function decorate($id, $renamedId = null, $priority = 0)
{
$this->definition->setDecoratedService($id, $renamedId, $priority);
return $this;
} | php | final public function decorate($id, $renamedId = null, $priority = 0)
{
$this->definition->setDecoratedService($id, $renamedId, $priority);
return $this;
} | [
"final",
"public",
"function",
"decorate",
"(",
"$",
"id",
",",
"$",
"renamedId",
"=",
"null",
",",
"$",
"priority",
"=",
"0",
")",
"{",
"$",
"this",
"->",
"definition",
"->",
"setDecoratedService",
"(",
"$",
"id",
",",
"$",
"renamedId",
",",
"$",
"p... | Sets the service that this service is decorating.
@param string|null $id The decorated service id, use null to remove decoration
@param string|null $renamedId The new decorated service id
@param int $priority The priority of decoration
@return $this
@throws InvalidArgumentException in case the decorated service id and the new decorated service id are equals | [
"Sets",
"the",
"service",
"that",
"this",
"service",
"is",
"decorating",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/DecorateTrait.php#L29-L34 | train | Set Decorator Service | [
30522,
2345,
2270,
3853,
29460,
1006,
1002,
8909,
1010,
1002,
4096,
3593,
1027,
19701,
1010,
1002,
9470,
1027,
1014,
1007,
1063,
1002,
2023,
1011,
1028,
6210,
1011,
1028,
2275,
3207,
27108,
4383,
8043,
7903,
2063,
1006,
1002,
8909,
1010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Auth/Console/ClearResetsCommand.php | ClearResetsCommand.handle | public function handle()
{
$this->laravel['auth.password']->broker($this->argument('name'))->getRepository()->deleteExpired();
$this->info('Expired reset tokens cleared!');
} | php | public function handle()
{
$this->laravel['auth.password']->broker($this->argument('name'))->getRepository()->deleteExpired();
$this->info('Expired reset tokens cleared!');
} | [
"public",
"function",
"handle",
"(",
")",
"{",
"$",
"this",
"->",
"laravel",
"[",
"'auth.password'",
"]",
"->",
"broker",
"(",
"$",
"this",
"->",
"argument",
"(",
"'name'",
")",
")",
"->",
"getRepository",
"(",
")",
"->",
"deleteExpired",
"(",
")",
";"... | Execute the console command.
@return void | [
"Execute",
"the",
"console",
"command",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Auth/Console/ClearResetsCommand.php#L28-L33 | train | Delete expired reset tokens | [
30522,
2270,
3853,
5047,
1006,
1007,
1063,
1002,
2023,
1011,
1028,
13679,
15985,
1031,
1005,
8740,
2705,
1012,
20786,
1005,
1033,
1011,
1028,
20138,
1006,
1002,
2023,
1011,
1028,
6685,
1006,
1005,
2171,
1005,
1007,
1007,
1011,
1028,
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... |
overtrue/wechat | src/BasicService/Media/Client.php | Client.createVideoForBroadcasting | public function createVideoForBroadcasting(string $mediaId, string $title, string $description)
{
return $this->httpPostJson('media/uploadvideo', [
'media_id' => $mediaId,
'title' => $title,
'description' => $description,
]);
} | php | public function createVideoForBroadcasting(string $mediaId, string $title, string $description)
{
return $this->httpPostJson('media/uploadvideo', [
'media_id' => $mediaId,
'title' => $title,
'description' => $description,
]);
} | [
"public",
"function",
"createVideoForBroadcasting",
"(",
"string",
"$",
"mediaId",
",",
"string",
"$",
"title",
",",
"string",
"$",
"description",
")",
"{",
"return",
"$",
"this",
"->",
"httpPostJson",
"(",
"'media/uploadvideo'",
",",
"[",
"'media_id'",
"=>",
... | @param string $mediaId
@param string $title
@param string $description
@return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string
@throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException | [
"@param",
"string",
"$mediaId",
"@param",
"string",
"$title",
"@param",
"string",
"$description"
] | 120c72faaa93c270365bc75c73c362d5fd583209 | https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/BasicService/Media/Client.php#L144-L151 | train | Create video for broadcasting | [
30522,
2270,
3853,
3443,
17258,
8780,
29278,
12618,
4215,
10526,
2075,
1006,
5164,
1002,
2865,
3593,
1010,
5164,
1002,
2516,
1010,
5164,
1002,
6412,
1007,
1063,
2709,
1002,
2023,
1011,
1028,
8299,
19894,
22578,
2239,
1006,
1005,
2865,
1013,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/backend/widgets/MediaManager.php | MediaManager.onMoveItems | public function onMoveItems()
{
$this->abortIfReadOnly();
$dest = trim(Input::get('dest'));
if (!strlen($dest)) {
throw new ApplicationException(Lang::get('backend::lang.media.please_select_move_dest'));
}
$dest = MediaLibrary::validatePath($dest);
if ($dest == Input::get('originalPath')) {
throw new ApplicationException(Lang::get('backend::lang.media.move_dest_src_match'));
}
$files = Input::get('files', []);
if (!is_array($files)) {
throw new ApplicationException('Invalid input data');
}
$folders = Input::get('folders', []);
if (!is_array($folders)) {
throw new ApplicationException('Invalid input data');
}
$library = MediaLibrary::instance();
foreach ($files as $path) {
/*
* Move a single file
*/
$library->moveFile($path, $dest.'/'.basename($path));
/**
* @event media.file.move
* Called after a file is moved
*
* Example usage:
*
* Event::listen('media.file.move', function((\Backend\Widgets\MediaManager) $mediaWidget, (string) $path, (string) $dest) {
* \Log::info($path . " was moved to " . $dest);
* });
*
* Or
*
* $mediaWidget->bindEvent('file.rename', function ((string) $path, (string) $dest) {
* \Log::info($path . " was moved to " . $dest);
* });
*
*/
$this->fireSystemEvent('media.file.move', [$path, $dest]);
}
foreach ($folders as $path) {
/*
* Move a single folder
*/
$library->moveFolder($path, $dest.'/'.basename($path));
/**
* @event media.folder.move
* Called after a folder is moved
*
* Example usage:
*
* Event::listen('media.folder.move', function((\Backend\Widgets\MediaManager) $mediaWidget, (string) $path, (string) $dest) {
* \Log::info($path . " was moved to " . $dest);
* });
*
* Or
*
* $mediaWidget->bindEvent('folder.rename', function ((string) $path, (string) $dest) {
* \Log::info($path . " was moved to " . $dest);
* });
*
*/
$this->fireSystemEvent('media.folder.move', [$path, $dest]);
}
$library->resetCache();
$this->prepareVars();
return [
'#'.$this->getId('item-list') => $this->makePartial('item-list')
];
} | php | public function onMoveItems()
{
$this->abortIfReadOnly();
$dest = trim(Input::get('dest'));
if (!strlen($dest)) {
throw new ApplicationException(Lang::get('backend::lang.media.please_select_move_dest'));
}
$dest = MediaLibrary::validatePath($dest);
if ($dest == Input::get('originalPath')) {
throw new ApplicationException(Lang::get('backend::lang.media.move_dest_src_match'));
}
$files = Input::get('files', []);
if (!is_array($files)) {
throw new ApplicationException('Invalid input data');
}
$folders = Input::get('folders', []);
if (!is_array($folders)) {
throw new ApplicationException('Invalid input data');
}
$library = MediaLibrary::instance();
foreach ($files as $path) {
/*
* Move a single file
*/
$library->moveFile($path, $dest.'/'.basename($path));
/**
* @event media.file.move
* Called after a file is moved
*
* Example usage:
*
* Event::listen('media.file.move', function((\Backend\Widgets\MediaManager) $mediaWidget, (string) $path, (string) $dest) {
* \Log::info($path . " was moved to " . $dest);
* });
*
* Or
*
* $mediaWidget->bindEvent('file.rename', function ((string) $path, (string) $dest) {
* \Log::info($path . " was moved to " . $dest);
* });
*
*/
$this->fireSystemEvent('media.file.move', [$path, $dest]);
}
foreach ($folders as $path) {
/*
* Move a single folder
*/
$library->moveFolder($path, $dest.'/'.basename($path));
/**
* @event media.folder.move
* Called after a folder is moved
*
* Example usage:
*
* Event::listen('media.folder.move', function((\Backend\Widgets\MediaManager) $mediaWidget, (string) $path, (string) $dest) {
* \Log::info($path . " was moved to " . $dest);
* });
*
* Or
*
* $mediaWidget->bindEvent('folder.rename', function ((string) $path, (string) $dest) {
* \Log::info($path . " was moved to " . $dest);
* });
*
*/
$this->fireSystemEvent('media.folder.move', [$path, $dest]);
}
$library->resetCache();
$this->prepareVars();
return [
'#'.$this->getId('item-list') => $this->makePartial('item-list')
];
} | [
"public",
"function",
"onMoveItems",
"(",
")",
"{",
"$",
"this",
"->",
"abortIfReadOnly",
"(",
")",
";",
"$",
"dest",
"=",
"trim",
"(",
"Input",
"::",
"get",
"(",
"'dest'",
")",
")",
";",
"if",
"(",
"!",
"strlen",
"(",
"$",
"dest",
")",
")",
"{",... | Move library item AJAX handler
@return array | [
"Move",
"library",
"item",
"AJAX",
"handler"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/MediaManager.php#L581-L666 | train | Move items on move | [
30522,
2270,
3853,
2006,
5302,
3726,
4221,
5244,
1006,
1007,
1063,
1002,
2023,
1011,
1028,
11113,
11589,
10128,
16416,
5280,
2135,
1006,
1007,
1025,
1002,
4078,
2102,
1027,
12241,
1006,
7953,
1024,
1024,
2131,
1006,
1005,
4078,
2102,
1005,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
dompdf/dompdf | lib/Cpdf.php | Cpdf.rect | function rect($x1, $y1, $width, $height)
{
$this->addContent(sprintf("\n%.3F %.3F %.3F %.3F re", $x1, $y1, $width, $height));
} | php | function rect($x1, $y1, $width, $height)
{
$this->addContent(sprintf("\n%.3F %.3F %.3F %.3F re", $x1, $y1, $width, $height));
} | [
"function",
"rect",
"(",
"$",
"x1",
",",
"$",
"y1",
",",
"$",
"width",
",",
"$",
"height",
")",
"{",
"$",
"this",
"->",
"addContent",
"(",
"sprintf",
"(",
"\"\\n%.3F %.3F %.3F %.3F re\"",
",",
"$",
"x1",
",",
"$",
"y1",
",",
"$",
"width",
",",
"$",... | draw a rectangle, note that it is the width and height of the rectangle which are the secondary parameters, not
the coordinates of the upper-right corner
@param $x1
@param $y1
@param $width
@param $height | [
"draw",
"a",
"rectangle",
"note",
"that",
"it",
"is",
"the",
"width",
"and",
"height",
"of",
"the",
"rectangle",
"which",
"are",
"the",
"secondary",
"parameters",
"not",
"the",
"coordinates",
"of",
"the",
"upper",
"-",
"right",
"corner"
] | 75f13c700009be21a1965dc2c5b68a8708c22ba2 | https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/lib/Cpdf.php#L3592-L3595 | train | Rectangle - based image rendering | [
30522,
3853,
28667,
2102,
1006,
1002,
1060,
2487,
1010,
1002,
1061,
2487,
1010,
1002,
9381,
1010,
1002,
4578,
1007,
1063,
1002,
2023,
1011,
1028,
5587,
8663,
6528,
2102,
1006,
9043,
2546,
1006,
1000,
1032,
1050,
1003,
1012,
1017,
2546,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/Common.php | Common.getSqlStringFieldsArray | public static function getSqlStringFieldsArray($fields)
{
if (is_string($fields)) {
$fields = array($fields);
}
$count = count($fields);
if ($count == 0) {
return "''";
}
return '?' . str_repeat(',?', $count - 1);
} | php | public static function getSqlStringFieldsArray($fields)
{
if (is_string($fields)) {
$fields = array($fields);
}
$count = count($fields);
if ($count == 0) {
return "''";
}
return '?' . str_repeat(',?', $count - 1);
} | [
"public",
"static",
"function",
"getSqlStringFieldsArray",
"(",
"$",
"fields",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"fields",
")",
")",
"{",
"$",
"fields",
"=",
"array",
"(",
"$",
"fields",
")",
";",
"}",
"$",
"count",
"=",
"count",
"(",
"$",
... | Returns a string with a comma separated list of placeholders for use in an SQL query. Used mainly
to fill the `IN (...)` part of a query.
@param array|string $fields The names of the mysql table fields to bind, e.g.
`array(fieldName1, fieldName2, fieldName3)`.
_Note: The content of the array isn't important, just its length._
@return string The placeholder string, e.g. `"?, ?, ?"`.
@api | [
"Returns",
"a",
"string",
"with",
"a",
"comma",
"separated",
"list",
"of",
"placeholders",
"for",
"use",
"in",
"an",
"SQL",
"query",
".",
"Used",
"mainly",
"to",
"fill",
"the",
"IN",
"(",
"...",
")",
"part",
"of",
"a",
"query",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Common.php#L1134-L1144 | train | Returns an array of sql string fields | [
30522,
2270,
10763,
3853,
4152,
4160,
4877,
18886,
3070,
15155,
2906,
9447,
1006,
1002,
4249,
1007,
1063,
2065,
1006,
2003,
1035,
5164,
1006,
1002,
4249,
1007,
1007,
1063,
1002,
4249,
1027,
9140,
1006,
1002,
4249,
1007,
1025,
1065,
1002,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/HttpFoundation/Request.php | Request.normalizeQueryString | public static function normalizeQueryString($qs)
{
if ('' == $qs) {
return '';
}
parse_str($qs, $qs);
ksort($qs);
return http_build_query($qs, '', '&', PHP_QUERY_RFC3986);
} | php | public static function normalizeQueryString($qs)
{
if ('' == $qs) {
return '';
}
parse_str($qs, $qs);
ksort($qs);
return http_build_query($qs, '', '&', PHP_QUERY_RFC3986);
} | [
"public",
"static",
"function",
"normalizeQueryString",
"(",
"$",
"qs",
")",
"{",
"if",
"(",
"''",
"==",
"$",
"qs",
")",
"{",
"return",
"''",
";",
"}",
"parse_str",
"(",
"$",
"qs",
",",
"$",
"qs",
")",
";",
"ksort",
"(",
"$",
"qs",
")",
";",
"r... | Normalizes a query string.
It builds a normalized query string, where keys/value pairs are alphabetized,
have consistent escaping and unneeded delimiters are removed.
@param string $qs Query string
@return string A normalized query string for the Request | [
"Normalizes",
"a",
"query",
"string",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpFoundation/Request.php#L629-L639 | train | Normalize a query string to a string | [
30522,
2270,
10763,
3853,
3671,
4697,
4226,
24769,
18886,
3070,
1006,
1002,
1053,
2015,
1007,
1063,
2065,
1006,
1005,
1005,
1027,
1027,
1002,
1053,
2015,
1007,
1063,
2709,
1005,
1005,
1025,
1065,
11968,
3366,
1035,
2358,
2099,
1006,
1002,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/ViewDataTable/Factory.php | Factory.build | public static function build($defaultType = null, $apiAction = false, $controllerAction = false, $forceDefault = false, $loadViewDataTableParametersForUser = null)
{
if (false === $controllerAction) {
$controllerAction = $apiAction;
}
$report = self::getReport($apiAction);
$defaultViewType = self::getDefaultViewTypeForReport($report, $apiAction);
$params = array();
$containerId = Common::getRequestVar('containerId', '', 'string');
if (!isset($loadViewDataTableParametersForUser)) {
$loadViewDataTableParametersForUser = ($containerId != '' || '0' == Common::getRequestVar('widget', '0', 'string'));
}
if ($loadViewDataTableParametersForUser) {
$login = Piwik::getCurrentUserLogin();
$paramsKey = $controllerAction;
if (!empty($report) && $controllerAction === $apiAction) {
$paramsKey = $report->getId();
}
$params = Manager::getViewDataTableParameters($login, $paramsKey, $containerId);
}
if (!self::isDefaultViewTypeForReportFixed($report)) {
$savedViewDataTable = false;
if (!empty($params['viewDataTable'])) {
$savedViewDataTable = $params['viewDataTable'];
}
// order of default viewDataTables' priority is: function specified default, saved default, configured default for report
// function specified default is preferred
// -> force default == true : defaultType ?: saved ?: defaultView
// -> force default == false : saved ?: defaultType ?: defaultView
if ($forceDefault) {
$defaultType = $defaultType ?: $savedViewDataTable ?: $defaultViewType;
} else {
$defaultType = $savedViewDataTable ?: $defaultType ?: $defaultViewType;
}
$type = Common::getRequestVar('viewDataTable', $defaultType, 'string');
// Common::getRequestVar removes backslashes from the defaultValue in case magic quotes are enabled.
// therefore do not pass this as a default value to getRequestVar()
if ('' === $type) {
$type = $defaultType ?: self::DEFAULT_VIEW;
}
} else {
$type = $defaultViewType;
}
$params['viewDataTable'] = $type;
$visualizations = Manager::getAvailableViewDataTables();
if (array_key_exists($type, $visualizations)) {
return self::createViewDataTableInstance($visualizations[$type], $controllerAction, $apiAction, $params);
}
if (array_key_exists($defaultType, $visualizations)) {
return self::createViewDataTableInstance($visualizations[$defaultType], $controllerAction, $apiAction, $params);
}
if (array_key_exists(self::DEFAULT_VIEW, $visualizations)) {
return self::createViewDataTableInstance($visualizations[self::DEFAULT_VIEW], $controllerAction, $apiAction, $params);
}
throw new \Exception('No visualization found to render ViewDataTable');
} | php | public static function build($defaultType = null, $apiAction = false, $controllerAction = false, $forceDefault = false, $loadViewDataTableParametersForUser = null)
{
if (false === $controllerAction) {
$controllerAction = $apiAction;
}
$report = self::getReport($apiAction);
$defaultViewType = self::getDefaultViewTypeForReport($report, $apiAction);
$params = array();
$containerId = Common::getRequestVar('containerId', '', 'string');
if (!isset($loadViewDataTableParametersForUser)) {
$loadViewDataTableParametersForUser = ($containerId != '' || '0' == Common::getRequestVar('widget', '0', 'string'));
}
if ($loadViewDataTableParametersForUser) {
$login = Piwik::getCurrentUserLogin();
$paramsKey = $controllerAction;
if (!empty($report) && $controllerAction === $apiAction) {
$paramsKey = $report->getId();
}
$params = Manager::getViewDataTableParameters($login, $paramsKey, $containerId);
}
if (!self::isDefaultViewTypeForReportFixed($report)) {
$savedViewDataTable = false;
if (!empty($params['viewDataTable'])) {
$savedViewDataTable = $params['viewDataTable'];
}
// order of default viewDataTables' priority is: function specified default, saved default, configured default for report
// function specified default is preferred
// -> force default == true : defaultType ?: saved ?: defaultView
// -> force default == false : saved ?: defaultType ?: defaultView
if ($forceDefault) {
$defaultType = $defaultType ?: $savedViewDataTable ?: $defaultViewType;
} else {
$defaultType = $savedViewDataTable ?: $defaultType ?: $defaultViewType;
}
$type = Common::getRequestVar('viewDataTable', $defaultType, 'string');
// Common::getRequestVar removes backslashes from the defaultValue in case magic quotes are enabled.
// therefore do not pass this as a default value to getRequestVar()
if ('' === $type) {
$type = $defaultType ?: self::DEFAULT_VIEW;
}
} else {
$type = $defaultViewType;
}
$params['viewDataTable'] = $type;
$visualizations = Manager::getAvailableViewDataTables();
if (array_key_exists($type, $visualizations)) {
return self::createViewDataTableInstance($visualizations[$type], $controllerAction, $apiAction, $params);
}
if (array_key_exists($defaultType, $visualizations)) {
return self::createViewDataTableInstance($visualizations[$defaultType], $controllerAction, $apiAction, $params);
}
if (array_key_exists(self::DEFAULT_VIEW, $visualizations)) {
return self::createViewDataTableInstance($visualizations[self::DEFAULT_VIEW], $controllerAction, $apiAction, $params);
}
throw new \Exception('No visualization found to render ViewDataTable');
} | [
"public",
"static",
"function",
"build",
"(",
"$",
"defaultType",
"=",
"null",
",",
"$",
"apiAction",
"=",
"false",
",",
"$",
"controllerAction",
"=",
"false",
",",
"$",
"forceDefault",
"=",
"false",
",",
"$",
"loadViewDataTableParametersForUser",
"=",
"null",... | Creates a {@link Piwik\Plugin\ViewDataTable} instance by ID. If the **viewDataTable** query parameter is set,
this parameter's value is used as the ID.
See {@link Piwik\Plugin\ViewDataTable} to read about the visualizations that are packaged with Piwik.
@param string|null $defaultType A ViewDataTable ID representing the default ViewDataTable type to use. If
the **viewDataTable** query parameter is not found, this value is used as
the ID of the ViewDataTable to create.
If a visualization type is configured for the report being displayed, it
is used instead of the default type. (See {@hook ViewDataTable.getDefaultType}).
If nothing is configured for the report and `null` is supplied for this
argument, **table** is used.
@param bool|false|string $apiAction The API method for the report that will be displayed, eg,
`'DevicesDetection.getBrowsers'`.
@param bool|false|string $controllerAction The controller name and action dedicated to displaying the report. This
action is used when reloading reports or changing the report visualization.
Defaulted to `$apiAction` if `false` is supplied.
@param bool $forceDefault If true, then the visualization type that was configured for the report will be
ignored and `$defaultType` will be used as the default.
@param bool $loadViewDataTableParametersForUser Whether the per-user parameters for this user, this ViewDataTable and this Api action
should be loaded from the user preferences and override the default params values.
@throws \Exception
@return \Piwik\Plugin\ViewDataTable | [
"Creates",
"a",
"{",
"@link",
"Piwik",
"\\",
"Plugin",
"\\",
"ViewDataTable",
"}",
"instance",
"by",
"ID",
".",
"If",
"the",
"**",
"viewDataTable",
"**",
"query",
"parameter",
"is",
"set",
"this",
"parameter",
"s",
"value",
"is",
"used",
"as",
"the",
"ID... | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/ViewDataTable/Factory.php#L97-L168 | train | Build the view table | [
30522,
2270,
10763,
3853,
3857,
1006,
1002,
12398,
13874,
1027,
19701,
1010,
1002,
17928,
18908,
3258,
1027,
6270,
1010,
1002,
11486,
18908,
3258,
1027,
6270,
1010,
1002,
3140,
12879,
23505,
1027,
6270,
1010,
1002,
7170,
8584,
2850,
29336,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/API/DataTableManipulator/LabelFilter.php | LabelFilter.getLabelVariations | private function getLabelVariations($originalLabel)
{
static $pageTitleReports = array('getPageTitles', 'getEntryPageTitles', 'getExitPageTitles');
$originalLabel = trim($originalLabel);
$isTerminal = substr($originalLabel, 0, 1) == self::TERMINAL_OPERATOR;
if ($isTerminal) {
$originalLabel = substr($originalLabel, 1);
}
$variations = array();
$label = trim(urldecode($originalLabel));
$sanitizedLabel = Common::sanitizeInputValue($label);
$variations[] = $sanitizedLabel;
if ($this->apiModule == 'Actions'
&& in_array($this->apiMethod, $pageTitleReports)
) {
if ($isTerminal) {
array_unshift($variations, ' ' . $sanitizedLabel);
array_unshift($variations, ' ' . $label);
} else {
// special case: the Actions.getPageTitles report prefixes some labels with a blank.
// the blank might be passed by the user but is removed in Request::getRequestArrayFromString.
$variations[] = ' ' . $sanitizedLabel;
$variations[] = ' ' . $label;
}
}
$variations[] = $label;
$variations = array_unique($variations);
return $variations;
} | php | private function getLabelVariations($originalLabel)
{
static $pageTitleReports = array('getPageTitles', 'getEntryPageTitles', 'getExitPageTitles');
$originalLabel = trim($originalLabel);
$isTerminal = substr($originalLabel, 0, 1) == self::TERMINAL_OPERATOR;
if ($isTerminal) {
$originalLabel = substr($originalLabel, 1);
}
$variations = array();
$label = trim(urldecode($originalLabel));
$sanitizedLabel = Common::sanitizeInputValue($label);
$variations[] = $sanitizedLabel;
if ($this->apiModule == 'Actions'
&& in_array($this->apiMethod, $pageTitleReports)
) {
if ($isTerminal) {
array_unshift($variations, ' ' . $sanitizedLabel);
array_unshift($variations, ' ' . $label);
} else {
// special case: the Actions.getPageTitles report prefixes some labels with a blank.
// the blank might be passed by the user but is removed in Request::getRequestArrayFromString.
$variations[] = ' ' . $sanitizedLabel;
$variations[] = ' ' . $label;
}
}
$variations[] = $label;
$variations = array_unique($variations);
return $variations;
} | [
"private",
"function",
"getLabelVariations",
"(",
"$",
"originalLabel",
")",
"{",
"static",
"$",
"pageTitleReports",
"=",
"array",
"(",
"'getPageTitles'",
",",
"'getEntryPageTitles'",
",",
"'getExitPageTitles'",
")",
";",
"$",
"originalLabel",
"=",
"trim",
"(",
"$... | Use variations of the label to make it easier to specify the desired label
Note: The HTML Encoded version must be tried first, since in ResponseBuilder the $label is unsanitized
via Common::unsanitizeLabelParameter.
@param string $originalLabel
@return array | [
"Use",
"variations",
"of",
"the",
"label",
"to",
"make",
"it",
"easier",
"to",
"specify",
"the",
"desired",
"label"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/API/DataTableManipulator/LabelFilter.php#L125-L160 | train | Returns the variations of the label | [
30522,
2797,
3853,
2131,
20470,
2884,
10755,
18963,
2015,
1006,
1002,
2434,
20470,
2884,
1007,
30524,
12241,
1006,
1002,
2434,
20470,
2884,
1007,
1025,
1002,
21541,
2121,
22311,
2140,
1027,
4942,
3367,
2099,
1006,
1002,
2434,
20470,
2884,
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/Notifications/Messages/MailMessage.php | MailMessage.replyTo | public function replyTo($address, $name = null)
{
if ($this->arrayOfAddresses($address)) {
$this->replyTo += $this->parseAddresses($address);
} else {
$this->replyTo[] = [$address, $name];
}
return $this;
} | php | public function replyTo($address, $name = null)
{
if ($this->arrayOfAddresses($address)) {
$this->replyTo += $this->parseAddresses($address);
} else {
$this->replyTo[] = [$address, $name];
}
return $this;
} | [
"public",
"function",
"replyTo",
"(",
"$",
"address",
",",
"$",
"name",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"arrayOfAddresses",
"(",
"$",
"address",
")",
")",
"{",
"$",
"this",
"->",
"replyTo",
"+=",
"$",
"this",
"->",
"parseAddresse... | Set the "reply to" address of the message.
@param array|string $address
@param string|null $name
@return $this | [
"Set",
"the",
"reply",
"to",
"address",
"of",
"the",
"message",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Notifications/Messages/MailMessage.php#L151-L160 | train | Add replyTo address | [
30522,
2270,
3853,
7514,
3406,
1006,
1002,
4769,
1010,
1002,
2171,
1027,
19701,
1007,
1063,
2065,
1006,
1002,
2023,
1011,
1028,
9140,
11253,
4215,
16200,
11393,
2015,
1006,
1002,
4769,
1007,
1007,
1063,
1002,
2023,
1011,
1028,
7514,
3406,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Utils.php | Utils.replaceLastOccurrence | public static function replaceLastOccurrence($search, $replace, $subject)
{
$pos = strrpos($subject, $search);
if($pos !== false)
{
$subject = static::mb_substr_replace($subject, $replace, $pos, mb_strlen($search));
}
return $subject;
} | php | public static function replaceLastOccurrence($search, $replace, $subject)
{
$pos = strrpos($subject, $search);
if($pos !== false)
{
$subject = static::mb_substr_replace($subject, $replace, $pos, mb_strlen($search));
}
return $subject;
} | [
"public",
"static",
"function",
"replaceLastOccurrence",
"(",
"$",
"search",
",",
"$",
"replace",
",",
"$",
"subject",
")",
"{",
"$",
"pos",
"=",
"strrpos",
"(",
"$",
"subject",
",",
"$",
"search",
")",
";",
"if",
"(",
"$",
"pos",
"!==",
"false",
")"... | Utility method to replace only the last occurrence in a string
@param string $search
@param string $replace
@param string $subject
@return string | [
"Utility",
"method",
"to",
"replace",
"only",
"the",
"last",
"occurrence",
"in",
"a",
"string"
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Utils.php#L235-L245 | train | Replace last occurrence in a string | [
30522,
2270,
10763,
3853,
5672,
8523,
3406,
9468,
30524,
999,
1027,
1027,
6270,
1007,
1063,
1002,
3395,
1027,
10763,
1024,
1024,
16914,
1035,
4942,
3367,
2099,
1035,
5672,
1006,
1002,
3395,
1010,
1002,
5672,
1010,
1002,
13433,
2015,
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... |
PHPMailer/PHPMailer | src/PHPMailer.php | PHPMailer.isHTML | public function isHTML($isHtml = true)
{
if ($isHtml) {
$this->ContentType = static::CONTENT_TYPE_TEXT_HTML;
} else {
$this->ContentType = static::CONTENT_TYPE_PLAINTEXT;
}
} | php | public function isHTML($isHtml = true)
{
if ($isHtml) {
$this->ContentType = static::CONTENT_TYPE_TEXT_HTML;
} else {
$this->ContentType = static::CONTENT_TYPE_PLAINTEXT;
}
} | [
"public",
"function",
"isHTML",
"(",
"$",
"isHtml",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"isHtml",
")",
"{",
"$",
"this",
"->",
"ContentType",
"=",
"static",
"::",
"CONTENT_TYPE_TEXT_HTML",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"ContentType",
"="... | Sets message type to HTML or plain.
@param bool $isHtml True for HTML mode | [
"Sets",
"message",
"type",
"to",
"HTML",
"or",
"plain",
"."
] | 3d7132341659a8a201adbc3ba11b1e202ee2857c | https://github.com/PHPMailer/PHPMailer/blob/3d7132341659a8a201adbc3ba11b1e202ee2857c/src/PHPMailer.php#L882-L889 | train | Set Content - Type to HTML or plain text | [
30522,
2270,
3853,
2003,
11039,
19968,
1006,
1002,
2003,
11039,
19968,
1027,
2995,
1007,
1063,
2065,
1006,
1002,
2003,
11039,
19968,
1007,
1063,
1002,
2023,
1011,
1028,
4180,
13874,
1027,
10763,
1024,
1024,
4180,
1035,
2828,
1035,
3793,
103... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/DataTable/Renderer/Php.php | Php.renderSimpleTable | protected function renderSimpleTable($table)
{
$array = array();
$row = $table->getFirstRow();
if ($row === false) {
return $array;
}
foreach ($row->getColumns() as $columnName => $columnValue) {
$array[$columnName] = $columnValue;
}
return $array;
} | php | protected function renderSimpleTable($table)
{
$array = array();
$row = $table->getFirstRow();
if ($row === false) {
return $array;
}
foreach ($row->getColumns() as $columnName => $columnValue) {
$array[$columnName] = $columnValue;
}
return $array;
} | [
"protected",
"function",
"renderSimpleTable",
"(",
"$",
"table",
")",
"{",
"$",
"array",
"=",
"array",
"(",
")",
";",
"$",
"row",
"=",
"$",
"table",
"->",
"getFirstRow",
"(",
")",
";",
"if",
"(",
"$",
"row",
"===",
"false",
")",
"{",
"return",
"$",... | Converts the simple data table to an array
@param Simple $table
@return array | [
"Converts",
"the",
"simple",
"data",
"table",
"to",
"an",
"array"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/DataTable/Renderer/Php.php#L237-L249 | train | Render simple table | [
30522,
5123,
3853,
17552,
5332,
23344,
10880,
1006,
1002,
2795,
1007,
1063,
1002,
9140,
1027,
9140,
1006,
1007,
1025,
1002,
5216,
1027,
1002,
2795,
1011,
1028,
2131,
8873,
12096,
10524,
1006,
1007,
1025,
2065,
1006,
1002,
5216,
1027,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/Scheduler/Scheduler.php | Scheduler.rescheduleTask | public function rescheduleTask(Task $task)
{
$this->logger->debug('Rescheduling task {task}', array('task' => $task->getName()));
$this->timetable->rescheduleTask($task);
} | php | public function rescheduleTask(Task $task)
{
$this->logger->debug('Rescheduling task {task}', array('task' => $task->getName()));
$this->timetable->rescheduleTask($task);
} | [
"public",
"function",
"rescheduleTask",
"(",
"Task",
"$",
"task",
")",
"{",
"$",
"this",
"->",
"logger",
"->",
"debug",
"(",
"'Rescheduling task {task}'",
",",
"array",
"(",
"'task'",
"=>",
"$",
"task",
"->",
"getName",
"(",
")",
")",
")",
";",
"$",
"t... | 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.
@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#L176-L181 | train | Reschedules a task | [
30522,
2270,
3853,
24501,
7690,
9307,
10230,
2243,
1006,
4708,
1002,
4708,
1007,
1063,
1002,
2023,
1011,
1028,
8833,
4590,
1011,
1028,
2139,
8569,
2290,
1006,
1005,
24501,
7690,
18639,
2290,
4708,
1063,
4708,
1065,
1005,
1010,
9140,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/HTML/QuickForm2/Element/Select.php | HTML_QuickForm2_Element_Select.loadOptions | public function loadOptions(array $options)
{
$this->possibleValues = array();
$this->optionContainer = new HTML_QuickForm2_Element_Select_OptionContainer(
$this->values, $this->possibleValues
);
$this->loadOptionsFromArray($this->optionContainer, $options);
return $this;
} | php | public function loadOptions(array $options)
{
$this->possibleValues = array();
$this->optionContainer = new HTML_QuickForm2_Element_Select_OptionContainer(
$this->values, $this->possibleValues
);
$this->loadOptionsFromArray($this->optionContainer, $options);
return $this;
} | [
"public",
"function",
"loadOptions",
"(",
"array",
"$",
"options",
")",
"{",
"$",
"this",
"->",
"possibleValues",
"=",
"array",
"(",
")",
";",
"$",
"this",
"->",
"optionContainer",
"=",
"new",
"HTML_QuickForm2_Element_Select_OptionContainer",
"(",
"$",
"this",
... | Loads <option>s (and <optgroup>s) for select element
The method expects a array of options and optgroups:
<pre>
array(
'option value 1' => 'option text 1',
...
'option value N' => 'option text N',
'optgroup label 1' => array(
'option value' => 'option text',
...
),
...
)
</pre>
If value is a scalar, then array key is treated as "value" attribute of
<option> and value as this <option>'s text. If value is an array, then
key is treated as a "label" attribute of <optgroup> and value as an
array of <option>s for this <optgroup>.
If you need to specify additional attributes for <option> and <optgroup>
tags, then you need to use {@link addOption()} and {@link addOptgroup()}
methods instead of this one.
@param array
@throws HTML_QuickForm2_InvalidArgumentException if junk is given in $options
@return HTML_QuickForm2_Element_Select | [
"Loads",
"<option",
">",
"s",
"(",
"and",
"<optgroup",
">",
"s",
")",
"for",
"select",
"element"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/HTML/QuickForm2/Element/Select.php#L496-L504 | train | Load options from an array | [
30522,
2270,
3853,
7170,
7361,
9285,
1006,
9140,
1002,
7047,
1007,
1063,
1002,
2023,
1011,
1028,
2825,
10175,
15808,
1027,
9140,
1006,
1007,
1025,
1002,
2023,
1011,
1028,
5724,
8663,
18249,
2121,
1027,
2047,
16129,
1035,
4248,
14192,
2475,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Database/Query/Grammars/Grammar.php | Grammar.whereNotInSub | protected function whereNotInSub(Builder $query, $where)
{
return $this->wrap($where['column']).' not in ('.$this->compileSelect($where['query']).')';
} | php | protected function whereNotInSub(Builder $query, $where)
{
return $this->wrap($where['column']).' not in ('.$this->compileSelect($where['query']).')';
} | [
"protected",
"function",
"whereNotInSub",
"(",
"Builder",
"$",
"query",
",",
"$",
"where",
")",
"{",
"return",
"$",
"this",
"->",
"wrap",
"(",
"$",
"where",
"[",
"'column'",
"]",
")",
".",
"' not in ('",
".",
"$",
"this",
"->",
"compileSelect",
"(",
"$... | Compile a where not in sub-select clause.
@param \Illuminate\Database\Query\Builder $query
@param array $where
@return string | [
"Compile",
"a",
"where",
"not",
"in",
"sub",
"-",
"select",
"clause",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Query/Grammars/Grammar.php#L319-L322 | train | Internal method to wrap where not in sub - select clauses in a query | [
30522,
5123,
3853,
2073,
17048,
7076,
12083,
1006,
12508,
1002,
23032,
1010,
1002,
2073,
1007,
1063,
2709,
1002,
2023,
1011,
1028,
10236,
1006,
1002,
2073,
1031,
1005,
5930,
1005,
1033,
1007,
1012,
1005,
2025,
1999,
1006,
1005,
1012,
1002,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
z-song/laravel-admin | src/Form.php | Form.getRelations | public function getRelations()
{
$relations = $columns = [];
/** @var Field $field */
foreach ($this->builder->fields() as $field) {
$columns[] = $field->column();
}
foreach (Arr::flatten($columns) as $column) {
if (Str::contains($column, '.')) {
list($relation) = explode('.', $column);
if (method_exists($this->model, $relation) &&
$this->model->$relation() instanceof Relations\Relation
) {
$relations[] = $relation;
}
} elseif (method_exists($this->model, $column) &&
!method_exists(Model::class, $column)
) {
$relations[] = $column;
}
}
return array_unique($relations);
} | php | public function getRelations()
{
$relations = $columns = [];
/** @var Field $field */
foreach ($this->builder->fields() as $field) {
$columns[] = $field->column();
}
foreach (Arr::flatten($columns) as $column) {
if (Str::contains($column, '.')) {
list($relation) = explode('.', $column);
if (method_exists($this->model, $relation) &&
$this->model->$relation() instanceof Relations\Relation
) {
$relations[] = $relation;
}
} elseif (method_exists($this->model, $column) &&
!method_exists(Model::class, $column)
) {
$relations[] = $column;
}
}
return array_unique($relations);
} | [
"public",
"function",
"getRelations",
"(",
")",
"{",
"$",
"relations",
"=",
"$",
"columns",
"=",
"[",
"]",
";",
"/** @var Field $field */",
"foreach",
"(",
"$",
"this",
"->",
"builder",
"->",
"fields",
"(",
")",
"as",
"$",
"field",
")",
"{",
"$",
"colu... | Get all relations of model from callable.
@return array | [
"Get",
"all",
"relations",
"of",
"model",
"from",
"callable",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Form.php#L1140-L1166 | train | Get relations from model | [
30522,
2270,
3853,
2131,
16570,
10708,
1006,
1007,
1063,
1002,
4262,
1027,
1002,
7753,
1027,
1031,
1033,
1025,
1013,
1008,
1008,
1030,
13075,
2492,
1002,
2492,
1008,
1013,
18921,
6776,
1006,
1002,
2023,
1011,
1028,
12508,
1011,
1028,
4249,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/API/Renderer/Php.php | Php.shouldSerialize | private function shouldSerialize($defaultSerializeValue)
{
$serialize = Common::getRequestVar('serialize', $defaultSerializeValue, 'int', $this->request);
return !empty($serialize);
} | php | private function shouldSerialize($defaultSerializeValue)
{
$serialize = Common::getRequestVar('serialize', $defaultSerializeValue, 'int', $this->request);
return !empty($serialize);
} | [
"private",
"function",
"shouldSerialize",
"(",
"$",
"defaultSerializeValue",
")",
"{",
"$",
"serialize",
"=",
"Common",
"::",
"getRequestVar",
"(",
"'serialize'",
",",
"$",
"defaultSerializeValue",
",",
"'int'",
",",
"$",
"this",
"->",
"request",
")",
";",
"re... | Returns true if the user requested to serialize the output data (&serialize=1 in the request)
@param mixed $defaultSerializeValue Default value in case the user hasn't specified a value
@return bool | [
"Returns",
"true",
"if",
"the",
"user",
"requested",
"to",
"serialize",
"the",
"output",
"data",
"(",
"&serialize",
"=",
"1",
"in",
"the",
"request",
")"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/API/Renderer/Php.php#L71-L76 | train | Returns true if the default serialize value is set in the request | [
30522,
2797,
3853,
2323,
8043,
4818,
4697,
1006,
1002,
12398,
8043,
4818,
4697,
10175,
5657,
1007,
1063,
1002,
7642,
4697,
1027,
2691,
1024,
1024,
2131,
2890,
15500,
10755,
1006,
1005,
7642,
4697,
1005,
1010,
1002,
12398,
8043,
4818,
4697,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/OpenWork/Provider/Client.php | Client.getRegisterCode | public function getRegisterCode(
string $corpName = '',
string $adminName = '',
string $adminMobile = '',
string $state = ''
) {
$params = [];
$params['template_id'] = $this->app['config']['reg_template_id'];
!empty($corpName) && $params['corp_name'] = $corpName;
!empty($adminName) && $params['admin_name'] = $adminName;
!empty($adminMobile) && $params['admin_mobile'] = $adminMobile;
!empty($state) && $params['state'] = $state;
return $this->httpPostJson('cgi-bin/service/get_register_code', $params);
} | php | public function getRegisterCode(
string $corpName = '',
string $adminName = '',
string $adminMobile = '',
string $state = ''
) {
$params = [];
$params['template_id'] = $this->app['config']['reg_template_id'];
!empty($corpName) && $params['corp_name'] = $corpName;
!empty($adminName) && $params['admin_name'] = $adminName;
!empty($adminMobile) && $params['admin_mobile'] = $adminMobile;
!empty($state) && $params['state'] = $state;
return $this->httpPostJson('cgi-bin/service/get_register_code', $params);
} | [
"public",
"function",
"getRegisterCode",
"(",
"string",
"$",
"corpName",
"=",
"''",
",",
"string",
"$",
"adminName",
"=",
"''",
",",
"string",
"$",
"adminMobile",
"=",
"''",
",",
"string",
"$",
"state",
"=",
"''",
")",
"{",
"$",
"params",
"=",
"[",
"... | 获取注册码.
@param string $corpName
@param string $adminName
@param string $adminMobile
@param string $state
@return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
@throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException | [
"获取注册码",
"."
] | 120c72faaa93c270365bc75c73c362d5fd583209 | https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/OpenWork/Provider/Client.php#L105-L119 | train | Get register code | [
30522,
2270,
3853,
2131,
2890,
24063,
2121,
16044,
1006,
5164,
1002,
13058,
18442,
1027,
1005,
1005,
1010,
5164,
1002,
4748,
10020,
18442,
1027,
1005,
1005,
1010,
5164,
1002,
4748,
10020,
17751,
1027,
1005,
1005,
1010,
5164,
1002,
2110,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/Zend/Mail/Storage/Maildir.php | Zend_Mail_Storage_Maildir.getRawContent | public function getRawContent($id, $part = null)
{
if ($part !== null) {
// TODO: implement
/**
* @see Zend_Mail_Storage_Exception
*/
// require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('not implemented');
}
$fh = fopen($this->_getFileData($id, 'filename'), 'r');
while (!feof($fh)) {
$line = fgets($fh);
if (!trim($line)) {
break;
}
}
$content = stream_get_contents($fh);
fclose($fh);
return $content;
} | php | public function getRawContent($id, $part = null)
{
if ($part !== null) {
// TODO: implement
/**
* @see Zend_Mail_Storage_Exception
*/
// require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('not implemented');
}
$fh = fopen($this->_getFileData($id, 'filename'), 'r');
while (!feof($fh)) {
$line = fgets($fh);
if (!trim($line)) {
break;
}
}
$content = stream_get_contents($fh);
fclose($fh);
return $content;
} | [
"public",
"function",
"getRawContent",
"(",
"$",
"id",
",",
"$",
"part",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"part",
"!==",
"null",
")",
"{",
"// TODO: implement",
"/**\n * @see Zend_Mail_Storage_Exception\n */",
"// require_once 'Zend/Mail/St... | /*
Get raw content of message or part
@param int $id number of message
@param null|array|string $part path to part or null for messsage content
@return string raw content
@throws Zend_Mail_Storage_Exception | [
"/",
"*",
"Get",
"raw",
"content",
"of",
"message",
"or",
"part"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Mail/Storage/Maildir.php#L230-L253 | train | Get raw content of a file | [
30522,
2270,
3853,
2131,
2527,
16526,
28040,
3372,
1006,
1002,
8909,
1010,
1002,
2112,
1027,
19701,
1007,
1063,
2065,
1006,
1002,
2112,
999,
1027,
1027,
19701,
1007,
1063,
1013,
1013,
28681,
2080,
1024,
10408,
1013,
1008,
1008,
1008,
1030,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Diagnostics/ConfigReader.php | ConfigReader.addConfigValuesFromSystemSettings | public function addConfigValuesFromSystemSettings($configValues, $systemSettings)
{
foreach ($systemSettings as $pluginSetting) {
$pluginName = $pluginSetting->getPluginName();
if (empty($pluginName)) {
continue;
}
if (!array_key_exists($pluginName, $configValues)) {
$configValues[$pluginName] = array();
}
foreach ($pluginSetting->getSettingsWritableByCurrentUser() as $setting) {
$name = $setting->getName();
$configSection = $pluginName;
if ($setting instanceof PiwikSettings\Plugin\SystemConfigSetting) {
$configSection = $setting->getConfigSectionName();
if ($this->shouldSkipCategory($configSection)) {
continue;
}
}
$config = $setting->configureField();
$description = '';
if (!empty($config->description)) {
$description .= $config->description . ' ';
}
if (!empty($config->inlineHelp)) {
$description .= $config->inlineHelp;
}
if (isset($configValues[$configSection][$name])) {
$configValues[$configSection][$name]['defaultValue'] = $setting->getDefaultValue();
$configValues[$configSection][$name]['description'] = trim($description);
if ($config->uiControl === PiwikSettings\FieldConfig::UI_CONTROL_PASSWORD) {
$configValues[$configSection][$name]['value'] = $this->getMaskedPassword();
}
} else {
$defaultValue = $setting->getValue();
$configValues[$configSection][$name] = array(
'value' => null,
'description' => trim($description),
'isCustomValue' => false,
'defaultValue' => $defaultValue
);
}
}
if (empty($configValues[$pluginName])) {
unset($configValues[$pluginName]);
}
}
return $configValues;
} | php | public function addConfigValuesFromSystemSettings($configValues, $systemSettings)
{
foreach ($systemSettings as $pluginSetting) {
$pluginName = $pluginSetting->getPluginName();
if (empty($pluginName)) {
continue;
}
if (!array_key_exists($pluginName, $configValues)) {
$configValues[$pluginName] = array();
}
foreach ($pluginSetting->getSettingsWritableByCurrentUser() as $setting) {
$name = $setting->getName();
$configSection = $pluginName;
if ($setting instanceof PiwikSettings\Plugin\SystemConfigSetting) {
$configSection = $setting->getConfigSectionName();
if ($this->shouldSkipCategory($configSection)) {
continue;
}
}
$config = $setting->configureField();
$description = '';
if (!empty($config->description)) {
$description .= $config->description . ' ';
}
if (!empty($config->inlineHelp)) {
$description .= $config->inlineHelp;
}
if (isset($configValues[$configSection][$name])) {
$configValues[$configSection][$name]['defaultValue'] = $setting->getDefaultValue();
$configValues[$configSection][$name]['description'] = trim($description);
if ($config->uiControl === PiwikSettings\FieldConfig::UI_CONTROL_PASSWORD) {
$configValues[$configSection][$name]['value'] = $this->getMaskedPassword();
}
} else {
$defaultValue = $setting->getValue();
$configValues[$configSection][$name] = array(
'value' => null,
'description' => trim($description),
'isCustomValue' => false,
'defaultValue' => $defaultValue
);
}
}
if (empty($configValues[$pluginName])) {
unset($configValues[$pluginName]);
}
}
return $configValues;
} | [
"public",
"function",
"addConfigValuesFromSystemSettings",
"(",
"$",
"configValues",
",",
"$",
"systemSettings",
")",
"{",
"foreach",
"(",
"$",
"systemSettings",
"as",
"$",
"pluginSetting",
")",
"{",
"$",
"pluginName",
"=",
"$",
"pluginSetting",
"->",
"getPluginNa... | Adds config values that can be used to overwrite a plugin system setting and adds a description + default value
for already existing configured config values that overwrite a plugin system setting.
@param array $configValues
@param \Piwik\Settings\Plugin\SystemSettings[] $systemSettings
@return array | [
"Adds",
"config",
"values",
"that",
"can",
"be",
"used",
"to",
"overwrite",
"a",
"plugin",
"system",
"setting",
"and",
"adds",
"a",
"description",
"+",
"default",
"value",
"for",
"already",
"existing",
"configured",
"config",
"values",
"that",
"overwrite",
"a"... | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Diagnostics/ConfigReader.php#L142-L204 | train | Adds the config values from system settings to the config values array | [
30522,
2270,
3853,
5587,
8663,
8873,
2290,
10175,
15808,
19699,
22225,
27268,
6633,
21678,
8613,
1006,
1002,
9530,
8873,
2290,
10175,
15808,
1010,
1002,
3001,
18319,
3070,
2015,
1007,
1063,
18921,
6776,
1006,
1002,
3001,
18319,
3070,
2015,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/Actions/Columns/InteractionPosition.php | InteractionPosition.onNewAction | public function onNewAction(Request $request, Visitor $visitor, Action $action)
{
$shouldCount = VisitTotalInteractions::shouldCountInteraction($action);
if ($shouldCount && $visitor->isNewVisit()) {
return 1;
} else if ($shouldCount) {
return VisitTotalInteractions::getNextInteractionPosition($request);
}
// we re-use same interaction position as last page view eg for events etc.
$position = VisitTotalInteractions::getCurrentInteractionPosition($request);
if ($position >= 1) {
return $position;
}
return false;
} | php | public function onNewAction(Request $request, Visitor $visitor, Action $action)
{
$shouldCount = VisitTotalInteractions::shouldCountInteraction($action);
if ($shouldCount && $visitor->isNewVisit()) {
return 1;
} else if ($shouldCount) {
return VisitTotalInteractions::getNextInteractionPosition($request);
}
// we re-use same interaction position as last page view eg for events etc.
$position = VisitTotalInteractions::getCurrentInteractionPosition($request);
if ($position >= 1) {
return $position;
}
return false;
} | [
"public",
"function",
"onNewAction",
"(",
"Request",
"$",
"request",
",",
"Visitor",
"$",
"visitor",
",",
"Action",
"$",
"action",
")",
"{",
"$",
"shouldCount",
"=",
"VisitTotalInteractions",
"::",
"shouldCountInteraction",
"(",
"$",
"action",
")",
";",
"if",
... | @param Request $request
@param Visitor $visitor
@param Action $action
@return mixed|false | [
"@param",
"Request",
"$request",
"@param",
"Visitor",
"$visitor",
"@param",
"Action",
"$action"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Actions/Columns/InteractionPosition.php#L32-L49 | train | This method is called when a new action is triggered. | [
30522,
2270,
3853,
2006,
2638,
4213,
7542,
1006,
5227,
1002,
5227,
1010,
10367,
1002,
10367,
1010,
2895,
1002,
2895,
1007,
1063,
1002,
2323,
3597,
16671,
1027,
3942,
3406,
9080,
18447,
6906,
22014,
1024,
1024,
2323,
3597,
16671,
18447,
6906... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/Zend/Db/Adapter/Pdo/Ibm.php | Zend_Db_Adapter_Pdo_Ibm.describeTable | public function describeTable($tableName, $schemaName = null)
{
$this->_connect();
return $this->_serverType->describeTable($tableName, $schemaName);
} | php | public function describeTable($tableName, $schemaName = null)
{
$this->_connect();
return $this->_serverType->describeTable($tableName, $schemaName);
} | [
"public",
"function",
"describeTable",
"(",
"$",
"tableName",
",",
"$",
"schemaName",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"_connect",
"(",
")",
";",
"return",
"$",
"this",
"->",
"_serverType",
"->",
"describeTable",
"(",
"$",
"tableName",
",",
"$",... | Returns the column descriptions for a table.
The return value is an associative array keyed by the column name,
as returned by the RDBMS.
The value of each array element is an associative array
with the following keys:
SCHEMA_NAME => string; name of database or schema
TABLE_NAME => string;
COLUMN_NAME => string; column name
COLUMN_POSITION => number; ordinal position of column in table
DATA_TYPE => string; SQL datatype name of column
DEFAULT => string; default expression of column, null if none
NULLABLE => boolean; true if column can have nulls
LENGTH => number; length of CHAR/VARCHAR
SCALE => number; scale of NUMERIC/DECIMAL
PRECISION => number; precision of NUMERIC/DECIMAL
UNSIGNED => boolean; unsigned property of an integer type
PRIMARY => boolean; true if column is part of the primary key
PRIMARY_POSITION => integer; position of column in primary key
@todo Discover integer unsigned property.
@param string $tableName
@param string $schemaName OPTIONAL
@return array | [
"Returns",
"the",
"column",
"descriptions",
"for",
"a",
"table",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Adapter/Pdo/Ibm.php#L242-L246 | train | Describe table. | [
30522,
2270,
3853,
6235,
10880,
1006,
1002,
2795,
18442,
1010,
1002,
8040,
28433,
18442,
1027,
19701,
1007,
1063,
1002,
2023,
1011,
1028,
1035,
7532,
1006,
1007,
1025,
2709,
1002,
2023,
1011,
1028,
1035,
8241,
13874,
1011,
1028,
6235,
10880... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/backend/widgets/table/DataSourceBase.php | DataSourceBase.readRecords | public function readRecords($count = 10)
{
$result = $this->getRecords($this->offset, $count);
$this->offset += count($result);
return $result;
} | php | public function readRecords($count = 10)
{
$result = $this->getRecords($this->offset, $count);
$this->offset += count($result);
return $result;
} | [
"public",
"function",
"readRecords",
"(",
"$",
"count",
"=",
"10",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"getRecords",
"(",
"$",
"this",
"->",
"offset",
",",
"$",
"count",
")",
";",
"$",
"this",
"->",
"offset",
"+=",
"count",
"(",
"$",
... | Returns a set of records from the data source.
@param integer $count Specifies the number of records to return.
@return array Returns the records.
If there are no more records, returns an empty array. | [
"Returns",
"a",
"set",
"of",
"records",
"from",
"the",
"data",
"source",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/table/DataSourceBase.php#L79-L85 | train | Read records from the current offset | [
30522,
2270,
3853,
3191,
2890,
27108,
5104,
1006,
1002,
4175,
1027,
2184,
1007,
1063,
1002,
2765,
1027,
1002,
2023,
1011,
1028,
2131,
2890,
27108,
5104,
1006,
1002,
2023,
1011,
1028,
16396,
1010,
1002,
4175,
1007,
1025,
1002,
2023,
1011,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/HttpKernel/Fragment/InlineFragmentRenderer.php | InlineFragmentRenderer.render | public function render($uri, Request $request, array $options = [])
{
$reference = null;
if ($uri instanceof ControllerReference) {
$reference = $uri;
// Remove attributes from the generated URI because if not, the Symfony
// routing system will use them to populate the Request attributes. We don't
// want that as we want to preserve objects (so we manually set Request attributes
// below instead)
$attributes = $reference->attributes;
$reference->attributes = [];
// The request format and locale might have been overridden by the user
foreach (['_format', '_locale'] as $key) {
if (isset($attributes[$key])) {
$reference->attributes[$key] = $attributes[$key];
}
}
$uri = $this->generateFragmentUri($uri, $request, false, false);
$reference->attributes = array_merge($attributes, $reference->attributes);
}
$subRequest = $this->createSubRequest($uri, $request);
// override Request attributes as they can be objects (which are not supported by the generated URI)
if (null !== $reference) {
$subRequest->attributes->add($reference->attributes);
}
$level = ob_get_level();
try {
return SubRequestHandler::handle($this->kernel, $subRequest, HttpKernelInterface::SUB_REQUEST, false);
} catch (\Exception $e) {
// we dispatch the exception event to trigger the logging
// the response that comes back is ignored
if (isset($options['ignore_errors']) && $options['ignore_errors'] && $this->dispatcher) {
$event = new ExceptionEvent($this->kernel, $request, HttpKernelInterface::SUB_REQUEST, $e);
$this->dispatcher->dispatch($event, KernelEvents::EXCEPTION);
}
// let's clean up the output buffers that were created by the sub-request
Response::closeOutputBuffers($level, false);
if (isset($options['alt'])) {
$alt = $options['alt'];
unset($options['alt']);
return $this->render($alt, $request, $options);
}
if (!isset($options['ignore_errors']) || !$options['ignore_errors']) {
throw $e;
}
return new Response();
}
} | php | public function render($uri, Request $request, array $options = [])
{
$reference = null;
if ($uri instanceof ControllerReference) {
$reference = $uri;
// Remove attributes from the generated URI because if not, the Symfony
// routing system will use them to populate the Request attributes. We don't
// want that as we want to preserve objects (so we manually set Request attributes
// below instead)
$attributes = $reference->attributes;
$reference->attributes = [];
// The request format and locale might have been overridden by the user
foreach (['_format', '_locale'] as $key) {
if (isset($attributes[$key])) {
$reference->attributes[$key] = $attributes[$key];
}
}
$uri = $this->generateFragmentUri($uri, $request, false, false);
$reference->attributes = array_merge($attributes, $reference->attributes);
}
$subRequest = $this->createSubRequest($uri, $request);
// override Request attributes as they can be objects (which are not supported by the generated URI)
if (null !== $reference) {
$subRequest->attributes->add($reference->attributes);
}
$level = ob_get_level();
try {
return SubRequestHandler::handle($this->kernel, $subRequest, HttpKernelInterface::SUB_REQUEST, false);
} catch (\Exception $e) {
// we dispatch the exception event to trigger the logging
// the response that comes back is ignored
if (isset($options['ignore_errors']) && $options['ignore_errors'] && $this->dispatcher) {
$event = new ExceptionEvent($this->kernel, $request, HttpKernelInterface::SUB_REQUEST, $e);
$this->dispatcher->dispatch($event, KernelEvents::EXCEPTION);
}
// let's clean up the output buffers that were created by the sub-request
Response::closeOutputBuffers($level, false);
if (isset($options['alt'])) {
$alt = $options['alt'];
unset($options['alt']);
return $this->render($alt, $request, $options);
}
if (!isset($options['ignore_errors']) || !$options['ignore_errors']) {
throw $e;
}
return new Response();
}
} | [
"public",
"function",
"render",
"(",
"$",
"uri",
",",
"Request",
"$",
"request",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"reference",
"=",
"null",
";",
"if",
"(",
"$",
"uri",
"instanceof",
"ControllerReference",
")",
"{",
"$",
"re... | {@inheritdoc}
Additional available options:
* alt: an alternative URI to render in case of an error | [
"{",
"@inheritdoc",
"}"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/Fragment/InlineFragmentRenderer.php#L47-L107 | train | Renders the URI and returns the response. | [
30522,
2270,
3853,
17552,
1006,
1002,
24471,
2072,
1010,
5227,
1002,
5227,
1010,
9140,
1002,
7047,
1027,
1031,
1033,
1007,
1063,
1002,
4431,
1027,
19701,
1025,
2065,
1006,
1002,
24471,
2072,
6013,
11253,
11486,
2890,
25523,
1007,
1063,
1002... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getgrav/grav | system/src/Grav/Framework/Flex/FlexIndex.php | FlexIndex.search | public function search(string $search, $properties = null, array $options = null)
{
return $this->__call('search', [$search, $properties, $options]);
} | php | public function search(string $search, $properties = null, array $options = null)
{
return $this->__call('search', [$search, $properties, $options]);
} | [
"public",
"function",
"search",
"(",
"string",
"$",
"search",
",",
"$",
"properties",
"=",
"null",
",",
"array",
"$",
"options",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"__call",
"(",
"'search'",
",",
"[",
"$",
"search",
",",
"$",
"proper... | {@inheritdoc}
@see FlexCollectionInterface::search() | [
"{"
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Framework/Flex/FlexIndex.php#L87-L90 | train | Search for a given search string | [
30522,
2270,
3853,
3945,
1006,
5164,
1002,
3945,
1010,
30524,
1028,
1035,
1035,
2655,
1006,
1005,
3945,
1005,
1010,
1031,
1002,
3945,
1010,
1002,
5144,
1010,
1002,
7047,
1033,
1007,
1025,
1065,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/Plugin/Dimension/VisitDimension.php | VisitDimension.uninstall | public function uninstall()
{
if (empty($this->columnName) || empty($this->columnType)) {
return;
}
try {
$sql = "ALTER TABLE `" . Common::prefixTable($this->dbTableName) . "` DROP COLUMN `$this->columnName`";
Db::exec($sql);
} catch (Exception $e) {
if (!Db::get()->isErrNo($e, '1091')) {
throw $e;
}
}
try {
if (!$this->isHandlingLogConversion()) {
return;
}
$sql = "ALTER TABLE `" . Common::prefixTable('log_conversion') . "` DROP COLUMN `$this->columnName`";
Db::exec($sql);
} catch (Exception $e) {
if (!Db::get()->isErrNo($e, '1091')) {
throw $e;
}
}
} | php | public function uninstall()
{
if (empty($this->columnName) || empty($this->columnType)) {
return;
}
try {
$sql = "ALTER TABLE `" . Common::prefixTable($this->dbTableName) . "` DROP COLUMN `$this->columnName`";
Db::exec($sql);
} catch (Exception $e) {
if (!Db::get()->isErrNo($e, '1091')) {
throw $e;
}
}
try {
if (!$this->isHandlingLogConversion()) {
return;
}
$sql = "ALTER TABLE `" . Common::prefixTable('log_conversion') . "` DROP COLUMN `$this->columnName`";
Db::exec($sql);
} catch (Exception $e) {
if (!Db::get()->isErrNo($e, '1091')) {
throw $e;
}
}
} | [
"public",
"function",
"uninstall",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"columnName",
")",
"||",
"empty",
"(",
"$",
"this",
"->",
"columnType",
")",
")",
"{",
"return",
";",
"}",
"try",
"{",
"$",
"sql",
"=",
"\"ALTER TABLE `\"",... | Uninstalls the dimension if a {@link $columnName} and {@link columnType} is set. In case you perform any custom
actions during {@link install()} - for instance adding an index - you should make sure to undo those actions by
overwriting this method. Make sure to call this parent method to make sure the uninstallation of the column
will be done.
@throws Exception
@api | [
"Uninstalls",
"the",
"dimension",
"if",
"a",
"{"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Plugin/Dimension/VisitDimension.php#L118-L145 | train | Uninstalls the column if it s not present in the database | [
30522,
2270,
3853,
4895,
7076,
9080,
2140,
1006,
1007,
1063,
2065,
1006,
4064,
1006,
1002,
2023,
1011,
1028,
5930,
18442,
1007,
1064,
1064,
4064,
1006,
1002,
2023,
1011,
1028,
5930,
13874,
1007,
1007,
1063,
2709,
1025,
1065,
3046,
1063,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/Login/Controller.php | Controller.logout | public function logout()
{
Piwik::postEvent('Login.logout', array(Piwik::getCurrentUserLogin()));
self::clearSession();
$logoutUrl = @Config::getInstance()->General['login_logout_url'];
if (empty($logoutUrl)) {
Piwik::redirectToModule('CoreHome');
} else {
Url::redirectToUrl($logoutUrl);
}
} | php | public function logout()
{
Piwik::postEvent('Login.logout', array(Piwik::getCurrentUserLogin()));
self::clearSession();
$logoutUrl = @Config::getInstance()->General['login_logout_url'];
if (empty($logoutUrl)) {
Piwik::redirectToModule('CoreHome');
} else {
Url::redirectToUrl($logoutUrl);
}
} | [
"public",
"function",
"logout",
"(",
")",
"{",
"Piwik",
"::",
"postEvent",
"(",
"'Login.logout'",
",",
"array",
"(",
"Piwik",
"::",
"getCurrentUserLogin",
"(",
")",
")",
")",
";",
"self",
"::",
"clearSession",
"(",
")",
";",
"$",
"logoutUrl",
"=",
"@",
... | Logout current user
@param none
@return void | [
"Logout",
"current",
"user"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Login/Controller.php#L474-L486 | train | Logouts the current user | [
30522,
2270,
3853,
8154,
4904,
1006,
1007,
1063,
14255,
9148,
2243,
1024,
1024,
2695,
18697,
3372,
1006,
1005,
8833,
2378,
1012,
8154,
4904,
1005,
1010,
9140,
1006,
14255,
9148,
2243,
1024,
1024,
2131,
10841,
14343,
3372,
20330,
21197,
2378... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/Referrers/API.php | API.getReferrerType | public function getReferrerType($idSite, $period, $date, $segment = false, $typeReferrer = false,
$idSubtable = false, $expanded = false)
{
Piwik::checkUserHasViewAccess($idSite);
$this->checkSingleSite($idSite, 'getReferrerType');
// if idSubtable is supplied, interpret idSubtable as referrer type and return correct report
if ($idSubtable !== false) {
$result = false;
switch ($idSubtable) {
case Common::REFERRER_TYPE_SEARCH_ENGINE:
$result = $this->getKeywords($idSite, $period, $date, $segment);
break;
case Common::REFERRER_TYPE_SOCIAL_NETWORK:
$result = $this->getSocials($idSite, $period, $date, $segment);
break;
case Common::REFERRER_TYPE_WEBSITE:
$result = $this->getWebsites($idSite, $period, $date, $segment);
break;
case Common::REFERRER_TYPE_CAMPAIGN:
$result = $this->getCampaigns($idSite, $period, $date, $segment);
break;
default: // invalid idSubtable, return whole report
break;
}
if ($result) {
$result->filter('ColumnCallbackDeleteMetadata', array('segment'));
$result->filter('ColumnCallbackDeleteMetadata', array('segmentValue'));
return $this->removeSubtableIds($result); // this report won't return subtables of individual reports
}
}
// get visits by referrer type
$dataTable = $this->getDataTable(Archiver::REFERRER_TYPE_RECORD_NAME, $idSite, $period, $date, $segment);
if ($typeReferrer !== false) // filter for a specific referrer type
{
$dataTable->filter('Pattern', array('label', $typeReferrer));
}
// set subtable IDs for each row to the label (which holds the int referrer type)
$dataTable->filter('Piwik\Plugins\Referrers\DataTable\Filter\SetGetReferrerTypeSubtables', array($idSite, $period, $date, $segment, $expanded));
$dataTable->filter('AddSegmentByLabelMapping', array(
'referrerType',
array(
Common::REFERRER_TYPE_DIRECT_ENTRY => 'direct',
Common::REFERRER_TYPE_CAMPAIGN => 'campaign',
Common::REFERRER_TYPE_SEARCH_ENGINE => 'search',
Common::REFERRER_TYPE_SOCIAL_NETWORK => 'social',
Common::REFERRER_TYPE_WEBSITE => 'website',
)
));
// set referrer type column to readable value
$dataTable->queueFilter('ColumnCallbackReplace', array('label', __NAMESPACE__ . '\getReferrerTypeLabel'));
return $dataTable;
} | php | public function getReferrerType($idSite, $period, $date, $segment = false, $typeReferrer = false,
$idSubtable = false, $expanded = false)
{
Piwik::checkUserHasViewAccess($idSite);
$this->checkSingleSite($idSite, 'getReferrerType');
// if idSubtable is supplied, interpret idSubtable as referrer type and return correct report
if ($idSubtable !== false) {
$result = false;
switch ($idSubtable) {
case Common::REFERRER_TYPE_SEARCH_ENGINE:
$result = $this->getKeywords($idSite, $period, $date, $segment);
break;
case Common::REFERRER_TYPE_SOCIAL_NETWORK:
$result = $this->getSocials($idSite, $period, $date, $segment);
break;
case Common::REFERRER_TYPE_WEBSITE:
$result = $this->getWebsites($idSite, $period, $date, $segment);
break;
case Common::REFERRER_TYPE_CAMPAIGN:
$result = $this->getCampaigns($idSite, $period, $date, $segment);
break;
default: // invalid idSubtable, return whole report
break;
}
if ($result) {
$result->filter('ColumnCallbackDeleteMetadata', array('segment'));
$result->filter('ColumnCallbackDeleteMetadata', array('segmentValue'));
return $this->removeSubtableIds($result); // this report won't return subtables of individual reports
}
}
// get visits by referrer type
$dataTable = $this->getDataTable(Archiver::REFERRER_TYPE_RECORD_NAME, $idSite, $period, $date, $segment);
if ($typeReferrer !== false) // filter for a specific referrer type
{
$dataTable->filter('Pattern', array('label', $typeReferrer));
}
// set subtable IDs for each row to the label (which holds the int referrer type)
$dataTable->filter('Piwik\Plugins\Referrers\DataTable\Filter\SetGetReferrerTypeSubtables', array($idSite, $period, $date, $segment, $expanded));
$dataTable->filter('AddSegmentByLabelMapping', array(
'referrerType',
array(
Common::REFERRER_TYPE_DIRECT_ENTRY => 'direct',
Common::REFERRER_TYPE_CAMPAIGN => 'campaign',
Common::REFERRER_TYPE_SEARCH_ENGINE => 'search',
Common::REFERRER_TYPE_SOCIAL_NETWORK => 'social',
Common::REFERRER_TYPE_WEBSITE => 'website',
)
));
// set referrer type column to readable value
$dataTable->queueFilter('ColumnCallbackReplace', array('label', __NAMESPACE__ . '\getReferrerTypeLabel'));
return $dataTable;
} | [
"public",
"function",
"getReferrerType",
"(",
"$",
"idSite",
",",
"$",
"period",
",",
"$",
"date",
",",
"$",
"segment",
"=",
"false",
",",
"$",
"typeReferrer",
"=",
"false",
",",
"$",
"idSubtable",
"=",
"false",
",",
"$",
"expanded",
"=",
"false",
")",... | Returns a report describing visit information for each possible referrer type. The
result is a datatable whose subtables are the reports for each parent row's referrer type.
The subtable reports are: 'getKeywords' (for search engine referrer type), 'getWebsites',
and 'getCampaigns'.
@param string $idSite The site ID.
@param string $period The period to get data for, either 'day', 'week', 'month', 'year',
or 'range'.
@param string $date The date of the period.
@param bool|string $segment The segment to use.
@param bool|int $typeReferrer (deprecated) If you want to get data only for a specific referrer
type, supply a type for this parameter.
@param bool|int $idSubtable For this report this value is a referrer type ID and not an actual
subtable ID. The result when using this parameter will be the
specific report for the given referrer type.
@param bool $expanded Whether to get report w/ subtables loaded or not.
@return DataTable | [
"Returns",
"a",
"report",
"describing",
"visit",
"information",
"for",
"each",
"possible",
"referrer",
"type",
".",
"The",
"result",
"is",
"a",
"datatable",
"whose",
"subtables",
"are",
"the",
"reports",
"for",
"each",
"parent",
"row",
"s",
"referrer",
"type",... | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Referrers/API.php#L67-L127 | train | Returns the referrer type for the specified site and period. | [
30522,
2270,
3853,
2131,
2890,
7512,
14544,
13874,
1006,
1002,
8909,
28032,
2063,
1010,
1002,
2558,
1010,
1002,
3058,
1010,
1002,
6903,
1027,
6270,
1010,
1002,
2828,
2890,
7512,
14544,
1027,
6270,
1010,
1002,
8909,
6342,
19279,
3085,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Database/Schema/Grammars/RenameColumn.php | RenameColumn.setRenamedColumns | protected static function setRenamedColumns(TableDiff $tableDiff, Fluent $command, Column $column)
{
$tableDiff->renamedColumns = [
$command->from => new Column($command->to, $column->getType(), $column->toArray()),
];
return $tableDiff;
} | php | protected static function setRenamedColumns(TableDiff $tableDiff, Fluent $command, Column $column)
{
$tableDiff->renamedColumns = [
$command->from => new Column($command->to, $column->getType(), $column->toArray()),
];
return $tableDiff;
} | [
"protected",
"static",
"function",
"setRenamedColumns",
"(",
"TableDiff",
"$",
"tableDiff",
",",
"Fluent",
"$",
"command",
",",
"Column",
"$",
"column",
")",
"{",
"$",
"tableDiff",
"->",
"renamedColumns",
"=",
"[",
"$",
"command",
"->",
"from",
"=>",
"new",
... | Set the renamed columns on the table diff.
@param \Doctrine\DBAL\Schema\TableDiff $tableDiff
@param \Illuminate\Support\Fluent $command
@param \Doctrine\DBAL\Schema\Column $column
@return \Doctrine\DBAL\Schema\TableDiff | [
"Set",
"the",
"renamed",
"columns",
"on",
"the",
"table",
"diff",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Schema/Grammars/RenameColumn.php#L61-L68 | train | Set renamed columns | [
30522,
5123,
10763,
3853,
2275,
7389,
14074,
16409,
4747,
2819,
3619,
1006,
2795,
4305,
4246,
1002,
2795,
4305,
4246,
30524,
1031,
1002,
3094,
1011,
1028,
2013,
1027,
1028,
2047,
5930,
1006,
1002,
3094,
1011,
1028,
2000,
1010,
1002,
5930,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/Updater/Migration/Db/Factory.php | Factory.dropPrimaryKey | public function dropPrimaryKey($table)
{
$table = $this->prefixTable($table);
return $this->container->make('Piwik\Updater\Migration\Db\DropPrimaryKey', array(
'table' => $table
));
} | php | public function dropPrimaryKey($table)
{
$table = $this->prefixTable($table);
return $this->container->make('Piwik\Updater\Migration\Db\DropPrimaryKey', array(
'table' => $table
));
} | [
"public",
"function",
"dropPrimaryKey",
"(",
"$",
"table",
")",
"{",
"$",
"table",
"=",
"$",
"this",
"->",
"prefixTable",
"(",
"$",
"table",
")",
";",
"return",
"$",
"this",
"->",
"container",
"->",
"make",
"(",
"'Piwik\\Updater\\Migration\\Db\\DropPrimaryKey'... | Drops an existing index from a database table.
@param string $table Unprefixed database table name, eg 'log_visit'.
@return DropIndex | [
"Drops",
"an",
"existing",
"index",
"from",
"a",
"database",
"table",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Updater/Migration/Db/Factory.php#L319-L326 | train | Drop a primary key from a table. | [
30522,
2270,
3853,
4530,
18098,
9581,
2854,
14839,
1006,
1002,
2795,
1007,
1063,
1002,
2795,
1027,
1002,
2023,
1011,
1028,
17576,
10880,
1006,
1002,
2795,
1007,
1025,
2709,
1002,
2023,
1011,
1028,
11661,
1011,
1028,
2191,
1006,
1005,
14255,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/SegmentEditor/API.php | API.sortSegmentsCreatedByUserFirst | private function sortSegmentsCreatedByUserFirst($segments)
{
$orderedSegments = array();
foreach($segments as $id => &$segment) {
if($segment['login'] == Piwik::getCurrentUserLogin()) {
$orderedSegments[] = $segment;
unset($segments[$id]);
}
}
foreach($segments as $id => &$segment) {
if($segment['enable_all_users'] == 1) {
$orderedSegments[] = $segment;
unset($segments[$id]);
}
}
foreach($segments as $id => &$segment) {
$orderedSegments[] = $segment;
}
return $orderedSegments;
} | php | private function sortSegmentsCreatedByUserFirst($segments)
{
$orderedSegments = array();
foreach($segments as $id => &$segment) {
if($segment['login'] == Piwik::getCurrentUserLogin()) {
$orderedSegments[] = $segment;
unset($segments[$id]);
}
}
foreach($segments as $id => &$segment) {
if($segment['enable_all_users'] == 1) {
$orderedSegments[] = $segment;
unset($segments[$id]);
}
}
foreach($segments as $id => &$segment) {
$orderedSegments[] = $segment;
}
return $orderedSegments;
} | [
"private",
"function",
"sortSegmentsCreatedByUserFirst",
"(",
"$",
"segments",
")",
"{",
"$",
"orderedSegments",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"segments",
"as",
"$",
"id",
"=>",
"&",
"$",
"segment",
")",
"{",
"if",
"(",
"$",
"segment"... | Sorts segment in a particular order:
1) my segments
2) segments created by the super user that were shared with all users
3) segments created by other users (which are visible to all super users)
@param $segments
@return array | [
"Sorts",
"segment",
"in",
"a",
"particular",
"order",
":"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/SegmentEditor/API.php#L379-L398 | train | Sort segments created by user first | [
30522,
2797,
3853,
11901,
13910,
8163,
16748,
4383,
3762,
20330,
8873,
12096,
1006,
1002,
9214,
1007,
1063,
1002,
3641,
3366,
21693,
11187,
1027,
9140,
1006,
1007,
1025,
18921,
6776,
1006,
1002,
9214,
2004,
1002,
8909,
1027,
1028,
1004,
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... |
walkor/Workerman | WebServer.php | WebServer.addRoot | public function addRoot($domain, $config)
{
if (is_string($config)) {
$config = array('root' => $config);
}
$this->serverRoot[$domain] = $config;
} | php | public function addRoot($domain, $config)
{
if (is_string($config)) {
$config = array('root' => $config);
}
$this->serverRoot[$domain] = $config;
} | [
"public",
"function",
"addRoot",
"(",
"$",
"domain",
",",
"$",
"config",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"config",
")",
")",
"{",
"$",
"config",
"=",
"array",
"(",
"'root'",
"=>",
"$",
"config",
")",
";",
"}",
"$",
"this",
"->",
"serv... | Add virtual host.
@param string $domain
@param string $config
@return void | [
"Add",
"virtual",
"host",
"."
] | 13649907f05014fcfffcfccaef01e63ad3339351 | https://github.com/walkor/Workerman/blob/13649907f05014fcfffcfccaef01e63ad3339351/WebServer.php#L53-L59 | train | Add root domain | [
30522,
2270,
3853,
5587,
3217,
4140,
1006,
1002,
5884,
1010,
1002,
9530,
8873,
2290,
1007,
1063,
2065,
1006,
2003,
1035,
5164,
1006,
1002,
9530,
8873,
2290,
1007,
1007,
1063,
1002,
9530,
8873,
2290,
1027,
9140,
1006,
1005,
7117,
1005,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/DependencyInjection/Definition.php | Definition.setBindings | public function setBindings(array $bindings)
{
foreach ($bindings as $key => $binding) {
if (0 < strpos($key, '$') && $key !== $k = preg_replace('/[ \t]*\$/', ' $', $key)) {
unset($bindings[$key]);
$bindings[$key = $k] = $binding;
}
if (!$binding instanceof BoundArgument) {
$bindings[$key] = new BoundArgument($binding);
}
}
$this->bindings = $bindings;
return $this;
} | php | public function setBindings(array $bindings)
{
foreach ($bindings as $key => $binding) {
if (0 < strpos($key, '$') && $key !== $k = preg_replace('/[ \t]*\$/', ' $', $key)) {
unset($bindings[$key]);
$bindings[$key = $k] = $binding;
}
if (!$binding instanceof BoundArgument) {
$bindings[$key] = new BoundArgument($binding);
}
}
$this->bindings = $bindings;
return $this;
} | [
"public",
"function",
"setBindings",
"(",
"array",
"$",
"bindings",
")",
"{",
"foreach",
"(",
"$",
"bindings",
"as",
"$",
"key",
"=>",
"$",
"binding",
")",
"{",
"if",
"(",
"0",
"<",
"strpos",
"(",
"$",
"key",
",",
"'$'",
")",
"&&",
"$",
"key",
"!... | Sets bindings.
Bindings map $named or FQCN arguments to values that should be
injected in the matching parameters (of the constructor, of methods
called and of controller actions).
@param array $bindings
@return $this | [
"Sets",
"bindings",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DependencyInjection/Definition.php#L864-L879 | train | Set the bindings | [
30522,
2270,
3853,
2275,
8428,
4667,
2015,
1006,
9140,
1002,
8031,
2015,
1007,
1063,
18921,
6776,
1006,
1002,
8031,
2015,
2004,
1002,
3145,
1027,
1028,
1002,
8031,
1007,
1063,
2065,
1006,
1014,
1026,
2358,
30524,
3145,
1010,
1005,
1002,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
z-song/laravel-admin | src/Grid/Displayers/Actions.php | Actions.disableView | public function disableView(bool $disable = true)
{
if ($disable) {
array_delete($this->actions, 'view');
} elseif (!in_array('view', $this->actions)) {
array_push($this->actions, 'view');
}
return $this;
} | php | public function disableView(bool $disable = true)
{
if ($disable) {
array_delete($this->actions, 'view');
} elseif (!in_array('view', $this->actions)) {
array_push($this->actions, 'view');
}
return $this;
} | [
"public",
"function",
"disableView",
"(",
"bool",
"$",
"disable",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"disable",
")",
"{",
"array_delete",
"(",
"$",
"this",
"->",
"actions",
",",
"'view'",
")",
";",
"}",
"elseif",
"(",
"!",
"in_array",
"(",
"'view... | Disable view action.
@return $this | [
"Disable",
"view",
"action",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid/Displayers/Actions.php#L74-L83 | train | Disable view actions | [
30522,
2270,
3853,
4487,
19150,
8584,
1006,
22017,
2140,
1002,
4487,
19150,
1027,
2995,
1007,
1063,
2065,
1006,
1002,
4487,
19150,
1007,
1063,
9140,
1035,
3972,
12870,
1006,
1002,
2023,
1011,
1028,
4506,
1010,
1005,
3193,
1005,
1007,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Queue/DatabaseQueue.php | DatabaseQueue.markJobAsReserved | protected function markJobAsReserved($job)
{
$this->database->table($this->table)->where('id', $job->id)->update([
'reserved_at' => $job->touch(),
'attempts' => $job->increment(),
]);
return $job;
} | php | protected function markJobAsReserved($job)
{
$this->database->table($this->table)->where('id', $job->id)->update([
'reserved_at' => $job->touch(),
'attempts' => $job->increment(),
]);
return $job;
} | [
"protected",
"function",
"markJobAsReserved",
"(",
"$",
"job",
")",
"{",
"$",
"this",
"->",
"database",
"->",
"table",
"(",
"$",
"this",
"->",
"table",
")",
"->",
"where",
"(",
"'id'",
",",
"$",
"job",
"->",
"id",
")",
"->",
"update",
"(",
"[",
"'r... | Mark the given job ID as reserved.
@param \Illuminate\Queue\Jobs\DatabaseJobRecord $job
@return \Illuminate\Queue\Jobs\DatabaseJobRecord | [
"Mark",
"the",
"given",
"job",
"ID",
"as",
"reserved",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Queue/DatabaseQueue.php#L277-L285 | train | Mark a job as reserved | [
30522,
5123,
3853,
2928,
5558,
22083,
6072,
25944,
1006,
1002,
3105,
1007,
1063,
1002,
2023,
1011,
1028,
7809,
1011,
1028,
2795,
1006,
1002,
2023,
1011,
1028,
2795,
1007,
1011,
1028,
2073,
1006,
1005,
8909,
1005,
1010,
1002,
3105,
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... |
slimphp/Slim | Slim/MiddlewareAwareTrait.php | MiddlewareAwareTrait.addMiddleware | protected function addMiddleware(callable $callable)
{
if ($this->middlewareLock) {
throw new RuntimeException('Middleware can’t be added once the stack is dequeuing');
}
if (is_null($this->tip)) {
$this->seedMiddlewareStack();
}
$next = $this->tip;
$this->tip = function (
ServerRequestInterface $request,
ResponseInterface $response
) use (
$callable,
$next
) {
$result = call_user_func($callable, $request, $response, $next);
if ($result instanceof ResponseInterface === false) {
throw new UnexpectedValueException(
'Middleware must return instance of \Psr\Http\Message\ResponseInterface'
);
}
return $result;
};
return $this;
} | php | protected function addMiddleware(callable $callable)
{
if ($this->middlewareLock) {
throw new RuntimeException('Middleware can’t be added once the stack is dequeuing');
}
if (is_null($this->tip)) {
$this->seedMiddlewareStack();
}
$next = $this->tip;
$this->tip = function (
ServerRequestInterface $request,
ResponseInterface $response
) use (
$callable,
$next
) {
$result = call_user_func($callable, $request, $response, $next);
if ($result instanceof ResponseInterface === false) {
throw new UnexpectedValueException(
'Middleware must return instance of \Psr\Http\Message\ResponseInterface'
);
}
return $result;
};
return $this;
} | [
"protected",
"function",
"addMiddleware",
"(",
"callable",
"$",
"callable",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"middlewareLock",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"'Middleware can’t be added once the stack is dequeuing');",
"",
"",
"}",
"if",
... | Add middleware
This method prepends new middleware to the application middleware stack.
@param callable $callable Any callable that accepts three arguments:
1. A Request object
2. A Response object
3. A "next" middleware callable
@return static
@throws RuntimeException If middleware is added while the stack is dequeuing
@throws UnexpectedValueException If the middleware doesn't return a Psr\Http\Message\ResponseInterface | [
"Add",
"middleware"
] | ccef5f7d8bcd469d59cbe64f6210d83764f91543 | https://github.com/slimphp/Slim/blob/ccef5f7d8bcd469d59cbe64f6210d83764f91543/Slim/MiddlewareAwareTrait.php#L53-L81 | train | Add middleware to stack | [
30522,
5123,
3853,
5587,
4328,
20338,
8059,
1006,
2655,
3085,
1002,
2655,
3085,
1007,
1063,
2065,
1006,
1002,
2023,
1011,
1028,
2690,
8059,
7878,
1007,
1063,
5466,
2047,
2448,
7292,
10288,
24422,
1006,
1005,
2690,
8059,
2064,
1521,
1056,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Database/Query/Grammars/Grammar.php | Grammar.compileHaving | protected function compileHaving(array $having)
{
// If the having clause is "raw", we can just return the clause straight away
// without doing any more processing on it. Otherwise, we will compile the
// clause into SQL based on the components that make it up from builder.
if ($having['type'] === 'Raw') {
return $having['boolean'].' '.$having['sql'];
} elseif ($having['type'] === 'between') {
return $this->compileHavingBetween($having);
}
return $this->compileBasicHaving($having);
} | php | protected function compileHaving(array $having)
{
// If the having clause is "raw", we can just return the clause straight away
// without doing any more processing on it. Otherwise, we will compile the
// clause into SQL based on the components that make it up from builder.
if ($having['type'] === 'Raw') {
return $having['boolean'].' '.$having['sql'];
} elseif ($having['type'] === 'between') {
return $this->compileHavingBetween($having);
}
return $this->compileBasicHaving($having);
} | [
"protected",
"function",
"compileHaving",
"(",
"array",
"$",
"having",
")",
"{",
"// If the having clause is \"raw\", we can just return the clause straight away",
"// without doing any more processing on it. Otherwise, we will compile the",
"// clause into SQL based on the components that mak... | Compile a single having clause.
@param array $having
@return string | [
"Compile",
"a",
"single",
"having",
"clause",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Query/Grammars/Grammar.php#L662-L674 | train | Compiles the having clause into a string | [
30522,
5123,
3853,
4012,
22090,
3270,
6455,
1006,
9140,
1002,
2383,
1007,
1063,
1013,
1013,
2065,
1996,
2383,
11075,
2003,
1000,
6315,
1000,
1010,
2057,
2064,
2074,
2709,
1996,
11075,
3442,
2185,
1013,
1013,
2302,
2725,
2151,
2062,
6364,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Markdown.php | Markdown.renderText | public function renderText($view, array $data = [])
{
$this->view->flushFinderCache();
$contents = $this->view->replaceNamespace(
'mail', $this->textComponentPaths()
)->make($view, $data)->render();
return new HtmlString(
html_entity_decode(preg_replace("/[\r\n]{2,}/", "\n\n", $contents), ENT_QUOTES, 'UTF-8')
);
} | php | public function renderText($view, array $data = [])
{
$this->view->flushFinderCache();
$contents = $this->view->replaceNamespace(
'mail', $this->textComponentPaths()
)->make($view, $data)->render();
return new HtmlString(
html_entity_decode(preg_replace("/[\r\n]{2,}/", "\n\n", $contents), ENT_QUOTES, 'UTF-8')
);
} | [
"public",
"function",
"renderText",
"(",
"$",
"view",
",",
"array",
"$",
"data",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"view",
"->",
"flushFinderCache",
"(",
")",
";",
"$",
"contents",
"=",
"$",
"this",
"->",
"view",
"->",
"replaceNamespace",
"... | Render the Markdown template into text.
@param string $view
@param array $data
@return \Illuminate\Support\HtmlString | [
"Render",
"the",
"Markdown",
"template",
"into",
"text",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Mail/Markdown.php#L75-L86 | train | Render a text view | [
30522,
2270,
3853,
17552,
18209,
1006,
1002,
3193,
1010,
9140,
1002,
2951,
1027,
1031,
1033,
1007,
1063,
1002,
2023,
1011,
1028,
3193,
1011,
1028,
13862,
23695,
3540,
5403,
1006,
1007,
1025,
1002,
8417,
1027,
1002,
2023,
1011,
1028,
3193,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Database/Schema/Grammars/SqlServerGrammar.php | SqlServerGrammar.modifyCollate | protected function modifyCollate(Blueprint $blueprint, Fluent $column)
{
if (! is_null($column->collation)) {
return ' collate '.$column->collation;
}
} | php | protected function modifyCollate(Blueprint $blueprint, Fluent $column)
{
if (! is_null($column->collation)) {
return ' collate '.$column->collation;
}
} | [
"protected",
"function",
"modifyCollate",
"(",
"Blueprint",
"$",
"blueprint",
",",
"Fluent",
"$",
"column",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"column",
"->",
"collation",
")",
")",
"{",
"return",
"' collate '",
".",
"$",
"column",
"->",
"col... | Get the SQL for a collation column modifier.
@param \Illuminate\Database\Schema\Blueprint $blueprint
@param \Illuminate\Support\Fluent $column
@return string|null | [
"Get",
"the",
"SQL",
"for",
"a",
"collation",
"column",
"modifier",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Schema/Grammars/SqlServerGrammar.php#L750-L755 | train | Protected modify collate | [
30522,
5123,
3853,
19933,
26895,
3686,
1006,
2630,
16550,
1002,
2630,
16550,
1010,
19376,
1002,
5930,
1007,
1063,
2065,
1006,
999,
2003,
1035,
19701,
1006,
1002,
5930,
1011,
1028,
8902,
13490,
1007,
1007,
1063,
2709,
1005,
8902,
13806,
1005... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/backend/traits/FormModelSaver.php | FormModelSaver.deferPurgedSaveAttributes | protected function deferPurgedSaveAttributes($model, $attributesToPurge)
{
if (!is_array($attributesToPurge)) {
return;
}
/*
* Compatibility with Purgeable trait:
* This will give the ability to restore purged attributes
* and make them available again if necessary.
*/
if (method_exists($model, 'getPurgeableAttributes')) {
$model->addPurgeable($attributesToPurge);
}
else {
$model->bindEventOnce('model.saveInternal', function () use ($model, $attributesToPurge) {
foreach ($attributesToPurge as $attribute) {
unset($model->attributes[$attribute]);
}
});
}
} | php | protected function deferPurgedSaveAttributes($model, $attributesToPurge)
{
if (!is_array($attributesToPurge)) {
return;
}
/*
* Compatibility with Purgeable trait:
* This will give the ability to restore purged attributes
* and make them available again if necessary.
*/
if (method_exists($model, 'getPurgeableAttributes')) {
$model->addPurgeable($attributesToPurge);
}
else {
$model->bindEventOnce('model.saveInternal', function () use ($model, $attributesToPurge) {
foreach ($attributesToPurge as $attribute) {
unset($model->attributes[$attribute]);
}
});
}
} | [
"protected",
"function",
"deferPurgedSaveAttributes",
"(",
"$",
"model",
",",
"$",
"attributesToPurge",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"attributesToPurge",
")",
")",
"{",
"return",
";",
"}",
"/*\n * Compatibility with Purgeable trait:\n ... | Removes an array of attributes from the model. If the model implements
the Purgeable trait, this is preferred over the internal logic.
@param \October\Rain\Database\Model $model Model to adjust.
@param array $attributesToPurge Attribute values to remove from the model.
@return void | [
"Removes",
"an",
"array",
"of",
"attributes",
"from",
"the",
"model",
".",
"If",
"the",
"model",
"implements",
"the",
"Purgeable",
"trait",
"this",
"is",
"preferred",
"over",
"the",
"internal",
"logic",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/traits/FormModelSaver.php#L98-L119 | train | Defer to save attributes | [
30522,
5123,
3853,
13366,
2121,
5311,
5999,
3736,
3726,
19321,
3089,
8569,
4570,
1006,
1002,
2944,
1010,
1002,
12332,
14399,
12514,
2063,
1007,
1063,
2065,
1006,
999,
2003,
1035,
9140,
1006,
1002,
12332,
14399,
12514,
2063,
1007,
1007,
1063... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
overtrue/wechat | src/OfficialAccount/TemplateMessage/Client.php | Client.send | public function send($data = [])
{
$params = $this->formatMessage($data);
$this->restoreMessage();
return $this->httpPostJson(static::API_SEND, $params);
} | php | public function send($data = [])
{
$params = $this->formatMessage($data);
$this->restoreMessage();
return $this->httpPostJson(static::API_SEND, $params);
} | [
"public",
"function",
"send",
"(",
"$",
"data",
"=",
"[",
"]",
")",
"{",
"$",
"params",
"=",
"$",
"this",
"->",
"formatMessage",
"(",
"$",
"data",
")",
";",
"$",
"this",
"->",
"restoreMessage",
"(",
")",
";",
"return",
"$",
"this",
"->",
"httpPostJ... | Send a template message.
@param $data
@return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string
@throws \EasyWeChat\Kernel\Exceptions\InvalidArgumentException | [
"Send",
"a",
"template",
"message",
"."
] | 120c72faaa93c270365bc75c73c362d5fd583209 | https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/OfficialAccount/TemplateMessage/Client.php#L122-L129 | train | Send a message to the site | [
30522,
2270,
3853,
4604,
1006,
1002,
2951,
1027,
1031,
1033,
1007,
1063,
1002,
11498,
5244,
1027,
1002,
2023,
1011,
1028,
4289,
7834,
3736,
3351,
1006,
1002,
2951,
1007,
1025,
1002,
2023,
1011,
1028,
9239,
7834,
3736,
3351,
1006,
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... |
z-song/laravel-admin | src/Widgets/Tab.php | Tab.render | public function render()
{
$data = array_merge(
$this->data,
['attributes' => $this->formatAttributes()]
);
return view($this->view, $data)->render();
} | php | public function render()
{
$data = array_merge(
$this->data,
['attributes' => $this->formatAttributes()]
);
return view($this->view, $data)->render();
} | [
"public",
"function",
"render",
"(",
")",
"{",
"$",
"data",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"data",
",",
"[",
"'attributes'",
"=>",
"$",
"this",
"->",
"formatAttributes",
"(",
")",
"]",
")",
";",
"return",
"view",
"(",
"$",
"this",
"->",
... | Render Tab.
@return string | [
"Render",
"Tab",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Widgets/Tab.php#L123-L131 | train | Render the content of the page | [
30522,
2270,
3853,
17552,
1006,
1007,
1063,
1002,
2951,
1027,
9140,
1035,
13590,
1006,
1002,
2023,
1011,
1028,
2951,
1010,
1031,
1005,
12332,
1005,
1027,
1028,
1002,
2023,
1011,
1028,
4289,
19321,
30524,
1006,
1007,
1025,
1065,
102,
0,
0,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getgrav/grav | system/src/Grav/Common/Page/Page.php | Page.find | public function find($url, $all = false)
{
/** @var Pages $pages */
$pages = Grav::instance()['pages'];
return $pages->find($url, $all);
} | php | public function find($url, $all = false)
{
/** @var Pages $pages */
$pages = Grav::instance()['pages'];
return $pages->find($url, $all);
} | [
"public",
"function",
"find",
"(",
"$",
"url",
",",
"$",
"all",
"=",
"false",
")",
"{",
"/** @var Pages $pages */",
"$",
"pages",
"=",
"Grav",
"::",
"instance",
"(",
")",
"[",
"'pages'",
"]",
";",
"return",
"$",
"pages",
"->",
"find",
"(",
"$",
"url"... | Helper method to return a page.
@param string $url the url of the page
@param bool $all
@return PageInterface page you were looking for if it exists | [
"Helper",
"method",
"to",
"return",
"a",
"page",
"."
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L2646-L2652 | train | Find a page by its URL | [
30522,
2270,
3853,
2424,
1006,
1002,
24471,
2140,
1010,
1002,
2035,
1027,
6270,
1007,
1063,
1013,
1008,
1008,
1030,
13075,
5530,
1002,
5530,
1008,
1013,
1002,
5530,
1027,
24665,
11431,
1024,
1024,
6013,
1006,
1007,
1031,
1005,
5530,
1005,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/Plugin/Controller.php | Controller.setHostValidationVariablesView | public static function setHostValidationVariablesView($view)
{
// check if host is valid
$view->isValidHost = Url::isValidHost();
if (!$view->isValidHost) {
// invalid host, so display warning to user
$validHosts = Url::getTrustedHostsFromConfig();
$validHost = $validHosts[0];
$invalidHost = Common::sanitizeInputValue($_SERVER['HTTP_HOST']);
$emailSubject = rawurlencode(Piwik::translate('CoreHome_InjectedHostEmailSubject', $invalidHost));
$emailBody = rawurlencode(Piwik::translate('CoreHome_InjectedHostEmailBody'));
$superUserEmail = implode(',', Piwik::getAllSuperUserAccessEmailAddresses());
$mailToUrl = "mailto:$superUserEmail?subject=$emailSubject&body=$emailBody";
$mailLinkStart = "<a href=\"$mailToUrl\">";
$invalidUrl = Url::getCurrentUrlWithoutQueryString($checkIfTrusted = false);
$validUrl = Url::getCurrentScheme() . '://' . $validHost
. Url::getCurrentScriptName();
$invalidUrl = Common::sanitizeInputValue($invalidUrl);
$validUrl = Common::sanitizeInputValue($validUrl);
$changeTrustedHostsUrl = "index.php"
. Url::getCurrentQueryStringWithParametersModified(array(
'module' => 'CoreAdminHome',
'action' => 'generalSettings'
))
. "#trustedHostsSection";
$warningStart = Piwik::translate('CoreHome_InjectedHostWarningIntro', array(
'<strong>' . $invalidUrl . '</strong>',
'<strong>' . $validUrl . '</strong>'
)) . ' <br/>';
if (Piwik::hasUserSuperUserAccess()) {
$view->invalidHostMessage = $warningStart . ' '
. Piwik::translate('CoreHome_InjectedHostSuperUserWarning', array(
"<a href=\"$changeTrustedHostsUrl\">",
$invalidHost,
'</a>',
"<br/><a href=\"$validUrl\">",
$validHost,
'</a>'
));
} elseif (Piwik::isUserIsAnonymous()) {
$view->invalidHostMessage = $warningStart . ' '
. Piwik::translate('CoreHome_InjectedHostNonSuperUserWarning', array(
"<br/><a href=\"$validUrl\">",
'</a>',
'<span style="display:none">',
'</span>'
));
} else {
$view->invalidHostMessage = $warningStart . ' '
. Piwik::translate('CoreHome_InjectedHostNonSuperUserWarning', array(
"<br/><a href=\"$validUrl\">",
'</a>',
$mailLinkStart,
'</a>'
));
}
$view->invalidHostMessageHowToFix = '<p><b>How do I fix this problem and how do I login again?</b><br/> The Matomo Super User can manually edit the file piwik/config/config.ini.php
and add the following lines: <pre>[General]' . "\n" . 'trusted_hosts[] = "' . $invalidHost . '"</pre>After making the change, you will be able to login again.</p>
<p>You may also <i>disable this security feature (not recommended)</i>. To do so edit config/config.ini.php and add:
<pre>[General]' . "\n" . 'enable_trusted_host_check=0</pre>';
$view->invalidHost = $invalidHost; // for UserSettings warning
$view->invalidHostMailLinkStart = $mailLinkStart;
}
} | php | public static function setHostValidationVariablesView($view)
{
// check if host is valid
$view->isValidHost = Url::isValidHost();
if (!$view->isValidHost) {
// invalid host, so display warning to user
$validHosts = Url::getTrustedHostsFromConfig();
$validHost = $validHosts[0];
$invalidHost = Common::sanitizeInputValue($_SERVER['HTTP_HOST']);
$emailSubject = rawurlencode(Piwik::translate('CoreHome_InjectedHostEmailSubject', $invalidHost));
$emailBody = rawurlencode(Piwik::translate('CoreHome_InjectedHostEmailBody'));
$superUserEmail = implode(',', Piwik::getAllSuperUserAccessEmailAddresses());
$mailToUrl = "mailto:$superUserEmail?subject=$emailSubject&body=$emailBody";
$mailLinkStart = "<a href=\"$mailToUrl\">";
$invalidUrl = Url::getCurrentUrlWithoutQueryString($checkIfTrusted = false);
$validUrl = Url::getCurrentScheme() . '://' . $validHost
. Url::getCurrentScriptName();
$invalidUrl = Common::sanitizeInputValue($invalidUrl);
$validUrl = Common::sanitizeInputValue($validUrl);
$changeTrustedHostsUrl = "index.php"
. Url::getCurrentQueryStringWithParametersModified(array(
'module' => 'CoreAdminHome',
'action' => 'generalSettings'
))
. "#trustedHostsSection";
$warningStart = Piwik::translate('CoreHome_InjectedHostWarningIntro', array(
'<strong>' . $invalidUrl . '</strong>',
'<strong>' . $validUrl . '</strong>'
)) . ' <br/>';
if (Piwik::hasUserSuperUserAccess()) {
$view->invalidHostMessage = $warningStart . ' '
. Piwik::translate('CoreHome_InjectedHostSuperUserWarning', array(
"<a href=\"$changeTrustedHostsUrl\">",
$invalidHost,
'</a>',
"<br/><a href=\"$validUrl\">",
$validHost,
'</a>'
));
} elseif (Piwik::isUserIsAnonymous()) {
$view->invalidHostMessage = $warningStart . ' '
. Piwik::translate('CoreHome_InjectedHostNonSuperUserWarning', array(
"<br/><a href=\"$validUrl\">",
'</a>',
'<span style="display:none">',
'</span>'
));
} else {
$view->invalidHostMessage = $warningStart . ' '
. Piwik::translate('CoreHome_InjectedHostNonSuperUserWarning', array(
"<br/><a href=\"$validUrl\">",
'</a>',
$mailLinkStart,
'</a>'
));
}
$view->invalidHostMessageHowToFix = '<p><b>How do I fix this problem and how do I login again?</b><br/> The Matomo Super User can manually edit the file piwik/config/config.ini.php
and add the following lines: <pre>[General]' . "\n" . 'trusted_hosts[] = "' . $invalidHost . '"</pre>After making the change, you will be able to login again.</p>
<p>You may also <i>disable this security feature (not recommended)</i>. To do so edit config/config.ini.php and add:
<pre>[General]' . "\n" . 'enable_trusted_host_check=0</pre>';
$view->invalidHost = $invalidHost; // for UserSettings warning
$view->invalidHostMailLinkStart = $mailLinkStart;
}
} | [
"public",
"static",
"function",
"setHostValidationVariablesView",
"(",
"$",
"view",
")",
"{",
"// check if host is valid",
"$",
"view",
"->",
"isValidHost",
"=",
"Url",
"::",
"isValidHost",
"(",
")",
";",
"if",
"(",
"!",
"$",
"view",
"->",
"isValidHost",
")",
... | Checks if the current host is valid and sets variables on the given view, including:
- **isValidHost** - true if host is valid, false if otherwise
- **invalidHostMessage** - message to display if host is invalid (only set if host is invalid)
- **invalidHost** - the invalid hostname (only set if host is invalid)
- **mailLinkStart** - the open tag of a link to email the Super User of this problem (only set
if host is invalid)
@param View $view
@api | [
"Checks",
"if",
"the",
"current",
"host",
"is",
"valid",
"and",
"sets",
"variables",
"on",
"the",
"given",
"view",
"including",
":"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Plugin/Controller.php#L766-L836 | train | Sets the validation variables view for the host | [
30522,
2270,
10763,
3853,
6662,
14122,
10175,
8524,
3508,
10755,
19210,
2015,
8584,
1006,
1002,
3193,
1007,
1063,
1013,
1013,
4638,
2065,
3677,
2003,
9398,
1002,
3193,
1011,
1028,
2003,
10175,
3593,
15006,
2102,
1027,
24471,
2140,
1024,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/DoctrineValidationPass.php | DoctrineValidationPass.updateValidatorMappingFiles | private function updateValidatorMappingFiles(ContainerBuilder $container, string $mapping, string $extension)
{
if (!$container->hasParameter('validator.mapping.loader.'.$mapping.'_files_loader.mapping_files')) {
return;
}
$files = $container->getParameter('validator.mapping.loader.'.$mapping.'_files_loader.mapping_files');
$validationPath = 'Resources/config/validation.'.$this->managerType.'.'.$extension;
foreach ($container->getParameter('kernel.bundles') as $bundle) {
$reflection = new \ReflectionClass($bundle);
if ($container->fileExists($file = \dirname($reflection->getFileName()).'/'.$validationPath)) {
$files[] = $file;
}
}
$container->setParameter('validator.mapping.loader.'.$mapping.'_files_loader.mapping_files', $files);
} | php | private function updateValidatorMappingFiles(ContainerBuilder $container, string $mapping, string $extension)
{
if (!$container->hasParameter('validator.mapping.loader.'.$mapping.'_files_loader.mapping_files')) {
return;
}
$files = $container->getParameter('validator.mapping.loader.'.$mapping.'_files_loader.mapping_files');
$validationPath = 'Resources/config/validation.'.$this->managerType.'.'.$extension;
foreach ($container->getParameter('kernel.bundles') as $bundle) {
$reflection = new \ReflectionClass($bundle);
if ($container->fileExists($file = \dirname($reflection->getFileName()).'/'.$validationPath)) {
$files[] = $file;
}
}
$container->setParameter('validator.mapping.loader.'.$mapping.'_files_loader.mapping_files', $files);
} | [
"private",
"function",
"updateValidatorMappingFiles",
"(",
"ContainerBuilder",
"$",
"container",
",",
"string",
"$",
"mapping",
",",
"string",
"$",
"extension",
")",
"{",
"if",
"(",
"!",
"$",
"container",
"->",
"hasParameter",
"(",
"'validator.mapping.loader.'",
"... | Gets the validation mapping files for the format and extends them with
files matching a doctrine search pattern (Resources/config/validation.orm.xml). | [
"Gets",
"the",
"validation",
"mapping",
"files",
"for",
"the",
"format",
"and",
"extends",
"them",
"with",
"files",
"matching",
"a",
"doctrine",
"search",
"pattern",
"(",
"Resources",
"/",
"config",
"/",
"validation",
".",
"orm",
".",
"xml",
")",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/DoctrineValidationPass.php#L44-L61 | train | Update validator mapping files | [
30522,
2797,
3853,
10651,
10175,
8524,
20654,
29098,
2075,
8873,
4244,
1006,
11661,
8569,
23891,
2099,
1002,
11661,
1010,
5164,
1002,
12375,
1010,
5164,
1002,
5331,
1007,
1063,
2065,
1006,
999,
1002,
11661,
1011,
1028,
2038,
28689,
22828,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Routing/UrlGenerator.php | UrlGenerator.extractQueryString | protected function extractQueryString($path)
{
if (($queryPosition = strpos($path, '?')) !== false) {
return [
substr($path, 0, $queryPosition),
substr($path, $queryPosition),
];
}
return [$path, ''];
} | php | protected function extractQueryString($path)
{
if (($queryPosition = strpos($path, '?')) !== false) {
return [
substr($path, 0, $queryPosition),
substr($path, $queryPosition),
];
}
return [$path, ''];
} | [
"protected",
"function",
"extractQueryString",
"(",
"$",
"path",
")",
"{",
"if",
"(",
"(",
"$",
"queryPosition",
"=",
"strpos",
"(",
"$",
"path",
",",
"'?'",
")",
")",
"!==",
"false",
")",
"{",
"return",
"[",
"substr",
"(",
"$",
"path",
",",
"0",
"... | Extract the query string from the given path.
@param string $path
@return array | [
"Extract",
"the",
"query",
"string",
"from",
"the",
"given",
"path",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Routing/UrlGenerator.php#L471-L481 | train | Extract query string from path | [
30522,
5123,
3853,
14817,
4226,
24769,
18886,
3070,
1006,
1002,
4130,
1007,
1063,
2065,
1006,
1006,
1002,
23032,
26994,
1027,
2358,
14536,
2891,
1006,
1002,
4130,
1010,
1005,
1029,
1005,
1007,
1007,
999,
1027,
1027,
6270,
1007,
1063,
2709,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Database/Schema/Grammars/PostgresGrammar.php | PostgresGrammar.modifyIncrement | protected function modifyIncrement(Blueprint $blueprint, Fluent $column)
{
if ((in_array($column->type, $this->serials) || ($column->generatedAs !== null)) && $column->autoIncrement) {
return ' primary key';
}
} | php | protected function modifyIncrement(Blueprint $blueprint, Fluent $column)
{
if ((in_array($column->type, $this->serials) || ($column->generatedAs !== null)) && $column->autoIncrement) {
return ' primary key';
}
} | [
"protected",
"function",
"modifyIncrement",
"(",
"Blueprint",
"$",
"blueprint",
",",
"Fluent",
"$",
"column",
")",
"{",
"if",
"(",
"(",
"in_array",
"(",
"$",
"column",
"->",
"type",
",",
"$",
"this",
"->",
"serials",
")",
"||",
"(",
"$",
"column",
"->"... | Get the SQL for an auto-increment column modifier.
@param \Illuminate\Database\Schema\Blueprint $blueprint
@param \Illuminate\Support\Fluent $column
@return string|null | [
"Get",
"the",
"SQL",
"for",
"an",
"auto",
"-",
"increment",
"column",
"modifier",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Schema/Grammars/PostgresGrammar.php#L894-L899 | train | Protected modify increment | [
30522,
5123,
3853,
19933,
2378,
16748,
3672,
1006,
2630,
16550,
1002,
2630,
16550,
1010,
19376,
1002,
5930,
1007,
1063,
2065,
1006,
1006,
1999,
1035,
9140,
1006,
1002,
5930,
1011,
1028,
2828,
1010,
1002,
2023,
1011,
1028,
28172,
1007,
1064,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/FormController.php | FormController.getRedirectUrl | protected function getRedirectUrl($context = null)
{
$redirectContext = explode('-', $context, 2)[0];
$redirectSource = ends_with($context, '-close') ? 'redirectClose' : 'redirect';
// Get the redirect for the provided context
$redirects = [$context => $this->getConfig("{$redirectContext}[{$redirectSource}]", '')];
// Assign the default redirect afterwards to prevent the
// source for the default redirect being default[redirect]
$redirects['default'] = $this->getConfig('defaultRedirect', '');
if (empty($redirects[$context])) {
return $redirects['default'];
}
return $redirects[$context];
} | php | protected function getRedirectUrl($context = null)
{
$redirectContext = explode('-', $context, 2)[0];
$redirectSource = ends_with($context, '-close') ? 'redirectClose' : 'redirect';
// Get the redirect for the provided context
$redirects = [$context => $this->getConfig("{$redirectContext}[{$redirectSource}]", '')];
// Assign the default redirect afterwards to prevent the
// source for the default redirect being default[redirect]
$redirects['default'] = $this->getConfig('defaultRedirect', '');
if (empty($redirects[$context])) {
return $redirects['default'];
}
return $redirects[$context];
} | [
"protected",
"function",
"getRedirectUrl",
"(",
"$",
"context",
"=",
"null",
")",
"{",
"$",
"redirectContext",
"=",
"explode",
"(",
"'-'",
",",
"$",
"context",
",",
"2",
")",
"[",
"0",
"]",
";",
"$",
"redirectSource",
"=",
"ends_with",
"(",
"$",
"conte... | Internal method that returns a redirect URL from the config based on
supplied context. Otherwise the default redirect is used.
@param string $context Redirect context, eg: create, update, delete.
@return string | [
"Internal",
"method",
"that",
"returns",
"a",
"redirect",
"URL",
"from",
"the",
"config",
"based",
"on",
"supplied",
"context",
".",
"Otherwise",
"the",
"default",
"redirect",
"is",
"used",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/behaviors/FormController.php#L492-L509 | train | Get redirect url | [
30522,
5123,
3853,
2131,
5596,
7442,
6593,
3126,
2140,
1006,
1002,
6123,
1027,
19701,
1007,
1063,
1002,
2417,
7442,
6593,
8663,
18209,
1027,
15044,
1006,
1005,
1011,
1005,
1010,
1002,
6123,
1010,
1016,
1007,
1031,
1014,
1033,
1025,
1002,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/backend/behaviors/RelationController.php | RelationController.beforeAjax | protected function beforeAjax()
{
if ($this->initialized) {
return;
}
$this->controller->pageAction();
$this->validateField();
$this->prepareVars();
$this->initialized = true;
} | php | protected function beforeAjax()
{
if ($this->initialized) {
return;
}
$this->controller->pageAction();
$this->validateField();
$this->prepareVars();
$this->initialized = true;
} | [
"protected",
"function",
"beforeAjax",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"initialized",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"controller",
"->",
"pageAction",
"(",
")",
";",
"$",
"this",
"->",
"validateField",
"(",
")",
";",
"$... | The controller action is responsible for supplying the parent model
so it's action must be fired. Additionally, each AJAX request must
supply the relation's field name (_relation_field). | [
"The",
"controller",
"action",
"is",
"responsible",
"for",
"supplying",
"the",
"parent",
"model",
"so",
"it",
"s",
"action",
"must",
"be",
"fired",
".",
"Additionally",
"each",
"AJAX",
"request",
"must",
"supply",
"the",
"relation",
"s",
"field",
"name",
"("... | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/behaviors/RelationController.php#L269-L279 | train | This method is called before ajax action. | [
30522,
5123,
3853,
2077,
22734,
2595,
1006,
1007,
1063,
2065,
1006,
1002,
2023,
1011,
1028,
3988,
3550,
1007,
1063,
2709,
1025,
1065,
1002,
2023,
1011,
1028,
11486,
1011,
1028,
3931,
18908,
3258,
1006,
1007,
1025,
1002,
2023,
1011,
1028,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Database/ConnectionResolver.php | ConnectionResolver.connection | public function connection($name = null)
{
if (is_null($name)) {
$name = $this->getDefaultConnection();
}
return $this->connections[$name];
} | php | public function connection($name = null)
{
if (is_null($name)) {
$name = $this->getDefaultConnection();
}
return $this->connections[$name];
} | [
"public",
"function",
"connection",
"(",
"$",
"name",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"name",
")",
")",
"{",
"$",
"name",
"=",
"$",
"this",
"->",
"getDefaultConnection",
"(",
")",
";",
"}",
"return",
"$",
"this",
"->",
"conne... | Get a database connection instance.
@param string $name
@return \Illuminate\Database\ConnectionInterface | [
"Get",
"a",
"database",
"connection",
"instance",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/ConnectionResolver.php#L40-L47 | train | Get the connection | [
30522,
2270,
3853,
4434,
1006,
1002,
2171,
1027,
19701,
1007,
1063,
2065,
1006,
2003,
1035,
19701,
1006,
1002,
2171,
1007,
1007,
1063,
1002,
2171,
1027,
1002,
2023,
1011,
1028,
2131,
3207,
7011,
11314,
8663,
2638,
7542,
1006,
1007,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Form/FormBuilder.php | FormBuilder.get | public function get($name)
{
if ($this->locked) {
throw new BadMethodCallException('FormBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.');
}
if (isset($this->unresolvedChildren[$name])) {
return $this->resolveChild($name);
}
if (isset($this->children[$name])) {
return $this->children[$name];
}
throw new InvalidArgumentException(sprintf('The child with the name "%s" does not exist.', $name));
} | php | public function get($name)
{
if ($this->locked) {
throw new BadMethodCallException('FormBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.');
}
if (isset($this->unresolvedChildren[$name])) {
return $this->resolveChild($name);
}
if (isset($this->children[$name])) {
return $this->children[$name];
}
throw new InvalidArgumentException(sprintf('The child with the name "%s" does not exist.', $name));
} | [
"public",
"function",
"get",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"locked",
")",
"{",
"throw",
"new",
"BadMethodCallException",
"(",
"'FormBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.'",
")",... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/FormBuilder.php#L103-L118 | train | Returns the child with the given name. | [
30522,
2270,
3853,
2131,
1006,
1002,
2171,
1007,
1063,
2065,
1006,
1002,
2023,
1011,
1028,
5299,
1007,
1063,
5466,
2047,
2919,
11368,
6806,
16409,
24164,
2595,
24422,
1006,
1005,
2433,
8569,
23891,
2099,
4725,
3685,
2022,
11570,
4902,
2320,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/Plugin/Manager.php | Manager.getPluginsDirectories | public static function getPluginsDirectories()
{
$dirs = array(self::getPluginsDirectory());
if (!empty($GLOBALS['MATOMO_PLUGIN_DIRS'])) {
$extraDirs = array_map(function ($dir) {
return rtrim($dir['pluginsPathAbsolute'], '/') . '/';
}, $GLOBALS['MATOMO_PLUGIN_DIRS']);
$dirs = array_merge($dirs, $extraDirs);
}
return $dirs;
} | php | public static function getPluginsDirectories()
{
$dirs = array(self::getPluginsDirectory());
if (!empty($GLOBALS['MATOMO_PLUGIN_DIRS'])) {
$extraDirs = array_map(function ($dir) {
return rtrim($dir['pluginsPathAbsolute'], '/') . '/';
}, $GLOBALS['MATOMO_PLUGIN_DIRS']);
$dirs = array_merge($dirs, $extraDirs);
}
return $dirs;
} | [
"public",
"static",
"function",
"getPluginsDirectories",
"(",
")",
"{",
"$",
"dirs",
"=",
"array",
"(",
"self",
"::",
"getPluginsDirectory",
"(",
")",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"GLOBALS",
"[",
"'MATOMO_PLUGIN_DIRS'",
"]",
")",
")",
"{"... | Returns the path to all plugins directories. Each plugins directory may contain several plugins.
All paths have a trailing slash '/'.
@return string[]
@api | [
"Returns",
"the",
"path",
"to",
"all",
"plugins",
"directories",
".",
"Each",
"plugins",
"directory",
"may",
"contain",
"several",
"plugins",
".",
"All",
"paths",
"have",
"a",
"trailing",
"slash",
"/",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Plugin/Manager.php#L406-L418 | train | Get all the plugin directories | [
30522,
2270,
10763,
3853,
2131,
24759,
15916,
7076,
4305,
2890,
16761,
3111,
1006,
1007,
1063,
1002,
16101,
2015,
1027,
9140,
1006,
2969,
1024,
1024,
2131,
24759,
15916,
7076,
4305,
2890,
16761,
2100,
1006,
1007,
1007,
1025,
2065,
1006,
999... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Database/Schema/Grammars/PostgresGrammar.php | PostgresGrammar.compileRename | public function compileRename(Blueprint $blueprint, Fluent $command)
{
$from = $this->wrapTable($blueprint);
return "alter table {$from} rename to ".$this->wrapTable($command->to);
} | php | public function compileRename(Blueprint $blueprint, Fluent $command)
{
$from = $this->wrapTable($blueprint);
return "alter table {$from} rename to ".$this->wrapTable($command->to);
} | [
"public",
"function",
"compileRename",
"(",
"Blueprint",
"$",
"blueprint",
",",
"Fluent",
"$",
"command",
")",
"{",
"$",
"from",
"=",
"$",
"this",
"->",
"wrapTable",
"(",
"$",
"blueprint",
")",
";",
"return",
"\"alter table {$from} rename to \"",
".",
"$",
"... | Compile a rename table command.
@param \Illuminate\Database\Schema\Blueprint $blueprint
@param \Illuminate\Support\Fluent $command
@return string | [
"Compile",
"a",
"rename",
"table",
"command",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Schema/Grammars/PostgresGrammar.php#L331-L336 | train | Compiles a rename table command. | [
30522,
2270,
3853,
21624,
8189,
4168,
1006,
2630,
16550,
1002,
2630,
16550,
1010,
19376,
1002,
3094,
1007,
1063,
1002,
2013,
1027,
1002,
2023,
1011,
1028,
10236,
10880,
1006,
1002,
2630,
16550,
1007,
1025,
2709,
1000,
11477,
2795,
1063,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Cache/Simple/AbstractCache.php | AbstractCache.setMultiple | public function setMultiple($values, $ttl = null)
{
if (!\is_array($values) && !$values instanceof \Traversable) {
throw new InvalidArgumentException(sprintf('Cache values must be array or Traversable, "%s" given', \is_object($values) ? \get_class($values) : \gettype($values)));
}
$valuesById = [];
foreach ($values as $key => $value) {
if (\is_int($key)) {
$key = (string) $key;
}
$valuesById[$this->getId($key)] = $value;
}
if (false === $ttl = $this->normalizeTtl($ttl)) {
return $this->doDelete(array_keys($valuesById));
}
try {
$e = $this->doSave($valuesById, $ttl);
} catch (\Exception $e) {
}
if (true === $e || [] === $e) {
return true;
}
$keys = [];
foreach (\is_array($e) ? $e : array_keys($valuesById) as $id) {
$keys[] = substr($id, \strlen($this->namespace));
}
CacheItem::log($this->logger, 'Failed to save values', ['keys' => $keys, 'exception' => $e instanceof \Exception ? $e : null]);
return false;
} | php | public function setMultiple($values, $ttl = null)
{
if (!\is_array($values) && !$values instanceof \Traversable) {
throw new InvalidArgumentException(sprintf('Cache values must be array or Traversable, "%s" given', \is_object($values) ? \get_class($values) : \gettype($values)));
}
$valuesById = [];
foreach ($values as $key => $value) {
if (\is_int($key)) {
$key = (string) $key;
}
$valuesById[$this->getId($key)] = $value;
}
if (false === $ttl = $this->normalizeTtl($ttl)) {
return $this->doDelete(array_keys($valuesById));
}
try {
$e = $this->doSave($valuesById, $ttl);
} catch (\Exception $e) {
}
if (true === $e || [] === $e) {
return true;
}
$keys = [];
foreach (\is_array($e) ? $e : array_keys($valuesById) as $id) {
$keys[] = substr($id, \strlen($this->namespace));
}
CacheItem::log($this->logger, 'Failed to save values', ['keys' => $keys, 'exception' => $e instanceof \Exception ? $e : null]);
return false;
} | [
"public",
"function",
"setMultiple",
"(",
"$",
"values",
",",
"$",
"ttl",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"\\",
"is_array",
"(",
"$",
"values",
")",
"&&",
"!",
"$",
"values",
"instanceof",
"\\",
"Traversable",
")",
"{",
"throw",
"new",
"Invali... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Cache/Simple/AbstractCache.php#L104-L135 | train | Save multiple cache items | [
30522,
2270,
3853,
2275,
12274,
7096,
11514,
2571,
1006,
1002,
5300,
1010,
1002,
23746,
2140,
1027,
19701,
1007,
1063,
2065,
1006,
999,
1032,
2003,
1035,
9140,
1006,
1002,
5300,
1007,
1004,
1004,
999,
1002,
5300,
6013,
11253,
1032,
29053,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/thrift | lib/php/lib/Protocol/TSimpleJSONProtocol.php | TSimpleJSONProtocol.writeStructBegin | public function writeStructBegin($name)
{
$this->writeContext_->write();
$this->trans_->write(self::LBRACE);
$this->pushWriteContext(new StructContext($this));
} | php | public function writeStructBegin($name)
{
$this->writeContext_->write();
$this->trans_->write(self::LBRACE);
$this->pushWriteContext(new StructContext($this));
} | [
"public",
"function",
"writeStructBegin",
"(",
"$",
"name",
")",
"{",
"$",
"this",
"->",
"writeContext_",
"->",
"write",
"(",
")",
";",
"$",
"this",
"->",
"trans_",
"->",
"write",
"(",
"self",
"::",
"LBRACE",
")",
";",
"$",
"this",
"->",
"pushWriteCont... | Writes a struct header.
@param string $name Struct name | [
"Writes",
"a",
"struct",
"header",
"."
] | acdd4226c210336e9e15eb812e5932a645fcd5ce | https://github.com/apache/thrift/blob/acdd4226c210336e9e15eb812e5932a645fcd5ce/lib/php/lib/Protocol/TSimpleJSONProtocol.php#L164-L169 | train | Write the begin of a struct | [
30522,
2270,
3853,
7009,
18300,
4783,
11528,
1006,
1002,
2171,
1007,
1063,
1002,
2023,
1011,
1028,
4339,
8663,
18209,
1035,
1011,
1028,
4339,
1006,
1007,
1025,
1002,
2023,
1011,
1028,
9099,
1035,
1011,
1028,
4339,
1006,
2969,
1024,
1024,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
google/flatbuffers | php/FlatbufferBuilder.php | FlatbufferBuilder.addOffset | public function addOffset($off)
{
$this->prep(Constants::SIZEOF_INT, 0); // Ensure alignment is already done
if ($off > $this->offset()) {
throw new \Exception("");
}
$this->putOffset($off);
} | php | public function addOffset($off)
{
$this->prep(Constants::SIZEOF_INT, 0); // Ensure alignment is already done
if ($off > $this->offset()) {
throw new \Exception("");
}
$this->putOffset($off);
} | [
"public",
"function",
"addOffset",
"(",
"$",
"off",
")",
"{",
"$",
"this",
"->",
"prep",
"(",
"Constants",
"::",
"SIZEOF_INT",
",",
"0",
")",
";",
"// Ensure alignment is already done",
"if",
"(",
"$",
"off",
">",
"$",
"this",
"->",
"offset",
"(",
")",
... | Adds on offset, relative to where it will be written.
@param $off The offset to add to the buffer.
@throws \Exception Throws an exception if `$off` is greater than the underlying ByteBuffer's
offest. | [
"Adds",
"on",
"offset",
"relative",
"to",
"where",
"it",
"will",
"be",
"written",
"."
] | af74f87ccd6ea9bcf9e325427dca7c7faf1d79c1 | https://github.com/google/flatbuffers/blob/af74f87ccd6ea9bcf9e325427dca7c7faf1d79c1/php/FlatbufferBuilder.php#L568-L575 | train | Adds the offset to the current page | [
30522,
2270,
3853,
5587,
27475,
3388,
1006,
1002,
2125,
1007,
1063,
1002,
2023,
1011,
1028,
17463,
1006,
5377,
2015,
1024,
1024,
2946,
11253,
1035,
20014,
1010,
1014,
1007,
1025,
1013,
1013,
5676,
12139,
2003,
2525,
2589,
2065,
1006,
1002,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
overtrue/wechat | src/Payment/Reverse/Client.php | Client.reverse | protected function reverse(string $number, string $type)
{
$params = [
'appid' => $this->app['config']->app_id,
$type => $number,
];
return $this->safeRequest($this->wrap('secapi/pay/reverse'), $params);
} | php | protected function reverse(string $number, string $type)
{
$params = [
'appid' => $this->app['config']->app_id,
$type => $number,
];
return $this->safeRequest($this->wrap('secapi/pay/reverse'), $params);
} | [
"protected",
"function",
"reverse",
"(",
"string",
"$",
"number",
",",
"string",
"$",
"type",
")",
"{",
"$",
"params",
"=",
"[",
"'appid'",
"=>",
"$",
"this",
"->",
"app",
"[",
"'config'",
"]",
"->",
"app_id",
",",
"$",
"type",
"=>",
"$",
"number",
... | Reverse order.
@param string $number
@param string $type
@return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string
@throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException | [
"Reverse",
"order",
"."
] | 120c72faaa93c270365bc75c73c362d5fd583209 | https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/Payment/Reverse/Client.php#L56-L64 | train | Reverse the payment | [
30522,
5123,
3853,
7901,
1006,
5164,
1002,
2193,
1010,
5164,
1002,
2828,
1007,
1063,
1002,
11498,
5244,
1027,
1031,
1005,
10439,
3593,
1005,
1027,
1028,
1002,
2023,
1011,
1028,
10439,
1031,
1005,
9530,
8873,
2290,
1005,
1033,
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... |
overtrue/wechat | src/OfficialAccount/Broadcasting/Client.php | Client.previewCard | public function previewCard(string $cardId, $reception, $method = self::PREVIEW_BY_OPENID)
{
return $this->previewMessage(new Card($cardId), $reception, $method);
} | php | public function previewCard(string $cardId, $reception, $method = self::PREVIEW_BY_OPENID)
{
return $this->previewMessage(new Card($cardId), $reception, $method);
} | [
"public",
"function",
"previewCard",
"(",
"string",
"$",
"cardId",
",",
"$",
"reception",
",",
"$",
"method",
"=",
"self",
"::",
"PREVIEW_BY_OPENID",
")",
"{",
"return",
"$",
"this",
"->",
"previewMessage",
"(",
"new",
"Card",
"(",
"$",
"cardId",
")",
",... | Preview a card message.
@param mixed $cardId message
@param string $reception
@param string $method
@return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string
@throws \EasyWeChat\Kernel\Exceptions\RuntimeException
@throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException | [
"Preview",
"a",
"card",
"message",
"."
] | 120c72faaa93c270365bc75c73c362d5fd583209 | https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/OfficialAccount/Broadcasting/Client.php#L316-L319 | train | Preview a card | [
30522,
2270,
3853,
19236,
11522,
1006,
5164,
1002,
4003,
3593,
1010,
1002,
7684,
1010,
1002,
4118,
1027,
2969,
1024,
1024,
19236,
1035,
2011,
1035,
2330,
3593,
1007,
1063,
2709,
1002,
2023,
1011,
1028,
19236,
7834,
3736,
3351,
1006,
2047,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/Updater/Migration/Db/Factory.php | Factory.changeColumnTypes | public function changeColumnTypes($table, $columns)
{
$table = $this->prefixTable($table);
return $this->container->make('Piwik\Updater\Migration\Db\ChangeColumnTypes', array(
'table' => $table, 'columns' => $columns
));
} | php | public function changeColumnTypes($table, $columns)
{
$table = $this->prefixTable($table);
return $this->container->make('Piwik\Updater\Migration\Db\ChangeColumnTypes', array(
'table' => $table, 'columns' => $columns
));
} | [
"public",
"function",
"changeColumnTypes",
"(",
"$",
"table",
",",
"$",
"columns",
")",
"{",
"$",
"table",
"=",
"$",
"this",
"->",
"prefixTable",
"(",
"$",
"table",
")",
";",
"return",
"$",
"this",
"->",
"container",
"->",
"make",
"(",
"'Piwik\\Updater\\... | Changes the type of multiple existing database table columns at the same time.
Changing multiple columns at the same time can lead to performance improvements compared to changing the type
of each column separately.
@param string $table Unprefixed database table name, eg 'log_visit'.
@param array $columns An array of column name to column type pairs,
eg array('my_column_name' => 'VARCHAR(200) NOT NULL', 'column2' => '...')
@return ChangeColumnTypes | [
"Changes",
"the",
"type",
"of",
"multiple",
"existing",
"database",
"table",
"columns",
"at",
"the",
"same",
"time",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Updater/Migration/Db/Factory.php#L229-L236 | train | Changes the column types of a table. | [
30522,
2270,
3853,
2689,
25778,
2819,
29405,
10374,
1006,
1002,
2795,
1010,
1002,
7753,
1007,
1063,
1002,
2795,
1027,
1002,
2023,
1011,
1028,
17576,
10880,
1006,
1002,
2795,
1007,
1025,
2709,
1002,
2023,
1011,
1028,
11661,
1011,
1028,
2191,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.path | public function path($var = null)
{
if ($var !== null) {
// Folder of the page.
$this->folder = basename($var);
// Path to the page.
$this->path = dirname($var);
}
return $this->path ? $this->path . '/' . $this->folder : null;
} | php | public function path($var = null)
{
if ($var !== null) {
// Folder of the page.
$this->folder = basename($var);
// Path to the page.
$this->path = dirname($var);
}
return $this->path ? $this->path . '/' . $this->folder : null;
} | [
"public",
"function",
"path",
"(",
"$",
"var",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"var",
"!==",
"null",
")",
"{",
"// Folder of the page.",
"$",
"this",
"->",
"folder",
"=",
"basename",
"(",
"$",
"var",
")",
";",
"// Path to the page.",
"$",
"this"... | Gets and sets the path to the folder where the .md for this Page object resides.
This is equivalent to the filePath but without the filename.
@param string $var the path
@return string|null the path | [
"Gets",
"and",
"sets",
"the",
"path",
"to",
"the",
"folder",
"where",
"the",
".",
"md",
"for",
"this",
"Page",
"object",
"resides",
".",
"This",
"is",
"equivalent",
"to",
"the",
"filePath",
"but",
"without",
"the",
"filename",
"."
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L2131-L2141 | train | Get the path to the page | [
30522,
2270,
3853,
4130,
1006,
1002,
13075,
1027,
19701,
1007,
1063,
2065,
1006,
1002,
13075,
999,
1027,
1027,
19701,
1007,
1063,
1013,
1013,
19622,
1997,
1996,
3931,
1012,
1002,
2023,
1011,
1028,
19622,
1027,
2918,
18442,
1006,
1002,
13075... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/ConfigurationUrlParser.php | ConfigurationUrlParser.parseUrl | protected function parseUrl($url)
{
$url = preg_replace('#^(sqlite3?):///#', '$1://null/', $url);
$parsedUrl = parse_url($url);
if ($parsedUrl === false) {
throw new InvalidArgumentException('The database configuration URL is malformed.');
}
return $this->parseStringsToNativeTypes(
array_map('rawurldecode', $parsedUrl)
);
} | php | protected function parseUrl($url)
{
$url = preg_replace('#^(sqlite3?):///#', '$1://null/', $url);
$parsedUrl = parse_url($url);
if ($parsedUrl === false) {
throw new InvalidArgumentException('The database configuration URL is malformed.');
}
return $this->parseStringsToNativeTypes(
array_map('rawurldecode', $parsedUrl)
);
} | [
"protected",
"function",
"parseUrl",
"(",
"$",
"url",
")",
"{",
"$",
"url",
"=",
"preg_replace",
"(",
"'#^(sqlite3?):///#'",
",",
"'$1://null/'",
",",
"$",
"url",
")",
";",
"$",
"parsedUrl",
"=",
"parse_url",
"(",
"$",
"url",
")",
";",
"if",
"(",
"$",
... | Parse the string URL to an array of components.
@param string $url
@return array | [
"Parse",
"the",
"string",
"URL",
"to",
"an",
"array",
"of",
"components",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/ConfigurationUrlParser.php#L129-L142 | train | Parse the database configuration URL into an array of native types. | [
30522,
5123,
3853,
11968,
3366,
3126,
2140,
1006,
1002,
24471,
2140,
1007,
1063,
1002,
24471,
2140,
1027,
3653,
2290,
1035,
5672,
1006,
1005,
1001,
1034,
1006,
29296,
4221,
2509,
1029,
1007,
1024,
1013,
1013,
1013,
1001,
1005,
1010,
1005,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
dompdf/dompdf | src/Css/Style.php | Style.get_outline_color | function get_outline_color()
{
if ($this->_props["outline_color"] === "") {
//see __set and __get, on all assignments clear cache!
$this->_prop_cache["outline_color"] = null;
$this->_props["outline_color"] = $this->__get("color");
}
return $this->munge_color($this->_props["outline_color"]);
} | php | function get_outline_color()
{
if ($this->_props["outline_color"] === "") {
//see __set and __get, on all assignments clear cache!
$this->_prop_cache["outline_color"] = null;
$this->_props["outline_color"] = $this->__get("color");
}
return $this->munge_color($this->_props["outline_color"]);
} | [
"function",
"get_outline_color",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_props",
"[",
"\"outline_color\"",
"]",
"===",
"\"\"",
")",
"{",
"//see __set and __get, on all assignments clear cache!",
"$",
"this",
"->",
"_prop_cache",
"[",
"\"outline_color\"",
"]",... | Returns the outline color as an array
See {@link Style::get_color()}
@link http://www.w3.org/TR/CSS21/box.html#border-color-properties
@return array | [
"Returns",
"the",
"outline",
"color",
"as",
"an",
"array"
] | 75f13c700009be21a1965dc2c5b68a8708c22ba2 | https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/src/Css/Style.php#L1524-L1533 | train | get outline color | [
30522,
3853,
2131,
1035,
12685,
1035,
3609,
1006,
1007,
1063,
2065,
1006,
1002,
2023,
1011,
1028,
1035,
24387,
1031,
1000,
12685,
1035,
3609,
1000,
1033,
1027,
1027,
1027,
1000,
1000,
1007,
1063,
1013,
1013,
2156,
1035,
1035,
2275,
1998,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getgrav/grav | system/src/Grav/Common/GPM/GPM.php | GPM.checkNoOtherPackageNeedsThisDependencyInALowerVersion | public function checkNoOtherPackageNeedsThisDependencyInALowerVersion(
$slug,
$version_with_operator,
$ignore_packages_list
) {
// check if any of the currently installed package need this in a lower version than the one we need. In case, abort and tell which package
$dependent_packages = $this->getPackagesThatDependOnPackage($slug);
$version = $this->calculateVersionNumberFromDependencyVersion($version_with_operator);
if (count($dependent_packages)) {
foreach ($dependent_packages as $dependent_package) {
$other_dependency_version_with_operator = $this->getVersionOfDependencyRequiredByPackage($dependent_package,
$slug);
$other_dependency_version = $this->calculateVersionNumberFromDependencyVersion($other_dependency_version_with_operator);
// check version is compatible with the one needed by the current package
if ($this->versionFormatIsNextSignificantRelease($other_dependency_version_with_operator)) {
$compatible = $this->checkNextSignificantReleasesAreCompatible($version,
$other_dependency_version);
if (!$compatible) {
if (!in_array($dependent_package, $ignore_packages_list)) {
throw new \Exception("Package <cyan>$slug</cyan> is required in an older version by package <cyan>$dependent_package</cyan>. This package needs a newer version, and because of this it cannot be installed. The <cyan>$dependent_package</cyan> package must be updated to use a newer release of <cyan>$slug</cyan>.",
2);
}
}
}
}
}
return true;
} | php | public function checkNoOtherPackageNeedsThisDependencyInALowerVersion(
$slug,
$version_with_operator,
$ignore_packages_list
) {
// check if any of the currently installed package need this in a lower version than the one we need. In case, abort and tell which package
$dependent_packages = $this->getPackagesThatDependOnPackage($slug);
$version = $this->calculateVersionNumberFromDependencyVersion($version_with_operator);
if (count($dependent_packages)) {
foreach ($dependent_packages as $dependent_package) {
$other_dependency_version_with_operator = $this->getVersionOfDependencyRequiredByPackage($dependent_package,
$slug);
$other_dependency_version = $this->calculateVersionNumberFromDependencyVersion($other_dependency_version_with_operator);
// check version is compatible with the one needed by the current package
if ($this->versionFormatIsNextSignificantRelease($other_dependency_version_with_operator)) {
$compatible = $this->checkNextSignificantReleasesAreCompatible($version,
$other_dependency_version);
if (!$compatible) {
if (!in_array($dependent_package, $ignore_packages_list)) {
throw new \Exception("Package <cyan>$slug</cyan> is required in an older version by package <cyan>$dependent_package</cyan>. This package needs a newer version, and because of this it cannot be installed. The <cyan>$dependent_package</cyan> package must be updated to use a newer release of <cyan>$slug</cyan>.",
2);
}
}
}
}
}
return true;
} | [
"public",
"function",
"checkNoOtherPackageNeedsThisDependencyInALowerVersion",
"(",
"$",
"slug",
",",
"$",
"version_with_operator",
",",
"$",
"ignore_packages_list",
")",
"{",
"// check if any of the currently installed package need this in a lower version than the one we need. In case, ... | Check the package identified by $slug can be updated to the version passed as argument.
Thrown an exception if it cannot be updated because another package installed requires it to be at an older version.
@param string $slug
@param string $version_with_operator
@param array $ignore_packages_list
@return bool
@throws \Exception | [
"Check",
"the",
"package",
"identified",
"by",
"$slug",
"can",
"be",
"updated",
"to",
"the",
"version",
"passed",
"as",
"argument",
".",
"Thrown",
"an",
"exception",
"if",
"it",
"cannot",
"be",
"updated",
"because",
"another",
"package",
"installed",
"requires... | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/GPM/GPM.php#L775-L806 | train | Check if any package that requires this dependency in a newer version | [
30522,
2270,
3853,
4638,
3630,
14573,
2121,
23947,
4270,
24045,
5104,
15222,
16150,
13699,
10497,
11916,
13290,
25114,
27774,
1006,
1002,
23667,
1010,
1002,
2544,
1035,
2007,
1035,
6872,
1010,
1002,
8568,
1035,
14555,
1035,
2862,
1007,
1063,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/SegmentEditor/Model.php | Model.getAllSegmentsAndIgnoreVisibility | public function getAllSegmentsAndIgnoreVisibility()
{
$sql = "SELECT * FROM " . $this->getTable() . " WHERE deleted = 0";
$segments = $this->getDb()->fetchAll($sql);
return $segments;
} | php | public function getAllSegmentsAndIgnoreVisibility()
{
$sql = "SELECT * FROM " . $this->getTable() . " WHERE deleted = 0";
$segments = $this->getDb()->fetchAll($sql);
return $segments;
} | [
"public",
"function",
"getAllSegmentsAndIgnoreVisibility",
"(",
")",
"{",
"$",
"sql",
"=",
"\"SELECT * FROM \"",
".",
"$",
"this",
"->",
"getTable",
"(",
")",
".",
"\" WHERE deleted = 0\"",
";",
"$",
"segments",
"=",
"$",
"this",
"->",
"getDb",
"(",
")",
"->... | Returns all stored segments that haven't been deleted. Ignores the site the segments are enabled
for and whether to auto archive or not.
@return array | [
"Returns",
"all",
"stored",
"segments",
"that",
"haven",
"t",
"been",
"deleted",
".",
"Ignores",
"the",
"site",
"the",
"segments",
"are",
"enabled",
"for",
"and",
"whether",
"to",
"auto",
"archive",
"or",
"not",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/SegmentEditor/Model.php#L33-L40 | train | Get all segments and ignore visibility | [
30522,
2270,
3853,
2131,
8095,
3366,
21693,
11187,
5685,
23773,
5686,
11365,
13464,
1006,
1007,
1063,
1002,
29296,
1027,
1000,
7276,
1008,
2013,
1000,
1012,
1002,
2023,
1011,
1028,
2131,
10880,
1006,
1007,
1012,
1000,
2073,
17159,
1027,
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... |
symfony/symfony | src/Symfony/Component/Finder/Iterator/CustomFilterIterator.php | CustomFilterIterator.accept | public function accept()
{
$fileinfo = $this->current();
foreach ($this->filters as $filter) {
if (false === $filter($fileinfo)) {
return false;
}
}
return true;
} | php | public function accept()
{
$fileinfo = $this->current();
foreach ($this->filters as $filter) {
if (false === $filter($fileinfo)) {
return false;
}
}
return true;
} | [
"public",
"function",
"accept",
"(",
")",
"{",
"$",
"fileinfo",
"=",
"$",
"this",
"->",
"current",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"filters",
"as",
"$",
"filter",
")",
"{",
"if",
"(",
"false",
"===",
"$",
"filter",
"(",
"$",
"fi... | Filters the iterator values.
@return bool true if the value should be kept, false otherwise | [
"Filters",
"the",
"iterator",
"values",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Finder/Iterator/CustomFilterIterator.php#L49-L60 | train | Accept the current file | [
30522,
2270,
3853,
5138,
1006,
1007,
1063,
1002,
5371,
2378,
14876,
1027,
1002,
2023,
1011,
1028,
2783,
1006,
1007,
1025,
18921,
6776,
1006,
1002,
2023,
1011,
1028,
17736,
2004,
1002,
11307,
1007,
1063,
2065,
1006,
6270,
1027,
1027,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/UsersManager/Controller.php | Controller.getDefaultDates | protected function getDefaultDates()
{
$dates = array(
'today' => $this->translator->translate('Intl_Today'),
'yesterday' => $this->translator->translate('Intl_Yesterday'),
'previous7' => $this->translator->translate('General_PreviousDays', 7),
'previous30' => $this->translator->translate('General_PreviousDays', 30),
'last7' => $this->translator->translate('General_LastDays', 7),
'last30' => $this->translator->translate('General_LastDays', 30),
'week' => $this->translator->translate('General_CurrentWeek'),
'month' => $this->translator->translate('General_CurrentMonth'),
'year' => $this->translator->translate('General_CurrentYear'),
);
$mappingDatesToPeriods = array(
'today' => 'day',
'yesterday' => 'day',
'previous7' => 'range',
'previous30' => 'range',
'last7' => 'range',
'last30' => 'range',
'week' => 'week',
'month' => 'month',
'year' => 'year',
);
// assertion
if (count($dates) != count($mappingDatesToPeriods)) {
throw new Exception("some metadata is missing in getDefaultDates()");
}
$allowedPeriods = self::getEnabledPeriodsInUI();
$allowedDates = array_intersect($mappingDatesToPeriods, $allowedPeriods);
$dates = array_intersect_key($dates, $allowedDates);
/**
* Triggered when the list of available dates is requested, for example for the
* User Settings > Report date to load by default.
*
* @param array &$dates Array of (date => translation)
*/
Piwik::postEvent('UsersManager.getDefaultDates', array(&$dates));
return $dates;
} | php | protected function getDefaultDates()
{
$dates = array(
'today' => $this->translator->translate('Intl_Today'),
'yesterday' => $this->translator->translate('Intl_Yesterday'),
'previous7' => $this->translator->translate('General_PreviousDays', 7),
'previous30' => $this->translator->translate('General_PreviousDays', 30),
'last7' => $this->translator->translate('General_LastDays', 7),
'last30' => $this->translator->translate('General_LastDays', 30),
'week' => $this->translator->translate('General_CurrentWeek'),
'month' => $this->translator->translate('General_CurrentMonth'),
'year' => $this->translator->translate('General_CurrentYear'),
);
$mappingDatesToPeriods = array(
'today' => 'day',
'yesterday' => 'day',
'previous7' => 'range',
'previous30' => 'range',
'last7' => 'range',
'last30' => 'range',
'week' => 'week',
'month' => 'month',
'year' => 'year',
);
// assertion
if (count($dates) != count($mappingDatesToPeriods)) {
throw new Exception("some metadata is missing in getDefaultDates()");
}
$allowedPeriods = self::getEnabledPeriodsInUI();
$allowedDates = array_intersect($mappingDatesToPeriods, $allowedPeriods);
$dates = array_intersect_key($dates, $allowedDates);
/**
* Triggered when the list of available dates is requested, for example for the
* User Settings > Report date to load by default.
*
* @param array &$dates Array of (date => translation)
*/
Piwik::postEvent('UsersManager.getDefaultDates', array(&$dates));
return $dates;
} | [
"protected",
"function",
"getDefaultDates",
"(",
")",
"{",
"$",
"dates",
"=",
"array",
"(",
"'today'",
"=>",
"$",
"this",
"->",
"translator",
"->",
"translate",
"(",
"'Intl_Today'",
")",
",",
"'yesterday'",
"=>",
"$",
"this",
"->",
"translator",
"->",
"tra... | Returns the enabled dates that users can select,
in their User Settings page "Report date to load by default"
@throws
@return array | [
"Returns",
"the",
"enabled",
"dates",
"that",
"users",
"can",
"select",
"in",
"their",
"User",
"Settings",
"page",
"Report",
"date",
"to",
"load",
"by",
"default"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/UsersManager/Controller.php#L125-L169 | train | Returns the list of dates that should be loaded by default | [
30522,
5123,
3853,
2131,
3207,
7011,
11314,
27122,
1006,
1007,
1063,
1002,
5246,
1027,
9140,
1006,
1005,
2651,
1005,
1027,
1028,
1002,
2023,
1011,
1028,
11403,
1011,
1028,
17637,
1006,
1005,
20014,
2140,
1035,
2651,
1005,
1007,
1010,
1005,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/Db/Adapter/Pdo/Mysql.php | Mysql.isConnectionUTF8 | public function isConnectionUTF8()
{
$charsetInfo = $this->fetchAll('SHOW VARIABLES LIKE ?', array('character_set_connection'));
if (empty($charsetInfo)) {
return false;
}
$charset = $charsetInfo[0]['Value'];
return $charset === 'utf8';
} | php | public function isConnectionUTF8()
{
$charsetInfo = $this->fetchAll('SHOW VARIABLES LIKE ?', array('character_set_connection'));
if (empty($charsetInfo)) {
return false;
}
$charset = $charsetInfo[0]['Value'];
return $charset === 'utf8';
} | [
"public",
"function",
"isConnectionUTF8",
"(",
")",
"{",
"$",
"charsetInfo",
"=",
"$",
"this",
"->",
"fetchAll",
"(",
"'SHOW VARIABLES LIKE ?'",
",",
"array",
"(",
"'character_set_connection'",
")",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"charsetInfo",
")",
... | Is the connection character set equal to utf8?
@return bool | [
"Is",
"the",
"connection",
"character",
"set",
"equal",
"to",
"utf8?"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Db/Adapter/Pdo/Mysql.php#L224-L234 | train | Return true if the connection character set is UTF - 8 | [
30522,
2270,
3853,
2003,
8663,
2638,
7542,
4904,
2546,
2620,
1006,
1007,
1063,
1002,
25869,
13462,
2378,
14876,
1027,
1002,
2023,
1011,
1028,
18584,
8095,
1006,
1005,
2265,
10857,
2066,
1029,
1005,
1010,
9140,
1006,
1005,
2839,
1035,
2275,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Validation/Concerns/ValidatesAttributes.php | ValidatesAttributes.validateFilled | public function validateFilled($attribute, $value)
{
if (Arr::has($this->data, $attribute)) {
return $this->validateRequired($attribute, $value);
}
return true;
} | php | public function validateFilled($attribute, $value)
{
if (Arr::has($this->data, $attribute)) {
return $this->validateRequired($attribute, $value);
}
return true;
} | [
"public",
"function",
"validateFilled",
"(",
"$",
"attribute",
",",
"$",
"value",
")",
"{",
"if",
"(",
"Arr",
"::",
"has",
"(",
"$",
"this",
"->",
"data",
",",
"$",
"attribute",
")",
")",
"{",
"return",
"$",
"this",
"->",
"validateRequired",
"(",
"$"... | Validate the given attribute is filled if it is present.
@param string $attribute
@param mixed $value
@return bool | [
"Validate",
"the",
"given",
"attribute",
"is",
"filled",
"if",
"it",
"is",
"present",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Validation/Concerns/ValidatesAttributes.php#L865-L872 | train | ValidateFilled - Filled attribute | [
30522,
2270,
3853,
9398,
3686,
8873,
11001,
1006,
1002,
17961,
1010,
1002,
3643,
1007,
1063,
2065,
1006,
12098,
2099,
1024,
1024,
2038,
1006,
1002,
2023,
1011,
1028,
2951,
1010,
1002,
17961,
1007,
1007,
1063,
2709,
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/cms/classes/ComponentBase.php | ComponentBase.runAjaxHandler | public function runAjaxHandler($handler)
{
/**
* @event cms.component.beforeRunAjaxHandler
* Provides an opportunity to modify an AJAX request to a component before it is processed by the component
*
* The parameter provided is `$handler` (the requested AJAX handler to be run)
*
* Example usage (forwards AJAX handlers to a backend widget):
*
* Event::listen('cms.component.beforeRunAjaxHandler', function((\Cms\Classes\ComponentBase) $component, (string) $handler) {
* if (strpos($handler, '::')) {
* list($componentAlias, $handlerName) = explode('::', $handler);
* if ($componentAlias === $this->getBackendWidgetAlias()) {
* return $this->backendControllerProxy->runAjaxHandler($handler);
* }
* }
* });
*
* Or
*
* $this->controller->bindEvent('component.beforeRunAjaxHandler', function ((string) $handler) {
* if (strpos($handler, '::')) {
* list($componentAlias, $handlerName) = explode('::', $handler);
* if ($componentAlias === $this->getBackendWidgetAlias()) {
* return $this->backendControllerProxy->runAjaxHandler($handler);
* }
* }
* });
*
*/
if ($event = $this->fireSystemEvent('cms.component.beforeRunAjaxHandler', [$handler])) {
return $event;
}
$result = $this->$handler();
/**
* @event cms.component.runAjaxHandler
* Provides an opportunity to modify an AJAX request to a component after it is processed by the component
*
* The parameters provided are `$handler` (the requested AJAX handler to be run) and `$result` (the result of the component processing the request)
*
* Example usage (Logs requests and their response):
*
* Event::listen('cms.component.beforeRunHandler', function((\Cms\Classes\ComponentBase) $component, (string) $handler, (mixed) $result) {
* if (in_array($handler, $interceptHandlers)) {
* return 'request has been intercepted, original response: ' . json_encode($result);
* }
* });
*
* Or
*
* $this->controller->bindEvent('componenet.beforeRunAjaxHandler', function ((string) $handler, (mixed) $result) {
* if (in_array($handler, $interceptHandlers)) {
* return 'request has been intercepted, original response: ' . json_encode($result);
* }
* });
*
*/
if ($event = $this->fireSystemEvent('cms.component.runAjaxHandler', [$handler, $result])) {
return $event;
}
return $result;
} | php | public function runAjaxHandler($handler)
{
/**
* @event cms.component.beforeRunAjaxHandler
* Provides an opportunity to modify an AJAX request to a component before it is processed by the component
*
* The parameter provided is `$handler` (the requested AJAX handler to be run)
*
* Example usage (forwards AJAX handlers to a backend widget):
*
* Event::listen('cms.component.beforeRunAjaxHandler', function((\Cms\Classes\ComponentBase) $component, (string) $handler) {
* if (strpos($handler, '::')) {
* list($componentAlias, $handlerName) = explode('::', $handler);
* if ($componentAlias === $this->getBackendWidgetAlias()) {
* return $this->backendControllerProxy->runAjaxHandler($handler);
* }
* }
* });
*
* Or
*
* $this->controller->bindEvent('component.beforeRunAjaxHandler', function ((string) $handler) {
* if (strpos($handler, '::')) {
* list($componentAlias, $handlerName) = explode('::', $handler);
* if ($componentAlias === $this->getBackendWidgetAlias()) {
* return $this->backendControllerProxy->runAjaxHandler($handler);
* }
* }
* });
*
*/
if ($event = $this->fireSystemEvent('cms.component.beforeRunAjaxHandler', [$handler])) {
return $event;
}
$result = $this->$handler();
/**
* @event cms.component.runAjaxHandler
* Provides an opportunity to modify an AJAX request to a component after it is processed by the component
*
* The parameters provided are `$handler` (the requested AJAX handler to be run) and `$result` (the result of the component processing the request)
*
* Example usage (Logs requests and their response):
*
* Event::listen('cms.component.beforeRunHandler', function((\Cms\Classes\ComponentBase) $component, (string) $handler, (mixed) $result) {
* if (in_array($handler, $interceptHandlers)) {
* return 'request has been intercepted, original response: ' . json_encode($result);
* }
* });
*
* Or
*
* $this->controller->bindEvent('componenet.beforeRunAjaxHandler', function ((string) $handler, (mixed) $result) {
* if (in_array($handler, $interceptHandlers)) {
* return 'request has been intercepted, original response: ' . json_encode($result);
* }
* });
*
*/
if ($event = $this->fireSystemEvent('cms.component.runAjaxHandler', [$handler, $result])) {
return $event;
}
return $result;
} | [
"public",
"function",
"runAjaxHandler",
"(",
"$",
"handler",
")",
"{",
"/**\n * @event cms.component.beforeRunAjaxHandler\n * Provides an opportunity to modify an AJAX request to a component before it is processed by the component\n *\n * The parameter provided is `$h... | Executes the event cycle when running an AJAX handler.
@return boolean Returns true if the handler was found. Returns false otherwise. | [
"Executes",
"the",
"event",
"cycle",
"when",
"running",
"an",
"AJAX",
"handler",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/ComponentBase.php#L152-L217 | train | Runs an AJAX handler on the current page | [
30522,
2270,
3853,
2448,
22734,
2595,
11774,
3917,
1006,
1002,
28213,
1007,
1063,
1013,
1008,
1008,
1008,
1030,
2724,
4642,
2015,
1012,
6922,
1012,
2077,
26605,
3900,
2595,
11774,
3917,
1008,
3640,
2019,
4495,
2000,
19933,
2019,
18176,
5227... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
php-ai/php-ml | src/Association/Apriori.php | Apriori.antecedents | private function antecedents(array $sample): array
{
$cardinality = count($sample);
$antecedents = $this->powerSet($sample);
return array_filter($antecedents, function ($antecedent) use ($cardinality) {
return (count($antecedent) != $cardinality) && ($antecedent != []);
});
} | php | private function antecedents(array $sample): array
{
$cardinality = count($sample);
$antecedents = $this->powerSet($sample);
return array_filter($antecedents, function ($antecedent) use ($cardinality) {
return (count($antecedent) != $cardinality) && ($antecedent != []);
});
} | [
"private",
"function",
"antecedents",
"(",
"array",
"$",
"sample",
")",
":",
"array",
"{",
"$",
"cardinality",
"=",
"count",
"(",
"$",
"sample",
")",
";",
"$",
"antecedents",
"=",
"$",
"this",
"->",
"powerSet",
"(",
"$",
"sample",
")",
";",
"return",
... | Generates all proper subsets for given set $sample without the empty set.
@param mixed[] $sample
@return mixed[][] | [
"Generates",
"all",
"proper",
"subsets",
"for",
"given",
"set",
"$sample",
"without",
"the",
"empty",
"set",
"."
] | f6aa1a59b0525b8fca3d2786d661ab3e70904016 | https://github.com/php-ai/php-ml/blob/f6aa1a59b0525b8fca3d2786d661ab3e70904016/src/Association/Apriori.php#L175-L183 | train | Returns antecedents for the sample | [
30522,
2797,
3853,
14405,
26005,
28986,
1006,
9140,
1002,
7099,
1007,
1024,
9140,
1063,
1002,
7185,
3012,
1027,
4175,
1006,
1002,
7099,
1007,
1025,
1002,
14405,
26005,
28986,
1027,
1002,
2023,
1011,
1028,
4204,
3388,
1006,
1002,
7099,
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/DependencyInjection/Loader/XmlFileLoader.php | XmlFileLoader.getChildren | private function getChildren(\DOMNode $node, $name)
{
$children = [];
foreach ($node->childNodes as $child) {
if ($child instanceof \DOMElement && $child->localName === $name && self::NS === $child->namespaceURI) {
$children[] = $child;
}
}
return $children;
} | php | private function getChildren(\DOMNode $node, $name)
{
$children = [];
foreach ($node->childNodes as $child) {
if ($child instanceof \DOMElement && $child->localName === $name && self::NS === $child->namespaceURI) {
$children[] = $child;
}
}
return $children;
} | [
"private",
"function",
"getChildren",
"(",
"\\",
"DOMNode",
"$",
"node",
",",
"$",
"name",
")",
"{",
"$",
"children",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"node",
"->",
"childNodes",
"as",
"$",
"child",
")",
"{",
"if",
"(",
"$",
"child",
"insta... | Get child elements by name.
@param \DOMNode $node
@param mixed $name
@return \DOMElement[] | [
"Get",
"child",
"elements",
"by",
"name",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php#L590-L600 | train | Get children of a node | [
30522,
2797,
3853,
2131,
19339,
7389,
1006,
1032,
14383,
3630,
3207,
1002,
13045,
1010,
1002,
2171,
1007,
1063,
1002,
2336,
1027,
1031,
1033,
1025,
18921,
6776,
1006,
1002,
13045,
1011,
1028,
2775,
3630,
6155,
2004,
1002,
2775,
1007,
1063,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/DependencyInjection/Compiler/ReplaceAliasByActualDefinitionPass.php | ReplaceAliasByActualDefinitionPass.processValue | protected function processValue($value, $isRoot = false)
{
if ($value instanceof Reference && isset($this->replacements[$referenceId = (string) $value])) {
// Perform the replacement
$newId = $this->replacements[$referenceId];
$value = new Reference($newId, $value->getInvalidBehavior());
$this->container->log($this, sprintf('Changed reference of service "%s" previously pointing to "%s" to "%s".', $this->currentId, $referenceId, $newId));
}
return parent::processValue($value, $isRoot);
} | php | protected function processValue($value, $isRoot = false)
{
if ($value instanceof Reference && isset($this->replacements[$referenceId = (string) $value])) {
// Perform the replacement
$newId = $this->replacements[$referenceId];
$value = new Reference($newId, $value->getInvalidBehavior());
$this->container->log($this, sprintf('Changed reference of service "%s" previously pointing to "%s" to "%s".', $this->currentId, $referenceId, $newId));
}
return parent::processValue($value, $isRoot);
} | [
"protected",
"function",
"processValue",
"(",
"$",
"value",
",",
"$",
"isRoot",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"value",
"instanceof",
"Reference",
"&&",
"isset",
"(",
"$",
"this",
"->",
"replacements",
"[",
"$",
"referenceId",
"=",
"(",
"string"... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DependencyInjection/Compiler/ReplaceAliasByActualDefinitionPass.php#L83-L93 | train | Process the value of the service | [
30522,
5123,
3853,
2832,
10175,
5657,
1006,
1002,
3643,
1010,
1002,
2003,
3217,
4140,
1027,
6270,
1007,
1063,
2065,
1006,
1002,
3643,
6013,
11253,
4431,
1004,
1004,
26354,
3388,
1006,
1002,
2023,
1011,
1028,
23936,
1031,
1002,
4431,
3593,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/API/ResponseBuilder.php | ResponseBuilder.getResponseException | public function getResponseException($e)
{
$e = $this->decorateExceptionWithDebugTrace($e);
$message = $this->formatExceptionMessage($e);
$this->sendHeaderIfEnabled();
return $this->apiRenderer->renderException($message, $e);
} | php | public function getResponseException($e)
{
$e = $this->decorateExceptionWithDebugTrace($e);
$message = $this->formatExceptionMessage($e);
$this->sendHeaderIfEnabled();
return $this->apiRenderer->renderException($message, $e);
} | [
"public",
"function",
"getResponseException",
"(",
"$",
"e",
")",
"{",
"$",
"e",
"=",
"$",
"this",
"->",
"decorateExceptionWithDebugTrace",
"(",
"$",
"e",
")",
";",
"$",
"message",
"=",
"$",
"this",
"->",
"formatExceptionMessage",
"(",
"$",
"e",
")",
";"... | Returns an error $message in the requested $format
@param Exception|\Throwable $e
@throws Exception
@return string | [
"Returns",
"an",
"error",
"$message",
"in",
"the",
"requested",
"$format"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/API/ResponseBuilder.php#L133-L141 | train | Get Response Exception | [
30522,
2270,
3853,
2131,
6072,
26029,
19763,
2595,
24422,
1006,
1002,
1041,
1007,
1063,
1002,
1041,
1027,
1002,
2023,
1011,
1028,
29460,
10288,
24422,
24415,
3207,
8569,
13512,
22903,
1006,
1002,
1041,
1007,
1025,
1002,
4471,
1027,
1002,
20... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php | BelongsToMany.orWherePivot | public function orWherePivot($column, $operator = null, $value = null)
{
return $this->wherePivot($column, $operator, $value, 'or');
} | php | public function orWherePivot($column, $operator = null, $value = null)
{
return $this->wherePivot($column, $operator, $value, 'or');
} | [
"public",
"function",
"orWherePivot",
"(",
"$",
"column",
",",
"$",
"operator",
"=",
"null",
",",
"$",
"value",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"wherePivot",
"(",
"$",
"column",
",",
"$",
"operator",
",",
"$",
"value",
",",
"'or'"... | Set an "or where" clause for a pivot table column.
@param string $column
@param string $operator
@param mixed $value
@return $this | [
"Set",
"an",
"or",
"where",
"clause",
"for",
"a",
"pivot",
"table",
"column",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php#L383-L386 | train | or wherePivot - Purpose is for backward compatibility | [
30522,
2270,
3853,
2030,
2860,
5886,
13699,
20984,
2102,
1006,
1002,
5930,
1010,
1002,
6872,
1027,
19701,
1010,
1002,
3643,
1027,
19701,
1007,
1063,
2709,
30524,
1005,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/DatabaseServiceProvider.php | DatabaseServiceProvider.registerEloquentFactory | protected function registerEloquentFactory()
{
$this->app->singleton(FakerGenerator::class, function ($app) {
return FakerFactory::create($app['config']->get('app.faker_locale', 'en_US'));
});
$this->app->singleton(EloquentFactory::class, function ($app) {
return EloquentFactory::construct(
$app->make(FakerGenerator::class), $this->app->databasePath('factories')
);
});
} | php | protected function registerEloquentFactory()
{
$this->app->singleton(FakerGenerator::class, function ($app) {
return FakerFactory::create($app['config']->get('app.faker_locale', 'en_US'));
});
$this->app->singleton(EloquentFactory::class, function ($app) {
return EloquentFactory::construct(
$app->make(FakerGenerator::class), $this->app->databasePath('factories')
);
});
} | [
"protected",
"function",
"registerEloquentFactory",
"(",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"singleton",
"(",
"FakerGenerator",
"::",
"class",
",",
"function",
"(",
"$",
"app",
")",
"{",
"return",
"FakerFactory",
"::",
"create",
"(",
"$",
"app",
"["... | Register the Eloquent factory instance in the container.
@return void | [
"Register",
"the",
"Eloquent",
"factory",
"instance",
"in",
"the",
"container",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/DatabaseServiceProvider.php#L75-L86 | train | Register Eloquent Factory | [
30522,
5123,
3853,
4236,
18349,
15417,
21450,
1006,
1007,
1063,
1002,
2023,
1011,
1028,
10439,
1011,
1028,
28159,
1006,
8275,
25892,
6906,
4263,
1024,
1024,
2465,
1010,
3853,
1006,
1002,
10439,
1007,
1063,
2709,
8275,
12881,
18908,
10253,
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/Table/Abstract.php | Zend_Db_Table_Abstract.find | public function find()
{
$this->_setupPrimaryKey();
$args = func_get_args();
$keyNames = array_values((array) $this->_primary);
if (count($args) < count($keyNames)) {
// require_once 'Zend/Db/Table/Exception.php';
throw new Zend_Db_Table_Exception("Too few columns for the primary key");
}
if (count($args) > count($keyNames)) {
// require_once 'Zend/Db/Table/Exception.php';
throw new Zend_Db_Table_Exception("Too many columns for the primary key");
}
$whereList = array();
$numberTerms = 0;
foreach ($args as $keyPosition => $keyValues) {
$keyValuesCount = count($keyValues);
// Coerce the values to an array.
// Don't simply typecast to array, because the values
// might be Zend_Db_Expr objects.
if (!is_array($keyValues)) {
$keyValues = array($keyValues);
}
if ($numberTerms == 0) {
$numberTerms = $keyValuesCount;
} else if ($keyValuesCount != $numberTerms) {
// require_once 'Zend/Db/Table/Exception.php';
throw new Zend_Db_Table_Exception("Missing value(s) for the primary key");
}
$keyValues = array_values($keyValues);
for ($i = 0; $i < $keyValuesCount; ++$i) {
if (!isset($whereList[$i])) {
$whereList[$i] = array();
}
$whereList[$i][$keyPosition] = $keyValues[$i];
}
}
$whereClause = null;
if (count($whereList)) {
$whereOrTerms = array();
$tableName = $this->_db->quoteTableAs($this->_name, null, true);
foreach ($whereList as $keyValueSets) {
$whereAndTerms = array();
foreach ($keyValueSets as $keyPosition => $keyValue) {
$type = $this->_metadata[$keyNames[$keyPosition]]['DATA_TYPE'];
$columnName = $this->_db->quoteIdentifier($keyNames[$keyPosition], true);
$whereAndTerms[] = $this->_db->quoteInto(
$tableName . '.' . $columnName . ' = ?',
$keyValue, $type);
}
$whereOrTerms[] = '(' . implode(' AND ', $whereAndTerms) . ')';
}
$whereClause = '(' . implode(' OR ', $whereOrTerms) . ')';
}
// issue ZF-5775 (empty where clause should return empty rowset)
if ($whereClause == null) {
$rowsetClass = $this->getRowsetClass();
if (!class_exists($rowsetClass)) {
// require_once 'Zend/Loader.php';
Zend_Loader::loadClass($rowsetClass);
}
return new $rowsetClass(array('table' => $this, 'rowClass' => $this->getRowClass(), 'stored' => true));
}
return $this->fetchAll($whereClause);
} | php | public function find()
{
$this->_setupPrimaryKey();
$args = func_get_args();
$keyNames = array_values((array) $this->_primary);
if (count($args) < count($keyNames)) {
// require_once 'Zend/Db/Table/Exception.php';
throw new Zend_Db_Table_Exception("Too few columns for the primary key");
}
if (count($args) > count($keyNames)) {
// require_once 'Zend/Db/Table/Exception.php';
throw new Zend_Db_Table_Exception("Too many columns for the primary key");
}
$whereList = array();
$numberTerms = 0;
foreach ($args as $keyPosition => $keyValues) {
$keyValuesCount = count($keyValues);
// Coerce the values to an array.
// Don't simply typecast to array, because the values
// might be Zend_Db_Expr objects.
if (!is_array($keyValues)) {
$keyValues = array($keyValues);
}
if ($numberTerms == 0) {
$numberTerms = $keyValuesCount;
} else if ($keyValuesCount != $numberTerms) {
// require_once 'Zend/Db/Table/Exception.php';
throw new Zend_Db_Table_Exception("Missing value(s) for the primary key");
}
$keyValues = array_values($keyValues);
for ($i = 0; $i < $keyValuesCount; ++$i) {
if (!isset($whereList[$i])) {
$whereList[$i] = array();
}
$whereList[$i][$keyPosition] = $keyValues[$i];
}
}
$whereClause = null;
if (count($whereList)) {
$whereOrTerms = array();
$tableName = $this->_db->quoteTableAs($this->_name, null, true);
foreach ($whereList as $keyValueSets) {
$whereAndTerms = array();
foreach ($keyValueSets as $keyPosition => $keyValue) {
$type = $this->_metadata[$keyNames[$keyPosition]]['DATA_TYPE'];
$columnName = $this->_db->quoteIdentifier($keyNames[$keyPosition], true);
$whereAndTerms[] = $this->_db->quoteInto(
$tableName . '.' . $columnName . ' = ?',
$keyValue, $type);
}
$whereOrTerms[] = '(' . implode(' AND ', $whereAndTerms) . ')';
}
$whereClause = '(' . implode(' OR ', $whereOrTerms) . ')';
}
// issue ZF-5775 (empty where clause should return empty rowset)
if ($whereClause == null) {
$rowsetClass = $this->getRowsetClass();
if (!class_exists($rowsetClass)) {
// require_once 'Zend/Loader.php';
Zend_Loader::loadClass($rowsetClass);
}
return new $rowsetClass(array('table' => $this, 'rowClass' => $this->getRowClass(), 'stored' => true));
}
return $this->fetchAll($whereClause);
} | [
"public",
"function",
"find",
"(",
")",
"{",
"$",
"this",
"->",
"_setupPrimaryKey",
"(",
")",
";",
"$",
"args",
"=",
"func_get_args",
"(",
")",
";",
"$",
"keyNames",
"=",
"array_values",
"(",
"(",
"array",
")",
"$",
"this",
"->",
"_primary",
")",
";"... | Fetches rows by primary key. The argument specifies one or more primary
key value(s). To find multiple rows by primary key, the argument must
be an array.
This method accepts a variable number of arguments. If the table has a
multi-column primary key, the number of arguments must be the same as
the number of columns in the primary key. To find multiple rows in a
table with a multi-column primary key, each argument must be an array
with the same number of elements.
The find() method always returns a Rowset object, even if only one row
was found.
@param mixed $key The value(s) of the primary keys.
@return Zend_Db_Table_Rowset_Abstract Row(s) matching the criteria.
@throws Zend_Db_Table_Exception | [
"Fetches",
"rows",
"by",
"primary",
"key",
".",
"The",
"argument",
"specifies",
"one",
"or",
"more",
"primary",
"key",
"value",
"(",
"s",
")",
".",
"To",
"find",
"multiple",
"rows",
"by",
"primary",
"key",
"the",
"argument",
"must",
"be",
"an",
"array",
... | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Table/Abstract.php#L1240-L1310 | train | Find all records matching the given conditions | [
30522,
2270,
3853,
2424,
1006,
1007,
1063,
1002,
2023,
1011,
1028,
1035,
16437,
18098,
9581,
2854,
14839,
1006,
1007,
1025,
1002,
12098,
5620,
1027,
4569,
2278,
1035,
2131,
1035,
12098,
5620,
1006,
1007,
1025,
1002,
3145,
18442,
2015,
1027,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/DataTable/Filter/BeautifyRangeLabels.php | BeautifyRangeLabels.getSingleUnitLabel | public function getSingleUnitLabel($oldLabel, $lowerBound)
{
if ($lowerBound == 1) {
return $this->labelSingular;
} else {
return sprintf($this->labelPlural, $lowerBound);
}
} | php | public function getSingleUnitLabel($oldLabel, $lowerBound)
{
if ($lowerBound == 1) {
return $this->labelSingular;
} else {
return sprintf($this->labelPlural, $lowerBound);
}
} | [
"public",
"function",
"getSingleUnitLabel",
"(",
"$",
"oldLabel",
",",
"$",
"lowerBound",
")",
"{",
"if",
"(",
"$",
"lowerBound",
"==",
"1",
")",
"{",
"return",
"$",
"this",
"->",
"labelSingular",
";",
"}",
"else",
"{",
"return",
"sprintf",
"(",
"$",
"... | Beautifies and returns a range label whose range spans over one unit, ie
1-1, 2-2 or 3-3.
This function can be overridden in derived types to customize beautifcation
behavior based on the range values.
@param string $oldLabel The original label value.
@param int $lowerBound The lower bound of the range.
@return string The pretty range label. | [
"Beautifies",
"and",
"returns",
"a",
"range",
"label",
"whose",
"range",
"spans",
"over",
"one",
"unit",
"ie",
"1",
"-",
"1",
"2",
"-",
"2",
"or",
"3",
"-",
"3",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/DataTable/Filter/BeautifyRangeLabels.php#L127-L134 | train | Get single unit label | [
30522,
2270,
3853,
4152,
2075,
2571,
19496,
19646,
16336,
2140,
1006,
1002,
2214,
20470,
2884,
1010,
1002,
2896,
15494,
1007,
1063,
2065,
1006,
1002,
2896,
15494,
1027,
1027,
1015,
1007,
1063,
2709,
1002,
2023,
1011,
1028,
10873,
2075,
7934... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/DependencyInjection/Compiler/AddAnnotationsCachedReaderPass.php | AddAnnotationsCachedReaderPass.process | public function process(ContainerBuilder $container)
{
// "annotations.cached_reader" is wired late so that any passes using
// "annotation_reader" at build time don't get any cache
foreach ($container->findTaggedServiceIds('annotations.cached_reader') as $id => $tags) {
$reader = $container->getDefinition($id);
$properties = $reader->getProperties();
if (isset($properties['cacheProviderBackup'])) {
$provider = $properties['cacheProviderBackup']->getValues()[0];
unset($properties['cacheProviderBackup']);
$reader->setProperties($properties);
$container->set($id, null);
$container->setDefinition($id, $reader->replaceArgument(1, $provider));
}
}
} | php | public function process(ContainerBuilder $container)
{
// "annotations.cached_reader" is wired late so that any passes using
// "annotation_reader" at build time don't get any cache
foreach ($container->findTaggedServiceIds('annotations.cached_reader') as $id => $tags) {
$reader = $container->getDefinition($id);
$properties = $reader->getProperties();
if (isset($properties['cacheProviderBackup'])) {
$provider = $properties['cacheProviderBackup']->getValues()[0];
unset($properties['cacheProviderBackup']);
$reader->setProperties($properties);
$container->set($id, null);
$container->setDefinition($id, $reader->replaceArgument(1, $provider));
}
}
} | [
"public",
"function",
"process",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"// \"annotations.cached_reader\" is wired late so that any passes using",
"// \"annotation_reader\" at build time don't get any cache",
"foreach",
"(",
"$",
"container",
"->",
"findTaggedServiceIds... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddAnnotationsCachedReaderPass.php#L25-L41 | train | Replace cache provider backup with cached provider | [
30522,
2270,
3853,
2832,
1006,
11661,
8569,
23891,
2099,
1002,
11661,
1007,
1063,
1013,
1013,
1000,
5754,
17287,
9285,
1012,
17053,
2094,
1035,
8068,
1000,
2003,
17502,
2397,
2061,
2008,
2151,
5235,
2478,
1013,
1013,
1000,
5754,
17287,
3508... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Form/Extension/Core/DataTransformer/PercentToLocalizedStringTransformer.php | PercentToLocalizedStringTransformer.transform | public function transform($value)
{
if (null === $value) {
return '';
}
if (!is_numeric($value)) {
throw new TransformationFailedException('Expected a numeric.');
}
if (self::FRACTIONAL == $this->type) {
$value *= 100;
}
$formatter = $this->getNumberFormatter();
$value = $formatter->format($value);
if (intl_is_failure($formatter->getErrorCode())) {
throw new TransformationFailedException($formatter->getErrorMessage());
}
// replace the UTF-8 non break spaces
return $value;
} | php | public function transform($value)
{
if (null === $value) {
return '';
}
if (!is_numeric($value)) {
throw new TransformationFailedException('Expected a numeric.');
}
if (self::FRACTIONAL == $this->type) {
$value *= 100;
}
$formatter = $this->getNumberFormatter();
$value = $formatter->format($value);
if (intl_is_failure($formatter->getErrorCode())) {
throw new TransformationFailedException($formatter->getErrorMessage());
}
// replace the UTF-8 non break spaces
return $value;
} | [
"public",
"function",
"transform",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"value",
")",
"{",
"return",
"''",
";",
"}",
"if",
"(",
"!",
"is_numeric",
"(",
"$",
"value",
")",
")",
"{",
"throw",
"new",
"TransformationFailedException",... | Transforms between a normalized format (integer or float) into a percentage value.
@param int|float $value Normalized value
@return string Percentage value
@throws TransformationFailedException if the given value is not numeric or
if the value could not be transformed | [
"Transforms",
"between",
"a",
"normalized",
"format",
"(",
"integer",
"or",
"float",
")",
"into",
"a",
"percentage",
"value",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Extension/Core/DataTransformer/PercentToLocalizedStringTransformer.php#L73-L96 | train | Transforms a number into a number | [
30522,
2270,
3853,
10938,
1006,
1002,
3643,
1007,
1063,
2065,
30524,
8651,
7011,
18450,
10288,
24422,
1006,
1005,
3517,
1037,
16371,
25531,
1012,
1005,
1007,
1025,
1065,
2065,
1006,
2969,
1024,
1024,
12884,
2389,
1027,
1027,
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... |
symfony/symfony | src/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationMapper.php | ViolationMapper.matchChild | private function matchChild(FormInterface $form, PropertyPathIteratorInterface $it)
{
$target = null;
$chunk = '';
$foundAtIndex = null;
// Construct mapping rules for the given form
$rules = [];
foreach ($form->getConfig()->getOption('error_mapping') as $propertyPath => $targetPath) {
// Dot rules are considered at the very end
if ('.' !== $propertyPath) {
$rules[] = new MappingRule($form, $propertyPath, $targetPath);
}
}
$children = iterator_to_array(new \RecursiveIteratorIterator(new InheritDataAwareIterator($form)), false);
while ($it->valid()) {
if ($it->isIndex()) {
$chunk .= '['.$it->current().']';
} else {
$chunk .= ('' === $chunk ? '' : '.').$it->current();
}
// Test mapping rules as long as we have any
foreach ($rules as $key => $rule) {
/* @var MappingRule $rule */
// Mapping rule matches completely, terminate.
if (null !== ($form = $rule->match($chunk))) {
return $form;
}
// Keep only rules that have $chunk as prefix
if (!$rule->isPrefix($chunk)) {
unset($rules[$key]);
}
}
/** @var FormInterface $child */
foreach ($children as $i => $child) {
$childPath = (string) $child->getPropertyPath();
if ($childPath === $chunk) {
$target = $child;
$foundAtIndex = $it->key();
} elseif (0 === strpos($childPath, $chunk)) {
continue;
}
unset($children[$i]);
}
$it->next();
}
if (null !== $foundAtIndex) {
$it->seek($foundAtIndex);
}
return $target;
} | php | private function matchChild(FormInterface $form, PropertyPathIteratorInterface $it)
{
$target = null;
$chunk = '';
$foundAtIndex = null;
// Construct mapping rules for the given form
$rules = [];
foreach ($form->getConfig()->getOption('error_mapping') as $propertyPath => $targetPath) {
// Dot rules are considered at the very end
if ('.' !== $propertyPath) {
$rules[] = new MappingRule($form, $propertyPath, $targetPath);
}
}
$children = iterator_to_array(new \RecursiveIteratorIterator(new InheritDataAwareIterator($form)), false);
while ($it->valid()) {
if ($it->isIndex()) {
$chunk .= '['.$it->current().']';
} else {
$chunk .= ('' === $chunk ? '' : '.').$it->current();
}
// Test mapping rules as long as we have any
foreach ($rules as $key => $rule) {
/* @var MappingRule $rule */
// Mapping rule matches completely, terminate.
if (null !== ($form = $rule->match($chunk))) {
return $form;
}
// Keep only rules that have $chunk as prefix
if (!$rule->isPrefix($chunk)) {
unset($rules[$key]);
}
}
/** @var FormInterface $child */
foreach ($children as $i => $child) {
$childPath = (string) $child->getPropertyPath();
if ($childPath === $chunk) {
$target = $child;
$foundAtIndex = $it->key();
} elseif (0 === strpos($childPath, $chunk)) {
continue;
}
unset($children[$i]);
}
$it->next();
}
if (null !== $foundAtIndex) {
$it->seek($foundAtIndex);
}
return $target;
} | [
"private",
"function",
"matchChild",
"(",
"FormInterface",
"$",
"form",
",",
"PropertyPathIteratorInterface",
"$",
"it",
")",
"{",
"$",
"target",
"=",
"null",
";",
"$",
"chunk",
"=",
"''",
";",
"$",
"foundAtIndex",
"=",
"null",
";",
"// Construct mapping rules... | Tries to match the beginning of the property path at the
current position against the children of the scope.
If a matching child is found, it is returned. Otherwise
null is returned.
@param FormInterface $form The form to search
@param PropertyPathIteratorInterface $it The iterator at its current position
@return FormInterface|null The found match or null | [
"Tries",
"to",
"match",
"the",
"beginning",
"of",
"the",
"property",
"path",
"at",
"the",
"current",
"position",
"against",
"the",
"children",
"of",
"the",
"scope",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationMapper.php#L149-L210 | train | Match child form | [
30522,
2797,
3853,
2674,
19339,
1006,
2433,
18447,
2121,
12172,
1002,
2433,
1010,
3200,
15069,
21646,
8844,
18447,
2121,
12172,
1002,
2009,
1007,
1063,
1002,
4539,
1027,
19701,
1025,
1002,
20000,
1027,
1005,
1005,
1025,
1002,
2179,
20363,
3... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getgrav/grav | system/src/Grav/Installer/Install.php | Install.checkRequirements | public function checkRequirements(): array
{
$results = [];
$this->checkVersion($results, 'php','php', $this->requires['php'], PHP_VERSION);
$this->checkVersion($results, 'grav', 'grav', $this->requires['grav'], GRAV_VERSION);
$this->checkPlugins($results, $this->requires['plugins']);
return $results;
} | php | public function checkRequirements(): array
{
$results = [];
$this->checkVersion($results, 'php','php', $this->requires['php'], PHP_VERSION);
$this->checkVersion($results, 'grav', 'grav', $this->requires['grav'], GRAV_VERSION);
$this->checkPlugins($results, $this->requires['plugins']);
return $results;
} | [
"public",
"function",
"checkRequirements",
"(",
")",
":",
"array",
"{",
"$",
"results",
"=",
"[",
"]",
";",
"$",
"this",
"->",
"checkVersion",
"(",
"$",
"results",
",",
"'php'",
",",
"'php'",
",",
"$",
"this",
"->",
"requires",
"[",
"'php'",
"]",
","... | NOTE: This method can only be called after $grav['plugins']->init().
@return array List of failed requirements. If the list is empty, installation can go on. | [
"NOTE",
":",
"This",
"method",
"can",
"only",
"be",
"called",
"after",
"$grav",
"[",
"plugins",
"]",
"-",
">",
"init",
"()",
"."
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Installer/Install.php#L143-L152 | train | Check requirements of the module | [
30522,
2270,
3853,
4638,
2890,
15549,
28578,
11187,
1006,
1007,
1024,
9140,
1063,
1002,
3463,
1027,
1031,
1033,
1025,
1002,
2023,
1011,
1028,
4638,
27774,
1006,
1002,
3463,
1010,
1005,
25718,
1005,
1010,
1005,
25718,
1005,
1010,
1002,
2023,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php | AbstractNormalizer.setCallbacks | public function setCallbacks(array $callbacks)
{
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.2, use the "callbacks" key of the context instead.', __METHOD__), E_USER_DEPRECATED);
foreach ($callbacks as $attribute => $callback) {
if (!\is_callable($callback)) {
throw new InvalidArgumentException(sprintf('The given callback for attribute "%s" is not callable.', $attribute));
}
}
$this->defaultContext[self::CALLBACKS] = $this->callbacks = $callbacks;
return $this;
} | php | public function setCallbacks(array $callbacks)
{
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.2, use the "callbacks" key of the context instead.', __METHOD__), E_USER_DEPRECATED);
foreach ($callbacks as $attribute => $callback) {
if (!\is_callable($callback)) {
throw new InvalidArgumentException(sprintf('The given callback for attribute "%s" is not callable.', $attribute));
}
}
$this->defaultContext[self::CALLBACKS] = $this->callbacks = $callbacks;
return $this;
} | [
"public",
"function",
"setCallbacks",
"(",
"array",
"$",
"callbacks",
")",
"{",
"@",
"trigger_error",
"(",
"sprintf",
"(",
"'The \"%s()\" method is deprecated since Symfony 4.2, use the \"callbacks\" key of the context instead.'",
",",
"__METHOD__",
")",
",",
"E_USER_DEPRECATED... | Sets normalization callbacks.
@deprecated since Symfony 4.2
@param callable[] $callbacks Help normalize the result
@return self
@throws InvalidArgumentException if a non-callable callback is set | [
"Sets",
"normalization",
"callbacks",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php#L235-L247 | train | Sets the callbacks | [
30522,
2270,
3853,
2275,
9289,
20850,
8684,
2015,
1006,
9140,
1002,
2655,
12221,
1007,
1063,
1030,
9495,
1035,
7561,
1006,
9043,
2546,
1006,
1005,
1996,
1000,
1003,
1055,
1006,
1007,
1000,
4118,
2003,
2139,
28139,
12921,
2144,
25353,
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... |
matomo-org/matomo | core/SettingsServer.php | SettingsServer.getMemoryLimitValue | public static function getMemoryLimitValue()
{
if (($memory = ini_get('memory_limit')) > 0) {
// handle shorthand byte options (case-insensitive)
$shorthandByteOption = substr($memory, -1);
switch ($shorthandByteOption) {
case 'G':
case 'g':
return substr($memory, 0, -1) * 1024;
case 'M':
case 'm':
return substr($memory, 0, -1);
case 'K':
case 'k':
return substr($memory, 0, -1) / 1024;
}
return $memory / 1048576;
}
// no memory limit
return false;
} | php | public static function getMemoryLimitValue()
{
if (($memory = ini_get('memory_limit')) > 0) {
// handle shorthand byte options (case-insensitive)
$shorthandByteOption = substr($memory, -1);
switch ($shorthandByteOption) {
case 'G':
case 'g':
return substr($memory, 0, -1) * 1024;
case 'M':
case 'm':
return substr($memory, 0, -1);
case 'K':
case 'k':
return substr($memory, 0, -1) / 1024;
}
return $memory / 1048576;
}
// no memory limit
return false;
} | [
"public",
"static",
"function",
"getMemoryLimitValue",
"(",
")",
"{",
"if",
"(",
"(",
"$",
"memory",
"=",
"ini_get",
"(",
"'memory_limit'",
")",
")",
">",
"0",
")",
"{",
"// handle shorthand byte options (case-insensitive)",
"$",
"shorthandByteOption",
"=",
"subst... | Get php memory_limit (in Megabytes)
Prior to PHP 5.2.1, or on Windows, --enable-memory-limit is not a
compile-time default, so ini_get('memory_limit') may return false.
@see http://www.php.net/manual/en/faq.using.php#faq.using.shorthandbytes
@return int|bool memory limit in megabytes, or false if there is no limit | [
"Get",
"php",
"memory_limit",
"(",
"in",
"Megabytes",
")"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/SettingsServer.php#L184-L205 | train | Returns the memory limit value | [
30522,
2270,
10763,
3853,
2131,
4168,
5302,
23320,
27605,
9189,
2389,
5657,
1006,
1007,
1063,
2065,
1006,
1006,
1002,
3638,
1027,
1999,
2072,
1035,
2131,
1006,
1005,
3638,
1035,
5787,
1005,
1007,
1007,
1028,
1014,
1007,
1063,
1013,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getgrav/grav | system/src/Grav/Framework/Flex/FlexObject.php | FlexObject.update | public function update(array $data, array $files = [])
{
if ($data) {
$blueprint = $this->getBlueprint();
// Process updated data through the object filters.
$this->filterElements($data);
// Get currently stored data.
$elements = $this->getElements();
// Merge existing object to the test data to be validated.
$test = $blueprint->mergeData($elements, $data);
// Validate and filter elements and throw an error if any issues were found.
$blueprint->validate($test + ['storage_key' => $this->getStorageKey(), 'timestamp' => $this->getTimestamp()]);
$data = $blueprint->filter($data, false, true);
// Finally update the object.
foreach ($blueprint->flattenData($data) as $key => $value) {
if ($value === null) {
$this->unsetNestedProperty($key);
} else {
$this->setNestedProperty($key, $value);
}
}
// Store the changes
$this->_changes = Utils::arrayDiffMultidimensional($this->getElements(), $elements);
}
if ($files && method_exists($this, 'setUpdatedMedia')) {
$this->setUpdatedMedia($files);
}
return $this;
} | php | public function update(array $data, array $files = [])
{
if ($data) {
$blueprint = $this->getBlueprint();
// Process updated data through the object filters.
$this->filterElements($data);
// Get currently stored data.
$elements = $this->getElements();
// Merge existing object to the test data to be validated.
$test = $blueprint->mergeData($elements, $data);
// Validate and filter elements and throw an error if any issues were found.
$blueprint->validate($test + ['storage_key' => $this->getStorageKey(), 'timestamp' => $this->getTimestamp()]);
$data = $blueprint->filter($data, false, true);
// Finally update the object.
foreach ($blueprint->flattenData($data) as $key => $value) {
if ($value === null) {
$this->unsetNestedProperty($key);
} else {
$this->setNestedProperty($key, $value);
}
}
// Store the changes
$this->_changes = Utils::arrayDiffMultidimensional($this->getElements(), $elements);
}
if ($files && method_exists($this, 'setUpdatedMedia')) {
$this->setUpdatedMedia($files);
}
return $this;
} | [
"public",
"function",
"update",
"(",
"array",
"$",
"data",
",",
"array",
"$",
"files",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"$",
"data",
")",
"{",
"$",
"blueprint",
"=",
"$",
"this",
"->",
"getBlueprint",
"(",
")",
";",
"// Process updated data through ... | {@inheritdoc}
@see FlexObjectInterface::update() | [
"{"
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Framework/Flex/FlexObject.php#L478-L514 | train | Update the object with the new data | [
30522,
2270,
3853,
10651,
1006,
9140,
1002,
2951,
1010,
9140,
1002,
6764,
1027,
1031,
1033,
1007,
1063,
2065,
1006,
1002,
2951,
1007,
1063,
1002,
2630,
16550,
1027,
1002,
2023,
1011,
1028,
2131,
16558,
5657,
16550,
1006,
1007,
1025,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/Referrers/Tasks.php | Tasks.updateSearchEngines | public function updateSearchEngines()
{
$url = 'https://raw.githubusercontent.com/matomo-org/searchengine-and-social-list/master/SearchEngines.yml';
$list = Http::sendHttpRequest($url, 30);
$searchEngines = SearchEngine::getInstance()->loadYmlData($list);
if (count($searchEngines) < 200) {
return;
}
Option::set(SearchEngine::OPTION_STORAGE_NAME, base64_encode(serialize($searchEngines)));
} | php | public function updateSearchEngines()
{
$url = 'https://raw.githubusercontent.com/matomo-org/searchengine-and-social-list/master/SearchEngines.yml';
$list = Http::sendHttpRequest($url, 30);
$searchEngines = SearchEngine::getInstance()->loadYmlData($list);
if (count($searchEngines) < 200) {
return;
}
Option::set(SearchEngine::OPTION_STORAGE_NAME, base64_encode(serialize($searchEngines)));
} | [
"public",
"function",
"updateSearchEngines",
"(",
")",
"{",
"$",
"url",
"=",
"'https://raw.githubusercontent.com/matomo-org/searchengine-and-social-list/master/SearchEngines.yml'",
";",
"$",
"list",
"=",
"Http",
"::",
"sendHttpRequest",
"(",
"$",
"url",
",",
"30",
")",
... | Update the search engine definitions
@see https://github.com/matomo-org/searchengine-and-social-list | [
"Update",
"the",
"search",
"engine",
"definitions"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Referrers/Tasks.php#L31-L40 | train | Update search engine options | [
30522,
2270,
3853,
14409,
14644,
21043,
10586,
1006,
1007,
1063,
1002,
24471,
2140,
1027,
1005,
16770,
1024,
1013,
1013,
6315,
1012,
21025,
2705,
12083,
20330,
8663,
6528,
2102,
1012,
4012,
1013,
13523,
19506,
1011,
8917,
1013,
3945,
13159,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.setAggregate | protected function setAggregate($function, $columns)
{
$this->aggregate = compact('function', 'columns');
if (empty($this->groups)) {
$this->orders = null;
$this->bindings['order'] = [];
}
return $this;
} | php | protected function setAggregate($function, $columns)
{
$this->aggregate = compact('function', 'columns');
if (empty($this->groups)) {
$this->orders = null;
$this->bindings['order'] = [];
}
return $this;
} | [
"protected",
"function",
"setAggregate",
"(",
"$",
"function",
",",
"$",
"columns",
")",
"{",
"$",
"this",
"->",
"aggregate",
"=",
"compact",
"(",
"'function'",
",",
"'columns'",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"groups",
")",
")",... | Set the aggregate property without running the query.
@param string $function
@param array $columns
@return $this | [
"Set",
"the",
"aggregate",
"property",
"without",
"running",
"the",
"query",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Query/Builder.php#L2568-L2579 | train | Set aggregate function and columns | [
30522,
5123,
3853,
2275,
8490,
17603,
5867,
1006,
1002,
3853,
1010,
1002,
7753,
1007,
1063,
1002,
2023,
1011,
1028,
9572,
1027,
9233,
1006,
1005,
3853,
1005,
1010,
1005,
7753,
1005,
1007,
1025,
2065,
1006,
4064,
1006,
1002,
2023,
1011,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/system/console/OctoberInstall.php | OctoberInstall.handle | public function handle()
{
$this->displayIntro();
if (
App::hasDatabase() &&
!$this->confirm('Application appears to be installed already. Continue anyway?', false)
) {
return;
}
$this->setupDatabaseConfig();
$this->setupAdminUser();
$this->setupCommonValues();
if ($this->confirm('Configure advanced options?', false)) {
$this->setupEncryptionKey();
$this->setupAdvancedValues();
$this->askToInstallPlugins();
}
else {
$this->setupEncryptionKey(true);
}
$this->setupMigrateDatabase();
$this->displayOutro();
} | php | public function handle()
{
$this->displayIntro();
if (
App::hasDatabase() &&
!$this->confirm('Application appears to be installed already. Continue anyway?', false)
) {
return;
}
$this->setupDatabaseConfig();
$this->setupAdminUser();
$this->setupCommonValues();
if ($this->confirm('Configure advanced options?', false)) {
$this->setupEncryptionKey();
$this->setupAdvancedValues();
$this->askToInstallPlugins();
}
else {
$this->setupEncryptionKey(true);
}
$this->setupMigrateDatabase();
$this->displayOutro();
} | [
"public",
"function",
"handle",
"(",
")",
"{",
"$",
"this",
"->",
"displayIntro",
"(",
")",
";",
"if",
"(",
"App",
"::",
"hasDatabase",
"(",
")",
"&&",
"!",
"$",
"this",
"->",
"confirm",
"(",
"'Application appears to be installed already. Continue anyway?'",
"... | Execute the console command. | [
"Execute",
"the",
"console",
"command",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/console/OctoberInstall.php#L59-L85 | train | Handle the install process | [
30522,
2270,
3853,
5047,
1006,
1007,
1063,
1002,
2023,
1011,
1028,
4653,
18447,
3217,
1006,
1007,
1025,
2065,
1006,
10439,
1024,
1024,
2038,
2850,
2696,
15058,
1006,
1007,
1004,
1004,
999,
1002,
2023,
1011,
1028,
12210,
1006,
1005,
4646,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/DependencyInjection/Argument/ServiceLocator.php | ServiceLocator.get | public function get($id)
{
return isset($this->serviceMap[$id]) ? ($this->factory)(...$this->serviceMap[$id]) : parent::get($id);
} | php | public function get($id)
{
return isset($this->serviceMap[$id]) ? ($this->factory)(...$this->serviceMap[$id]) : parent::get($id);
} | [
"public",
"function",
"get",
"(",
"$",
"id",
")",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"serviceMap",
"[",
"$",
"id",
"]",
")",
"?",
"(",
"$",
"this",
"->",
"factory",
")",
"(",
"...",
"$",
"this",
"->",
"serviceMap",
"[",
"$",
"id",
... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DependencyInjection/Argument/ServiceLocator.php#L38-L41 | train | Get a service by ID | [
30522,
2270,
3853,
2131,
1006,
1002,
8909,
1007,
1063,
2709,
26354,
3388,
1006,
1002,
2023,
1011,
1028,
2326,
2863,
2361,
1031,
1002,
8909,
1033,
1007,
1029,
1006,
1002,
2023,
1011,
1028,
4713,
1007,
1006,
1012,
1012,
1012,
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... |
octobercms/october | modules/backend/widgets/Filter.php | Filter.optionsFromAjax | protected function optionsFromAjax($options)
{
$processed = [];
if (!is_array($options)) {
return $processed;
}
foreach ($options as $option) {
$id = array_get($option, 'id');
if ($id === null) {
continue;
}
$processed[$id] = array_get($option, 'name');
}
return $processed;
} | php | protected function optionsFromAjax($options)
{
$processed = [];
if (!is_array($options)) {
return $processed;
}
foreach ($options as $option) {
$id = array_get($option, 'id');
if ($id === null) {
continue;
}
$processed[$id] = array_get($option, 'name');
}
return $processed;
} | [
"protected",
"function",
"optionsFromAjax",
"(",
"$",
"options",
")",
"{",
"$",
"processed",
"=",
"[",
"]",
";",
"if",
"(",
"!",
"is_array",
"(",
"$",
"options",
")",
")",
"{",
"return",
"$",
"processed",
";",
"}",
"foreach",
"(",
"$",
"options",
"as... | Convert a named array to a key/pair array
@param array $options
@return array | [
"Convert",
"a",
"named",
"array",
"to",
"a",
"key",
"/",
"pair",
"array"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/Filter.php#L947-L962 | train | Returns an array of options from ajax | [
30522,
5123,
3853,
7047,
19699,
9626,
3900,
2595,
1006,
1002,
7047,
1007,
1063,
1002,
13995,
1027,
1031,
1033,
1025,
2065,
1006,
999,
2003,
1035,
9140,
1006,
1002,
7047,
1007,
1007,
1063,
2709,
1002,
13995,
1025,
1065,
18921,
6776,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
php-ai/php-ml | src/Math/LinearAlgebra/EigenvalueDecomposition.php | EigenvalueDecomposition.tql2 | private function tql2(): void
{
for ($i = 1; $i < $this->n; ++$i) {
$this->e[$i - 1] = $this->e[$i];
}
$this->e[$this->n - 1] = 0.0;
$f = 0.0;
$tst1 = 0.0;
$eps = 2.0 ** -52.0;
for ($l = 0; $l < $this->n; ++$l) {
// Find small subdiagonal element
$tst1 = max($tst1, abs($this->d[$l]) + abs($this->e[$l]));
$m = $l;
while ($m < $this->n) {
if (abs($this->e[$m]) <= $eps * $tst1) {
break;
}
++$m;
}
// If m == l, $this->d[l] is an eigenvalue,
// otherwise, iterate.
if ($m > $l) {
do {
// Compute implicit shift
$g = $this->d[$l];
$p = ($this->d[$l + 1] - $g) / (2.0 * $this->e[$l]);
$r = hypot($p, 1.0);
if ($p < 0) {
$r *= -1;
}
$this->d[$l] = $this->e[$l] / ($p + $r);
$this->d[$l + 1] = $this->e[$l] * ($p + $r);
$dl1 = $this->d[$l + 1];
$h = $g - $this->d[$l];
for ($i = $l + 2; $i < $this->n; ++$i) {
$this->d[$i] -= $h;
}
$f += $h;
// Implicit QL transformation.
$p = $this->d[$m];
$c = 1.0;
$c2 = $c3 = $c;
$el1 = $this->e[$l + 1];
$s = $s2 = 0.0;
for ($i = $m - 1; $i >= $l; --$i) {
$c3 = $c2;
$c2 = $c;
$s2 = $s;
$g = $c * $this->e[$i];
$h = $c * $p;
$r = hypot($p, $this->e[$i]);
$this->e[$i + 1] = $s * $r;
$s = $this->e[$i] / $r;
$c = $p / $r;
$p = $c * $this->d[$i] - $s * $g;
$this->d[$i + 1] = $h + $s * ($c * $g + $s * $this->d[$i]);
// Accumulate transformation.
for ($k = 0; $k < $this->n; ++$k) {
$h = $this->V[$k][$i + 1];
$this->V[$k][$i + 1] = $s * $this->V[$k][$i] + $c * $h;
$this->V[$k][$i] = $c * $this->V[$k][$i] - $s * $h;
}
}
$p = -$s * $s2 * $c3 * $el1 * $this->e[$l] / $dl1;
$this->e[$l] = $s * $p;
$this->d[$l] = $c * $p;
// Check for convergence.
} while (abs($this->e[$l]) > $eps * $tst1);
}
$this->d[$l] += $f;
$this->e[$l] = 0.0;
}
// Sort eigenvalues and corresponding vectors.
for ($i = 0; $i < $this->n - 1; ++$i) {
$k = $i;
$p = $this->d[$i];
for ($j = $i + 1; $j < $this->n; ++$j) {
if ($this->d[$j] < $p) {
$k = $j;
$p = $this->d[$j];
}
}
if ($k != $i) {
$this->d[$k] = $this->d[$i];
$this->d[$i] = $p;
for ($j = 0; $j < $this->n; ++$j) {
$p = $this->V[$j][$i];
$this->V[$j][$i] = $this->V[$j][$k];
$this->V[$j][$k] = $p;
}
}
}
} | php | private function tql2(): void
{
for ($i = 1; $i < $this->n; ++$i) {
$this->e[$i - 1] = $this->e[$i];
}
$this->e[$this->n - 1] = 0.0;
$f = 0.0;
$tst1 = 0.0;
$eps = 2.0 ** -52.0;
for ($l = 0; $l < $this->n; ++$l) {
// Find small subdiagonal element
$tst1 = max($tst1, abs($this->d[$l]) + abs($this->e[$l]));
$m = $l;
while ($m < $this->n) {
if (abs($this->e[$m]) <= $eps * $tst1) {
break;
}
++$m;
}
// If m == l, $this->d[l] is an eigenvalue,
// otherwise, iterate.
if ($m > $l) {
do {
// Compute implicit shift
$g = $this->d[$l];
$p = ($this->d[$l + 1] - $g) / (2.0 * $this->e[$l]);
$r = hypot($p, 1.0);
if ($p < 0) {
$r *= -1;
}
$this->d[$l] = $this->e[$l] / ($p + $r);
$this->d[$l + 1] = $this->e[$l] * ($p + $r);
$dl1 = $this->d[$l + 1];
$h = $g - $this->d[$l];
for ($i = $l + 2; $i < $this->n; ++$i) {
$this->d[$i] -= $h;
}
$f += $h;
// Implicit QL transformation.
$p = $this->d[$m];
$c = 1.0;
$c2 = $c3 = $c;
$el1 = $this->e[$l + 1];
$s = $s2 = 0.0;
for ($i = $m - 1; $i >= $l; --$i) {
$c3 = $c2;
$c2 = $c;
$s2 = $s;
$g = $c * $this->e[$i];
$h = $c * $p;
$r = hypot($p, $this->e[$i]);
$this->e[$i + 1] = $s * $r;
$s = $this->e[$i] / $r;
$c = $p / $r;
$p = $c * $this->d[$i] - $s * $g;
$this->d[$i + 1] = $h + $s * ($c * $g + $s * $this->d[$i]);
// Accumulate transformation.
for ($k = 0; $k < $this->n; ++$k) {
$h = $this->V[$k][$i + 1];
$this->V[$k][$i + 1] = $s * $this->V[$k][$i] + $c * $h;
$this->V[$k][$i] = $c * $this->V[$k][$i] - $s * $h;
}
}
$p = -$s * $s2 * $c3 * $el1 * $this->e[$l] / $dl1;
$this->e[$l] = $s * $p;
$this->d[$l] = $c * $p;
// Check for convergence.
} while (abs($this->e[$l]) > $eps * $tst1);
}
$this->d[$l] += $f;
$this->e[$l] = 0.0;
}
// Sort eigenvalues and corresponding vectors.
for ($i = 0; $i < $this->n - 1; ++$i) {
$k = $i;
$p = $this->d[$i];
for ($j = $i + 1; $j < $this->n; ++$j) {
if ($this->d[$j] < $p) {
$k = $j;
$p = $this->d[$j];
}
}
if ($k != $i) {
$this->d[$k] = $this->d[$i];
$this->d[$i] = $p;
for ($j = 0; $j < $this->n; ++$j) {
$p = $this->V[$j][$i];
$this->V[$j][$i] = $this->V[$j][$k];
$this->V[$j][$k] = $p;
}
}
}
} | [
"private",
"function",
"tql2",
"(",
")",
":",
"void",
"{",
"for",
"(",
"$",
"i",
"=",
"1",
";",
"$",
"i",
"<",
"$",
"this",
"->",
"n",
";",
"++",
"$",
"i",
")",
"{",
"$",
"this",
"->",
"e",
"[",
"$",
"i",
"-",
"1",
"]",
"=",
"$",
"this"... | Symmetric tridiagonal QL algorithm.
This is derived from the Algol procedures tql2, by
Bowdler, Martin, Reinsch, and Wilkinson, Handbook for
Auto. Comp., Vol.ii-Linear Algebra, and the corresponding
Fortran subroutine in EISPACK. | [
"Symmetric",
"tridiagonal",
"QL",
"algorithm",
"."
] | f6aa1a59b0525b8fca3d2786d661ab3e70904016 | https://github.com/php-ai/php-ml/blob/f6aa1a59b0525b8fca3d2786d661ab3e70904016/src/Math/LinearAlgebra/EigenvalueDecomposition.php#L315-L417 | train | TQL 2 - 2 - 2 | [
30522,
2797,
3853,
28816,
2140,
2475,
1006,
1007,
1024,
11675,
1063,
2005,
1006,
1002,
1045,
1027,
1015,
1025,
1002,
1045,
1026,
1002,
2023,
1011,
1028,
1050,
1025,
1009,
1009,
1002,
1045,
1007,
1063,
1002,
2023,
1011,
1028,
1041,
1031,
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/Mailer/Transport/Smtp/Auth/XOAuth2Authenticator.php | XOAuth2Authenticator.authenticate | public function authenticate(EsmtpTransport $client): void
{
$client->executeCommand('AUTH XOAUTH2 '.base64_encode('user='.$client->getUsername()."\1auth=Bearer ".$client->getPassword()."\1\1")."\r\n", [235]);
} | php | public function authenticate(EsmtpTransport $client): void
{
$client->executeCommand('AUTH XOAUTH2 '.base64_encode('user='.$client->getUsername()."\1auth=Bearer ".$client->getPassword()."\1\1")."\r\n", [235]);
} | [
"public",
"function",
"authenticate",
"(",
"EsmtpTransport",
"$",
"client",
")",
":",
"void",
"{",
"$",
"client",
"->",
"executeCommand",
"(",
"'AUTH XOAUTH2 '",
".",
"base64_encode",
"(",
"'user='",
".",
"$",
"client",
"->",
"getUsername",
"(",
")",
".",
"\... | {@inheritdoc}
@see https://developers.google.com/google-apps/gmail/xoauth2_protocol#the_sasl_xoauth2_mechanism | [
"{",
"@inheritdoc",
"}"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Mailer/Transport/Smtp/Auth/XOAuth2Authenticator.php#L37-L40 | train | Authenticates the user with the given username and password | [
30522,
2270,
3853,
14469,
3686,
1006,
9686,
20492,
13876,
5521,
20205,
1002,
7396,
1007,
1024,
11675,
1063,
1002,
7396,
1011,
1028,
15389,
9006,
2386,
2094,
1006,
1005,
8740,
2705,
1060,
10441,
14317,
2475,
1005,
1012,
2918,
21084,
1035,
43... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/XmlDescriptor.php | XmlDescriptor.describeContainerDefinition | protected function describeContainerDefinition(Definition $definition, array $options = [])
{
$this->writeDocument($this->getContainerDefinitionDocument($definition, isset($options['id']) ? $options['id'] : null, isset($options['omit_tags']) && $options['omit_tags'], isset($options['show_arguments']) && $options['show_arguments']));
} | php | protected function describeContainerDefinition(Definition $definition, array $options = [])
{
$this->writeDocument($this->getContainerDefinitionDocument($definition, isset($options['id']) ? $options['id'] : null, isset($options['omit_tags']) && $options['omit_tags'], isset($options['show_arguments']) && $options['show_arguments']));
} | [
"protected",
"function",
"describeContainerDefinition",
"(",
"Definition",
"$",
"definition",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"writeDocument",
"(",
"$",
"this",
"->",
"getContainerDefinitionDocument",
"(",
"$",
"definiti... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/XmlDescriptor.php#L89-L92 | train | Describes a container definition | [
30522,
5123,
3853,
6235,
8663,
18249,
2121,
3207,
16294,
22753,
1006,
6210,
1002,
6210,
1010,
9140,
1002,
7047,
1027,
1031,
1033,
1007,
1063,
1002,
2023,
1011,
1028,
4339,
3527,
24894,
4765,
1006,
1002,
2023,
1011,
1028,
2131,
8663,
18249,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/HttpKernel/DataCollector/ConfigDataCollector.php | ConfigDataCollector.determineSymfonyState | private function determineSymfonyState()
{
$now = new \DateTime();
$eom = \DateTime::createFromFormat('m/Y', Kernel::END_OF_MAINTENANCE)->modify('last day of this month');
$eol = \DateTime::createFromFormat('m/Y', Kernel::END_OF_LIFE)->modify('last day of this month');
if ($now > $eol) {
$versionState = 'eol';
} elseif ($now > $eom) {
$versionState = 'eom';
} elseif ('' !== Kernel::EXTRA_VERSION) {
$versionState = 'dev';
} else {
$versionState = 'stable';
}
return $versionState;
} | php | private function determineSymfonyState()
{
$now = new \DateTime();
$eom = \DateTime::createFromFormat('m/Y', Kernel::END_OF_MAINTENANCE)->modify('last day of this month');
$eol = \DateTime::createFromFormat('m/Y', Kernel::END_OF_LIFE)->modify('last day of this month');
if ($now > $eol) {
$versionState = 'eol';
} elseif ($now > $eom) {
$versionState = 'eom';
} elseif ('' !== Kernel::EXTRA_VERSION) {
$versionState = 'dev';
} else {
$versionState = 'stable';
}
return $versionState;
} | [
"private",
"function",
"determineSymfonyState",
"(",
")",
"{",
"$",
"now",
"=",
"new",
"\\",
"DateTime",
"(",
")",
";",
"$",
"eom",
"=",
"\\",
"DateTime",
"::",
"createFromFormat",
"(",
"'m/Y'",
",",
"Kernel",
"::",
"END_OF_MAINTENANCE",
")",
"->",
"modify... | Tries to retrieve information about the current Symfony version.
@return string One of: dev, stable, eom, eol | [
"Tries",
"to",
"retrieve",
"information",
"about",
"the",
"current",
"Symfony",
"version",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/DataCollector/ConfigDataCollector.php#L330-L347 | train | Determine the Symfony version state | [
30522,
2797,
3853,
16463,
24335,
14876,
4890,
9153,
2618,
1006,
1007,
1063,
1002,
2085,
1027,
2047,
1032,
3058,
7292,
1006,
1007,
1025,
1002,
1041,
5358,
1027,
1032,
3058,
7292,
1024,
1024,
3443,
19699,
5358,
14192,
4017,
1006,
1005,
1049,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.