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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
matomo-org/matomo | core/View.php | View.addForm | public function addForm(QuickForm2 $form)
{
// assign array with form data
$this->assign('form_data', $form->getFormData());
$this->assign('element_list', $form->getElementList());
} | php | public function addForm(QuickForm2 $form)
{
// assign array with form data
$this->assign('form_data', $form->getFormData());
$this->assign('element_list', $form->getElementList());
} | [
"public",
"function",
"addForm",
"(",
"QuickForm2",
"$",
"form",
")",
"{",
"// assign array with form data",
"$",
"this",
"->",
"assign",
"(",
"'form_data'",
",",
"$",
"form",
"->",
"getFormData",
"(",
")",
")",
";",
"$",
"this",
"->",
"assign",
"(",
"'ele... | Add form to view
@param QuickForm2 $form
@ignore | [
"Add",
"form",
"to",
"view"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/View.php#L396-L402 | train | assigns form data and element list to the current context | [
30522,
2270,
3853,
5587,
14192,
1006,
4248,
14192,
2475,
1002,
2433,
1007,
1063,
1013,
1013,
23911,
9140,
2007,
2433,
2951,
1002,
2023,
1011,
1028,
23911,
1006,
1005,
2433,
1035,
2951,
1005,
1010,
1002,
2433,
1011,
1028,
2131,
14192,
2850,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/Segment/SegmentExpression.php | SegmentExpression.parseSubExpressions | public function parseSubExpressions()
{
$parsedSubExpressions = array();
foreach ($this->tree as $leaf) {
$operand = $leaf[self::INDEX_OPERAND];
$operand = urldecode($operand);
$operator = $leaf[self::INDEX_BOOL_OPERATOR];
$pattern = '/^(.+?)(' . self::MATCH_EQUAL . '|'
. self::MATCH_NOT_EQUAL . '|'
. self::MATCH_GREATER_OR_EQUAL . '|'
. self::MATCH_GREATER . '|'
. self::MATCH_LESS_OR_EQUAL . '|'
. self::MATCH_LESS . '|'
. self::MATCH_CONTAINS . '|'
. self::MATCH_DOES_NOT_CONTAIN . '|'
. preg_quote(self::MATCH_STARTS_WITH) . '|'
. preg_quote(self::MATCH_ENDS_WITH)
. '){1}(.*)/';
$match = preg_match($pattern, $operand, $matches);
if ($match == 0) {
throw new Exception('The segment condition \'' . $operand . '\' is not valid.');
}
$leftMember = $matches[1];
$operation = $matches[2];
$valueRightMember = urldecode($matches[3]);
// is null / is not null
if ($valueRightMember === '') {
if ($operation == self::MATCH_NOT_EQUAL) {
$operation = self::MATCH_IS_NOT_NULL_NOR_EMPTY;
} elseif ($operation == self::MATCH_EQUAL) {
$operation = self::MATCH_IS_NULL_OR_EMPTY;
} else {
throw new Exception('The segment \'' . $operand . '\' has no value specified. You can leave this value empty ' .
'only when you use the operators: ' . self::MATCH_NOT_EQUAL . ' (is not) or ' . self::MATCH_EQUAL . ' (is)');
}
}
$parsedSubExpressions[] = array(
self::INDEX_BOOL_OPERATOR => $operator,
self::INDEX_OPERAND => array(
self::INDEX_OPERAND_NAME => $leftMember,
self::INDEX_OPERAND_OPERATOR => $operation,
self::INDEX_OPERAND_VALUE => $valueRightMember,
));
}
$this->parsedSubExpressions = $parsedSubExpressions;
return $parsedSubExpressions;
} | php | public function parseSubExpressions()
{
$parsedSubExpressions = array();
foreach ($this->tree as $leaf) {
$operand = $leaf[self::INDEX_OPERAND];
$operand = urldecode($operand);
$operator = $leaf[self::INDEX_BOOL_OPERATOR];
$pattern = '/^(.+?)(' . self::MATCH_EQUAL . '|'
. self::MATCH_NOT_EQUAL . '|'
. self::MATCH_GREATER_OR_EQUAL . '|'
. self::MATCH_GREATER . '|'
. self::MATCH_LESS_OR_EQUAL . '|'
. self::MATCH_LESS . '|'
. self::MATCH_CONTAINS . '|'
. self::MATCH_DOES_NOT_CONTAIN . '|'
. preg_quote(self::MATCH_STARTS_WITH) . '|'
. preg_quote(self::MATCH_ENDS_WITH)
. '){1}(.*)/';
$match = preg_match($pattern, $operand, $matches);
if ($match == 0) {
throw new Exception('The segment condition \'' . $operand . '\' is not valid.');
}
$leftMember = $matches[1];
$operation = $matches[2];
$valueRightMember = urldecode($matches[3]);
// is null / is not null
if ($valueRightMember === '') {
if ($operation == self::MATCH_NOT_EQUAL) {
$operation = self::MATCH_IS_NOT_NULL_NOR_EMPTY;
} elseif ($operation == self::MATCH_EQUAL) {
$operation = self::MATCH_IS_NULL_OR_EMPTY;
} else {
throw new Exception('The segment \'' . $operand . '\' has no value specified. You can leave this value empty ' .
'only when you use the operators: ' . self::MATCH_NOT_EQUAL . ' (is not) or ' . self::MATCH_EQUAL . ' (is)');
}
}
$parsedSubExpressions[] = array(
self::INDEX_BOOL_OPERATOR => $operator,
self::INDEX_OPERAND => array(
self::INDEX_OPERAND_NAME => $leftMember,
self::INDEX_OPERAND_OPERATOR => $operation,
self::INDEX_OPERAND_VALUE => $valueRightMember,
));
}
$this->parsedSubExpressions = $parsedSubExpressions;
return $parsedSubExpressions;
} | [
"public",
"function",
"parseSubExpressions",
"(",
")",
"{",
"$",
"parsedSubExpressions",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"tree",
"as",
"$",
"leaf",
")",
"{",
"$",
"operand",
"=",
"$",
"leaf",
"[",
"self",
"::",
"INDEX_OP... | Given the array of parsed filters containing, for each filter,
the boolean operator (AND/OR) and the operand,
Will return the array where the filters are in SQL representation
@throws Exception
@return array | [
"Given",
"the",
"array",
"of",
"parsed",
"filters",
"containing",
"for",
"each",
"filter",
"the",
"boolean",
"operator",
"(",
"AND",
"/",
"OR",
")",
"and",
"the",
"operand",
"Will",
"return",
"the",
"array",
"where",
"the",
"filters",
"are",
"in",
"SQL",
... | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Segment/SegmentExpression.php#L85-L136 | train | Parse the sub - expressions of the tree | [
30522,
2270,
3853,
11968,
8583,
12083,
10288,
20110,
8496,
1006,
1007,
1063,
1002,
11968,
6924,
6342,
4783,
2595,
20110,
8496,
1027,
9140,
1006,
1007,
1025,
18921,
6776,
1006,
1002,
2023,
1011,
1028,
3392,
2004,
1002,
7053,
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... |
matomo-org/matomo | libs/Zend/Db/Table/Abstract.php | Zend_Db_Table_Abstract._cascadeUpdate | public function _cascadeUpdate($parentTableClassname, array $oldPrimaryKey, array $newPrimaryKey)
{
$this->_setupMetadata();
$rowsAffected = 0;
foreach ($this->_getReferenceMapNormalized() as $map) {
if ($map[self::REF_TABLE_CLASS] == $parentTableClassname && isset($map[self::ON_UPDATE])) {
switch ($map[self::ON_UPDATE]) {
case self::CASCADE:
$newRefs = array();
$where = array();
for ($i = 0; $i < count($map[self::COLUMNS]); ++$i) {
$col = $this->_db->foldCase($map[self::COLUMNS][$i]);
$refCol = $this->_db->foldCase($map[self::REF_COLUMNS][$i]);
if (array_key_exists($refCol, $newPrimaryKey)) {
$newRefs[$col] = $newPrimaryKey[$refCol];
}
$type = $this->_metadata[$col]['DATA_TYPE'];
$where[] = $this->_db->quoteInto(
$this->_db->quoteIdentifier($col, true) . ' = ?',
$oldPrimaryKey[$refCol], $type);
}
$rowsAffected += $this->update($newRefs, $where);
break;
default:
// no action
break;
}
}
}
return $rowsAffected;
} | php | public function _cascadeUpdate($parentTableClassname, array $oldPrimaryKey, array $newPrimaryKey)
{
$this->_setupMetadata();
$rowsAffected = 0;
foreach ($this->_getReferenceMapNormalized() as $map) {
if ($map[self::REF_TABLE_CLASS] == $parentTableClassname && isset($map[self::ON_UPDATE])) {
switch ($map[self::ON_UPDATE]) {
case self::CASCADE:
$newRefs = array();
$where = array();
for ($i = 0; $i < count($map[self::COLUMNS]); ++$i) {
$col = $this->_db->foldCase($map[self::COLUMNS][$i]);
$refCol = $this->_db->foldCase($map[self::REF_COLUMNS][$i]);
if (array_key_exists($refCol, $newPrimaryKey)) {
$newRefs[$col] = $newPrimaryKey[$refCol];
}
$type = $this->_metadata[$col]['DATA_TYPE'];
$where[] = $this->_db->quoteInto(
$this->_db->quoteIdentifier($col, true) . ' = ?',
$oldPrimaryKey[$refCol], $type);
}
$rowsAffected += $this->update($newRefs, $where);
break;
default:
// no action
break;
}
}
}
return $rowsAffected;
} | [
"public",
"function",
"_cascadeUpdate",
"(",
"$",
"parentTableClassname",
",",
"array",
"$",
"oldPrimaryKey",
",",
"array",
"$",
"newPrimaryKey",
")",
"{",
"$",
"this",
"->",
"_setupMetadata",
"(",
")",
";",
"$",
"rowsAffected",
"=",
"0",
";",
"foreach",
"("... | Called by a row object for the parent table's class during save() method.
@param string $parentTableClassname
@param array $oldPrimaryKey
@param array $newPrimaryKey
@return int | [
"Called",
"by",
"a",
"row",
"object",
"for",
"the",
"parent",
"table",
"s",
"class",
"during",
"save",
"()",
"method",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Table/Abstract.php#L1143-L1173 | train | Causes all foreign keys of the parent table to be updated | [
30522,
2270,
3853,
1035,
16690,
6279,
13701,
1006,
1002,
6687,
10880,
26266,
18442,
1010,
9140,
1002,
2214,
18098,
9581,
2854,
14839,
1010,
9140,
1002,
2047,
18098,
9581,
2854,
14839,
1007,
1063,
1002,
2023,
1011,
1028,
1035,
16437,
11368,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Capsule/Manager.php | Manager.addConnection | public function addConnection(array $config, $name = 'default')
{
$connections = $this->container['config']['database.connections'];
$connections[$name] = $config;
$this->container['config']['database.connections'] = $connections;
} | php | public function addConnection(array $config, $name = 'default')
{
$connections = $this->container['config']['database.connections'];
$connections[$name] = $config;
$this->container['config']['database.connections'] = $connections;
} | [
"public",
"function",
"addConnection",
"(",
"array",
"$",
"config",
",",
"$",
"name",
"=",
"'default'",
")",
"{",
"$",
"connections",
"=",
"$",
"this",
"->",
"container",
"[",
"'config'",
"]",
"[",
"'database.connections'",
"]",
";",
"$",
"connections",
"[... | Register a connection with the manager.
@param array $config
@param string $name
@return void | [
"Register",
"a",
"connection",
"with",
"the",
"manager",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Capsule/Manager.php#L118-L125 | train | Add a new database connection to the container | [
30522,
2270,
3853,
5587,
8663,
2638,
7542,
1006,
9140,
1002,
9530,
8873,
2290,
1010,
1002,
2171,
1027,
1005,
12398,
1005,
1007,
1063,
1002,
7264,
1027,
1002,
2023,
1011,
1028,
11661,
1031,
1005,
9530,
8873,
2290,
1005,
1033,
1031,
1005,
7... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Console/Command.php | Command.secret | public function secret($question, $fallback = true)
{
$question = new Question($question);
$question->setHidden(true)->setHiddenFallback($fallback);
return $this->output->askQuestion($question);
} | php | public function secret($question, $fallback = true)
{
$question = new Question($question);
$question->setHidden(true)->setHiddenFallback($fallback);
return $this->output->askQuestion($question);
} | [
"public",
"function",
"secret",
"(",
"$",
"question",
",",
"$",
"fallback",
"=",
"true",
")",
"{",
"$",
"question",
"=",
"new",
"Question",
"(",
"$",
"question",
")",
";",
"$",
"question",
"->",
"setHidden",
"(",
"true",
")",
"->",
"setHiddenFallback",
... | Prompt the user for input but hide the answer from the console.
@param string $question
@param bool $fallback
@return mixed | [
"Prompt",
"the",
"user",
"for",
"input",
"but",
"hide",
"the",
"answer",
"from",
"the",
"console",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Console/Command.php#L384-L391 | train | Ask a secret question | [
30522,
2270,
3853,
3595,
1006,
1002,
3160,
1010,
1002,
2991,
5963,
1027,
2995,
1007,
1063,
1002,
3160,
1027,
2047,
3160,
1006,
1002,
3160,
1007,
1025,
1002,
3160,
1011,
1028,
6662,
3593,
4181,
1006,
2995,
1007,
1011,
1028,
6662,
3593,
418... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
php-ai/php-ml | src/Classification/Linear/LogisticRegression.php | LogisticRegression.predictProbability | protected function predictProbability(array $sample, $label): float
{
$sample = $this->checkNormalizedSample($sample);
$probability = $this->output($sample);
if (array_search($label, $this->labels, true) > 0) {
return $probability;
}
return 1 - $probability;
} | php | protected function predictProbability(array $sample, $label): float
{
$sample = $this->checkNormalizedSample($sample);
$probability = $this->output($sample);
if (array_search($label, $this->labels, true) > 0) {
return $probability;
}
return 1 - $probability;
} | [
"protected",
"function",
"predictProbability",
"(",
"array",
"$",
"sample",
",",
"$",
"label",
")",
":",
"float",
"{",
"$",
"sample",
"=",
"$",
"this",
"->",
"checkNormalizedSample",
"(",
"$",
"sample",
")",
";",
"$",
"probability",
"=",
"$",
"this",
"->... | Returns the probability of the sample of belonging to the given label.
The probability is simply taken as the distance of the sample
to the decision plane.
@param mixed $label | [
"Returns",
"the",
"probability",
"of",
"the",
"sample",
"of",
"belonging",
"to",
"the",
"given",
"label",
"."
] | f6aa1a59b0525b8fca3d2786d661ab3e70904016 | https://github.com/php-ai/php-ml/blob/f6aa1a59b0525b8fca3d2786d661ab3e70904016/src/Classification/Linear/LogisticRegression.php#L272-L282 | train | Predict probability for a given sample and label | [
30522,
5123,
3853,
16014,
21572,
3676,
8553,
1006,
9140,
1002,
7099,
1010,
1002,
3830,
1007,
1024,
14257,
1063,
1002,
7099,
1027,
1002,
2023,
1011,
1028,
4638,
12131,
9067,
3550,
21559,
10814,
1006,
1002,
7099,
1007,
1025,
1002,
9723,
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... |
symfony/symfony | src/Symfony/Component/Config/Definition/Builder/NormalizationBuilder.php | NormalizationBuilder.remap | public function remap($key, $plural = null)
{
$this->remappings[] = [$key, null === $plural ? $key.'s' : $plural];
return $this;
} | php | public function remap($key, $plural = null)
{
$this->remappings[] = [$key, null === $plural ? $key.'s' : $plural];
return $this;
} | [
"public",
"function",
"remap",
"(",
"$",
"key",
",",
"$",
"plural",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"remappings",
"[",
"]",
"=",
"[",
"$",
"key",
",",
"null",
"===",
"$",
"plural",
"?",
"$",
"key",
".",
"'s'",
":",
"$",
"plural",
"]",... | Registers a key to remap to its plural form.
@param string $key The key to remap
@param string $plural The plural of the key in case of irregular plural
@return $this | [
"Registers",
"a",
"key",
"to",
"remap",
"to",
"its",
"plural",
"form",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Config/Definition/Builder/NormalizationBuilder.php#L38-L43 | train | Remaps a key = > plural name pair pair | [
30522,
2270,
3853,
2128,
2863,
2361,
1006,
1002,
3145,
1010,
1002,
13994,
1027,
19701,
1007,
1063,
1002,
30524,
1025,
2709,
1002,
2023,
1025,
1065,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.whereNotInRaw | protected function whereNotInRaw(Builder $query, $where)
{
if (! empty($where['values'])) {
return $this->wrap($where['column']).' not in ('.implode(', ', $where['values']).')';
}
return '1 = 1';
} | php | protected function whereNotInRaw(Builder $query, $where)
{
if (! empty($where['values'])) {
return $this->wrap($where['column']).' not in ('.implode(', ', $where['values']).')';
}
return '1 = 1';
} | [
"protected",
"function",
"whereNotInRaw",
"(",
"Builder",
"$",
"query",
",",
"$",
"where",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"where",
"[",
"'values'",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"wrap",
"(",
"$",
"where",
"[",
"'col... | Compile a "where not in raw" clause.
For safety, whereIntegerInRaw ensures this method is only used with integer values.
@param \Illuminate\Database\Query\Builder $query
@param array $where
@return string | [
"Compile",
"a",
"where",
"not",
"in",
"raw",
"clause",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Query/Grammars/Grammar.php#L291-L298 | train | Protected whereNotInRaw method | [
30522,
5123,
3853,
2073,
17048,
2378,
2527,
2860,
1006,
12508,
1002,
23032,
1010,
1002,
2073,
1007,
1063,
2065,
1006,
999,
4064,
1006,
1002,
2073,
1031,
1005,
5300,
1005,
1033,
1007,
1007,
1063,
2709,
1002,
2023,
1011,
1028,
10236,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Redis/RedisManager.php | RedisManager.resolveCluster | protected function resolveCluster($name)
{
$clusterOptions = $this->config['clusters']['options'] ?? [];
return $this->connector()->connectToCluster(
$this->config['clusters'][$name], $clusterOptions, $this->config['options'] ?? []
);
} | php | protected function resolveCluster($name)
{
$clusterOptions = $this->config['clusters']['options'] ?? [];
return $this->connector()->connectToCluster(
$this->config['clusters'][$name], $clusterOptions, $this->config['options'] ?? []
);
} | [
"protected",
"function",
"resolveCluster",
"(",
"$",
"name",
")",
"{",
"$",
"clusterOptions",
"=",
"$",
"this",
"->",
"config",
"[",
"'clusters'",
"]",
"[",
"'options'",
"]",
"??",
"[",
"]",
";",
"return",
"$",
"this",
"->",
"connector",
"(",
")",
"->"... | Resolve the given cluster connection by name.
@param string $name
@return \Illuminate\Redis\Connections\Connection | [
"Resolve",
"the",
"given",
"cluster",
"connection",
"by",
"name",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Redis/RedisManager.php#L114-L121 | train | Connect to cluster and return the cluster object | [
30522,
5123,
3853,
10663,
20464,
19966,
2121,
1006,
1002,
2171,
1007,
1063,
1002,
9324,
7361,
9285,
1027,
1002,
2023,
1011,
1028,
9530,
8873,
2290,
1031,
1005,
12906,
1005,
1033,
1031,
1005,
7047,
1005,
1033,
1029,
1029,
1031,
1033,
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/Security/Core/User/ChainUserProvider.php | ChainUserProvider.loadUserByUsername | public function loadUserByUsername($username)
{
foreach ($this->providers as $provider) {
try {
return $provider->loadUserByUsername($username);
} catch (UsernameNotFoundException $e) {
// try next one
}
}
$ex = new UsernameNotFoundException(sprintf('There is no user with name "%s".', $username));
$ex->setUsername($username);
throw $ex;
} | php | public function loadUserByUsername($username)
{
foreach ($this->providers as $provider) {
try {
return $provider->loadUserByUsername($username);
} catch (UsernameNotFoundException $e) {
// try next one
}
}
$ex = new UsernameNotFoundException(sprintf('There is no user with name "%s".', $username));
$ex->setUsername($username);
throw $ex;
} | [
"public",
"function",
"loadUserByUsername",
"(",
"$",
"username",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"providers",
"as",
"$",
"provider",
")",
"{",
"try",
"{",
"return",
"$",
"provider",
"->",
"loadUserByUsername",
"(",
"$",
"username",
")",
";",
... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Security/Core/User/ChainUserProvider.php#L52-L65 | train | Load user by username | [
30522,
2270,
3853,
7170,
20330,
3762,
20330,
18442,
1006,
1002,
5310,
18442,
1007,
1063,
18921,
6776,
1006,
1002,
2023,
1011,
1028,
11670,
2004,
1002,
10802,
1007,
1063,
3046,
1063,
2709,
1002,
10802,
1011,
1028,
7170,
20330,
3762,
20330,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getgrav/grav | system/src/Grav/Framework/Filesystem/Filesystem.php | Filesystem.pathinfoInternal | protected function pathinfoInternal(?string $scheme, string $path, int $options = null)
{
$info = $options ? \pathinfo($path, $options) : \pathinfo($path);
if (null !== $scheme) {
$info['scheme'] = $scheme;
$dirname = isset($info['dirname']) && $info['dirname'] !== '.' ? $info['dirname'] : null;
if (null !== $dirname) {
$info['dirname'] = $scheme . '://' . $dirname;
} else {
$info = ['dirname' => $scheme . '://'] + $info;
}
}
return $info;
} | php | protected function pathinfoInternal(?string $scheme, string $path, int $options = null)
{
$info = $options ? \pathinfo($path, $options) : \pathinfo($path);
if (null !== $scheme) {
$info['scheme'] = $scheme;
$dirname = isset($info['dirname']) && $info['dirname'] !== '.' ? $info['dirname'] : null;
if (null !== $dirname) {
$info['dirname'] = $scheme . '://' . $dirname;
} else {
$info = ['dirname' => $scheme . '://'] + $info;
}
}
return $info;
} | [
"protected",
"function",
"pathinfoInternal",
"(",
"?",
"string",
"$",
"scheme",
",",
"string",
"$",
"path",
",",
"int",
"$",
"options",
"=",
"null",
")",
"{",
"$",
"info",
"=",
"$",
"options",
"?",
"\\",
"pathinfo",
"(",
"$",
"path",
",",
"$",
"optio... | @param string|null $scheme
@param string $path
@param int|null $options
@return array | [
"@param",
"string|null",
"$scheme",
"@param",
"string",
"$path",
"@param",
"int|null",
"$options"
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Framework/Filesystem/Filesystem.php#L189-L205 | train | Internal path info | [
30522,
5123,
3853,
4130,
2378,
14876,
18447,
11795,
2389,
1006,
1029,
5164,
1002,
5679,
1010,
5164,
1002,
4130,
1010,
20014,
1002,
7047,
1027,
19701,
1007,
1063,
1002,
18558,
1027,
1002,
7047,
1029,
1032,
4130,
2378,
14876,
1006,
1002,
4130... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Validator/Constraints/CurrencyValidator.php | CurrencyValidator.validate | public function validate($value, Constraint $constraint)
{
if (!$constraint instanceof Currency) {
throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Currency');
}
if (null === $value || '' === $value) {
return;
}
if (!is_scalar($value) && !(\is_object($value) && method_exists($value, '__toString'))) {
throw new UnexpectedValueException($value, 'string');
}
if (!class_exists(Currencies::class)) {
throw new LogicException('The "symfony/intl" component is required to use the Currency constraint.');
}
$value = (string) $value;
if (!Currencies::exists($value)) {
$this->context->buildViolation($constraint->message)
->setParameter('{{ value }}', $this->formatValue($value))
->setCode(Currency::NO_SUCH_CURRENCY_ERROR)
->addViolation();
}
} | php | public function validate($value, Constraint $constraint)
{
if (!$constraint instanceof Currency) {
throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Currency');
}
if (null === $value || '' === $value) {
return;
}
if (!is_scalar($value) && !(\is_object($value) && method_exists($value, '__toString'))) {
throw new UnexpectedValueException($value, 'string');
}
if (!class_exists(Currencies::class)) {
throw new LogicException('The "symfony/intl" component is required to use the Currency constraint.');
}
$value = (string) $value;
if (!Currencies::exists($value)) {
$this->context->buildViolation($constraint->message)
->setParameter('{{ value }}', $this->formatValue($value))
->setCode(Currency::NO_SUCH_CURRENCY_ERROR)
->addViolation();
}
} | [
"public",
"function",
"validate",
"(",
"$",
"value",
",",
"Constraint",
"$",
"constraint",
")",
"{",
"if",
"(",
"!",
"$",
"constraint",
"instanceof",
"Currency",
")",
"{",
"throw",
"new",
"UnexpectedTypeException",
"(",
"$",
"constraint",
",",
"__NAMESPACE__",... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Validator/Constraints/CurrencyValidator.php#L32-L58 | train | Checks if the value is a valid currency | [
30522,
2270,
3853,
9398,
3686,
1006,
1002,
3643,
1010,
27142,
1002,
27142,
1007,
1063,
2065,
1006,
999,
1002,
27142,
6013,
11253,
9598,
1007,
1063,
5466,
2047,
9223,
13874,
10288,
24422,
1006,
1002,
27142,
1010,
1035,
1035,
3415,
15327,
103... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/ProxyDumper.php | ProxyDumper.getProxyFactoryCode | public function getProxyFactoryCode(Definition $definition, $id, $factoryCode = null)
{
$instantiation = 'return';
if ($definition->isShared()) {
$instantiation .= sprintf(' $this->%s[%s] =', $definition->isPublic() && !$definition->isPrivate() ? 'services' : 'privates', var_export($id, true));
}
if (null === $factoryCode) {
throw new \InvalidArgumentException(sprintf('Missing factory code to construct the service "%s".', $id));
}
$proxyClass = $this->getProxyClassName($definition);
return <<<EOF
if (\$lazyLoad) {
$instantiation \$this->createProxy('$proxyClass', function () {
return \\$proxyClass::staticProxyConstructor(function (&\$wrappedInstance, \ProxyManager\Proxy\LazyLoadingInterface \$proxy) {
\$wrappedInstance = $factoryCode;
\$proxy->setProxyInitializer(null);
return true;
});
});
}
EOF;
} | php | public function getProxyFactoryCode(Definition $definition, $id, $factoryCode = null)
{
$instantiation = 'return';
if ($definition->isShared()) {
$instantiation .= sprintf(' $this->%s[%s] =', $definition->isPublic() && !$definition->isPrivate() ? 'services' : 'privates', var_export($id, true));
}
if (null === $factoryCode) {
throw new \InvalidArgumentException(sprintf('Missing factory code to construct the service "%s".', $id));
}
$proxyClass = $this->getProxyClassName($definition);
return <<<EOF
if (\$lazyLoad) {
$instantiation \$this->createProxy('$proxyClass', function () {
return \\$proxyClass::staticProxyConstructor(function (&\$wrappedInstance, \ProxyManager\Proxy\LazyLoadingInterface \$proxy) {
\$wrappedInstance = $factoryCode;
\$proxy->setProxyInitializer(null);
return true;
});
});
}
EOF;
} | [
"public",
"function",
"getProxyFactoryCode",
"(",
"Definition",
"$",
"definition",
",",
"$",
"id",
",",
"$",
"factoryCode",
"=",
"null",
")",
"{",
"$",
"instantiation",
"=",
"'return'",
";",
"if",
"(",
"$",
"definition",
"->",
"isShared",
"(",
")",
")",
... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/ProxyDumper.php#L51-L80 | train | Returns the code for creating a proxy instance. | [
30522,
2270,
3853,
2131,
21572,
18037,
21450,
16044,
1006,
6210,
1002,
6210,
1010,
1002,
8909,
1010,
1002,
4713,
16044,
1027,
19701,
1007,
1063,
1002,
7107,
18963,
1027,
1005,
2709,
1005,
1025,
2065,
1006,
1002,
6210,
1011,
1028,
26354,
816... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Upgrader.php | Upgrader.minPHPVersion | public function minPHPVersion()
{
if (null === $this->min_php) {
$this->min_php = $this->remote->getMinPHPVersion();
}
return $this->min_php;
} | php | public function minPHPVersion()
{
if (null === $this->min_php) {
$this->min_php = $this->remote->getMinPHPVersion();
}
return $this->min_php;
} | [
"public",
"function",
"minPHPVersion",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"min_php",
")",
"{",
"$",
"this",
"->",
"min_php",
"=",
"$",
"this",
"->",
"remote",
"->",
"getMinPHPVersion",
"(",
")",
";",
"}",
"return",
"$",
"this... | Get minimum PHP version from remote
@return null | [
"Get",
"minimum",
"PHP",
"version",
"from",
"remote"
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/GPM/Upgrader.php#L114-L120 | train | Get the minimum PHP version of the current version of the remote server. | [
30522,
2270,
3853,
8117,
8458,
2361,
27774,
1006,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
1027,
1002,
2023,
1011,
1028,
8117,
1035,
25718,
1007,
1063,
1002,
2023,
30524,
25718,
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 | libs/Zend/Cache/Backend/File.php | Zend_Cache_Backend_File._recursiveMkdirAndChmod | protected function _recursiveMkdirAndChmod($id)
{
if ($this->_options['hashed_directory_level'] <=0) {
return true;
}
$partsArray = $this->_path($id, true);
foreach ($partsArray as $part) {
if (!is_dir($part)) {
@mkdir($part, $this->_options['hashed_directory_umask']);
@chmod($part, $this->_options['hashed_directory_umask']); // see #ZF-320 (this line is required in some configurations)
}
}
return true;
} | php | protected function _recursiveMkdirAndChmod($id)
{
if ($this->_options['hashed_directory_level'] <=0) {
return true;
}
$partsArray = $this->_path($id, true);
foreach ($partsArray as $part) {
if (!is_dir($part)) {
@mkdir($part, $this->_options['hashed_directory_umask']);
@chmod($part, $this->_options['hashed_directory_umask']); // see #ZF-320 (this line is required in some configurations)
}
}
return true;
} | [
"protected",
"function",
"_recursiveMkdirAndChmod",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_options",
"[",
"'hashed_directory_level'",
"]",
"<=",
"0",
")",
"{",
"return",
"true",
";",
"}",
"$",
"partsArray",
"=",
"$",
"this",
"->",
"_pa... | Make the directory strucuture for the given id
@param string $id cache id
@return boolean true | [
"Make",
"the",
"directory",
"strucuture",
"for",
"the",
"given",
"id"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Cache/Backend/File.php#L914-L927 | train | recursive mkdir and chmod | [
30522,
5123,
3853,
1035,
28667,
9236,
3512,
2213,
2243,
4305,
13033,
2818,
5302,
2094,
1006,
1002,
8909,
1007,
1063,
2065,
1006,
1002,
2023,
1011,
1028,
1035,
7047,
1031,
1005,
23325,
2098,
1035,
14176,
1035,
2504,
1005,
1033,
1026,
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... |
symfony/symfony | src/Symfony/Component/HttpKernel/Controller/ArgumentResolver.php | ArgumentResolver.getArguments | public function getArguments(Request $request, $controller)
{
$arguments = [];
foreach ($this->argumentMetadataFactory->createArgumentMetadata($controller) as $metadata) {
foreach ($this->argumentValueResolvers as $resolver) {
if (!$resolver->supports($request, $metadata)) {
continue;
}
$resolved = $resolver->resolve($request, $metadata);
if (!$resolved instanceof \Generator) {
throw new \InvalidArgumentException(sprintf('%s::resolve() must yield at least one value.', \get_class($resolver)));
}
foreach ($resolved as $append) {
$arguments[] = $append;
}
// continue to the next controller argument
continue 2;
}
$representative = $controller;
if (\is_array($representative)) {
$representative = sprintf('%s::%s()', \get_class($representative[0]), $representative[1]);
} elseif (\is_object($representative)) {
$representative = \get_class($representative);
}
throw new \RuntimeException(sprintf('Controller "%s" requires that you provide a value for the "$%s" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one.', $representative, $metadata->getName()));
}
return $arguments;
} | php | public function getArguments(Request $request, $controller)
{
$arguments = [];
foreach ($this->argumentMetadataFactory->createArgumentMetadata($controller) as $metadata) {
foreach ($this->argumentValueResolvers as $resolver) {
if (!$resolver->supports($request, $metadata)) {
continue;
}
$resolved = $resolver->resolve($request, $metadata);
if (!$resolved instanceof \Generator) {
throw new \InvalidArgumentException(sprintf('%s::resolve() must yield at least one value.', \get_class($resolver)));
}
foreach ($resolved as $append) {
$arguments[] = $append;
}
// continue to the next controller argument
continue 2;
}
$representative = $controller;
if (\is_array($representative)) {
$representative = sprintf('%s::%s()', \get_class($representative[0]), $representative[1]);
} elseif (\is_object($representative)) {
$representative = \get_class($representative);
}
throw new \RuntimeException(sprintf('Controller "%s" requires that you provide a value for the "$%s" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one.', $representative, $metadata->getName()));
}
return $arguments;
} | [
"public",
"function",
"getArguments",
"(",
"Request",
"$",
"request",
",",
"$",
"controller",
")",
"{",
"$",
"arguments",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"argumentMetadataFactory",
"->",
"createArgumentMetadata",
"(",
"$",
"controller",
... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver.php#L46-L82 | train | Returns the list of arguments for the controller | [
30522,
2270,
3853,
2131,
2906,
30524,
9918,
1027,
1031,
1033,
1025,
18921,
6776,
1006,
1002,
2023,
1011,
1028,
6685,
11368,
8447,
2696,
21450,
1011,
1028,
3443,
2906,
22850,
4765,
11368,
8447,
2696,
1006,
1002,
11486,
1007,
2004,
1002,
2742... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
overtrue/wechat | src/Payment/Redpack/Client.php | Client.info | public function info($mchBillno)
{
$params = is_array($mchBillno) ? $mchBillno : ['mch_billno' => $mchBillno];
$base = [
'appid' => $this->app['config']->app_id,
'bill_type' => 'MCHT',
];
return $this->safeRequest('mmpaymkttransfers/gethbinfo', array_merge($base, $params));
} | php | public function info($mchBillno)
{
$params = is_array($mchBillno) ? $mchBillno : ['mch_billno' => $mchBillno];
$base = [
'appid' => $this->app['config']->app_id,
'bill_type' => 'MCHT',
];
return $this->safeRequest('mmpaymkttransfers/gethbinfo', array_merge($base, $params));
} | [
"public",
"function",
"info",
"(",
"$",
"mchBillno",
")",
"{",
"$",
"params",
"=",
"is_array",
"(",
"$",
"mchBillno",
")",
"?",
"$",
"mchBillno",
":",
"[",
"'mch_billno'",
"=>",
"$",
"mchBillno",
"]",
";",
"$",
"base",
"=",
"[",
"'appid'",
"=>",
"$",... | Query redpack.
@param mixed $params
@return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string
@throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException | [
"Query",
"redpack",
"."
] | 120c72faaa93c270365bc75c73c362d5fd583209 | https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/Payment/Redpack/Client.php#L33-L42 | train | Get info about MCHT billno | [
30522,
2270,
3853,
18558,
1006,
1002,
11338,
2232,
24457,
3630,
1007,
1063,
1002,
11498,
5244,
1027,
2003,
1035,
9140,
1006,
1002,
11338,
2232,
24457,
3630,
1007,
1029,
1002,
11338,
2232,
24457,
3630,
1024,
1031,
1005,
11338,
2232,
1035,
30... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Validator/Constraints/IsNullValidator.php | IsNullValidator.validate | public function validate($value, Constraint $constraint)
{
if (!$constraint instanceof IsNull) {
throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\IsNull');
}
if (null !== $value) {
$this->context->buildViolation($constraint->message)
->setParameter('{{ value }}', $this->formatValue($value))
->setCode(IsNull::NOT_NULL_ERROR)
->addViolation();
}
} | php | public function validate($value, Constraint $constraint)
{
if (!$constraint instanceof IsNull) {
throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\IsNull');
}
if (null !== $value) {
$this->context->buildViolation($constraint->message)
->setParameter('{{ value }}', $this->formatValue($value))
->setCode(IsNull::NOT_NULL_ERROR)
->addViolation();
}
} | [
"public",
"function",
"validate",
"(",
"$",
"value",
",",
"Constraint",
"$",
"constraint",
")",
"{",
"if",
"(",
"!",
"$",
"constraint",
"instanceof",
"IsNull",
")",
"{",
"throw",
"new",
"UnexpectedTypeException",
"(",
"$",
"constraint",
",",
"__NAMESPACE__",
... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Validator/Constraints/IsNullValidator.php#L26-L38 | train | Checks if the value is null | [
30522,
2270,
3853,
9398,
3686,
1006,
1002,
3643,
1010,
27142,
1002,
27142,
1007,
1063,
2065,
1006,
999,
1002,
27142,
6013,
11253,
3475,
18083,
1007,
1063,
5466,
2047,
9223,
13874,
10288,
24422,
1006,
1002,
27142,
1010,
1035,
1035,
3415,
153... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/Piwik.php | Piwik.getArrayFromApiParameter | public static function getArrayFromApiParameter($columns)
{
if (empty($columns)) {
return array();
}
if (is_array($columns)) {
return $columns;
}
$array = explode(',', $columns);
$array = array_unique($array);
return $array;
} | php | public static function getArrayFromApiParameter($columns)
{
if (empty($columns)) {
return array();
}
if (is_array($columns)) {
return $columns;
}
$array = explode(',', $columns);
$array = array_unique($array);
return $array;
} | [
"public",
"static",
"function",
"getArrayFromApiParameter",
"(",
"$",
"columns",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"columns",
")",
")",
"{",
"return",
"array",
"(",
")",
";",
"}",
"if",
"(",
"is_array",
"(",
"$",
"columns",
")",
")",
"{",
"retu... | Helper method used in API function to introduce array elements in API parameters.
Array elements can be passed by comma separated values, or using the notation
array[]=value1&array[]=value2 in the URL.
This function will handle both cases and return the array.
@param array|string $columns
@return array | [
"Helper",
"method",
"used",
"in",
"API",
"function",
"to",
"introduce",
"array",
"elements",
"in",
"API",
"parameters",
".",
"Array",
"elements",
"can",
"be",
"passed",
"by",
"comma",
"separated",
"values",
"or",
"using",
"the",
"notation",
"array",
"[]",
"=... | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Piwik.php#L609-L620 | train | Returns array from API parameter | [
30522,
2270,
10763,
3853,
2131,
2906,
9447,
19699,
9626,
8197,
28689,
22828,
1006,
1002,
7753,
1007,
1063,
2065,
1006,
4064,
1006,
1002,
7753,
30524,
15044,
1006,
1005,
1010,
1005,
1010,
1002,
7753,
1007,
1025,
1002,
9140,
1027,
9140,
1035,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Database/Schema/Grammars/MySqlGrammar.php | MySqlGrammar.compileDropUnique | public function compileDropUnique(Blueprint $blueprint, Fluent $command)
{
$index = $this->wrap($command->index);
return "alter table {$this->wrapTable($blueprint)} drop index {$index}";
} | php | public function compileDropUnique(Blueprint $blueprint, Fluent $command)
{
$index = $this->wrap($command->index);
return "alter table {$this->wrapTable($blueprint)} drop index {$index}";
} | [
"public",
"function",
"compileDropUnique",
"(",
"Blueprint",
"$",
"blueprint",
",",
"Fluent",
"$",
"command",
")",
"{",
"$",
"index",
"=",
"$",
"this",
"->",
"wrap",
"(",
"$",
"command",
"->",
"index",
")",
";",
"return",
"\"alter table {$this->wrapTable($blue... | Compile a drop unique key command.
@param \Illuminate\Database\Schema\Blueprint $blueprint
@param \Illuminate\Support\Fluent $command
@return string | [
"Compile",
"a",
"drop",
"unique",
"key",
"command",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Schema/Grammars/MySqlGrammar.php#L285-L290 | train | Compiles a drop unique statement into SQL. | [
30522,
2270,
3853,
9227,
18981,
19496,
4226,
1006,
2630,
16550,
1002,
2630,
16550,
1010,
19376,
1002,
3094,
1007,
1063,
1002,
5950,
1027,
1002,
2023,
1011,
1028,
10236,
1006,
1002,
3094,
1011,
1028,
5950,
1007,
1025,
2709,
1000,
11477,
2795... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/TwigBundle/Controller/ExceptionController.php | ExceptionController.findTemplate | protected function findTemplate(Request $request, $format, $code, $showException)
{
$name = $showException ? 'exception' : 'error';
if ($showException && 'html' == $format) {
$name = 'exception_full';
}
// For error pages, try to find a template for the specific HTTP status code and format
if (!$showException) {
$template = sprintf('@Twig/Exception/%s%s.%s.twig', $name, $code, $format);
if ($this->templateExists($template)) {
return $template;
}
}
// try to find a template for the given format
$template = sprintf('@Twig/Exception/%s.%s.twig', $name, $format);
if ($this->templateExists($template)) {
return $template;
}
// default to a generic HTML exception
$request->setRequestFormat('html');
return sprintf('@Twig/Exception/%s.html.twig', $showException ? 'exception_full' : $name);
} | php | protected function findTemplate(Request $request, $format, $code, $showException)
{
$name = $showException ? 'exception' : 'error';
if ($showException && 'html' == $format) {
$name = 'exception_full';
}
// For error pages, try to find a template for the specific HTTP status code and format
if (!$showException) {
$template = sprintf('@Twig/Exception/%s%s.%s.twig', $name, $code, $format);
if ($this->templateExists($template)) {
return $template;
}
}
// try to find a template for the given format
$template = sprintf('@Twig/Exception/%s.%s.twig', $name, $format);
if ($this->templateExists($template)) {
return $template;
}
// default to a generic HTML exception
$request->setRequestFormat('html');
return sprintf('@Twig/Exception/%s.html.twig', $showException ? 'exception_full' : $name);
} | [
"protected",
"function",
"findTemplate",
"(",
"Request",
"$",
"request",
",",
"$",
"format",
",",
"$",
"code",
",",
"$",
"showException",
")",
"{",
"$",
"name",
"=",
"$",
"showException",
"?",
"'exception'",
":",
"'error'",
";",
"if",
"(",
"$",
"showExce... | @param Request $request
@param string $format
@param int $code An HTTP response status code
@param bool $showException
@return string | [
"@param",
"Request",
"$request",
"@param",
"string",
"$format",
"@param",
"int",
"$code",
"An",
"HTTP",
"response",
"status",
"code",
"@param",
"bool",
"$showException"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/TwigBundle/Controller/ExceptionController.php#L98-L123 | train | Find the exception template | [
30522,
5123,
30524,
1027,
1002,
4289,
1007,
1063,
1002,
2171,
1027,
1005,
6453,
1035,
2440,
1005,
1025,
1065,
1013,
1013,
2005,
7561,
5530,
1010,
3046,
2000,
2424,
1037,
23561,
2005,
1996,
3563,
8299,
3570,
3642,
1998,
4289,
2065,
1006,
9... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/HttpClient/Response/NativeResponse.php | NativeResponse.close | private function close(): void
{
unset($this->multi->openHandles[$this->id], $this->multi->handlesActivity[$this->id]);
$this->handle = $this->buffer = $this->inflate = $this->onProgress = null;
} | php | private function close(): void
{
unset($this->multi->openHandles[$this->id], $this->multi->handlesActivity[$this->id]);
$this->handle = $this->buffer = $this->inflate = $this->onProgress = null;
} | [
"private",
"function",
"close",
"(",
")",
":",
"void",
"{",
"unset",
"(",
"$",
"this",
"->",
"multi",
"->",
"openHandles",
"[",
"$",
"this",
"->",
"id",
"]",
",",
"$",
"this",
"->",
"multi",
"->",
"handlesActivity",
"[",
"$",
"this",
"->",
"id",
"]... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpClient/Response/NativeResponse.php#L167-L171 | train | Close the current thread | [
30522,
2797,
3853,
2485,
1006,
1007,
1024,
11675,
1063,
4895,
13462,
1006,
1002,
2023,
1011,
1028,
4800,
1011,
1028,
2330,
11774,
4244,
1031,
1002,
2023,
1011,
1028,
8909,
1033,
1010,
1002,
2023,
1011,
1028,
4800,
1011,
1028,
16024,
18908,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/NumberToLocalizedStringTransformer.php | NumberToLocalizedStringTransformer.getNumberFormatter | protected function getNumberFormatter()
{
$formatter = new \NumberFormatter($this->locale ?? \Locale::getDefault(), \NumberFormatter::DECIMAL);
if (null !== $this->scale) {
$formatter->setAttribute(\NumberFormatter::FRACTION_DIGITS, $this->scale);
$formatter->setAttribute(\NumberFormatter::ROUNDING_MODE, $this->roundingMode);
}
$formatter->setAttribute(\NumberFormatter::GROUPING_USED, $this->grouping);
return $formatter;
} | php | protected function getNumberFormatter()
{
$formatter = new \NumberFormatter($this->locale ?? \Locale::getDefault(), \NumberFormatter::DECIMAL);
if (null !== $this->scale) {
$formatter->setAttribute(\NumberFormatter::FRACTION_DIGITS, $this->scale);
$formatter->setAttribute(\NumberFormatter::ROUNDING_MODE, $this->roundingMode);
}
$formatter->setAttribute(\NumberFormatter::GROUPING_USED, $this->grouping);
return $formatter;
} | [
"protected",
"function",
"getNumberFormatter",
"(",
")",
"{",
"$",
"formatter",
"=",
"new",
"\\",
"NumberFormatter",
"(",
"$",
"this",
"->",
"locale",
"??",
"\\",
"Locale",
"::",
"getDefault",
"(",
")",
",",
"\\",
"NumberFormatter",
"::",
"DECIMAL",
")",
"... | Returns a preconfigured \NumberFormatter instance.
@return \NumberFormatter | [
"Returns",
"a",
"preconfigured",
"\\",
"NumberFormatter",
"instance",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Extension/Core/DataTransformer/NumberToLocalizedStringTransformer.php#L217-L229 | train | Get NumberFormatter instance | [
30522,
5123,
3853,
2131,
19172,
5677,
14192,
20097,
1006,
1007,
1063,
1002,
4289,
3334,
1027,
2047,
1032,
2193,
14192,
20097,
1006,
1002,
30524,
1006,
1007,
1010,
1032,
2193,
14192,
20097,
1024,
1024,
26066,
1007,
1025,
2065,
1006,
19701,
9... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/cms/twig/PutTokenParser.php | PutTokenParser.parse | public function parse(Twig_Token $token)
{
$lineno = $token->getLine();
$stream = $this->parser->getStream();
$name = $stream->expect(Twig_Token::NAME_TYPE)->getValue();
$stream->expect(Twig_Token::BLOCK_END_TYPE);
$body = $this->parser->subparse([$this, 'decidePutEnd'], true);
$endType = null;
if ($token = $stream->nextIf(Twig_Token::NAME_TYPE)) {
$endType = $token->getValue();
}
$stream->expect(Twig_Token::BLOCK_END_TYPE);
return new PutNode($body, $name, $endType, $lineno, $this->getTag());
} | php | public function parse(Twig_Token $token)
{
$lineno = $token->getLine();
$stream = $this->parser->getStream();
$name = $stream->expect(Twig_Token::NAME_TYPE)->getValue();
$stream->expect(Twig_Token::BLOCK_END_TYPE);
$body = $this->parser->subparse([$this, 'decidePutEnd'], true);
$endType = null;
if ($token = $stream->nextIf(Twig_Token::NAME_TYPE)) {
$endType = $token->getValue();
}
$stream->expect(Twig_Token::BLOCK_END_TYPE);
return new PutNode($body, $name, $endType, $lineno, $this->getTag());
} | [
"public",
"function",
"parse",
"(",
"Twig_Token",
"$",
"token",
")",
"{",
"$",
"lineno",
"=",
"$",
"token",
"->",
"getLine",
"(",
")",
";",
"$",
"stream",
"=",
"$",
"this",
"->",
"parser",
"->",
"getStream",
"(",
")",
";",
"$",
"name",
"=",
"$",
... | Parses a token and returns a node.
@param Twig_Token $token A Twig_Token instance
@return Twig_Node A Twig_Node instance | [
"Parses",
"a",
"token",
"and",
"returns",
"a",
"node",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/twig/PutTokenParser.php#L31-L47 | train | Parse PutEnd token | [
30522,
2270,
3853,
11968,
3366,
1006,
1056,
16279,
1035,
19204,
1002,
19204,
1007,
1063,
1002,
17517,
2080,
1027,
1002,
19204,
1011,
1028,
2131,
4179,
1006,
1007,
1025,
1002,
5460,
1027,
1002,
2023,
1011,
1028,
11968,
8043,
1011,
1028,
4152... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/HTML/QuickForm2/Renderer/Default.php | HTML_QuickForm2_Renderer_Default.setElementTemplateForGroupClass | public function setElementTemplateForGroupClass($groupClass, $elementClass, $template)
{
$this->elementTemplatesForGroupClass[strtolower($groupClass)][strtolower($elementClass)] = $template;
return $this;
} | php | public function setElementTemplateForGroupClass($groupClass, $elementClass, $template)
{
$this->elementTemplatesForGroupClass[strtolower($groupClass)][strtolower($elementClass)] = $template;
return $this;
} | [
"public",
"function",
"setElementTemplateForGroupClass",
"(",
"$",
"groupClass",
",",
"$",
"elementClass",
",",
"$",
"template",
")",
"{",
"$",
"this",
"->",
"elementTemplatesForGroupClass",
"[",
"strtolower",
"(",
"$",
"groupClass",
")",
"]",
"[",
"strtolower",
... | Sets grouped elements templates using group class
Templates set via {@link setTemplateForClass()} will not be used for
grouped form elements. When searching for a template to use, the renderer
will first consider template set for a specific group id, then the
group templates set by group class.
@param string Group class name
@param string Element class name
@param mixed Template
@return HTML_QuickForm2_Renderer_Default | [
"Sets",
"grouped",
"elements",
"templates",
"using",
"group",
"class"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/HTML/QuickForm2/Renderer/Default.php#L227-L231 | train | Set the element template for the group class | [
30522,
2270,
3853,
2275,
12260,
3672,
18532,
15725,
29278,
17058,
26266,
1006,
1002,
2177,
26266,
1010,
1002,
5783,
26266,
1010,
1002,
23561,
1007,
1063,
1002,
2023,
1011,
1028,
5783,
18532,
15725,
22747,
21759,
22107,
26266,
1031,
2358,
5339... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Security/Guard/Authenticator/AbstractFormLoginAuthenticator.php | AbstractFormLoginAuthenticator.start | public function start(Request $request, AuthenticationException $authException = null)
{
$url = $this->getLoginUrl();
return new RedirectResponse($url);
} | php | public function start(Request $request, AuthenticationException $authException = null)
{
$url = $this->getLoginUrl();
return new RedirectResponse($url);
} | [
"public",
"function",
"start",
"(",
"Request",
"$",
"request",
",",
"AuthenticationException",
"$",
"authException",
"=",
"null",
")",
"{",
"$",
"url",
"=",
"$",
"this",
"->",
"getLoginUrl",
"(",
")",
";",
"return",
"new",
"RedirectResponse",
"(",
"$",
"ur... | Override to control what happens when the user hits a secure page
but isn't logged in yet.
@return RedirectResponse | [
"Override",
"to",
"control",
"what",
"happens",
"when",
"the",
"user",
"hits",
"a",
"secure",
"page",
"but",
"isn",
"t",
"logged",
"in",
"yet",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Security/Guard/Authenticator/AbstractFormLoginAuthenticator.php#L61-L66 | train | Redirect to login page | [
30522,
2270,
3853,
2707,
1006,
5227,
1002,
5227,
1010,
27280,
10288,
24422,
1002,
8740,
10760,
2595,
24422,
1027,
19701,
1007,
1063,
1002,
24471,
2140,
1027,
1002,
2023,
1011,
1028,
2131,
21197,
2378,
3126,
2140,
1006,
1007,
1025,
2709,
204... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/View/Concerns/ManagesStacks.php | ManagesStacks.extendPush | protected function extendPush($section, $content)
{
if (! isset($this->pushes[$section])) {
$this->pushes[$section] = [];
}
if (! isset($this->pushes[$section][$this->renderCount])) {
$this->pushes[$section][$this->renderCount] = $content;
} else {
$this->pushes[$section][$this->renderCount] .= $content;
}
} | php | protected function extendPush($section, $content)
{
if (! isset($this->pushes[$section])) {
$this->pushes[$section] = [];
}
if (! isset($this->pushes[$section][$this->renderCount])) {
$this->pushes[$section][$this->renderCount] = $content;
} else {
$this->pushes[$section][$this->renderCount] .= $content;
}
} | [
"protected",
"function",
"extendPush",
"(",
"$",
"section",
",",
"$",
"content",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"pushes",
"[",
"$",
"section",
"]",
")",
")",
"{",
"$",
"this",
"->",
"pushes",
"[",
"$",
"section",
"]",
... | Append content to a given push section.
@param string $section
@param string $content
@return void | [
"Append",
"content",
"to",
"a",
"given",
"push",
"section",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/View/Concerns/ManagesStacks.php#L73-L84 | train | Extend push section | [
30522,
5123,
3853,
7949,
12207,
2232,
1006,
1002,
2930,
1010,
1002,
4180,
1007,
1063,
2065,
1006,
999,
26354,
3388,
1006,
1002,
2023,
1011,
1028,
13956,
1031,
1002,
2930,
1033,
1007,
1007,
1063,
1002,
2023,
1011,
1028,
13956,
1031,
1002,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php | Configuration.getConfigTreeBuilder | public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder('framework');
$rootNode = $treeBuilder->getRootNode();
$rootNode
->beforeNormalization()
->ifTrue(function ($v) { return !isset($v['assets']) && isset($v['templating']) && class_exists(Package::class); })
->then(function ($v) {
$v['assets'] = [];
return $v;
})
->end()
->children()
->scalarNode('secret')->end()
->scalarNode('http_method_override')
->info("Set true to enable support for the '_method' request parameter to determine the intended HTTP method on POST requests. Note: When using the HttpCache, you need to call the method in your front controller instead")
->defaultTrue()
->end()
->scalarNode('ide')->defaultNull()->end()
->booleanNode('test')->end()
->scalarNode('default_locale')->defaultValue('en')->end()
->arrayNode('trusted_hosts')
->beforeNormalization()->ifString()->then(function ($v) { return [$v]; })->end()
->prototype('scalar')->end()
->end()
->end()
;
$this->addCsrfSection($rootNode);
$this->addFormSection($rootNode);
$this->addEsiSection($rootNode);
$this->addSsiSection($rootNode);
$this->addFragmentsSection($rootNode);
$this->addProfilerSection($rootNode);
$this->addWorkflowSection($rootNode);
$this->addRouterSection($rootNode);
$this->addSessionSection($rootNode);
$this->addRequestSection($rootNode);
$this->addTemplatingSection($rootNode);
$this->addAssetsSection($rootNode);
$this->addTranslatorSection($rootNode);
$this->addValidationSection($rootNode);
$this->addAnnotationsSection($rootNode);
$this->addSerializerSection($rootNode);
$this->addPropertyAccessSection($rootNode);
$this->addPropertyInfoSection($rootNode);
$this->addCacheSection($rootNode);
$this->addPhpErrorsSection($rootNode);
$this->addWebLinkSection($rootNode);
$this->addLockSection($rootNode);
$this->addMessengerSection($rootNode);
$this->addRobotsIndexSection($rootNode);
$this->addHttpClientSection($rootNode);
$this->addMailerSection($rootNode);
return $treeBuilder;
} | php | public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder('framework');
$rootNode = $treeBuilder->getRootNode();
$rootNode
->beforeNormalization()
->ifTrue(function ($v) { return !isset($v['assets']) && isset($v['templating']) && class_exists(Package::class); })
->then(function ($v) {
$v['assets'] = [];
return $v;
})
->end()
->children()
->scalarNode('secret')->end()
->scalarNode('http_method_override')
->info("Set true to enable support for the '_method' request parameter to determine the intended HTTP method on POST requests. Note: When using the HttpCache, you need to call the method in your front controller instead")
->defaultTrue()
->end()
->scalarNode('ide')->defaultNull()->end()
->booleanNode('test')->end()
->scalarNode('default_locale')->defaultValue('en')->end()
->arrayNode('trusted_hosts')
->beforeNormalization()->ifString()->then(function ($v) { return [$v]; })->end()
->prototype('scalar')->end()
->end()
->end()
;
$this->addCsrfSection($rootNode);
$this->addFormSection($rootNode);
$this->addEsiSection($rootNode);
$this->addSsiSection($rootNode);
$this->addFragmentsSection($rootNode);
$this->addProfilerSection($rootNode);
$this->addWorkflowSection($rootNode);
$this->addRouterSection($rootNode);
$this->addSessionSection($rootNode);
$this->addRequestSection($rootNode);
$this->addTemplatingSection($rootNode);
$this->addAssetsSection($rootNode);
$this->addTranslatorSection($rootNode);
$this->addValidationSection($rootNode);
$this->addAnnotationsSection($rootNode);
$this->addSerializerSection($rootNode);
$this->addPropertyAccessSection($rootNode);
$this->addPropertyInfoSection($rootNode);
$this->addCacheSection($rootNode);
$this->addPhpErrorsSection($rootNode);
$this->addWebLinkSection($rootNode);
$this->addLockSection($rootNode);
$this->addMessengerSection($rootNode);
$this->addRobotsIndexSection($rootNode);
$this->addHttpClientSection($rootNode);
$this->addMailerSection($rootNode);
return $treeBuilder;
} | [
"public",
"function",
"getConfigTreeBuilder",
"(",
")",
"{",
"$",
"treeBuilder",
"=",
"new",
"TreeBuilder",
"(",
"'framework'",
")",
";",
"$",
"rootNode",
"=",
"$",
"treeBuilder",
"->",
"getRootNode",
"(",
")",
";",
"$",
"rootNode",
"->",
"beforeNormalization"... | Generates the configuration tree builder.
@return TreeBuilder The tree builder | [
"Generates",
"the",
"configuration",
"tree",
"builder",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php#L60-L118 | train | Returns the TreeBuilder object | [
30522,
2270,
3853,
2131,
8663,
8873,
13512,
9910,
8569,
23891,
2099,
1006,
1007,
1063,
1002,
3392,
8569,
23891,
2099,
1027,
2047,
3392,
8569,
23891,
2099,
1006,
1005,
7705,
1005,
1007,
1025,
1002,
7117,
3630,
3207,
1027,
1002,
3392,
8569,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Filter/Presenter/Text.php | Text.variables | public function variables() : array
{
return [
'placeholder' => $this->placeholder,
'icon' => $this->icon,
'type' => $this->type,
'group' => $this->filter->group,
];
} | php | public function variables() : array
{
return [
'placeholder' => $this->placeholder,
'icon' => $this->icon,
'type' => $this->type,
'group' => $this->filter->group,
];
} | [
"public",
"function",
"variables",
"(",
")",
":",
"array",
"{",
"return",
"[",
"'placeholder'",
"=>",
"$",
"this",
"->",
"placeholder",
",",
"'icon'",
"=>",
"$",
"this",
"->",
"icon",
",",
"'type'",
"=>",
"$",
"this",
"->",
"type",
",",
"'group'",
"=>"... | Get variables for field template.
@return array | [
"Get",
"variables",
"for",
"field",
"template",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid/Filter/Presenter/Text.php#L39-L47 | train | Return array of variables | [
30522,
2270,
3853,
10857,
1006,
1007,
1024,
9140,
1063,
2709,
1031,
1005,
2173,
14528,
1005,
1027,
1028,
1002,
2023,
1011,
1028,
2173,
14528,
1010,
1005,
12696,
1005,
1027,
1028,
1002,
2023,
1011,
1028,
12696,
1010,
1005,
2828,
1005,
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... |
symfony/symfony | src/Symfony/Component/Serializer/NameConverter/CamelCaseToSnakeCaseNameConverter.php | CamelCaseToSnakeCaseNameConverter.denormalize | public function denormalize($propertyName)
{
$camelCasedName = preg_replace_callback('/(^|_|\.)+(.)/', function ($match) {
return ('.' === $match[1] ? '_' : '').strtoupper($match[2]);
}, $propertyName);
if ($this->lowerCamelCase) {
$camelCasedName = lcfirst($camelCasedName);
}
if (null === $this->attributes || \in_array($camelCasedName, $this->attributes)) {
return $camelCasedName;
}
return $propertyName;
} | php | public function denormalize($propertyName)
{
$camelCasedName = preg_replace_callback('/(^|_|\.)+(.)/', function ($match) {
return ('.' === $match[1] ? '_' : '').strtoupper($match[2]);
}, $propertyName);
if ($this->lowerCamelCase) {
$camelCasedName = lcfirst($camelCasedName);
}
if (null === $this->attributes || \in_array($camelCasedName, $this->attributes)) {
return $camelCasedName;
}
return $propertyName;
} | [
"public",
"function",
"denormalize",
"(",
"$",
"propertyName",
")",
"{",
"$",
"camelCasedName",
"=",
"preg_replace_callback",
"(",
"'/(^|_|\\.)+(.)/'",
",",
"function",
"(",
"$",
"match",
")",
"{",
"return",
"(",
"'.'",
"===",
"$",
"match",
"[",
"1",
"]",
... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Serializer/NameConverter/CamelCaseToSnakeCaseNameConverter.php#L49-L64 | train | Denormalizes the property name to the correct format for the current language | [
30522,
2270,
3853,
7939,
2953,
9067,
4697,
1006,
1002,
3200,
18442,
1007,
1063,
1002,
19130,
28969,
18442,
1027,
3653,
2290,
1035,
5672,
1035,
2655,
5963,
1006,
1005,
1013,
1006,
1034,
1064,
1035,
1064,
1032,
1012,
1007,
1009,
1006,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/Plugin/Manager.php | Manager.unloadPlugin | public function unloadPlugin($plugin)
{
$this->resetTransientCache();
if (!($plugin instanceof Plugin)) {
$oPlugin = $this->loadPlugin($plugin);
if ($oPlugin === null) {
unset($this->loadedPlugins[$plugin]);
return;
}
$plugin = $oPlugin;
}
unset($this->loadedPlugins[$plugin->getPluginName()]);
} | php | public function unloadPlugin($plugin)
{
$this->resetTransientCache();
if (!($plugin instanceof Plugin)) {
$oPlugin = $this->loadPlugin($plugin);
if ($oPlugin === null) {
unset($this->loadedPlugins[$plugin]);
return;
}
$plugin = $oPlugin;
}
unset($this->loadedPlugins[$plugin->getPluginName()]);
} | [
"public",
"function",
"unloadPlugin",
"(",
"$",
"plugin",
")",
"{",
"$",
"this",
"->",
"resetTransientCache",
"(",
")",
";",
"if",
"(",
"!",
"(",
"$",
"plugin",
"instanceof",
"Plugin",
")",
")",
"{",
"$",
"oPlugin",
"=",
"$",
"this",
"->",
"loadPlugin"... | Unload plugin
@param Plugin|string $plugin
@throws \Exception | [
"Unload",
"plugin"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Plugin/Manager.php#L1207-L1222 | train | Unloads a plugin | [
30522,
2270,
3853,
4895,
11066,
24759,
15916,
2378,
1006,
1002,
13354,
2378,
1007,
1063,
1002,
2023,
1011,
1028,
25141,
6494,
3619,
11638,
3540,
5403,
1006,
1007,
1025,
2065,
1006,
999,
1006,
1002,
13354,
2378,
6013,
11253,
13354,
2378,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/Contents/Reports/Base.php | Base.configureView | public function configureView(ViewDataTable $view)
{
$view->config->datatable_js_type = 'ContentsDataTable';
$view->config->datatable_css_class = 'ContentsDataTable';
if (!empty($this->dimension)) {
$view->config->addTranslations(array('label' => $this->dimension->getName()));
}
$view->config->columns_to_display = array_merge(
array('label'),
array_keys($this->getMetrics()),
array_keys($this->getProcessedMetrics())
);
$view->requestConfig->filter_sort_column = 'nb_impressions';
if ($this->hasSubtableId()) {
$apiMethod = $view->requestConfig->getApiMethodToRequest();
$label = Dimensions::getSubtableLabelForApiMethod($apiMethod);
$view->config->addTranslation('label', Piwik::translate($label));
}
} | php | public function configureView(ViewDataTable $view)
{
$view->config->datatable_js_type = 'ContentsDataTable';
$view->config->datatable_css_class = 'ContentsDataTable';
if (!empty($this->dimension)) {
$view->config->addTranslations(array('label' => $this->dimension->getName()));
}
$view->config->columns_to_display = array_merge(
array('label'),
array_keys($this->getMetrics()),
array_keys($this->getProcessedMetrics())
);
$view->requestConfig->filter_sort_column = 'nb_impressions';
if ($this->hasSubtableId()) {
$apiMethod = $view->requestConfig->getApiMethodToRequest();
$label = Dimensions::getSubtableLabelForApiMethod($apiMethod);
$view->config->addTranslation('label', Piwik::translate($label));
}
} | [
"public",
"function",
"configureView",
"(",
"ViewDataTable",
"$",
"view",
")",
"{",
"$",
"view",
"->",
"config",
"->",
"datatable_js_type",
"=",
"'ContentsDataTable'",
";",
"$",
"view",
"->",
"config",
"->",
"datatable_css_class",
"=",
"'ContentsDataTable'",
";",
... | Here you can configure how your report should be displayed. For instance whether your report supports a search
etc. You can also change the default request config. For instance change how many rows are displayed by default.
@param ViewDataTable $view | [
"Here",
"you",
"can",
"configure",
"how",
"your",
"report",
"should",
"be",
"displayed",
".",
"For",
"instance",
"whether",
"your",
"report",
"supports",
"a",
"search",
"etc",
".",
"You",
"can",
"also",
"change",
"the",
"default",
"request",
"config",
".",
... | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Contents/Reports/Base.php#L40-L62 | train | Configure the viewDataTable | [
30522,
2270,
3853,
9530,
8873,
27390,
6777,
2666,
2860,
1006,
3193,
2850,
29336,
3085,
1002,
3193,
1007,
1063,
1002,
3193,
1011,
1028,
9530,
8873,
2290,
1011,
1028,
2951,
10880,
1035,
1046,
2015,
1035,
2828,
1027,
1005,
8417,
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 | plugins/Live/Visitor.php | Visitor.cleanVisitorDetails | public static function cleanVisitorDetails($visitorDetails)
{
if (Piwik::isUserIsAnonymous()) {
$toUnset = array(
'idvisitor',
'user_id',
'location_ip',
'config_id'
);
foreach ($toUnset as $keyName) {
if (isset($visitorDetails[$keyName])) {
unset($visitorDetails[$keyName]);
}
}
}
return $visitorDetails;
} | php | public static function cleanVisitorDetails($visitorDetails)
{
if (Piwik::isUserIsAnonymous()) {
$toUnset = array(
'idvisitor',
'user_id',
'location_ip',
'config_id'
);
foreach ($toUnset as $keyName) {
if (isset($visitorDetails[$keyName])) {
unset($visitorDetails[$keyName]);
}
}
}
return $visitorDetails;
} | [
"public",
"static",
"function",
"cleanVisitorDetails",
"(",
"$",
"visitorDetails",
")",
"{",
"if",
"(",
"Piwik",
"::",
"isUserIsAnonymous",
"(",
")",
")",
"{",
"$",
"toUnset",
"=",
"array",
"(",
"'idvisitor'",
",",
"'user_id'",
",",
"'location_ip'",
",",
"'c... | Removes fields that the user should only access if they are Super User or admin (cookie, IP,
md5 config "fingerprint" hash)
@param array $visitorDetails
@return array | [
"Removes",
"fields",
"that",
"the",
"user",
"should",
"only",
"access",
"if",
"they",
"are",
"Super",
"User",
"or",
"admin",
"(",
"cookie",
"IP",
"md5",
"config",
"fingerprint",
"hash",
")"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Live/Visitor.php#L155-L173 | train | Removes all visitor details that are not related to a user | [
30522,
2270,
10763,
3853,
4550,
11365,
15660,
3207,
22081,
1006,
1002,
10367,
3207,
22081,
1007,
1063,
2065,
1006,
14255,
9148,
2243,
1024,
1024,
2003,
20330,
29196,
16585,
27711,
1006,
1007,
1007,
1063,
1002,
2000,
4609,
13462,
1027,
9140,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformer.php | DateTimeToLocalizedStringTransformer.reverseTransform | public function reverseTransform($value)
{
if (!\is_string($value)) {
throw new TransformationFailedException('Expected a string.');
}
if ('' === $value) {
return;
}
// date-only patterns require parsing to be done in UTC, as midnight might not exist in the local timezone due
// to DST changes
$dateOnly = $this->isPatternDateOnly();
$timestamp = $this->getIntlDateFormatter($dateOnly)->parse($value);
if (0 != intl_get_error_code()) {
throw new TransformationFailedException(intl_get_error_message());
} elseif ($timestamp > 253402214400) {
// This timestamp represents UTC midnight of 9999-12-31 to prevent 5+ digit years
throw new TransformationFailedException('Years beyond 9999 are not supported.');
}
try {
if ($dateOnly) {
// we only care about year-month-date, which has been delivered as a timestamp pointing to UTC midnight
$dateTime = new \DateTime(gmdate('Y-m-d', $timestamp), new \DateTimeZone($this->outputTimezone));
} else {
// read timestamp into DateTime object - the formatter delivers a timestamp
$dateTime = new \DateTime(sprintf('@%s', $timestamp));
}
// set timezone separately, as it would be ignored if set via the constructor,
// see http://php.net/manual/en/datetime.construct.php
$dateTime->setTimezone(new \DateTimeZone($this->outputTimezone));
} catch (\Exception $e) {
throw new TransformationFailedException($e->getMessage(), $e->getCode(), $e);
}
if ($this->outputTimezone !== $this->inputTimezone) {
$dateTime->setTimezone(new \DateTimeZone($this->inputTimezone));
}
return $dateTime;
} | php | public function reverseTransform($value)
{
if (!\is_string($value)) {
throw new TransformationFailedException('Expected a string.');
}
if ('' === $value) {
return;
}
// date-only patterns require parsing to be done in UTC, as midnight might not exist in the local timezone due
// to DST changes
$dateOnly = $this->isPatternDateOnly();
$timestamp = $this->getIntlDateFormatter($dateOnly)->parse($value);
if (0 != intl_get_error_code()) {
throw new TransformationFailedException(intl_get_error_message());
} elseif ($timestamp > 253402214400) {
// This timestamp represents UTC midnight of 9999-12-31 to prevent 5+ digit years
throw new TransformationFailedException('Years beyond 9999 are not supported.');
}
try {
if ($dateOnly) {
// we only care about year-month-date, which has been delivered as a timestamp pointing to UTC midnight
$dateTime = new \DateTime(gmdate('Y-m-d', $timestamp), new \DateTimeZone($this->outputTimezone));
} else {
// read timestamp into DateTime object - the formatter delivers a timestamp
$dateTime = new \DateTime(sprintf('@%s', $timestamp));
}
// set timezone separately, as it would be ignored if set via the constructor,
// see http://php.net/manual/en/datetime.construct.php
$dateTime->setTimezone(new \DateTimeZone($this->outputTimezone));
} catch (\Exception $e) {
throw new TransformationFailedException($e->getMessage(), $e->getCode(), $e);
}
if ($this->outputTimezone !== $this->inputTimezone) {
$dateTime->setTimezone(new \DateTimeZone($this->inputTimezone));
}
return $dateTime;
} | [
"public",
"function",
"reverseTransform",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"\\",
"is_string",
"(",
"$",
"value",
")",
")",
"{",
"throw",
"new",
"TransformationFailedException",
"(",
"'Expected a string.'",
")",
";",
"}",
"if",
"(",
"''",
"===",... | Transforms a localized date string/array into a normalized date.
@param string|array $value Localized date string/array
@return \DateTime Normalized date
@throws TransformationFailedException if the given value is not a string,
if the date could not be parsed | [
"Transforms",
"a",
"localized",
"date",
"string",
"/",
"array",
"into",
"a",
"normalized",
"date",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformer.php#L107-L150 | train | Transforms a date string into a \ DateTime object | [
30522,
2270,
3853,
7901,
6494,
3619,
14192,
1006,
1002,
3643,
1007,
1063,
2065,
1006,
999,
1032,
2003,
1035,
5164,
1006,
1002,
3643,
1007,
1007,
1063,
5466,
2047,
8651,
7011,
18450,
10288,
24422,
1006,
1005,
3517,
1037,
30524,
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... |
php-ai/php-ml | src/Math/Statistic/Gaussian.php | Gaussian.pdf | public function pdf(float $value)
{
// Calculate the probability density by use of normal/Gaussian distribution
// Ref: https://en.wikipedia.org/wiki/Normal_distribution
$std2 = $this->std ** 2;
$mean = $this->mean;
return exp(-(($value - $mean) ** 2) / (2 * $std2)) / ((2 * $std2 * M_PI) ** .5);
} | php | public function pdf(float $value)
{
// Calculate the probability density by use of normal/Gaussian distribution
// Ref: https://en.wikipedia.org/wiki/Normal_distribution
$std2 = $this->std ** 2;
$mean = $this->mean;
return exp(-(($value - $mean) ** 2) / (2 * $std2)) / ((2 * $std2 * M_PI) ** .5);
} | [
"public",
"function",
"pdf",
"(",
"float",
"$",
"value",
")",
"{",
"// Calculate the probability density by use of normal/Gaussian distribution",
"// Ref: https://en.wikipedia.org/wiki/Normal_distribution",
"$",
"std2",
"=",
"$",
"this",
"->",
"std",
"**",
"2",
";",
"$",
... | Returns probability density of the given <i>$value</i>
@return float|int | [
"Returns",
"probability",
"density",
"of",
"the",
"given",
"<i",
">",
"$value<",
"/",
"i",
">"
] | f6aa1a59b0525b8fca3d2786d661ab3e70904016 | https://github.com/php-ai/php-ml/blob/f6aa1a59b0525b8fca3d2786d661ab3e70904016/src/Math/Statistic/Gaussian.php#L30-L38 | train | Calculate the probability density of the current criterion using the normal distribution | [
30522,
2270,
3853,
11135,
1006,
14257,
1002,
3643,
1007,
1063,
1013,
1013,
18422,
1996,
9723,
4304,
2011,
2224,
1997,
3671,
1013,
11721,
17854,
2937,
4353,
1013,
1013,
25416,
1024,
16770,
1024,
1013,
1013,
4372,
1012,
16948,
1012,
8917,
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/DomCrawler/AbstractUriElement.php | AbstractUriElement.cleanupAnchor | private function cleanupAnchor(string $uri): string
{
if (false !== $pos = strpos($uri, '#')) {
return substr($uri, 0, $pos);
}
return $uri;
} | php | private function cleanupAnchor(string $uri): string
{
if (false !== $pos = strpos($uri, '#')) {
return substr($uri, 0, $pos);
}
return $uri;
} | [
"private",
"function",
"cleanupAnchor",
"(",
"string",
"$",
"uri",
")",
":",
"string",
"{",
"if",
"(",
"false",
"!==",
"$",
"pos",
"=",
"strpos",
"(",
"$",
"uri",
",",
"'#'",
")",
")",
"{",
"return",
"substr",
"(",
"$",
"uri",
",",
"0",
",",
"$",... | Remove the anchor from the uri. | [
"Remove",
"the",
"anchor",
"from",
"the",
"uri",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DomCrawler/AbstractUriElement.php#L194-L201 | train | Remove anchor from uri | [
30522,
2797,
3853,
27686,
2319,
9905,
2099,
1006,
5164,
1002,
24471,
2072,
1007,
1024,
5164,
1063,
2065,
1006,
6270,
999,
1027,
1027,
1002,
13433,
2015,
1027,
2358,
14536,
2891,
1006,
1002,
24471,
2072,
1010,
1005,
1001,
1005,
1007,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/Actions/Archiver.php | Archiver.initActionsTables | private function initActionsTables()
{
$this->actionsTablesByType = array();
foreach (Metrics::$actionTypes as $type) {
$dataTable = new DataTable();
if ($type === Action::TYPE_SITE_SEARCH) {
$maxRows = ArchivingHelper::$maximumRowsInDataTableSiteSearch;
} else {
$maxRows = ArchivingHelper::$maximumRowsInDataTableLevelZero;
}
$dataTable->setMaximumAllowedRows($maxRows);
if ($type == Action::TYPE_PAGE_URL
|| $type == Action::TYPE_PAGE_TITLE
) {
// for page urls and page titles, performance metrics exist and have to be aggregated correctly
$dataTable->setMetadata(DataTable::COLUMN_AGGREGATION_OPS_METADATA_NAME, Metrics::$columnsAggregationOperation);
}
$this->actionsTablesByType[$type] = $dataTable;
}
} | php | private function initActionsTables()
{
$this->actionsTablesByType = array();
foreach (Metrics::$actionTypes as $type) {
$dataTable = new DataTable();
if ($type === Action::TYPE_SITE_SEARCH) {
$maxRows = ArchivingHelper::$maximumRowsInDataTableSiteSearch;
} else {
$maxRows = ArchivingHelper::$maximumRowsInDataTableLevelZero;
}
$dataTable->setMaximumAllowedRows($maxRows);
if ($type == Action::TYPE_PAGE_URL
|| $type == Action::TYPE_PAGE_TITLE
) {
// for page urls and page titles, performance metrics exist and have to be aggregated correctly
$dataTable->setMetadata(DataTable::COLUMN_AGGREGATION_OPS_METADATA_NAME, Metrics::$columnsAggregationOperation);
}
$this->actionsTablesByType[$type] = $dataTable;
}
} | [
"private",
"function",
"initActionsTables",
"(",
")",
"{",
"$",
"this",
"->",
"actionsTablesByType",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"Metrics",
"::",
"$",
"actionTypes",
"as",
"$",
"type",
")",
"{",
"$",
"dataTable",
"=",
"new",
"DataTable",
... | Initializes the DataTables created by the archiveDay function. | [
"Initializes",
"the",
"DataTables",
"created",
"by",
"the",
"archiveDay",
"function",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Actions/Archiver.php#L130-L151 | train | Initializes the actions tables | [
30522,
2797,
3853,
1999,
6590,
22014,
10880,
2015,
1006,
1007,
1063,
1002,
2023,
1011,
1028,
4506,
10880,
14478,
13874,
1027,
9140,
1006,
1007,
1025,
18921,
6776,
1006,
12046,
2015,
1024,
1024,
1002,
2895,
13874,
2015,
2004,
1002,
2828,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Http/Request.php | Request.filterFiles | protected function filterFiles($files)
{
if (! $files) {
return;
}
foreach ($files as $key => $file) {
if (is_array($file)) {
$files[$key] = $this->filterFiles($files[$key]);
}
if (empty($files[$key])) {
unset($files[$key]);
}
}
return $files;
} | php | protected function filterFiles($files)
{
if (! $files) {
return;
}
foreach ($files as $key => $file) {
if (is_array($file)) {
$files[$key] = $this->filterFiles($files[$key]);
}
if (empty($files[$key])) {
unset($files[$key]);
}
}
return $files;
} | [
"protected",
"function",
"filterFiles",
"(",
"$",
"files",
")",
"{",
"if",
"(",
"!",
"$",
"files",
")",
"{",
"return",
";",
"}",
"foreach",
"(",
"$",
"files",
"as",
"$",
"key",
"=>",
"$",
"file",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"file",... | Filter the given array of files, removing any empty values.
@param mixed $files
@return mixed | [
"Filter",
"the",
"given",
"array",
"of",
"files",
"removing",
"any",
"empty",
"values",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Http/Request.php#L455-L472 | train | Filter files array | [
30522,
5123,
3853,
11307,
8873,
4244,
1006,
1002,
6764,
1007,
1063,
2065,
1006,
999,
1002,
6764,
1007,
1063,
2709,
1025,
1065,
18921,
6776,
1006,
1002,
6764,
2004,
1002,
3145,
1027,
1028,
1002,
5371,
1007,
1063,
2065,
1006,
2003,
1035,
91... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.renderTemplate | protected function renderTemplate($template, array $variables = array())
{
if (false === strpos($template, '@') || false === strpos($template, '/')) {
$template = '@' . $this->pluginName . '/' . $template;
}
$view = new View($template);
// alternatively we could check whether the templates extends either admin.twig or dashboard.twig and based on
// that call the correct method. This will be needed once we unify Controller and ControllerAdmin see
// https://github.com/piwik/piwik/issues/6151
if ($this instanceof ControllerAdmin) {
$this->setBasicVariablesView($view);
} elseif (empty($this->site) || empty($this->idSite)) {
$this->setBasicVariablesView($view);
} else {
$this->setGeneralVariablesView($view);
}
foreach ($variables as $key => $value) {
$view->$key = $value;
}
return $view->render();
} | php | protected function renderTemplate($template, array $variables = array())
{
if (false === strpos($template, '@') || false === strpos($template, '/')) {
$template = '@' . $this->pluginName . '/' . $template;
}
$view = new View($template);
// alternatively we could check whether the templates extends either admin.twig or dashboard.twig and based on
// that call the correct method. This will be needed once we unify Controller and ControllerAdmin see
// https://github.com/piwik/piwik/issues/6151
if ($this instanceof ControllerAdmin) {
$this->setBasicVariablesView($view);
} elseif (empty($this->site) || empty($this->idSite)) {
$this->setBasicVariablesView($view);
} else {
$this->setGeneralVariablesView($view);
}
foreach ($variables as $key => $value) {
$view->$key = $value;
}
return $view->render();
} | [
"protected",
"function",
"renderTemplate",
"(",
"$",
"template",
",",
"array",
"$",
"variables",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"false",
"===",
"strpos",
"(",
"$",
"template",
",",
"'@'",
")",
"||",
"false",
"===",
"strpos",
"(",
"$",
"... | Assigns the given variables to the template and renders it.
Example:
public function myControllerAction () {
return $this->renderTemplate('index', array(
'answerToLife' => '42'
));
}
This will render the 'index.twig' file within the plugin templates folder and assign the view variable
`answerToLife` to `42`.
@param string $template The name of the template file. If only a name is given it will automatically use
the template within the plugin folder. For instance 'myTemplate' will result in
'@$pluginName/myTemplate.twig'. Alternatively you can include the full path:
'@anyOtherFolder/otherTemplate'. The trailing '.twig' is not needed.
@param array $variables For instance array('myViewVar' => 'myValue'). In template you can use {{ myViewVar }}
@return string
@since 2.5.0
@api | [
"Assigns",
"the",
"given",
"variables",
"to",
"the",
"template",
"and",
"renders",
"it",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Plugin/Controller.php#L276-L300 | train | Render a template | [
30522,
5123,
3853,
17552,
18532,
15725,
1006,
1002,
23561,
1010,
9140,
1002,
10857,
1027,
9140,
1006,
1007,
1007,
1063,
2065,
1006,
6270,
1027,
1027,
1027,
2358,
14536,
2891,
1006,
1002,
23561,
1010,
1005,
1030,
1005,
1007,
1064,
1064,
6270... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/SitesManager/API.php | API.getPatternMatchSites | public function getPatternMatchSites($pattern, $limit = false)
{
$ids = $this->getSitesIdWithAtLeastViewAccess();
if (empty($ids)) {
return array();
}
$sites = $this->getModel()->getPatternMatchSites($ids, $pattern, $limit);
foreach ($sites as &$site) {
$this->enrichSite($site);
}
$sites = Site::setSitesFromArray($sites);
return $sites;
} | php | public function getPatternMatchSites($pattern, $limit = false)
{
$ids = $this->getSitesIdWithAtLeastViewAccess();
if (empty($ids)) {
return array();
}
$sites = $this->getModel()->getPatternMatchSites($ids, $pattern, $limit);
foreach ($sites as &$site) {
$this->enrichSite($site);
}
$sites = Site::setSitesFromArray($sites);
return $sites;
} | [
"public",
"function",
"getPatternMatchSites",
"(",
"$",
"pattern",
",",
"$",
"limit",
"=",
"false",
")",
"{",
"$",
"ids",
"=",
"$",
"this",
"->",
"getSitesIdWithAtLeastViewAccess",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"ids",
")",
")",
"{",
"ret... | Find websites matching the given pattern.
Any website will be returned that matches the pattern in the name, URL or group.
To limit the number of returned sites you can either specify `filter_limit` as usual or `limit` which is
faster.
@param string $pattern
@param int|false $limit
@return array | [
"Find",
"websites",
"matching",
"the",
"given",
"pattern",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/SitesManager/API.php#L1635-L1651 | train | Get all the sites that match the given pattern | [
30522,
2270,
3853,
2131,
4502,
12079,
2078,
18900,
18069,
7616,
1006,
1002,
5418,
1010,
1002,
5787,
1027,
6270,
1007,
1063,
1002,
8909,
2015,
1027,
1002,
2023,
1011,
1028,
4152,
7616,
3593,
24415,
4017,
19738,
3367,
8584,
6305,
9623,
2015,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Support/Facades/Event.php | Event.fakeFor | public static function fakeFor(callable $callable, array $eventsToFake = [])
{
$originalDispatcher = static::getFacadeRoot();
static::fake($eventsToFake);
return tap($callable(), function () use ($originalDispatcher) {
static::swap($originalDispatcher);
Model::setEventDispatcher($originalDispatcher);
});
} | php | public static function fakeFor(callable $callable, array $eventsToFake = [])
{
$originalDispatcher = static::getFacadeRoot();
static::fake($eventsToFake);
return tap($callable(), function () use ($originalDispatcher) {
static::swap($originalDispatcher);
Model::setEventDispatcher($originalDispatcher);
});
} | [
"public",
"static",
"function",
"fakeFor",
"(",
"callable",
"$",
"callable",
",",
"array",
"$",
"eventsToFake",
"=",
"[",
"]",
")",
"{",
"$",
"originalDispatcher",
"=",
"static",
"::",
"getFacadeRoot",
"(",
")",
";",
"static",
"::",
"fake",
"(",
"$",
"ev... | Replace the bound instance with a fake during the given callable's execution.
@param callable $callable
@param array $eventsToFake
@return callable | [
"Replace",
"the",
"bound",
"instance",
"with",
"a",
"fake",
"during",
"the",
"given",
"callable",
"s",
"execution",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Support/Facades/Event.php#L45-L56 | train | Fake the given callable with the given events. | [
30522,
2270,
10763,
3853,
8275,
29278,
1006,
2655,
3085,
1002,
2655,
3085,
1010,
9140,
1002,
2824,
3406,
7011,
3489,
1027,
1031,
1033,
1007,
1063,
1002,
2434,
10521,
4502,
10649,
2121,
1027,
10763,
1024,
1024,
2131,
7011,
21869,
3217,
30524... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Form/FormConfigBuilder.php | FormConfigBuilder.setAction | public function setAction($action)
{
if ($this->locked) {
throw new BadMethodCallException('The config builder cannot be modified anymore.');
}
$this->action = (string) $action;
return $this;
} | php | public function setAction($action)
{
if ($this->locked) {
throw new BadMethodCallException('The config builder cannot be modified anymore.');
}
$this->action = (string) $action;
return $this;
} | [
"public",
"function",
"setAction",
"(",
"$",
"action",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"locked",
")",
"{",
"throw",
"new",
"BadMethodCallException",
"(",
"'The config builder cannot be modified anymore.'",
")",
";",
"}",
"$",
"this",
"->",
"action",
"=... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/FormConfigBuilder.php#L698-L707 | train | Set the action name | [
30522,
2270,
3853,
2275,
18908,
3258,
1006,
1002,
2895,
1007,
1063,
2065,
1006,
1002,
2023,
1011,
1028,
5299,
1007,
1063,
5466,
2047,
2919,
11368,
6806,
16409,
24164,
2595,
24422,
1006,
1005,
1996,
9530,
8873,
2290,
12508,
3685,
2022,
6310,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Request.php | Request.reloadAuthUsingTokenAuth | public static function reloadAuthUsingTokenAuth($request = null)
{
// if a token_auth is specified in the API request, we load the right permissions
$token_auth = Common::getRequestVar('token_auth', '', 'string', $request);
if (self::shouldReloadAuthUsingTokenAuth($request)) {
self::forceReloadAuthUsingTokenAuth($token_auth);
}
} | php | public static function reloadAuthUsingTokenAuth($request = null)
{
// if a token_auth is specified in the API request, we load the right permissions
$token_auth = Common::getRequestVar('token_auth', '', 'string', $request);
if (self::shouldReloadAuthUsingTokenAuth($request)) {
self::forceReloadAuthUsingTokenAuth($token_auth);
}
} | [
"public",
"static",
"function",
"reloadAuthUsingTokenAuth",
"(",
"$",
"request",
"=",
"null",
")",
"{",
"// if a token_auth is specified in the API request, we load the right permissions",
"$",
"token_auth",
"=",
"Common",
"::",
"getRequestVar",
"(",
"'token_auth'",
",",
"'... | If the token_auth is found in the $request parameter,
the current session will be authenticated using this token_auth.
It will overwrite the previous Auth object.
@param array $request If null, uses the default request ($_GET)
@return void
@ignore | [
"If",
"the",
"token_auth",
"is",
"found",
"in",
"the",
"$request",
"parameter",
"the",
"current",
"session",
"will",
"be",
"authenticated",
"using",
"this",
"token_auth",
".",
"It",
"will",
"overwrite",
"the",
"previous",
"Auth",
"object",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/API/Request.php#L407-L415 | train | Reloads the user s authentication using the token_auth parameter | [
30522,
2270,
10763,
3853,
2128,
11066,
4887,
19877,
2075,
18715,
8189,
14317,
1006,
1002,
5227,
1027,
19701,
1007,
1063,
1013,
1013,
2065,
1037,
19204,
1035,
8740,
2705,
2003,
9675,
1999,
1996,
17928,
5227,
1010,
2057,
7170,
1996,
2157,
665... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Object/Collection/ObjectExpressionVisitor.php | ObjectExpressionVisitor.sortByField | public static function sortByField($name, $orientation = 1, \Closure $next = null)
{
if (!$next) {
$next = function($a, $b) {
return 0;
};
}
return function ($a, $b) use ($name, $next, $orientation) {
$aValue = static::getObjectFieldValue($a, $name);
$bValue = static::getObjectFieldValue($b, $name);
if ($aValue === $bValue) {
return $next($a, $b);
}
return (($aValue > $bValue) ? 1 : -1) * $orientation;
};
} | php | public static function sortByField($name, $orientation = 1, \Closure $next = null)
{
if (!$next) {
$next = function($a, $b) {
return 0;
};
}
return function ($a, $b) use ($name, $next, $orientation) {
$aValue = static::getObjectFieldValue($a, $name);
$bValue = static::getObjectFieldValue($b, $name);
if ($aValue === $bValue) {
return $next($a, $b);
}
return (($aValue > $bValue) ? 1 : -1) * $orientation;
};
} | [
"public",
"static",
"function",
"sortByField",
"(",
"$",
"name",
",",
"$",
"orientation",
"=",
"1",
",",
"\\",
"Closure",
"$",
"next",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"next",
")",
"{",
"$",
"next",
"=",
"function",
"(",
"$",
"a",
",",... | Helper for sorting arrays of objects based on multiple fields + orientations.
@param string $name
@param int $orientation
@param \Closure $next
@return \Closure | [
"Helper",
"for",
"sorting",
"arrays",
"of",
"objects",
"based",
"on",
"multiple",
"fields",
"+",
"orientations",
"."
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Framework/Object/Collection/ObjectExpressionVisitor.php#L101-L119 | train | Sort by field | [
30522,
2270,
10763,
3853,
4066,
3762,
3790,
1006,
1002,
2171,
1010,
1002,
10296,
1027,
1015,
1010,
1032,
8503,
1002,
2279,
1027,
19701,
1007,
1063,
2065,
1006,
999,
1002,
2279,
1007,
1063,
1002,
2279,
1027,
3853,
1006,
1002,
1037,
1010,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getgrav/grav | system/src/Grav/Common/Helpers/Excerpts.php | Excerpts.parseUrl | protected static function parseUrl($url)
{
$url_parts = Utils::multibyteParseUrl($url);
if (isset($url_parts['scheme'])) {
/** @var UniformResourceLocator $locator */
$locator = Grav::instance()['locator'];
// Special handling for the streams.
if ($locator->schemeExists($url_parts['scheme'])) {
if (isset($url_parts['host'])) {
// Merge host and path into a path.
$url_parts['path'] = $url_parts['host'] . (isset($url_parts['path']) ? '/' . $url_parts['path'] : '');
unset($url_parts['host']);
}
$url_parts['stream'] = true;
}
}
return $url_parts;
} | php | protected static function parseUrl($url)
{
$url_parts = Utils::multibyteParseUrl($url);
if (isset($url_parts['scheme'])) {
/** @var UniformResourceLocator $locator */
$locator = Grav::instance()['locator'];
// Special handling for the streams.
if ($locator->schemeExists($url_parts['scheme'])) {
if (isset($url_parts['host'])) {
// Merge host and path into a path.
$url_parts['path'] = $url_parts['host'] . (isset($url_parts['path']) ? '/' . $url_parts['path'] : '');
unset($url_parts['host']);
}
$url_parts['stream'] = true;
}
}
return $url_parts;
} | [
"protected",
"static",
"function",
"parseUrl",
"(",
"$",
"url",
")",
"{",
"$",
"url_parts",
"=",
"Utils",
"::",
"multibyteParseUrl",
"(",
"$",
"url",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"url_parts",
"[",
"'scheme'",
"]",
")",
")",
"{",
"/** @var Un... | Variation of parse_url() which works also with local streams.
@param string $url
@return array|bool | [
"Variation",
"of",
"parse_url",
"()",
"which",
"works",
"also",
"with",
"local",
"streams",
"."
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Helpers/Excerpts.php#L335-L356 | train | Parse url into array | [
30522,
5123,
10763,
3853,
11968,
3366,
3126,
2140,
1006,
1002,
24471,
2140,
1007,
1063,
1002,
24471,
2140,
1035,
3033,
1027,
21183,
12146,
1024,
1024,
4800,
3762,
2618,
19362,
3366,
3126,
2140,
1006,
1002,
24471,
2140,
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... |
overtrue/wechat | src/Payment/Notify/Scanned.php | Scanned.handle | public function handle(Closure $closure)
{
$result = \call_user_func($closure, $this->getMessage(), [$this, 'fail'], [$this, 'alert']);
$attributes = [
'result_code' => is_null($this->alert) && is_null($this->fail) ? static::SUCCESS : static::FAIL,
'err_code_des' => $this->alert,
];
if (is_null($this->alert) && is_string($result)) {
$attributes += [
'appid' => $this->app['config']->app_id,
'mch_id' => $this->app['config']->mch_id,
'nonce_str' => uniqid(),
'prepay_id' => $result,
];
}
return $this->respondWith($attributes, true)->toResponse();
} | php | public function handle(Closure $closure)
{
$result = \call_user_func($closure, $this->getMessage(), [$this, 'fail'], [$this, 'alert']);
$attributes = [
'result_code' => is_null($this->alert) && is_null($this->fail) ? static::SUCCESS : static::FAIL,
'err_code_des' => $this->alert,
];
if (is_null($this->alert) && is_string($result)) {
$attributes += [
'appid' => $this->app['config']->app_id,
'mch_id' => $this->app['config']->mch_id,
'nonce_str' => uniqid(),
'prepay_id' => $result,
];
}
return $this->respondWith($attributes, true)->toResponse();
} | [
"public",
"function",
"handle",
"(",
"Closure",
"$",
"closure",
")",
"{",
"$",
"result",
"=",
"\\",
"call_user_func",
"(",
"$",
"closure",
",",
"$",
"this",
"->",
"getMessage",
"(",
")",
",",
"[",
"$",
"this",
",",
"'fail'",
"]",
",",
"[",
"$",
"th... | @param \Closure $closure
@return \Symfony\Component\HttpFoundation\Response
@throws \EasyWeChat\Kernel\Exceptions\Exception | [
"@param",
"\\",
"Closure",
"$closure"
] | 120c72faaa93c270365bc75c73c362d5fd583209 | https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/Payment/Notify/Scanned.php#L40-L59 | train | Handle the response | [
30522,
2270,
3853,
5047,
1006,
8503,
1002,
8503,
1007,
1063,
1002,
2765,
1027,
1032,
2655,
1035,
5310,
1035,
4569,
2278,
1006,
1002,
8503,
1010,
1002,
2023,
1011,
1028,
2131,
7834,
3736,
3351,
1006,
1007,
1010,
1031,
1002,
2023,
1010,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getgrav/grav | system/src/Grav/Common/Page/Medium/ImageFile.php | ImageFile.getHash | public function getHash($type = 'guess', $quality = 80, $extras = [])
{
if (null === $this->hash) {
$this->generateHash($type, $quality, $extras);
}
return $this->hash;
} | php | public function getHash($type = 'guess', $quality = 80, $extras = [])
{
if (null === $this->hash) {
$this->generateHash($type, $quality, $extras);
}
return $this->hash;
} | [
"public",
"function",
"getHash",
"(",
"$",
"type",
"=",
"'guess'",
",",
"$",
"quality",
"=",
"80",
",",
"$",
"extras",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"hash",
")",
"{",
"$",
"this",
"->",
"generateHash",
"(",... | Gets the hash.
@param string $type
@param int $quality
@param [] $extras
@return null | [
"Gets",
"the",
"hash",
"."
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Medium/ImageFile.php#L115-L122 | train | Get the hash of the current language | [
30522,
2270,
3853,
2131,
14949,
2232,
1006,
1002,
2828,
1027,
1005,
3984,
1005,
1010,
1002,
3737,
1027,
3770,
1010,
1002,
26279,
1027,
1031,
1033,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
1027,
1002,
2023,
1011,
1028,
23325,
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/Form/Button.php | Button.setParent | public function setParent(FormInterface $parent = null)
{
if ($this->submitted) {
throw new AlreadySubmittedException('You cannot set the parent of a submitted button');
}
$this->parent = $parent;
return $this;
} | php | public function setParent(FormInterface $parent = null)
{
if ($this->submitted) {
throw new AlreadySubmittedException('You cannot set the parent of a submitted button');
}
$this->parent = $parent;
return $this;
} | [
"public",
"function",
"setParent",
"(",
"FormInterface",
"$",
"parent",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"submitted",
")",
"{",
"throw",
"new",
"AlreadySubmittedException",
"(",
"'You cannot set the parent of a submitted button'",
")",
";",
"}"... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Button.php#L107-L116 | train | Set the parent of the button | [
30522,
2270,
3853,
2275,
19362,
4765,
1006,
2433,
18447,
2121,
12172,
1002,
6687,
1027,
19701,
1007,
1063,
2065,
1006,
1002,
2023,
1011,
1028,
7864,
1007,
1063,
5466,
2047,
2525,
6342,
25526,
27100,
3207,
2595,
24422,
1006,
1005,
2017,
3685... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/DataAccess/Actions.php | Actions.delete | public function delete($idActions)
{
foreach ($idActions as &$id) {
$id = (int)$id;
}
$table = Common::prefixTable('log_action');
$sql = "DELETE FROM $table WHERE idaction IN (" . implode(",", $idActions) . ")";
Db::query($sql);
} | php | public function delete($idActions)
{
foreach ($idActions as &$id) {
$id = (int)$id;
}
$table = Common::prefixTable('log_action');
$sql = "DELETE FROM $table WHERE idaction IN (" . implode(",", $idActions) . ")";
Db::query($sql);
} | [
"public",
"function",
"delete",
"(",
"$",
"idActions",
")",
"{",
"foreach",
"(",
"$",
"idActions",
"as",
"&",
"$",
"id",
")",
"{",
"$",
"id",
"=",
"(",
"int",
")",
"$",
"id",
";",
"}",
"$",
"table",
"=",
"Common",
"::",
"prefixTable",
"(",
"'log_... | Removes a list of actions from the log_action table by ID.
@param int[] $idActions | [
"Removes",
"a",
"list",
"of",
"actions",
"from",
"the",
"log_action",
"table",
"by",
"ID",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/DataAccess/Actions.php#L23-L33 | train | Delete all log_action records for the given idactions | [
30522,
2270,
3853,
3972,
12870,
1006,
1002,
16096,
22014,
1007,
1063,
18921,
6776,
1006,
1002,
16096,
22014,
2004,
1004,
1002,
8909,
1007,
1063,
1002,
8909,
1027,
1006,
20014,
1007,
1002,
8909,
1025,
1065,
1002,
2795,
1027,
2691,
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... |
symfony/symfony | src/Symfony/Component/Console/Helper/QuestionHelper.php | QuestionHelper.writePrompt | protected function writePrompt(OutputInterface $output, Question $question)
{
$message = $question->getQuestion();
if ($question instanceof ChoiceQuestion) {
$maxWidth = max(array_map([$this, 'strlen'], array_keys($question->getChoices())));
$messages = (array) $question->getQuestion();
foreach ($question->getChoices() as $key => $value) {
$width = $maxWidth - $this->strlen($key);
$messages[] = ' [<info>'.$key.str_repeat(' ', $width).'</info>] '.$value;
}
$output->writeln($messages);
$message = $question->getPrompt();
}
$output->write($message);
} | php | protected function writePrompt(OutputInterface $output, Question $question)
{
$message = $question->getQuestion();
if ($question instanceof ChoiceQuestion) {
$maxWidth = max(array_map([$this, 'strlen'], array_keys($question->getChoices())));
$messages = (array) $question->getQuestion();
foreach ($question->getChoices() as $key => $value) {
$width = $maxWidth - $this->strlen($key);
$messages[] = ' [<info>'.$key.str_repeat(' ', $width).'</info>] '.$value;
}
$output->writeln($messages);
$message = $question->getPrompt();
}
$output->write($message);
} | [
"protected",
"function",
"writePrompt",
"(",
"OutputInterface",
"$",
"output",
",",
"Question",
"$",
"question",
")",
"{",
"$",
"message",
"=",
"$",
"question",
"->",
"getQuestion",
"(",
")",
";",
"if",
"(",
"$",
"question",
"instanceof",
"ChoiceQuestion",
"... | Outputs the question prompt. | [
"Outputs",
"the",
"question",
"prompt",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Console/Helper/QuestionHelper.php#L159-L178 | train | Write the question prompt | [
30522,
5123,
3853,
4339,
21572,
27718,
1006,
6434,
18447,
2121,
12172,
1002,
6434,
1010,
3160,
1002,
3160,
1007,
1063,
1002,
4471,
1027,
1002,
3160,
1011,
1028,
2131,
15500,
3258,
1006,
1007,
1025,
2065,
1006,
1002,
3160,
6013,
11253,
3601,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
z-song/laravel-admin | src/Grid/Column.php | Column.resolveDisplayer | protected function resolveDisplayer($abstract, $arguments)
{
if (array_key_exists($abstract, static::$displayers)) {
return $this->callBuiltinDisplayer(static::$displayers[$abstract], $arguments);
}
return $this->callSupportDisplayer($abstract, $arguments);
} | php | protected function resolveDisplayer($abstract, $arguments)
{
if (array_key_exists($abstract, static::$displayers)) {
return $this->callBuiltinDisplayer(static::$displayers[$abstract], $arguments);
}
return $this->callSupportDisplayer($abstract, $arguments);
} | [
"protected",
"function",
"resolveDisplayer",
"(",
"$",
"abstract",
",",
"$",
"arguments",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"abstract",
",",
"static",
"::",
"$",
"displayers",
")",
")",
"{",
"return",
"$",
"this",
"->",
"callBuiltinDisplayer... | Find a displayer to display column.
@param string $abstract
@param array $arguments
@return Column | [
"Find",
"a",
"displayer",
"to",
"display",
"column",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid/Column.php#L609-L616 | train | Resolves the displayer for the given abstract and arguments. | [
30522,
5123,
3853,
10395,
2483,
13068,
2121,
1006,
1002,
10061,
1010,
1002,
9918,
1007,
1063,
2065,
1006,
9140,
1035,
3145,
1035,
6526,
1006,
1002,
10061,
1010,
10763,
1024,
1024,
1002,
4653,
2545,
1007,
1007,
1063,
2709,
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... |
overtrue/wechat | src/Kernel/Log/LogManager.php | LogManager.level | protected function level(array $config)
{
$level = $config['level'] ?? 'debug';
if (isset($this->levels[$level])) {
return $this->levels[$level];
}
throw new \InvalidArgumentException('Invalid log level.');
} | php | protected function level(array $config)
{
$level = $config['level'] ?? 'debug';
if (isset($this->levels[$level])) {
return $this->levels[$level];
}
throw new \InvalidArgumentException('Invalid log level.');
} | [
"protected",
"function",
"level",
"(",
"array",
"$",
"config",
")",
"{",
"$",
"level",
"=",
"$",
"config",
"[",
"'level'",
"]",
"??",
"'debug'",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"levels",
"[",
"$",
"level",
"]",
")",
")",
"{",
"re... | Parse the string level into a Monolog constant.
@param array $config
@return int
@throws \InvalidArgumentException | [
"Parse",
"the",
"string",
"level",
"into",
"a",
"Monolog",
"constant",
"."
] | 120c72faaa93c270365bc75c73c362d5fd583209 | https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/Kernel/Log/LogManager.php#L357-L366 | train | Returns the level of the log message. | [
30522,
5123,
3853,
2504,
1006,
9140,
1002,
9530,
8873,
2290,
1007,
1063,
1002,
2504,
1027,
1002,
9530,
8873,
2290,
1031,
1005,
2504,
1005,
1033,
1029,
1029,
1005,
2139,
8569,
2290,
1005,
1025,
2065,
1006,
26354,
3388,
1006,
1002,
2023,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php | ArrayNodeDefinition.canBeEnabled | public function canBeEnabled()
{
$this
->addDefaultsIfNotSet()
->treatFalseLike(['enabled' => false])
->treatTrueLike(['enabled' => true])
->treatNullLike(['enabled' => true])
->beforeNormalization()
->ifArray()
->then(function ($v) {
$v['enabled'] = isset($v['enabled']) ? $v['enabled'] : true;
return $v;
})
->end()
->children()
->booleanNode('enabled')
->defaultFalse()
;
return $this;
} | php | public function canBeEnabled()
{
$this
->addDefaultsIfNotSet()
->treatFalseLike(['enabled' => false])
->treatTrueLike(['enabled' => true])
->treatNullLike(['enabled' => true])
->beforeNormalization()
->ifArray()
->then(function ($v) {
$v['enabled'] = isset($v['enabled']) ? $v['enabled'] : true;
return $v;
})
->end()
->children()
->booleanNode('enabled')
->defaultFalse()
;
return $this;
} | [
"public",
"function",
"canBeEnabled",
"(",
")",
"{",
"$",
"this",
"->",
"addDefaultsIfNotSet",
"(",
")",
"->",
"treatFalseLike",
"(",
"[",
"'enabled'",
"=>",
"false",
"]",
")",
"->",
"treatTrueLike",
"(",
"[",
"'enabled'",
"=>",
"true",
"]",
")",
"->",
"... | Adds an "enabled" boolean to enable the current section.
By default, the section is disabled. If any configuration is specified then
the node will be automatically enabled:
enableableArrayNode: {enabled: true, ...} # The config is enabled & default values get overridden
enableableArrayNode: ~ # The config is enabled & use the default values
enableableArrayNode: true # The config is enabled & use the default values
enableableArrayNode: {other: value, ...} # The config is enabled & default values get overridden
enableableArrayNode: {enabled: false, ...} # The config is disabled
enableableArrayNode: false # The config is disabled
@return $this | [
"Adds",
"an",
"enabled",
"boolean",
"to",
"enable",
"the",
"current",
"section",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php#L274-L295 | train | Ajoute un archivo en base a un archivo en base a un archivo en base a un archivo en base a un archivo en base a un archivo en base a un archivo en base a un archivo en base a un archivo en base a un archivo en base a un archivo en base a un archivo en base a un archivo en base a un archivo en base a un archivo en base a un archivo en base | [
30522,
2270,
3853,
2064,
11306,
22966,
2094,
1006,
1007,
1063,
1002,
2023,
1011,
1028,
5587,
3207,
7011,
11314,
5332,
2546,
17048,
13462,
1006,
1007,
1011,
1028,
7438,
7011,
4877,
20806,
3489,
1006,
1031,
1005,
9124,
1005,
1027,
1028,
6270,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/Config/IniFileChain.php | IniFileChain.arrayUnmerge | public function arrayUnmerge($original, $modified)
{
// return key/value pairs for keys in $modified but not in $original
// return key/value pairs for keys in both $modified and $original, but values differ
// ignore keys that are in $original but not in $modified
if (empty($original) || !is_array($original)) {
$original = array();
}
if (empty($modified) || !is_array($modified)) {
$modified = array();
}
return array_udiff_assoc($modified, $original, array(__CLASS__, 'compareElements'));
} | php | public function arrayUnmerge($original, $modified)
{
// return key/value pairs for keys in $modified but not in $original
// return key/value pairs for keys in both $modified and $original, but values differ
// ignore keys that are in $original but not in $modified
if (empty($original) || !is_array($original)) {
$original = array();
}
if (empty($modified) || !is_array($modified)) {
$modified = array();
}
return array_udiff_assoc($modified, $original, array(__CLASS__, 'compareElements'));
} | [
"public",
"function",
"arrayUnmerge",
"(",
"$",
"original",
",",
"$",
"modified",
")",
"{",
"// return key/value pairs for keys in $modified but not in $original",
"// return key/value pairs for keys in both $modified and $original, but values differ",
"// ignore keys that are in $original... | Compare arrays and return difference, such that:
$modified = array_merge($original, $difference);
@param array $original original array
@param array $modified modified array
@return array differences between original and modified | [
"Compare",
"arrays",
"and",
"return",
"difference",
"such",
"that",
":"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Config/IniFileChain.php#L344-L359 | train | Unmerge array with array_merge | [
30522,
2270,
3853,
9140,
4609,
5017,
3351,
1006,
1002,
2434,
1010,
1002,
6310,
1007,
1063,
1013,
1013,
2709,
3145,
1013,
3643,
7689,
2005,
6309,
1999,
1002,
6310,
2021,
2025,
1999,
1002,
2434,
1013,
1013,
2709,
3145,
1013,
3643,
7689,
200... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/Zend/Db/Statement/Db2.php | Zend_Db_Statement_Db2._bindParam | public function _bindParam($parameter, &$variable, $type = null, $length = null, $options = null)
{
if ($type === null) {
$type = DB2_PARAM_IN;
}
if (isset($options['data-type'])) {
$datatype = $options['data-type'];
} else {
$datatype = DB2_CHAR;
}
if (!db2_bind_param($this->_stmt, $position, "variable", $type, $datatype)) {
/**
* @see Zend_Db_Statement_Db2_Exception
*/
// require_once 'Zend/Db/Statement/Db2/Exception.php';
throw new Zend_Db_Statement_Db2_Exception(
db2_stmt_errormsg(),
db2_stmt_error()
);
}
return true;
} | php | public function _bindParam($parameter, &$variable, $type = null, $length = null, $options = null)
{
if ($type === null) {
$type = DB2_PARAM_IN;
}
if (isset($options['data-type'])) {
$datatype = $options['data-type'];
} else {
$datatype = DB2_CHAR;
}
if (!db2_bind_param($this->_stmt, $position, "variable", $type, $datatype)) {
/**
* @see Zend_Db_Statement_Db2_Exception
*/
// require_once 'Zend/Db/Statement/Db2/Exception.php';
throw new Zend_Db_Statement_Db2_Exception(
db2_stmt_errormsg(),
db2_stmt_error()
);
}
return true;
} | [
"public",
"function",
"_bindParam",
"(",
"$",
"parameter",
",",
"&",
"$",
"variable",
",",
"$",
"type",
"=",
"null",
",",
"$",
"length",
"=",
"null",
",",
"$",
"options",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"type",
"===",
"null",
")",
"{",
"$"... | Binds a parameter to the specified variable name.
@param mixed $parameter Name the parameter, either integer or string.
@param mixed $variable Reference to PHP variable containing the value.
@param mixed $type OPTIONAL Datatype of SQL parameter.
@param mixed $length OPTIONAL Length of SQL parameter.
@param mixed $options OPTIONAL Other options.
@return bool
@throws Zend_Db_Statement_Db2_Exception | [
"Binds",
"a",
"parameter",
"to",
"the",
"specified",
"variable",
"name",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Statement/Db2.php#L87-L111 | train | Binds a parameter to a variable in the statement | [
30522,
2270,
3853,
1035,
14187,
28689,
2213,
1006,
1002,
16381,
1010,
1004,
1002,
8023,
1010,
1002,
2828,
1027,
19701,
1010,
1002,
3091,
1027,
19701,
1010,
1002,
7047,
1027,
19701,
1007,
1063,
2065,
1006,
1002,
2828,
1027,
1027,
1027,
19701... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/DataTable/Filter/ColumnCallbackAddColumnQuotient.php | ColumnCallbackAddColumnQuotient.formatValue | protected function formatValue($value, $divisor)
{
$quotient = 0;
if ($divisor > 0 && $value > 0) {
$quotient = round($value / $divisor, $this->quotientPrecision);
}
return $quotient;
} | php | protected function formatValue($value, $divisor)
{
$quotient = 0;
if ($divisor > 0 && $value > 0) {
$quotient = round($value / $divisor, $this->quotientPrecision);
}
return $quotient;
} | [
"protected",
"function",
"formatValue",
"(",
"$",
"value",
",",
"$",
"divisor",
")",
"{",
"$",
"quotient",
"=",
"0",
";",
"if",
"(",
"$",
"divisor",
">",
"0",
"&&",
"$",
"value",
">",
"0",
")",
"{",
"$",
"quotient",
"=",
"round",
"(",
"$",
"value... | Formats the given value
@param number $value
@param number $divisor
@return float|int | [
"Formats",
"the",
"given",
"value"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/DataTable/Filter/ColumnCallbackAddColumnQuotient.php#L106-L114 | train | Format value by divisor | [
30522,
5123,
3853,
4289,
10175,
5657,
1006,
1002,
3643,
1010,
1002,
4487,
11365,
2953,
1007,
1063,
1002,
22035,
9515,
3372,
1027,
1014,
1025,
2065,
1006,
1002,
4487,
11365,
2953,
1028,
1014,
1004,
1004,
1002,
3643,
1028,
1014,
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/EventDispatcher/Debug/TraceableEventDispatcher.php | TraceableEventDispatcher.getListenerPriority | public function getListenerPriority($eventName, $listener)
{
// we might have wrapped listeners for the event (if called while dispatching)
// in that case get the priority by wrapper
if (isset($this->wrappedListeners[$eventName])) {
foreach ($this->wrappedListeners[$eventName] as $index => $wrappedListener) {
if ($wrappedListener->getWrappedListener() === $listener) {
return $this->dispatcher->getListenerPriority($eventName, $wrappedListener);
}
}
}
return $this->dispatcher->getListenerPriority($eventName, $listener);
} | php | public function getListenerPriority($eventName, $listener)
{
// we might have wrapped listeners for the event (if called while dispatching)
// in that case get the priority by wrapper
if (isset($this->wrappedListeners[$eventName])) {
foreach ($this->wrappedListeners[$eventName] as $index => $wrappedListener) {
if ($wrappedListener->getWrappedListener() === $listener) {
return $this->dispatcher->getListenerPriority($eventName, $wrappedListener);
}
}
}
return $this->dispatcher->getListenerPriority($eventName, $listener);
} | [
"public",
"function",
"getListenerPriority",
"(",
"$",
"eventName",
",",
"$",
"listener",
")",
"{",
"// we might have wrapped listeners for the event (if called while dispatching)",
"// in that case get the priority by wrapper",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"wr... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcher.php#L108-L121 | train | Get the priority of an event | [
30522,
2270,
3853,
2131,
9863,
24454,
18098,
25346,
3012,
1006,
1002,
2724,
18442,
1010,
1002,
19373,
1007,
1063,
1013,
1013,
2057,
2453,
2031,
5058,
13810,
2005,
1996,
2724,
1006,
2065,
2170,
2096,
18365,
2075,
1007,
1013,
1013,
1999,
2008... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/DataUriNormalizer.php | DataUriNormalizer.normalize | public function normalize($object, $format = null, array $context = [])
{
if (!$object instanceof \SplFileInfo) {
throw new InvalidArgumentException('The object must be an instance of "\SplFileInfo".');
}
$mimeType = $this->getMimeType($object);
$splFileObject = $this->extractSplFileObject($object);
$data = '';
$splFileObject->rewind();
while (!$splFileObject->eof()) {
$data .= $splFileObject->fgets();
}
if ('text' === explode('/', $mimeType, 2)[0]) {
return sprintf('data:%s,%s', $mimeType, rawurlencode($data));
}
return sprintf('data:%s;base64,%s', $mimeType, base64_encode($data));
} | php | public function normalize($object, $format = null, array $context = [])
{
if (!$object instanceof \SplFileInfo) {
throw new InvalidArgumentException('The object must be an instance of "\SplFileInfo".');
}
$mimeType = $this->getMimeType($object);
$splFileObject = $this->extractSplFileObject($object);
$data = '';
$splFileObject->rewind();
while (!$splFileObject->eof()) {
$data .= $splFileObject->fgets();
}
if ('text' === explode('/', $mimeType, 2)[0]) {
return sprintf('data:%s,%s', $mimeType, rawurlencode($data));
}
return sprintf('data:%s;base64,%s', $mimeType, base64_encode($data));
} | [
"public",
"function",
"normalize",
"(",
"$",
"object",
",",
"$",
"format",
"=",
"null",
",",
"array",
"$",
"context",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"$",
"object",
"instanceof",
"\\",
"SplFileInfo",
")",
"{",
"throw",
"new",
"InvalidArgumentE... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Serializer/Normalizer/DataUriNormalizer.php#L65-L86 | train | Normalize the object | [
30522,
2270,
3853,
3671,
4697,
1006,
1002,
4874,
1010,
1002,
4289,
1027,
19701,
1010,
9140,
1002,
6123,
1027,
1031,
1033,
1007,
1063,
2065,
1006,
999,
1002,
4874,
6013,
11253,
1032,
11867,
10270,
9463,
2378,
14876,
1007,
1063,
5466,
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... |
z-song/laravel-admin | src/Form.php | Form.findFieldClass | public static function findFieldClass($method)
{
// If alias exists.
if (isset(static::$fieldAlias[$method])) {
$method = static::$fieldAlias[$method];
}
$class = Arr::get(static::$availableFields, $method);
if (class_exists($class)) {
return $class;
}
return false;
} | php | public static function findFieldClass($method)
{
// If alias exists.
if (isset(static::$fieldAlias[$method])) {
$method = static::$fieldAlias[$method];
}
$class = Arr::get(static::$availableFields, $method);
if (class_exists($class)) {
return $class;
}
return false;
} | [
"public",
"static",
"function",
"findFieldClass",
"(",
"$",
"method",
")",
"{",
"// If alias exists.",
"if",
"(",
"isset",
"(",
"static",
"::",
"$",
"fieldAlias",
"[",
"$",
"method",
"]",
")",
")",
"{",
"$",
"method",
"=",
"static",
"::",
"$",
"fieldAlia... | Find field class.
@param string $method
@return bool|mixed | [
"Find",
"field",
"class",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Form.php#L1492-L1506 | train | Find field class by method name | [
30522,
2270,
10763,
3853,
2424,
3790,
26266,
1006,
1002,
4118,
1007,
1063,
1013,
1013,
2065,
14593,
6526,
1012,
2065,
1006,
26354,
3388,
1006,
10763,
1024,
1024,
1002,
2492,
22786,
2015,
1031,
1002,
4118,
1033,
1007,
1007,
1063,
1002,
4118,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
dompdf/dompdf | lib/Cpdf.php | Cpdf.ellipse | function ellipse(
$x0,
$y0,
$r1,
$r2 = 0,
$angle = 0,
$nSeg = 8,
$astart = 0,
$afinish = 360,
$close = true,
$fill = false,
$stroke = true,
$incomplete = false
) {
if ($r1 == 0) {
return;
}
if ($r2 == 0) {
$r2 = $r1;
}
if ($nSeg < 2) {
$nSeg = 2;
}
$astart = deg2rad((float)$astart);
$afinish = deg2rad((float)$afinish);
$totalAngle = $afinish - $astart;
$dt = $totalAngle / $nSeg;
$dtm = $dt / 3;
if ($angle != 0) {
$a = -1 * deg2rad((float)$angle);
$this->addContent(
sprintf("\n q %.3F %.3F %.3F %.3F %.3F %.3F cm", cos($a), -sin($a), sin($a), cos($a), $x0, $y0)
);
$x0 = 0;
$y0 = 0;
}
$t1 = $astart;
$a0 = $x0 + $r1 * cos($t1);
$b0 = $y0 + $r2 * sin($t1);
$c0 = -$r1 * sin($t1);
$d0 = $r2 * cos($t1);
if (!$incomplete) {
$this->addContent(sprintf("\n%.3F %.3F m ", $a0, $b0));
}
for ($i = 1; $i <= $nSeg; $i++) {
// draw this bit of the total curve
$t1 = $i * $dt + $astart;
$a1 = $x0 + $r1 * cos($t1);
$b1 = $y0 + $r2 * sin($t1);
$c1 = -$r1 * sin($t1);
$d1 = $r2 * cos($t1);
$this->addContent(
sprintf(
"\n%.3F %.3F %.3F %.3F %.3F %.3F c",
($a0 + $c0 * $dtm),
($b0 + $d0 * $dtm),
($a1 - $c1 * $dtm),
($b1 - $d1 * $dtm),
$a1,
$b1
)
);
$a0 = $a1;
$b0 = $b1;
$c0 = $c1;
$d0 = $d1;
}
if (!$incomplete) {
if ($fill) {
$this->addContent(' f');
}
if ($stroke) {
if ($close) {
$this->addContent(' s'); // small 's' signifies closing the path as well
} else {
$this->addContent(' S');
}
}
}
if ($angle != 0) {
$this->addContent(' Q');
}
} | php | function ellipse(
$x0,
$y0,
$r1,
$r2 = 0,
$angle = 0,
$nSeg = 8,
$astart = 0,
$afinish = 360,
$close = true,
$fill = false,
$stroke = true,
$incomplete = false
) {
if ($r1 == 0) {
return;
}
if ($r2 == 0) {
$r2 = $r1;
}
if ($nSeg < 2) {
$nSeg = 2;
}
$astart = deg2rad((float)$astart);
$afinish = deg2rad((float)$afinish);
$totalAngle = $afinish - $astart;
$dt = $totalAngle / $nSeg;
$dtm = $dt / 3;
if ($angle != 0) {
$a = -1 * deg2rad((float)$angle);
$this->addContent(
sprintf("\n q %.3F %.3F %.3F %.3F %.3F %.3F cm", cos($a), -sin($a), sin($a), cos($a), $x0, $y0)
);
$x0 = 0;
$y0 = 0;
}
$t1 = $astart;
$a0 = $x0 + $r1 * cos($t1);
$b0 = $y0 + $r2 * sin($t1);
$c0 = -$r1 * sin($t1);
$d0 = $r2 * cos($t1);
if (!$incomplete) {
$this->addContent(sprintf("\n%.3F %.3F m ", $a0, $b0));
}
for ($i = 1; $i <= $nSeg; $i++) {
// draw this bit of the total curve
$t1 = $i * $dt + $astart;
$a1 = $x0 + $r1 * cos($t1);
$b1 = $y0 + $r2 * sin($t1);
$c1 = -$r1 * sin($t1);
$d1 = $r2 * cos($t1);
$this->addContent(
sprintf(
"\n%.3F %.3F %.3F %.3F %.3F %.3F c",
($a0 + $c0 * $dtm),
($b0 + $d0 * $dtm),
($a1 - $c1 * $dtm),
($b1 - $d1 * $dtm),
$a1,
$b1
)
);
$a0 = $a1;
$b0 = $b1;
$c0 = $c1;
$d0 = $d1;
}
if (!$incomplete) {
if ($fill) {
$this->addContent(' f');
}
if ($stroke) {
if ($close) {
$this->addContent(' s'); // small 's' signifies closing the path as well
} else {
$this->addContent(' S');
}
}
}
if ($angle != 0) {
$this->addContent(' Q');
}
} | [
"function",
"ellipse",
"(",
"$",
"x0",
",",
"$",
"y0",
",",
"$",
"r1",
",",
"$",
"r2",
"=",
"0",
",",
"$",
"angle",
"=",
"0",
",",
"$",
"nSeg",
"=",
"8",
",",
"$",
"astart",
"=",
"0",
",",
"$",
"afinish",
"=",
"360",
",",
"$",
"close",
"=... | draw an ellipse
note that the part and filled ellipse are just special cases of this function
draws an ellipse in the current line style
centered at $x0,$y0, radii $r1,$r2
if $r2 is not set, then a circle is drawn
from $astart to $afinish, measured in degrees, running anti-clockwise from the right hand side of the ellipse.
nSeg is not allowed to be less than 2, as this will simply draw a line (and will even draw a
pretty crappy shape at 2, as we are approximating with bezier curves.
@param $x0
@param $y0
@param $r1
@param int $r2
@param int $angle
@param int $nSeg
@param int $astart
@param int $afinish
@param bool $close
@param bool $fill
@param bool $stroke
@param bool $incomplete | [
"draw",
"an",
"ellipse",
"note",
"that",
"the",
"part",
"and",
"filled",
"ellipse",
"are",
"just",
"special",
"cases",
"of",
"this",
"function"
] | 75f13c700009be21a1965dc2c5b68a8708c22ba2 | https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/lib/Cpdf.php#L3386-L3483 | train | Draw the ellipse | [
30522,
3853,
3449,
15000,
3366,
1006,
1002,
1060,
2692,
1010,
1002,
1061,
2692,
1010,
1002,
1054,
2487,
1010,
1002,
1054,
2475,
1027,
1014,
1010,
1002,
6466,
1027,
1014,
1010,
1002,
24978,
13910,
1027,
1022,
1010,
1002,
2004,
7559,
2102,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/Zend/Db/Adapter/Abstract.php | Zend_Db_Adapter_Abstract.fetchAll | public function fetchAll($sql, $bind = array(), $fetchMode = null)
{
if ($fetchMode === null) {
$fetchMode = $this->_fetchMode;
}
$stmt = $this->query($sql, $bind);
$result = $stmt->fetchAll($fetchMode);
return $result;
} | php | public function fetchAll($sql, $bind = array(), $fetchMode = null)
{
if ($fetchMode === null) {
$fetchMode = $this->_fetchMode;
}
$stmt = $this->query($sql, $bind);
$result = $stmt->fetchAll($fetchMode);
return $result;
} | [
"public",
"function",
"fetchAll",
"(",
"$",
"sql",
",",
"$",
"bind",
"=",
"array",
"(",
")",
",",
"$",
"fetchMode",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"fetchMode",
"===",
"null",
")",
"{",
"$",
"fetchMode",
"=",
"$",
"this",
"->",
"_fetchMode",... | Fetches all SQL result rows as a sequential array.
Uses the current fetchMode for the adapter.
@param string|Zend_Db_Select $sql An SQL SELECT statement.
@param mixed $bind Data to bind into SELECT placeholders.
@param mixed $fetchMode Override current fetch mode.
@return array | [
"Fetches",
"all",
"SQL",
"result",
"rows",
"as",
"a",
"sequential",
"array",
".",
"Uses",
"the",
"current",
"fetchMode",
"for",
"the",
"adapter",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Adapter/Abstract.php#L731-L739 | train | fetch all records from the database | [
30522,
2270,
3853,
18584,
8095,
1006,
1002,
29296,
1010,
1002,
14187,
1027,
9140,
1006,
1007,
1010,
1002,
18584,
5302,
3207,
1027,
19701,
1007,
1063,
2065,
1006,
1002,
18584,
5302,
3207,
1027,
1027,
1027,
19701,
1007,
1063,
1002,
18584,
530... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Common2.php | HTML_Common2.getAttributes | public function getAttributes($asString = false)
{
if ($asString) {
return self::getAttributesString($this->attributes);
} else {
return $this->attributes;
}
} | php | public function getAttributes($asString = false)
{
if ($asString) {
return self::getAttributesString($this->attributes);
} else {
return $this->attributes;
}
} | [
"public",
"function",
"getAttributes",
"(",
"$",
"asString",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"asString",
")",
"{",
"return",
"self",
"::",
"getAttributesString",
"(",
"$",
"this",
"->",
"attributes",
")",
";",
"}",
"else",
"{",
"return",
"$",
"... | Returns the attribute array or string
@param bool Whether to return attributes as string
@return mixed Either an array or string of attributes | [
"Returns",
"the",
"attribute",
"array",
"or",
"string"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/HTML/Common2.php#L299-L306 | train | Get attributes of the page | [
30522,
2270,
3853,
2131,
19321,
3089,
8569,
4570,
1006,
1002,
4632,
18886,
3070,
1027,
6270,
1007,
1063,
2065,
1006,
1002,
4632,
18886,
3070,
1007,
1063,
2709,
2969,
1024,
1024,
2131,
19321,
3089,
8569,
4570,
3367,
4892,
1006,
1002,
2023,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/cms/models/ThemeData.php | ThemeData.getDefaultValues | public function getDefaultValues()
{
$result = [];
foreach ($this->getFormFields() as $attribute => $field) {
if (($value = array_get($field, 'default')) === null) {
continue;
}
$result[$attribute] = $value;
}
return $result;
} | php | public function getDefaultValues()
{
$result = [];
foreach ($this->getFormFields() as $attribute => $field) {
if (($value = array_get($field, 'default')) === null) {
continue;
}
$result[$attribute] = $value;
}
return $result;
} | [
"public",
"function",
"getDefaultValues",
"(",
")",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"getFormFields",
"(",
")",
"as",
"$",
"attribute",
"=>",
"$",
"field",
")",
"{",
"if",
"(",
"(",
"$",
"value",
"=",
"arra... | Gets default values for this model based on form field definitions.
@return array | [
"Gets",
"default",
"values",
"for",
"this",
"model",
"based",
"on",
"form",
"field",
"definitions",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/models/ThemeData.php#L171-L184 | train | Get default values | [
30522,
2270,
3853,
2131,
3207,
7011,
11314,
10175,
15808,
1006,
1007,
1063,
1002,
2765,
1027,
1031,
1033,
1025,
18921,
6776,
1006,
1002,
2023,
1011,
1028,
2131,
14192,
15155,
1006,
1007,
2004,
1002,
17961,
1027,
1028,
1002,
2492,
1007,
1063... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/Zend/Db/Statement/Mysqli.php | Zend_Db_Statement_Mysqli.rowCount | public function rowCount()
{
if (!$this->_adapter) {
return false;
}
$mysqli = $this->_adapter->getConnection();
return $mysqli->affected_rows;
} | php | public function rowCount()
{
if (!$this->_adapter) {
return false;
}
$mysqli = $this->_adapter->getConnection();
return $mysqli->affected_rows;
} | [
"public",
"function",
"rowCount",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"_adapter",
")",
"{",
"return",
"false",
";",
"}",
"$",
"mysqli",
"=",
"$",
"this",
"->",
"_adapter",
"->",
"getConnection",
"(",
")",
";",
"return",
"$",
"mysqli",
... | Returns the number of rows affected by the execution of the
last INSERT, DELETE, or UPDATE statement executed by this
statement object.
@return int The number of rows affected. | [
"Returns",
"the",
"number",
"of",
"rows",
"affected",
"by",
"the",
"execution",
"of",
"the",
"last",
"INSERT",
"DELETE",
"or",
"UPDATE",
"statement",
"executed",
"by",
"this",
"statement",
"object",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Statement/Mysqli.php#L353-L360 | train | Get the number of rows affected by the current query | [
30522,
2270,
3853,
5216,
3597,
16671,
1006,
1007,
1063,
2065,
1006,
999,
1002,
2023,
1011,
1028,
1035,
15581,
2121,
1007,
1063,
2709,
6270,
1025,
1065,
1002,
2026,
2015,
4160,
3669,
1027,
1002,
2023,
1011,
1028,
1035,
15581,
2121,
1011,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/QuickForm2.php | QuickForm2.getFormData | public function getFormData($groupErrors = true)
{
if (!self::$registered) {
HTML_QuickForm2_Renderer::register('smarty', 'HTML_QuickForm2_Renderer_Smarty');
self::$registered = true;
}
// Create the renderer object
$renderer = HTML_QuickForm2_Renderer::factory('smarty');
$renderer->setOption('group_errors', $groupErrors);
// build the HTML for the form
$this->render($renderer);
return $renderer->toArray();
} | php | public function getFormData($groupErrors = true)
{
if (!self::$registered) {
HTML_QuickForm2_Renderer::register('smarty', 'HTML_QuickForm2_Renderer_Smarty');
self::$registered = true;
}
// Create the renderer object
$renderer = HTML_QuickForm2_Renderer::factory('smarty');
$renderer->setOption('group_errors', $groupErrors);
// build the HTML for the form
$this->render($renderer);
return $renderer->toArray();
} | [
"public",
"function",
"getFormData",
"(",
"$",
"groupErrors",
"=",
"true",
")",
"{",
"if",
"(",
"!",
"self",
"::",
"$",
"registered",
")",
"{",
"HTML_QuickForm2_Renderer",
"::",
"register",
"(",
"'smarty'",
",",
"'HTML_QuickForm2_Renderer_Smarty'",
")",
";",
"... | Returns the rendered form as an array.
@param bool $groupErrors Whether to group errors together or not.
@return array | [
"Returns",
"the",
"rendered",
"form",
"as",
"an",
"array",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/QuickForm2.php#L129-L144 | train | Returns the form data | [
30522,
2270,
3853,
2131,
14192,
2850,
2696,
1006,
1002,
2177,
2121,
29165,
2015,
1027,
2995,
1007,
1063,
2065,
1006,
999,
2969,
1024,
1024,
1002,
5068,
1007,
1063,
16129,
1035,
4248,
14192,
2475,
1035,
17552,
2121,
1024,
1024,
4236,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Database/Eloquent/Model.php | Model.performInsert | protected function performInsert(Builder $query)
{
if ($this->fireModelEvent('creating') === false) {
return false;
}
// First we'll need to create a fresh query instance and touch the creation and
// update timestamps on this model, which are maintained by us for developer
// convenience. After, we will just continue saving these model instances.
if ($this->usesTimestamps()) {
$this->updateTimestamps();
}
// If the model has an incrementing key, we can use the "insertGetId" method on
// the query builder, which will give us back the final inserted ID for this
// table from the database. Not all tables have to be incrementing though.
$attributes = $this->getAttributes();
if ($this->getIncrementing()) {
$this->insertAndSetId($query, $attributes);
}
// If the table isn't incrementing we'll simply insert these attributes as they
// are. These attribute arrays must contain an "id" column previously placed
// there by the developer as the manually determined key for these models.
else {
if (empty($attributes)) {
return true;
}
$query->insert($attributes);
}
// We will go ahead and set the exists property to true, so that it is set when
// the created event is fired, just in case the developer tries to update it
// during the event. This will allow them to do so and run an update here.
$this->exists = true;
$this->wasRecentlyCreated = true;
$this->fireModelEvent('created', false);
return true;
} | php | protected function performInsert(Builder $query)
{
if ($this->fireModelEvent('creating') === false) {
return false;
}
// First we'll need to create a fresh query instance and touch the creation and
// update timestamps on this model, which are maintained by us for developer
// convenience. After, we will just continue saving these model instances.
if ($this->usesTimestamps()) {
$this->updateTimestamps();
}
// If the model has an incrementing key, we can use the "insertGetId" method on
// the query builder, which will give us back the final inserted ID for this
// table from the database. Not all tables have to be incrementing though.
$attributes = $this->getAttributes();
if ($this->getIncrementing()) {
$this->insertAndSetId($query, $attributes);
}
// If the table isn't incrementing we'll simply insert these attributes as they
// are. These attribute arrays must contain an "id" column previously placed
// there by the developer as the manually determined key for these models.
else {
if (empty($attributes)) {
return true;
}
$query->insert($attributes);
}
// We will go ahead and set the exists property to true, so that it is set when
// the created event is fired, just in case the developer tries to update it
// during the event. This will allow them to do so and run an update here.
$this->exists = true;
$this->wasRecentlyCreated = true;
$this->fireModelEvent('created', false);
return true;
} | [
"protected",
"function",
"performInsert",
"(",
"Builder",
"$",
"query",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"fireModelEvent",
"(",
"'creating'",
")",
"===",
"false",
")",
"{",
"return",
"false",
";",
"}",
"// First we'll need to create a fresh query instance a... | Perform a model insert operation.
@param \Illuminate\Database\Eloquent\Builder $query
@return bool | [
"Perform",
"a",
"model",
"insert",
"operation",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Model.php#L781-L824 | train | Performs an insert on the database. | [
30522,
5123,
3853,
4685,
7076,
8743,
1006,
12508,
1002,
23032,
1007,
1063,
2065,
1006,
1002,
2023,
1011,
1028,
2543,
5302,
9247,
18697,
3372,
1006,
1005,
4526,
1005,
1007,
1027,
1027,
1027,
6270,
1007,
1063,
2709,
6270,
1025,
1065,
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.generateThumbnail | protected function generateThumbnail($thumbnailInfo, $thumbnailParams = null)
{
$tempFilePath = null;
$fullThumbnailPath = null;
$thumbnailPath = null;
$markup = null;
try {
/*
* Get and validate input data
*/
$path = $thumbnailInfo['path'];
$width = $thumbnailInfo['width'];
$height = $thumbnailInfo['height'];
$lastModified = $thumbnailInfo['lastModified'];
if (!is_numeric($width) || !is_numeric($height) || !is_numeric($lastModified)) {
throw new ApplicationException('Invalid input data');
}
if (!$thumbnailParams) {
$thumbnailParams = $this->getThumbnailParams();
$thumbnailParams['width'] = $width;
$thumbnailParams['height'] = $height;
}
$thumbnailPath = $this->getThumbnailImagePath($thumbnailParams, $path, $lastModified);
$fullThumbnailPath = temp_path(ltrim($thumbnailPath, '/'));
/*
* Save the file locally
*/
$library = MediaLibrary::instance();
$tempFilePath = $this->getLocalTempFilePath($path);
if (!@File::put($tempFilePath, $library->get($path))) {
throw new SystemException('Error saving remote file to a temporary location');
}
/*
* Resize the thumbnail and save to the thumbnails directory
*/
$this->resizeImage($fullThumbnailPath, $thumbnailParams, $tempFilePath);
/*
* Delete the temporary file
*/
File::delete($tempFilePath);
$markup = $this->makePartial('thumbnail-image', [
'isError' => false,
'imageUrl' => $this->getThumbnailImageUrl($thumbnailPath)
]);
}
catch (Exception $ex) {
if ($tempFilePath) {
File::delete($tempFilePath);
}
if ($fullThumbnailPath) {
$this->copyBrokenImage($fullThumbnailPath);
}
$markup = $this->makePartial('thumbnail-image', ['isError' => true]);
/*
* @todo We need to log all types of exceptions here
*/
traceLog($ex->getMessage());
}
if ($markup && ($id = $thumbnailInfo['id'])) {
return [
'id' => $id,
'markup' => $markup
];
}
} | php | protected function generateThumbnail($thumbnailInfo, $thumbnailParams = null)
{
$tempFilePath = null;
$fullThumbnailPath = null;
$thumbnailPath = null;
$markup = null;
try {
/*
* Get and validate input data
*/
$path = $thumbnailInfo['path'];
$width = $thumbnailInfo['width'];
$height = $thumbnailInfo['height'];
$lastModified = $thumbnailInfo['lastModified'];
if (!is_numeric($width) || !is_numeric($height) || !is_numeric($lastModified)) {
throw new ApplicationException('Invalid input data');
}
if (!$thumbnailParams) {
$thumbnailParams = $this->getThumbnailParams();
$thumbnailParams['width'] = $width;
$thumbnailParams['height'] = $height;
}
$thumbnailPath = $this->getThumbnailImagePath($thumbnailParams, $path, $lastModified);
$fullThumbnailPath = temp_path(ltrim($thumbnailPath, '/'));
/*
* Save the file locally
*/
$library = MediaLibrary::instance();
$tempFilePath = $this->getLocalTempFilePath($path);
if (!@File::put($tempFilePath, $library->get($path))) {
throw new SystemException('Error saving remote file to a temporary location');
}
/*
* Resize the thumbnail and save to the thumbnails directory
*/
$this->resizeImage($fullThumbnailPath, $thumbnailParams, $tempFilePath);
/*
* Delete the temporary file
*/
File::delete($tempFilePath);
$markup = $this->makePartial('thumbnail-image', [
'isError' => false,
'imageUrl' => $this->getThumbnailImageUrl($thumbnailPath)
]);
}
catch (Exception $ex) {
if ($tempFilePath) {
File::delete($tempFilePath);
}
if ($fullThumbnailPath) {
$this->copyBrokenImage($fullThumbnailPath);
}
$markup = $this->makePartial('thumbnail-image', ['isError' => true]);
/*
* @todo We need to log all types of exceptions here
*/
traceLog($ex->getMessage());
}
if ($markup && ($id = $thumbnailInfo['id'])) {
return [
'id' => $id,
'markup' => $markup
];
}
} | [
"protected",
"function",
"generateThumbnail",
"(",
"$",
"thumbnailInfo",
",",
"$",
"thumbnailParams",
"=",
"null",
")",
"{",
"$",
"tempFilePath",
"=",
"null",
";",
"$",
"fullThumbnailPath",
"=",
"null",
";",
"$",
"thumbnailPath",
"=",
"null",
";",
"$",
"mark... | Generate thumbnail
@param array $thumbnailInfo
@param array|null $thumbnailParams
@return array | [
"Generate",
"thumbnail"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/MediaManager.php#L1291-L1367 | train | Generate thumbnail image | [
30522,
5123,
3853,
9699,
2705,
25438,
25464,
1006,
1002,
7639,
25464,
2378,
14876,
1010,
1002,
7639,
25464,
28689,
5244,
1027,
19701,
1007,
1063,
1002,
8915,
8737,
8873,
2571,
15069,
1027,
19701,
1025,
1002,
2440,
2705,
25438,
25464,
15069,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Database/Schema/Blueprint.php | Blueprint.addFluentCommands | public function addFluentCommands(Grammar $grammar)
{
foreach ($this->columns as $column) {
foreach ($grammar->getFluentCommands() as $commandName) {
$attributeName = lcfirst($commandName);
if (! isset($column->{$attributeName})) {
continue;
}
$value = $column->{$attributeName};
$this->addCommand(
$commandName, compact('value', 'column')
);
}
}
} | php | public function addFluentCommands(Grammar $grammar)
{
foreach ($this->columns as $column) {
foreach ($grammar->getFluentCommands() as $commandName) {
$attributeName = lcfirst($commandName);
if (! isset($column->{$attributeName})) {
continue;
}
$value = $column->{$attributeName};
$this->addCommand(
$commandName, compact('value', 'column')
);
}
}
} | [
"public",
"function",
"addFluentCommands",
"(",
"Grammar",
"$",
"grammar",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"columns",
"as",
"$",
"column",
")",
"{",
"foreach",
"(",
"$",
"grammar",
"->",
"getFluentCommands",
"(",
")",
"as",
"$",
"commandName",... | Add the fluent commands specified on any columns.
@param \Illuminate\Database\Schema\Grammars\Grammar $grammar
@return void | [
"Add",
"the",
"fluent",
"commands",
"specified",
"on",
"any",
"columns",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Schema/Blueprint.php#L227-L244 | train | Adds fluent commands to the table | [
30522,
2270,
3853,
5587,
10258,
24997,
13535,
5358,
2386,
5104,
1006,
8035,
1002,
8035,
1007,
1063,
18921,
6776,
1006,
1002,
2023,
1011,
1028,
7753,
2004,
1002,
5930,
1007,
1063,
18921,
6776,
1006,
1002,
8035,
1011,
1028,
2131,
10258,
24997... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Sort.php | Sort.filter | public function filter($table)
{
if ($table instanceof Simple) {
return;
}
if (empty($this->columnToSort)) {
return;
}
if (!$table->getRowsCountWithoutSummaryRow()) {
return;
}
$row = $table->getFirstRow();
if ($row === false) {
return;
}
$config = new Sorter\Config();
$sorter = new Sorter($config);
$config->naturalSort = $this->naturalSort;
$config->primaryColumnToSort = $sorter->getPrimaryColumnToSort($table, $this->columnToSort);
$config->primarySortOrder = $sorter->getPrimarySortOrder($this->order);
$config->primarySortFlags = $sorter->getBestSortFlags($table, $config->primaryColumnToSort);
if (!empty($this->secondaryColumnSortCallback)) {
$config->secondaryColumnToSort = call_user_func($this->secondaryColumnSortCallback, $config->primaryColumnToSort, $table);
} else {
$config->secondaryColumnToSort = $sorter->getSecondaryColumnToSort($row, $config->primaryColumnToSort);
}
$config->secondarySortOrder = $sorter->getSecondarySortOrder($this->order, $config->secondaryColumnToSort);
$config->secondarySortFlags = $sorter->getBestSortFlags($table, $config->secondaryColumnToSort);
// secondary sort should not be needed for all other sort flags (eg string/natural sort) as label is unique and would make it slower
$isSecondaryColumnSortNeeded = $config->primarySortFlags === SORT_NUMERIC;
$config->isSecondaryColumnSortEnabled = $this->isSecondaryColumnSortEnabled && $isSecondaryColumnSortNeeded;
$this->sort($sorter, $table);
} | php | public function filter($table)
{
if ($table instanceof Simple) {
return;
}
if (empty($this->columnToSort)) {
return;
}
if (!$table->getRowsCountWithoutSummaryRow()) {
return;
}
$row = $table->getFirstRow();
if ($row === false) {
return;
}
$config = new Sorter\Config();
$sorter = new Sorter($config);
$config->naturalSort = $this->naturalSort;
$config->primaryColumnToSort = $sorter->getPrimaryColumnToSort($table, $this->columnToSort);
$config->primarySortOrder = $sorter->getPrimarySortOrder($this->order);
$config->primarySortFlags = $sorter->getBestSortFlags($table, $config->primaryColumnToSort);
if (!empty($this->secondaryColumnSortCallback)) {
$config->secondaryColumnToSort = call_user_func($this->secondaryColumnSortCallback, $config->primaryColumnToSort, $table);
} else {
$config->secondaryColumnToSort = $sorter->getSecondaryColumnToSort($row, $config->primaryColumnToSort);
}
$config->secondarySortOrder = $sorter->getSecondarySortOrder($this->order, $config->secondaryColumnToSort);
$config->secondarySortFlags = $sorter->getBestSortFlags($table, $config->secondaryColumnToSort);
// secondary sort should not be needed for all other sort flags (eg string/natural sort) as label is unique and would make it slower
$isSecondaryColumnSortNeeded = $config->primarySortFlags === SORT_NUMERIC;
$config->isSecondaryColumnSortEnabled = $this->isSecondaryColumnSortEnabled && $isSecondaryColumnSortNeeded;
$this->sort($sorter, $table);
} | [
"public",
"function",
"filter",
"(",
"$",
"table",
")",
"{",
"if",
"(",
"$",
"table",
"instanceof",
"Simple",
")",
"{",
"return",
";",
"}",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"columnToSort",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
... | See {@link Sort}.
@param DataTable $table
@return mixed | [
"See",
"{",
"@link",
"Sort",
"}",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/DataTable/Filter/Sort.php#L70-L110 | train | Filter the table by the current sort order | [
30522,
2270,
3853,
11307,
1006,
1002,
2795,
1007,
1063,
2065,
1006,
1002,
2795,
6013,
11253,
3722,
1007,
1063,
2709,
1025,
1065,
2065,
1006,
4064,
1006,
1002,
2023,
1011,
1028,
5930,
13122,
11589,
1007,
1007,
1063,
2709,
1025,
1065,
2065,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Form/FormFactory.php | FormFactory.createBuilderForProperty | public function createBuilderForProperty($class, $property, $data = null, array $options = [])
{
if (null === $guesser = $this->registry->getTypeGuesser()) {
return $this->createNamedBuilder($property, 'Symfony\Component\Form\Extension\Core\Type\TextType', $data, $options);
}
$typeGuess = $guesser->guessType($class, $property);
$maxLengthGuess = $guesser->guessMaxLength($class, $property);
$requiredGuess = $guesser->guessRequired($class, $property);
$patternGuess = $guesser->guessPattern($class, $property);
$type = $typeGuess ? $typeGuess->getType() : 'Symfony\Component\Form\Extension\Core\Type\TextType';
$maxLength = $maxLengthGuess ? $maxLengthGuess->getValue() : null;
$pattern = $patternGuess ? $patternGuess->getValue() : null;
if (null !== $pattern) {
$options = array_replace_recursive(['attr' => ['pattern' => $pattern]], $options);
}
if (null !== $maxLength) {
$options = array_replace_recursive(['attr' => ['maxlength' => $maxLength]], $options);
}
if ($requiredGuess) {
$options = array_merge(['required' => $requiredGuess->getValue()], $options);
}
// user options may override guessed options
if ($typeGuess) {
$attrs = [];
$typeGuessOptions = $typeGuess->getOptions();
if (isset($typeGuessOptions['attr']) && isset($options['attr'])) {
$attrs = ['attr' => array_merge($typeGuessOptions['attr'], $options['attr'])];
}
$options = array_merge($typeGuessOptions, $options, $attrs);
}
return $this->createNamedBuilder($property, $type, $data, $options);
} | php | public function createBuilderForProperty($class, $property, $data = null, array $options = [])
{
if (null === $guesser = $this->registry->getTypeGuesser()) {
return $this->createNamedBuilder($property, 'Symfony\Component\Form\Extension\Core\Type\TextType', $data, $options);
}
$typeGuess = $guesser->guessType($class, $property);
$maxLengthGuess = $guesser->guessMaxLength($class, $property);
$requiredGuess = $guesser->guessRequired($class, $property);
$patternGuess = $guesser->guessPattern($class, $property);
$type = $typeGuess ? $typeGuess->getType() : 'Symfony\Component\Form\Extension\Core\Type\TextType';
$maxLength = $maxLengthGuess ? $maxLengthGuess->getValue() : null;
$pattern = $patternGuess ? $patternGuess->getValue() : null;
if (null !== $pattern) {
$options = array_replace_recursive(['attr' => ['pattern' => $pattern]], $options);
}
if (null !== $maxLength) {
$options = array_replace_recursive(['attr' => ['maxlength' => $maxLength]], $options);
}
if ($requiredGuess) {
$options = array_merge(['required' => $requiredGuess->getValue()], $options);
}
// user options may override guessed options
if ($typeGuess) {
$attrs = [];
$typeGuessOptions = $typeGuess->getOptions();
if (isset($typeGuessOptions['attr']) && isset($options['attr'])) {
$attrs = ['attr' => array_merge($typeGuessOptions['attr'], $options['attr'])];
}
$options = array_merge($typeGuessOptions, $options, $attrs);
}
return $this->createNamedBuilder($property, $type, $data, $options);
} | [
"public",
"function",
"createBuilderForProperty",
"(",
"$",
"class",
",",
"$",
"property",
",",
"$",
"data",
"=",
"null",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"guesser",
"=",
"$",
"this",
"->",
"regist... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/FormFactory.php#L88-L128 | train | Guesses the type of a property and returns a builder for it | [
30522,
2270,
3853,
3443,
8569,
23891,
12881,
2953,
21572,
30524,
19701,
1027,
1027,
1027,
1002,
3984,
2121,
1027,
1002,
2023,
1011,
1028,
15584,
1011,
1028,
2131,
13874,
22967,
8043,
1006,
1007,
1007,
1063,
2709,
1002,
2023,
1011,
1028,
344... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/ValidationData.php | ValidationData.extractDataFromPath | public static function extractDataFromPath($attribute, $masterData)
{
$results = [];
$value = Arr::get($masterData, $attribute, '__missing__');
if ($value !== '__missing__') {
Arr::set($results, $attribute, $value);
}
return $results;
} | php | public static function extractDataFromPath($attribute, $masterData)
{
$results = [];
$value = Arr::get($masterData, $attribute, '__missing__');
if ($value !== '__missing__') {
Arr::set($results, $attribute, $value);
}
return $results;
} | [
"public",
"static",
"function",
"extractDataFromPath",
"(",
"$",
"attribute",
",",
"$",
"masterData",
")",
"{",
"$",
"results",
"=",
"[",
"]",
";",
"$",
"value",
"=",
"Arr",
"::",
"get",
"(",
"$",
"masterData",
",",
"$",
"attribute",
",",
"'__missing__'"... | Extract data based on the given dot-notated path.
Used to extract a sub-section of the data for faster iteration.
@param string $attribute
@param array $masterData
@return array | [
"Extract",
"data",
"based",
"on",
"the",
"given",
"dot",
"-",
"notated",
"path",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Validation/ValidationData.php#L86-L97 | train | Extract data from masterData array | [
30522,
2270,
10763,
3853,
14817,
2850,
2696,
19699,
25377,
8988,
1006,
1002,
17961,
1010,
1002,
3040,
2850,
2696,
1007,
1063,
1002,
3463,
1027,
1031,
1033,
1025,
1002,
3643,
1027,
12098,
2099,
1024,
1024,
2131,
1006,
1002,
3040,
2850,
2696,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
php-ai/php-ml | src/Helper/Optimizer/ConjugateGradient.php | ConjugateGradient.getNewDirection | protected function getNewDirection(array $theta, float $beta, array $d): array
{
$grad = $this->gradient($theta);
return MP::add(MP::muls($grad, -1), MP::muls($d, $beta));
} | php | protected function getNewDirection(array $theta, float $beta, array $d): array
{
$grad = $this->gradient($theta);
return MP::add(MP::muls($grad, -1), MP::muls($d, $beta));
} | [
"protected",
"function",
"getNewDirection",
"(",
"array",
"$",
"theta",
",",
"float",
"$",
"beta",
",",
"array",
"$",
"d",
")",
":",
"array",
"{",
"$",
"grad",
"=",
"$",
"this",
"->",
"gradient",
"(",
"$",
"theta",
")",
";",
"return",
"MP",
"::",
"... | Calculates the new conjugate direction
d(k+1) =–∇f(x(k+1)) + β(k).d(k) | [
"Calculates",
"the",
"new",
"conjugate",
"direction"
] | f6aa1a59b0525b8fca3d2786d661ab3e70904016 | https://github.com/php-ai/php-ml/blob/f6aa1a59b0525b8fca3d2786d661ab3e70904016/src/Helper/Optimizer/ConjugateGradient.php#L197-L202 | train | Get new direction | [
30522,
5123,
3853,
2131,
2638,
21724,
7442,
7542,
1006,
9140,
1002,
23963,
1010,
14257,
1002,
8247,
1010,
9140,
1002,
1040,
1007,
1024,
9140,
1063,
1002,
24665,
4215,
1027,
1002,
2023,
1011,
1028,
17978,
1006,
1002,
23963,
1007,
1025,
2709,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Auth/Access/Gate.php | Gate.callbackAllowsGuests | protected function callbackAllowsGuests($callback)
{
$parameters = (new ReflectionFunction($callback))->getParameters();
return isset($parameters[0]) && $this->parameterAllowsGuests($parameters[0]);
} | php | protected function callbackAllowsGuests($callback)
{
$parameters = (new ReflectionFunction($callback))->getParameters();
return isset($parameters[0]) && $this->parameterAllowsGuests($parameters[0]);
} | [
"protected",
"function",
"callbackAllowsGuests",
"(",
"$",
"callback",
")",
"{",
"$",
"parameters",
"=",
"(",
"new",
"ReflectionFunction",
"(",
"$",
"callback",
")",
")",
"->",
"getParameters",
"(",
")",
";",
"return",
"isset",
"(",
"$",
"parameters",
"[",
... | Determine if the callback allows guests.
@param callable $callback
@return bool | [
"Determine",
"if",
"the",
"callback",
"allows",
"guests",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Auth/Access/Gate.php#L421-L426 | train | Checks if the callback allows guests | [
30522,
5123,
3853,
2655,
5963,
8095,
15568,
22967,
3215,
1006,
1002,
2655,
5963,
1007,
1063,
1002,
11709,
1027,
1006,
2047,
9185,
11263,
27989,
1006,
1002,
2655,
5963,
1007,
1007,
1011,
1028,
2131,
28689,
22828,
2015,
1006,
1007,
1025,
2709... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/backend/controllers/Auth.php | Auth.reset | public function reset($userId = null, $code = null)
{
try {
if (post('postback')) {
return $this->reset_onSubmit();
}
if (!$userId || !$code) {
throw new ApplicationException(trans('backend::lang.account.reset_error'));
}
}
catch (Exception $ex) {
Flash::error($ex->getMessage());
}
$this->vars['code'] = $code;
$this->vars['id'] = $userId;
} | php | public function reset($userId = null, $code = null)
{
try {
if (post('postback')) {
return $this->reset_onSubmit();
}
if (!$userId || !$code) {
throw new ApplicationException(trans('backend::lang.account.reset_error'));
}
}
catch (Exception $ex) {
Flash::error($ex->getMessage());
}
$this->vars['code'] = $code;
$this->vars['id'] = $userId;
} | [
"public",
"function",
"reset",
"(",
"$",
"userId",
"=",
"null",
",",
"$",
"code",
"=",
"null",
")",
"{",
"try",
"{",
"if",
"(",
"post",
"(",
"'postback'",
")",
")",
"{",
"return",
"$",
"this",
"->",
"reset_onSubmit",
"(",
")",
";",
"}",
"if",
"("... | Reset backend user password using verification code. | [
"Reset",
"backend",
"user",
"password",
"using",
"verification",
"code",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/controllers/Auth.php#L164-L181 | train | Reset the user | [
30522,
2270,
3853,
25141,
1006,
1002,
5310,
3593,
1027,
19701,
1010,
1002,
3642,
1027,
19701,
1007,
1063,
3046,
1063,
2065,
1006,
2695,
1006,
1005,
2695,
5963,
1005,
1007,
1007,
30524,
1011,
1028,
25141,
1035,
2006,
6342,
25526,
4183,
1006,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Validation/Concerns/ValidatesAttributes.php | ValidatesAttributes.validateRequiredWithout | public function validateRequiredWithout($attribute, $value, $parameters)
{
if ($this->anyFailingRequired($parameters)) {
return $this->validateRequired($attribute, $value);
}
return true;
} | php | public function validateRequiredWithout($attribute, $value, $parameters)
{
if ($this->anyFailingRequired($parameters)) {
return $this->validateRequired($attribute, $value);
}
return true;
} | [
"public",
"function",
"validateRequiredWithout",
"(",
"$",
"attribute",
",",
"$",
"value",
",",
"$",
"parameters",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"anyFailingRequired",
"(",
"$",
"parameters",
")",
")",
"{",
"return",
"$",
"this",
"->",
"validateRe... | Validate that an attribute exists when another attribute does not.
@param string $attribute
@param mixed $value
@param mixed $parameters
@return bool | [
"Validate",
"that",
"an",
"attribute",
"exists",
"when",
"another",
"attribute",
"does",
"not",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Validation/Concerns/ValidatesAttributes.php#L1426-L1433 | train | Validate required without | [
30522,
2270,
3853,
9398,
24932,
2063,
15549,
5596,
24415,
5833,
1006,
1002,
17961,
1010,
1002,
3643,
1010,
1002,
11709,
1007,
1063,
2065,
1006,
1002,
2023,
1011,
1028,
2151,
7011,
16281,
2890,
15549,
5596,
1006,
1002,
11709,
1007,
1007,
106... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
overtrue/wechat | src/OpenWork/Corp/Client.php | Client.getOAuthRedirectUrl | public function getOAuthRedirectUrl(string $redirectUri = '', string $scope = 'snsapi_userinfo', string $state = null)
{
$redirectUri || $redirectUri = $this->app->config['redirect_uri_oauth'];
$state || $state = rand();
$params = [
'appid' => $this->app['config']['suite_id'],
'redirect_uri' => $redirectUri,
'response_type' => 'code',
'scope' => $scope,
'state' => $state,
];
return 'https://open.weixin.qq.com/connect/oauth2/authorize?'.http_build_query($params).'#wechat_redirect';
} | php | public function getOAuthRedirectUrl(string $redirectUri = '', string $scope = 'snsapi_userinfo', string $state = null)
{
$redirectUri || $redirectUri = $this->app->config['redirect_uri_oauth'];
$state || $state = rand();
$params = [
'appid' => $this->app['config']['suite_id'],
'redirect_uri' => $redirectUri,
'response_type' => 'code',
'scope' => $scope,
'state' => $state,
];
return 'https://open.weixin.qq.com/connect/oauth2/authorize?'.http_build_query($params).'#wechat_redirect';
} | [
"public",
"function",
"getOAuthRedirectUrl",
"(",
"string",
"$",
"redirectUri",
"=",
"''",
",",
"string",
"$",
"scope",
"=",
"'snsapi_userinfo'",
",",
"string",
"$",
"state",
"=",
"null",
")",
"{",
"$",
"redirectUri",
"||",
"$",
"redirectUri",
"=",
"$",
"t... | 获取登录url.
@param string $redirectUri
@param string $scope
@param string|null $state
@return string | [
"获取登录url",
"."
] | 120c72faaa93c270365bc75c73c362d5fd583209 | https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/OpenWork/Corp/Client.php#L162-L175 | train | Get OAuth Redirect Url | [
30522,
2270,
3853,
2131,
10441,
14317,
5596,
7442,
6593,
3126,
2140,
1006,
5164,
1002,
2417,
7442,
6593,
9496,
1027,
1005,
1005,
1010,
5164,
1002,
9531,
1027,
1005,
1055,
3619,
9331,
2072,
1035,
5310,
2378,
14876,
1005,
1010,
5164,
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... |
opencart/opencart | upload/catalog/controller/event/activity.php | ControllerEventActivity.editCustomer | public function editCustomer(&$route, &$args, &$output) {
if ($this->config->get('config_customer_activity')) {
$this->load->model('account/activity');
$activity_data = array(
'customer_id' => $this->customer->getId(),
'name' => $this->customer->getFirstName() . ' ' . $this->customer->getLastName()
);
$this->model_account_activity->addActivity('edit', $activity_data);
}
} | php | public function editCustomer(&$route, &$args, &$output) {
if ($this->config->get('config_customer_activity')) {
$this->load->model('account/activity');
$activity_data = array(
'customer_id' => $this->customer->getId(),
'name' => $this->customer->getFirstName() . ' ' . $this->customer->getLastName()
);
$this->model_account_activity->addActivity('edit', $activity_data);
}
} | [
"public",
"function",
"editCustomer",
"(",
"&",
"$",
"route",
",",
"&",
"$",
"args",
",",
"&",
"$",
"output",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"config",
"->",
"get",
"(",
"'config_customer_activity'",
")",
")",
"{",
"$",
"this",
"->",
"load",
... | catalog/model/account/customer/editCustomer/after | [
"catalog",
"/",
"model",
"/",
"account",
"/",
"customer",
"/",
"editCustomer",
"/",
"after"
] | e7933b56ba05aafb3655c6b490c9733cd18b5c69 | https://github.com/opencart/opencart/blob/e7933b56ba05aafb3655c6b490c9733cd18b5c69/upload/catalog/controller/event/activity.php#L18-L29 | train | Edit a customer activity | [
30522,
2270,
3853,
10086,
7874,
20389,
2121,
1006,
1004,
1002,
2799,
1010,
1004,
1002,
12098,
5620,
1010,
1004,
1002,
6434,
1007,
1063,
2065,
1006,
1002,
2023,
1011,
1028,
9530,
8873,
2290,
1011,
1028,
2131,
1006,
1005,
9530,
8873,
2290,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/UserCountry/LocationProvider.php | LocationProvider.getIpFromInfo | protected function getIpFromInfo($info)
{
$ip = \Piwik\Network\IP::fromStringIP($info['ip']);
if ($ip instanceof \Piwik\Network\IPv6 && $ip->isMappedIPv4()) {
return $ip->toIPv4String();
} else {
return $ip->toString();
}
} | php | protected function getIpFromInfo($info)
{
$ip = \Piwik\Network\IP::fromStringIP($info['ip']);
if ($ip instanceof \Piwik\Network\IPv6 && $ip->isMappedIPv4()) {
return $ip->toIPv4String();
} else {
return $ip->toString();
}
} | [
"protected",
"function",
"getIpFromInfo",
"(",
"$",
"info",
")",
"{",
"$",
"ip",
"=",
"\\",
"Piwik",
"\\",
"Network",
"\\",
"IP",
"::",
"fromStringIP",
"(",
"$",
"info",
"[",
"'ip'",
"]",
")",
";",
"if",
"(",
"$",
"ip",
"instanceof",
"\\",
"Piwik",
... | Returns an IP address from an array that was passed into getLocation. This
will return an IPv4 address or IPv6 address.
@param array $info Must have 'ip' key.
@return string|null | [
"Returns",
"an",
"IP",
"address",
"from",
"an",
"array",
"that",
"was",
"passed",
"into",
"getLocation",
".",
"This",
"will",
"return",
"an",
"IPv4",
"address",
"or",
"IPv6",
"address",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/UserCountry/LocationProvider.php#L499-L508 | train | Get the IP from the info array | [
30522,
5123,
3853,
2131,
11514,
19699,
20936,
2078,
14876,
1006,
1002,
18558,
1007,
1063,
1002,
12997,
1027,
1032,
14255,
9148,
2243,
1032,
2897,
1032,
12997,
1024,
1024,
2013,
3367,
4892,
11514,
1006,
1002,
18558,
1031,
1005,
12997,
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.set_background_repeat | function set_background_repeat($val)
{
if (is_null($val)) {
$val = self::$_defaults["background_repeat"];
}
//see __set and __get, on all assignments clear cache, not needed on direct set through __set
$this->_prop_cache["background_repeat"] = null;
$this->_props["background_repeat"] = $val;
} | php | function set_background_repeat($val)
{
if (is_null($val)) {
$val = self::$_defaults["background_repeat"];
}
//see __set and __get, on all assignments clear cache, not needed on direct set through __set
$this->_prop_cache["background_repeat"] = null;
$this->_props["background_repeat"] = $val;
} | [
"function",
"set_background_repeat",
"(",
"$",
"val",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"val",
")",
")",
"{",
"$",
"val",
"=",
"self",
"::",
"$",
"_defaults",
"[",
"\"background_repeat\"",
"]",
";",
"}",
"//see __set and __get, on all assignments clear... | Sets the background repeat
@link http://www.w3.org/TR/CSS21/colors.html#propdef-background-repeat
@param string $val | [
"Sets",
"the",
"background",
"repeat"
] | 75f13c700009be21a1965dc2c5b68a8708c22ba2 | https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/src/Css/Style.php#L1858-L1867 | train | set background repeat | [
30522,
3853,
2275,
1035,
4281,
1035,
9377,
1006,
1002,
11748,
1007,
1063,
2065,
1006,
2003,
1035,
19701,
1006,
1002,
11748,
1007,
1007,
1063,
1002,
11748,
1027,
2969,
1024,
1024,
1002,
1035,
12398,
2015,
1031,
1000,
4281,
1035,
9377,
1000,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/HttpFoundation/File/UploadedFile.php | UploadedFile.move | public function move($directory, $name = null)
{
if ($this->isValid()) {
if ($this->test) {
return parent::move($directory, $name);
}
$target = $this->getTargetFile($directory, $name);
set_error_handler(function ($type, $msg) use (&$error) { $error = $msg; });
$moved = move_uploaded_file($this->getPathname(), $target);
restore_error_handler();
if (!$moved) {
throw new FileException(sprintf('Could not move the file "%s" to "%s" (%s)', $this->getPathname(), $target, strip_tags($error)));
}
@chmod($target, 0666 & ~umask());
return $target;
}
switch ($this->error) {
case UPLOAD_ERR_INI_SIZE:
throw new IniSizeFileException($this->getErrorMessage());
case UPLOAD_ERR_FORM_SIZE:
throw new FormSizeFileException($this->getErrorMessage());
case UPLOAD_ERR_PARTIAL:
throw new PartialFileException($this->getErrorMessage());
case UPLOAD_ERR_NO_FILE:
throw new NoFileException($this->getErrorMessage());
case UPLOAD_ERR_CANT_WRITE:
throw new CannotWriteFileException($this->getErrorMessage());
case UPLOAD_ERR_NO_TMP_DIR:
throw new NoTmpDirFileException($this->getErrorMessage());
case UPLOAD_ERR_EXTENSION:
throw new ExtensionFileException($this->getErrorMessage());
}
throw new FileException($this->getErrorMessage());
} | php | public function move($directory, $name = null)
{
if ($this->isValid()) {
if ($this->test) {
return parent::move($directory, $name);
}
$target = $this->getTargetFile($directory, $name);
set_error_handler(function ($type, $msg) use (&$error) { $error = $msg; });
$moved = move_uploaded_file($this->getPathname(), $target);
restore_error_handler();
if (!$moved) {
throw new FileException(sprintf('Could not move the file "%s" to "%s" (%s)', $this->getPathname(), $target, strip_tags($error)));
}
@chmod($target, 0666 & ~umask());
return $target;
}
switch ($this->error) {
case UPLOAD_ERR_INI_SIZE:
throw new IniSizeFileException($this->getErrorMessage());
case UPLOAD_ERR_FORM_SIZE:
throw new FormSizeFileException($this->getErrorMessage());
case UPLOAD_ERR_PARTIAL:
throw new PartialFileException($this->getErrorMessage());
case UPLOAD_ERR_NO_FILE:
throw new NoFileException($this->getErrorMessage());
case UPLOAD_ERR_CANT_WRITE:
throw new CannotWriteFileException($this->getErrorMessage());
case UPLOAD_ERR_NO_TMP_DIR:
throw new NoTmpDirFileException($this->getErrorMessage());
case UPLOAD_ERR_EXTENSION:
throw new ExtensionFileException($this->getErrorMessage());
}
throw new FileException($this->getErrorMessage());
} | [
"public",
"function",
"move",
"(",
"$",
"directory",
",",
"$",
"name",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isValid",
"(",
")",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"test",
")",
"{",
"return",
"parent",
"::",
"move",
"(",
"$... | Moves the file to a new location.
@param string $directory The destination folder
@param string $name The new file name
@return File A File object representing the new file
@throws FileException if, for any reason, the file could not have been moved | [
"Moves",
"the",
"file",
"to",
"a",
"new",
"location",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpFoundation/File/UploadedFile.php#L198-L237 | train | Moves the file to the target directory | [
30522,
2270,
3853,
2693,
1006,
1002,
14176,
1010,
1002,
2171,
1027,
19701,
1007,
1063,
2065,
1006,
1002,
2023,
1011,
1028,
2003,
10175,
3593,
1006,
1007,
1007,
1063,
2065,
1006,
1002,
2023,
1011,
1028,
3231,
1007,
1063,
2709,
6687,
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... |
laravel/framework | src/Illuminate/Routing/Router.php | Router.convertToControllerAction | protected function convertToControllerAction($action)
{
if (is_string($action)) {
$action = ['uses' => $action];
}
// Here we'll merge any group "uses" statement if necessary so that the action
// has the proper clause for this property. Then we can simply set the name
// of the controller on the action and return the action array for usage.
if (! empty($this->groupStack)) {
$action['uses'] = $this->prependGroupNamespace($action['uses']);
}
// Here we will set this controller name on the action array just so we always
// have a copy of it for reference if we need it. This can be used while we
// search for a controller name or do some other type of fetch operation.
$action['controller'] = $action['uses'];
return $action;
} | php | protected function convertToControllerAction($action)
{
if (is_string($action)) {
$action = ['uses' => $action];
}
// Here we'll merge any group "uses" statement if necessary so that the action
// has the proper clause for this property. Then we can simply set the name
// of the controller on the action and return the action array for usage.
if (! empty($this->groupStack)) {
$action['uses'] = $this->prependGroupNamespace($action['uses']);
}
// Here we will set this controller name on the action array just so we always
// have a copy of it for reference if we need it. This can be used while we
// search for a controller name or do some other type of fetch operation.
$action['controller'] = $action['uses'];
return $action;
} | [
"protected",
"function",
"convertToControllerAction",
"(",
"$",
"action",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"action",
")",
")",
"{",
"$",
"action",
"=",
"[",
"'uses'",
"=>",
"$",
"action",
"]",
";",
"}",
"// Here we'll merge any group \"uses\" statem... | Add a controller based route action to the action array.
@param array|string $action
@return array | [
"Add",
"a",
"controller",
"based",
"route",
"action",
"to",
"the",
"action",
"array",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Routing/Router.php#L502-L521 | train | Converts a string to a controller action array | [
30522,
5123,
3853,
10463,
3406,
8663,
13181,
10820,
18908,
3258,
1006,
1002,
2895,
1007,
1063,
2065,
1006,
2003,
1035,
5164,
1006,
1002,
2895,
1007,
1007,
1063,
1002,
2895,
1027,
1031,
1005,
3594,
1005,
1027,
1028,
1002,
2895,
1033,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/Referrers/SearchEngine.php | SearchEngine.getUrlFromName | public function getUrlFromName($name)
{
$searchEngineNames = $this->getNames();
if (isset($searchEngineNames[$name])) {
$url = 'http://' . $searchEngineNames[$name];
} else {
$url = 'URL unknown!';
}
return $url;
} | php | public function getUrlFromName($name)
{
$searchEngineNames = $this->getNames();
if (isset($searchEngineNames[$name])) {
$url = 'http://' . $searchEngineNames[$name];
} else {
$url = 'URL unknown!';
}
return $url;
} | [
"public",
"function",
"getUrlFromName",
"(",
"$",
"name",
")",
"{",
"$",
"searchEngineNames",
"=",
"$",
"this",
"->",
"getNames",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"searchEngineNames",
"[",
"$",
"name",
"]",
")",
")",
"{",
"$",
"url",
"=",... | Return search engine URL by name
@see core/DataFiles/SearchEnginges.php
@param string $name
@return string URL | [
"Return",
"search",
"engine",
"URL",
"by",
"name"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Referrers/SearchEngine.php#L429-L438 | train | Get Search Engine URL from Name | [
30522,
2270,
3853,
2131,
3126,
10270,
21716,
18442,
1006,
1002,
2171,
1007,
1063,
1002,
3945,
13159,
21820,
14074,
2015,
1027,
1002,
2023,
1011,
1028,
2131,
18442,
2015,
1006,
1007,
1025,
2065,
1006,
26354,
3388,
1006,
1002,
3945,
13159,
21... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Validator/Constraints/IsTrueValidator.php | IsTrueValidator.validate | public function validate($value, Constraint $constraint)
{
if (!$constraint instanceof IsTrue) {
throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\IsTrue');
}
if (null === $value) {
return;
}
if (true !== $value && 1 !== $value && '1' !== $value) {
$this->context->buildViolation($constraint->message)
->setParameter('{{ value }}', $this->formatValue($value))
->setCode(IsTrue::NOT_TRUE_ERROR)
->addViolation();
}
} | php | public function validate($value, Constraint $constraint)
{
if (!$constraint instanceof IsTrue) {
throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\IsTrue');
}
if (null === $value) {
return;
}
if (true !== $value && 1 !== $value && '1' !== $value) {
$this->context->buildViolation($constraint->message)
->setParameter('{{ value }}', $this->formatValue($value))
->setCode(IsTrue::NOT_TRUE_ERROR)
->addViolation();
}
} | [
"public",
"function",
"validate",
"(",
"$",
"value",
",",
"Constraint",
"$",
"constraint",
")",
"{",
"if",
"(",
"!",
"$",
"constraint",
"instanceof",
"IsTrue",
")",
"{",
"throw",
"new",
"UnexpectedTypeException",
"(",
"$",
"constraint",
",",
"__NAMESPACE__",
... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Validator/Constraints/IsTrueValidator.php#L26-L42 | train | Validate if the value is true | [
30522,
2270,
3853,
9398,
3686,
1006,
1002,
3643,
1010,
27142,
1002,
27142,
1007,
1063,
2065,
1006,
999,
1002,
27142,
6013,
11253,
21541,
6820,
2063,
1007,
1063,
5466,
2047,
9223,
13874,
10288,
24422,
1006,
1002,
30524,
1065,
2065,
1006,
197... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Support/Collection.php | Collection.keyBy | public function keyBy($keyBy)
{
$keyBy = $this->valueRetriever($keyBy);
$results = [];
foreach ($this->items as $key => $item) {
$resolvedKey = $keyBy($item, $key);
if (is_object($resolvedKey)) {
$resolvedKey = (string) $resolvedKey;
}
$results[$resolvedKey] = $item;
}
return new static($results);
} | php | public function keyBy($keyBy)
{
$keyBy = $this->valueRetriever($keyBy);
$results = [];
foreach ($this->items as $key => $item) {
$resolvedKey = $keyBy($item, $key);
if (is_object($resolvedKey)) {
$resolvedKey = (string) $resolvedKey;
}
$results[$resolvedKey] = $item;
}
return new static($results);
} | [
"public",
"function",
"keyBy",
"(",
"$",
"keyBy",
")",
"{",
"$",
"keyBy",
"=",
"$",
"this",
"->",
"valueRetriever",
"(",
"$",
"keyBy",
")",
";",
"$",
"results",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"items",
"as",
"$",
"key",
"=>... | Key an associative array by a field or using a callback.
@param callable|string $keyBy
@return static | [
"Key",
"an",
"associative",
"array",
"by",
"a",
"field",
"or",
"using",
"a",
"callback",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Support/Collection.php#L935-L952 | train | Key By Method | [
30522,
2270,
3853,
3145,
3762,
1006,
1002,
3145,
3762,
1007,
1063,
1002,
3145,
3762,
1027,
1002,
2023,
1011,
1028,
3643,
13465,
7373,
6299,
1006,
1002,
3145,
3762,
1007,
1025,
1002,
3463,
1027,
1031,
1033,
1025,
18921,
6776,
1006,
1002,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Routing/RouteRegistrar.php | RouteRegistrar.compileAction | protected function compileAction($action)
{
if (is_null($action)) {
return $this->attributes;
}
if (is_string($action) || $action instanceof Closure) {
$action = ['uses' => $action];
}
return array_merge($this->attributes, $action);
} | php | protected function compileAction($action)
{
if (is_null($action)) {
return $this->attributes;
}
if (is_string($action) || $action instanceof Closure) {
$action = ['uses' => $action];
}
return array_merge($this->attributes, $action);
} | [
"protected",
"function",
"compileAction",
"(",
"$",
"action",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"action",
")",
")",
"{",
"return",
"$",
"this",
"->",
"attributes",
";",
"}",
"if",
"(",
"is_string",
"(",
"$",
"action",
")",
"||",
"$",
"action"... | Compile the action into an array including the attributes.
@param \Closure|array|string|null $action
@return array | [
"Compile",
"the",
"action",
"into",
"an",
"array",
"including",
"the",
"attributes",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Routing/RouteRegistrar.php#L160-L171 | train | Compile action into array | [
30522,
5123,
3853,
4012,
22090,
18908,
3258,
1006,
1002,
2895,
1007,
1063,
2065,
1006,
2003,
1035,
19701,
1006,
1002,
2895,
1007,
1007,
1063,
2709,
1002,
2023,
1011,
1028,
12332,
1025,
1065,
2065,
1006,
2003,
1035,
5164,
1006,
1002,
2895,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Container.php | HTML_QuickForm2_Container.getValue | public function getValue()
{
$values = array();
foreach ($this as $child) {
$value = $child->getValue();
if (null !== $value) {
if ($child instanceof HTML_QuickForm2_Container
&& !$child->prependsName()
) {
$values = self::arrayMerge($values, $value);
} else {
$name = $child->getName();
if (!strpos($name, '[')) {
$values[$name] = $value;
} else {
$tokens = explode('[', str_replace(']', '', $name));
$valueAry =& $values;
do {
$token = array_shift($tokens);
if (!isset($valueAry[$token])) {
$valueAry[$token] = array();
}
$valueAry =& $valueAry[$token];
} while (count($tokens) > 1);
$valueAry[$tokens[0]] = $value;
}
}
}
}
return empty($values)? null: $this->applyFilters($values);
} | php | public function getValue()
{
$values = array();
foreach ($this as $child) {
$value = $child->getValue();
if (null !== $value) {
if ($child instanceof HTML_QuickForm2_Container
&& !$child->prependsName()
) {
$values = self::arrayMerge($values, $value);
} else {
$name = $child->getName();
if (!strpos($name, '[')) {
$values[$name] = $value;
} else {
$tokens = explode('[', str_replace(']', '', $name));
$valueAry =& $values;
do {
$token = array_shift($tokens);
if (!isset($valueAry[$token])) {
$valueAry[$token] = array();
}
$valueAry =& $valueAry[$token];
} while (count($tokens) > 1);
$valueAry[$tokens[0]] = $value;
}
}
}
}
return empty($values)? null: $this->applyFilters($values);
} | [
"public",
"function",
"getValue",
"(",
")",
"{",
"$",
"values",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"as",
"$",
"child",
")",
"{",
"$",
"value",
"=",
"$",
"child",
"->",
"getValue",
"(",
")",
";",
"if",
"(",
"null",
"!==",
... | Returns the element's value
The default implementation for Containers is to return an array with
contained elements' values. The array is indexed the same way $_GET and
$_POST arrays would be for these elements.
@return array|null | [
"Returns",
"the",
"element",
"s",
"value"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/HTML/QuickForm2/Container.php#L115-L145 | train | Returns the value of the form element | [
30522,
2270,
3853,
2131,
10175,
5657,
1006,
1007,
1063,
1002,
5300,
1027,
9140,
1006,
1007,
1025,
18921,
6776,
1006,
1002,
2023,
2004,
1002,
2775,
1007,
1063,
1002,
3643,
1027,
1002,
2775,
1011,
1028,
2131,
10175,
5657,
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/Intl/NumberFormatter/NumberFormatter.php | NumberFormatter.getInt64Value | private function getInt64Value($value)
{
if ($value > self::$int64Max || $value < -self::$int64Max - 1) {
return false;
}
if (PHP_INT_SIZE !== 8 && ($value > self::$int32Max || $value < -self::$int32Max - 1)) {
return (float) $value;
}
return (int) $value;
} | php | private function getInt64Value($value)
{
if ($value > self::$int64Max || $value < -self::$int64Max - 1) {
return false;
}
if (PHP_INT_SIZE !== 8 && ($value > self::$int32Max || $value < -self::$int32Max - 1)) {
return (float) $value;
}
return (int) $value;
} | [
"private",
"function",
"getInt64Value",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"value",
">",
"self",
"::",
"$",
"int64Max",
"||",
"$",
"value",
"<",
"-",
"self",
"::",
"$",
"int64Max",
"-",
"1",
")",
"{",
"return",
"false",
";",
"}",
"if",
... | Convert the value data type to int or returns false if the value is out of the integer value range.
@param mixed $value The value to be converted
@return int|float|false The converted value | [
"Convert",
"the",
"value",
"data",
"type",
"to",
"int",
"or",
"returns",
"false",
"if",
"the",
"value",
"is",
"out",
"of",
"the",
"integer",
"value",
"range",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php#L836-L847 | train | Get the value of the int64 field | [
30522,
2797,
3853,
2131,
18447,
21084,
10175,
5657,
1006,
1002,
3643,
1007,
1063,
2065,
1006,
1002,
3643,
1028,
2969,
1024,
1024,
1002,
20014,
21084,
17848,
1064,
1064,
1002,
3643,
1026,
1011,
2969,
1024,
1024,
1002,
20014,
21084,
17848,
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... |
getgrav/grav | system/src/Grav/Common/Page/Page.php | Page.getMediaOrder | public function getMediaOrder()
{
$header = $this->header();
return isset($header->media_order) ? array_map('trim', explode(',', (string)$header->media_order)) : [];
} | php | public function getMediaOrder()
{
$header = $this->header();
return isset($header->media_order) ? array_map('trim', explode(',', (string)$header->media_order)) : [];
} | [
"public",
"function",
"getMediaOrder",
"(",
")",
"{",
"$",
"header",
"=",
"$",
"this",
"->",
"header",
"(",
")",
";",
"return",
"isset",
"(",
"$",
"header",
"->",
"media_order",
")",
"?",
"array_map",
"(",
"'trim'",
",",
"explode",
"(",
"','",
",",
"... | Get display order for the associated media.
@return array Empty array means default ordering. | [
"Get",
"display",
"order",
"for",
"the",
"associated",
"media",
"."
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L1312-L1317 | train | Get the media order of the page | [
30522,
2270,
3853,
2131,
16969,
8551,
2121,
1006,
1007,
1063,
1002,
20346,
1027,
1002,
2023,
1011,
1028,
20346,
1006,
1007,
1025,
2709,
26354,
3388,
1006,
1002,
20346,
1011,
1028,
2865,
1035,
2344,
1007,
1029,
9140,
1035,
4949,
1006,
1005,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/thrift | lib/php/lib/Transport/TFramedTransport.php | TFramedTransport.write | public function write($buf, $len = null)
{
if (!$this->write_) {
return $this->transport_->write($buf, $len);
}
if ($len !== null && $len < TStringFuncFactory::create()->strlen($buf)) {
$buf = TStringFuncFactory::create()->substr($buf, 0, $len);
}
$this->wBuf_ .= $buf;
} | php | public function write($buf, $len = null)
{
if (!$this->write_) {
return $this->transport_->write($buf, $len);
}
if ($len !== null && $len < TStringFuncFactory::create()->strlen($buf)) {
$buf = TStringFuncFactory::create()->substr($buf, 0, $len);
}
$this->wBuf_ .= $buf;
} | [
"public",
"function",
"write",
"(",
"$",
"buf",
",",
"$",
"len",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"write_",
")",
"{",
"return",
"$",
"this",
"->",
"transport_",
"->",
"write",
"(",
"$",
"buf",
",",
"$",
"len",
")",
";",... | Writes some data to the pending output buffer.
@param string $buf The data
@param int $len Limit of bytes to write | [
"Writes",
"some",
"data",
"to",
"the",
"pending",
"output",
"buffer",
"."
] | acdd4226c210336e9e15eb812e5932a645fcd5ce | https://github.com/apache/thrift/blob/acdd4226c210336e9e15eb812e5932a645fcd5ce/lib/php/lib/Transport/TFramedTransport.php#L160-L170 | train | Write data to the socket. | [
30522,
2270,
3853,
4339,
1006,
1002,
20934,
2546,
1010,
1002,
18798,
1027,
19701,
1007,
1063,
2065,
1006,
999,
1002,
2023,
1011,
1028,
4339,
1035,
1007,
1063,
2709,
1002,
2023,
1011,
1028,
3665,
1035,
1011,
1028,
4339,
1006,
1002,
20934,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Rules/DatabaseRule.php | DatabaseRule.whereNotIn | public function whereNotIn($column, array $values)
{
return $this->where(function ($query) use ($column, $values) {
$query->whereNotIn($column, $values);
});
} | php | public function whereNotIn($column, array $values)
{
return $this->where(function ($query) use ($column, $values) {
$query->whereNotIn($column, $values);
});
} | [
"public",
"function",
"whereNotIn",
"(",
"$",
"column",
",",
"array",
"$",
"values",
")",
"{",
"return",
"$",
"this",
"->",
"where",
"(",
"function",
"(",
"$",
"query",
")",
"use",
"(",
"$",
"column",
",",
"$",
"values",
")",
"{",
"$",
"query",
"->... | Set a "where not in" constraint on the query.
@param string $column
@param array $values
@return $this | [
"Set",
"a",
"where",
"not",
"in",
"constraint",
"on",
"the",
"query",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Validation/Rules/DatabaseRule.php#L131-L136 | train | Devuelve el query de la consulta en base a un array | [
30522,
2270,
3853,
2073,
17048,
2378,
1006,
1002,
5930,
1010,
9140,
1002,
5300,
1007,
1063,
2709,
1002,
2023,
1011,
1028,
2073,
1006,
3853,
1006,
1002,
23032,
1007,
2224,
1006,
1002,
5930,
1010,
1002,
5300,
1007,
1063,
1002,
23032,
1011,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/Zend/Mail.php | Zend_Mail.addTo | public function addTo($email, $name='')
{
if (!is_array($email)) {
$email = array($name => $email);
}
foreach ($email as $n => $recipient) {
$this->_addRecipientAndHeader('To', $recipient, is_int($n) ? '' : $n);
$this->_to[] = $recipient;
}
return $this;
} | php | public function addTo($email, $name='')
{
if (!is_array($email)) {
$email = array($name => $email);
}
foreach ($email as $n => $recipient) {
$this->_addRecipientAndHeader('To', $recipient, is_int($n) ? '' : $n);
$this->_to[] = $recipient;
}
return $this;
} | [
"public",
"function",
"addTo",
"(",
"$",
"email",
",",
"$",
"name",
"=",
"''",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"email",
")",
")",
"{",
"$",
"email",
"=",
"array",
"(",
"$",
"name",
"=>",
"$",
"email",
")",
";",
"}",
"foreach",
... | Adds To-header and recipient, $email can be an array, or a single string address
@param string|array $email
@param string $name
@return Zend_Mail Provides fluent interface | [
"Adds",
"To",
"-",
"header",
"and",
"recipient",
"$email",
"can",
"be",
"an",
"array",
"or",
"a",
"single",
"string",
"address"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Mail.php#L571-L583 | train | Add To To | [
30522,
2270,
3853,
5587,
3406,
1006,
1002,
10373,
1010,
30524,
1027,
1028,
1002,
7799,
1007,
1063,
1002,
2023,
1011,
1028,
1035,
5587,
2890,
6895,
14756,
12380,
4859,
4974,
2121,
1006,
1005,
2000,
1005,
1010,
1002,
7799,
1010,
2003,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/SEO/Metric/DomainAge.php | DomainAge.getAgeArchiveOrg | private function getAgeArchiveOrg($domain)
{
$response = $this->getUrl('https://archive.org/wayback/available?timestamp=19900101&url=' . urlencode($domain));
$data = json_decode($response, true);
if (empty($data["archived_snapshots"]["closest"]["timestamp"])) {
return 0;
}
return strtotime($data["archived_snapshots"]["closest"]["timestamp"]);
} | php | private function getAgeArchiveOrg($domain)
{
$response = $this->getUrl('https://archive.org/wayback/available?timestamp=19900101&url=' . urlencode($domain));
$data = json_decode($response, true);
if (empty($data["archived_snapshots"]["closest"]["timestamp"])) {
return 0;
}
return strtotime($data["archived_snapshots"]["closest"]["timestamp"]);
} | [
"private",
"function",
"getAgeArchiveOrg",
"(",
"$",
"domain",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"getUrl",
"(",
"'https://archive.org/wayback/available?timestamp=19900101&url='",
".",
"urlencode",
"(",
"$",
"domain",
")",
")",
";",
"$",
"data",
... | Returns the domain age archive.org lists for the current url
@param string $domain
@return int | [
"Returns",
"the",
"domain",
"age",
"archive",
".",
"org",
"lists",
"for",
"the",
"current",
"url"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/SEO/Metric/DomainAge.php#L75-L83 | train | Get age archive. org | [
30522,
2797,
3853,
2131,
4270,
2906,
5428,
3726,
21759,
1006,
1002,
5884,
1007,
1063,
1002,
3433,
1027,
1002,
2023,
1011,
1028,
2131,
3126,
2140,
1006,
1005,
16770,
1024,
1013,
1013,
8756,
1012,
8917,
1013,
2126,
5963,
1013,
2800,
1029,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
z-song/laravel-admin | src/Grid/Filter/Group.php | Group.condition | public function condition($inputs)
{
$value = Arr::get($inputs, $this->column);
if (!isset($value)) {
return;
}
$this->value = $value;
$group = Arr::get($inputs, "{$this->id}_group");
call_user_func($this->builder, $this);
if ($query = $this->group->get($group)) {
return $this->buildCondition(...$query['condition']);
}
} | php | public function condition($inputs)
{
$value = Arr::get($inputs, $this->column);
if (!isset($value)) {
return;
}
$this->value = $value;
$group = Arr::get($inputs, "{$this->id}_group");
call_user_func($this->builder, $this);
if ($query = $this->group->get($group)) {
return $this->buildCondition(...$query['condition']);
}
} | [
"public",
"function",
"condition",
"(",
"$",
"inputs",
")",
"{",
"$",
"value",
"=",
"Arr",
"::",
"get",
"(",
"$",
"inputs",
",",
"$",
"this",
"->",
"column",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"value",
")",
")",
"{",
"return",
";",
"}... | {@inheritdoc} | [
"{"
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid/Filter/Group.php#L263-L280 | train | Build the condition for the current field. | [
30522,
2270,
3853,
4650,
1006,
1002,
20407,
1007,
1063,
1002,
3643,
1027,
12098,
2099,
1024,
1024,
2131,
1006,
1002,
20407,
1010,
1002,
2023,
1011,
1028,
5930,
1007,
1025,
2065,
1006,
999,
26354,
3388,
1006,
1002,
3643,
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... |
octobercms/october | modules/backend/widgets/Table.php | Table.prepareVars | public function prepareVars()
{
$this->vars['columns'] = $this->prepareColumnsArray();
$this->vars['recordsKeyFrom'] = $this->recordsKeyFrom;
$this->vars['recordsPerPage'] = $this->getConfig('recordsPerPage', false) ?: 'false';
$this->vars['postbackHandlerName'] = $this->getConfig('postbackHandlerName', 'onSave');
$this->vars['searching'] = $this->getConfig('searching', false);
$this->vars['adding'] = $this->getConfig('adding', true);
$this->vars['deleting'] = $this->getConfig('deleting', true);
$this->vars['toolbar'] = $this->getConfig('toolbar', true);
$this->vars['height'] = $this->getConfig('height', false) ?: 'false';
$this->vars['dynamicHeight'] = $this->getConfig('dynamicHeight', false) ?: 'false';
$this->vars['btnAddRowLabel'] = Lang::get($this->getConfig('btnAddRowLabel', 'backend::lang.form.insert_row'));
$this->vars['btnAddRowBelowLabel'] = Lang::get($this->getConfig('btnAddRowBelowLabel', 'backend::lang.form.insert_row_below'));
$this->vars['btnDeleteRowLabel'] = Lang::get($this->getConfig('btnDeleteRowLabel', 'backend::lang.form.delete_row'));
$isClientDataSource = $this->isClientDataSource();
$this->vars['clientDataSourceClass'] = $isClientDataSource ? 'client' : 'server';
$this->vars['data'] = json_encode($isClientDataSource
? $this->dataSource->getAllRecords()
: []
);
} | php | public function prepareVars()
{
$this->vars['columns'] = $this->prepareColumnsArray();
$this->vars['recordsKeyFrom'] = $this->recordsKeyFrom;
$this->vars['recordsPerPage'] = $this->getConfig('recordsPerPage', false) ?: 'false';
$this->vars['postbackHandlerName'] = $this->getConfig('postbackHandlerName', 'onSave');
$this->vars['searching'] = $this->getConfig('searching', false);
$this->vars['adding'] = $this->getConfig('adding', true);
$this->vars['deleting'] = $this->getConfig('deleting', true);
$this->vars['toolbar'] = $this->getConfig('toolbar', true);
$this->vars['height'] = $this->getConfig('height', false) ?: 'false';
$this->vars['dynamicHeight'] = $this->getConfig('dynamicHeight', false) ?: 'false';
$this->vars['btnAddRowLabel'] = Lang::get($this->getConfig('btnAddRowLabel', 'backend::lang.form.insert_row'));
$this->vars['btnAddRowBelowLabel'] = Lang::get($this->getConfig('btnAddRowBelowLabel', 'backend::lang.form.insert_row_below'));
$this->vars['btnDeleteRowLabel'] = Lang::get($this->getConfig('btnDeleteRowLabel', 'backend::lang.form.delete_row'));
$isClientDataSource = $this->isClientDataSource();
$this->vars['clientDataSourceClass'] = $isClientDataSource ? 'client' : 'server';
$this->vars['data'] = json_encode($isClientDataSource
? $this->dataSource->getAllRecords()
: []
);
} | [
"public",
"function",
"prepareVars",
"(",
")",
"{",
"$",
"this",
"->",
"vars",
"[",
"'columns'",
"]",
"=",
"$",
"this",
"->",
"prepareColumnsArray",
"(",
")",
";",
"$",
"this",
"->",
"vars",
"[",
"'recordsKeyFrom'",
"]",
"=",
"$",
"this",
"->",
"record... | Prepares the view data | [
"Prepares",
"the",
"view",
"data"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/Table.php#L117-L142 | train | Prepares the form variables | [
30522,
2270,
3853,
7374,
10755,
2015,
1006,
1007,
1063,
1002,
2023,
1011,
1028,
13075,
2015,
1031,
1005,
7753,
1005,
1033,
1027,
1002,
2023,
1011,
1028,
7374,
25778,
2819,
3619,
2906,
9447,
1006,
1007,
1025,
1002,
2023,
1011,
1028,
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... |
matomo-org/matomo | libs/HTML/QuickForm2/Node.php | HTML_QuickForm2_Node.setId | public function setId($id = null)
{
if (is_null($id)) {
$id = self::generateId($this->getName());
} else {
self::storeId($id);
}
$this->attributes['id'] = (string)$id;
return $this;
} | php | public function setId($id = null)
{
if (is_null($id)) {
$id = self::generateId($this->getName());
} else {
self::storeId($id);
}
$this->attributes['id'] = (string)$id;
return $this;
} | [
"public",
"function",
"setId",
"(",
"$",
"id",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"id",
")",
")",
"{",
"$",
"id",
"=",
"self",
"::",
"generateId",
"(",
"$",
"this",
"->",
"getName",
"(",
")",
")",
";",
"}",
"else",
"{",
"s... | Sets the elements id
Please note that elements should always have an id in QuickForm2 and
therefore it will not be possible to remove the element's id or set it to
an empty value. If id is not explicitly given, it will be autogenerated.
@param string Element's id, will be autogenerated if not given
@return HTML_QuickForm2_Node | [
"Sets",
"the",
"elements",
"id"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/HTML/QuickForm2/Node.php#L328-L337 | train | Set the id of the language | [
30522,
2270,
3853,
2275,
3593,
1006,
1002,
8909,
1027,
19701,
1007,
1063,
2065,
1006,
2003,
1035,
19701,
1006,
1002,
8909,
1007,
1007,
1063,
1002,
8909,
1027,
2969,
1024,
1024,
9699,
3593,
1006,
1002,
2023,
1011,
1028,
2131,
18442,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/Tracker/Db/Mysqli.php | Mysqli.beginTransaction | public function beginTransaction()
{
if (!$this->activeTransaction === false) {
return;
}
if ($this->connection->autocommit(false)) {
$this->activeTransaction = uniqid();
return $this->activeTransaction;
}
} | php | public function beginTransaction()
{
if (!$this->activeTransaction === false) {
return;
}
if ($this->connection->autocommit(false)) {
$this->activeTransaction = uniqid();
return $this->activeTransaction;
}
} | [
"public",
"function",
"beginTransaction",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"activeTransaction",
"===",
"false",
")",
"{",
"return",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"connection",
"->",
"autocommit",
"(",
"false",
")",
")",
"{",
... | Start Transaction
@return string TransactionID | [
"Start",
"Transaction"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Tracker/Db/Mysqli.php#L335-L345 | train | Transaction start | [
30522,
2270,
3853,
4088,
6494,
3619,
18908,
3258,
1006,
1007,
1063,
2065,
1006,
999,
1002,
2023,
1011,
1028,
3161,
6494,
3619,
18908,
3258,
1027,
1027,
1027,
6270,
1007,
1063,
2709,
1025,
1065,
2065,
1006,
1002,
2023,
1011,
1028,
4434,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/Login/Auth.php | Auth.setPassword | public function setPassword($password)
{
if (empty($password)) {
$this->hashedPassword = null;
} else {
$this->hashedPassword = UsersManager::getPasswordHash($password);
}
} | php | public function setPassword($password)
{
if (empty($password)) {
$this->hashedPassword = null;
} else {
$this->hashedPassword = UsersManager::getPasswordHash($password);
}
} | [
"public",
"function",
"setPassword",
"(",
"$",
"password",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"password",
")",
")",
"{",
"$",
"this",
"->",
"hashedPassword",
"=",
"null",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"hashedPassword",
"=",
"UsersManag... | Sets the password to authenticate with.
@param string $password | [
"Sets",
"the",
"password",
"to",
"authenticate",
"with",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Login/Auth.php#L169-L176 | train | Set the password | [
30522,
2270,
3853,
2275,
15194,
18351,
1006,
1002,
20786,
1007,
1063,
2065,
1006,
4064,
1006,
1002,
20786,
1007,
1007,
1063,
1002,
2023,
1011,
1028,
23325,
2098,
15194,
18351,
1027,
19701,
1025,
1065,
2842,
1063,
1002,
2023,
1011,
1028,
233... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Foundation/Console/MailMakeCommand.php | MailMakeCommand.writeMarkdownTemplate | protected function writeMarkdownTemplate()
{
$path = resource_path('views/'.str_replace('.', '/', $this->option('markdown'))).'.blade.php';
if (! $this->files->isDirectory(dirname($path))) {
$this->files->makeDirectory(dirname($path), 0755, true);
}
$this->files->put($path, file_get_contents(__DIR__.'/stubs/markdown.stub'));
} | php | protected function writeMarkdownTemplate()
{
$path = resource_path('views/'.str_replace('.', '/', $this->option('markdown'))).'.blade.php';
if (! $this->files->isDirectory(dirname($path))) {
$this->files->makeDirectory(dirname($path), 0755, true);
}
$this->files->put($path, file_get_contents(__DIR__.'/stubs/markdown.stub'));
} | [
"protected",
"function",
"writeMarkdownTemplate",
"(",
")",
"{",
"$",
"path",
"=",
"resource_path",
"(",
"'views/'",
".",
"str_replace",
"(",
"'.'",
",",
"'/'",
",",
"$",
"this",
"->",
"option",
"(",
"'markdown'",
")",
")",
")",
".",
"'.blade.php'",
";",
... | Write the Markdown template for the mailable.
@return void | [
"Write",
"the",
"Markdown",
"template",
"for",
"the",
"mailable",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Foundation/Console/MailMakeCommand.php#L52-L61 | train | Write the Markdown template to the files directory | [
30522,
5123,
3853,
4339,
10665,
7698,
18532,
15725,
1006,
1007,
1063,
1002,
4130,
1027,
7692,
1035,
4130,
1006,
1005,
5328,
1013,
1005,
1012,
2358,
2099,
1035,
5672,
1006,
1005,
1012,
1005,
1010,
1005,
1013,
1005,
1010,
1002,
2023,
1011,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Translation/MessageSelector.php | MessageSelector.extractFromString | private function extractFromString($part, $number)
{
preg_match('/^[\{\[]([^\[\]\{\}]*)[\}\]](.*)/s', $part, $matches);
if (count($matches) !== 3) {
return;
}
$condition = $matches[1];
$value = $matches[2];
if (Str::contains($condition, ',')) {
[$from, $to] = explode(',', $condition, 2);
if ($to === '*' && $number >= $from) {
return $value;
} elseif ($from === '*' && $number <= $to) {
return $value;
} elseif ($number >= $from && $number <= $to) {
return $value;
}
}
return $condition == $number ? $value : null;
} | php | private function extractFromString($part, $number)
{
preg_match('/^[\{\[]([^\[\]\{\}]*)[\}\]](.*)/s', $part, $matches);
if (count($matches) !== 3) {
return;
}
$condition = $matches[1];
$value = $matches[2];
if (Str::contains($condition, ',')) {
[$from, $to] = explode(',', $condition, 2);
if ($to === '*' && $number >= $from) {
return $value;
} elseif ($from === '*' && $number <= $to) {
return $value;
} elseif ($number >= $from && $number <= $to) {
return $value;
}
}
return $condition == $number ? $value : null;
} | [
"private",
"function",
"extractFromString",
"(",
"$",
"part",
",",
"$",
"number",
")",
"{",
"preg_match",
"(",
"'/^[\\{\\[]([^\\[\\]\\{\\}]*)[\\}\\]](.*)/s'",
",",
"$",
"part",
",",
"$",
"matches",
")",
";",
"if",
"(",
"count",
"(",
"$",
"matches",
")",
"!==... | Get the translation string if the condition matches.
@param string $part
@param int $number
@return mixed | [
"Get",
"the",
"translation",
"string",
"if",
"the",
"condition",
"matches",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Translation/MessageSelector.php#L59-L84 | train | Extract from string | [
30522,
2797,
3853,
14817,
19699,
22225,
18886,
3070,
1006,
1002,
2112,
1010,
1002,
2193,
1007,
1063,
3653,
2290,
1035,
2674,
1006,
1005,
1013,
1034,
1031,
1032,
1063,
1032,
1031,
1033,
1006,
1031,
1034,
1032,
1031,
1032,
1033,
1032,
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/Loader/XmlFileLoader.php | XmlFileLoader.parseParameters | private function parseParameters(\DOMDocument $xml, $file)
{
if ($parameters = $this->getChildren($xml->documentElement, 'parameters')) {
$this->container->getParameterBag()->add($this->getArgumentsAsPhp($parameters[0], 'parameter', $file));
}
} | php | private function parseParameters(\DOMDocument $xml, $file)
{
if ($parameters = $this->getChildren($xml->documentElement, 'parameters')) {
$this->container->getParameterBag()->add($this->getArgumentsAsPhp($parameters[0], 'parameter', $file));
}
} | [
"private",
"function",
"parseParameters",
"(",
"\\",
"DOMDocument",
"$",
"xml",
",",
"$",
"file",
")",
"{",
"if",
"(",
"$",
"parameters",
"=",
"$",
"this",
"->",
"getChildren",
"(",
"$",
"xml",
"->",
"documentElement",
",",
"'parameters'",
")",
")",
"{",... | Parses parameters.
@param \DOMDocument $xml
@param string $file | [
"Parses",
"parameters",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php#L94-L99 | train | Parse parameters in container | [
30522,
2797,
3853,
11968,
3366,
28689,
22828,
2015,
1006,
1032,
14383,
3527,
24894,
4765,
1002,
20950,
1010,
1002,
5371,
1007,
1063,
2065,
1006,
1002,
11709,
1027,
1002,
2023,
1011,
1028,
2131,
19339,
7389,
1006,
1002,
20950,
1011,
1028,
62... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.