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/DataTable.php | DataTable.getSerialized | public function getSerialized($maximumRowsInDataTable = null,
$maximumRowsInSubDataTable = null,
$columnToSortByBeforeTruncation = null,
&$aSerializedDataTable = array())
{
static $depth = 0;
// make sure subtableIds are consecutive from 1 to N
static $subtableId = 0;
if ($depth > self::$maximumDepthLevelAllowed) {
$depth = 0;
$subtableId = 0;
throw new Exception("Maximum recursion level of " . self::$maximumDepthLevelAllowed . " reached. Maybe you have set a DataTable\Row with an associated DataTable belonging already to one of its parent tables?");
}
if (!is_null($maximumRowsInDataTable)) {
$this->filter('Truncate',
array($maximumRowsInDataTable - 1,
DataTable::LABEL_SUMMARY_ROW,
$columnToSortByBeforeTruncation,
$filterRecursive = false)
);
}
$consecutiveSubtableIds = array();
$forcedId = $subtableId;
// For each row, get the serialized row
// If it is associated to a sub table, get the serialized table recursively ;
// but returns all serialized tables and subtable in an array of 1 dimension
foreach ($this->rows as $id => $row) {
$subTable = $row->getSubtable();
if ($subTable) {
$consecutiveSubtableIds[$id] = ++$subtableId;
$depth++;
$subTable->getSerialized($maximumRowsInSubDataTable, $maximumRowsInSubDataTable, $columnToSortByBeforeTruncation, $aSerializedDataTable);
$depth--;
} else {
$row->removeSubtable();
}
}
// if the datatable is the parent we force the Id at 0 (this is part of the specification)
if ($depth == 0) {
$forcedId = 0;
$subtableId = 0;
}
// we then serialize the rows and store them in the serialized dataTable
$rows = array();
foreach ($this->rows as $id => $row) {
if (isset($consecutiveSubtableIds[$id])) {
$backup = $row->subtableId;
$row->subtableId = $consecutiveSubtableIds[$id];
$rows[$id] = $row->export();
$row->subtableId = $backup;
} else {
$rows[$id] = $row->export();
}
}
if (isset($this->summaryRow)) {
$rows[self::ID_SUMMARY_ROW] = $this->summaryRow->export();
}
$aSerializedDataTable[$forcedId] = serialize($rows);
unset($rows);
return $aSerializedDataTable;
} | php | public function getSerialized($maximumRowsInDataTable = null,
$maximumRowsInSubDataTable = null,
$columnToSortByBeforeTruncation = null,
&$aSerializedDataTable = array())
{
static $depth = 0;
// make sure subtableIds are consecutive from 1 to N
static $subtableId = 0;
if ($depth > self::$maximumDepthLevelAllowed) {
$depth = 0;
$subtableId = 0;
throw new Exception("Maximum recursion level of " . self::$maximumDepthLevelAllowed . " reached. Maybe you have set a DataTable\Row with an associated DataTable belonging already to one of its parent tables?");
}
if (!is_null($maximumRowsInDataTable)) {
$this->filter('Truncate',
array($maximumRowsInDataTable - 1,
DataTable::LABEL_SUMMARY_ROW,
$columnToSortByBeforeTruncation,
$filterRecursive = false)
);
}
$consecutiveSubtableIds = array();
$forcedId = $subtableId;
// For each row, get the serialized row
// If it is associated to a sub table, get the serialized table recursively ;
// but returns all serialized tables and subtable in an array of 1 dimension
foreach ($this->rows as $id => $row) {
$subTable = $row->getSubtable();
if ($subTable) {
$consecutiveSubtableIds[$id] = ++$subtableId;
$depth++;
$subTable->getSerialized($maximumRowsInSubDataTable, $maximumRowsInSubDataTable, $columnToSortByBeforeTruncation, $aSerializedDataTable);
$depth--;
} else {
$row->removeSubtable();
}
}
// if the datatable is the parent we force the Id at 0 (this is part of the specification)
if ($depth == 0) {
$forcedId = 0;
$subtableId = 0;
}
// we then serialize the rows and store them in the serialized dataTable
$rows = array();
foreach ($this->rows as $id => $row) {
if (isset($consecutiveSubtableIds[$id])) {
$backup = $row->subtableId;
$row->subtableId = $consecutiveSubtableIds[$id];
$rows[$id] = $row->export();
$row->subtableId = $backup;
} else {
$rows[$id] = $row->export();
}
}
if (isset($this->summaryRow)) {
$rows[self::ID_SUMMARY_ROW] = $this->summaryRow->export();
}
$aSerializedDataTable[$forcedId] = serialize($rows);
unset($rows);
return $aSerializedDataTable;
} | [
"public",
"function",
"getSerialized",
"(",
"$",
"maximumRowsInDataTable",
"=",
"null",
",",
"$",
"maximumRowsInSubDataTable",
"=",
"null",
",",
"$",
"columnToSortByBeforeTruncation",
"=",
"null",
",",
"&",
"$",
"aSerializedDataTable",
"=",
"array",
"(",
")",
")",... | Serializes an entire DataTable hierarchy and returns the array of serialized DataTables.
The first element in the returned array will be the serialized representation of this DataTable.
Every subsequent element will be a serialized subtable.
This DataTable and subtables can optionally be truncated before being serialized. In most
cases where DataTables can become quite large, they should be truncated before being persisted
in an archive.
The result of this method is intended for use with the {@link ArchiveProcessor::insertBlobRecord()} method.
@throws Exception If infinite recursion detected. This will occur if a table's subtable is one of its parent tables.
@param int $maximumRowsInDataTable If not null, defines the maximum number of rows allowed in the serialized DataTable.
@param int $maximumRowsInSubDataTable If not null, defines the maximum number of rows allowed in serialized subtables.
@param string $columnToSortByBeforeTruncation The column to sort by before truncating, eg, `Metrics::INDEX_NB_VISITS`.
@param array $aSerializedDataTable Will contain all the output arrays
@return array The array of serialized DataTables:
array(
// this DataTable (the root)
0 => 'eghuighahgaueytae78yaet7yaetae',
// a subtable
1 => 'gaegae gh gwrh guiwh uigwhuige',
// another subtable
2 => 'gqegJHUIGHEQjkgneqjgnqeugUGEQHGUHQE',
// etc.
); | [
"Serializes",
"an",
"entire",
"DataTable",
"hierarchy",
"and",
"returns",
"the",
"array",
"of",
"serialized",
"DataTables",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/DataTable.php#L1280-L1348 | train | Returns the serialized datatable | [
30522,
2270,
3853,
4152,
11610,
28931,
1006,
1002,
4555,
10524,
11493,
2850,
29336,
3085,
1027,
19701,
1010,
1002,
4555,
10524,
11493,
6342,
2497,
2850,
29336,
3085,
1027,
19701,
1010,
1002,
5930,
13122,
11589,
3762,
4783,
29278,
3388,
15532,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/OptionsResolver/OptionsResolver.php | OptionsResolver.setRequired | public function setRequired($optionNames)
{
if ($this->locked) {
throw new AccessException('Options cannot be made required from a lazy option or normalizer.');
}
foreach ((array) $optionNames as $option) {
$this->defined[$option] = true;
$this->required[$option] = true;
}
return $this;
} | php | public function setRequired($optionNames)
{
if ($this->locked) {
throw new AccessException('Options cannot be made required from a lazy option or normalizer.');
}
foreach ((array) $optionNames as $option) {
$this->defined[$option] = true;
$this->required[$option] = true;
}
return $this;
} | [
"public",
"function",
"setRequired",
"(",
"$",
"optionNames",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"locked",
")",
"{",
"throw",
"new",
"AccessException",
"(",
"'Options cannot be made required from a lazy option or normalizer.'",
")",
";",
"}",
"foreach",
"(",
... | Marks one or more options as required.
@param string|string[] $optionNames One or more option names
@return $this
@throws AccessException If called from a lazy option or normalizer | [
"Marks",
"one",
"or",
"more",
"options",
"as",
"required",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/OptionsResolver/OptionsResolver.php#L274-L286 | train | Set required options | [
30522,
2270,
3853,
2275,
2890,
15549,
5596,
1006,
1002,
5724,
18442,
2015,
1007,
1063,
2065,
1006,
1002,
2023,
1011,
1028,
5299,
1007,
1063,
5466,
2047,
3229,
10288,
24422,
1006,
1005,
7047,
3685,
2022,
2081,
3223,
2013,
1037,
13971,
5724,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/backend/classes/Controller.php | Controller.pageAction | public function pageAction()
{
if (!$this->action) {
return;
}
$this->suppressView = true;
$this->execPageAction($this->action, $this->params);
} | php | public function pageAction()
{
if (!$this->action) {
return;
}
$this->suppressView = true;
$this->execPageAction($this->action, $this->params);
} | [
"public",
"function",
"pageAction",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"action",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"suppressView",
"=",
"true",
";",
"$",
"this",
"->",
"execPageAction",
"(",
"$",
"this",
"->",
"action",
... | Invokes the current controller action without rendering a view,
used by AJAX handler that may rely on the logic inside the action. | [
"Invokes",
"the",
"current",
"controller",
"action",
"without",
"rendering",
"a",
"view",
"used",
"by",
"AJAX",
"handler",
"that",
"may",
"rely",
"on",
"the",
"logic",
"inside",
"the",
"action",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/classes/Controller.php#L321-L329 | train | Page Action - Execute action | [
30522,
2270,
3853,
3931,
18908,
3258,
1006,
30524,
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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Database/Migrations/Migrator.php | Migrator.runDown | protected function runDown($file, $migration, $pretend)
{
// First we will get the file name of the migration so we can resolve out an
// instance of the migration. Once we get an instance we can either run a
// pretend execution of the migration or we can run the real migration.
$instance = $this->resolve(
$name = $this->getMigrationName($file)
);
$this->note("<comment>Rolling back:</comment> {$name}");
if ($pretend) {
return $this->pretendToRun($instance, 'down');
}
$this->runMigration($instance, 'down');
// Once we have successfully run the migration "down" we will remove it from
// the migration repository so it will be considered to have not been run
// by the application then will be able to fire by any later operation.
$this->repository->delete($migration);
$this->note("<info>Rolled back:</info> {$name}");
} | php | protected function runDown($file, $migration, $pretend)
{
// First we will get the file name of the migration so we can resolve out an
// instance of the migration. Once we get an instance we can either run a
// pretend execution of the migration or we can run the real migration.
$instance = $this->resolve(
$name = $this->getMigrationName($file)
);
$this->note("<comment>Rolling back:</comment> {$name}");
if ($pretend) {
return $this->pretendToRun($instance, 'down');
}
$this->runMigration($instance, 'down');
// Once we have successfully run the migration "down" we will remove it from
// the migration repository so it will be considered to have not been run
// by the application then will be able to fire by any later operation.
$this->repository->delete($migration);
$this->note("<info>Rolled back:</info> {$name}");
} | [
"protected",
"function",
"runDown",
"(",
"$",
"file",
",",
"$",
"migration",
",",
"$",
"pretend",
")",
"{",
"// First we will get the file name of the migration so we can resolve out an",
"// instance of the migration. Once we get an instance we can either run a",
"// pretend executi... | Run "down" a migration instance.
@param string $file
@param object $migration
@param bool $pretend
@return void | [
"Run",
"down",
"a",
"migration",
"instance",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Migrations/Migrator.php#L343-L366 | train | Runs the down migration | [
30522,
5123,
3853,
2448,
7698,
1006,
1002,
5371,
1010,
1002,
9230,
1010,
1002,
9811,
1007,
1063,
1013,
1013,
2034,
2057,
2097,
2131,
1996,
5371,
2171,
1997,
1996,
9230,
2061,
2057,
2064,
10663,
2041,
2019,
1013,
1013,
6013,
1997,
1996,
92... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/Zend/Session/SaveHandler/DbTable.php | Zend_Session_SaveHandler_DbTable._getPrimary | protected function _getPrimary($id, $type = null)
{
$this->_setupPrimaryKey();
if ($type === null) {
$type = self::PRIMARY_TYPE_NUM;
}
$primaryArray = array();
foreach ($this->_primary as $index => $primary) {
switch ($this->_primaryAssignment[$index]) {
case self::PRIMARY_ASSIGNMENT_SESSION_SAVE_PATH:
$value = $this->_sessionSavePath;
break;
case self::PRIMARY_ASSIGNMENT_SESSION_NAME:
$value = $this->_sessionName;
break;
case self::PRIMARY_ASSIGNMENT_SESSION_ID:
$value = (string) $id;
break;
default:
$value = (string) $this->_primaryAssignment[$index];
break;
}
switch ((string) $type) {
case self::PRIMARY_TYPE_PRIMARYNUM:
$primaryArray[$index] = $value;
break;
case self::PRIMARY_TYPE_ASSOC:
$primaryArray[$primary] = $value;
break;
case self::PRIMARY_TYPE_WHERECLAUSE:
$primaryArray[] = $this->getAdapter()->quoteIdentifier($primary, true) . ' = '
. $this->getAdapter()->quote($value);
break;
case self::PRIMARY_TYPE_NUM:
default:
$primaryArray[] = $value;
break;
}
}
return $primaryArray;
} | php | protected function _getPrimary($id, $type = null)
{
$this->_setupPrimaryKey();
if ($type === null) {
$type = self::PRIMARY_TYPE_NUM;
}
$primaryArray = array();
foreach ($this->_primary as $index => $primary) {
switch ($this->_primaryAssignment[$index]) {
case self::PRIMARY_ASSIGNMENT_SESSION_SAVE_PATH:
$value = $this->_sessionSavePath;
break;
case self::PRIMARY_ASSIGNMENT_SESSION_NAME:
$value = $this->_sessionName;
break;
case self::PRIMARY_ASSIGNMENT_SESSION_ID:
$value = (string) $id;
break;
default:
$value = (string) $this->_primaryAssignment[$index];
break;
}
switch ((string) $type) {
case self::PRIMARY_TYPE_PRIMARYNUM:
$primaryArray[$index] = $value;
break;
case self::PRIMARY_TYPE_ASSOC:
$primaryArray[$primary] = $value;
break;
case self::PRIMARY_TYPE_WHERECLAUSE:
$primaryArray[] = $this->getAdapter()->quoteIdentifier($primary, true) . ' = '
. $this->getAdapter()->quote($value);
break;
case self::PRIMARY_TYPE_NUM:
default:
$primaryArray[] = $value;
break;
}
}
return $primaryArray;
} | [
"protected",
"function",
"_getPrimary",
"(",
"$",
"id",
",",
"$",
"type",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"_setupPrimaryKey",
"(",
")",
";",
"if",
"(",
"$",
"type",
"===",
"null",
")",
"{",
"$",
"type",
"=",
"self",
"::",
"PRIMARY_TYPE_NUM"... | Retrieve session table primary key values
@param string $id
@param string $type (optional; default: self::PRIMARY_TYPE_NUM)
@return array | [
"Retrieve",
"session",
"table",
"primary",
"key",
"values"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Session/SaveHandler/DbTable.php#L517-L562 | train | Returns array of session identifiers | [
30522,
5123,
3853,
1035,
2131,
18098,
9581,
2854,
1006,
1002,
8909,
1010,
1002,
2828,
1027,
19701,
1007,
1063,
1002,
2023,
1011,
1028,
1035,
16437,
18098,
9581,
2854,
14839,
1006,
1007,
1025,
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... |
getgrav/grav | system/src/Grav/Common/Page/Medium/Medium.php | Medium.getThumbnail | protected function getThumbnail()
{
if (!$this->_thumbnail) {
$types = $this->thumbnailTypes;
if ($this->thumbnailType !== 'auto') {
array_unshift($types, $this->thumbnailType);
}
foreach ($types as $type) {
$thumb = $this->get('thumbnails.' . $type, false);
if ($thumb) {
$thumb = $thumb instanceof ThumbnailImageMedium ? $thumb : MediumFactory::fromFile($thumb, ['type' => 'thumbnail']);
$thumb->parent = $this;
}
if ($thumb) {
$this->_thumbnail = $thumb;
break;
}
}
}
return $this->_thumbnail;
} | php | protected function getThumbnail()
{
if (!$this->_thumbnail) {
$types = $this->thumbnailTypes;
if ($this->thumbnailType !== 'auto') {
array_unshift($types, $this->thumbnailType);
}
foreach ($types as $type) {
$thumb = $this->get('thumbnails.' . $type, false);
if ($thumb) {
$thumb = $thumb instanceof ThumbnailImageMedium ? $thumb : MediumFactory::fromFile($thumb, ['type' => 'thumbnail']);
$thumb->parent = $this;
}
if ($thumb) {
$this->_thumbnail = $thumb;
break;
}
}
}
return $this->_thumbnail;
} | [
"protected",
"function",
"getThumbnail",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"_thumbnail",
")",
"{",
"$",
"types",
"=",
"$",
"this",
"->",
"thumbnailTypes",
";",
"if",
"(",
"$",
"this",
"->",
"thumbnailType",
"!==",
"'auto'",
")",
"{",
... | Get the thumbnail Medium object
@return ThumbnailImageMedium | [
"Get",
"the",
"thumbnail",
"Medium",
"object"
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Medium/Medium.php#L652-L677 | train | Get thumbnail image | [
30522,
5123,
3853,
2131,
2705,
25438,
25464,
1006,
1007,
1063,
2065,
1006,
999,
1002,
2023,
1011,
1028,
1035,
7639,
25464,
1007,
1063,
1002,
4127,
1027,
1002,
2023,
1011,
1028,
7639,
25464,
13874,
2015,
1025,
2065,
1006,
1002,
2023,
1011,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/Zend/Cache/Backend/Sqlite.php | Zend_Cache_Backend_Sqlite.getIds | public function getIds()
{
$this->_checkAndBuildStructure();
$res = $this->_query("SELECT id FROM cache WHERE (expire=0 OR expire>" . time() . ")");
$result = array();
while ($id = @sqlite_fetch_single($res)) {
$result[] = $id;
}
return $result;
} | php | public function getIds()
{
$this->_checkAndBuildStructure();
$res = $this->_query("SELECT id FROM cache WHERE (expire=0 OR expire>" . time() . ")");
$result = array();
while ($id = @sqlite_fetch_single($res)) {
$result[] = $id;
}
return $result;
} | [
"public",
"function",
"getIds",
"(",
")",
"{",
"$",
"this",
"->",
"_checkAndBuildStructure",
"(",
")",
";",
"$",
"res",
"=",
"$",
"this",
"->",
"_query",
"(",
"\"SELECT id FROM cache WHERE (expire=0 OR expire>\"",
".",
"time",
"(",
")",
".",
"\")\"",
")",
";... | Return an array of stored cache ids
@return array array of stored cache ids (string) | [
"Return",
"an",
"array",
"of",
"stored",
"cache",
"ids"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Cache/Backend/Sqlite.php#L231-L240 | train | Get all the ids of the cache | [
30522,
2270,
3853,
2131,
9821,
1006,
1007,
1063,
1002,
2023,
1011,
1028,
1035,
4638,
5685,
8569,
4014,
5104,
18300,
5397,
1006,
1007,
1025,
1002,
24501,
1027,
1002,
2023,
1011,
1028,
1035,
23032,
1006,
1000,
7276,
8909,
2013,
17053,
2073,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.compileCreate | public function compileCreate(Blueprint $blueprint, Fluent $command, Connection $connection)
{
$sql = $this->compileCreateTable(
$blueprint, $command, $connection
);
// Once we have the primary SQL, we can add the encoding option to the SQL for
// the table. Then, we can check if a storage engine has been supplied for
// the table. If so, we will add the engine declaration to the SQL query.
$sql = $this->compileCreateEncoding(
$sql, $connection, $blueprint
);
// Finally, we will append the engine configuration onto this SQL statement as
// the final thing we do before returning this finished SQL. Once this gets
// added the query will be ready to execute against the real connections.
return $this->compileCreateEngine(
$sql, $connection, $blueprint
);
} | php | public function compileCreate(Blueprint $blueprint, Fluent $command, Connection $connection)
{
$sql = $this->compileCreateTable(
$blueprint, $command, $connection
);
// Once we have the primary SQL, we can add the encoding option to the SQL for
// the table. Then, we can check if a storage engine has been supplied for
// the table. If so, we will add the engine declaration to the SQL query.
$sql = $this->compileCreateEncoding(
$sql, $connection, $blueprint
);
// Finally, we will append the engine configuration onto this SQL statement as
// the final thing we do before returning this finished SQL. Once this gets
// added the query will be ready to execute against the real connections.
return $this->compileCreateEngine(
$sql, $connection, $blueprint
);
} | [
"public",
"function",
"compileCreate",
"(",
"Blueprint",
"$",
"blueprint",
",",
"Fluent",
"$",
"command",
",",
"Connection",
"$",
"connection",
")",
"{",
"$",
"sql",
"=",
"$",
"this",
"->",
"compileCreateTable",
"(",
"$",
"blueprint",
",",
"$",
"command",
... | Compile a create table command.
@param \Illuminate\Database\Schema\Blueprint $blueprint
@param \Illuminate\Support\Fluent $command
@param \Illuminate\Database\Connection $connection
@return string | [
"Compile",
"a",
"create",
"table",
"command",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Schema/Grammars/MySqlGrammar.php#L57-L76 | train | Compiles create table statement | [
30522,
2270,
3853,
4012,
22090,
16748,
3686,
1006,
2630,
16550,
1002,
2630,
16550,
1010,
19376,
1002,
3094,
1010,
4434,
1002,
4434,
1007,
1063,
1002,
29296,
1027,
1002,
2023,
1011,
1028,
4012,
22090,
16748,
3686,
10880,
1006,
1002,
2630,
16... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Console/Migrations/RefreshCommand.php | RefreshCommand.runRollback | protected function runRollback($database, $path, $step)
{
$this->call('migrate:rollback', array_filter([
'--database' => $database,
'--path' => $path,
'--realpath' => $this->input->getOption('realpath'),
'--step' => $step,
'--force' => true,
]));
} | php | protected function runRollback($database, $path, $step)
{
$this->call('migrate:rollback', array_filter([
'--database' => $database,
'--path' => $path,
'--realpath' => $this->input->getOption('realpath'),
'--step' => $step,
'--force' => true,
]));
} | [
"protected",
"function",
"runRollback",
"(",
"$",
"database",
",",
"$",
"path",
",",
"$",
"step",
")",
"{",
"$",
"this",
"->",
"call",
"(",
"'migrate:rollback'",
",",
"array_filter",
"(",
"[",
"'--database'",
"=>",
"$",
"database",
",",
"'--path'",
"=>",
... | Run the rollback command.
@param string $database
@param string $path
@param int $step
@return void | [
"Run",
"the",
"rollback",
"command",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Console/Migrations/RefreshCommand.php#L79-L88 | train | Runs the rollback command on the next run | [
30522,
5123,
3853,
2448,
28402,
5963,
1006,
1002,
7809,
1010,
1002,
4130,
1010,
1002,
3357,
1007,
1063,
1002,
2023,
1011,
1028,
2655,
1006,
1005,
22806,
1024,
4897,
5963,
1005,
1010,
9140,
1035,
11307,
1006,
1031,
1005,
1011,
1011,
7809,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Metrics.php | Metrics.getUnit | public static function getUnit($column, $idSite)
{
$nameToUnit = array(
'_rate' => '%',
'revenue' => Site::getCurrencySymbolFor($idSite),
'_time_' => 's'
);
$unit = null;
/**
* Use this event to define units for custom metrics used in evolution graphs and row evolution only.
*
* @param string $unit should hold the unit (e.g. %, €, s or empty string)
* @param string $column name of the column to determine
* @param string $idSite id of the current site
*/
Piwik::postEvent('Metrics.getEvolutionUnit', [&$unit, $column, $idSite]);
if (!empty($unit)) {
return $unit;
}
foreach ($nameToUnit as $pattern => $type) {
if (strpos($column, $pattern) !== false) {
return $type;
}
}
return '';
} | php | public static function getUnit($column, $idSite)
{
$nameToUnit = array(
'_rate' => '%',
'revenue' => Site::getCurrencySymbolFor($idSite),
'_time_' => 's'
);
$unit = null;
/**
* Use this event to define units for custom metrics used in evolution graphs and row evolution only.
*
* @param string $unit should hold the unit (e.g. %, €, s or empty string)
* @param string $column name of the column to determine
* @param string $idSite id of the current site
*/
Piwik::postEvent('Metrics.getEvolutionUnit', [&$unit, $column, $idSite]);
if (!empty($unit)) {
return $unit;
}
foreach ($nameToUnit as $pattern => $type) {
if (strpos($column, $pattern) !== false) {
return $type;
}
}
return '';
} | [
"public",
"static",
"function",
"getUnit",
"(",
"$",
"column",
",",
"$",
"idSite",
")",
"{",
"$",
"nameToUnit",
"=",
"array",
"(",
"'_rate'",
"=>",
"'%'",
",",
"'revenue'",
"=>",
"Site",
"::",
"getCurrencySymbolFor",
"(",
"$",
"idSite",
")",
",",
"'_time... | Derive the unit name from a column name
@param $column
@param $idSite
@return string
@ignore | [
"Derive",
"the",
"unit",
"name",
"from",
"a",
"column",
"name"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Metrics.php#L236-L266 | train | Returns the unit name of the given column | [
30522,
2270,
10763,
3853,
2131,
19496,
2102,
1006,
1002,
5930,
1010,
1002,
8909,
28032,
2063,
1007,
1063,
1002,
2171,
24826,
3490,
2102,
1027,
9140,
1006,
1005,
1035,
3446,
1005,
1027,
1028,
1005,
1003,
1005,
1010,
1005,
6599,
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... |
matomo-org/matomo | core/Settings/Setting.php | Setting.setValue | public function setValue($value)
{
$this->checkHasEnoughWritePermission();
$config = $this->configureField();
$this->validateValue($value);
if ($config->transform && $config->transform instanceof \Closure) {
$value = call_user_func($config->transform, $value, $this);
}
if (isset($this->type) && !is_null($value)) {
settype($value, $this->type);
}
$this->storage->setValue($this->name, $value);
} | php | public function setValue($value)
{
$this->checkHasEnoughWritePermission();
$config = $this->configureField();
$this->validateValue($value);
if ($config->transform && $config->transform instanceof \Closure) {
$value = call_user_func($config->transform, $value, $this);
}
if (isset($this->type) && !is_null($value)) {
settype($value, $this->type);
}
$this->storage->setValue($this->name, $value);
} | [
"public",
"function",
"setValue",
"(",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"checkHasEnoughWritePermission",
"(",
")",
";",
"$",
"config",
"=",
"$",
"this",
"->",
"configureField",
"(",
")",
";",
"$",
"this",
"->",
"validateValue",
"(",
"$",
"value... | Sets and persists this setting's value overwriting any existing value.
Before a value is actually set it will be made sure the current user is allowed to change the value. The value
will be first validated either via a system built-in validate method or via a set {@link FieldConfig::$validate}
custom method. Afterwards the value will be transformed via a possibly specified {@link FieldConfig::$transform}
method. Before storing the actual value, the value will be converted to the actually specified {@link $type}.
@param mixed $value
@throws \Exception If the current user is not allowed to change the value of this setting. | [
"Sets",
"and",
"persists",
"this",
"setting",
"s",
"value",
"overwriting",
"any",
"existing",
"value",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Settings/Setting.php#L218-L235 | train | Set the value of the field. | [
30522,
2270,
3853,
2275,
10175,
5657,
30524,
12879,
12891,
1006,
1007,
1025,
1002,
2023,
1011,
1028,
9398,
3686,
10175,
5657,
1006,
1002,
3643,
1007,
1025,
2065,
1006,
1002,
9530,
8873,
2290,
1011,
1028,
10938,
1004,
1004,
1002,
9530,
8873,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Yaml/Inline.php | Inline.dumpArray | private static function dumpArray(array $value, int $flags): string
{
// array
if (($value || Yaml::DUMP_EMPTY_ARRAY_AS_SEQUENCE & $flags) && !self::isHash($value)) {
$output = [];
foreach ($value as $val) {
$output[] = self::dump($val, $flags);
}
return sprintf('[%s]', implode(', ', $output));
}
// hash
$output = [];
foreach ($value as $key => $val) {
$output[] = sprintf('%s: %s', self::dump($key, $flags), self::dump($val, $flags));
}
return sprintf('{ %s }', implode(', ', $output));
} | php | private static function dumpArray(array $value, int $flags): string
{
// array
if (($value || Yaml::DUMP_EMPTY_ARRAY_AS_SEQUENCE & $flags) && !self::isHash($value)) {
$output = [];
foreach ($value as $val) {
$output[] = self::dump($val, $flags);
}
return sprintf('[%s]', implode(', ', $output));
}
// hash
$output = [];
foreach ($value as $key => $val) {
$output[] = sprintf('%s: %s', self::dump($key, $flags), self::dump($val, $flags));
}
return sprintf('{ %s }', implode(', ', $output));
} | [
"private",
"static",
"function",
"dumpArray",
"(",
"array",
"$",
"value",
",",
"int",
"$",
"flags",
")",
":",
"string",
"{",
"// array",
"if",
"(",
"(",
"$",
"value",
"||",
"Yaml",
"::",
"DUMP_EMPTY_ARRAY_AS_SEQUENCE",
"&",
"$",
"flags",
")",
"&&",
"!",
... | Dumps a PHP array to a YAML string.
@param array $value The PHP array to dump
@param int $flags A bit field of Yaml::DUMP_* constants to customize the dumped YAML string
@return string The YAML string representing the PHP array | [
"Dumps",
"a",
"PHP",
"array",
"to",
"a",
"YAML",
"string",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Yaml/Inline.php#L238-L257 | train | Dump array value | [
30522,
2797,
10763,
3853,
15653,
2906,
9447,
1006,
9140,
1002,
3643,
1010,
20014,
1002,
9245,
1007,
1024,
5164,
1063,
1013,
1013,
9140,
2065,
1006,
1006,
1002,
3643,
1064,
1064,
8038,
19968,
1024,
1024,
15653,
1035,
4064,
1035,
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... |
symfony/symfony | src/Symfony/Component/CssSelector/Parser/Handler/CommentHandler.php | CommentHandler.handle | public function handle(Reader $reader, TokenStream $stream): bool
{
if ('/*' !== $reader->getSubstring(2)) {
return false;
}
$offset = $reader->getOffset('*/');
if (false === $offset) {
$reader->moveToEnd();
} else {
$reader->moveForward($offset + 2);
}
return true;
} | php | public function handle(Reader $reader, TokenStream $stream): bool
{
if ('/*' !== $reader->getSubstring(2)) {
return false;
}
$offset = $reader->getOffset('*/');
if (false === $offset) {
$reader->moveToEnd();
} else {
$reader->moveForward($offset + 2);
}
return true;
} | [
"public",
"function",
"handle",
"(",
"Reader",
"$",
"reader",
",",
"TokenStream",
"$",
"stream",
")",
":",
"bool",
"{",
"if",
"(",
"'/*'",
"!==",
"$",
"reader",
"->",
"getSubstring",
"(",
"2",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"offset"... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/CssSelector/Parser/Handler/CommentHandler.php#L32-L47 | train | Handle the token stream | [
30522,
2270,
3853,
5047,
1006,
8068,
1002,
8068,
1010,
19204,
21422,
1002,
5460,
1007,
1024,
22017,
2140,
1063,
2065,
1006,
1005,
1013,
1008,
1005,
999,
1027,
1027,
1002,
8068,
1011,
1028,
4152,
12083,
3367,
4892,
1006,
1016,
1007,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/Zend/Db/Adapter/Pdo/Abstract.php | Zend_Db_Adapter_Pdo_Abstract.query | public function query($sql, $bind = array())
{
if (empty($bind) && $sql instanceof Zend_Db_Select) {
$bind = $sql->getBind();
}
if (is_array($bind)) {
foreach ($bind as $name => $value) {
if (!is_int($name) && !preg_match('/^:/', $name)) {
$newName = ":$name";
unset($bind[$name]);
$bind[$newName] = $value;
}
}
}
try {
return parent::query($sql, $bind);
} catch (PDOException $e) {
/**
* @see Zend_Db_Statement_Exception
*/
// require_once 'Zend/Db/Statement/Exception.php';
throw new Zend_Db_Statement_Exception($e->getMessage(), $e->getCode(), $e);
}
} | php | public function query($sql, $bind = array())
{
if (empty($bind) && $sql instanceof Zend_Db_Select) {
$bind = $sql->getBind();
}
if (is_array($bind)) {
foreach ($bind as $name => $value) {
if (!is_int($name) && !preg_match('/^:/', $name)) {
$newName = ":$name";
unset($bind[$name]);
$bind[$newName] = $value;
}
}
}
try {
return parent::query($sql, $bind);
} catch (PDOException $e) {
/**
* @see Zend_Db_Statement_Exception
*/
// require_once 'Zend/Db/Statement/Exception.php';
throw new Zend_Db_Statement_Exception($e->getMessage(), $e->getCode(), $e);
}
} | [
"public",
"function",
"query",
"(",
"$",
"sql",
",",
"$",
"bind",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"bind",
")",
"&&",
"$",
"sql",
"instanceof",
"Zend_Db_Select",
")",
"{",
"$",
"bind",
"=",
"$",
"sql",
"->",
"getBin... | Special handling for PDO query().
All bind parameter names must begin with ':'
@param string|Zend_Db_Select $sql The SQL statement with placeholders.
@param array $bind An array of data to bind to the placeholders.
@return Zend_Db_Statement_Pdo
@throws Zend_Db_Adapter_Exception To re-throw PDOException. | [
"Special",
"handling",
"for",
"PDO",
"query",
"()",
".",
"All",
"bind",
"parameter",
"names",
"must",
"begin",
"with",
":"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Adapter/Pdo/Abstract.php#L221-L246 | train | Implementa un query de una base de datos | [
30522,
2270,
3853,
23032,
1006,
1002,
29296,
1010,
1002,
14187,
1027,
9140,
1006,
1007,
1007,
1063,
2065,
1006,
4064,
1006,
1002,
14187,
1007,
1004,
1004,
1002,
29296,
6013,
11253,
16729,
2094,
1035,
16962,
1035,
7276,
1007,
1063,
1002,
141... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Mail/Mailer.php | Mailer.setGlobalToAndRemoveCcAndBcc | protected function setGlobalToAndRemoveCcAndBcc($message)
{
$message->to($this->to['address'], $this->to['name'], true);
$message->cc(null, null, true);
$message->bcc(null, null, true);
} | php | protected function setGlobalToAndRemoveCcAndBcc($message)
{
$message->to($this->to['address'], $this->to['name'], true);
$message->cc(null, null, true);
$message->bcc(null, null, true);
} | [
"protected",
"function",
"setGlobalToAndRemoveCcAndBcc",
"(",
"$",
"message",
")",
"{",
"$",
"message",
"->",
"to",
"(",
"$",
"this",
"->",
"to",
"[",
"'address'",
"]",
",",
"$",
"this",
"->",
"to",
"[",
"'name'",
"]",
",",
"true",
")",
";",
"$",
"me... | Set the global "to" address on the given message.
@param \Illuminate\Mail\Message $message
@return void | [
"Set",
"the",
"global",
"to",
"address",
"on",
"the",
"given",
"message",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Mail/Mailer.php#L362-L367 | train | Set the global to address and name of the message and remove the cc and bcc addresses | [
30522,
5123,
3853,
2275,
23296,
16429,
2389,
3406,
5685,
28578,
21818,
16665,
4859,
9818,
2278,
1006,
1002,
4471,
1007,
1063,
1002,
4471,
1011,
1028,
2000,
1006,
1002,
2023,
1011,
1028,
2000,
1031,
1005,
4769,
1005,
1033,
1010,
1002,
2023,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php | PhpDumper.dumpLiteralClass | private function dumpLiteralClass(string $class): string
{
if (false !== strpos($class, '$')) {
return sprintf('${($_ = %s) && false ?: "_"}', $class);
}
if (0 !== strpos($class, "'") || !preg_match('/^\'(?:\\\{2})?[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*(?:\\\{2}[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)*\'$/', $class)) {
throw new RuntimeException(sprintf('Cannot dump definition because of invalid class name (%s)', $class ?: 'n/a'));
}
$class = substr(str_replace('\\\\', '\\', $class), 1, -1);
return 0 === strpos($class, '\\') ? $class : '\\'.$class;
} | php | private function dumpLiteralClass(string $class): string
{
if (false !== strpos($class, '$')) {
return sprintf('${($_ = %s) && false ?: "_"}', $class);
}
if (0 !== strpos($class, "'") || !preg_match('/^\'(?:\\\{2})?[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*(?:\\\{2}[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)*\'$/', $class)) {
throw new RuntimeException(sprintf('Cannot dump definition because of invalid class name (%s)', $class ?: 'n/a'));
}
$class = substr(str_replace('\\\\', '\\', $class), 1, -1);
return 0 === strpos($class, '\\') ? $class : '\\'.$class;
} | [
"private",
"function",
"dumpLiteralClass",
"(",
"string",
"$",
"class",
")",
":",
"string",
"{",
"if",
"(",
"false",
"!==",
"strpos",
"(",
"$",
"class",
",",
"'$'",
")",
")",
"{",
"return",
"sprintf",
"(",
"'${($_ = %s) && false ?: \"_\"}'",
",",
"$",
"cla... | Dumps a string to a literal (aka PHP Code) class value.
@throws RuntimeException | [
"Dumps",
"a",
"string",
"to",
"a",
"literal",
"(",
"aka",
"PHP",
"Code",
")",
"class",
"value",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php#L1658-L1670 | train | Dump literal class name | [
30522,
2797,
3853,
15653,
22779,
7941,
26266,
1006,
5164,
1002,
2465,
1007,
1024,
5164,
1063,
2065,
1006,
6270,
999,
1027,
1027,
2358,
14536,
2891,
1006,
1002,
2465,
1010,
1005,
1002,
1005,
1007,
1007,
1063,
2709,
9043,
2546,
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... |
octobercms/october | modules/system/behaviors/SettingsModel.php | SettingsModel.saveModelInternal | public function saveModelInternal()
{
// Purge the field values from the attributes
$this->model->attributes = array_diff_key($this->model->attributes, $this->fieldValues);
} | php | public function saveModelInternal()
{
// Purge the field values from the attributes
$this->model->attributes = array_diff_key($this->model->attributes, $this->fieldValues);
} | [
"public",
"function",
"saveModelInternal",
"(",
")",
"{",
"// Purge the field values from the attributes",
"$",
"this",
"->",
"model",
"->",
"attributes",
"=",
"array_diff_key",
"(",
"$",
"this",
"->",
"model",
"->",
"attributes",
",",
"$",
"this",
"->",
"fieldVal... | Internal save method for the model
@return void | [
"Internal",
"save",
"method",
"for",
"the",
"model"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/behaviors/SettingsModel.php#L182-L186 | train | Save the model to the attributes array | [
30522,
2270,
3853,
3828,
5302,
9247,
18447,
11795,
2389,
1006,
1007,
1063,
1013,
1013,
24694,
1996,
2492,
5300,
2013,
1996,
12332,
1002,
2023,
1011,
1028,
2944,
1011,
1028,
12332,
1027,
9140,
1035,
4487,
4246,
1035,
3145,
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... |
z-song/laravel-admin | src/Console/ExtendCommand.php | ExtendCommand.extensionPath | protected function extensionPath($path = '')
{
$path = rtrim($path, '/');
if (empty($path)) {
return rtrim($this->basePath, '/');
}
return rtrim($this->basePath, '/').'/'.ltrim($path, '/');
} | php | protected function extensionPath($path = '')
{
$path = rtrim($path, '/');
if (empty($path)) {
return rtrim($this->basePath, '/');
}
return rtrim($this->basePath, '/').'/'.ltrim($path, '/');
} | [
"protected",
"function",
"extensionPath",
"(",
"$",
"path",
"=",
"''",
")",
"{",
"$",
"path",
"=",
"rtrim",
"(",
"$",
"path",
",",
"'/'",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"path",
")",
")",
"{",
"return",
"rtrim",
"(",
"$",
"this",
"->",
... | Extension path.
@param string $path
@return string | [
"Extension",
"path",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Console/ExtendCommand.php#L247-L256 | train | Extension path getter | [
30522,
5123,
3853,
5331,
15069,
1006,
1002,
4130,
1027,
1005,
1005,
1007,
1063,
1002,
4130,
1027,
19387,
20026,
1006,
1002,
4130,
1010,
1005,
1013,
1005,
1007,
1025,
2065,
1006,
4064,
1006,
1002,
4130,
1007,
1007,
1063,
2709,
19387,
20026,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Lock/Lock.php | Lock.acquire | public function acquire($blocking = false)
{
try {
if ($blocking) {
$this->store->waitAndSave($this->key);
} else {
$this->store->save($this->key);
}
$this->dirty = true;
$this->logger->info('Successfully acquired the "{resource}" lock.', ['resource' => $this->key]);
if ($this->ttl) {
$this->refresh();
}
if ($this->key->isExpired()) {
throw new LockExpiredException(sprintf('Failed to store the "%s" lock.', $this->key));
}
return true;
} catch (LockConflictedException $e) {
$this->dirty = false;
$this->logger->notice('Failed to acquire the "{resource}" lock. Someone else already acquired the lock.', ['resource' => $this->key]);
if ($blocking) {
throw $e;
}
return false;
} catch (\Exception $e) {
$this->logger->notice('Failed to acquire the "{resource}" lock.', ['resource' => $this->key, 'exception' => $e]);
throw new LockAcquiringException(sprintf('Failed to acquire the "%s" lock.', $this->key), 0, $e);
}
} | php | public function acquire($blocking = false)
{
try {
if ($blocking) {
$this->store->waitAndSave($this->key);
} else {
$this->store->save($this->key);
}
$this->dirty = true;
$this->logger->info('Successfully acquired the "{resource}" lock.', ['resource' => $this->key]);
if ($this->ttl) {
$this->refresh();
}
if ($this->key->isExpired()) {
throw new LockExpiredException(sprintf('Failed to store the "%s" lock.', $this->key));
}
return true;
} catch (LockConflictedException $e) {
$this->dirty = false;
$this->logger->notice('Failed to acquire the "{resource}" lock. Someone else already acquired the lock.', ['resource' => $this->key]);
if ($blocking) {
throw $e;
}
return false;
} catch (\Exception $e) {
$this->logger->notice('Failed to acquire the "{resource}" lock.', ['resource' => $this->key, 'exception' => $e]);
throw new LockAcquiringException(sprintf('Failed to acquire the "%s" lock.', $this->key), 0, $e);
}
} | [
"public",
"function",
"acquire",
"(",
"$",
"blocking",
"=",
"false",
")",
"{",
"try",
"{",
"if",
"(",
"$",
"blocking",
")",
"{",
"$",
"this",
"->",
"store",
"->",
"waitAndSave",
"(",
"$",
"this",
"->",
"key",
")",
";",
"}",
"else",
"{",
"$",
"thi... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Lock/Lock.php#L69-L103 | train | Acquires the lock | [
30522,
2270,
3853,
9878,
1006,
1002,
10851,
1027,
6270,
1007,
1063,
3046,
1063,
2065,
1006,
1002,
10851,
1007,
1063,
1002,
2023,
1011,
1028,
3573,
1011,
1028,
3524,
29560,
10696,
1006,
1002,
2023,
1011,
1028,
3145,
1007,
1025,
1065,
2842,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/UrlHelper.php | UrlHelper.getQueryStringWithExcludedParameters | public static function getQueryStringWithExcludedParameters($queryParameters, $parametersToExclude)
{
$validQuery = '';
$separator = '&';
foreach ($queryParameters as $name => $value) {
// decode encoded square brackets
$name = str_replace(array('%5B', '%5D'), array('[', ']'), $name);
if (!self::in_array_matches_regex(strtolower($name), $parametersToExclude)) {
if (is_array($value)) {
foreach ($value as $param) {
if ($param === false) {
$validQuery .= $name . '[]' . $separator;
} else {
$validQuery .= $name . '[]=' . $param . $separator;
}
}
} elseif ($value === false) {
$validQuery .= $name . $separator;
} else {
$validQuery .= $name . '=' . $value . $separator;
}
}
}
$validQuery = substr($validQuery, 0, -strlen($separator));
return $validQuery;
} | php | public static function getQueryStringWithExcludedParameters($queryParameters, $parametersToExclude)
{
$validQuery = '';
$separator = '&';
foreach ($queryParameters as $name => $value) {
// decode encoded square brackets
$name = str_replace(array('%5B', '%5D'), array('[', ']'), $name);
if (!self::in_array_matches_regex(strtolower($name), $parametersToExclude)) {
if (is_array($value)) {
foreach ($value as $param) {
if ($param === false) {
$validQuery .= $name . '[]' . $separator;
} else {
$validQuery .= $name . '[]=' . $param . $separator;
}
}
} elseif ($value === false) {
$validQuery .= $name . $separator;
} else {
$validQuery .= $name . '=' . $value . $separator;
}
}
}
$validQuery = substr($validQuery, 0, -strlen($separator));
return $validQuery;
} | [
"public",
"static",
"function",
"getQueryStringWithExcludedParameters",
"(",
"$",
"queryParameters",
",",
"$",
"parametersToExclude",
")",
"{",
"$",
"validQuery",
"=",
"''",
";",
"$",
"separator",
"=",
"'&'",
";",
"foreach",
"(",
"$",
"queryParameters",
"as",
"$... | Converts an array of query parameter name/value mappings into a query string.
Parameters that are in `$parametersToExclude` will not appear in the result.
@static
@param $queryParameters Array of query parameters, eg, `array('site' => '0', 'date' => '2012-01-01')`.
@param $parametersToExclude Array of query parameter names that shouldn't be
in the result query string, eg, `array('date', 'period')`.
@return string A query string, eg, `"?site=0"`.
@api | [
"Converts",
"an",
"array",
"of",
"query",
"parameter",
"name",
"/",
"value",
"mappings",
"into",
"a",
"query",
"string",
".",
"Parameters",
"that",
"are",
"in",
"$parametersToExclude",
"will",
"not",
"appear",
"in",
"the",
"result",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/UrlHelper.php#L65-L91 | train | Returns the query string with excluded parameters | [
30522,
2270,
10763,
3853,
2131,
4226,
24769,
18886,
3070,
24415,
10288,
20464,
13936,
28689,
22828,
2015,
1006,
1002,
23032,
28689,
22828,
2015,
1010,
1002,
11709,
3406,
10288,
20464,
12672,
1007,
1063,
1002,
9398,
4226,
2854,
1027,
1005,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/cms/classes/CmsObjectCollection.php | CmsObjectCollection.where | public function where($property, $value, $strict = true)
{
return $this->filter(function ($object) use ($property, $value, $strict) {
if (!array_key_exists($property, $object->settings)) {
return false;
}
return $strict
? $object->settings[$property] === $value
: $object->settings[$property] == $value;
});
} | php | public function where($property, $value, $strict = true)
{
return $this->filter(function ($object) use ($property, $value, $strict) {
if (!array_key_exists($property, $object->settings)) {
return false;
}
return $strict
? $object->settings[$property] === $value
: $object->settings[$property] == $value;
});
} | [
"public",
"function",
"where",
"(",
"$",
"property",
",",
"$",
"value",
",",
"$",
"strict",
"=",
"true",
")",
"{",
"return",
"$",
"this",
"->",
"filter",
"(",
"function",
"(",
"$",
"object",
")",
"use",
"(",
"$",
"property",
",",
"$",
"value",
",",... | Returns objects whose properties match the supplied value.
@param string $property
@param string $value
@param bool $strict
@return static | [
"Returns",
"objects",
"whose",
"properties",
"match",
"the",
"supplied",
"value",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/CmsObjectCollection.php#L47-L59 | train | Filter the result by a property value | [
30522,
2270,
3853,
2073,
1006,
1002,
3200,
1010,
1002,
3643,
1010,
1002,
9384,
1027,
2995,
1007,
1063,
2709,
1002,
2023,
1011,
1028,
11307,
1006,
3853,
1006,
1002,
4874,
1007,
2224,
1006,
1002,
3200,
1010,
1002,
3643,
1010,
1002,
9384,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/system/behaviors/SettingsModel.php | SettingsModel.resetDefault | public function resetDefault()
{
if ($record = $this->getSettingsRecord()) {
$record->delete();
unset(self::$instances[$this->recordCode]);
Cache::forget($this->getCacheKey());
}
} | php | public function resetDefault()
{
if ($record = $this->getSettingsRecord()) {
$record->delete();
unset(self::$instances[$this->recordCode]);
Cache::forget($this->getCacheKey());
}
} | [
"public",
"function",
"resetDefault",
"(",
")",
"{",
"if",
"(",
"$",
"record",
"=",
"$",
"this",
"->",
"getSettingsRecord",
"(",
")",
")",
"{",
"$",
"record",
"->",
"delete",
"(",
")",
";",
"unset",
"(",
"self",
"::",
"$",
"instances",
"[",
"$",
"t... | Reset the settings to their defaults, this will delete the record model | [
"Reset",
"the",
"settings",
"to",
"their",
"defaults",
"this",
"will",
"delete",
"the",
"record",
"model"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/behaviors/SettingsModel.php#L87-L94 | train | Reset default settings | [
30522,
2270,
3853,
25141,
3207,
7011,
11314,
1006,
1007,
1063,
2065,
1006,
1002,
2501,
1027,
1002,
2023,
1011,
1028,
4152,
18319,
3070,
21338,
8586,
8551,
1006,
1007,
1007,
1063,
1002,
2501,
1011,
1028,
3972,
12870,
1006,
1007,
1025,
4895,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/cms/classes/ComponentManager.php | ComponentManager.registerComponent | public function registerComponent($className, $code = null, $plugin = null)
{
if (!$this->classMap) {
$this->classMap = [];
}
if (!$this->codeMap) {
$this->codeMap = [];
}
if (!$code) {
$code = Str::getClassId($className);
}
if ($code == 'viewBag' && $className != 'Cms\Components\ViewBag') {
throw new SystemException(sprintf(
'The component code viewBag is reserved. Please use another code for the component class %s.',
$className
));
}
$className = Str::normalizeClassName($className);
$this->codeMap[$code] = $className;
$this->classMap[$className] = $code;
if ($plugin !== null) {
$this->pluginMap[$className] = $plugin;
}
} | php | public function registerComponent($className, $code = null, $plugin = null)
{
if (!$this->classMap) {
$this->classMap = [];
}
if (!$this->codeMap) {
$this->codeMap = [];
}
if (!$code) {
$code = Str::getClassId($className);
}
if ($code == 'viewBag' && $className != 'Cms\Components\ViewBag') {
throw new SystemException(sprintf(
'The component code viewBag is reserved. Please use another code for the component class %s.',
$className
));
}
$className = Str::normalizeClassName($className);
$this->codeMap[$code] = $className;
$this->classMap[$className] = $code;
if ($plugin !== null) {
$this->pluginMap[$className] = $plugin;
}
} | [
"public",
"function",
"registerComponent",
"(",
"$",
"className",
",",
"$",
"code",
"=",
"null",
",",
"$",
"plugin",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"classMap",
")",
"{",
"$",
"this",
"->",
"classMap",
"=",
"[",
"]",
";",
... | Registers a single component. | [
"Registers",
"a",
"single",
"component",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/ComponentManager.php#L93-L120 | train | Registers a component | [
30522,
2270,
3853,
4236,
9006,
29513,
3372,
1006,
1002,
2465,
18442,
1010,
1002,
3642,
1027,
19701,
1010,
1002,
13354,
2378,
1027,
19701,
1007,
1063,
2065,
1006,
999,
1002,
2023,
1011,
1028,
2465,
2863,
2361,
1007,
1063,
1002,
2023,
1011,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/cms/classes/Controller.php | Controller.findComponentByHandler | public function findComponentByHandler($handler)
{
foreach ($this->page->components as $component) {
if ($component->methodExists($handler)) {
return $component;
}
}
foreach ($this->layout->components as $component) {
if ($component->methodExists($handler)) {
return $component;
}
}
return null;
} | php | public function findComponentByHandler($handler)
{
foreach ($this->page->components as $component) {
if ($component->methodExists($handler)) {
return $component;
}
}
foreach ($this->layout->components as $component) {
if ($component->methodExists($handler)) {
return $component;
}
}
return null;
} | [
"public",
"function",
"findComponentByHandler",
"(",
"$",
"handler",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"page",
"->",
"components",
"as",
"$",
"component",
")",
"{",
"if",
"(",
"$",
"component",
"->",
"methodExists",
"(",
"$",
"handler",
")",
"... | Searches the layout and page components by an AJAX handler
@param string $handler
@return ComponentBase The component object, if found | [
"Searches",
"the",
"layout",
"and",
"page",
"components",
"by",
"an",
"AJAX",
"handler"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/Controller.php#L1496-L1511 | train | Find Component By Handler | [
30522,
2270,
3853,
2424,
9006,
29513,
3372,
3762,
11774,
3917,
1006,
1002,
28213,
1007,
1063,
18921,
6776,
1006,
1002,
2023,
1011,
1028,
3931,
1011,
1028,
6177,
2004,
1002,
6922,
1007,
1063,
2065,
1006,
1002,
6922,
1011,
1028,
4118,
10288,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Descriptor/TextDescriptor.php | TextDescriptor.formatDefaultValue | private function formatDefaultValue($default): string
{
if (INF === $default) {
return 'INF';
}
if (\is_string($default)) {
$default = OutputFormatter::escape($default);
} elseif (\is_array($default)) {
foreach ($default as $key => $value) {
if (\is_string($value)) {
$default[$key] = OutputFormatter::escape($value);
}
}
}
return str_replace('\\\\', '\\', json_encode($default, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
} | php | private function formatDefaultValue($default): string
{
if (INF === $default) {
return 'INF';
}
if (\is_string($default)) {
$default = OutputFormatter::escape($default);
} elseif (\is_array($default)) {
foreach ($default as $key => $value) {
if (\is_string($value)) {
$default[$key] = OutputFormatter::escape($value);
}
}
}
return str_replace('\\\\', '\\', json_encode($default, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
} | [
"private",
"function",
"formatDefaultValue",
"(",
"$",
"default",
")",
":",
"string",
"{",
"if",
"(",
"INF",
"===",
"$",
"default",
")",
"{",
"return",
"'INF'",
";",
"}",
"if",
"(",
"\\",
"is_string",
"(",
"$",
"default",
")",
")",
"{",
"$",
"default... | Formats input option/argument default value.
@param mixed $default | [
"Formats",
"input",
"option",
"/",
"argument",
"default",
"value",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Console/Descriptor/TextDescriptor.php#L281-L298 | train | Formats the default value for the field. | [
30522,
2797,
3853,
4289,
3207,
7011,
11314,
10175,
5657,
1006,
1002,
12398,
1007,
1024,
5164,
1063,
2065,
1006,
1999,
2546,
1027,
1027,
1027,
1002,
12398,
1007,
1063,
2709,
1005,
1999,
2546,
1005,
1025,
1065,
2065,
1006,
1032,
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... |
laravel/framework | src/Illuminate/Database/Query/Grammars/Grammar.php | Grammar.whereBetween | protected function whereBetween(Builder $query, $where)
{
$between = $where['not'] ? 'not between' : 'between';
$min = $this->parameter(reset($where['values']));
$max = $this->parameter(end($where['values']));
return $this->wrap($where['column']).' '.$between.' '.$min.' and '.$max;
} | php | protected function whereBetween(Builder $query, $where)
{
$between = $where['not'] ? 'not between' : 'between';
$min = $this->parameter(reset($where['values']));
$max = $this->parameter(end($where['values']));
return $this->wrap($where['column']).' '.$between.' '.$min.' and '.$max;
} | [
"protected",
"function",
"whereBetween",
"(",
"Builder",
"$",
"query",
",",
"$",
"where",
")",
"{",
"$",
"between",
"=",
"$",
"where",
"[",
"'not'",
"]",
"?",
"'not between'",
":",
"'between'",
";",
"$",
"min",
"=",
"$",
"this",
"->",
"parameter",
"(",... | Compile a "between" where clause.
@param \Illuminate\Database\Query\Builder $query
@param array $where
@return string | [
"Compile",
"a",
"between",
"where",
"clause",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Query/Grammars/Grammar.php#L373-L382 | train | Protected whereBetween method | [
30522,
5123,
3853,
2073,
20915,
28394,
2078,
1006,
12508,
1002,
23032,
1010,
1002,
2073,
1007,
1063,
1002,
2090,
1027,
1002,
2073,
1031,
1005,
2025,
1005,
1033,
1029,
1005,
2025,
2090,
1005,
1024,
1005,
2090,
1005,
1025,
1002,
8117,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/Tracker/GoalManager.php | GoalManager.recordEcommerceGoal | protected function recordEcommerceGoal(VisitProperties $visitProperties, Request $request, $conversion, $action)
{
$isThereExistingCartInVisit = $request->getMetadata('Goals', 'isThereExistingCartInVisit');
if ($isThereExistingCartInVisit) {
Common::printDebug("There is an existing cart for this visit");
}
$visitor = Visitor::makeFromVisitProperties($visitProperties, $request);
$isGoalAnOrder = $request->getMetadata('Ecommerce', 'isGoalAnOrder');
if ($isGoalAnOrder) {
$debugMessage = 'The conversion is an Ecommerce order';
$orderId = $request->getParam('ec_id');
$conversion['idorder'] = $orderId;
$conversion['idgoal'] = self::IDGOAL_ORDER;
$conversion['buster'] = Common::hashStringToInt($orderId);
$conversionDimensions = ConversionDimension::getAllDimensions();
$conversion = $this->triggerHookOnDimensions($request, $conversionDimensions, 'onEcommerceOrderConversion', $visitor, $action, $conversion);
} // If Cart update, select current items in the previous Cart
else {
$debugMessage = 'The conversion is an Ecommerce Cart Update';
$conversion['buster'] = 0;
$conversion['idgoal'] = self::IDGOAL_CART;
$conversionDimensions = ConversionDimension::getAllDimensions();
$conversion = $this->triggerHookOnDimensions($request, $conversionDimensions, 'onEcommerceCartUpdateConversion', $visitor, $action, $conversion);
}
Common::printDebug($debugMessage . ':' . var_export($conversion, true));
// INSERT or Sync items in the Cart / Order for this visit & order
$items = $this->getEcommerceItemsFromRequest($request);
if (false === $items) {
return;
}
$itemsCount = 0;
foreach ($items as $item) {
$itemsCount += $item[GoalManager::INTERNAL_ITEM_QUANTITY];
}
$conversion['items'] = $itemsCount;
if ($isThereExistingCartInVisit) {
$recorded = $this->getModel()->updateConversion(
$visitProperties->getProperty('idvisit'), self::IDGOAL_CART, $conversion);
} else {
$recorded = $this->insertNewConversion($conversion, $visitProperties->getProperties(), $request, $action);
}
if ($recorded) {
$this->recordEcommerceItems($conversion, $items);
}
} | php | protected function recordEcommerceGoal(VisitProperties $visitProperties, Request $request, $conversion, $action)
{
$isThereExistingCartInVisit = $request->getMetadata('Goals', 'isThereExistingCartInVisit');
if ($isThereExistingCartInVisit) {
Common::printDebug("There is an existing cart for this visit");
}
$visitor = Visitor::makeFromVisitProperties($visitProperties, $request);
$isGoalAnOrder = $request->getMetadata('Ecommerce', 'isGoalAnOrder');
if ($isGoalAnOrder) {
$debugMessage = 'The conversion is an Ecommerce order';
$orderId = $request->getParam('ec_id');
$conversion['idorder'] = $orderId;
$conversion['idgoal'] = self::IDGOAL_ORDER;
$conversion['buster'] = Common::hashStringToInt($orderId);
$conversionDimensions = ConversionDimension::getAllDimensions();
$conversion = $this->triggerHookOnDimensions($request, $conversionDimensions, 'onEcommerceOrderConversion', $visitor, $action, $conversion);
} // If Cart update, select current items in the previous Cart
else {
$debugMessage = 'The conversion is an Ecommerce Cart Update';
$conversion['buster'] = 0;
$conversion['idgoal'] = self::IDGOAL_CART;
$conversionDimensions = ConversionDimension::getAllDimensions();
$conversion = $this->triggerHookOnDimensions($request, $conversionDimensions, 'onEcommerceCartUpdateConversion', $visitor, $action, $conversion);
}
Common::printDebug($debugMessage . ':' . var_export($conversion, true));
// INSERT or Sync items in the Cart / Order for this visit & order
$items = $this->getEcommerceItemsFromRequest($request);
if (false === $items) {
return;
}
$itemsCount = 0;
foreach ($items as $item) {
$itemsCount += $item[GoalManager::INTERNAL_ITEM_QUANTITY];
}
$conversion['items'] = $itemsCount;
if ($isThereExistingCartInVisit) {
$recorded = $this->getModel()->updateConversion(
$visitProperties->getProperty('idvisit'), self::IDGOAL_CART, $conversion);
} else {
$recorded = $this->insertNewConversion($conversion, $visitProperties->getProperties(), $request, $action);
}
if ($recorded) {
$this->recordEcommerceItems($conversion, $items);
}
} | [
"protected",
"function",
"recordEcommerceGoal",
"(",
"VisitProperties",
"$",
"visitProperties",
",",
"Request",
"$",
"request",
",",
"$",
"conversion",
",",
"$",
"action",
")",
"{",
"$",
"isThereExistingCartInVisit",
"=",
"$",
"request",
"->",
"getMetadata",
"(",
... | Records an Ecommerce conversion in the DB. Deals with Items found in the request.
Will deal with 2 types of conversions: Ecommerce Order and Ecommerce Cart update (Add to cart, Update Cart etc).
@param array $conversion
@param Visitor $visitor
@param Action $action
@param array $visitInformation | [
"Records",
"an",
"Ecommerce",
"conversion",
"in",
"the",
"DB",
".",
"Deals",
"with",
"Items",
"found",
"in",
"the",
"request",
".",
"Will",
"deal",
"with",
"2",
"types",
"of",
"conversions",
":",
"Ecommerce",
"Order",
"and",
"Ecommerce",
"Cart",
"update",
... | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Tracker/GoalManager.php#L290-L348 | train | Records an ecommerce goal | [
30522,
5123,
3853,
2501,
8586,
5358,
5017,
3401,
3995,
2389,
1006,
3942,
21572,
4842,
7368,
1002,
3942,
21572,
4842,
7368,
1010,
5227,
1002,
5227,
1010,
1002,
7584,
1010,
1002,
2895,
1007,
1063,
1002,
21541,
5886,
4402,
9048,
16643,
3070,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.prepare | protected function prepare($data = [])
{
if (($response = $this->callSubmitted()) instanceof Response) {
return $response;
}
$this->inputs = array_merge($this->removeIgnoredFields($data), $this->inputs);
if (($response = $this->callSaving()) instanceof Response) {
return $response;
}
$this->relations = $this->getRelationInputs($this->inputs);
$this->updates = Arr::except($this->inputs, array_keys($this->relations));
} | php | protected function prepare($data = [])
{
if (($response = $this->callSubmitted()) instanceof Response) {
return $response;
}
$this->inputs = array_merge($this->removeIgnoredFields($data), $this->inputs);
if (($response = $this->callSaving()) instanceof Response) {
return $response;
}
$this->relations = $this->getRelationInputs($this->inputs);
$this->updates = Arr::except($this->inputs, array_keys($this->relations));
} | [
"protected",
"function",
"prepare",
"(",
"$",
"data",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"(",
"$",
"response",
"=",
"$",
"this",
"->",
"callSubmitted",
"(",
")",
")",
"instanceof",
"Response",
")",
"{",
"return",
"$",
"response",
";",
"}",
"$",
"t... | Prepare input data for insert or update.
@param array $data
@return mixed | [
"Prepare",
"input",
"data",
"for",
"insert",
"or",
"update",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Form.php#L439-L454 | train | Prepare the request and save it to the database | [
30522,
5123,
3853,
7374,
1006,
1002,
2951,
1027,
1031,
1033,
1007,
1063,
2065,
1006,
1006,
1002,
3433,
1027,
1002,
2023,
1011,
1028,
4455,
12083,
22930,
3064,
1006,
1007,
1007,
6013,
11253,
3433,
1007,
1063,
2709,
1002,
3433,
1025,
1065,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Queue/RedisQueue.php | RedisQueue.pushRaw | public function pushRaw($payload, $queue = null, array $options = [])
{
$this->getConnection()->eval(
LuaScripts::push(), 2, $this->getQueue($queue),
$this->getQueue($queue).':notify', $payload
);
return json_decode($payload, true)['id'] ?? null;
} | php | public function pushRaw($payload, $queue = null, array $options = [])
{
$this->getConnection()->eval(
LuaScripts::push(), 2, $this->getQueue($queue),
$this->getQueue($queue).':notify', $payload
);
return json_decode($payload, true)['id'] ?? null;
} | [
"public",
"function",
"pushRaw",
"(",
"$",
"payload",
",",
"$",
"queue",
"=",
"null",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"getConnection",
"(",
")",
"->",
"eval",
"(",
"LuaScripts",
"::",
"push",
"(",
")",
",",... | Push a raw payload onto the queue.
@param string $payload
@param string $queue
@param array $options
@return mixed | [
"Push",
"a",
"raw",
"payload",
"onto",
"the",
"queue",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Queue/RedisQueue.php#L102-L110 | train | Pushes a raw message to the queue | [
30522,
2270,
3853,
5245,
2527,
2860,
1006,
1002,
18093,
1010,
1002,
24240,
1027,
19701,
1010,
9140,
1002,
7047,
1027,
1031,
1033,
1007,
1063,
1002,
2023,
1011,
1028,
2131,
8663,
2638,
7542,
1006,
1007,
1011,
1028,
9345,
2140,
1006,
11320,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Messages/Message.php | Message.transformToXml | public function transformToXml(array $appends = [], bool $returnAsArray = false): string
{
$data = array_merge(['MsgType' => $this->getType()], $this->toXmlArray(), $appends);
return $returnAsArray ? $data : XML::build($data);
} | php | public function transformToXml(array $appends = [], bool $returnAsArray = false): string
{
$data = array_merge(['MsgType' => $this->getType()], $this->toXmlArray(), $appends);
return $returnAsArray ? $data : XML::build($data);
} | [
"public",
"function",
"transformToXml",
"(",
"array",
"$",
"appends",
"=",
"[",
"]",
",",
"bool",
"$",
"returnAsArray",
"=",
"false",
")",
":",
"string",
"{",
"$",
"data",
"=",
"array_merge",
"(",
"[",
"'MsgType'",
"=>",
"$",
"this",
"->",
"getType",
"... | @param array $appends
@param bool $returnAsArray
@return string | [
"@param",
"array",
"$appends",
"@param",
"bool",
"$returnAsArray"
] | 120c72faaa93c270365bc75c73c362d5fd583209 | https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/Kernel/Messages/Message.php#L171-L176 | train | Transform the message to xml string | [
30522,
2270,
3853,
10938,
3406,
2595,
19968,
1006,
9140,
1002,
10439,
10497,
2015,
1027,
1031,
1033,
1010,
22017,
2140,
1002,
2709,
16782,
11335,
2100,
1027,
6270,
1007,
1024,
5164,
1063,
1002,
2951,
1027,
9140,
1035,
13590,
1006,
1031,
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/Support/Str.php | Str.orderedUuid | public static function orderedUuid()
{
$factory = new UuidFactory;
$factory->setRandomGenerator(new CombGenerator(
$factory->getRandomGenerator(),
$factory->getNumberConverter()
));
$factory->setCodec(new TimestampFirstCombCodec(
$factory->getUuidBuilder()
));
return $factory->uuid4();
} | php | public static function orderedUuid()
{
$factory = new UuidFactory;
$factory->setRandomGenerator(new CombGenerator(
$factory->getRandomGenerator(),
$factory->getNumberConverter()
));
$factory->setCodec(new TimestampFirstCombCodec(
$factory->getUuidBuilder()
));
return $factory->uuid4();
} | [
"public",
"static",
"function",
"orderedUuid",
"(",
")",
"{",
"$",
"factory",
"=",
"new",
"UuidFactory",
";",
"$",
"factory",
"->",
"setRandomGenerator",
"(",
"new",
"CombGenerator",
"(",
"$",
"factory",
"->",
"getRandomGenerator",
"(",
")",
",",
"$",
"facto... | Generate a time-ordered UUID (version 4).
@return \Ramsey\Uuid\UuidInterface | [
"Generate",
"a",
"time",
"-",
"ordered",
"UUID",
"(",
"version",
"4",
")",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Support/Str.php#L559-L573 | train | Returns a UUID that is ordered by the order of the current time. | [
30522,
2270,
10763,
3853,
3641,
2226,
21272,
1006,
1007,
1063,
1002,
4713,
1027,
2047,
1057,
21272,
21450,
1025,
1002,
4713,
1011,
1028,
2275,
13033,
5358,
6914,
6906,
4263,
1006,
2047,
22863,
6914,
6906,
4263,
1006,
1002,
4713,
1011,
1028,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/DataAccess/TableMetadata.php | TableMetadata.getIdActionColumnNames | public function getIdActionColumnNames($table)
{
$columns = $this->getColumns($table);
$columns = array_filter($columns, function ($columnName) {
return strpos($columnName, 'idaction') !== false;
});
return array_values($columns);
} | php | public function getIdActionColumnNames($table)
{
$columns = $this->getColumns($table);
$columns = array_filter($columns, function ($columnName) {
return strpos($columnName, 'idaction') !== false;
});
return array_values($columns);
} | [
"public",
"function",
"getIdActionColumnNames",
"(",
"$",
"table",
")",
"{",
"$",
"columns",
"=",
"$",
"this",
"->",
"getColumns",
"(",
"$",
"table",
")",
";",
"$",
"columns",
"=",
"array_filter",
"(",
"$",
"columns",
",",
"function",
"(",
"$",
"columnNa... | Returns the list of idaction columns in a table. A column is
assumed to be an idaction reference if it has `"idaction"` in its
name (eg, `"idaction_url"` or `"idaction_content_name"`.
@param string $table Prefixed table name.
@return string[] | [
"Returns",
"the",
"list",
"of",
"idaction",
"columns",
"in",
"a",
"table",
".",
"A",
"column",
"is",
"assumed",
"to",
"be",
"an",
"idaction",
"reference",
"if",
"it",
"has",
"idaction",
"in",
"its",
"name",
"(",
"eg",
"idaction_url",
"or",
"idaction_conten... | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/DataAccess/TableMetadata.php#L46-L55 | train | Returns an array of idaction column names for a table | [
30522,
2270,
3853,
2131,
8524,
7542,
25778,
2819,
9516,
7834,
1006,
1002,
2795,
1007,
1063,
1002,
7753,
1027,
1002,
2023,
1011,
1028,
2131,
25778,
2819,
3619,
1006,
1002,
2795,
1007,
1025,
1002,
7753,
1027,
9140,
1035,
11307,
1006,
1002,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Foundation/Exceptions/Handler.php | Handler.shouldntReport | protected function shouldntReport(Exception $e)
{
$dontReport = array_merge($this->dontReport, $this->internalDontReport);
return ! is_null(Arr::first($dontReport, function ($type) use ($e) {
return $e instanceof $type;
}));
} | php | protected function shouldntReport(Exception $e)
{
$dontReport = array_merge($this->dontReport, $this->internalDontReport);
return ! is_null(Arr::first($dontReport, function ($type) use ($e) {
return $e instanceof $type;
}));
} | [
"protected",
"function",
"shouldntReport",
"(",
"Exception",
"$",
"e",
")",
"{",
"$",
"dontReport",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"dontReport",
",",
"$",
"this",
"->",
"internalDontReport",
")",
";",
"return",
"!",
"is_null",
"(",
"Arr",
"::"... | Determine if the exception is in the "do not report" list.
@param \Exception $e
@return bool | [
"Determine",
"if",
"the",
"exception",
"is",
"in",
"the",
"do",
"not",
"report",
"list",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Foundation/Exceptions/Handler.php#L135-L142 | train | Check if exception is in the list of types that should be reported | [
30522,
5123,
3853,
5807,
7913,
6442,
1006,
6453,
1002,
1041,
1007,
1063,
1002,
2123,
7913,
6442,
1027,
9140,
1035,
13590,
1006,
1002,
2023,
1011,
1028,
2123,
7913,
6442,
1010,
1002,
2023,
1011,
1028,
4722,
5280,
7913,
6442,
1007,
1025,
27... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Session/Store.php | Store.migrate | public function migrate($destroy = false)
{
if ($destroy) {
$this->handler->destroy($this->getId());
}
$this->setExists(false);
$this->setId($this->generateSessionId());
return true;
} | php | public function migrate($destroy = false)
{
if ($destroy) {
$this->handler->destroy($this->getId());
}
$this->setExists(false);
$this->setId($this->generateSessionId());
return true;
} | [
"public",
"function",
"migrate",
"(",
"$",
"destroy",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"destroy",
")",
"{",
"$",
"this",
"->",
"handler",
"->",
"destroy",
"(",
"$",
"this",
"->",
"getId",
"(",
")",
")",
";",
"}",
"$",
"this",
"->",
"setExi... | Generate a new session ID for the session.
@param bool $destroy
@return bool | [
"Generate",
"a",
"new",
"session",
"ID",
"for",
"the",
"session",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Session/Store.php#L489-L500 | train | Migrate the current session to the new session | [
30522,
2270,
3853,
22806,
1006,
1002,
6033,
1027,
6270,
1007,
1063,
2065,
1006,
1002,
6033,
1007,
1063,
1002,
2023,
1011,
1028,
28213,
1011,
1028,
6033,
1006,
1002,
2023,
1011,
1028,
2131,
3593,
1006,
1007,
1007,
1025,
1065,
1002,
2023,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Console/Application.php | Application.parseCommand | protected function parseCommand($command, $parameters)
{
if (is_subclass_of($command, SymfonyCommand::class)) {
$callingClass = true;
$command = $this->laravel->make($command)->getName();
}
if (! isset($callingClass) && empty($parameters)) {
$command = $this->getCommandName($input = new StringInput($command));
} else {
array_unshift($parameters, $command);
$input = new ArrayInput($parameters);
}
return [$command, $input ?? null];
} | php | protected function parseCommand($command, $parameters)
{
if (is_subclass_of($command, SymfonyCommand::class)) {
$callingClass = true;
$command = $this->laravel->make($command)->getName();
}
if (! isset($callingClass) && empty($parameters)) {
$command = $this->getCommandName($input = new StringInput($command));
} else {
array_unshift($parameters, $command);
$input = new ArrayInput($parameters);
}
return [$command, $input ?? null];
} | [
"protected",
"function",
"parseCommand",
"(",
"$",
"command",
",",
"$",
"parameters",
")",
"{",
"if",
"(",
"is_subclass_of",
"(",
"$",
"command",
",",
"SymfonyCommand",
"::",
"class",
")",
")",
"{",
"$",
"callingClass",
"=",
"true",
";",
"$",
"command",
... | Parse the incoming Artisan command and its input.
@param string $command
@param array $parameters
@return array | [
"Parse",
"the",
"incoming",
"Artisan",
"command",
"and",
"its",
"input",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Console/Application.php#L193-L210 | train | Parse the command and parameters | [
30522,
5123,
3853,
11968,
3366,
9006,
2386,
2094,
1006,
1002,
3094,
1010,
1002,
11709,
1007,
1063,
2065,
1006,
2003,
1035,
4942,
26266,
1035,
1997,
1006,
1002,
3094,
1010,
25353,
2213,
14876,
4890,
9006,
2386,
2094,
1024,
1024,
2465,
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... |
overtrue/wechat | src/Payment/ProfitSharing/Client.php | Client.share | public function share(
string $transactionId,
string $outOrderNo,
array $receivers
) {
$params = [
'appid' => $this->app['config']->app_id,
'transaction_id' => $transactionId,
'out_order_no' => $outOrderNo,
'receivers' => json_encode(
$receivers, JSON_UNESCAPED_UNICODE
),
];
return $this->safeRequest(
'secapi/pay/profitsharing', $params
);
} | php | public function share(
string $transactionId,
string $outOrderNo,
array $receivers
) {
$params = [
'appid' => $this->app['config']->app_id,
'transaction_id' => $transactionId,
'out_order_no' => $outOrderNo,
'receivers' => json_encode(
$receivers, JSON_UNESCAPED_UNICODE
),
];
return $this->safeRequest(
'secapi/pay/profitsharing', $params
);
} | [
"public",
"function",
"share",
"(",
"string",
"$",
"transactionId",
",",
"string",
"$",
"outOrderNo",
",",
"array",
"$",
"receivers",
")",
"{",
"$",
"params",
"=",
"[",
"'appid'",
"=>",
"$",
"this",
"->",
"app",
"[",
"'config'",
"]",
"->",
"app_id",
",... | Single profit sharing.
请求单次分账.
@param string $transactionId 微信支付订单号
@param string $outOrderNo 商户系统内部的分账单号
@param string $receivers 分账接收方列表 | [
"Single",
"profit",
"sharing",
".",
"请求单次分账",
"."
] | 120c72faaa93c270365bc75c73c362d5fd583209 | https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/Payment/ProfitSharing/Client.php#L83-L100 | train | Share Profit Share | [
30522,
2270,
3853,
3745,
1006,
5164,
1002,
12598,
3593,
1010,
5164,
1002,
2041,
8551,
11795,
2080,
1010,
9140,
1002,
19278,
1007,
1063,
1002,
11498,
5244,
1027,
1031,
1005,
10439,
3593,
1005,
1027,
1028,
1002,
2023,
1011,
1028,
10439,
1031,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/Zend/Mail.php | Zend_Mail._addRecipientAndHeader | protected function _addRecipientAndHeader($headerName, $email, $name)
{
$email = $this->_filterEmail($email);
$name = $this->_filterName($name);
// prevent duplicates
$this->_recipients[$email] = 1;
$this->_storeHeader($headerName, $this->_formatAddress($email, $name), true);
} | php | protected function _addRecipientAndHeader($headerName, $email, $name)
{
$email = $this->_filterEmail($email);
$name = $this->_filterName($name);
// prevent duplicates
$this->_recipients[$email] = 1;
$this->_storeHeader($headerName, $this->_formatAddress($email, $name), true);
} | [
"protected",
"function",
"_addRecipientAndHeader",
"(",
"$",
"headerName",
",",
"$",
"email",
",",
"$",
"name",
")",
"{",
"$",
"email",
"=",
"$",
"this",
"->",
"_filterEmail",
"(",
"$",
"email",
")",
";",
"$",
"name",
"=",
"$",
"this",
"->",
"_filterNa... | Helper function for adding a recipient and the corresponding header
@param string $headerName
@param string $email
@param string $name | [
"Helper",
"function",
"for",
"adding",
"a",
"recipient",
"and",
"the",
"corresponding",
"header"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Mail.php#L555-L562 | train | Add a recipient and header to the header array | [
30522,
5123,
3853,
1035,
5587,
2890,
6895,
14756,
12380,
4859,
4974,
2121,
30524,
2023,
1011,
1028,
1035,
15991,
1031,
1002,
10373,
1033,
1027,
1015,
1025,
1002,
2023,
1011,
1028,
1035,
3573,
4974,
2121,
1006,
1002,
20346,
18442,
1010,
1002... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Foundation/ComposerScripts.php | ComposerScripts.clearCompiled | protected static function clearCompiled()
{
$laravel = new Application(getcwd());
if (file_exists($servicesPath = $laravel->getCachedServicesPath())) {
@unlink($servicesPath);
}
if (file_exists($packagesPath = $laravel->getCachedPackagesPath())) {
@unlink($packagesPath);
}
} | php | protected static function clearCompiled()
{
$laravel = new Application(getcwd());
if (file_exists($servicesPath = $laravel->getCachedServicesPath())) {
@unlink($servicesPath);
}
if (file_exists($packagesPath = $laravel->getCachedPackagesPath())) {
@unlink($packagesPath);
}
} | [
"protected",
"static",
"function",
"clearCompiled",
"(",
")",
"{",
"$",
"laravel",
"=",
"new",
"Application",
"(",
"getcwd",
"(",
")",
")",
";",
"if",
"(",
"file_exists",
"(",
"$",
"servicesPath",
"=",
"$",
"laravel",
"->",
"getCachedServicesPath",
"(",
")... | Clear the cached Laravel bootstrapping files.
@return void | [
"Clear",
"the",
"cached",
"Laravel",
"bootstrapping",
"files",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Foundation/ComposerScripts.php#L53-L64 | train | Clear compiled files | [
30522,
5123,
10763,
3853,
3154,
9006,
22090,
2094,
1006,
1007,
1063,
1002,
13679,
15985,
1027,
2047,
4646,
1006,
2131,
2278,
21724,
1006,
1007,
1007,
1025,
2065,
1006,
5371,
1035,
6526,
1006,
1002,
2578,
15069,
1027,
1002,
13679,
15985,
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... |
dompdf/dompdf | lib/html5lib/TreeBuilder.php | HTML5_TreeBuilder.printActiveFormattingElements | private function printActiveFormattingElements() {
if (!$this->a_formatting) {
return;
}
$names = array();
foreach ($this->a_formatting as $node) {
if ($node === self::MARKER) {
$names[] = 'MARKER';
} else {
$names[] = $node->tagName;
}
}
echo " -> active formatting [" . implode(', ', $names) . "]\n";
} | php | private function printActiveFormattingElements() {
if (!$this->a_formatting) {
return;
}
$names = array();
foreach ($this->a_formatting as $node) {
if ($node === self::MARKER) {
$names[] = 'MARKER';
} else {
$names[] = $node->tagName;
}
}
echo " -> active formatting [" . implode(', ', $names) . "]\n";
} | [
"private",
"function",
"printActiveFormattingElements",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"a_formatting",
")",
"{",
"return",
";",
"}",
"$",
"names",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"a_formatting",
"as",
... | For debugging, prints active formatting elements | [
"For",
"debugging",
"prints",
"active",
"formatting",
"elements"
] | 75f13c700009be21a1965dc2c5b68a8708c22ba2 | https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/lib/html5lib/TreeBuilder.php#L3744-L3757 | train | Print active formatting elements | [
30522,
2797,
3853,
6140,
19620,
14192,
19321,
23496,
16930,
11187,
1006,
1007,
1063,
2065,
1006,
999,
1002,
2023,
1011,
1028,
1037,
1035,
4289,
3436,
1007,
1063,
2709,
1025,
1065,
1002,
3415,
1027,
9140,
1006,
1007,
1025,
18921,
6776,
1006,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/Annotations/API.php | API.getAnnotationCountForDates | public function getAnnotationCountForDates($idSite, $date, $period, $lastN = false, $getAnnotationText = false)
{
Piwik::checkUserHasViewAccess($idSite);
// get start & end date for request. lastN is ignored if $period == 'range'
list($startDate, $endDate) = self::getDateRangeForPeriod($date, $period, $lastN);
if ($period == 'range') {
$period = 'day';
}
// create list of dates
$dates = array();
for (; $startDate->getTimestamp() <= $endDate->getTimestamp(); $startDate = $startDate->addPeriod(1, $period)) {
$dates[] = $startDate;
}
// we add one for the end of the last period (used in for loop below to bound annotation dates)
$dates[] = $startDate;
// get annotations for the site
$annotations = new AnnotationList($idSite);
// create result w/ 0-counts
$result = array();
for ($i = 0; $i != count($dates) - 1; ++$i) {
$date = $dates[$i];
$nextDate = $dates[$i + 1];
$strDate = $date->toString();
foreach ($annotations->getIdSites() as $idSite) {
$result[$idSite][$strDate] = $annotations->count($idSite, $date, $nextDate);
// if only one annotation, return the one annotation's text w/ the counts
if ($getAnnotationText
&& $result[$idSite][$strDate]['count'] == 1
) {
$annotationsForSite = $annotations->search(
$date, Date::factory($nextDate->getTimestamp() - 1), $idSite);
$annotation = reset($annotationsForSite[$idSite]);
$result[$idSite][$strDate]['note'] = $annotation['note'];
}
}
}
// convert associative array into array of pairs (so it can be traversed by index)
$pairResult = array();
foreach ($result as $idSite => $counts) {
foreach ($counts as $date => $count) {
$pairResult[$idSite][] = array($date, $count);
}
}
return $pairResult;
} | php | public function getAnnotationCountForDates($idSite, $date, $period, $lastN = false, $getAnnotationText = false)
{
Piwik::checkUserHasViewAccess($idSite);
// get start & end date for request. lastN is ignored if $period == 'range'
list($startDate, $endDate) = self::getDateRangeForPeriod($date, $period, $lastN);
if ($period == 'range') {
$period = 'day';
}
// create list of dates
$dates = array();
for (; $startDate->getTimestamp() <= $endDate->getTimestamp(); $startDate = $startDate->addPeriod(1, $period)) {
$dates[] = $startDate;
}
// we add one for the end of the last period (used in for loop below to bound annotation dates)
$dates[] = $startDate;
// get annotations for the site
$annotations = new AnnotationList($idSite);
// create result w/ 0-counts
$result = array();
for ($i = 0; $i != count($dates) - 1; ++$i) {
$date = $dates[$i];
$nextDate = $dates[$i + 1];
$strDate = $date->toString();
foreach ($annotations->getIdSites() as $idSite) {
$result[$idSite][$strDate] = $annotations->count($idSite, $date, $nextDate);
// if only one annotation, return the one annotation's text w/ the counts
if ($getAnnotationText
&& $result[$idSite][$strDate]['count'] == 1
) {
$annotationsForSite = $annotations->search(
$date, Date::factory($nextDate->getTimestamp() - 1), $idSite);
$annotation = reset($annotationsForSite[$idSite]);
$result[$idSite][$strDate]['note'] = $annotation['note'];
}
}
}
// convert associative array into array of pairs (so it can be traversed by index)
$pairResult = array();
foreach ($result as $idSite => $counts) {
foreach ($counts as $date => $count) {
$pairResult[$idSite][] = array($date, $count);
}
}
return $pairResult;
} | [
"public",
"function",
"getAnnotationCountForDates",
"(",
"$",
"idSite",
",",
"$",
"date",
",",
"$",
"period",
",",
"$",
"lastN",
"=",
"false",
",",
"$",
"getAnnotationText",
"=",
"false",
")",
"{",
"Piwik",
"::",
"checkUserHasViewAccess",
"(",
"$",
"idSite",... | Returns the count of annotations for a list of periods, including the count of
starred annotations.
@param string $idSite The site ID to add the annotation to.
@param string|bool $date The date of the period.
@param string $period The period type.
@param int|bool $lastN Whether to get counts for the last N number of periods or not.
@param bool $getAnnotationText
@return array An array mapping site IDs to arrays holding dates & the count of
annotations made for those dates. eg,
array(
5 => array(
array('2012-01-02', array('count' => 4, 'starred' => 2)),
array('2012-01-03', array('count' => 0, 'starred' => 0)),
array('2012-01-04', array('count' => 2, 'starred' => 0)),
),
6 => array(
array('2012-01-02', array('count' => 1, 'starred' => 0)),
array('2012-01-03', array('count' => 4, 'starred' => 3)),
array('2012-01-04', array('count' => 2, 'starred' => 0)),
),
...
) | [
"Returns",
"the",
"count",
"of",
"annotations",
"for",
"a",
"list",
"of",
"periods",
"including",
"the",
"count",
"of",
"starred",
"annotations",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Annotations/API.php#L222-L274 | train | Returns annotation count for a given date range and annotation period | [
30522,
2270,
3853,
2131,
11639,
17287,
3508,
3597,
16671,
3877,
8520,
1006,
1002,
8909,
28032,
2063,
1010,
1002,
3058,
1010,
1002,
2558,
1010,
1002,
2197,
2078,
1027,
6270,
1010,
1002,
2131,
11639,
17287,
30524,
2015,
1006,
1002,
8909,
2803... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Routing/RouteCollectionBuilder.php | RouteCollectionBuilder.load | private function load($resource, string $type = null): array
{
if (null === $this->loader) {
throw new \BadMethodCallException('Cannot import other routing resources: you must pass a LoaderInterface when constructing RouteCollectionBuilder.');
}
if ($this->loader->supports($resource, $type)) {
$collections = $this->loader->load($resource, $type);
return \is_array($collections) ? $collections : [$collections];
}
if (null === $resolver = $this->loader->getResolver()) {
throw new LoaderLoadException($resource, null, null, null, $type);
}
if (false === $loader = $resolver->resolve($resource, $type)) {
throw new LoaderLoadException($resource, null, null, null, $type);
}
$collections = $loader->load($resource, $type);
return \is_array($collections) ? $collections : [$collections];
} | php | private function load($resource, string $type = null): array
{
if (null === $this->loader) {
throw new \BadMethodCallException('Cannot import other routing resources: you must pass a LoaderInterface when constructing RouteCollectionBuilder.');
}
if ($this->loader->supports($resource, $type)) {
$collections = $this->loader->load($resource, $type);
return \is_array($collections) ? $collections : [$collections];
}
if (null === $resolver = $this->loader->getResolver()) {
throw new LoaderLoadException($resource, null, null, null, $type);
}
if (false === $loader = $resolver->resolve($resource, $type)) {
throw new LoaderLoadException($resource, null, null, null, $type);
}
$collections = $loader->load($resource, $type);
return \is_array($collections) ? $collections : [$collections];
} | [
"private",
"function",
"load",
"(",
"$",
"resource",
",",
"string",
"$",
"type",
"=",
"null",
")",
":",
"array",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"loader",
")",
"{",
"throw",
"new",
"\\",
"BadMethodCallException",
"(",
"'Cannot import ot... | Finds a loader able to load an imported resource and loads it.
@param mixed $resource A resource
@param string|null $type The resource type or null if unknown
@return RouteCollection[]
@throws LoaderLoadException If no loader is found | [
"Finds",
"a",
"loader",
"able",
"to",
"load",
"an",
"imported",
"resource",
"and",
"loads",
"it",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Routing/RouteCollectionBuilder.php#L352-L375 | train | Load the routing resources | [
30522,
2797,
3853,
7170,
30524,
1006,
1005,
3685,
12324,
2060,
16972,
4219,
1024,
2017,
2442,
3413,
1037,
7170,
23282,
3334,
12172,
2043,
15696,
2799,
26895,
18491,
8569,
23891,
2099,
1012,
1005,
1007,
1025,
1065,
2065,
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... |
matomo-org/matomo | core/Menu/MenuAdmin.php | MenuAdmin.addPersonalItem | public function addPersonalItem($menuName, $url, $order = 50, $tooltip = false)
{
$this->addItem('UsersManager_MenuPersonal', $menuName, $url, $order, $tooltip);
} | php | public function addPersonalItem($menuName, $url, $order = 50, $tooltip = false)
{
$this->addItem('UsersManager_MenuPersonal', $menuName, $url, $order, $tooltip);
} | [
"public",
"function",
"addPersonalItem",
"(",
"$",
"menuName",
",",
"$",
"url",
",",
"$",
"order",
"=",
"50",
",",
"$",
"tooltip",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"addItem",
"(",
"'UsersManager_MenuPersonal'",
",",
"$",
"menuName",
",",
"$",
... | See {@link add()}. Adds a new menu item to the manage section of the user menu.
@param string $menuName
@param array $url
@param int $order
@param bool|string $tooltip
@api
@since 2.5.0 | [
"See",
"{"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Menu/MenuAdmin.php#L32-L35 | train | Add a personal menu item | [
30522,
2270,
3853,
5587,
28823,
4221,
2213,
1006,
1002,
12183,
18442,
1010,
1002,
24471,
2140,
1010,
1002,
2344,
1027,
2753,
1010,
1002,
6994,
25101,
1027,
6270,
1007,
1063,
1002,
2023,
1011,
1028,
5587,
4221,
2213,
1006,
1005,
5198,
24805,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Routing/RouteCollectionBuilder.php | RouteCollectionBuilder.mount | public function mount($prefix, self $builder)
{
$builder->prefix = trim(trim($prefix), '/');
$this->routes[] = $builder;
} | php | public function mount($prefix, self $builder)
{
$builder->prefix = trim(trim($prefix), '/');
$this->routes[] = $builder;
} | [
"public",
"function",
"mount",
"(",
"$",
"prefix",
",",
"self",
"$",
"builder",
")",
"{",
"$",
"builder",
"->",
"prefix",
"=",
"trim",
"(",
"trim",
"(",
"$",
"prefix",
")",
",",
"'/'",
")",
";",
"$",
"this",
"->",
"routes",
"[",
"]",
"=",
"$",
... | Add a RouteCollectionBuilder.
@param string $prefix
@param RouteCollectionBuilder $builder | [
"Add",
"a",
"RouteCollectionBuilder",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Routing/RouteCollectionBuilder.php#L121-L125 | train | Mount a new route builder | [
30522,
2270,
3853,
4057,
1006,
1002,
17576,
1010,
2969,
1002,
12508,
1007,
1063,
1002,
12508,
1011,
1028,
17576,
1027,
12241,
1006,
12241,
1006,
1002,
17576,
1007,
1010,
1005,
1013,
1005,
1007,
1025,
1002,
2023,
1011,
1028,
5847,
1031,
1033... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Overlay/Controller.php | Controller.startOverlaySession | public function startOverlaySession()
{
$this->checkSitePermission();
Piwik::checkUserHasViewAccess($this->idSite);
$view = new View('@Overlay/startOverlaySession');
$sitesManager = APISitesManager::getInstance();
$site = $sitesManager->getSiteFromId($this->idSite);
$urls = $sitesManager->getSiteUrlsFromId($this->idSite);
$view->isHttps = ProxyHttp::isHttps();
$view->knownUrls = json_encode($urls);
$view->mainUrl = $site['main_url'];
$this->outputCORSHeaders();
Common::sendHeader('Content-Type: text/html; charset=UTF-8');
return $view->render();
} | php | public function startOverlaySession()
{
$this->checkSitePermission();
Piwik::checkUserHasViewAccess($this->idSite);
$view = new View('@Overlay/startOverlaySession');
$sitesManager = APISitesManager::getInstance();
$site = $sitesManager->getSiteFromId($this->idSite);
$urls = $sitesManager->getSiteUrlsFromId($this->idSite);
$view->isHttps = ProxyHttp::isHttps();
$view->knownUrls = json_encode($urls);
$view->mainUrl = $site['main_url'];
$this->outputCORSHeaders();
Common::sendHeader('Content-Type: text/html; charset=UTF-8');
return $view->render();
} | [
"public",
"function",
"startOverlaySession",
"(",
")",
"{",
"$",
"this",
"->",
"checkSitePermission",
"(",
")",
";",
"Piwik",
"::",
"checkUserHasViewAccess",
"(",
"$",
"this",
"->",
"idSite",
")",
";",
"$",
"view",
"=",
"new",
"View",
"(",
"'@Overlay/startOv... | Start an Overlay session: Redirect to the tracked website. The Piwik
tracker will recognize this referrer and start the session. | [
"Start",
"an",
"Overlay",
"session",
":",
"Redirect",
"to",
"the",
"tracked",
"website",
".",
"The",
"Piwik",
"tracker",
"will",
"recognize",
"this",
"referrer",
"and",
"start",
"the",
"session",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Overlay/Controller.php#L164-L183 | train | This method renders the HTML code to start the overlay session | [
30522,
2270,
3853,
2707,
7840,
8485,
8583,
10992,
1006,
1007,
1063,
1002,
2023,
1011,
1028,
14148,
4221,
4842,
25481,
1006,
1007,
1025,
14255,
9148,
2243,
1024,
1024,
4638,
20330,
14949,
8584,
6305,
9623,
2015,
1006,
1002,
2023,
1011,
1028,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Form/Extension/Core/DataTransformer/StringToFloatTransformer.php | StringToFloatTransformer.transform | public function transform($value)
{
if (null === $value) {
return null;
}
if (!\is_string($value) || !is_numeric($value)) {
throw new TransformationFailedException('Expected a numeric string.');
}
return (float) $value;
} | php | public function transform($value)
{
if (null === $value) {
return null;
}
if (!\is_string($value) || !is_numeric($value)) {
throw new TransformationFailedException('Expected a numeric string.');
}
return (float) $value;
} | [
"public",
"function",
"transform",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"value",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"!",
"\\",
"is_string",
"(",
"$",
"value",
")",
"||",
"!",
"is_numeric",
"(",
"$",
"value",
"... | @param mixed $value
@return float|null | [
"@param",
"mixed",
"$value"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Extension/Core/DataTransformer/StringToFloatTransformer.php#L31-L42 | train | Transforms a numeric string into a float | [
30522,
2270,
3853,
10938,
1006,
1002,
3643,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
1027,
1002,
3643,
1007,
1063,
2709,
19701,
1025,
1065,
2065,
1006,
999,
1032,
2003,
1035,
5164,
1006,
1002,
3643,
1007,
1064,
1064,
999,
2003,
1035,
16... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Config.php | Zend_Config.next | public function next()
{
if ($this->_skipNextIteration) {
$this->_skipNextIteration = false;
return;
}
next($this->_data);
$this->_index++;
} | php | public function next()
{
if ($this->_skipNextIteration) {
$this->_skipNextIteration = false;
return;
}
next($this->_data);
$this->_index++;
} | [
"public",
"function",
"next",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_skipNextIteration",
")",
"{",
"$",
"this",
"->",
"_skipNextIteration",
"=",
"false",
";",
"return",
";",
"}",
"next",
"(",
"$",
"this",
"->",
"_data",
")",
";",
"$",
"this",... | Defined by Iterator interface | [
"Defined",
"by",
"Iterator",
"interface"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Config.php#L278-L286 | train | Returns the next term in the iterator | [
30522,
2270,
3853,
2279,
1006,
30524,
1009,
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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/SQLiteBuilder.php | SQLiteBuilder.dropAllTables | public function dropAllTables()
{
if ($this->connection->getDatabaseName() !== ':memory:') {
return $this->refreshDatabaseFile();
}
$this->connection->select($this->grammar->compileEnableWriteableSchema());
$this->connection->select($this->grammar->compileDropAllTables());
$this->connection->select($this->grammar->compileDisableWriteableSchema());
$this->connection->select($this->grammar->compileRebuild());
} | php | public function dropAllTables()
{
if ($this->connection->getDatabaseName() !== ':memory:') {
return $this->refreshDatabaseFile();
}
$this->connection->select($this->grammar->compileEnableWriteableSchema());
$this->connection->select($this->grammar->compileDropAllTables());
$this->connection->select($this->grammar->compileDisableWriteableSchema());
$this->connection->select($this->grammar->compileRebuild());
} | [
"public",
"function",
"dropAllTables",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"connection",
"->",
"getDatabaseName",
"(",
")",
"!==",
"':memory:'",
")",
"{",
"return",
"$",
"this",
"->",
"refreshDatabaseFile",
"(",
")",
";",
"}",
"$",
"this",
"->",... | Drop all tables from the database.
@return void | [
"Drop",
"all",
"tables",
"from",
"the",
"database",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Schema/SQLiteBuilder.php#L12-L25 | train | Drop all tables in the database | [
30522,
2270,
3853,
4530,
8095,
10880,
2015,
1006,
1007,
1063,
2065,
1006,
1002,
2023,
1011,
1028,
4434,
1011,
1028,
2131,
2850,
2696,
15058,
18442,
1006,
1007,
999,
1027,
1027,
1005,
1024,
3638,
1024,
1005,
1007,
1063,
2709,
1002,
2023,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Filesystem/Filesystem.php | Filesystem.replace | public function replace($path, $content)
{
// If the path already exists and is a symlink, get the real path...
clearstatcache(true, $path);
$path = realpath($path) ?: $path;
$tempPath = tempnam(dirname($path), basename($path));
// Fix permissions of tempPath because `tempnam()` creates it with permissions set to 0600...
chmod($tempPath, 0777 - umask());
file_put_contents($tempPath, $content);
rename($tempPath, $path);
} | php | public function replace($path, $content)
{
// If the path already exists and is a symlink, get the real path...
clearstatcache(true, $path);
$path = realpath($path) ?: $path;
$tempPath = tempnam(dirname($path), basename($path));
// Fix permissions of tempPath because `tempnam()` creates it with permissions set to 0600...
chmod($tempPath, 0777 - umask());
file_put_contents($tempPath, $content);
rename($tempPath, $path);
} | [
"public",
"function",
"replace",
"(",
"$",
"path",
",",
"$",
"content",
")",
"{",
"// If the path already exists and is a symlink, get the real path...",
"clearstatcache",
"(",
"true",
",",
"$",
"path",
")",
";",
"$",
"path",
"=",
"realpath",
"(",
"$",
"path",
"... | Write the contents of a file, replacing it atomically if it already exists.
@param string $path
@param string $content
@return void | [
"Write",
"the",
"contents",
"of",
"a",
"file",
"replacing",
"it",
"atomically",
"if",
"it",
"already",
"exists",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Filesystem/Filesystem.php#L132-L147 | train | Replaces the content of the file with the content of the file | [
30522,
2270,
3853,
5672,
1006,
1002,
4130,
1010,
1002,
4180,
1007,
1063,
1013,
1013,
2065,
1996,
4130,
2525,
6526,
1998,
2003,
1037,
25353,
19968,
19839,
1010,
2131,
1996,
2613,
4130,
1012,
1012,
1012,
28837,
29336,
3540,
5403,
1006,
2995,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/widgets/AssetList.php | AssetList.validateFileType | protected function validateFileType($name)
{
$extension = strtolower(File::extension($name));
if (!in_array($extension, $this->assetExtensions)) {
return false;
}
return true;
} | php | protected function validateFileType($name)
{
$extension = strtolower(File::extension($name));
if (!in_array($extension, $this->assetExtensions)) {
return false;
}
return true;
} | [
"protected",
"function",
"validateFileType",
"(",
"$",
"name",
")",
"{",
"$",
"extension",
"=",
"strtolower",
"(",
"File",
"::",
"extension",
"(",
"$",
"name",
")",
")",
";",
"if",
"(",
"!",
"in_array",
"(",
"$",
"extension",
",",
"$",
"this",
"->",
... | Check for valid asset file extension
@param string
@return bool | [
"Check",
"for",
"valid",
"asset",
"file",
"extension"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/widgets/AssetList.php#L603-L612 | train | Validate asset file type | [
30522,
5123,
3853,
9398,
3686,
8873,
7485,
18863,
1006,
1002,
2171,
1007,
1063,
1002,
5331,
1027,
2358,
5339,
12898,
13777,
1006,
5371,
1024,
1024,
5331,
1006,
1002,
2171,
1007,
1007,
1025,
2065,
1006,
999,
1999,
1035,
9140,
1006,
1002,
5... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Auth/Console/AuthMakeCommand.php | AuthMakeCommand.createDirectories | protected function createDirectories()
{
if (! is_dir($directory = $this->getViewPath('layouts'))) {
mkdir($directory, 0755, true);
}
if (! is_dir($directory = $this->getViewPath('auth/passwords'))) {
mkdir($directory, 0755, true);
}
} | php | protected function createDirectories()
{
if (! is_dir($directory = $this->getViewPath('layouts'))) {
mkdir($directory, 0755, true);
}
if (! is_dir($directory = $this->getViewPath('auth/passwords'))) {
mkdir($directory, 0755, true);
}
} | [
"protected",
"function",
"createDirectories",
"(",
")",
"{",
"if",
"(",
"!",
"is_dir",
"(",
"$",
"directory",
"=",
"$",
"this",
"->",
"getViewPath",
"(",
"'layouts'",
")",
")",
")",
"{",
"mkdir",
"(",
"$",
"directory",
",",
"0755",
",",
"true",
")",
... | Create the directories for the files.
@return void | [
"Create",
"the",
"directories",
"for",
"the",
"files",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Auth/Console/AuthMakeCommand.php#L75-L84 | train | Create directories for layout and auth | [
30522,
5123,
3853,
2580,
7442,
16761,
3111,
1006,
1007,
1063,
2065,
1006,
999,
2003,
1035,
16101,
1006,
1002,
14176,
1027,
1002,
2023,
1011,
1028,
2131,
8584,
15069,
1006,
1005,
9621,
2015,
1005,
1007,
1007,
1007,
1063,
12395,
4305,
2099,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
z-song/laravel-admin | src/Form/Field/Tags.php | Tags.options | public function options($options = [])
{
if (!$this->keyAsValue) {
return parent::options($options);
}
if ($options instanceof Collection) {
$options = $options->pluck($this->visibleColumn, $this->key)->toArray();
}
if ($options instanceof Arrayable) {
$options = $options->toArray();
}
$this->options = $options + $this->options;
return $this;
} | php | public function options($options = [])
{
if (!$this->keyAsValue) {
return parent::options($options);
}
if ($options instanceof Collection) {
$options = $options->pluck($this->visibleColumn, $this->key)->toArray();
}
if ($options instanceof Arrayable) {
$options = $options->toArray();
}
$this->options = $options + $this->options;
return $this;
} | [
"public",
"function",
"options",
"(",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"keyAsValue",
")",
"{",
"return",
"parent",
"::",
"options",
"(",
"$",
"options",
")",
";",
"}",
"if",
"(",
"$",
"options",
"instanceo... | Set the field options.
@param array|Collection|Arrayable $options
@return $this|Field | [
"Set",
"the",
"field",
"options",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Form/Field/Tags.php#L96-L113 | train | Options for this column | [
30522,
2270,
3853,
7047,
1006,
1002,
7047,
1027,
1031,
1033,
1007,
1063,
2065,
1006,
999,
1002,
2023,
1011,
1028,
3145,
3022,
10175,
5657,
1007,
1063,
2709,
6687,
1024,
1024,
7047,
1006,
1002,
7047,
1007,
1025,
1065,
2065,
1006,
1002,
704... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
overtrue/wechat | src/OfficialAccount/ShakeAround/DeviceClient.php | DeviceClient.bindPoi | public function bindPoi(array $deviceIdentifier, int $poiId)
{
$params = [
'device_identifier' => $deviceIdentifier,
'poi_id' => $poiId,
];
return $this->httpPostJson('shakearound/device/bindlocation', $params);
} | php | public function bindPoi(array $deviceIdentifier, int $poiId)
{
$params = [
'device_identifier' => $deviceIdentifier,
'poi_id' => $poiId,
];
return $this->httpPostJson('shakearound/device/bindlocation', $params);
} | [
"public",
"function",
"bindPoi",
"(",
"array",
"$",
"deviceIdentifier",
",",
"int",
"$",
"poiId",
")",
"{",
"$",
"params",
"=",
"[",
"'device_identifier'",
"=>",
"$",
"deviceIdentifier",
",",
"'poi_id'",
"=>",
"$",
"poiId",
",",
"]",
";",
"return",
"$",
... | Bind location for device.
@param array $deviceIdentifier
@param int $poiId
@return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string
@throws InvalidArgumentException | [
"Bind",
"location",
"for",
"device",
"."
] | 120c72faaa93c270365bc75c73c362d5fd583209 | https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/OfficialAccount/ShakeAround/DeviceClient.php#L78-L86 | train | Bind Poi to Device | [
30522,
2270,
3853,
14187,
6873,
2072,
1006,
9140,
1002,
5080,
5178,
16778,
8873,
2121,
1010,
20014,
1002,
13433,
6137,
2094,
1007,
1063,
1002,
11498,
5244,
1027,
1031,
1005,
5080,
1035,
8909,
4765,
30524,
1011,
1028,
8299,
19894,
22578,
223... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Database/Schema/Grammars/SqlServerGrammar.php | SqlServerGrammar.compileDropColumn | public function compileDropColumn(Blueprint $blueprint, Fluent $command)
{
$columns = $this->wrapArray($command->columns);
return 'alter table '.$this->wrapTable($blueprint).' drop column '.implode(', ', $columns);
} | php | public function compileDropColumn(Blueprint $blueprint, Fluent $command)
{
$columns = $this->wrapArray($command->columns);
return 'alter table '.$this->wrapTable($blueprint).' drop column '.implode(', ', $columns);
} | [
"public",
"function",
"compileDropColumn",
"(",
"Blueprint",
"$",
"blueprint",
",",
"Fluent",
"$",
"command",
")",
"{",
"$",
"columns",
"=",
"$",
"this",
"->",
"wrapArray",
"(",
"$",
"command",
"->",
"columns",
")",
";",
"return",
"'alter table '",
".",
"$... | Compile a drop column command.
@param \Illuminate\Database\Schema\Blueprint $blueprint
@param \Illuminate\Support\Fluent $command
@return string | [
"Compile",
"a",
"drop",
"column",
"command",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Schema/Grammars/SqlServerGrammar.php#L191-L196 | train | Compiles drop column SQL statement. | [
30522,
2270,
3853,
9227,
18981,
25778,
2819,
2078,
1006,
2630,
16550,
1002,
2630,
16550,
1010,
19376,
1002,
3094,
1007,
1063,
1002,
7753,
1027,
1002,
2023,
1011,
1028,
10236,
2906,
9447,
1006,
1002,
3094,
1011,
1028,
7753,
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... |
matomo-org/matomo | plugins/Live/Visitor.php | Visitor.enrichVisitorArrayWithActions | public static function enrichVisitorArrayWithActions($visitorDetailsArray, $actionDetails = array())
{
$actionsLimit = (int)Config::getInstance()->General['visitor_log_maximum_actions_per_visit'];
$visitorDetailsManipulators = self::getAllVisitorDetailsInstances();
foreach ($visitorDetailsManipulators as $instance) {
$instance->provideActionsForVisit($actionDetails, $visitorDetailsArray);
}
foreach ($visitorDetailsManipulators as $instance) {
$instance->filterActions($actionDetails, $visitorDetailsArray);
}
usort($actionDetails, array('static', 'sortByServerTime'));
$actionDetails = array_values($actionDetails);
// limit actions
if ($actionsLimit < count($actionDetails)) {
$visitorDetailsArray['truncatedActionsCount'] = count($actionDetails) - $actionsLimit;
$actionDetails = array_slice($actionDetails, 0, $actionsLimit);
}
foreach ($actionDetails as $actionIdx => &$actionDetail) {
$actionDetail =& $actionDetails[$actionIdx];
$nextAction = isset($actionDetails[$actionIdx+1]) ? $actionDetails[$actionIdx+1] : null;
foreach ($visitorDetailsManipulators as $instance) {
$instance->extendActionDetails($actionDetail, $nextAction, $visitorDetailsArray);
}
}
$visitorDetailsArray['actionDetails'] = $actionDetails;
return $visitorDetailsArray;
} | php | public static function enrichVisitorArrayWithActions($visitorDetailsArray, $actionDetails = array())
{
$actionsLimit = (int)Config::getInstance()->General['visitor_log_maximum_actions_per_visit'];
$visitorDetailsManipulators = self::getAllVisitorDetailsInstances();
foreach ($visitorDetailsManipulators as $instance) {
$instance->provideActionsForVisit($actionDetails, $visitorDetailsArray);
}
foreach ($visitorDetailsManipulators as $instance) {
$instance->filterActions($actionDetails, $visitorDetailsArray);
}
usort($actionDetails, array('static', 'sortByServerTime'));
$actionDetails = array_values($actionDetails);
// limit actions
if ($actionsLimit < count($actionDetails)) {
$visitorDetailsArray['truncatedActionsCount'] = count($actionDetails) - $actionsLimit;
$actionDetails = array_slice($actionDetails, 0, $actionsLimit);
}
foreach ($actionDetails as $actionIdx => &$actionDetail) {
$actionDetail =& $actionDetails[$actionIdx];
$nextAction = isset($actionDetails[$actionIdx+1]) ? $actionDetails[$actionIdx+1] : null;
foreach ($visitorDetailsManipulators as $instance) {
$instance->extendActionDetails($actionDetail, $nextAction, $visitorDetailsArray);
}
}
$visitorDetailsArray['actionDetails'] = $actionDetails;
return $visitorDetailsArray;
} | [
"public",
"static",
"function",
"enrichVisitorArrayWithActions",
"(",
"$",
"visitorDetailsArray",
",",
"$",
"actionDetails",
"=",
"array",
"(",
")",
")",
"{",
"$",
"actionsLimit",
"=",
"(",
"int",
")",
"Config",
"::",
"getInstance",
"(",
")",
"->",
"General",
... | @param array $visitorDetailsArray
@param array $actionDetails preset action details
@return array | [
"@param",
"array",
"$visitorDetailsArray",
"@param",
"array",
"$actionDetails",
"preset",
"action",
"details"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Live/Visitor.php#L281-L316 | train | Enriches the visitor array with the action details of all the visits | [
30522,
2270,
10763,
3853,
4372,
13149,
11365,
15660,
2906,
9447,
24415,
18908,
8496,
1006,
1002,
10367,
3207,
22081,
2906,
9447,
1010,
1002,
2895,
3207,
22081,
1027,
9140,
1006,
1007,
1007,
1063,
1002,
4506,
17960,
4183,
1027,
1006,
20014,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/HttpClient/CurlHttpClient.php | CurlHttpClient.request | public function request(string $method, string $url, array $options = []): ResponseInterface
{
[$url, $options] = self::prepareRequest($method, $url, $options, $this->defaultOptions);
$scheme = $url['scheme'];
$authority = $url['authority'];
$host = parse_url($authority, PHP_URL_HOST);
$url = implode('', $url);
if ($pushedResponse = $this->multi->pushedResponses[$url] ?? null) {
unset($this->multi->pushedResponses[$url]);
// Accept pushed responses only if their headers related to authentication match the request
$expectedHeaders = [
$options['headers']['authorization'] ?? null,
$options['headers']['cookie'] ?? null,
$options['headers']['x-requested-with'] ?? null,
$options['headers']['range'] ?? null,
];
if ('GET' === $method && $expectedHeaders === $pushedResponse->headers && !$options['body']) {
$this->logger && $this->logger->debug(sprintf('Connecting request to pushed response: "%s %s"', $method, $url));
// Reinitialize the pushed response with request's options
$pushedResponse->response->__construct($this->multi, $url, $options, $this->logger);
return $pushedResponse->response;
}
$this->logger && $this->logger->debug(sprintf('Rejecting pushed response for "%s": authorization headers don\'t match the request', $url));
}
$this->logger && $this->logger->info(sprintf('Request: "%s %s"', $method, $url));
$curlopts = [
CURLOPT_URL => $url,
CURLOPT_USERAGENT => 'Symfony HttpClient/Curl',
CURLOPT_TCP_NODELAY => true,
CURLOPT_PROTOCOLS => CURLPROTO_HTTP | CURLPROTO_HTTPS,
CURLOPT_REDIR_PROTOCOLS => CURLPROTO_HTTP | CURLPROTO_HTTPS,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_MAXREDIRS => 0 < $options['max_redirects'] ? $options['max_redirects'] : 0,
CURLOPT_COOKIEFILE => '', // Keep track of cookies during redirects
CURLOPT_CONNECTTIMEOUT_MS => 1000 * $options['timeout'],
CURLOPT_PROXY => $options['proxy'],
CURLOPT_NOPROXY => $options['no_proxy'] ?? $_SERVER['no_proxy'] ?? $_SERVER['NO_PROXY'] ?? '',
CURLOPT_SSL_VERIFYPEER => $options['verify_peer'],
CURLOPT_SSL_VERIFYHOST => $options['verify_host'] ? 2 : 0,
CURLOPT_CAINFO => $options['cafile'],
CURLOPT_CAPATH => $options['capath'],
CURLOPT_SSL_CIPHER_LIST => $options['ciphers'],
CURLOPT_SSLCERT => $options['local_cert'],
CURLOPT_SSLKEY => $options['local_pk'],
CURLOPT_KEYPASSWD => $options['passphrase'],
CURLOPT_CERTINFO => $options['capture_peer_cert_chain'],
];
if (!ZEND_THREAD_SAFE) {
$curlopts[CURLOPT_DNS_USE_GLOBAL_CACHE] = false;
}
if (\defined('CURLOPT_HEADEROPT')) {
$curlopts[CURLOPT_HEADEROPT] = CURLHEADER_SEPARATE;
}
// curl's resolve feature varies by host:port but ours varies by host only, let's handle this with our own DNS map
if (isset($this->multi->dnsCache->hostnames[$host])) {
$options['resolve'] += [$host => $this->multi->dnsCache->hostnames[$host]];
}
if ($options['resolve'] || $this->multi->dnsCache->evictions) {
// First reset any old DNS cache entries then add the new ones
$resolve = $this->multi->dnsCache->evictions;
$this->multi->dnsCache->evictions = [];
$port = parse_url($authority, PHP_URL_PORT) ?: ('http:' === $scheme ? 80 : 443);
if ($resolve && 0x072a00 > curl_version()['version_number']) {
// DNS cache removals require curl 7.42 or higher
// On lower versions, we have to create a new multi handle
curl_multi_close($this->multi->handle);
$this->multi->handle = (new self())->multi->handle;
}
foreach ($options['resolve'] as $host => $ip) {
$resolve[] = null === $ip ? "-$host:$port" : "$host:$port:$ip";
$this->multi->dnsCache->hostnames[$host] = $ip;
$this->multi->dnsCache->removals["-$host:$port"] = "-$host:$port";
}
$curlopts[CURLOPT_RESOLVE] = $resolve;
}
if (1.0 === (float) $options['http_version']) {
$curlopts[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_1_0;
} elseif (1.1 === (float) $options['http_version'] || 'https:' !== $scheme) {
$curlopts[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_1_1;
} elseif (CURL_VERSION_HTTP2 & curl_version()['features']) {
$curlopts[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_2_0;
}
if ('POST' === $method) {
// Use CURLOPT_POST to have browser-like POST-to-GET redirects for 301, 302 and 303
$curlopts[CURLOPT_POST] = true;
} else {
$curlopts[CURLOPT_CUSTOMREQUEST] = $method;
}
if ('\\' !== \DIRECTORY_SEPARATOR && $options['timeout'] < 1) {
$curlopts[CURLOPT_NOSIGNAL] = true;
}
if (!isset($options['headers']['accept-encoding'])) {
$curlopts[CURLOPT_ENCODING] = ''; // Enable HTTP compression
}
foreach ($options['request_headers'] as $header) {
if (':' === $header[-2] && \strlen($header) - 2 === strpos($header, ': ')) {
// curl requires a special syntax to send empty headers
$curlopts[CURLOPT_HTTPHEADER][] = substr_replace($header, ';', -2);
} else {
$curlopts[CURLOPT_HTTPHEADER][] = $header;
}
}
// Prevent curl from sending its default Accept and Expect headers
foreach (['accept', 'expect'] as $header) {
if (!isset($options['headers'][$header])) {
$curlopts[CURLOPT_HTTPHEADER][] = $header.':';
}
}
if (!\is_string($body = $options['body'])) {
if (\is_resource($body)) {
$curlopts[CURLOPT_INFILE] = $body;
} else {
$eof = false;
$buffer = '';
$curlopts[CURLOPT_READFUNCTION] = static function ($ch, $fd, $length) use ($body, &$buffer, &$eof) {
return self::readRequestBody($length, $body, $buffer, $eof);
};
}
if (isset($options['headers']['content-length'][0])) {
$curlopts[CURLOPT_INFILESIZE] = $options['headers']['content-length'][0];
} elseif (!isset($options['headers']['transfer-encoding'])) {
$curlopts[CURLOPT_HTTPHEADER][] = 'Transfer-Encoding: chunked'; // Enable chunked request bodies
}
if ('POST' !== $method) {
$curlopts[CURLOPT_UPLOAD] = true;
}
} elseif ('' !== $body) {
$curlopts[CURLOPT_POSTFIELDS] = $body;
}
if ($options['peer_fingerprint']) {
if (!isset($options['peer_fingerprint']['pin-sha256'])) {
throw new TransportException(__CLASS__.' supports only "pin-sha256" fingerprints.');
}
$curlopts[CURLOPT_PINNEDPUBLICKEY] = 'sha256//'.implode(';sha256//', $options['peer_fingerprint']['pin-sha256']);
}
if ($options['bindto']) {
$curlopts[file_exists($options['bindto']) ? CURLOPT_UNIX_SOCKET_PATH : CURLOPT_INTERFACE] = $options['bindto'];
}
$ch = curl_init();
foreach ($curlopts as $opt => $value) {
if (null !== $value && !curl_setopt($ch, $opt, $value) && CURLOPT_CERTINFO !== $opt) {
$constants = array_filter(get_defined_constants(), static function ($v, $k) use ($opt) {
return $v === $opt && 'C' === $k[0] && (0 === strpos($k, 'CURLOPT_') || 0 === strpos($k, 'CURLINFO_'));
}, ARRAY_FILTER_USE_BOTH);
throw new TransportException(sprintf('Curl option "%s" is not supported.', key($constants) ?? $opt));
}
}
return new CurlResponse($this->multi, $ch, $options, $this->logger, $method, self::createRedirectResolver($options, $host));
} | php | public function request(string $method, string $url, array $options = []): ResponseInterface
{
[$url, $options] = self::prepareRequest($method, $url, $options, $this->defaultOptions);
$scheme = $url['scheme'];
$authority = $url['authority'];
$host = parse_url($authority, PHP_URL_HOST);
$url = implode('', $url);
if ($pushedResponse = $this->multi->pushedResponses[$url] ?? null) {
unset($this->multi->pushedResponses[$url]);
// Accept pushed responses only if their headers related to authentication match the request
$expectedHeaders = [
$options['headers']['authorization'] ?? null,
$options['headers']['cookie'] ?? null,
$options['headers']['x-requested-with'] ?? null,
$options['headers']['range'] ?? null,
];
if ('GET' === $method && $expectedHeaders === $pushedResponse->headers && !$options['body']) {
$this->logger && $this->logger->debug(sprintf('Connecting request to pushed response: "%s %s"', $method, $url));
// Reinitialize the pushed response with request's options
$pushedResponse->response->__construct($this->multi, $url, $options, $this->logger);
return $pushedResponse->response;
}
$this->logger && $this->logger->debug(sprintf('Rejecting pushed response for "%s": authorization headers don\'t match the request', $url));
}
$this->logger && $this->logger->info(sprintf('Request: "%s %s"', $method, $url));
$curlopts = [
CURLOPT_URL => $url,
CURLOPT_USERAGENT => 'Symfony HttpClient/Curl',
CURLOPT_TCP_NODELAY => true,
CURLOPT_PROTOCOLS => CURLPROTO_HTTP | CURLPROTO_HTTPS,
CURLOPT_REDIR_PROTOCOLS => CURLPROTO_HTTP | CURLPROTO_HTTPS,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_MAXREDIRS => 0 < $options['max_redirects'] ? $options['max_redirects'] : 0,
CURLOPT_COOKIEFILE => '', // Keep track of cookies during redirects
CURLOPT_CONNECTTIMEOUT_MS => 1000 * $options['timeout'],
CURLOPT_PROXY => $options['proxy'],
CURLOPT_NOPROXY => $options['no_proxy'] ?? $_SERVER['no_proxy'] ?? $_SERVER['NO_PROXY'] ?? '',
CURLOPT_SSL_VERIFYPEER => $options['verify_peer'],
CURLOPT_SSL_VERIFYHOST => $options['verify_host'] ? 2 : 0,
CURLOPT_CAINFO => $options['cafile'],
CURLOPT_CAPATH => $options['capath'],
CURLOPT_SSL_CIPHER_LIST => $options['ciphers'],
CURLOPT_SSLCERT => $options['local_cert'],
CURLOPT_SSLKEY => $options['local_pk'],
CURLOPT_KEYPASSWD => $options['passphrase'],
CURLOPT_CERTINFO => $options['capture_peer_cert_chain'],
];
if (!ZEND_THREAD_SAFE) {
$curlopts[CURLOPT_DNS_USE_GLOBAL_CACHE] = false;
}
if (\defined('CURLOPT_HEADEROPT')) {
$curlopts[CURLOPT_HEADEROPT] = CURLHEADER_SEPARATE;
}
// curl's resolve feature varies by host:port but ours varies by host only, let's handle this with our own DNS map
if (isset($this->multi->dnsCache->hostnames[$host])) {
$options['resolve'] += [$host => $this->multi->dnsCache->hostnames[$host]];
}
if ($options['resolve'] || $this->multi->dnsCache->evictions) {
// First reset any old DNS cache entries then add the new ones
$resolve = $this->multi->dnsCache->evictions;
$this->multi->dnsCache->evictions = [];
$port = parse_url($authority, PHP_URL_PORT) ?: ('http:' === $scheme ? 80 : 443);
if ($resolve && 0x072a00 > curl_version()['version_number']) {
// DNS cache removals require curl 7.42 or higher
// On lower versions, we have to create a new multi handle
curl_multi_close($this->multi->handle);
$this->multi->handle = (new self())->multi->handle;
}
foreach ($options['resolve'] as $host => $ip) {
$resolve[] = null === $ip ? "-$host:$port" : "$host:$port:$ip";
$this->multi->dnsCache->hostnames[$host] = $ip;
$this->multi->dnsCache->removals["-$host:$port"] = "-$host:$port";
}
$curlopts[CURLOPT_RESOLVE] = $resolve;
}
if (1.0 === (float) $options['http_version']) {
$curlopts[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_1_0;
} elseif (1.1 === (float) $options['http_version'] || 'https:' !== $scheme) {
$curlopts[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_1_1;
} elseif (CURL_VERSION_HTTP2 & curl_version()['features']) {
$curlopts[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_2_0;
}
if ('POST' === $method) {
// Use CURLOPT_POST to have browser-like POST-to-GET redirects for 301, 302 and 303
$curlopts[CURLOPT_POST] = true;
} else {
$curlopts[CURLOPT_CUSTOMREQUEST] = $method;
}
if ('\\' !== \DIRECTORY_SEPARATOR && $options['timeout'] < 1) {
$curlopts[CURLOPT_NOSIGNAL] = true;
}
if (!isset($options['headers']['accept-encoding'])) {
$curlopts[CURLOPT_ENCODING] = ''; // Enable HTTP compression
}
foreach ($options['request_headers'] as $header) {
if (':' === $header[-2] && \strlen($header) - 2 === strpos($header, ': ')) {
// curl requires a special syntax to send empty headers
$curlopts[CURLOPT_HTTPHEADER][] = substr_replace($header, ';', -2);
} else {
$curlopts[CURLOPT_HTTPHEADER][] = $header;
}
}
// Prevent curl from sending its default Accept and Expect headers
foreach (['accept', 'expect'] as $header) {
if (!isset($options['headers'][$header])) {
$curlopts[CURLOPT_HTTPHEADER][] = $header.':';
}
}
if (!\is_string($body = $options['body'])) {
if (\is_resource($body)) {
$curlopts[CURLOPT_INFILE] = $body;
} else {
$eof = false;
$buffer = '';
$curlopts[CURLOPT_READFUNCTION] = static function ($ch, $fd, $length) use ($body, &$buffer, &$eof) {
return self::readRequestBody($length, $body, $buffer, $eof);
};
}
if (isset($options['headers']['content-length'][0])) {
$curlopts[CURLOPT_INFILESIZE] = $options['headers']['content-length'][0];
} elseif (!isset($options['headers']['transfer-encoding'])) {
$curlopts[CURLOPT_HTTPHEADER][] = 'Transfer-Encoding: chunked'; // Enable chunked request bodies
}
if ('POST' !== $method) {
$curlopts[CURLOPT_UPLOAD] = true;
}
} elseif ('' !== $body) {
$curlopts[CURLOPT_POSTFIELDS] = $body;
}
if ($options['peer_fingerprint']) {
if (!isset($options['peer_fingerprint']['pin-sha256'])) {
throw new TransportException(__CLASS__.' supports only "pin-sha256" fingerprints.');
}
$curlopts[CURLOPT_PINNEDPUBLICKEY] = 'sha256//'.implode(';sha256//', $options['peer_fingerprint']['pin-sha256']);
}
if ($options['bindto']) {
$curlopts[file_exists($options['bindto']) ? CURLOPT_UNIX_SOCKET_PATH : CURLOPT_INTERFACE] = $options['bindto'];
}
$ch = curl_init();
foreach ($curlopts as $opt => $value) {
if (null !== $value && !curl_setopt($ch, $opt, $value) && CURLOPT_CERTINFO !== $opt) {
$constants = array_filter(get_defined_constants(), static function ($v, $k) use ($opt) {
return $v === $opt && 'C' === $k[0] && (0 === strpos($k, 'CURLOPT_') || 0 === strpos($k, 'CURLINFO_'));
}, ARRAY_FILTER_USE_BOTH);
throw new TransportException(sprintf('Curl option "%s" is not supported.', key($constants) ?? $opt));
}
}
return new CurlResponse($this->multi, $ch, $options, $this->logger, $method, self::createRedirectResolver($options, $host));
} | [
"public",
"function",
"request",
"(",
"string",
"$",
"method",
",",
"string",
"$",
"url",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
":",
"ResponseInterface",
"{",
"[",
"$",
"url",
",",
"$",
"options",
"]",
"=",
"self",
"::",
"prepareRequest",
... | @see HttpClientInterface::OPTIONS_DEFAULTS for available options
{@inheritdoc} | [
"@see",
"HttpClientInterface",
"::",
"OPTIONS_DEFAULTS",
"for",
"available",
"options"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpClient/CurlHttpClient.php#L97-L275 | train | Sends a request to the specified url and returns a response | [
30522,
2270,
3853,
5227,
1006,
5164,
1002,
4118,
1010,
5164,
1002,
24471,
2140,
1010,
9140,
1002,
7047,
1027,
1031,
1033,
1007,
1024,
3433,
18447,
2121,
12172,
1063,
1031,
1002,
24471,
2140,
1010,
1002,
7047,
1033,
1027,
2969,
1024,
1024,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Validator/Constraints/UniqueValidator.php | UniqueValidator.validate | public function validate($value, Constraint $constraint)
{
if (!$constraint instanceof Unique) {
throw new UnexpectedTypeException($constraint, Unique::class);
}
if (null === $value) {
return;
}
if (!\is_array($value) && !$value instanceof \IteratorAggregate) {
throw new UnexpectedValueException($value, 'array|IteratorAggregate');
}
$collectionElements = [];
foreach ($value as $element) {
if (\in_array($element, $collectionElements, true)) {
$this->context->buildViolation($constraint->message)
->setParameter('{{ value }}', $this->formatValue($value))
->setCode(Unique::IS_NOT_UNIQUE)
->addViolation();
return;
}
$collectionElements[] = $element;
}
} | php | public function validate($value, Constraint $constraint)
{
if (!$constraint instanceof Unique) {
throw new UnexpectedTypeException($constraint, Unique::class);
}
if (null === $value) {
return;
}
if (!\is_array($value) && !$value instanceof \IteratorAggregate) {
throw new UnexpectedValueException($value, 'array|IteratorAggregate');
}
$collectionElements = [];
foreach ($value as $element) {
if (\in_array($element, $collectionElements, true)) {
$this->context->buildViolation($constraint->message)
->setParameter('{{ value }}', $this->formatValue($value))
->setCode(Unique::IS_NOT_UNIQUE)
->addViolation();
return;
}
$collectionElements[] = $element;
}
} | [
"public",
"function",
"validate",
"(",
"$",
"value",
",",
"Constraint",
"$",
"constraint",
")",
"{",
"if",
"(",
"!",
"$",
"constraint",
"instanceof",
"Unique",
")",
"{",
"throw",
"new",
"UnexpectedTypeException",
"(",
"$",
"constraint",
",",
"Unique",
"::",
... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Validator/Constraints/UniqueValidator.php#L27-L53 | train | Checks if the value is a unique | [
30522,
2270,
3853,
9398,
3686,
1006,
1002,
3643,
1010,
27142,
1002,
27142,
1007,
1063,
2065,
1006,
999,
1002,
27142,
6013,
11253,
4310,
1007,
1063,
5466,
2047,
9223,
13874,
10288,
24422,
1006,
1002,
27142,
1010,
4310,
1024,
1024,
2465,
1007... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Database/Connectors/MySqlConnector.php | MySqlConnector.setCustomModes | protected function setCustomModes(PDO $connection, array $config)
{
$modes = implode(',', $config['modes']);
$connection->prepare("set session sql_mode='{$modes}'")->execute();
} | php | protected function setCustomModes(PDO $connection, array $config)
{
$modes = implode(',', $config['modes']);
$connection->prepare("set session sql_mode='{$modes}'")->execute();
} | [
"protected",
"function",
"setCustomModes",
"(",
"PDO",
"$",
"connection",
",",
"array",
"$",
"config",
")",
"{",
"$",
"modes",
"=",
"implode",
"(",
"','",
",",
"$",
"config",
"[",
"'modes'",
"]",
")",
";",
"$",
"connection",
"->",
"prepare",
"(",
"\"se... | Set the custom modes on the connection.
@param \PDO $connection
@param array $config
@return void | [
"Set",
"the",
"custom",
"modes",
"on",
"the",
"connection",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Connectors/MySqlConnector.php#L164-L169 | train | Set custom modes | [
30522,
5123,
3853,
2275,
7874,
20389,
5302,
6155,
1006,
22851,
2080,
1002,
4434,
1010,
9140,
1002,
9530,
8873,
2290,
1007,
1063,
1002,
11583,
1027,
17727,
4135,
3207,
1006,
1005,
1010,
1005,
1010,
1002,
9530,
8873,
2290,
1031,
1005,
11583,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Uri.php | Uri.params | public function params($id = null, $array = false)
{
$config = Grav::instance()['config'];
$sep = $config->get('system.param_sep');
$params = null;
if ($id === null) {
if ($array) {
return $this->params;
}
$output = [];
foreach ($this->params as $key => $value) {
$output[] = "{$key}{$sep}{$value}";
$params = '/' . implode('/', $output);
}
} elseif (isset($this->params[$id])) {
if ($array) {
return $this->params[$id];
}
$params = "/{$id}{$sep}{$this->params[$id]}";
}
return $params;
} | php | public function params($id = null, $array = false)
{
$config = Grav::instance()['config'];
$sep = $config->get('system.param_sep');
$params = null;
if ($id === null) {
if ($array) {
return $this->params;
}
$output = [];
foreach ($this->params as $key => $value) {
$output[] = "{$key}{$sep}{$value}";
$params = '/' . implode('/', $output);
}
} elseif (isset($this->params[$id])) {
if ($array) {
return $this->params[$id];
}
$params = "/{$id}{$sep}{$this->params[$id]}";
}
return $params;
} | [
"public",
"function",
"params",
"(",
"$",
"id",
"=",
"null",
",",
"$",
"array",
"=",
"false",
")",
"{",
"$",
"config",
"=",
"Grav",
"::",
"instance",
"(",
")",
"[",
"'config'",
"]",
";",
"$",
"sep",
"=",
"$",
"config",
"->",
"get",
"(",
"'system.... | Return all or a single query parameter as a URI compatible string.
@param string $id Optional parameter name.
@param boolean $array return the array format or not
@return null|string|array | [
"Return",
"all",
"or",
"a",
"single",
"query",
"parameter",
"as",
"a",
"URI",
"compatible",
"string",
"."
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Uri.php#L274-L297 | train | Return parameters of the current page | [
30522,
2270,
3853,
11498,
5244,
1006,
1002,
8909,
1027,
19701,
1010,
1002,
9140,
1027,
6270,
1007,
1063,
1002,
9530,
8873,
2290,
1027,
24665,
11431,
1024,
1024,
6013,
1006,
1007,
1031,
1005,
9530,
8873,
2290,
1005,
1033,
1025,
1002,
19802,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Cache/Traits/DoctrineTrait.php | DoctrineTrait.doClear | protected function doClear($namespace)
{
$namespace = $this->provider->getNamespace();
return isset($namespace[0])
? $this->provider->deleteAll()
: $this->provider->flushAll();
} | php | protected function doClear($namespace)
{
$namespace = $this->provider->getNamespace();
return isset($namespace[0])
? $this->provider->deleteAll()
: $this->provider->flushAll();
} | [
"protected",
"function",
"doClear",
"(",
"$",
"namespace",
")",
"{",
"$",
"namespace",
"=",
"$",
"this",
"->",
"provider",
"->",
"getNamespace",
"(",
")",
";",
"return",
"isset",
"(",
"$",
"namespace",
"[",
"0",
"]",
")",
"?",
"$",
"this",
"->",
"pro... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Cache/Traits/DoctrineTrait.php#L69-L76 | train | Clear all cache | [
30522,
5123,
3853,
9986,
19738,
2099,
1006,
1002,
3415,
15327,
1007,
1063,
1002,
3415,
15327,
1027,
1002,
2023,
1011,
1028,
10802,
1011,
1028,
2131,
18442,
23058,
1006,
1007,
1025,
2709,
26354,
3388,
1006,
1002,
3415,
15327,
1031,
1014,
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... |
getgrav/grav | system/src/Grav/Common/Page/Page.php | Page.doReorder | protected function doReorder($new_order)
{
if (!$this->_original) {
return;
}
$pages = Grav::instance()['pages'];
$pages->init();
$this->_original->path($this->path());
$parent = $this->parent();
$siblings = $parent ? $parent->children() : null;
if ($siblings) {
$siblings->order('slug', 'asc', $new_order);
$counter = 0;
// Reorder all moved pages.
foreach ($siblings as $slug => $page) {
$order = (int)trim($page->order(), '.');
$counter++;
if ($order) {
if ($page->path() === $this->path() && $this->folderExists()) {
// Handle current page; we do want to change ordering number, but nothing else.
$this->order($counter);
$this->save(false);
} else {
// Handle all the other pages.
$page = $pages->get($page->path());
if ($page && $page->folderExists() && !$page->_action) {
$page = $page->move($this->parent());
$page->order($counter);
$page->save(false);
}
}
}
}
}
} | php | protected function doReorder($new_order)
{
if (!$this->_original) {
return;
}
$pages = Grav::instance()['pages'];
$pages->init();
$this->_original->path($this->path());
$parent = $this->parent();
$siblings = $parent ? $parent->children() : null;
if ($siblings) {
$siblings->order('slug', 'asc', $new_order);
$counter = 0;
// Reorder all moved pages.
foreach ($siblings as $slug => $page) {
$order = (int)trim($page->order(), '.');
$counter++;
if ($order) {
if ($page->path() === $this->path() && $this->folderExists()) {
// Handle current page; we do want to change ordering number, but nothing else.
$this->order($counter);
$this->save(false);
} else {
// Handle all the other pages.
$page = $pages->get($page->path());
if ($page && $page->folderExists() && !$page->_action) {
$page = $page->move($this->parent());
$page->order($counter);
$page->save(false);
}
}
}
}
}
} | [
"protected",
"function",
"doReorder",
"(",
"$",
"new_order",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"_original",
")",
"{",
"return",
";",
"}",
"$",
"pages",
"=",
"Grav",
"::",
"instance",
"(",
")",
"[",
"'pages'",
"]",
";",
"$",
"pages",
"->"... | Reorders all siblings according to a defined order
@param array|null $new_order | [
"Reorders",
"all",
"siblings",
"according",
"to",
"a",
"defined",
"order"
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L3051-L3092 | train | Reorder the page. | [
30522,
5123,
3853,
2079,
2890,
8551,
2121,
1006,
1002,
2047,
1035,
2344,
1007,
1063,
2065,
1006,
999,
1002,
2023,
1011,
1028,
1035,
2434,
1007,
1063,
2709,
1025,
1065,
1002,
5530,
1027,
24665,
11431,
1024,
1024,
6013,
1006,
1007,
1031,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/DependencyInjection/ContainerBuilder.php | ContainerBuilder.get | public function get($id, $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE)
{
if ($this->isCompiled() && isset($this->removedIds[$id = (string) $id]) && ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE >= $invalidBehavior) {
return parent::get($id);
}
return $this->doGet($id, $invalidBehavior);
} | php | public function get($id, $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE)
{
if ($this->isCompiled() && isset($this->removedIds[$id = (string) $id]) && ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE >= $invalidBehavior) {
return parent::get($id);
}
return $this->doGet($id, $invalidBehavior);
} | [
"public",
"function",
"get",
"(",
"$",
"id",
",",
"$",
"invalidBehavior",
"=",
"ContainerInterface",
"::",
"EXCEPTION_ON_INVALID_REFERENCE",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isCompiled",
"(",
")",
"&&",
"isset",
"(",
"$",
"this",
"->",
"removedIds",
... | Gets a service.
@param string $id The service identifier
@param int $invalidBehavior The behavior when the service does not exist
@return object The associated service
@throws InvalidArgumentException when no definitions are available
@throws ServiceCircularReferenceException When a circular reference is detected
@throws ServiceNotFoundException When the service is not defined
@throws \Exception
@see Reference | [
"Gets",
"a",
"service",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DependencyInjection/ContainerBuilder.php#L552-L559 | train | Get a language from the cache. | [
30522,
2270,
3853,
2131,
1006,
1002,
8909,
1010,
1002,
19528,
4783,
3270,
25500,
2099,
1027,
11661,
18447,
2121,
12172,
1024,
1024,
6453,
1035,
2006,
1035,
19528,
1035,
4431,
1007,
1063,
2065,
1006,
1002,
2023,
1011,
1028,
2003,
9006,
22090... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
slimphp/Slim | Slim/App.php | App.run | public function run($silent = false)
{
$response = $this->container->get('response');
try {
ob_start();
$response = $this->process($this->container->get('request'), $response);
} catch (InvalidMethodException $e) {
$response = $this->processInvalidMethod($e->getRequest(), $response);
} finally {
$output = ob_get_clean();
}
if (!empty($output) && $response->getBody()->isWritable()) {
$outputBuffering = $this->container->get('settings')['outputBuffering'];
if ($outputBuffering === 'prepend') {
// prepend output buffer content
$body = new Http\Body(fopen('php://temp', 'r+'));
$body->write($output . $response->getBody());
$response = $response->withBody($body);
} elseif ($outputBuffering === 'append') {
// append output buffer content
$response->getBody()->write($output);
}
}
$response = $this->finalize($response);
if (!$silent) {
$this->respond($response);
}
return $response;
} | php | public function run($silent = false)
{
$response = $this->container->get('response');
try {
ob_start();
$response = $this->process($this->container->get('request'), $response);
} catch (InvalidMethodException $e) {
$response = $this->processInvalidMethod($e->getRequest(), $response);
} finally {
$output = ob_get_clean();
}
if (!empty($output) && $response->getBody()->isWritable()) {
$outputBuffering = $this->container->get('settings')['outputBuffering'];
if ($outputBuffering === 'prepend') {
// prepend output buffer content
$body = new Http\Body(fopen('php://temp', 'r+'));
$body->write($output . $response->getBody());
$response = $response->withBody($body);
} elseif ($outputBuffering === 'append') {
// append output buffer content
$response->getBody()->write($output);
}
}
$response = $this->finalize($response);
if (!$silent) {
$this->respond($response);
}
return $response;
} | [
"public",
"function",
"run",
"(",
"$",
"silent",
"=",
"false",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"container",
"->",
"get",
"(",
"'response'",
")",
";",
"try",
"{",
"ob_start",
"(",
")",
";",
"$",
"response",
"=",
"$",
"this",
"->",... | Run application
This method traverses the application middleware stack and then sends the
resultant Response object to the HTTP client.
@param bool|false $silent
@return ResponseInterface
@throws Exception
@throws Throwable | [
"Run",
"application"
] | ccef5f7d8bcd469d59cbe64f6210d83764f91543 | https://github.com/slimphp/Slim/blob/ccef5f7d8bcd469d59cbe64f6210d83764f91543/Slim/App.php#L291-L324 | train | Runs the application | [
30522,
2270,
3853,
2448,
1006,
1002,
4333,
1027,
6270,
1007,
1063,
1002,
3433,
1027,
1002,
2023,
1011,
1028,
11661,
1011,
1028,
2131,
1006,
1005,
3433,
1005,
1007,
1025,
3046,
1063,
27885,
1035,
2707,
1006,
1007,
1025,
1002,
3433,
1027,
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/Filesystem/Folder.php | Folder.hashAllFiles | public static function hashAllFiles($path)
{
$flags = \RecursiveDirectoryIterator::SKIP_DOTS;
$files = [];
/** @var UniformResourceLocator $locator */
$locator = Grav::instance()['locator'];
if ($locator->isStream($path)) {
$directory = $locator->getRecursiveIterator($path, $flags);
} else {
$directory = new \RecursiveDirectoryIterator($path, $flags);
}
$iterator = new \RecursiveIteratorIterator($directory, \RecursiveIteratorIterator::SELF_FIRST);
foreach ($iterator as $file) {
$files[] = $file->getPathname() . '?'. $file->getMTime();
}
return md5(serialize($files));
} | php | public static function hashAllFiles($path)
{
$flags = \RecursiveDirectoryIterator::SKIP_DOTS;
$files = [];
/** @var UniformResourceLocator $locator */
$locator = Grav::instance()['locator'];
if ($locator->isStream($path)) {
$directory = $locator->getRecursiveIterator($path, $flags);
} else {
$directory = new \RecursiveDirectoryIterator($path, $flags);
}
$iterator = new \RecursiveIteratorIterator($directory, \RecursiveIteratorIterator::SELF_FIRST);
foreach ($iterator as $file) {
$files[] = $file->getPathname() . '?'. $file->getMTime();
}
return md5(serialize($files));
} | [
"public",
"static",
"function",
"hashAllFiles",
"(",
"$",
"path",
")",
"{",
"$",
"flags",
"=",
"\\",
"RecursiveDirectoryIterator",
"::",
"SKIP_DOTS",
";",
"$",
"files",
"=",
"[",
"]",
";",
"/** @var UniformResourceLocator $locator */",
"$",
"locator",
"=",
"Grav... | Recursively md5 hash all files in a path
@param string $path
@return string | [
"Recursively",
"md5",
"hash",
"all",
"files",
"in",
"a",
"path"
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Filesystem/Folder.php#L93-L113 | train | Hash all files in a directory | [
30522,
2270,
10763,
30524,
1002,
9245,
1027,
1032,
28667,
9236,
3512,
4305,
2890,
16761,
10139,
14621,
4263,
1024,
1024,
13558,
1035,
14981,
1025,
1002,
6764,
1027,
1031,
1033,
1025,
1013,
1008,
1008,
1030,
13075,
6375,
6072,
8162,
29109,
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... |
matomo-org/matomo | core/DataAccess/RawLogDao.php | RawLogDao.deleteFromLogTable | public function deleteFromLogTable($tableName, $visitIds)
{
$sql = "DELETE FROM `" . Common::prefixTable($tableName) . "` WHERE idvisit IN "
. $this->getInFieldExpressionWithInts($visitIds);
$statement = Db::query($sql);
return $statement->rowCount();
} | php | public function deleteFromLogTable($tableName, $visitIds)
{
$sql = "DELETE FROM `" . Common::prefixTable($tableName) . "` WHERE idvisit IN "
. $this->getInFieldExpressionWithInts($visitIds);
$statement = Db::query($sql);
return $statement->rowCount();
} | [
"public",
"function",
"deleteFromLogTable",
"(",
"$",
"tableName",
",",
"$",
"visitIds",
")",
"{",
"$",
"sql",
"=",
"\"DELETE FROM `\"",
".",
"Common",
"::",
"prefixTable",
"(",
"$",
"tableName",
")",
".",
"\"` WHERE idvisit IN \"",
".",
"$",
"this",
"->",
"... | Deletes conversions for the supplied visit IDs from log_conversion. This method does not cascade, so
conversion items will not be deleted.
@param int[] $visitIds
@return int The number of deleted rows. | [
"Deletes",
"conversions",
"for",
"the",
"supplied",
"visit",
"IDs",
"from",
"log_conversion",
".",
"This",
"method",
"does",
"not",
"cascade",
"so",
"conversion",
"items",
"will",
"not",
"be",
"deleted",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/DataAccess/RawLogDao.php#L130-L137 | train | Delete rows from log table | [
30522,
2270,
3853,
3972,
12870,
19699,
5358,
21197,
10880,
1006,
1002,
2795,
18442,
1010,
1002,
3942,
9821,
1007,
1063,
1002,
29296,
1027,
1000,
3972,
12870,
2013,
1036,
1000,
1012,
2691,
1024,
1024,
17576,
10880,
1006,
1002,
2795,
18442,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/SitesManager/API.php | API.deleteSite | public function deleteSite($idSite)
{
Piwik::checkUserHasSuperUserAccess();
$idSites = $this->getSitesId();
if (!in_array($idSite, $idSites)) {
throw new Exception("website id = $idSite not found");
}
$nbSites = count($idSites);
if ($nbSites == 1) {
throw new Exception(Piwik::translate("SitesManager_ExceptionDeleteSite"));
}
$this->getModel()->deleteSite($idSite);
/**
* Triggered after a site has been deleted.
*
* Plugins can use this event to remove site specific values or settings, such as removing all
* goals that belong to a specific website. If you store any data related to a website you
* should clean up that information here.
*
* @param int $idSite The ID of the site being deleted.
*/
Piwik::postEvent('SitesManager.deleteSite.end', array($idSite));
} | php | public function deleteSite($idSite)
{
Piwik::checkUserHasSuperUserAccess();
$idSites = $this->getSitesId();
if (!in_array($idSite, $idSites)) {
throw new Exception("website id = $idSite not found");
}
$nbSites = count($idSites);
if ($nbSites == 1) {
throw new Exception(Piwik::translate("SitesManager_ExceptionDeleteSite"));
}
$this->getModel()->deleteSite($idSite);
/**
* Triggered after a site has been deleted.
*
* Plugins can use this event to remove site specific values or settings, such as removing all
* goals that belong to a specific website. If you store any data related to a website you
* should clean up that information here.
*
* @param int $idSite The ID of the site being deleted.
*/
Piwik::postEvent('SitesManager.deleteSite.end', array($idSite));
} | [
"public",
"function",
"deleteSite",
"(",
"$",
"idSite",
")",
"{",
"Piwik",
"::",
"checkUserHasSuperUserAccess",
"(",
")",
";",
"$",
"idSites",
"=",
"$",
"this",
"->",
"getSitesId",
"(",
")",
";",
"if",
"(",
"!",
"in_array",
"(",
"$",
"idSite",
",",
"$"... | Delete a website from the database, given its Id. The method deletes the actual site as well as some associated
data. However, it does not delete any logs or archives that belong to this website. You can delete logs and
archives for a site manually as described in this FAQ: http://matomo.org/faq/how-to/faq_73/ .
Requires Super User access.
@param int $idSite
@throws Exception | [
"Delete",
"a",
"website",
"from",
"the",
"database",
"given",
"its",
"Id",
".",
"The",
"method",
"deletes",
"the",
"actual",
"site",
"as",
"well",
"as",
"some",
"associated",
"data",
".",
"However",
"it",
"does",
"not",
"delete",
"any",
"logs",
"or",
"ar... | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/SitesManager/API.php#L795-L820 | train | Delete a site | [
30522,
2270,
3853,
3972,
12870,
28032,
2063,
1006,
1002,
8909,
28032,
2063,
1007,
1063,
14255,
9148,
2243,
1024,
1024,
4638,
20330,
14949,
6342,
4842,
20330,
6305,
9623,
2015,
1006,
1007,
1025,
1002,
8909,
28032,
2229,
1027,
1002,
2023,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Cache/DynamoDbStore.php | DynamoDbStore.get | public function get($key)
{
$response = $this->dynamo->getItem([
'TableName' => $this->table,
'ConsistentRead' => false,
'Key' => [
$this->keyAttribute => [
'S' => $this->prefix.$key,
],
],
]);
if (! isset($response['Item'])) {
return;
}
if ($this->isExpired($response['Item'])) {
return;
}
if (isset($response['Item'][$this->valueAttribute])) {
return $this->unserialize(
$response['Item'][$this->valueAttribute]['S'] ??
$response['Item'][$this->valueAttribute]['N'] ??
null
);
}
} | php | public function get($key)
{
$response = $this->dynamo->getItem([
'TableName' => $this->table,
'ConsistentRead' => false,
'Key' => [
$this->keyAttribute => [
'S' => $this->prefix.$key,
],
],
]);
if (! isset($response['Item'])) {
return;
}
if ($this->isExpired($response['Item'])) {
return;
}
if (isset($response['Item'][$this->valueAttribute])) {
return $this->unserialize(
$response['Item'][$this->valueAttribute]['S'] ??
$response['Item'][$this->valueAttribute]['N'] ??
null
);
}
} | [
"public",
"function",
"get",
"(",
"$",
"key",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"dynamo",
"->",
"getItem",
"(",
"[",
"'TableName'",
"=>",
"$",
"this",
"->",
"table",
",",
"'ConsistentRead'",
"=>",
"false",
",",
"'Key'",
"=>",
"[",
"$... | Retrieve an item from the cache by key.
@param string $key
@return mixed | [
"Retrieve",
"an",
"item",
"from",
"the",
"cache",
"by",
"key",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Cache/DynamoDbStore.php#L93-L120 | train | Get the value of a key from the cache | [
30522,
2270,
3853,
2131,
1006,
1002,
3145,
1007,
1063,
1002,
3433,
1027,
1002,
2023,
1011,
1028,
17205,
1011,
1028,
2131,
4221,
2213,
1006,
1031,
1005,
2795,
18442,
1005,
1027,
1028,
1002,
2023,
1011,
1028,
2795,
1010,
1005,
8335,
16416,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/GoalManager.php | GoalManager.recordGoals | public function recordGoals(VisitProperties $visitProperties, Request $request)
{
$visitorInformation = $visitProperties->getProperties();
$visitCustomVariables = $request->getMetadata('CustomVariables', 'visitCustomVariables') ?: array();
/** @var Action $action */
$action = $request->getMetadata('Actions', 'action');
$goal = $this->getGoalFromVisitor($visitProperties, $request, $action);
// Copy Custom Variables from Visit row to the Goal conversion
// Otherwise, set the Custom Variables found in the cookie sent with this request
$goal += $visitCustomVariables;
$maxCustomVariables = CustomVariables::getNumUsableCustomVariables();
for ($i = 1; $i <= $maxCustomVariables; $i++) {
if (isset($visitorInformation['custom_var_k' . $i])
&& strlen($visitorInformation['custom_var_k' . $i])
) {
$goal['custom_var_k' . $i] = $visitorInformation['custom_var_k' . $i];
}
if (isset($visitorInformation['custom_var_v' . $i])
&& strlen($visitorInformation['custom_var_v' . $i])
) {
$goal['custom_var_v' . $i] = $visitorInformation['custom_var_v' . $i];
}
}
// some goals are converted, so must be ecommerce Order or Cart Update
$isRequestEcommerce = $request->getMetadata('Ecommerce', 'isRequestEcommerce');
if ($isRequestEcommerce) {
$this->recordEcommerceGoal($visitProperties, $request, $goal, $action);
} else {
$this->recordStandardGoals($visitProperties, $request, $goal, $action);
}
} | php | public function recordGoals(VisitProperties $visitProperties, Request $request)
{
$visitorInformation = $visitProperties->getProperties();
$visitCustomVariables = $request->getMetadata('CustomVariables', 'visitCustomVariables') ?: array();
/** @var Action $action */
$action = $request->getMetadata('Actions', 'action');
$goal = $this->getGoalFromVisitor($visitProperties, $request, $action);
// Copy Custom Variables from Visit row to the Goal conversion
// Otherwise, set the Custom Variables found in the cookie sent with this request
$goal += $visitCustomVariables;
$maxCustomVariables = CustomVariables::getNumUsableCustomVariables();
for ($i = 1; $i <= $maxCustomVariables; $i++) {
if (isset($visitorInformation['custom_var_k' . $i])
&& strlen($visitorInformation['custom_var_k' . $i])
) {
$goal['custom_var_k' . $i] = $visitorInformation['custom_var_k' . $i];
}
if (isset($visitorInformation['custom_var_v' . $i])
&& strlen($visitorInformation['custom_var_v' . $i])
) {
$goal['custom_var_v' . $i] = $visitorInformation['custom_var_v' . $i];
}
}
// some goals are converted, so must be ecommerce Order or Cart Update
$isRequestEcommerce = $request->getMetadata('Ecommerce', 'isRequestEcommerce');
if ($isRequestEcommerce) {
$this->recordEcommerceGoal($visitProperties, $request, $goal, $action);
} else {
$this->recordStandardGoals($visitProperties, $request, $goal, $action);
}
} | [
"public",
"function",
"recordGoals",
"(",
"VisitProperties",
"$",
"visitProperties",
",",
"Request",
"$",
"request",
")",
"{",
"$",
"visitorInformation",
"=",
"$",
"visitProperties",
"->",
"getProperties",
"(",
")",
";",
"$",
"visitCustomVariables",
"=",
"$",
"r... | Records one or several goals matched in this request.
@param Visitor $visitor
@param array $visitorInformation
@param array $visitCustomVariables
@param Action $action | [
"Records",
"one",
"or",
"several",
"goals",
"matched",
"in",
"this",
"request",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Tracker/GoalManager.php#L227-L262 | train | Record Goals in the order that the user has requested | [
30522,
2270,
3853,
2501,
3995,
9777,
1006,
3942,
21572,
4842,
7368,
1002,
3942,
21572,
4842,
7368,
1010,
5227,
1002,
5227,
1007,
1063,
1002,
10367,
2378,
14192,
3370,
1027,
1002,
3942,
21572,
4842,
7368,
1011,
1028,
2131,
21572,
4842,
7368,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Command/Command.php | Command.run | public function run(InputInterface $input, OutputInterface $output)
{
// force the creation of the synopsis before the merge with the app definition
$this->getSynopsis(true);
$this->getSynopsis(false);
// add the application arguments and options
$this->mergeApplicationDefinition();
// bind the input against the command specific arguments/options
try {
$input->bind($this->definition);
} catch (ExceptionInterface $e) {
if (!$this->ignoreValidationErrors) {
throw $e;
}
}
$this->initialize($input, $output);
if (null !== $this->processTitle) {
if (\function_exists('cli_set_process_title')) {
if (!@cli_set_process_title($this->processTitle)) {
if ('Darwin' === PHP_OS) {
$output->writeln('<comment>Running "cli_set_process_title" as an unprivileged user is not supported on MacOS.</comment>', OutputInterface::VERBOSITY_VERY_VERBOSE);
} else {
cli_set_process_title($this->processTitle);
}
}
} elseif (\function_exists('setproctitle')) {
setproctitle($this->processTitle);
} elseif (OutputInterface::VERBOSITY_VERY_VERBOSE === $output->getVerbosity()) {
$output->writeln('<comment>Install the proctitle PECL to be able to change the process title.</comment>');
}
}
if ($input->isInteractive()) {
$this->interact($input, $output);
}
// The command name argument is often omitted when a command is executed directly with its run() method.
// It would fail the validation if we didn't make sure the command argument is present,
// since it's required by the application.
if ($input->hasArgument('command') && null === $input->getArgument('command')) {
$input->setArgument('command', $this->getName());
}
$input->validate();
if ($this->code) {
$statusCode = ($this->code)($input, $output);
} else {
$statusCode = $this->execute($input, $output);
}
return is_numeric($statusCode) ? (int) $statusCode : 0;
} | php | public function run(InputInterface $input, OutputInterface $output)
{
// force the creation of the synopsis before the merge with the app definition
$this->getSynopsis(true);
$this->getSynopsis(false);
// add the application arguments and options
$this->mergeApplicationDefinition();
// bind the input against the command specific arguments/options
try {
$input->bind($this->definition);
} catch (ExceptionInterface $e) {
if (!$this->ignoreValidationErrors) {
throw $e;
}
}
$this->initialize($input, $output);
if (null !== $this->processTitle) {
if (\function_exists('cli_set_process_title')) {
if (!@cli_set_process_title($this->processTitle)) {
if ('Darwin' === PHP_OS) {
$output->writeln('<comment>Running "cli_set_process_title" as an unprivileged user is not supported on MacOS.</comment>', OutputInterface::VERBOSITY_VERY_VERBOSE);
} else {
cli_set_process_title($this->processTitle);
}
}
} elseif (\function_exists('setproctitle')) {
setproctitle($this->processTitle);
} elseif (OutputInterface::VERBOSITY_VERY_VERBOSE === $output->getVerbosity()) {
$output->writeln('<comment>Install the proctitle PECL to be able to change the process title.</comment>');
}
}
if ($input->isInteractive()) {
$this->interact($input, $output);
}
// The command name argument is often omitted when a command is executed directly with its run() method.
// It would fail the validation if we didn't make sure the command argument is present,
// since it's required by the application.
if ($input->hasArgument('command') && null === $input->getArgument('command')) {
$input->setArgument('command', $this->getName());
}
$input->validate();
if ($this->code) {
$statusCode = ($this->code)($input, $output);
} else {
$statusCode = $this->execute($input, $output);
}
return is_numeric($statusCode) ? (int) $statusCode : 0;
} | [
"public",
"function",
"run",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"// force the creation of the synopsis before the merge with the app definition",
"$",
"this",
"->",
"getSynopsis",
"(",
"true",
")",
";",
"$",
"this",
"... | Runs the command.
The code to execute is either defined directly with the
setCode() method or by overriding the execute() method
in a sub-class.
@return int The command exit code
@throws \Exception When binding input fails. Bypass this by calling {@link ignoreValidationErrors()}.
@see setCode()
@see execute() | [
"Runs",
"the",
"command",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Console/Command/Command.php#L203-L259 | train | Runs the application | [
30522,
2270,
3853,
2448,
1006,
7953,
18447,
30524,
1025,
1002,
2023,
1011,
1028,
4152,
6038,
22599,
1006,
6270,
1007,
1025,
1013,
1013,
5587,
1996,
4646,
9918,
1998,
7047,
1002,
2023,
1011,
1028,
13590,
29098,
19341,
3508,
3207,
16294,
2275... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/Actions/ArchivingHelper.php | ArchivingHelper.getDefaultRow | private static function getDefaultRow()
{
static $row = false;
if ($row === false) {
// This row is used in the case where an action is know as an exit_action
// but this action was not properly recorded when it was hit in the first place
// so we add this fake row information to make sure there is a nb_hits, etc. column for every action
$row = new Row(array(
Row::COLUMNS => array(
PiwikMetrics::INDEX_NB_VISITS => 1,
PiwikMetrics::INDEX_NB_UNIQ_VISITORS => 1,
PiwikMetrics::INDEX_PAGE_NB_HITS => 1,
)));
}
return $row;
} | php | private static function getDefaultRow()
{
static $row = false;
if ($row === false) {
// This row is used in the case where an action is know as an exit_action
// but this action was not properly recorded when it was hit in the first place
// so we add this fake row information to make sure there is a nb_hits, etc. column for every action
$row = new Row(array(
Row::COLUMNS => array(
PiwikMetrics::INDEX_NB_VISITS => 1,
PiwikMetrics::INDEX_NB_UNIQ_VISITORS => 1,
PiwikMetrics::INDEX_PAGE_NB_HITS => 1,
)));
}
return $row;
} | [
"private",
"static",
"function",
"getDefaultRow",
"(",
")",
"{",
"static",
"$",
"row",
"=",
"false",
";",
"if",
"(",
"$",
"row",
"===",
"false",
")",
"{",
"// This row is used in the case where an action is know as an exit_action",
"// but this action was not properly rec... | The default row is used when archiving, if data is inconsistent in the DB,
there could be pages that have exit/entry hits, but don't yet
have a record in the table (or the record was truncated).
@return Row | [
"The",
"default",
"row",
"is",
"used",
"when",
"archiving",
"if",
"data",
"is",
"inconsistent",
"in",
"the",
"DB",
"there",
"could",
"be",
"pages",
"that",
"have",
"exit",
"/",
"entry",
"hits",
"but",
"don",
"t",
"yet",
"have",
"a",
"record",
"in",
"th... | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Actions/ArchivingHelper.php#L346-L361 | train | Get the default row for the action | [
30522,
2797,
10763,
3853,
2131,
3207,
7011,
11314,
10524,
1006,
1007,
1063,
10763,
1002,
5216,
1027,
6270,
1025,
2065,
1006,
1002,
5216,
1027,
1027,
1027,
6270,
1007,
1063,
1013,
1013,
2023,
5216,
2003,
2109,
1999,
1996,
2553,
2073,
2019,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/WebProfilerBundle/DependencyInjection/Configuration.php | Configuration.getConfigTreeBuilder | public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder('web_profiler');
$treeBuilder->getRootNode()
->children()
->booleanNode('toolbar')->defaultFalse()->end()
->booleanNode('intercept_redirects')->defaultFalse()->end()
->scalarNode('excluded_ajax_paths')->defaultValue('^/((index|app(_[\w]+)?)\.php/)?_wdt')->end()
->end()
;
return $treeBuilder;
} | php | public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder('web_profiler');
$treeBuilder->getRootNode()
->children()
->booleanNode('toolbar')->defaultFalse()->end()
->booleanNode('intercept_redirects')->defaultFalse()->end()
->scalarNode('excluded_ajax_paths')->defaultValue('^/((index|app(_[\w]+)?)\.php/)?_wdt')->end()
->end()
;
return $treeBuilder;
} | [
"public",
"function",
"getConfigTreeBuilder",
"(",
")",
"{",
"$",
"treeBuilder",
"=",
"new",
"TreeBuilder",
"(",
"'web_profiler'",
")",
";",
"$",
"treeBuilder",
"->",
"getRootNode",
"(",
")",
"->",
"children",
"(",
")",
"->",
"booleanNode",
"(",
"'toolbar'",
... | 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/WebProfilerBundle/DependencyInjection/Configuration.php#L32-L45 | train | Get the tree builder for the web profiler | [
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,
4773,
1035,
6337,
2099,
1005,
1007,
1025,
1002,
3392,
8569,
23891,
2099,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php | HtmlDumper.leaveHash | public function leaveHash(Cursor $cursor, $type, $class, $hasChild, $cut)
{
$this->dumpEllipsis($cursor, $hasChild, $cut);
if ($hasChild) {
$this->line .= '</samp>';
}
parent::leaveHash($cursor, $type, $class, $hasChild, 0);
} | php | public function leaveHash(Cursor $cursor, $type, $class, $hasChild, $cut)
{
$this->dumpEllipsis($cursor, $hasChild, $cut);
if ($hasChild) {
$this->line .= '</samp>';
}
parent::leaveHash($cursor, $type, $class, $hasChild, 0);
} | [
"public",
"function",
"leaveHash",
"(",
"Cursor",
"$",
"cursor",
",",
"$",
"type",
",",
"$",
"class",
",",
"$",
"hasChild",
",",
"$",
"cut",
")",
"{",
"$",
"this",
"->",
"dumpEllipsis",
"(",
"$",
"cursor",
",",
"$",
"hasChild",
",",
"$",
"cut",
")"... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php#L819-L826 | train | Overwrites the leaveHash method so we can dump the ellipsis and append the amp to the end of the hash. | [
30522,
2270,
3853,
2681,
14949,
2232,
1006,
12731,
25301,
2099,
1002,
12731,
25301,
2099,
1010,
1002,
2828,
1010,
1002,
2465,
1010,
1002,
2038,
19339,
1010,
1002,
3013,
1007,
1063,
1002,
2023,
1011,
1028,
15653,
13348,
18409,
1006,
1002,
12... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/backend/controllers/Files.php | Files.getUniqueCode | public static function getUniqueCode($file)
{
if (!$file) {
return null;
}
$hash = md5($file->file_name . '!' . $file->disk_name);
return base64_encode($file->id . '!' . $hash);
} | php | public static function getUniqueCode($file)
{
if (!$file) {
return null;
}
$hash = md5($file->file_name . '!' . $file->disk_name);
return base64_encode($file->id . '!' . $hash);
} | [
"public",
"static",
"function",
"getUniqueCode",
"(",
"$",
"file",
")",
"{",
"if",
"(",
"!",
"$",
"file",
")",
"{",
"return",
"null",
";",
"}",
"$",
"hash",
"=",
"md5",
"(",
"$",
"file",
"->",
"file_name",
".",
"'!'",
".",
"$",
"file",
"->",
"dis... | Returns a unique code used for masking the file identifier.
@param $file System\Models\File
@return string | [
"Returns",
"a",
"unique",
"code",
"used",
"for",
"masking",
"the",
"file",
"identifier",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/controllers/Files.php#L82-L90 | train | Get Unique Code | [
30522,
2270,
10763,
3853,
2131,
19496,
4226,
16044,
1006,
1002,
5371,
1007,
1063,
2065,
1006,
999,
1002,
5371,
1007,
1063,
2709,
19701,
1025,
1065,
1002,
23325,
1027,
9108,
2629,
1006,
1002,
5371,
1011,
1028,
5371,
1035,
2171,
1012,
1005,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/Tracker/GoalManager.php | GoalManager.getItemRowCast | protected function getItemRowCast($row)
{
return array(
(string)(int)$row[self::INTERNAL_ITEM_SKU],
(string)(int)$row[self::INTERNAL_ITEM_NAME],
(string)(int)$row[self::INTERNAL_ITEM_CATEGORY],
(string)(int)$row[self::INTERNAL_ITEM_CATEGORY2],
(string)(int)$row[self::INTERNAL_ITEM_CATEGORY3],
(string)(int)$row[self::INTERNAL_ITEM_CATEGORY4],
(string)(int)$row[self::INTERNAL_ITEM_CATEGORY5],
(string)$row[self::INTERNAL_ITEM_PRICE],
(string)$row[self::INTERNAL_ITEM_QUANTITY],
);
} | php | protected function getItemRowCast($row)
{
return array(
(string)(int)$row[self::INTERNAL_ITEM_SKU],
(string)(int)$row[self::INTERNAL_ITEM_NAME],
(string)(int)$row[self::INTERNAL_ITEM_CATEGORY],
(string)(int)$row[self::INTERNAL_ITEM_CATEGORY2],
(string)(int)$row[self::INTERNAL_ITEM_CATEGORY3],
(string)(int)$row[self::INTERNAL_ITEM_CATEGORY4],
(string)(int)$row[self::INTERNAL_ITEM_CATEGORY5],
(string)$row[self::INTERNAL_ITEM_PRICE],
(string)$row[self::INTERNAL_ITEM_QUANTITY],
);
} | [
"protected",
"function",
"getItemRowCast",
"(",
"$",
"row",
")",
"{",
"return",
"array",
"(",
"(",
"string",
")",
"(",
"int",
")",
"$",
"row",
"[",
"self",
"::",
"INTERNAL_ITEM_SKU",
"]",
",",
"(",
"string",
")",
"(",
"int",
")",
"$",
"row",
"[",
"... | Casts the item array so that array comparisons work nicely
@param array $row
@return array | [
"Casts",
"the",
"item",
"array",
"so",
"that",
"array",
"comparisons",
"work",
"nicely"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Tracker/GoalManager.php#L763-L776 | train | Casts the item row into an array of cast values | [
30522,
5123,
3853,
2131,
4221,
2213,
10524,
10526,
1006,
1002,
5216,
1007,
1063,
2709,
9140,
1006,
1006,
5164,
1007,
1006,
20014,
1007,
1002,
5216,
1031,
2969,
1024,
1024,
4722,
1035,
8875,
1035,
15315,
2226,
1033,
1010,
1006,
5164,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Foundation/Console/VendorPublishCommand.php | VendorPublishCommand.promptForProviderOrTag | protected function promptForProviderOrTag()
{
$choice = $this->choice(
"Which provider or tag's files would you like to publish?",
$choices = $this->publishableChoices()
);
if ($choice == $choices[0] || is_null($choice)) {
return;
}
$this->parseChoice($choice);
} | php | protected function promptForProviderOrTag()
{
$choice = $this->choice(
"Which provider or tag's files would you like to publish?",
$choices = $this->publishableChoices()
);
if ($choice == $choices[0] || is_null($choice)) {
return;
}
$this->parseChoice($choice);
} | [
"protected",
"function",
"promptForProviderOrTag",
"(",
")",
"{",
"$",
"choice",
"=",
"$",
"this",
"->",
"choice",
"(",
"\"Which provider or tag's files would you like to publish?\"",
",",
"$",
"choices",
"=",
"$",
"this",
"->",
"publishableChoices",
"(",
")",
")",
... | Prompt for which provider or tag to publish.
@return void | [
"Prompt",
"for",
"which",
"provider",
"or",
"tag",
"to",
"publish",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Foundation/Console/VendorPublishCommand.php#L107-L119 | train | Prompts the user for a provider or tag | [
30522,
5123,
3853,
25732,
29278,
21572,
17258,
10624,
13320,
2290,
1006,
1007,
1063,
1002,
3601,
1027,
30524,
1005,
1055,
6764,
2052,
2017,
2066,
2000,
10172,
1029,
1000,
1010,
1002,
9804,
1027,
1002,
2023,
1011,
1028,
10172,
3085,
9905,
23... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Mailer/Transport/Smtp/SmtpTransport.php | SmtpTransport.setLocalDomain | public function setLocalDomain(string $domain): self
{
if ('' !== $domain && '[' !== $domain[0]) {
if (filter_var($domain, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
$domain = '['.$domain.']';
} elseif (filter_var($domain, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
$domain = '[IPv6:'.$domain.']';
}
}
$this->domain = $domain;
return $this;
} | php | public function setLocalDomain(string $domain): self
{
if ('' !== $domain && '[' !== $domain[0]) {
if (filter_var($domain, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
$domain = '['.$domain.']';
} elseif (filter_var($domain, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
$domain = '[IPv6:'.$domain.']';
}
}
$this->domain = $domain;
return $this;
} | [
"public",
"function",
"setLocalDomain",
"(",
"string",
"$",
"domain",
")",
":",
"self",
"{",
"if",
"(",
"''",
"!==",
"$",
"domain",
"&&",
"'['",
"!==",
"$",
"domain",
"[",
"0",
"]",
")",
"{",
"if",
"(",
"filter_var",
"(",
"$",
"domain",
",",
"FILTE... | Sets the name of the local domain that will be used in HELO.
This should be a fully-qualified domain name and should be truly the domain
you're using.
If your server does not have a domain name, use the IP address. This will
automatically be wrapped in square brackets as described in RFC 5321,
section 4.1.3. | [
"Sets",
"the",
"name",
"of",
"the",
"local",
"domain",
"that",
"will",
"be",
"used",
"in",
"HELO",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Mailer/Transport/Smtp/SmtpTransport.php#L81-L94 | train | Set local domain | [
30522,
2270,
3853,
2275,
4135,
9289,
9527,
8113,
1006,
5164,
1002,
5884,
1007,
1024,
2969,
1063,
2065,
1006,
1005,
1005,
999,
1027,
1027,
1002,
5884,
1004,
1004,
1005,
1031,
1005,
999,
1027,
1027,
1002,
5884,
1031,
1014,
1033,
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 | core/Scheduler/Schedule/Daily.php | Daily.getRescheduledTime | public function getRescheduledTime()
{
$currentTime = $this->getTime();
// Add one day
$rescheduledTime = mktime(date('H', $currentTime),
date('i', $currentTime),
date('s', $currentTime),
date('n', $currentTime),
date('j', $currentTime) + 1,
date('Y', $currentTime)
);
// Adjusts the scheduled hour
$rescheduledTime = $this->adjustHour($rescheduledTime);
$rescheduledTime = $this->adjustTimezone($rescheduledTime);
return $rescheduledTime;
} | php | public function getRescheduledTime()
{
$currentTime = $this->getTime();
// Add one day
$rescheduledTime = mktime(date('H', $currentTime),
date('i', $currentTime),
date('s', $currentTime),
date('n', $currentTime),
date('j', $currentTime) + 1,
date('Y', $currentTime)
);
// Adjusts the scheduled hour
$rescheduledTime = $this->adjustHour($rescheduledTime);
$rescheduledTime = $this->adjustTimezone($rescheduledTime);
return $rescheduledTime;
} | [
"public",
"function",
"getRescheduledTime",
"(",
")",
"{",
"$",
"currentTime",
"=",
"$",
"this",
"->",
"getTime",
"(",
")",
";",
"// Add one day",
"$",
"rescheduledTime",
"=",
"mktime",
"(",
"date",
"(",
"'H'",
",",
"$",
"currentTime",
")",
",",
"date",
... | @see ScheduledTime::getRescheduledTime
@return int | [
"@see",
"ScheduledTime",
"::",
"getRescheduledTime",
"@return",
"int"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Scheduler/Schedule/Daily.php#L26-L44 | train | Get the rescheduled time | [
30522,
2270,
3853,
2131,
6072,
7690,
18696,
7292,
1006,
1007,
1063,
1002,
2783,
7292,
1027,
1002,
2023,
1011,
1028,
2131,
7292,
1006,
1007,
1025,
1013,
1013,
5587,
2028,
2154,
1002,
24501,
7690,
18696,
7292,
1027,
12395,
7292,
1006,
3058,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.addCc | public function addCc($email, $name='')
{
if (!is_array($email)) {
$email = array($name => $email);
}
foreach ($email as $n => $recipient) {
$this->_addRecipientAndHeader('Cc', $recipient, is_int($n) ? '' : $n);
}
return $this;
} | php | public function addCc($email, $name='')
{
if (!is_array($email)) {
$email = array($name => $email);
}
foreach ($email as $n => $recipient) {
$this->_addRecipientAndHeader('Cc', $recipient, is_int($n) ? '' : $n);
}
return $this;
} | [
"public",
"function",
"addCc",
"(",
"$",
"email",
",",
"$",
"name",
"=",
"''",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"email",
")",
")",
"{",
"$",
"email",
"=",
"array",
"(",
"$",
"name",
"=>",
"$",
"email",
")",
";",
"}",
"foreach",
... | Adds Cc-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",
"Cc",
"-",
"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#L592-L603 | train | Add Cc - recipients to header | [
30522,
2270,
3853,
5587,
9468,
1006,
1002,
10373,
1010,
1002,
2171,
1027,
1005,
1005,
1007,
1063,
2065,
1006,
999,
2003,
1035,
9140,
1006,
1002,
10373,
1007,
1007,
1063,
1002,
10373,
1027,
9140,
1006,
1002,
2171,
1027,
1028,
1002,
10373,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
PHPMailer/PHPMailer | src/SMTP.php | SMTP.close | public function close()
{
$this->setError('');
$this->server_caps = null;
$this->helo_rply = null;
if (is_resource($this->smtp_conn)) {
// close the connection and cleanup
fclose($this->smtp_conn);
$this->smtp_conn = null; //Makes for cleaner serialization
$this->edebug('Connection: closed', self::DEBUG_CONNECTION);
}
} | php | public function close()
{
$this->setError('');
$this->server_caps = null;
$this->helo_rply = null;
if (is_resource($this->smtp_conn)) {
// close the connection and cleanup
fclose($this->smtp_conn);
$this->smtp_conn = null; //Makes for cleaner serialization
$this->edebug('Connection: closed', self::DEBUG_CONNECTION);
}
} | [
"public",
"function",
"close",
"(",
")",
"{",
"$",
"this",
"->",
"setError",
"(",
"''",
")",
";",
"$",
"this",
"->",
"server_caps",
"=",
"null",
";",
"$",
"this",
"->",
"helo_rply",
"=",
"null",
";",
"if",
"(",
"is_resource",
"(",
"$",
"this",
"->"... | Close the socket and clean up the state of the class.
Don't use this function without first trying to use QUIT.
@see quit() | [
"Close",
"the",
"socket",
"and",
"clean",
"up",
"the",
"state",
"of",
"the",
"class",
".",
"Don",
"t",
"use",
"this",
"function",
"without",
"first",
"trying",
"to",
"use",
"QUIT",
"."
] | 3d7132341659a8a201adbc3ba11b1e202ee2857c | https://github.com/PHPMailer/PHPMailer/blob/3d7132341659a8a201adbc3ba11b1e202ee2857c/src/SMTP.php#L615-L626 | train | Close the connection and cleanup | [
30522,
2270,
3853,
2485,
1006,
1007,
1063,
1002,
2023,
1011,
1028,
2275,
2121,
29165,
1006,
1005,
1005,
1007,
1025,
1002,
2023,
1011,
1028,
8241,
1035,
9700,
1027,
19701,
1025,
1002,
2023,
1011,
1028,
2002,
4135,
1035,
1054,
22086,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/Scheduler/Scheduler.php | Scheduler.run | public function run()
{
$tasks = $this->loader->loadTasks();
$this->logger->debug('{count} scheduled tasks loaded', array('count' => count($tasks)));
// remove from timetable tasks that are not active anymore
$this->timetable->removeInactiveTasks($tasks);
$this->logger->info("Starting Scheduled tasks... ");
// for every priority level, starting with the highest and concluding with the lowest
$executionResults = array();
for ($priority = Task::HIGHEST_PRIORITY; $priority <= Task::LOWEST_PRIORITY; ++$priority) {
$this->logger->debug("Executing tasks with priority {priority}:", array('priority' => $priority));
// loop through each task
foreach ($tasks as $task) {
// if the task does not have the current priority level, don't execute it yet
if ($task->getPriority() != $priority) {
continue;
}
$taskName = $task->getName();
$shouldExecuteTask = $this->timetable->shouldExecuteTask($taskName);
if ($this->timetable->taskShouldBeRescheduled($taskName)) {
$rescheduledDate = $this->timetable->rescheduleTask($task);
$this->logger->debug("Task {task} is scheduled to run again for {date}.", array('task' => $taskName, 'date' => $rescheduledDate));
}
/**
* Triggered before a task is executed.
*
* A plugin can listen to it and modify whether a specific task should be executed or not. This way
* you can force certain tasks to be executed more often or for example to be never executed.
*
* @param bool &$shouldExecuteTask Decides whether the task will be executed.
* @param Task $task The task that is about to be executed.
*/
Piwik::postEvent('ScheduledTasks.shouldExecuteTask', array(&$shouldExecuteTask, $task));
if ($shouldExecuteTask) {
$message = $this->executeTask($task);
$executionResults[] = array('task' => $taskName, 'output' => $message);
}
}
}
$this->logger->info("done");
return $executionResults;
} | php | public function run()
{
$tasks = $this->loader->loadTasks();
$this->logger->debug('{count} scheduled tasks loaded', array('count' => count($tasks)));
// remove from timetable tasks that are not active anymore
$this->timetable->removeInactiveTasks($tasks);
$this->logger->info("Starting Scheduled tasks... ");
// for every priority level, starting with the highest and concluding with the lowest
$executionResults = array();
for ($priority = Task::HIGHEST_PRIORITY; $priority <= Task::LOWEST_PRIORITY; ++$priority) {
$this->logger->debug("Executing tasks with priority {priority}:", array('priority' => $priority));
// loop through each task
foreach ($tasks as $task) {
// if the task does not have the current priority level, don't execute it yet
if ($task->getPriority() != $priority) {
continue;
}
$taskName = $task->getName();
$shouldExecuteTask = $this->timetable->shouldExecuteTask($taskName);
if ($this->timetable->taskShouldBeRescheduled($taskName)) {
$rescheduledDate = $this->timetable->rescheduleTask($task);
$this->logger->debug("Task {task} is scheduled to run again for {date}.", array('task' => $taskName, 'date' => $rescheduledDate));
}
/**
* Triggered before a task is executed.
*
* A plugin can listen to it and modify whether a specific task should be executed or not. This way
* you can force certain tasks to be executed more often or for example to be never executed.
*
* @param bool &$shouldExecuteTask Decides whether the task will be executed.
* @param Task $task The task that is about to be executed.
*/
Piwik::postEvent('ScheduledTasks.shouldExecuteTask', array(&$shouldExecuteTask, $task));
if ($shouldExecuteTask) {
$message = $this->executeTask($task);
$executionResults[] = array('task' => $taskName, 'output' => $message);
}
}
}
$this->logger->info("done");
return $executionResults;
} | [
"public",
"function",
"run",
"(",
")",
"{",
"$",
"tasks",
"=",
"$",
"this",
"->",
"loader",
"->",
"loadTasks",
"(",
")",
";",
"$",
"this",
"->",
"logger",
"->",
"debug",
"(",
"'{count} scheduled tasks loaded'",
",",
"array",
"(",
"'count'",
"=>",
"count"... | Executes tasks that are scheduled to run, then reschedules them.
@return array An array describing the results of scheduled task execution. Each element
in the array will have the following format:
```
array(
'task' => 'task name',
'output' => '... task output ...'
)
``` | [
"Executes",
"tasks",
"that",
"are",
"scheduled",
"to",
"run",
"then",
"reschedules",
"them",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Scheduler/Scheduler.php#L92-L146 | train | Runs all scheduled tasks | [
30522,
2270,
3853,
2448,
1006,
1007,
1063,
1002,
8518,
1027,
1002,
2023,
1011,
1028,
7170,
2121,
1011,
1028,
7170,
10230,
5705,
1006,
1007,
1025,
1002,
2023,
1011,
1028,
8833,
4590,
1011,
1028,
2139,
8569,
2290,
1006,
1005,
1063,
4175,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Auth/Access/Gate.php | Gate.getPolicyFor | public function getPolicyFor($class)
{
if (is_object($class)) {
$class = get_class($class);
}
if (! is_string($class)) {
return;
}
if (isset($this->policies[$class])) {
return $this->resolvePolicy($this->policies[$class]);
}
foreach ($this->guessPolicyName($class) as $guessedPolicy) {
if (class_exists($guessedPolicy)) {
return $this->resolvePolicy($guessedPolicy);
}
}
foreach ($this->policies as $expected => $policy) {
if (is_subclass_of($class, $expected)) {
return $this->resolvePolicy($policy);
}
}
} | php | public function getPolicyFor($class)
{
if (is_object($class)) {
$class = get_class($class);
}
if (! is_string($class)) {
return;
}
if (isset($this->policies[$class])) {
return $this->resolvePolicy($this->policies[$class]);
}
foreach ($this->guessPolicyName($class) as $guessedPolicy) {
if (class_exists($guessedPolicy)) {
return $this->resolvePolicy($guessedPolicy);
}
}
foreach ($this->policies as $expected => $policy) {
if (is_subclass_of($class, $expected)) {
return $this->resolvePolicy($policy);
}
}
} | [
"public",
"function",
"getPolicyFor",
"(",
"$",
"class",
")",
"{",
"if",
"(",
"is_object",
"(",
"$",
"class",
")",
")",
"{",
"$",
"class",
"=",
"get_class",
"(",
"$",
"class",
")",
";",
"}",
"if",
"(",
"!",
"is_string",
"(",
"$",
"class",
")",
")... | Get a policy instance for a given class.
@param object|string $class
@return mixed | [
"Get",
"a",
"policy",
"instance",
"for",
"a",
"given",
"class",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Auth/Access/Gate.php#L539-L564 | train | Get the policy for a given class. | [
30522,
2270,
3853,
2131,
18155,
2594,
2100,
29278,
1006,
1002,
2465,
1007,
1063,
2065,
1006,
2003,
1035,
4874,
1006,
1002,
2465,
1007,
1007,
1063,
1002,
2465,
1027,
2131,
1035,
2465,
1006,
1002,
2465,
1007,
1025,
1065,
2065,
1006,
999,
20... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Support/Str.php | Str.camel | public static function camel($value)
{
if (isset(static::$camelCache[$value])) {
return static::$camelCache[$value];
}
return static::$camelCache[$value] = lcfirst(static::studly($value));
} | php | public static function camel($value)
{
if (isset(static::$camelCache[$value])) {
return static::$camelCache[$value];
}
return static::$camelCache[$value] = lcfirst(static::studly($value));
} | [
"public",
"static",
"function",
"camel",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"isset",
"(",
"static",
"::",
"$",
"camelCache",
"[",
"$",
"value",
"]",
")",
")",
"{",
"return",
"static",
"::",
"$",
"camelCache",
"[",
"$",
"value",
"]",
";",
"}",
... | Convert a value to camel case.
@param string $value
@return string | [
"Convert",
"a",
"value",
"to",
"camel",
"case",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Support/Str.php#L88-L95 | train | Converts a string into CamelCase | [
30522,
2270,
10763,
3853,
19130,
1006,
1002,
3643,
1007,
1063,
2065,
1006,
26354,
3388,
1006,
10763,
1024,
1024,
1002,
19130,
3540,
5403,
1031,
1002,
3643,
1033,
1007,
1007,
1063,
2709,
10763,
1024,
1024,
1002,
19130,
3540,
5403,
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/Component/Validator/Validator/RecursiveContextualValidator.php | RecursiveContextualValidator.stepThroughGroupSequence | private function stepThroughGroupSequence($value, $object, $cacheKey, MetadataInterface $metadata = null, $propertyPath, $traversalStrategy, GroupSequence $groupSequence, $cascadedGroup, ExecutionContextInterface $context)
{
$violationCount = \count($context->getViolations());
$cascadedGroups = $cascadedGroup ? [$cascadedGroup] : null;
foreach ($groupSequence->groups as $groupInSequence) {
$groups = (array) $groupInSequence;
if ($metadata instanceof ClassMetadataInterface) {
$this->validateClassNode(
$value,
$cacheKey,
$metadata,
$propertyPath,
$groups,
$cascadedGroups,
$traversalStrategy,
$context
);
} else {
$this->validateGenericNode(
$value,
$object,
$cacheKey,
$metadata,
$propertyPath,
$groups,
$cascadedGroups,
$traversalStrategy,
$context
);
}
// Abort sequence validation if a violation was generated
if (\count($context->getViolations()) > $violationCount) {
break;
}
}
} | php | private function stepThroughGroupSequence($value, $object, $cacheKey, MetadataInterface $metadata = null, $propertyPath, $traversalStrategy, GroupSequence $groupSequence, $cascadedGroup, ExecutionContextInterface $context)
{
$violationCount = \count($context->getViolations());
$cascadedGroups = $cascadedGroup ? [$cascadedGroup] : null;
foreach ($groupSequence->groups as $groupInSequence) {
$groups = (array) $groupInSequence;
if ($metadata instanceof ClassMetadataInterface) {
$this->validateClassNode(
$value,
$cacheKey,
$metadata,
$propertyPath,
$groups,
$cascadedGroups,
$traversalStrategy,
$context
);
} else {
$this->validateGenericNode(
$value,
$object,
$cacheKey,
$metadata,
$propertyPath,
$groups,
$cascadedGroups,
$traversalStrategy,
$context
);
}
// Abort sequence validation if a violation was generated
if (\count($context->getViolations()) > $violationCount) {
break;
}
}
} | [
"private",
"function",
"stepThroughGroupSequence",
"(",
"$",
"value",
",",
"$",
"object",
",",
"$",
"cacheKey",
",",
"MetadataInterface",
"$",
"metadata",
"=",
"null",
",",
"$",
"propertyPath",
",",
"$",
"traversalStrategy",
",",
"GroupSequence",
"$",
"groupSequ... | Sequentially validates a node's value in each group of a group sequence.
If any of the constraints generates a violation, subsequent groups in the
group sequence are skipped.
@param mixed $value The validated value
@param object|null $object The current object
@param string $cacheKey The key for caching
the validated value
@param MetadataInterface $metadata The metadata of the
value
@param string $propertyPath The property path leading
to the value
@param int $traversalStrategy The strategy used for
traversing the value
@param GroupSequence $groupSequence The group sequence
@param string|null $cascadedGroup The group that should
be passed to cascaded
objects instead of
the group sequence
@param ExecutionContextInterface $context The execution context | [
"Sequentially",
"validates",
"a",
"node",
"s",
"value",
"in",
"each",
"group",
"of",
"a",
"group",
"sequence",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Validator/Validator/RecursiveContextualValidator.php#L727-L765 | train | Step through the group sequence | [
30522,
2797,
3853,
3357,
2705,
22494,
5603,
17058,
3366,
4226,
5897,
1006,
1002,
3643,
1010,
1002,
4874,
1010,
1002,
17053,
14839,
1010,
27425,
18447,
2121,
12172,
1002,
27425,
1027,
19701,
1010,
1002,
3200,
15069,
1010,
1002,
29053,
9777,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.offsetExists | public function offsetExists($offset)
{
return Arr::has(
$this->all() + $this->route()->parameters(),
$offset
);
} | php | public function offsetExists($offset)
{
return Arr::has(
$this->all() + $this->route()->parameters(),
$offset
);
} | [
"public",
"function",
"offsetExists",
"(",
"$",
"offset",
")",
"{",
"return",
"Arr",
"::",
"has",
"(",
"$",
"this",
"->",
"all",
"(",
")",
"+",
"$",
"this",
"->",
"route",
"(",
")",
"->",
"parameters",
"(",
")",
",",
"$",
"offset",
")",
";",
"}"
... | Determine if the given offset exists.
@param string $offset
@return bool | [
"Determine",
"if",
"the",
"given",
"offset",
"exists",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Http/Request.php#L638-L644 | train | Return true if the route parameters exists in the current context | [
30522,
2270,
3853,
16396,
10288,
5130,
1006,
1002,
16396,
1007,
1063,
2709,
12098,
2099,
1024,
1024,
2038,
1006,
1002,
2023,
1011,
1028,
2035,
1006,
1007,
1009,
1002,
2023,
1011,
1028,
2799,
1006,
1007,
1011,
1028,
11709,
1006,
1007,
1010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Database/Eloquent/Relations/MorphPivot.php | MorphPivot.getQueueableId | public function getQueueableId()
{
if (isset($this->attributes[$this->getKeyName()])) {
return $this->getKey();
}
return sprintf(
'%s:%s:%s:%s:%s:%s',
$this->foreignKey, $this->getAttribute($this->foreignKey),
$this->relatedKey, $this->getAttribute($this->relatedKey),
$this->morphType, $this->morphClass
);
} | php | public function getQueueableId()
{
if (isset($this->attributes[$this->getKeyName()])) {
return $this->getKey();
}
return sprintf(
'%s:%s:%s:%s:%s:%s',
$this->foreignKey, $this->getAttribute($this->foreignKey),
$this->relatedKey, $this->getAttribute($this->relatedKey),
$this->morphType, $this->morphClass
);
} | [
"public",
"function",
"getQueueableId",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"attributes",
"[",
"$",
"this",
"->",
"getKeyName",
"(",
")",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"getKey",
"(",
")",
";",
"}",
"return"... | Get the queueable identity for the entity.
@return mixed | [
"Get",
"the",
"queueable",
"identity",
"for",
"the",
"entity",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Relations/MorphPivot.php#L86-L98 | train | Get Queueable Id | [
30522,
2270,
3853,
2131,
4226,
5657,
3085,
3593,
1006,
1007,
1063,
2065,
1006,
26354,
3388,
1006,
1002,
2023,
1011,
1028,
12332,
1031,
1002,
2023,
1011,
1028,
2131,
14839,
18442,
1006,
1007,
1033,
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... |
laravel/framework | src/Illuminate/Redis/Connectors/PhpRedisConnector.php | PhpRedisConnector.createClient | protected function createClient(array $config)
{
return tap(new Redis, function ($client) use ($config) {
$this->establishConnection($client, $config);
if (! empty($config['password'])) {
$client->auth($config['password']);
}
if (! empty($config['database'])) {
$client->select($config['database']);
}
if (! empty($config['prefix'])) {
$client->setOption(Redis::OPT_PREFIX, $config['prefix']);
}
if (! empty($config['read_timeout'])) {
$client->setOption(Redis::OPT_READ_TIMEOUT, $config['read_timeout']);
}
});
} | php | protected function createClient(array $config)
{
return tap(new Redis, function ($client) use ($config) {
$this->establishConnection($client, $config);
if (! empty($config['password'])) {
$client->auth($config['password']);
}
if (! empty($config['database'])) {
$client->select($config['database']);
}
if (! empty($config['prefix'])) {
$client->setOption(Redis::OPT_PREFIX, $config['prefix']);
}
if (! empty($config['read_timeout'])) {
$client->setOption(Redis::OPT_READ_TIMEOUT, $config['read_timeout']);
}
});
} | [
"protected",
"function",
"createClient",
"(",
"array",
"$",
"config",
")",
"{",
"return",
"tap",
"(",
"new",
"Redis",
",",
"function",
"(",
"$",
"client",
")",
"use",
"(",
"$",
"config",
")",
"{",
"$",
"this",
"->",
"establishConnection",
"(",
"$",
"cl... | Create the Redis client instance.
@param array $config
@return \Redis | [
"Create",
"the",
"Redis",
"client",
"instance",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Redis/Connectors/PhpRedisConnector.php#L63-L84 | train | Create Redis client | [
30522,
5123,
3853,
3443,
20464,
11638,
1006,
9140,
1002,
9530,
8873,
2290,
1007,
1063,
2709,
11112,
1006,
2047,
2417,
2483,
1010,
3853,
1006,
1002,
7396,
1007,
2224,
1006,
1002,
9530,
8873,
2290,
1007,
1063,
1002,
2023,
1011,
1028,
5323,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/GeoIp2/GeoIP2AutoUpdater.php | GeoIP2AutoUpdater.performRedundantDbChecks | protected function performRedundantDbChecks($logErrors = true)
{
$databaseTypes = array_keys(LocationProviderGeoIp2::$dbNames);
foreach ($databaseTypes as $type) {
$customNames = array(
'loc' => array(),
'isp' => array(),
'org' => array()
);
$customNames[$type] = LocationProviderGeoIp2::$dbNames[$type];
// create provider that only uses the DB type we're testing
$provider = new Php($customNames);
// test the provider. on error, we rename the broken DB.
try {
$location = $provider->getLocation(array('ip' => LocationProviderGeoIp2::TEST_IP));
} catch (\Exception $e) {
if($logErrors) {
Log::error("GeoIP2AutoUpdater: Encountered exception when performing redundant tests on GeoIP2 "
. "%s database: %s", $type, $e->getMessage());
}
// get the current filename for the DB and an available new one to rename it to
list($oldPath, $newPath) = $this->getOldAndNewPathsForBrokenDb($customNames[$type]);
// rename the DB so tracking will not fail
if ($oldPath !== false
&& $newPath !== false
) {
if (file_exists($newPath)) {
unlink($newPath);
}
rename($oldPath, $newPath);
}
}
}
} | php | protected function performRedundantDbChecks($logErrors = true)
{
$databaseTypes = array_keys(LocationProviderGeoIp2::$dbNames);
foreach ($databaseTypes as $type) {
$customNames = array(
'loc' => array(),
'isp' => array(),
'org' => array()
);
$customNames[$type] = LocationProviderGeoIp2::$dbNames[$type];
// create provider that only uses the DB type we're testing
$provider = new Php($customNames);
// test the provider. on error, we rename the broken DB.
try {
$location = $provider->getLocation(array('ip' => LocationProviderGeoIp2::TEST_IP));
} catch (\Exception $e) {
if($logErrors) {
Log::error("GeoIP2AutoUpdater: Encountered exception when performing redundant tests on GeoIP2 "
. "%s database: %s", $type, $e->getMessage());
}
// get the current filename for the DB and an available new one to rename it to
list($oldPath, $newPath) = $this->getOldAndNewPathsForBrokenDb($customNames[$type]);
// rename the DB so tracking will not fail
if ($oldPath !== false
&& $newPath !== false
) {
if (file_exists($newPath)) {
unlink($newPath);
}
rename($oldPath, $newPath);
}
}
}
} | [
"protected",
"function",
"performRedundantDbChecks",
"(",
"$",
"logErrors",
"=",
"true",
")",
"{",
"$",
"databaseTypes",
"=",
"array_keys",
"(",
"LocationProviderGeoIp2",
"::",
"$",
"dbNames",
")",
";",
"foreach",
"(",
"$",
"databaseTypes",
"as",
"$",
"type",
... | Utility function that checks if geolocation works with each installed database,
and if one or more doesn't, they are renamed to make sure tracking will work.
This is a safety measure used to make sure tracking isn't affected if strange
update errors occur.
Databases are renamed to ${original}.broken .
Note: method is protected for testability.
@param $logErrors - only used to hide error logs during tests | [
"Utility",
"function",
"that",
"checks",
"if",
"geolocation",
"works",
"with",
"each",
"installed",
"database",
"and",
"if",
"one",
"or",
"more",
"doesn",
"t",
"they",
"are",
"renamed",
"to",
"make",
"sure",
"tracking",
"will",
"work",
".",
"This",
"is",
"... | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/GeoIp2/GeoIP2AutoUpdater.php#L501-L540 | train | Perform redundant database checks | [
30522,
5123,
3853,
4685,
5596,
18426,
3372,
18939,
5403,
10603,
1006,
1002,
8833,
2121,
29165,
2015,
1027,
2995,
1007,
1063,
1002,
7809,
13874,
2015,
1027,
9140,
1035,
6309,
1006,
3295,
21572,
17258,
2121,
3351,
10448,
2361,
2475,
1024,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Serializer/Normalizer/DateTimeNormalizer.php | DateTimeNormalizer.normalize | public function normalize($object, $format = null, array $context = [])
{
if (!$object instanceof \DateTimeInterface) {
throw new InvalidArgumentException('The object must implement the "\DateTimeInterface".');
}
$dateTimeFormat = $context[self::FORMAT_KEY] ?? $this->defaultContext[self::FORMAT_KEY];
$timezone = $this->getTimezone($context);
if (null !== $timezone) {
$object = clone $object;
$object = $object->setTimezone($timezone);
}
return $object->format($dateTimeFormat);
} | php | public function normalize($object, $format = null, array $context = [])
{
if (!$object instanceof \DateTimeInterface) {
throw new InvalidArgumentException('The object must implement the "\DateTimeInterface".');
}
$dateTimeFormat = $context[self::FORMAT_KEY] ?? $this->defaultContext[self::FORMAT_KEY];
$timezone = $this->getTimezone($context);
if (null !== $timezone) {
$object = clone $object;
$object = $object->setTimezone($timezone);
}
return $object->format($dateTimeFormat);
} | [
"public",
"function",
"normalize",
"(",
"$",
"object",
",",
"$",
"format",
"=",
"null",
",",
"array",
"$",
"context",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"$",
"object",
"instanceof",
"\\",
"DateTimeInterface",
")",
"{",
"throw",
"new",
"InvalidArg... | {@inheritdoc}
@throws InvalidArgumentException | [
"{",
"@inheritdoc",
"}"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Serializer/Normalizer/DateTimeNormalizer.php#L61-L76 | train | Normalize a \ DateTimeInterface object to a date time format | [
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,
3058,
7292,
18447,
2121,
12172,
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... |
matomo-org/matomo | plugins/CoreVisualizations/Visualizations/Sparklines/Config.php | Config.removeSparklineMetric | public function removeSparklineMetric($metricNames)
{
foreach ($this->sparkline_metrics as $index => $metric) {
if ($metric['columns'] === $metricNames) {
array_splice($this->sparkline_metrics, $index, 1);
break;
}
}
} | php | public function removeSparklineMetric($metricNames)
{
foreach ($this->sparkline_metrics as $index => $metric) {
if ($metric['columns'] === $metricNames) {
array_splice($this->sparkline_metrics, $index, 1);
break;
}
}
} | [
"public",
"function",
"removeSparklineMetric",
"(",
"$",
"metricNames",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"sparkline_metrics",
"as",
"$",
"index",
"=>",
"$",
"metric",
")",
"{",
"if",
"(",
"$",
"metric",
"[",
"'columns'",
"]",
"===",
"$",
"met... | Removes an existing sparkline entry. Especially useful in dataTable filters in case sparklines should be not
displayed depending on the fetched data.
Example:
$config->addSparklineMetric('nb_users');
$config->filters[] = function ($dataTable) use ($config) {
if ($dataTable->getFirstRow()->getColumn('nb_users') == 0) {
// do not show a sparkline if there are no recorded users
$config->removeSparklineMetric('nb_users');
}
}
@param array|string $metricNames The name of the metrics in the same format they were used when added via
{@link addSparklineMetric} | [
"Removes",
"an",
"existing",
"sparkline",
"entry",
".",
"Especially",
"useful",
"in",
"dataTable",
"filters",
"in",
"case",
"sparklines",
"should",
"be",
"not",
"displayed",
"depending",
"on",
"the",
"fetched",
"data",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/CoreVisualizations/Visualizations/Sparklines/Config.php#L90-L99 | train | Remove a sparkline metric | [
30522,
2270,
3853,
20362,
14432,
4179,
12589,
1006,
1002,
12046,
18442,
2015,
1007,
1063,
18921,
6776,
1006,
1002,
2023,
1011,
1028,
12125,
4179,
1035,
12046,
2015,
2004,
1002,
5950,
1027,
1028,
1002,
12046,
1007,
1063,
2065,
1006,
1002,
12... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
dompdf/dompdf | src/Helpers.php | Helpers.rle4_decode | public static function rle4_decode($str, $width)
{
$w = floor($width / 2) + ($width % 2);
$lineWidth = $w + (3 - (($width - 1) / 2) % 4);
$pixels = array();
$cnt = strlen($str);
$c = 0;
for ($i = 0; $i < $cnt; $i++) {
$o = ord($str[$i]);
switch ($o) {
case 0: # ESCAPE
$i++;
switch (ord($str[$i])) {
case 0: # NEW LINE
while (count($pixels) % $lineWidth != 0) {
$pixels[] = 0;
}
break;
case 1: # END OF FILE
while (count($pixels) % $lineWidth != 0) {
$pixels[] = 0;
}
break 3;
case 2: # DELTA
$i += 2;
break;
default: # ABSOLUTE MODE
$num = ord($str[$i]);
for ($j = 0; $j < $num; $j++) {
if ($j % 2 == 0) {
$c = ord($str[++$i]);
$pixels[] = ($c & 240) >> 4;
} else {
$pixels[] = $c & 15;
}
}
if ($num % 2 == 0) {
$i++;
}
}
break;
default:
$c = ord($str[++$i]);
for ($j = 0; $j < $o; $j++) {
$pixels[] = ($j % 2 == 0 ? ($c & 240) >> 4 : $c & 15);
}
}
}
$out = '';
if (count($pixels) % 2) {
$pixels[] = 0;
}
$cnt = count($pixels) / 2;
for ($i = 0; $i < $cnt; $i++) {
$out .= chr(16 * $pixels[2 * $i] + $pixels[2 * $i + 1]);
}
return $out;
} | php | public static function rle4_decode($str, $width)
{
$w = floor($width / 2) + ($width % 2);
$lineWidth = $w + (3 - (($width - 1) / 2) % 4);
$pixels = array();
$cnt = strlen($str);
$c = 0;
for ($i = 0; $i < $cnt; $i++) {
$o = ord($str[$i]);
switch ($o) {
case 0: # ESCAPE
$i++;
switch (ord($str[$i])) {
case 0: # NEW LINE
while (count($pixels) % $lineWidth != 0) {
$pixels[] = 0;
}
break;
case 1: # END OF FILE
while (count($pixels) % $lineWidth != 0) {
$pixels[] = 0;
}
break 3;
case 2: # DELTA
$i += 2;
break;
default: # ABSOLUTE MODE
$num = ord($str[$i]);
for ($j = 0; $j < $num; $j++) {
if ($j % 2 == 0) {
$c = ord($str[++$i]);
$pixels[] = ($c & 240) >> 4;
} else {
$pixels[] = $c & 15;
}
}
if ($num % 2 == 0) {
$i++;
}
}
break;
default:
$c = ord($str[++$i]);
for ($j = 0; $j < $o; $j++) {
$pixels[] = ($j % 2 == 0 ? ($c & 240) >> 4 : $c & 15);
}
}
}
$out = '';
if (count($pixels) % 2) {
$pixels[] = 0;
}
$cnt = count($pixels) / 2;
for ($i = 0; $i < $cnt; $i++) {
$out .= chr(16 * $pixels[2 * $i] + $pixels[2 * $i + 1]);
}
return $out;
} | [
"public",
"static",
"function",
"rle4_decode",
"(",
"$",
"str",
",",
"$",
"width",
")",
"{",
"$",
"w",
"=",
"floor",
"(",
"$",
"width",
"/",
"2",
")",
"+",
"(",
"$",
"width",
"%",
"2",
")",
";",
"$",
"lineWidth",
"=",
"$",
"w",
"+",
"(",
"3",... | Decoder for RLE4 compression in windows bitmaps
see http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/bitmaps_6x0u.asp
@param string $str Data to decode
@param integer $width Image width
@return string | [
"Decoder",
"for",
"RLE4",
"compression",
"in",
"windows",
"bitmaps",
"see",
"http",
":",
"//",
"msdn",
".",
"microsoft",
".",
"com",
"/",
"library",
"/",
"default",
".",
"asp?url",
"=",
"/",
"library",
"/",
"en",
"-",
"us",
"/",
"gdi",
"/",
"bitmaps_6x... | 75f13c700009be21a1965dc2c5b68a8708c22ba2 | https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/src/Helpers.php#L305-L368 | train | Decode an rle4 image | [
30522,
2270,
10763,
3853,
1054,
2571,
2549,
1035,
21933,
3207,
1006,
1002,
2358,
2099,
1010,
1002,
9381,
1007,
1063,
1002,
1059,
1027,
2723,
1006,
1002,
9381,
1013,
1016,
1007,
1009,
1006,
1002,
9381,
1003,
1016,
1007,
1025,
1002,
2240,
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... |
slimphp/Slim | Slim/Router.php | Router.getNamedRoute | public function getNamedRoute($name)
{
foreach ($this->routes as $route) {
if ($name == $route->getName()) {
return $route;
}
}
throw new RuntimeException('Named route does not exist for name: ' . $name);
} | php | public function getNamedRoute($name)
{
foreach ($this->routes as $route) {
if ($name == $route->getName()) {
return $route;
}
}
throw new RuntimeException('Named route does not exist for name: ' . $name);
} | [
"public",
"function",
"getNamedRoute",
"(",
"$",
"name",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"routes",
"as",
"$",
"route",
")",
"{",
"if",
"(",
"$",
"name",
"==",
"$",
"route",
"->",
"getName",
"(",
")",
")",
"{",
"return",
"$",
"route",
... | {@inheritdoc} | [
"{"
] | ccef5f7d8bcd469d59cbe64f6210d83764f91543 | https://github.com/slimphp/Slim/blob/ccef5f7d8bcd469d59cbe64f6210d83764f91543/Slim/Router.php#L268-L276 | train | Get the route with the given name | [
30522,
2270,
3853,
2131,
18442,
22196,
10421,
1006,
1002,
2171,
1007,
1063,
18921,
6776,
1006,
1002,
2023,
1011,
1028,
5847,
2004,
1002,
2799,
1007,
1063,
2065,
1006,
1002,
2171,
1027,
1027,
1002,
2799,
1011,
1028,
2131,
18442,
1006,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/Zend/Db/Statement/Oracle.php | Zend_Db_Statement_Oracle.fetchObject | public function fetchObject($class = 'stdClass', array $config = array())
{
if (!$this->_stmt) {
return false;
}
$obj = oci_fetch_object($this->_stmt);
if ($error = oci_error($this->_stmt)) {
/**
* @see Zend_Db_Adapter_Oracle_Exception
*/
// require_once 'Zend/Db/Statement/Oracle/Exception.php';
throw new Zend_Db_Statement_Oracle_Exception($error);
}
/* @todo XXX handle parameters */
return $obj;
} | php | public function fetchObject($class = 'stdClass', array $config = array())
{
if (!$this->_stmt) {
return false;
}
$obj = oci_fetch_object($this->_stmt);
if ($error = oci_error($this->_stmt)) {
/**
* @see Zend_Db_Adapter_Oracle_Exception
*/
// require_once 'Zend/Db/Statement/Oracle/Exception.php';
throw new Zend_Db_Statement_Oracle_Exception($error);
}
/* @todo XXX handle parameters */
return $obj;
} | [
"public",
"function",
"fetchObject",
"(",
"$",
"class",
"=",
"'stdClass'",
",",
"array",
"$",
"config",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"_stmt",
")",
"{",
"return",
"false",
";",
"}",
"$",
"obj",
"=",
"oci_fetch... | Fetches the next row and returns it as an object.
@param string $class OPTIONAL Name of the class to create.
@param array $config OPTIONAL Constructor arguments for the class.
@return mixed One object instance of the specified class.
@throws Zend_Db_Statement_Exception | [
"Fetches",
"the",
"next",
"row",
"and",
"returns",
"it",
"as",
"an",
"object",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Statement/Oracle.php#L507-L526 | train | Fetch the result of the statement as an object | [
30522,
2270,
3853,
18584,
16429,
20614,
1006,
1002,
2465,
1027,
1005,
2358,
16409,
27102,
1005,
1010,
30524,
1002,
2023,
1011,
1028,
1035,
2358,
20492,
1007,
1063,
2709,
6270,
1025,
1065,
1002,
27885,
3501,
1027,
1051,
6895,
1035,
18584,
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/Cache/Traits/AbstractAdapterTrait.php | AbstractAdapterTrait.getItem | public function getItem($key)
{
if ($this->deferred) {
$this->commit();
}
$id = $this->getId($key);
$f = $this->createCacheItem;
$isHit = false;
$value = null;
try {
foreach ($this->doFetch([$id]) as $value) {
$isHit = true;
}
} catch (\Exception $e) {
CacheItem::log($this->logger, 'Failed to fetch key "{key}"', ['key' => $key, 'exception' => $e]);
}
return $f($key, $value, $isHit);
} | php | public function getItem($key)
{
if ($this->deferred) {
$this->commit();
}
$id = $this->getId($key);
$f = $this->createCacheItem;
$isHit = false;
$value = null;
try {
foreach ($this->doFetch([$id]) as $value) {
$isHit = true;
}
} catch (\Exception $e) {
CacheItem::log($this->logger, 'Failed to fetch key "{key}"', ['key' => $key, 'exception' => $e]);
}
return $f($key, $value, $isHit);
} | [
"public",
"function",
"getItem",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"deferred",
")",
"{",
"$",
"this",
"->",
"commit",
"(",
")",
";",
"}",
"$",
"id",
"=",
"$",
"this",
"->",
"getId",
"(",
"$",
"key",
")",
";",
"$",
"f",
... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Cache/Traits/AbstractAdapterTrait.php#L39-L59 | train | Get an item from the cache | [
30522,
2270,
3853,
2131,
4221,
2213,
1006,
1002,
3145,
1007,
1063,
2065,
1006,
1002,
2023,
1011,
1028,
13366,
28849,
2094,
1007,
1063,
1002,
2023,
1011,
1028,
10797,
1006,
1007,
1025,
1065,
1002,
8909,
1027,
1002,
2023,
1011,
1028,
2131,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php | MarkdownDescriptor.describeCallable | protected function describeCallable($callable, array $options = [])
{
$string = '';
if (\is_array($callable)) {
$string .= "\n- Type: `function`";
if (\is_object($callable[0])) {
$string .= "\n".sprintf('- Name: `%s`', $callable[1]);
$string .= "\n".sprintf('- Class: `%s`', \get_class($callable[0]));
} else {
if (0 !== strpos($callable[1], 'parent::')) {
$string .= "\n".sprintf('- Name: `%s`', $callable[1]);
$string .= "\n".sprintf('- Class: `%s`', $callable[0]);
$string .= "\n- Static: yes";
} else {
$string .= "\n".sprintf('- Name: `%s`', substr($callable[1], 8));
$string .= "\n".sprintf('- Class: `%s`', $callable[0]);
$string .= "\n- Static: yes";
$string .= "\n- Parent: yes";
}
}
return $this->write($string."\n");
}
if (\is_string($callable)) {
$string .= "\n- Type: `function`";
if (false === strpos($callable, '::')) {
$string .= "\n".sprintf('- Name: `%s`', $callable);
} else {
$callableParts = explode('::', $callable);
$string .= "\n".sprintf('- Name: `%s`', $callableParts[1]);
$string .= "\n".sprintf('- Class: `%s`', $callableParts[0]);
$string .= "\n- Static: yes";
}
return $this->write($string."\n");
}
if ($callable instanceof \Closure) {
$string .= "\n- Type: `closure`";
$r = new \ReflectionFunction($callable);
if (false !== strpos($r->name, '{closure}')) {
return $this->write($string."\n");
}
$string .= "\n".sprintf('- Name: `%s`', $r->name);
if ($class = $r->getClosureScopeClass()) {
$string .= "\n".sprintf('- Class: `%s`', $class->name);
if (!$r->getClosureThis()) {
$string .= "\n- Static: yes";
}
}
return $this->write($string."\n");
}
if (method_exists($callable, '__invoke')) {
$string .= "\n- Type: `object`";
$string .= "\n".sprintf('- Name: `%s`', \get_class($callable));
return $this->write($string."\n");
}
throw new \InvalidArgumentException('Callable is not describable.');
} | php | protected function describeCallable($callable, array $options = [])
{
$string = '';
if (\is_array($callable)) {
$string .= "\n- Type: `function`";
if (\is_object($callable[0])) {
$string .= "\n".sprintf('- Name: `%s`', $callable[1]);
$string .= "\n".sprintf('- Class: `%s`', \get_class($callable[0]));
} else {
if (0 !== strpos($callable[1], 'parent::')) {
$string .= "\n".sprintf('- Name: `%s`', $callable[1]);
$string .= "\n".sprintf('- Class: `%s`', $callable[0]);
$string .= "\n- Static: yes";
} else {
$string .= "\n".sprintf('- Name: `%s`', substr($callable[1], 8));
$string .= "\n".sprintf('- Class: `%s`', $callable[0]);
$string .= "\n- Static: yes";
$string .= "\n- Parent: yes";
}
}
return $this->write($string."\n");
}
if (\is_string($callable)) {
$string .= "\n- Type: `function`";
if (false === strpos($callable, '::')) {
$string .= "\n".sprintf('- Name: `%s`', $callable);
} else {
$callableParts = explode('::', $callable);
$string .= "\n".sprintf('- Name: `%s`', $callableParts[1]);
$string .= "\n".sprintf('- Class: `%s`', $callableParts[0]);
$string .= "\n- Static: yes";
}
return $this->write($string."\n");
}
if ($callable instanceof \Closure) {
$string .= "\n- Type: `closure`";
$r = new \ReflectionFunction($callable);
if (false !== strpos($r->name, '{closure}')) {
return $this->write($string."\n");
}
$string .= "\n".sprintf('- Name: `%s`', $r->name);
if ($class = $r->getClosureScopeClass()) {
$string .= "\n".sprintf('- Class: `%s`', $class->name);
if (!$r->getClosureThis()) {
$string .= "\n- Static: yes";
}
}
return $this->write($string."\n");
}
if (method_exists($callable, '__invoke')) {
$string .= "\n- Type: `object`";
$string .= "\n".sprintf('- Name: `%s`', \get_class($callable));
return $this->write($string."\n");
}
throw new \InvalidArgumentException('Callable is not describable.');
} | [
"protected",
"function",
"describeCallable",
"(",
"$",
"callable",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"string",
"=",
"''",
";",
"if",
"(",
"\\",
"is_array",
"(",
"$",
"callable",
")",
")",
"{",
"$",
"string",
".=",
"\"\\n- Ty... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php#L324-L393 | train | Describes the function | [
30522,
5123,
3853,
6235,
9289,
20470,
2571,
1006,
1002,
2655,
3085,
1010,
9140,
1002,
7047,
1027,
1031,
1033,
1007,
1063,
1002,
5164,
1027,
1005,
1005,
1025,
2065,
1006,
1032,
2003,
1035,
9140,
1006,
1002,
2655,
3085,
1007,
1007,
1063,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/Tracker/Response.php | Response.outputException | public function outputException(Tracker $tracker, Exception $e, $statusCode)
{
Common::sendResponseCode($statusCode);
$this->logExceptionToErrorLog($e);
if ($tracker->isDebugModeEnabled()) {
Common::sendHeader('Content-Type: text/html; charset=utf-8');
$trailer = '<span style="color: #888888">Backtrace:<br /><pre>' . $e->getTraceAsString() . '</pre></span>';
$headerPage = file_get_contents(PIWIK_INCLUDE_PATH . '/plugins/Morpheus/templates/simpleLayoutHeader.tpl');
$footerPage = file_get_contents(PIWIK_INCLUDE_PATH . '/plugins/Morpheus/templates/simpleLayoutFooter.tpl');
$headerPage = str_replace('{$HTML_TITLE}', 'Matomo › Error', $headerPage);
echo $headerPage . '<p>' . $this->getMessageFromException($e) . '</p>' . $trailer . $footerPage;
} else {
$this->outputApiResponse($tracker);
}
} | php | public function outputException(Tracker $tracker, Exception $e, $statusCode)
{
Common::sendResponseCode($statusCode);
$this->logExceptionToErrorLog($e);
if ($tracker->isDebugModeEnabled()) {
Common::sendHeader('Content-Type: text/html; charset=utf-8');
$trailer = '<span style="color: #888888">Backtrace:<br /><pre>' . $e->getTraceAsString() . '</pre></span>';
$headerPage = file_get_contents(PIWIK_INCLUDE_PATH . '/plugins/Morpheus/templates/simpleLayoutHeader.tpl');
$footerPage = file_get_contents(PIWIK_INCLUDE_PATH . '/plugins/Morpheus/templates/simpleLayoutFooter.tpl');
$headerPage = str_replace('{$HTML_TITLE}', 'Matomo › Error', $headerPage);
echo $headerPage . '<p>' . $this->getMessageFromException($e) . '</p>' . $trailer . $footerPage;
} else {
$this->outputApiResponse($tracker);
}
} | [
"public",
"function",
"outputException",
"(",
"Tracker",
"$",
"tracker",
",",
"Exception",
"$",
"e",
",",
"$",
"statusCode",
")",
"{",
"Common",
"::",
"sendResponseCode",
"(",
"$",
"statusCode",
")",
";",
"$",
"this",
"->",
"logExceptionToErrorLog",
"(",
"$"... | Echos an error message & other information, then exits.
@param Tracker $tracker
@param Exception $e
@param int $statusCode eg 500 | [
"Echos",
"an",
"error",
"message",
"&",
"other",
"information",
"then",
"exits",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Tracker/Response.php#L53-L69 | train | Output exception to the browser | [
30522,
2270,
3853,
6434,
10288,
24422,
1006,
27080,
1002,
27080,
1010,
6453,
1002,
1041,
1010,
1002,
3570,
16044,
1007,
1063,
2691,
1024,
1024,
4604,
6072,
26029,
3366,
16044,
1006,
1002,
3570,
16044,
1007,
1025,
1002,
2023,
1011,
1028,
883... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Bridge/Doctrine/DependencyInjection/AbstractDoctrineExtension.php | AbstractDoctrineExtension.loadMappingInformation | protected function loadMappingInformation(array $objectManager, ContainerBuilder $container)
{
if ($objectManager['auto_mapping']) {
// automatically register bundle mappings
foreach (array_keys($container->getParameter('kernel.bundles')) as $bundle) {
if (!isset($objectManager['mappings'][$bundle])) {
$objectManager['mappings'][$bundle] = [
'mapping' => true,
'is_bundle' => true,
];
}
}
}
foreach ($objectManager['mappings'] as $mappingName => $mappingConfig) {
if (null !== $mappingConfig && false === $mappingConfig['mapping']) {
continue;
}
$mappingConfig = array_replace([
'dir' => false,
'type' => false,
'prefix' => false,
], (array) $mappingConfig);
$mappingConfig['dir'] = $container->getParameterBag()->resolveValue($mappingConfig['dir']);
// a bundle configuration is detected by realizing that the specified dir is not absolute and existing
if (!isset($mappingConfig['is_bundle'])) {
$mappingConfig['is_bundle'] = !is_dir($mappingConfig['dir']);
}
if ($mappingConfig['is_bundle']) {
$bundle = null;
foreach ($container->getParameter('kernel.bundles') as $name => $class) {
if ($mappingName === $name) {
$bundle = new \ReflectionClass($class);
break;
}
}
if (null === $bundle) {
throw new \InvalidArgumentException(sprintf('Bundle "%s" does not exist or it is not enabled.', $mappingName));
}
$mappingConfig = $this->getMappingDriverBundleConfigDefaults($mappingConfig, $bundle, $container);
if (!$mappingConfig) {
continue;
}
}
$this->assertValidMappingConfiguration($mappingConfig, $objectManager['name']);
$this->setMappingDriverConfig($mappingConfig, $mappingName);
$this->setMappingDriverAlias($mappingConfig, $mappingName);
}
} | php | protected function loadMappingInformation(array $objectManager, ContainerBuilder $container)
{
if ($objectManager['auto_mapping']) {
// automatically register bundle mappings
foreach (array_keys($container->getParameter('kernel.bundles')) as $bundle) {
if (!isset($objectManager['mappings'][$bundle])) {
$objectManager['mappings'][$bundle] = [
'mapping' => true,
'is_bundle' => true,
];
}
}
}
foreach ($objectManager['mappings'] as $mappingName => $mappingConfig) {
if (null !== $mappingConfig && false === $mappingConfig['mapping']) {
continue;
}
$mappingConfig = array_replace([
'dir' => false,
'type' => false,
'prefix' => false,
], (array) $mappingConfig);
$mappingConfig['dir'] = $container->getParameterBag()->resolveValue($mappingConfig['dir']);
// a bundle configuration is detected by realizing that the specified dir is not absolute and existing
if (!isset($mappingConfig['is_bundle'])) {
$mappingConfig['is_bundle'] = !is_dir($mappingConfig['dir']);
}
if ($mappingConfig['is_bundle']) {
$bundle = null;
foreach ($container->getParameter('kernel.bundles') as $name => $class) {
if ($mappingName === $name) {
$bundle = new \ReflectionClass($class);
break;
}
}
if (null === $bundle) {
throw new \InvalidArgumentException(sprintf('Bundle "%s" does not exist or it is not enabled.', $mappingName));
}
$mappingConfig = $this->getMappingDriverBundleConfigDefaults($mappingConfig, $bundle, $container);
if (!$mappingConfig) {
continue;
}
}
$this->assertValidMappingConfiguration($mappingConfig, $objectManager['name']);
$this->setMappingDriverConfig($mappingConfig, $mappingName);
$this->setMappingDriverAlias($mappingConfig, $mappingName);
}
} | [
"protected",
"function",
"loadMappingInformation",
"(",
"array",
"$",
"objectManager",
",",
"ContainerBuilder",
"$",
"container",
")",
"{",
"if",
"(",
"$",
"objectManager",
"[",
"'auto_mapping'",
"]",
")",
"{",
"// automatically register bundle mappings",
"foreach",
"... | @param array $objectManager A configured object manager
@param ContainerBuilder $container A ContainerBuilder instance
@throws \InvalidArgumentException | [
"@param",
"array",
"$objectManager",
"A",
"configured",
"object",
"manager",
"@param",
"ContainerBuilder",
"$container",
"A",
"ContainerBuilder",
"instance"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bridge/Doctrine/DependencyInjection/AbstractDoctrineExtension.php#L43-L98 | train | Load mapping information from the object manager | [
30522,
5123,
3853,
7170,
2863,
14853,
2378,
14192,
3370,
1006,
9140,
1002,
4874,
24805,
4590,
1010,
11661,
8569,
23891,
2099,
1002,
11661,
1007,
1063,
2065,
1006,
1002,
4874,
24805,
4590,
1031,
1005,
8285,
1035,
12375,
1005,
1033,
1007,
106... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Console/Command.php | Command.parseVerbosity | protected function parseVerbosity($level = null)
{
if (isset($this->verbosityMap[$level])) {
$level = $this->verbosityMap[$level];
} elseif (! is_int($level)) {
$level = $this->verbosity;
}
return $level;
} | php | protected function parseVerbosity($level = null)
{
if (isset($this->verbosityMap[$level])) {
$level = $this->verbosityMap[$level];
} elseif (! is_int($level)) {
$level = $this->verbosity;
}
return $level;
} | [
"protected",
"function",
"parseVerbosity",
"(",
"$",
"level",
"=",
"null",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"verbosityMap",
"[",
"$",
"level",
"]",
")",
")",
"{",
"$",
"level",
"=",
"$",
"this",
"->",
"verbosityMap",
"[",
"$",
... | Get the verbosity level in terms of Symfony's OutputInterface level.
@param string|int|null $level
@return int | [
"Get",
"the",
"verbosity",
"level",
"in",
"terms",
"of",
"Symfony",
"s",
"OutputInterface",
"level",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Console/Command.php#L553-L562 | train | Parse verbosity level | [
30522,
5123,
3853,
11968,
3366,
6299,
15853,
3012,
1006,
1002,
2504,
1027,
19701,
1007,
1063,
2065,
1006,
26354,
3388,
1006,
1002,
2023,
1011,
1028,
12034,
25949,
2863,
2361,
1031,
1002,
2504,
1033,
1007,
1007,
1063,
1002,
2504,
1027,
1002,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/Mail.php | Mail.setFrom | public function setFrom($email, $name = null)
{
return parent::setFrom(
$this->parseDomainPlaceholderAsPiwikHostName($email),
$name
);
} | php | public function setFrom($email, $name = null)
{
return parent::setFrom(
$this->parseDomainPlaceholderAsPiwikHostName($email),
$name
);
} | [
"public",
"function",
"setFrom",
"(",
"$",
"email",
",",
"$",
"name",
"=",
"null",
")",
"{",
"return",
"parent",
"::",
"setFrom",
"(",
"$",
"this",
"->",
"parseDomainPlaceholderAsPiwikHostName",
"(",
"$",
"email",
")",
",",
"$",
"name",
")",
";",
"}"
] | Sets the sender.
@param string $email Email address of the sender.
@param null|string $name Name of the sender.
@return Zend_Mail | [
"Sets",
"the",
"sender",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Mail.php#L75-L81 | train | Set From - - | [
30522,
2270,
3853,
2275,
19699,
5358,
1006,
1002,
10373,
1010,
1002,
2171,
1027,
19701,
1007,
1063,
2709,
6687,
1024,
1024,
2275,
19699,
5358,
1006,
1002,
2023,
1011,
1028,
11968,
6924,
9626,
2378,
24759,
10732,
14528,
3022,
8197,
9148,
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/Support/Arr.php | Arr.crossJoin | public static function crossJoin(...$arrays)
{
$results = [[]];
foreach ($arrays as $index => $array) {
$append = [];
foreach ($results as $product) {
foreach ($array as $item) {
$product[$index] = $item;
$append[] = $product;
}
}
$results = $append;
}
return $results;
} | php | public static function crossJoin(...$arrays)
{
$results = [[]];
foreach ($arrays as $index => $array) {
$append = [];
foreach ($results as $product) {
foreach ($array as $item) {
$product[$index] = $item;
$append[] = $product;
}
}
$results = $append;
}
return $results;
} | [
"public",
"static",
"function",
"crossJoin",
"(",
"...",
"$",
"arrays",
")",
"{",
"$",
"results",
"=",
"[",
"[",
"]",
"]",
";",
"foreach",
"(",
"$",
"arrays",
"as",
"$",
"index",
"=>",
"$",
"array",
")",
"{",
"$",
"append",
"=",
"[",
"]",
";",
... | Cross join the given arrays, returning all possible permutations.
@param array ...$arrays
@return array | [
"Cross",
"join",
"the",
"given",
"arrays",
"returning",
"all",
"possible",
"permutations",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Support/Arr.php#L70-L89 | train | Cross join array | [
30522,
2270,
10763,
3853,
2892,
5558,
2378,
1006,
1012,
1012,
1012,
1002,
27448,
1007,
1063,
1002,
3463,
1027,
1031,
1031,
1033,
1033,
1025,
18921,
6776,
1006,
1002,
27448,
2004,
1002,
5950,
1027,
1028,
1002,
9140,
1007,
1063,
1002,
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... |
matomo-org/matomo | plugins/ScheduledReports/ScheduledReports.php | ScheduledReports.deleteSiteReport | public function deleteSiteReport($idSite)
{
$idReports = API::getInstance()->getReports($idSite);
foreach ($idReports as $report) {
$idReport = $report['idreport'];
API::getInstance()->deleteReport($idReport);
}
} | php | public function deleteSiteReport($idSite)
{
$idReports = API::getInstance()->getReports($idSite);
foreach ($idReports as $report) {
$idReport = $report['idreport'];
API::getInstance()->deleteReport($idReport);
}
} | [
"public",
"function",
"deleteSiteReport",
"(",
"$",
"idSite",
")",
"{",
"$",
"idReports",
"=",
"API",
"::",
"getInstance",
"(",
")",
"->",
"getReports",
"(",
"$",
"idSite",
")",
";",
"foreach",
"(",
"$",
"idReports",
"as",
"$",
"report",
")",
"{",
"$",... | Delete reports for the website | [
"Delete",
"reports",
"for",
"the",
"website"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/ScheduledReports/ScheduledReports.php#L121-L129 | train | Delete all reports for a site | [
30522,
2270,
3853,
3972,
12870,
28032,
7869,
6442,
1006,
1002,
8909,
28032,
2063,
1007,
1063,
1002,
8909,
2890,
25378,
1027,
17928,
1024,
1024,
2131,
7076,
26897,
1006,
1007,
1011,
1028,
2131,
2890,
25378,
1006,
1002,
8909,
28032,
2063,
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/Ecommerce/Columns/Revenue.php | Revenue.onEcommerceCartUpdateConversion | public function onEcommerceCartUpdateConversion(Request $request, Visitor $visitor, $action, GoalManager $goalManager)
{
return $this->onEcommerceOrderConversion($request, $visitor, $action, $goalManager);
} | php | public function onEcommerceCartUpdateConversion(Request $request, Visitor $visitor, $action, GoalManager $goalManager)
{
return $this->onEcommerceOrderConversion($request, $visitor, $action, $goalManager);
} | [
"public",
"function",
"onEcommerceCartUpdateConversion",
"(",
"Request",
"$",
"request",
",",
"Visitor",
"$",
"visitor",
",",
"$",
"action",
",",
"GoalManager",
"$",
"goalManager",
")",
"{",
"return",
"$",
"this",
"->",
"onEcommerceOrderConversion",
"(",
"$",
"r... | @param Request $request
@param Visitor $visitor
@param Action|null $action
@param GoalManager $goalManager
@return mixed|false | [
"@param",
"Request",
"$request",
"@param",
"Visitor",
"$visitor",
"@param",
"Action|null",
"$action",
"@param",
"GoalManager",
"$goalManager"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Ecommerce/Columns/Revenue.php#L70-L73 | train | This method is called when an ecommerce cart update conversion is triggered | [
30522,
2270,
3853,
2028,
9006,
5017,
3401,
10010,
8525,
17299,
3686,
8663,
27774,
1006,
5227,
1002,
5227,
1010,
10367,
1002,
10367,
1010,
1002,
2895,
1010,
3125,
24805,
4590,
1002,
3125,
24805,
4590,
1007,
1063,
2709,
1002,
2023,
1011,
1028... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.