repo stringclasses 21 values | path stringlengths 10 105 | func_name stringlengths 6 64 | original_string stringlengths 105 15.6k | language stringclasses 1 value | code stringlengths 105 15.6k | code_tokens listlengths 29 2.15k | docstring stringlengths 11 2.85k | docstring_tokens listlengths 1 290 | sha stringclasses 21 values | url stringlengths 100 194 | partition stringclasses 1 value | summary stringlengths 8 319 | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
matomo-org/matomo | libs/Zend/Db/Table/Abstract.php | Zend_Db_Table_Abstract._where | protected function _where(Zend_Db_Table_Select $select, $where)
{
$where = (array) $where;
foreach ($where as $key => $val) {
// is $key an int?
if (is_int($key)) {
// $val is the full condition
$select->where($val);
} else {
// $key is the condition with placeholder,
// and $val is quoted into the condition
$select->where($key, $val);
}
}
return $select;
} | php | protected function _where(Zend_Db_Table_Select $select, $where)
{
$where = (array) $where;
foreach ($where as $key => $val) {
// is $key an int?
if (is_int($key)) {
// $val is the full condition
$select->where($val);
} else {
// $key is the condition with placeholder,
// and $val is quoted into the condition
$select->where($key, $val);
}
}
return $select;
} | [
"protected",
"function",
"_where",
"(",
"Zend_Db_Table_Select",
"$",
"select",
",",
"$",
"where",
")",
"{",
"$",
"where",
"=",
"(",
"array",
")",
"$",
"where",
";",
"foreach",
"(",
"$",
"where",
"as",
"$",
"key",
"=>",
"$",
"val",
")",
"{",
"// is $k... | Generate WHERE clause from user-supplied string or array
@param string|array $where OPTIONAL An SQL WHERE clause.
@return Zend_Db_Table_Select | [
"Generate",
"WHERE",
"clause",
"from",
"user",
"-",
"supplied",
"string",
"or",
"array"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Table/Abstract.php#L1483-L1500 | train | Add where clause to the select | [
30522,
5123,
3853,
1035,
2073,
1006,
16729,
2094,
1035,
16962,
1035,
2795,
1035,
7276,
1002,
7276,
1010,
1002,
2073,
1007,
1063,
1002,
2073,
1027,
1006,
9140,
1007,
1002,
2073,
1025,
18921,
6776,
1006,
1002,
2073,
2004,
1002,
3145,
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/API/Request.php | Request.getBaseReportUrl | public static function getBaseReportUrl($module, $action, $queryParams = array())
{
$params = array_merge($queryParams, array('module' => $module, 'action' => $action));
return Request::getCurrentUrlWithoutGenericFilters($params);
} | php | public static function getBaseReportUrl($module, $action, $queryParams = array())
{
$params = array_merge($queryParams, array('module' => $module, 'action' => $action));
return Request::getCurrentUrlWithoutGenericFilters($params);
} | [
"public",
"static",
"function",
"getBaseReportUrl",
"(",
"$",
"module",
",",
"$",
"action",
",",
"$",
"queryParams",
"=",
"array",
"(",
")",
")",
"{",
"$",
"params",
"=",
"array_merge",
"(",
"$",
"queryParams",
",",
"array",
"(",
"'module'",
"=>",
"$",
... | Returns the URL for the current requested report w/o any filter parameters.
@param string $module The API module.
@param string $action The API action.
@param array $queryParams Query parameter overrides.
@return string | [
"Returns",
"the",
"URL",
"for",
"the",
"current",
"requested",
"report",
"w",
"/",
"o",
"any",
"filter",
"parameters",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/API/Request.php#L534-L538 | train | Returns the base URL for the report | [
30522,
2270,
10763,
3853,
2131,
15058,
2890,
6442,
3126,
2140,
1006,
1002,
11336,
1010,
1002,
2895,
1010,
1002,
23032,
28689,
5244,
1027,
9140,
1006,
1007,
1007,
1063,
1002,
11498,
5244,
1027,
9140,
1035,
13590,
1006,
1002,
23032,
28689,
52... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/ArrayDenormalizer.php | ArrayDenormalizer.denormalize | public function denormalize($data, $class, $format = null, array $context = [])
{
if (null === $this->serializer) {
throw new BadMethodCallException('Please set a serializer before calling denormalize()!');
}
if (!\is_array($data)) {
throw new InvalidArgumentException('Data expected to be an array, '.\gettype($data).' given.');
}
if ('[]' !== substr($class, -2)) {
throw new InvalidArgumentException('Unsupported class: '.$class);
}
$serializer = $this->serializer;
$class = substr($class, 0, -2);
$builtinType = isset($context['key_type']) ? $context['key_type']->getBuiltinType() : null;
foreach ($data as $key => $value) {
if (null !== $builtinType && !('is_'.$builtinType)($key)) {
throw new NotNormalizableValueException(sprintf('The type of the key "%s" must be "%s" ("%s" given).', $key, $builtinType, \gettype($key)));
}
$data[$key] = $serializer->denormalize($value, $class, $format, $context);
}
return $data;
} | php | public function denormalize($data, $class, $format = null, array $context = [])
{
if (null === $this->serializer) {
throw new BadMethodCallException('Please set a serializer before calling denormalize()!');
}
if (!\is_array($data)) {
throw new InvalidArgumentException('Data expected to be an array, '.\gettype($data).' given.');
}
if ('[]' !== substr($class, -2)) {
throw new InvalidArgumentException('Unsupported class: '.$class);
}
$serializer = $this->serializer;
$class = substr($class, 0, -2);
$builtinType = isset($context['key_type']) ? $context['key_type']->getBuiltinType() : null;
foreach ($data as $key => $value) {
if (null !== $builtinType && !('is_'.$builtinType)($key)) {
throw new NotNormalizableValueException(sprintf('The type of the key "%s" must be "%s" ("%s" given).', $key, $builtinType, \gettype($key)));
}
$data[$key] = $serializer->denormalize($value, $class, $format, $context);
}
return $data;
} | [
"public",
"function",
"denormalize",
"(",
"$",
"data",
",",
"$",
"class",
",",
"$",
"format",
"=",
"null",
",",
"array",
"$",
"context",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"serializer",
")",
"{",
"throw",
"new",
... | {@inheritdoc}
@throws NotNormalizableValueException | [
"{",
"@inheritdoc",
"}"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Serializer/Normalizer/ArrayDenormalizer.php#L39-L64 | train | Denormalizes the data | [
30522,
2270,
3853,
7939,
2953,
9067,
4697,
1006,
1002,
2951,
1010,
1002,
2465,
1010,
1002,
4289,
30524,
1007,
999,
1005,
1007,
1025,
1065,
2065,
1006,
999,
1032,
2003,
1035,
9140,
1006,
1002,
2951,
1007,
1007,
1063,
5466,
2047,
19528,
290... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Command/TranslationUpdateCommand.php | TranslationUpdateCommand.configure | protected function configure()
{
$this
->setDefinition([
new InputArgument('locale', InputArgument::REQUIRED, 'The locale'),
new InputArgument('bundle', InputArgument::OPTIONAL, 'The bundle name or directory where to load the messages'),
new InputOption('prefix', null, InputOption::VALUE_OPTIONAL, 'Override the default prefix', '__'),
new InputOption('output-format', null, InputOption::VALUE_OPTIONAL, 'Override the default output format', 'xlf'),
new InputOption('dump-messages', null, InputOption::VALUE_NONE, 'Should the messages be dumped in the console'),
new InputOption('force', null, InputOption::VALUE_NONE, 'Should the update be done'),
new InputOption('no-backup', null, InputOption::VALUE_NONE, 'Should backup be disabled'),
new InputOption('clean', null, InputOption::VALUE_NONE, 'Should clean not found messages'),
new InputOption('domain', null, InputOption::VALUE_OPTIONAL, 'Specify the domain to update'),
new InputOption('xliff-version', null, InputOption::VALUE_OPTIONAL, 'Override the default xliff version', '1.2'),
])
->setDescription('Updates the translation file')
->setHelp(<<<'EOF'
The <info>%command.name%</info> command extracts translation strings from templates
of a given bundle or the default translations directory. It can display them or merge the new ones into the translation files.
When new translation strings are found it can automatically add a prefix to the translation
message.
Example running against a Bundle (AcmeBundle)
<info>php %command.full_name% --dump-messages en AcmeBundle</info>
<info>php %command.full_name% --force --prefix="new_" fr AcmeBundle</info>
Example running against default messages directory
<info>php %command.full_name% --dump-messages en</info>
<info>php %command.full_name% --force --prefix="new_" fr</info>
EOF
)
;
} | php | protected function configure()
{
$this
->setDefinition([
new InputArgument('locale', InputArgument::REQUIRED, 'The locale'),
new InputArgument('bundle', InputArgument::OPTIONAL, 'The bundle name or directory where to load the messages'),
new InputOption('prefix', null, InputOption::VALUE_OPTIONAL, 'Override the default prefix', '__'),
new InputOption('output-format', null, InputOption::VALUE_OPTIONAL, 'Override the default output format', 'xlf'),
new InputOption('dump-messages', null, InputOption::VALUE_NONE, 'Should the messages be dumped in the console'),
new InputOption('force', null, InputOption::VALUE_NONE, 'Should the update be done'),
new InputOption('no-backup', null, InputOption::VALUE_NONE, 'Should backup be disabled'),
new InputOption('clean', null, InputOption::VALUE_NONE, 'Should clean not found messages'),
new InputOption('domain', null, InputOption::VALUE_OPTIONAL, 'Specify the domain to update'),
new InputOption('xliff-version', null, InputOption::VALUE_OPTIONAL, 'Override the default xliff version', '1.2'),
])
->setDescription('Updates the translation file')
->setHelp(<<<'EOF'
The <info>%command.name%</info> command extracts translation strings from templates
of a given bundle or the default translations directory. It can display them or merge the new ones into the translation files.
When new translation strings are found it can automatically add a prefix to the translation
message.
Example running against a Bundle (AcmeBundle)
<info>php %command.full_name% --dump-messages en AcmeBundle</info>
<info>php %command.full_name% --force --prefix="new_" fr AcmeBundle</info>
Example running against default messages directory
<info>php %command.full_name% --dump-messages en</info>
<info>php %command.full_name% --force --prefix="new_" fr</info>
EOF
)
;
} | [
"protected",
"function",
"configure",
"(",
")",
"{",
"$",
"this",
"->",
"setDefinition",
"(",
"[",
"new",
"InputArgument",
"(",
"'locale'",
",",
"InputArgument",
"::",
"REQUIRED",
",",
"'The locale'",
")",
",",
"new",
"InputArgument",
"(",
"'bundle'",
",",
"... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php#L67-L100 | train | Configure the command | [
30522,
5123,
3853,
9530,
8873,
27390,
2063,
1006,
1007,
1063,
1002,
2023,
1011,
1028,
2275,
3207,
16294,
22753,
1006,
1031,
2047,
7953,
2906,
22850,
4765,
1006,
1005,
2334,
2063,
1005,
1010,
7953,
2906,
22850,
4765,
1024,
1024,
3223,
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... |
dompdf/dompdf | src/Renderer/AbstractRenderer.php | AbstractRenderer._border_line | protected function _border_line($x, $y, $length, $color, $widths, $side, $corner_style = "bevel", $pattern_name, $r1 = 0, $r2 = 0)
{
/** used by $$side */
list($top, $right, $bottom, $left) = $widths;
$width = $$side;
$pattern = $this->_get_dash_pattern($pattern_name, $width);
$half_width = $width / 2;
$r1 -= $half_width;
$r2 -= $half_width;
$adjust = $r1 / 80;
$length -= $width;
switch ($side) {
case "top":
$x += $half_width;
$y += $half_width;
if ($r1 > 0) {
$this->_canvas->arc($x + $r1, $y + $r1, $r1, $r1, 90 - $adjust, 135 + $adjust, $color, $width, $pattern);
}
$this->_canvas->line($x + $r1, $y, $x + $length - $r2, $y, $color, $width, $pattern);
if ($r2 > 0) {
$this->_canvas->arc($x + $length - $r2, $y + $r2, $r2, $r2, 45 - $adjust, 90 + $adjust, $color, $width, $pattern);
}
break;
case "bottom":
$x += $half_width;
$y -= $half_width;
if ($r1 > 0) {
$this->_canvas->arc($x + $r1, $y - $r1, $r1, $r1, 225 - $adjust, 270 + $adjust, $color, $width, $pattern);
}
$this->_canvas->line($x + $r1, $y, $x + $length - $r2, $y, $color, $width, $pattern);
if ($r2 > 0) {
$this->_canvas->arc($x + $length - $r2, $y - $r2, $r2, $r2, 270 - $adjust, 315 + $adjust, $color, $width, $pattern);
}
break;
case "left":
$y += $half_width;
$x += $half_width;
if ($r1 > 0) {
$this->_canvas->arc($x + $r1, $y + $r1, $r1, $r1, 135 - $adjust, 180 + $adjust, $color, $width, $pattern);
}
$this->_canvas->line($x, $y + $r1, $x, $y + $length - $r2, $color, $width, $pattern);
if ($r2 > 0) {
$this->_canvas->arc($x + $r2, $y + $length - $r2, $r2, $r2, 180 - $adjust, 225 + $adjust, $color, $width, $pattern);
}
break;
case "right":
$y += $half_width;
$x -= $half_width;
if ($r1 > 0) {
$this->_canvas->arc($x - $r1, $y + $r1, $r1, $r1, 0 - $adjust, 45 + $adjust, $color, $width, $pattern);
}
$this->_canvas->line($x, $y + $r1, $x, $y + $length - $r2, $color, $width, $pattern);
if ($r2 > 0) {
$this->_canvas->arc($x - $r2, $y + $length - $r2, $r2, $r2, 315 - $adjust, 360 + $adjust, $color, $width, $pattern);
}
break;
}
} | php | protected function _border_line($x, $y, $length, $color, $widths, $side, $corner_style = "bevel", $pattern_name, $r1 = 0, $r2 = 0)
{
/** used by $$side */
list($top, $right, $bottom, $left) = $widths;
$width = $$side;
$pattern = $this->_get_dash_pattern($pattern_name, $width);
$half_width = $width / 2;
$r1 -= $half_width;
$r2 -= $half_width;
$adjust = $r1 / 80;
$length -= $width;
switch ($side) {
case "top":
$x += $half_width;
$y += $half_width;
if ($r1 > 0) {
$this->_canvas->arc($x + $r1, $y + $r1, $r1, $r1, 90 - $adjust, 135 + $adjust, $color, $width, $pattern);
}
$this->_canvas->line($x + $r1, $y, $x + $length - $r2, $y, $color, $width, $pattern);
if ($r2 > 0) {
$this->_canvas->arc($x + $length - $r2, $y + $r2, $r2, $r2, 45 - $adjust, 90 + $adjust, $color, $width, $pattern);
}
break;
case "bottom":
$x += $half_width;
$y -= $half_width;
if ($r1 > 0) {
$this->_canvas->arc($x + $r1, $y - $r1, $r1, $r1, 225 - $adjust, 270 + $adjust, $color, $width, $pattern);
}
$this->_canvas->line($x + $r1, $y, $x + $length - $r2, $y, $color, $width, $pattern);
if ($r2 > 0) {
$this->_canvas->arc($x + $length - $r2, $y - $r2, $r2, $r2, 270 - $adjust, 315 + $adjust, $color, $width, $pattern);
}
break;
case "left":
$y += $half_width;
$x += $half_width;
if ($r1 > 0) {
$this->_canvas->arc($x + $r1, $y + $r1, $r1, $r1, 135 - $adjust, 180 + $adjust, $color, $width, $pattern);
}
$this->_canvas->line($x, $y + $r1, $x, $y + $length - $r2, $color, $width, $pattern);
if ($r2 > 0) {
$this->_canvas->arc($x + $r2, $y + $length - $r2, $r2, $r2, 180 - $adjust, 225 + $adjust, $color, $width, $pattern);
}
break;
case "right":
$y += $half_width;
$x -= $half_width;
if ($r1 > 0) {
$this->_canvas->arc($x - $r1, $y + $r1, $r1, $r1, 0 - $adjust, 45 + $adjust, $color, $width, $pattern);
}
$this->_canvas->line($x, $y + $r1, $x, $y + $length - $r2, $color, $width, $pattern);
if ($r2 > 0) {
$this->_canvas->arc($x - $r2, $y + $length - $r2, $r2, $r2, 315 - $adjust, 360 + $adjust, $color, $width, $pattern);
}
break;
}
} | [
"protected",
"function",
"_border_line",
"(",
"$",
"x",
",",
"$",
"y",
",",
"$",
"length",
",",
"$",
"color",
",",
"$",
"widths",
",",
"$",
"side",
",",
"$",
"corner_style",
"=",
"\"bevel\"",
",",
"$",
"pattern_name",
",",
"$",
"r1",
"=",
"0",
",",... | Draws a solid, dotted, or dashed line, observing the border radius
@param $x
@param $y
@param $length
@param $color
@param $widths
@param $side
@param string $corner_style
@param $pattern_name
@param int $r1
@param int $r2
@var $top | [
"Draws",
"a",
"solid",
"dotted",
"or",
"dashed",
"line",
"observing",
"the",
"border",
"radius"
] | 75f13c700009be21a1965dc2c5b68a8708c22ba2 | https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/src/Renderer/AbstractRenderer.php#L827-L902 | train | border a line | [
30522,
5123,
3853,
1035,
3675,
1035,
2240,
1006,
1002,
1060,
1010,
1002,
1061,
1010,
1002,
3091,
1010,
1002,
3609,
1010,
1002,
9381,
2015,
1010,
1002,
2217,
1010,
1002,
3420,
1035,
2806,
1027,
1000,
2022,
15985,
1000,
1010,
1002,
5418,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/CoreUpdater/Commands/Update.php | Update.execute | protected function execute(InputInterface $input, OutputInterface $output)
{
$this->executeClearCaches();
$yes = $input->getOption('yes');
try {
$this->makeUpdate($input, $output, true);
if (!$yes) {
$yes = $this->askForUpdateConfirmation($input, $output);
}
if ($yes) {
$output->writeln("\n" . Piwik::translate('CoreUpdater_ConsoleStartingDbUpgrade'));
$this->makeUpdate($input, $output, false);
$this->writeSuccessMessage($output, array(Piwik::translate('CoreUpdater_PiwikHasBeenSuccessfullyUpgraded')));
} else {
$this->writeSuccessMessage($output, array(Piwik::translate('CoreUpdater_DbUpgradeNotExecuted')));
}
$this->writeAlertMessageWhenCommandExecutedWithUnexpectedUser($output);
} catch(NoUpdatesFoundException $e) {
// Do not fail if no updates were found
$this->writeSuccessMessage($output, array($e->getMessage()));
}
} | php | protected function execute(InputInterface $input, OutputInterface $output)
{
$this->executeClearCaches();
$yes = $input->getOption('yes');
try {
$this->makeUpdate($input, $output, true);
if (!$yes) {
$yes = $this->askForUpdateConfirmation($input, $output);
}
if ($yes) {
$output->writeln("\n" . Piwik::translate('CoreUpdater_ConsoleStartingDbUpgrade'));
$this->makeUpdate($input, $output, false);
$this->writeSuccessMessage($output, array(Piwik::translate('CoreUpdater_PiwikHasBeenSuccessfullyUpgraded')));
} else {
$this->writeSuccessMessage($output, array(Piwik::translate('CoreUpdater_DbUpgradeNotExecuted')));
}
$this->writeAlertMessageWhenCommandExecutedWithUnexpectedUser($output);
} catch(NoUpdatesFoundException $e) {
// Do not fail if no updates were found
$this->writeSuccessMessage($output, array($e->getMessage()));
}
} | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"$",
"this",
"->",
"executeClearCaches",
"(",
")",
";",
"$",
"yes",
"=",
"$",
"input",
"->",
"getOption",
"(",
"'yes'",
")",
";",
"t... | Execute command like: ./console core:update --yes | [
"Execute",
"command",
"like",
":",
".",
"/",
"console",
"core",
":",
"update",
"--",
"yes"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/CoreUpdater/Commands/Update.php#L50-L80 | train | Executes the update command | [
30522,
5123,
3853,
15389,
1006,
7953,
18447,
2121,
12172,
1002,
7953,
1010,
6434,
18447,
2121,
12172,
1002,
6434,
1007,
1063,
1002,
2023,
1011,
1028,
15389,
14321,
2906,
3540,
8376,
1006,
1007,
1025,
1002,
2748,
1027,
1002,
7953,
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/Db.php | Db.isLockPrivilegeGranted | public static function isLockPrivilegeGranted()
{
if (is_null(self::$lockPrivilegeGranted)) {
try {
Db::lockTables(Common::prefixTable('log_visit'));
Db::unlockAllTables();
self::$lockPrivilegeGranted = true;
} catch (Exception $ex) {
self::$lockPrivilegeGranted = false;
}
}
return self::$lockPrivilegeGranted;
} | php | public static function isLockPrivilegeGranted()
{
if (is_null(self::$lockPrivilegeGranted)) {
try {
Db::lockTables(Common::prefixTable('log_visit'));
Db::unlockAllTables();
self::$lockPrivilegeGranted = true;
} catch (Exception $ex) {
self::$lockPrivilegeGranted = false;
}
}
return self::$lockPrivilegeGranted;
} | [
"public",
"static",
"function",
"isLockPrivilegeGranted",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"self",
"::",
"$",
"lockPrivilegeGranted",
")",
")",
"{",
"try",
"{",
"Db",
"::",
"lockTables",
"(",
"Common",
"::",
"prefixTable",
"(",
"'log_visit'",
")",
... | Checks whether the database user is allowed to lock tables.
@return bool | [
"Checks",
"whether",
"the",
"database",
"user",
"is",
"allowed",
"to",
"lock",
"tables",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Db.php#L707-L721 | train | Returns true if the privilege is granted for the current user | [
30522,
2270,
10763,
3853,
2003,
7878,
18098,
12848,
9463,
3351,
18980,
2098,
1006,
1007,
1063,
2065,
1006,
2003,
1035,
19701,
1006,
2969,
1024,
1024,
1002,
5843,
18098,
12848,
9463,
3351,
18980,
2098,
1007,
1007,
1063,
3046,
1063,
16962,
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/Validator/Constraints/TimezoneValidator.php | TimezoneValidator.formatValue | protected function formatValue($value, $format = 0)
{
$value = parent::formatValue($value, $format);
if (!$value || \DateTimeZone::PER_COUNTRY === $value) {
return $value;
}
return array_search($value, (new \ReflectionClass(\DateTimeZone::class))->getConstants(), true) ?: $value;
} | php | protected function formatValue($value, $format = 0)
{
$value = parent::formatValue($value, $format);
if (!$value || \DateTimeZone::PER_COUNTRY === $value) {
return $value;
}
return array_search($value, (new \ReflectionClass(\DateTimeZone::class))->getConstants(), true) ?: $value;
} | [
"protected",
"function",
"formatValue",
"(",
"$",
"value",
",",
"$",
"format",
"=",
"0",
")",
"{",
"$",
"value",
"=",
"parent",
"::",
"formatValue",
"(",
"$",
"value",
",",
"$",
"format",
")",
";",
"if",
"(",
"!",
"$",
"value",
"||",
"\\",
"DateTim... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Validator/Constraints/TimezoneValidator.php#L98-L107 | train | Override to allow custom formatting of DateTimeZone | [
30522,
5123,
3853,
4289,
10175,
5657,
1006,
1002,
3643,
1010,
1002,
4289,
1027,
1014,
1007,
1063,
1002,
3643,
1027,
6687,
1024,
1024,
4289,
10175,
5657,
1006,
1002,
3643,
1010,
1002,
4289,
1007,
1025,
2065,
1006,
999,
1002,
3643,
1064,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/Referrers/Referrers.php | Referrers.setGetAllHtmlPrefix | public function setGetAllHtmlPrefix($referrerType)
{
// get singular label for referrer type
$indexTranslation = '';
switch ($referrerType) {
case Common::REFERRER_TYPE_DIRECT_ENTRY:
$indexTranslation = 'Referrers_DirectEntry';
break;
case Common::REFERRER_TYPE_SEARCH_ENGINE:
$indexTranslation = 'General_ColumnKeyword';
break;
case Common::REFERRER_TYPE_SOCIAL_NETWORK:
$indexTranslation = 'Referrers_ColumnSocial';
break;
case Common::REFERRER_TYPE_WEBSITE:
$indexTranslation = 'Referrers_ColumnWebsite';
break;
case Common::REFERRER_TYPE_CAMPAIGN:
$indexTranslation = 'Referrers_ColumnCampaign';
break;
default:
// case of newsletter, partners, before Piwik 0.2.25
$indexTranslation = 'General_Others';
break;
}
$label = strtolower(Piwik::translate($indexTranslation));
// return html that displays it as grey & italic
return '<span class="datatable-label-category">(' . $label . ')</span>';
} | php | public function setGetAllHtmlPrefix($referrerType)
{
// get singular label for referrer type
$indexTranslation = '';
switch ($referrerType) {
case Common::REFERRER_TYPE_DIRECT_ENTRY:
$indexTranslation = 'Referrers_DirectEntry';
break;
case Common::REFERRER_TYPE_SEARCH_ENGINE:
$indexTranslation = 'General_ColumnKeyword';
break;
case Common::REFERRER_TYPE_SOCIAL_NETWORK:
$indexTranslation = 'Referrers_ColumnSocial';
break;
case Common::REFERRER_TYPE_WEBSITE:
$indexTranslation = 'Referrers_ColumnWebsite';
break;
case Common::REFERRER_TYPE_CAMPAIGN:
$indexTranslation = 'Referrers_ColumnCampaign';
break;
default:
// case of newsletter, partners, before Piwik 0.2.25
$indexTranslation = 'General_Others';
break;
}
$label = strtolower(Piwik::translate($indexTranslation));
// return html that displays it as grey & italic
return '<span class="datatable-label-category">(' . $label . ')</span>';
} | [
"public",
"function",
"setGetAllHtmlPrefix",
"(",
"$",
"referrerType",
")",
"{",
"// get singular label for referrer type",
"$",
"indexTranslation",
"=",
"''",
";",
"switch",
"(",
"$",
"referrerType",
")",
"{",
"case",
"Common",
"::",
"REFERRER_TYPE_DIRECT_ENTRY",
":"... | DataTable filter callback that returns the HTML prefix for a label in the
'getAll' report based on the row's referrer type.
@param int $referrerType The referrer type.
@return string | [
"DataTable",
"filter",
"callback",
"that",
"returns",
"the",
"HTML",
"prefix",
"for",
"a",
"label",
"in",
"the",
"getAll",
"report",
"based",
"on",
"the",
"row",
"s",
"referrer",
"type",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Referrers/Referrers.php#L101-L131 | train | Returns the html for the all columns of the referrer type | [
30522,
2270,
3853,
2275,
18150,
8095,
11039,
19968,
28139,
8873,
2595,
1006,
1002,
6523,
14544,
13874,
1007,
1063,
1013,
1013,
2131,
13048,
3830,
2005,
6523,
14544,
2828,
1002,
5950,
6494,
3619,
13490,
1027,
1005,
1005,
1025,
6942,
1006,
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/Routing/Console/ControllerMakeCommand.php | ControllerMakeCommand.parseModel | protected function parseModel($model)
{
if (preg_match('([^A-Za-z0-9_/\\\\])', $model)) {
throw new InvalidArgumentException('Model name contains invalid characters.');
}
$model = trim(str_replace('/', '\\', $model), '\\');
if (! Str::startsWith($model, $rootNamespace = $this->laravel->getNamespace())) {
$model = $rootNamespace.$model;
}
return $model;
} | php | protected function parseModel($model)
{
if (preg_match('([^A-Za-z0-9_/\\\\])', $model)) {
throw new InvalidArgumentException('Model name contains invalid characters.');
}
$model = trim(str_replace('/', '\\', $model), '\\');
if (! Str::startsWith($model, $rootNamespace = $this->laravel->getNamespace())) {
$model = $rootNamespace.$model;
}
return $model;
} | [
"protected",
"function",
"parseModel",
"(",
"$",
"model",
")",
"{",
"if",
"(",
"preg_match",
"(",
"'([^A-Za-z0-9_/\\\\\\\\])'",
",",
"$",
"model",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'Model name contains invalid characters.'",
")",
";",
... | Get the fully-qualified model class name.
@param string $model
@return string
@throws \InvalidArgumentException | [
"Get",
"the",
"fully",
"-",
"qualified",
"model",
"class",
"name",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Routing/Console/ControllerMakeCommand.php#L156-L169 | train | Parse model name | [
30522,
5123,
3853,
11968,
3366,
5302,
9247,
1006,
1002,
2944,
1007,
1063,
2065,
1006,
3653,
2290,
1035,
2674,
1006,
1005,
1006,
1031,
1034,
1037,
1011,
23564,
1011,
1062,
2692,
1011,
1023,
1035,
1013,
1032,
1032,
1032,
1032,
1033,
1007,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
php-ai/php-ml | src/Classification/Linear/Perceptron.php | Perceptron.output | protected function output(array $sample)
{
$sum = 0;
foreach ($this->weights as $index => $w) {
if ($index == 0) {
$sum += $w;
} else {
$sum += $w * $sample[$index - 1];
}
}
return $sum;
} | php | protected function output(array $sample)
{
$sum = 0;
foreach ($this->weights as $index => $w) {
if ($index == 0) {
$sum += $w;
} else {
$sum += $w * $sample[$index - 1];
}
}
return $sum;
} | [
"protected",
"function",
"output",
"(",
"array",
"$",
"sample",
")",
"{",
"$",
"sum",
"=",
"0",
";",
"foreach",
"(",
"$",
"this",
"->",
"weights",
"as",
"$",
"index",
"=>",
"$",
"w",
")",
"{",
"if",
"(",
"$",
"index",
"==",
"0",
")",
"{",
"$",
... | Calculates net output of the network as a float value for the given input
@return int|float | [
"Calculates",
"net",
"output",
"of",
"the",
"network",
"as",
"a",
"float",
"value",
"for",
"the",
"given",
"input"
] | f6aa1a59b0525b8fca3d2786d661ab3e70904016 | https://github.com/php-ai/php-ml/blob/f6aa1a59b0525b8fca3d2786d661ab3e70904016/src/Classification/Linear/Perceptron.php#L210-L222 | train | Outputs the output of the weights | [
30522,
5123,
3853,
6434,
1006,
9140,
1002,
7099,
1007,
1063,
1002,
7680,
1027,
1014,
1025,
18921,
6776,
1006,
1002,
2023,
1011,
1028,
15871,
2004,
1002,
5950,
1027,
1028,
1002,
1059,
1007,
1063,
2065,
1006,
1002,
5950,
1027,
1027,
1014,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/Zend/Db/Adapter/Oracle.php | Zend_Db_Adapter_Oracle._rollBack | protected function _rollBack()
{
if (!oci_rollback($this->_connection)) {
/**
* @see Zend_Db_Adapter_Oracle_Exception
*/
// require_once 'Zend/Db/Adapter/Oracle/Exception.php';
throw new Zend_Db_Adapter_Oracle_Exception(oci_error($this->_connection));
}
$this->_setExecuteMode(OCI_COMMIT_ON_SUCCESS);
} | php | protected function _rollBack()
{
if (!oci_rollback($this->_connection)) {
/**
* @see Zend_Db_Adapter_Oracle_Exception
*/
// require_once 'Zend/Db/Adapter/Oracle/Exception.php';
throw new Zend_Db_Adapter_Oracle_Exception(oci_error($this->_connection));
}
$this->_setExecuteMode(OCI_COMMIT_ON_SUCCESS);
} | [
"protected",
"function",
"_rollBack",
"(",
")",
"{",
"if",
"(",
"!",
"oci_rollback",
"(",
"$",
"this",
"->",
"_connection",
")",
")",
"{",
"/**\n * @see Zend_Db_Adapter_Oracle_Exception\n */",
"// require_once 'Zend/Db/Adapter/Oracle/Exception.php';",
... | Roll back a transaction and return to autocommit mode.
@return void
@throws Zend_Db_Adapter_Oracle_Exception | [
"Roll",
"back",
"a",
"transaction",
"and",
"return",
"to",
"autocommit",
"mode",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Adapter/Oracle.php#L483-L493 | train | Rollback the connection | [
30522,
5123,
3853,
1035,
4897,
5963,
1006,
1007,
1063,
2065,
1006,
999,
1051,
6895,
1035,
4897,
5963,
1006,
1002,
2023,
1011,
1028,
1035,
4434,
1007,
1007,
1063,
1013,
1008,
1008,
1008,
1030,
2156,
16729,
2094,
1035,
16962,
1035,
15581,
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 | libs/Zend/Mail/Storage/Pop3.php | Zend_Mail_Storage_Pop3.getRawHeader | public function getRawHeader($id, $part = null, $topLines = 0)
{
if ($part !== null) {
// TODO: implement
/**
* @see Zend_Mail_Storage_Exception
*/
// require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('not implemented');
}
return $this->_protocol->top($id, 0, true);
} | php | public function getRawHeader($id, $part = null, $topLines = 0)
{
if ($part !== null) {
// TODO: implement
/**
* @see Zend_Mail_Storage_Exception
*/
// require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('not implemented');
}
return $this->_protocol->top($id, 0, true);
} | [
"public",
"function",
"getRawHeader",
"(",
"$",
"id",
",",
"$",
"part",
"=",
"null",
",",
"$",
"topLines",
"=",
"0",
")",
"{",
"if",
"(",
"$",
"part",
"!==",
"null",
")",
"{",
"// TODO: implement",
"/**\n * @see Zend_Mail_Storage_Exception\n ... | /*
Get raw header of message or part
@param int $id number of message
@param null|array|string $part path to part or null for messsage header
@param int $topLines include this many lines with header (after an empty line)
@return string raw header
@throws Zend_Mail_Protocol_Exception
@throws Zend_Mail_Storage_Exception | [
"/",
"*",
"Get",
"raw",
"header",
"of",
"message",
"or",
"part"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Mail/Storage/Pop3.php#L108-L120 | train | Get raw header | [
30522,
2270,
3853,
2131,
2527,
2860,
4974,
2121,
1006,
1002,
8909,
1010,
1002,
2112,
1027,
19701,
1010,
1002,
2327,
12735,
1027,
1014,
1007,
1063,
2065,
1006,
1002,
2112,
999,
1027,
1027,
19701,
1007,
1063,
1013,
1013,
28681,
2080,
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/Mailer/Transport/Smtp/Auth/LoginAuthenticator.php | LoginAuthenticator.authenticate | public function authenticate(EsmtpTransport $client): void
{
$client->executeCommand("AUTH LOGIN\r\n", [334]);
$client->executeCommand(sprintf("%s\r\n", base64_encode($client->getUsername())), [334]);
$client->executeCommand(sprintf("%s\r\n", base64_encode($client->getPassword())), [235]);
} | php | public function authenticate(EsmtpTransport $client): void
{
$client->executeCommand("AUTH LOGIN\r\n", [334]);
$client->executeCommand(sprintf("%s\r\n", base64_encode($client->getUsername())), [334]);
$client->executeCommand(sprintf("%s\r\n", base64_encode($client->getPassword())), [235]);
} | [
"public",
"function",
"authenticate",
"(",
"EsmtpTransport",
"$",
"client",
")",
":",
"void",
"{",
"$",
"client",
"->",
"executeCommand",
"(",
"\"AUTH LOGIN\\r\\n\"",
",",
"[",
"334",
"]",
")",
";",
"$",
"client",
"->",
"executeCommand",
"(",
"sprintf",
"(",... | {@inheritdoc}
@see https://www.ietf.org/rfc/rfc4954.txt | [
"{",
"@inheritdoc",
"}"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Mailer/Transport/Smtp/Auth/LoginAuthenticator.php#L35-L40 | train | Authenticates the user using the LOGIN command. | [
30522,
2270,
3853,
14469,
3686,
1006,
9686,
20492,
13876,
5521,
20205,
1002,
7396,
1007,
1024,
11675,
1063,
1002,
7396,
1011,
1028,
15389,
9006,
2386,
2094,
1006,
1000,
8740,
2705,
8833,
2378,
1032,
1054,
1032,
1050,
1000,
1010,
1031,
29562... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getgrav/grav | system/src/Grav/Common/Data/Blueprints.php | Blueprints.loadFile | protected function loadFile($name)
{
$blueprint = new Blueprint($name);
if (\is_array($this->search) || \is_object($this->search)) {
// Page types.
$blueprint->setOverrides($this->search);
$blueprint->setContext('blueprints://pages');
} else {
$blueprint->setContext($this->search);
}
return $blueprint->load()->init();
} | php | protected function loadFile($name)
{
$blueprint = new Blueprint($name);
if (\is_array($this->search) || \is_object($this->search)) {
// Page types.
$blueprint->setOverrides($this->search);
$blueprint->setContext('blueprints://pages');
} else {
$blueprint->setContext($this->search);
}
return $blueprint->load()->init();
} | [
"protected",
"function",
"loadFile",
"(",
"$",
"name",
")",
"{",
"$",
"blueprint",
"=",
"new",
"Blueprint",
"(",
"$",
"name",
")",
";",
"if",
"(",
"\\",
"is_array",
"(",
"$",
"this",
"->",
"search",
")",
"||",
"\\",
"is_object",
"(",
"$",
"this",
"... | Load blueprint file.
@param string $name Name of the blueprint.
@return Blueprint | [
"Load",
"blueprint",
"file",
"."
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Data/Blueprints.php#L90-L103 | train | Load blueprints. | [
30522,
5123,
3853,
7170,
8873,
2571,
1006,
1002,
2171,
1007,
1063,
1002,
2630,
16550,
1027,
2047,
2630,
16550,
1006,
1002,
2171,
1007,
1025,
2065,
1006,
1032,
2003,
1035,
9140,
1006,
1002,
2023,
1011,
1028,
3945,
1007,
1064,
1064,
1032,
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 | plugins/SitesManager/SitesManager.php | SitesManager.getTrackerExcludedQueryParameters | public static function getTrackerExcludedQueryParameters($website)
{
$excludedQueryParameters = $website['excluded_parameters'];
$globalExcludedQueryParameters = API::getInstance()->getExcludedQueryParametersGlobal();
$excludedQueryParameters .= ',' . $globalExcludedQueryParameters;
return self::filterBlankFromCommaSepList($excludedQueryParameters);
} | php | public static function getTrackerExcludedQueryParameters($website)
{
$excludedQueryParameters = $website['excluded_parameters'];
$globalExcludedQueryParameters = API::getInstance()->getExcludedQueryParametersGlobal();
$excludedQueryParameters .= ',' . $globalExcludedQueryParameters;
return self::filterBlankFromCommaSepList($excludedQueryParameters);
} | [
"public",
"static",
"function",
"getTrackerExcludedQueryParameters",
"(",
"$",
"website",
")",
"{",
"$",
"excludedQueryParameters",
"=",
"$",
"website",
"[",
"'excluded_parameters'",
"]",
";",
"$",
"globalExcludedQueryParameters",
"=",
"API",
"::",
"getInstance",
"(",... | Returns the array of URL query parameters to exclude from URLs
@param array $website
@return array | [
"Returns",
"the",
"array",
"of",
"URL",
"query",
"parameters",
"to",
"exclude",
"from",
"URLs"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/SitesManager/SitesManager.php#L272-L279 | train | Returns the list of excluded query parameters for the website | [
30522,
2270,
10763,
3853,
2131,
6494,
9102,
10288,
20464,
13936,
4226,
2854,
28689,
22828,
2015,
1006,
1002,
4037,
1007,
1063,
1002,
12421,
4226,
2854,
28689,
22828,
2015,
1027,
1002,
4037,
1031,
1005,
12421,
1035,
11709,
1005,
1033,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
guzzle/guzzle | src/Exception/RequestException.php | RequestException.obfuscateUri | private static function obfuscateUri($uri)
{
$userInfo = $uri->getUserInfo();
if (false !== ($pos = strpos($userInfo, ':'))) {
return $uri->withUserInfo(substr($userInfo, 0, $pos), '***');
}
return $uri;
} | php | private static function obfuscateUri($uri)
{
$userInfo = $uri->getUserInfo();
if (false !== ($pos = strpos($userInfo, ':'))) {
return $uri->withUserInfo(substr($userInfo, 0, $pos), '***');
}
return $uri;
} | [
"private",
"static",
"function",
"obfuscateUri",
"(",
"$",
"uri",
")",
"{",
"$",
"userInfo",
"=",
"$",
"uri",
"->",
"getUserInfo",
"(",
")",
";",
"if",
"(",
"false",
"!==",
"(",
"$",
"pos",
"=",
"strpos",
"(",
"$",
"userInfo",
",",
"':'",
")",
")",... | Obfuscates URI if there is an username and a password present
@param UriInterface $uri
@return UriInterface | [
"Obfuscates",
"URI",
"if",
"there",
"is",
"an",
"username",
"and",
"a",
"password",
"present"
] | bf595424e4d442a190582e088985dc835a789071 | https://github.com/guzzle/guzzle/blob/bf595424e4d442a190582e088985dc835a789071/src/Exception/RequestException.php#L162-L171 | train | Obfuscates the URI | [
30522,
2797,
10763,
3853,
27885,
25608,
16280,
9496,
1006,
1002,
24471,
2072,
1007,
1063,
1002,
5310,
2378,
14876,
1027,
1002,
24471,
2072,
1011,
1028,
2131,
20330,
2378,
14876,
1006,
1007,
1025,
2065,
1006,
6270,
999,
1027,
1027,
1006,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getgrav/grav | system/src/Grav/Common/Assets/Traits/AssetUtilsTrait.php | AssetUtilsTrait.renderQueryString | protected function renderQueryString($asset = null)
{
$querystring = '';
$asset = $asset ?? $this->asset;
if (!empty($this->query)) {
if (Utils::contains($asset, '?')) {
$querystring .= '&' . $this->query;
} else {
$querystring .= '?' . $this->query;
}
}
if ($this->timestamp) {
if (Utils::contains($asset, '?') || $querystring) {
$querystring .= '&' . $this->timestamp;
} else {
$querystring .= '?' . $this->timestamp;
}
}
return $querystring;
} | php | protected function renderQueryString($asset = null)
{
$querystring = '';
$asset = $asset ?? $this->asset;
if (!empty($this->query)) {
if (Utils::contains($asset, '?')) {
$querystring .= '&' . $this->query;
} else {
$querystring .= '?' . $this->query;
}
}
if ($this->timestamp) {
if (Utils::contains($asset, '?') || $querystring) {
$querystring .= '&' . $this->timestamp;
} else {
$querystring .= '?' . $this->timestamp;
}
}
return $querystring;
} | [
"protected",
"function",
"renderQueryString",
"(",
"$",
"asset",
"=",
"null",
")",
"{",
"$",
"querystring",
"=",
"''",
";",
"$",
"asset",
"=",
"$",
"asset",
"??",
"$",
"this",
"->",
"asset",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"qu... | Render Querystring
@param string $asset
@return string | [
"Render",
"Querystring"
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Assets/Traits/AssetUtilsTrait.php#L158-L181 | train | Render Query String | [
30522,
5123,
3853,
17552,
4226,
24769,
18886,
3070,
1006,
1002,
11412,
1027,
19701,
1007,
1063,
1002,
23032,
3367,
4892,
1027,
1005,
1005,
1025,
1002,
11412,
1027,
1002,
11412,
1029,
1029,
1002,
2023,
1011,
1028,
11412,
1025,
2065,
1006,
99... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
overtrue/wechat | src/OfficialAccount/Comment/Client.php | Client.markElect | public function markElect(string $msgId, int $index, int $commentId)
{
$params = [
'msg_data_id' => $msgId,
'index' => $index,
'user_comment_id' => $commentId,
];
return $this->httpPostJson('cgi-bin/comment/markelect', $params);
} | php | public function markElect(string $msgId, int $index, int $commentId)
{
$params = [
'msg_data_id' => $msgId,
'index' => $index,
'user_comment_id' => $commentId,
];
return $this->httpPostJson('cgi-bin/comment/markelect', $params);
} | [
"public",
"function",
"markElect",
"(",
"string",
"$",
"msgId",
",",
"int",
"$",
"index",
",",
"int",
"$",
"commentId",
")",
"{",
"$",
"params",
"=",
"[",
"'msg_data_id'",
"=>",
"$",
"msgId",
",",
"'index'",
"=>",
"$",
"index",
",",
"'user_comment_id'",
... | Mark elect comment.
@param string $msgId
@param int $index
@param int $commentId
@return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string | [
"Mark",
"elect",
"comment",
"."
] | 120c72faaa93c270365bc75c73c362d5fd583209 | https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/OfficialAccount/Comment/Client.php#L92-L101 | train | MarkElect a comment | [
30522,
2270,
3853,
2928,
12260,
6593,
1006,
5164,
1002,
5796,
5856,
2094,
1010,
20014,
1002,
5950,
1010,
20014,
1002,
7615,
3593,
1007,
1063,
1002,
11498,
5244,
1027,
1031,
1005,
5796,
2290,
1035,
2951,
1035,
8909,
1005,
1027,
1028,
1002,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Cache/Traits/ApcuTrait.php | ApcuTrait.doSave | protected function doSave(array $values, $lifetime)
{
try {
if (false === $failures = apcu_store($values, null, $lifetime)) {
$failures = $values;
}
return array_keys($failures);
} catch (\Throwable $e) {
if (1 === \count($values)) {
// Workaround https://github.com/krakjoe/apcu/issues/170
apcu_delete(key($values));
}
throw $e;
}
} | php | protected function doSave(array $values, $lifetime)
{
try {
if (false === $failures = apcu_store($values, null, $lifetime)) {
$failures = $values;
}
return array_keys($failures);
} catch (\Throwable $e) {
if (1 === \count($values)) {
// Workaround https://github.com/krakjoe/apcu/issues/170
apcu_delete(key($values));
}
throw $e;
}
} | [
"protected",
"function",
"doSave",
"(",
"array",
"$",
"values",
",",
"$",
"lifetime",
")",
"{",
"try",
"{",
"if",
"(",
"false",
"===",
"$",
"failures",
"=",
"apcu_store",
"(",
"$",
"values",
",",
"null",
",",
"$",
"lifetime",
")",
")",
"{",
"$",
"f... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Cache/Traits/ApcuTrait.php#L104-L120 | train | Save the values into the cache. | [
30522,
5123,
3853,
9998,
10696,
1006,
9140,
1002,
5300,
1010,
1002,
6480,
1007,
1063,
3046,
1063,
2065,
1006,
6270,
1027,
1027,
1027,
1002,
15428,
1027,
9706,
10841,
1035,
3573,
1006,
1002,
5300,
1010,
19701,
1010,
1002,
6480,
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/Mssql.php | Zend_Db_Adapter_Pdo_Mssql.lastInsertId | public function lastInsertId($tableName = null, $primaryKey = null)
{
$sql = 'SELECT SCOPE_IDENTITY()';
return (int)$this->fetchOne($sql);
} | php | public function lastInsertId($tableName = null, $primaryKey = null)
{
$sql = 'SELECT SCOPE_IDENTITY()';
return (int)$this->fetchOne($sql);
} | [
"public",
"function",
"lastInsertId",
"(",
"$",
"tableName",
"=",
"null",
",",
"$",
"primaryKey",
"=",
"null",
")",
"{",
"$",
"sql",
"=",
"'SELECT SCOPE_IDENTITY()'",
";",
"return",
"(",
"int",
")",
"$",
"this",
"->",
"fetchOne",
"(",
"$",
"sql",
")",
... | Gets the last ID generated automatically by an IDENTITY/AUTOINCREMENT column.
As a convention, on RDBMS brands that support sequences
(e.g. Oracle, PostgreSQL, DB2), this method forms the name of a sequence
from the arguments and returns the last id generated by that sequence.
On RDBMS brands that support IDENTITY/AUTOINCREMENT columns, this method
returns the last value generated for such a column, and the table name
argument is disregarded.
Microsoft SQL Server does not support sequences, so the arguments to
this method are ignored.
@param string $tableName OPTIONAL Name of table.
@param string $primaryKey OPTIONAL Name of primary key column.
@return string
@throws Zend_Db_Adapter_Exception | [
"Gets",
"the",
"last",
"ID",
"generated",
"automatically",
"by",
"an",
"IDENTITY",
"/",
"AUTOINCREMENT",
"column",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Adapter/Pdo/Mssql.php#L399-L403 | train | Returns last inserted ID | [
30522,
2270,
3853,
2197,
7076,
8743,
3593,
1006,
1002,
2795,
18442,
1027,
19701,
1010,
1002,
3078,
14839,
1027,
19701,
1007,
1063,
1002,
29296,
1027,
1005,
7276,
9531,
1035,
4767,
1006,
1007,
1005,
1025,
2709,
1006,
20014,
1007,
1002,
2023,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Support/ServiceProvider.php | ServiceProvider.publishes | protected function publishes(array $paths, $groups = null)
{
$this->ensurePublishArrayInitialized($class = static::class);
static::$publishes[$class] = array_merge(static::$publishes[$class], $paths);
if (! is_null($groups)) {
foreach ((array) $groups as $group) {
$this->addPublishGroup($group, $paths);
}
}
} | php | protected function publishes(array $paths, $groups = null)
{
$this->ensurePublishArrayInitialized($class = static::class);
static::$publishes[$class] = array_merge(static::$publishes[$class], $paths);
if (! is_null($groups)) {
foreach ((array) $groups as $group) {
$this->addPublishGroup($group, $paths);
}
}
} | [
"protected",
"function",
"publishes",
"(",
"array",
"$",
"paths",
",",
"$",
"groups",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"ensurePublishArrayInitialized",
"(",
"$",
"class",
"=",
"static",
"::",
"class",
")",
";",
"static",
"::",
"$",
"publishes",
... | Register paths to be published by the publish command.
@param array $paths
@param mixed $groups
@return void | [
"Register",
"paths",
"to",
"be",
"published",
"by",
"the",
"publish",
"command",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Support/ServiceProvider.php#L153-L164 | train | Add publish paths to the array | [
30522,
5123,
3853,
12466,
1006,
9140,
1002,
10425,
1010,
1002,
2967,
1027,
19701,
1007,
1063,
1002,
2023,
1011,
1028,
5676,
14289,
16558,
24032,
11335,
25811,
29050,
28931,
1006,
1002,
2465,
1027,
10763,
1024,
1024,
2465,
1007,
1025,
10763,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Measurable/MeasurableSetting.php | MeasurableSetting.isWritableByCurrentUser | public function isWritableByCurrentUser()
{
if (isset($this->hasWritePermission)) {
return $this->hasWritePermission;
}
// performance improvement, do not detect this in __construct otherwise likely rather "big" query to DB.
if ($this->hasSiteBeenCreated()) {
$this->hasWritePermission = Piwik::isUserHasAdminAccess($this->idSite);
} else {
$this->hasWritePermission = Piwik::hasUserSuperUserAccess();
}
return $this->hasWritePermission;
} | php | public function isWritableByCurrentUser()
{
if (isset($this->hasWritePermission)) {
return $this->hasWritePermission;
}
// performance improvement, do not detect this in __construct otherwise likely rather "big" query to DB.
if ($this->hasSiteBeenCreated()) {
$this->hasWritePermission = Piwik::isUserHasAdminAccess($this->idSite);
} else {
$this->hasWritePermission = Piwik::hasUserSuperUserAccess();
}
return $this->hasWritePermission;
} | [
"public",
"function",
"isWritableByCurrentUser",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"hasWritePermission",
")",
")",
"{",
"return",
"$",
"this",
"->",
"hasWritePermission",
";",
"}",
"// performance improvement, do not detect this in __construct... | Returns `true` if this setting can be displayed for the current user, `false` if otherwise.
@return bool | [
"Returns",
"true",
"if",
"this",
"setting",
"can",
"be",
"displayed",
"for",
"the",
"current",
"user",
"false",
"if",
"otherwise",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Settings/Measurable/MeasurableSetting.php#L52-L66 | train | Returns true if the user has write access to the current user. | [
30522,
2270,
3853,
2003,
13088,
6590,
3468,
3762,
10841,
14343,
3372,
20330,
1006,
1007,
1063,
2065,
1006,
26354,
3388,
1006,
1002,
2023,
1011,
1028,
2038,
30524,
2023,
1999,
1035,
1035,
9570,
4728,
3497,
2738,
1000,
2502,
1000,
23032,
2000... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Log/LogManager.php | LogManager.createSingleDriver | protected function createSingleDriver(array $config)
{
return new Monolog($this->parseChannel($config), [
$this->prepareHandler(
new StreamHandler(
$config['path'], $this->level($config),
$config['bubble'] ?? true, $config['permission'] ?? null, $config['locking'] ?? false
), $config
),
]);
} | php | protected function createSingleDriver(array $config)
{
return new Monolog($this->parseChannel($config), [
$this->prepareHandler(
new StreamHandler(
$config['path'], $this->level($config),
$config['bubble'] ?? true, $config['permission'] ?? null, $config['locking'] ?? false
), $config
),
]);
} | [
"protected",
"function",
"createSingleDriver",
"(",
"array",
"$",
"config",
")",
"{",
"return",
"new",
"Monolog",
"(",
"$",
"this",
"->",
"parseChannel",
"(",
"$",
"config",
")",
",",
"[",
"$",
"this",
"->",
"prepareHandler",
"(",
"new",
"StreamHandler",
"... | Create an instance of the single file log driver.
@param array $config
@return \Psr\Log\LoggerInterface | [
"Create",
"an",
"instance",
"of",
"the",
"single",
"file",
"log",
"driver",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Log/LogManager.php#L233-L243 | train | Create a single Monolog driver | [
30522,
5123,
3853,
9005,
2075,
3709,
24352,
1006,
9140,
1002,
9530,
8873,
2290,
1007,
1063,
2709,
2047,
18847,
21197,
1006,
1002,
2023,
1011,
1028,
11968,
3366,
26058,
1006,
1002,
9530,
8873,
2290,
1007,
1010,
1031,
1002,
2023,
1011,
1028,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Mail/Transport/ArrayTransport.php | ArrayTransport.send | public function send(Swift_Mime_SimpleMessage $message, &$failedRecipients = null)
{
$this->beforeSendPerformed($message);
$this->messages[] = $message;
return $this->numberOfRecipients($message);
} | php | public function send(Swift_Mime_SimpleMessage $message, &$failedRecipients = null)
{
$this->beforeSendPerformed($message);
$this->messages[] = $message;
return $this->numberOfRecipients($message);
} | [
"public",
"function",
"send",
"(",
"Swift_Mime_SimpleMessage",
"$",
"message",
",",
"&",
"$",
"failedRecipients",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"beforeSendPerformed",
"(",
"$",
"message",
")",
";",
"$",
"this",
"->",
"messages",
"[",
"]",
"=",
... | {@inheritdoc} | [
"{"
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Mail/Transport/ArrayTransport.php#L30-L37 | train | Send a Swift_Mime_SimpleMessage to the messagestore. | [
30522,
2270,
3853,
4604,
1006,
9170,
1035,
2771,
4168,
1035,
3722,
7834,
3736,
3351,
1002,
4471,
1010,
1004,
1002,
3478,
2890,
6895,
14756,
7666,
1027,
19701,
1007,
1063,
1002,
2023,
1011,
1028,
2077,
5054,
18927,
2121,
29021,
1006,
1002,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
z-song/laravel-admin | src/Layout/Column.php | Column.build | public function build()
{
$this->startColumn();
foreach ($this->contents as $content) {
if ($content instanceof Renderable || $content instanceof Grid) {
echo $content->render();
} else {
echo (string) $content;
}
}
$this->endColumn();
} | php | public function build()
{
$this->startColumn();
foreach ($this->contents as $content) {
if ($content instanceof Renderable || $content instanceof Grid) {
echo $content->render();
} else {
echo (string) $content;
}
}
$this->endColumn();
} | [
"public",
"function",
"build",
"(",
")",
"{",
"$",
"this",
"->",
"startColumn",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"contents",
"as",
"$",
"content",
")",
"{",
"if",
"(",
"$",
"content",
"instanceof",
"Renderable",
"||",
"$",
"content",
... | Build column html. | [
"Build",
"column",
"html",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Layout/Column.php#L94-L107 | train | Build the column | [
30522,
2270,
3853,
3857,
1006,
1007,
1063,
1002,
2023,
1011,
1028,
2707,
25778,
2819,
2078,
1006,
1007,
1025,
18921,
6776,
1006,
1002,
2023,
1011,
1028,
8417,
2004,
1002,
4180,
1007,
1063,
2065,
1006,
1002,
4180,
6013,
11253,
17552,
3085,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.dropAllViews | public function dropAllViews()
{
$this->connection->select($this->grammar->compileEnableWriteableSchema());
$this->connection->select($this->grammar->compileDropAllViews());
$this->connection->select($this->grammar->compileDisableWriteableSchema());
$this->connection->select($this->grammar->compileRebuild());
} | php | public function dropAllViews()
{
$this->connection->select($this->grammar->compileEnableWriteableSchema());
$this->connection->select($this->grammar->compileDropAllViews());
$this->connection->select($this->grammar->compileDisableWriteableSchema());
$this->connection->select($this->grammar->compileRebuild());
} | [
"public",
"function",
"dropAllViews",
"(",
")",
"{",
"$",
"this",
"->",
"connection",
"->",
"select",
"(",
"$",
"this",
"->",
"grammar",
"->",
"compileEnableWriteableSchema",
"(",
")",
")",
";",
"$",
"this",
"->",
"connection",
"->",
"select",
"(",
"$",
... | Drop all views from the database.
@return void | [
"Drop",
"all",
"views",
"from",
"the",
"database",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Schema/SQLiteBuilder.php#L32-L41 | train | Drop all views in the schema | [
30522,
2270,
3853,
4530,
8095,
8584,
2015,
1006,
1007,
1063,
1002,
2023,
1011,
1028,
4434,
1011,
1028,
7276,
1006,
1002,
2023,
1011,
1028,
8035,
1011,
1028,
4012,
22090,
8189,
3468,
26373,
3085,
22842,
2863,
1006,
1007,
1007,
1025,
1002,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Validation/Validator.php | Validator.getExplicitKeys | protected function getExplicitKeys($attribute)
{
$pattern = str_replace('\*', '([^\.]+)', preg_quote($this->getPrimaryAttribute($attribute), '/'));
if (preg_match('/^'.$pattern.'/', $attribute, $keys)) {
array_shift($keys);
return $keys;
}
return [];
} | php | protected function getExplicitKeys($attribute)
{
$pattern = str_replace('\*', '([^\.]+)', preg_quote($this->getPrimaryAttribute($attribute), '/'));
if (preg_match('/^'.$pattern.'/', $attribute, $keys)) {
array_shift($keys);
return $keys;
}
return [];
} | [
"protected",
"function",
"getExplicitKeys",
"(",
"$",
"attribute",
")",
"{",
"$",
"pattern",
"=",
"str_replace",
"(",
"'\\*'",
",",
"'([^\\.]+)'",
",",
"preg_quote",
"(",
"$",
"this",
"->",
"getPrimaryAttribute",
"(",
"$",
"attribute",
")",
",",
"'/'",
")",
... | Get the explicit keys from an attribute flattened with dot notation.
E.g. 'foo.1.bar.spark.baz' -> [1, 'spark'] for 'foo.*.bar.*.baz'
@param string $attribute
@return array | [
"Get",
"the",
"explicit",
"keys",
"from",
"an",
"attribute",
"flattened",
"with",
"dot",
"notation",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Validation/Validator.php#L422-L433 | train | Get explicit keys from the primary attribute | [
30522,
5123,
3853,
2131,
10288,
24759,
28775,
2102,
14839,
2015,
1006,
1002,
17961,
1007,
1063,
1002,
5418,
1027,
2358,
2099,
1035,
5672,
1006,
1005,
1032,
1008,
1005,
1010,
1005,
1006,
1031,
1034,
1032,
1012,
1033,
1009,
1007,
1005,
1010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
PHPMailer/PHPMailer | src/POP3.php | POP3.connect | public function connect($host, $port = false, $tval = 30)
{
// Are we already connected?
if ($this->connected) {
return true;
}
//On Windows this will raise a PHP Warning error if the hostname doesn't exist.
//Rather than suppress it with @fsockopen, capture it cleanly instead
set_error_handler([$this, 'catchWarning']);
if (false === $port) {
$port = static::DEFAULT_PORT;
}
// connect to the POP3 server
$this->pop_conn = fsockopen(
$host, // POP3 Host
$port, // Port #
$errno, // Error Number
$errstr, // Error Message
$tval
); // Timeout (seconds)
// Restore the error handler
restore_error_handler();
// Did we connect?
if (false === $this->pop_conn) {
// It would appear not...
$this->setError(
"Failed to connect to server $host on port $port. errno: $errno; errstr: $errstr"
);
return false;
}
// Increase the stream time-out
stream_set_timeout($this->pop_conn, $tval, 0);
// Get the POP3 server response
$pop3_response = $this->getResponse();
// Check for the +OK
if ($this->checkResponse($pop3_response)) {
// The connection is established and the POP3 server is talking
$this->connected = true;
return true;
}
return false;
} | php | public function connect($host, $port = false, $tval = 30)
{
// Are we already connected?
if ($this->connected) {
return true;
}
//On Windows this will raise a PHP Warning error if the hostname doesn't exist.
//Rather than suppress it with @fsockopen, capture it cleanly instead
set_error_handler([$this, 'catchWarning']);
if (false === $port) {
$port = static::DEFAULT_PORT;
}
// connect to the POP3 server
$this->pop_conn = fsockopen(
$host, // POP3 Host
$port, // Port #
$errno, // Error Number
$errstr, // Error Message
$tval
); // Timeout (seconds)
// Restore the error handler
restore_error_handler();
// Did we connect?
if (false === $this->pop_conn) {
// It would appear not...
$this->setError(
"Failed to connect to server $host on port $port. errno: $errno; errstr: $errstr"
);
return false;
}
// Increase the stream time-out
stream_set_timeout($this->pop_conn, $tval, 0);
// Get the POP3 server response
$pop3_response = $this->getResponse();
// Check for the +OK
if ($this->checkResponse($pop3_response)) {
// The connection is established and the POP3 server is talking
$this->connected = true;
return true;
}
return false;
} | [
"public",
"function",
"connect",
"(",
"$",
"host",
",",
"$",
"port",
"=",
"false",
",",
"$",
"tval",
"=",
"30",
")",
"{",
"// Are we already connected?",
"if",
"(",
"$",
"this",
"->",
"connected",
")",
"{",
"return",
"true",
";",
"}",
"//On Windows this... | Connect to a POP3 server.
@param string $host
@param int|bool $port
@param int $tval
@return bool | [
"Connect",
"to",
"a",
"POP3",
"server",
"."
] | 3d7132341659a8a201adbc3ba11b1e202ee2857c | https://github.com/PHPMailer/PHPMailer/blob/3d7132341659a8a201adbc3ba11b1e202ee2857c/src/POP3.php#L217-L267 | train | Connect to the POP3 server | [
30522,
2270,
3853,
7532,
1006,
1002,
3677,
1010,
1002,
3417,
1027,
6270,
1010,
1002,
2694,
2389,
1027,
2382,
1007,
1063,
1013,
1013,
2024,
2057,
2525,
4198,
1029,
2065,
1006,
1002,
2023,
1011,
1028,
4198,
1007,
1063,
2709,
2995,
1025,
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... |
z-song/laravel-admin | src/Form/Field/Radio.php | Radio.checked | public function checked($checked = [])
{
if ($checked instanceof Arrayable) {
$checked = $checked->toArray();
}
// input radio checked should be unique
$this->checked = is_array($checked) ? (array) end($checked) : (array) $checked;
return $this;
} | php | public function checked($checked = [])
{
if ($checked instanceof Arrayable) {
$checked = $checked->toArray();
}
// input radio checked should be unique
$this->checked = is_array($checked) ? (array) end($checked) : (array) $checked;
return $this;
} | [
"public",
"function",
"checked",
"(",
"$",
"checked",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"$",
"checked",
"instanceof",
"Arrayable",
")",
"{",
"$",
"checked",
"=",
"$",
"checked",
"->",
"toArray",
"(",
")",
";",
"}",
"// input radio checked should be uniqu... | Set checked.
@param array|callable|string $checked
@return $this | [
"Set",
"checked",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Form/Field/Radio.php#L45-L55 | train | Set checked input radio | [
30522,
2270,
3853,
7039,
1006,
1002,
7039,
1027,
1031,
1033,
1007,
1063,
2065,
1006,
1002,
7039,
6013,
11253,
9140,
3085,
1007,
1063,
1002,
7039,
1027,
1002,
7039,
1011,
1028,
2000,
2906,
9447,
1006,
1007,
1025,
1065,
1013,
1013,
7953,
25... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
z-song/laravel-admin | src/Grid/Displayers/Actions.php | Actions.disableView | public function disableView(bool $disable = true)
{
if ($disable) {
array_delete($this->actions, 'view');
} elseif (!in_array('view', $this->actions)) {
array_push($this->actions, 'view');
}
return $this;
} | php | public function disableView(bool $disable = true)
{
if ($disable) {
array_delete($this->actions, 'view');
} elseif (!in_array('view', $this->actions)) {
array_push($this->actions, 'view');
}
return $this;
} | [
"public",
"function",
"disableView",
"(",
"bool",
"$",
"disable",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"disable",
")",
"{",
"array_delete",
"(",
"$",
"this",
"->",
"actions",
",",
"'view'",
")",
";",
"}",
"elseif",
"(",
"!",
"in_array",
"(",
"'view... | Disable view action.
@return $this | [
"Disable",
"view",
"action",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid/Displayers/Actions.php#L74-L83 | train | Disable view actions | [
30522,
2270,
3853,
4487,
19150,
8584,
1006,
22017,
2140,
1002,
4487,
19150,
1027,
2995,
1007,
1063,
2065,
1006,
1002,
4487,
19150,
1007,
1063,
9140,
1035,
3972,
12870,
1006,
1002,
2023,
1011,
1028,
4506,
1010,
1005,
3193,
1005,
1007,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
z-song/laravel-admin | src/Form/Field/ImageField.php | ImageField.callInterventionMethods | public function callInterventionMethods($target)
{
if (!empty($this->interventionCalls)) {
$image = ImageManagerStatic::make($target);
foreach ($this->interventionCalls as $call) {
call_user_func_array(
[$image, $call['method']],
$call['arguments']
)->save($target);
}
}
return $target;
} | php | public function callInterventionMethods($target)
{
if (!empty($this->interventionCalls)) {
$image = ImageManagerStatic::make($target);
foreach ($this->interventionCalls as $call) {
call_user_func_array(
[$image, $call['method']],
$call['arguments']
)->save($target);
}
}
return $target;
} | [
"public",
"function",
"callInterventionMethods",
"(",
"$",
"target",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"interventionCalls",
")",
")",
"{",
"$",
"image",
"=",
"ImageManagerStatic",
"::",
"make",
"(",
"$",
"target",
")",
";",
"fore... | Execute Intervention calls.
@param string $target
@return mixed | [
"Execute",
"Intervention",
"calls",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Form/Field/ImageField.php#L33-L47 | train | Calls all intervention methods on the target | [
30522,
2270,
3853,
2655,
18447,
2121,
15338,
3258,
11368,
6806,
5104,
1006,
1002,
4539,
1007,
1063,
2065,
1006,
999,
4064,
1006,
1002,
2023,
1011,
1028,
8830,
9289,
4877,
1007,
1007,
1063,
1002,
3746,
1027,
3746,
24805,
15776,
29336,
2594,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Debug/DebugClassLoader.php | DebugClassLoader.getOwnInterfaces | private function getOwnInterfaces($class, $parent)
{
$ownInterfaces = class_implements($class, false);
if ($parent) {
foreach (class_implements($parent, false) as $interface) {
unset($ownInterfaces[$interface]);
}
}
foreach ($ownInterfaces as $interface) {
foreach (class_implements($interface) as $interface) {
unset($ownInterfaces[$interface]);
}
}
return $ownInterfaces;
} | php | private function getOwnInterfaces($class, $parent)
{
$ownInterfaces = class_implements($class, false);
if ($parent) {
foreach (class_implements($parent, false) as $interface) {
unset($ownInterfaces[$interface]);
}
}
foreach ($ownInterfaces as $interface) {
foreach (class_implements($interface) as $interface) {
unset($ownInterfaces[$interface]);
}
}
return $ownInterfaces;
} | [
"private",
"function",
"getOwnInterfaces",
"(",
"$",
"class",
",",
"$",
"parent",
")",
"{",
"$",
"ownInterfaces",
"=",
"class_implements",
"(",
"$",
"class",
",",
"false",
")",
";",
"if",
"(",
"$",
"parent",
")",
"{",
"foreach",
"(",
"class_implements",
... | `class_implements` includes interfaces from the parents so we have to manually exclude them.
@param string $class
@param string|false $parent
@return string[] | [
"class_implements",
"includes",
"interfaces",
"from",
"the",
"parents",
"so",
"we",
"have",
"to",
"manually",
"exclude",
"them",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Debug/DebugClassLoader.php#L507-L524 | train | Get all interfaces that the class implements | [
30522,
2797,
3853,
2131,
12384,
18447,
2121,
12172,
2015,
1006,
1002,
2465,
1010,
1002,
6687,
1007,
1063,
1002,
2219,
18447,
2121,
12172,
2015,
1027,
2465,
1035,
22164,
1006,
1002,
2465,
1010,
6270,
1007,
1025,
2065,
1006,
1002,
6687,
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/Validation/Concerns/ReplacesAttributes.php | ReplacesAttributes.replaceDifferent | protected function replaceDifferent($message, $attribute, $rule, $parameters)
{
return $this->replaceSame($message, $attribute, $rule, $parameters);
} | php | protected function replaceDifferent($message, $attribute, $rule, $parameters)
{
return $this->replaceSame($message, $attribute, $rule, $parameters);
} | [
"protected",
"function",
"replaceDifferent",
"(",
"$",
"message",
",",
"$",
"attribute",
",",
"$",
"rule",
",",
"$",
"parameters",
")",
"{",
"return",
"$",
"this",
"->",
"replaceSame",
"(",
"$",
"message",
",",
"$",
"attribute",
",",
"$",
"rule",
",",
... | Replace all place-holders for the different rule.
@param string $message
@param string $attribute
@param string $rule
@param array $parameters
@return string | [
"Replace",
"all",
"place",
"-",
"holders",
"for",
"the",
"different",
"rule",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Validation/Concerns/ReplacesAttributes.php#L46-L49 | train | Replace the messages for different attributes | [
30522,
5123,
3853,
2999,
13355,
7869,
3372,
1006,
1002,
4471,
1010,
1002,
17961,
1010,
1002,
3627,
1010,
1002,
11709,
1007,
1063,
2709,
1002,
2023,
1011,
1028,
20736,
14074,
1006,
1002,
4471,
1010,
1002,
17961,
1010,
1002,
3627,
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/Console/EventCacheCommand.php | EventCacheCommand.getEvents | protected function getEvents()
{
$events = [];
foreach ($this->laravel->getProviders(EventServiceProvider::class) as $provider) {
$providerEvents = array_merge($provider->discoverEvents(), $provider->listens());
$events = array_merge_recursive($events, $providerEvents);
}
return $events;
} | php | protected function getEvents()
{
$events = [];
foreach ($this->laravel->getProviders(EventServiceProvider::class) as $provider) {
$providerEvents = array_merge($provider->discoverEvents(), $provider->listens());
$events = array_merge_recursive($events, $providerEvents);
}
return $events;
} | [
"protected",
"function",
"getEvents",
"(",
")",
"{",
"$",
"events",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"laravel",
"->",
"getProviders",
"(",
"EventServiceProvider",
"::",
"class",
")",
"as",
"$",
"provider",
")",
"{",
"$",
"providerEv... | Get all of the events and listeners configured for the application.
@return array | [
"Get",
"all",
"of",
"the",
"events",
"and",
"listeners",
"configured",
"for",
"the",
"application",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Foundation/Console/EventCacheCommand.php#L46-L57 | train | Get all events from all event providers | [
30522,
5123,
3853,
2131,
18697,
7666,
1006,
1007,
1063,
1002,
2824,
1027,
1031,
1033,
1025,
18921,
6776,
1006,
1002,
2023,
1011,
1028,
13679,
15985,
1011,
1028,
2131,
21572,
17258,
2545,
1006,
2824,
2121,
7903,
13699,
12298,
18688,
1024,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getgrav/grav | system/src/Grav/Common/File/CompiledFile.php | CompiledFile.content | public function content($var = null)
{
try {
// If nothing has been loaded, attempt to get pre-compiled version of the file first.
if ($var === null && $this->raw === null && $this->content === null) {
$key = md5($this->filename);
$file = PhpFile::instance(CACHE_DIR . "compiled/files/{$key}{$this->extension}.php");
$modified = $this->modified();
if (!$modified) {
return $this->decode($this->raw());
}
$class = get_class($this);
$cache = $file->exists() ? $file->content() : null;
// Load real file if cache isn't up to date (or is invalid).
if (
!isset($cache['@class'])
|| $cache['@class'] !== $class
|| $cache['modified'] !== $modified
|| $cache['filename'] !== $this->filename
) {
// Attempt to lock the file for writing.
try {
$file->lock(false);
} catch (\Exception $e) {
// Another process has locked the file; we will check this in a bit.
}
// Decode RAW file into compiled array.
$data = (array)$this->decode($this->raw());
$cache = [
'@class' => $class,
'filename' => $this->filename,
'modified' => $modified,
'data' => $data
];
// If compiled file wasn't already locked by another process, save it.
if ($file->locked() !== false) {
$file->save($cache);
$file->unlock();
// Compile cached file into bytecode cache
if (function_exists('opcache_invalidate')) {
// Silence error if function exists, but is restricted.
@opcache_invalidate($file->filename(), true);
}
}
}
$file->free();
$this->content = $cache['data'];
}
} catch (\Exception $e) {
throw new \RuntimeException(sprintf('Failed to read %s: %s', basename($this->filename), $e->getMessage()), 500, $e);
}
return parent::content($var);
} | php | public function content($var = null)
{
try {
// If nothing has been loaded, attempt to get pre-compiled version of the file first.
if ($var === null && $this->raw === null && $this->content === null) {
$key = md5($this->filename);
$file = PhpFile::instance(CACHE_DIR . "compiled/files/{$key}{$this->extension}.php");
$modified = $this->modified();
if (!$modified) {
return $this->decode($this->raw());
}
$class = get_class($this);
$cache = $file->exists() ? $file->content() : null;
// Load real file if cache isn't up to date (or is invalid).
if (
!isset($cache['@class'])
|| $cache['@class'] !== $class
|| $cache['modified'] !== $modified
|| $cache['filename'] !== $this->filename
) {
// Attempt to lock the file for writing.
try {
$file->lock(false);
} catch (\Exception $e) {
// Another process has locked the file; we will check this in a bit.
}
// Decode RAW file into compiled array.
$data = (array)$this->decode($this->raw());
$cache = [
'@class' => $class,
'filename' => $this->filename,
'modified' => $modified,
'data' => $data
];
// If compiled file wasn't already locked by another process, save it.
if ($file->locked() !== false) {
$file->save($cache);
$file->unlock();
// Compile cached file into bytecode cache
if (function_exists('opcache_invalidate')) {
// Silence error if function exists, but is restricted.
@opcache_invalidate($file->filename(), true);
}
}
}
$file->free();
$this->content = $cache['data'];
}
} catch (\Exception $e) {
throw new \RuntimeException(sprintf('Failed to read %s: %s', basename($this->filename), $e->getMessage()), 500, $e);
}
return parent::content($var);
} | [
"public",
"function",
"content",
"(",
"$",
"var",
"=",
"null",
")",
"{",
"try",
"{",
"// If nothing has been loaded, attempt to get pre-compiled version of the file first.",
"if",
"(",
"$",
"var",
"===",
"null",
"&&",
"$",
"this",
"->",
"raw",
"===",
"null",
"&&",... | Get/set parsed file contents.
@param mixed $var
@return string | [
"Get",
"/",
"set",
"parsed",
"file",
"contents",
"."
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/File/CompiledFile.php#L22-L85 | train | Returns the compiled content of the file | [
30522,
2270,
3853,
4180,
1006,
1002,
13075,
1027,
19701,
1007,
1063,
3046,
1063,
1013,
1013,
2065,
2498,
2038,
2042,
8209,
1010,
3535,
2000,
2131,
3653,
1011,
9227,
2544,
1997,
1996,
5371,
2034,
1012,
2065,
1006,
1002,
13075,
1027,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Bundle/FrameworkBundle/Command/EventDispatcherDebugCommand.php | EventDispatcherDebugCommand.execute | protected function execute(InputInterface $input, OutputInterface $output)
{
$io = new SymfonyStyle($input, $output);
$options = [];
if ($event = $input->getArgument('event')) {
if (!$this->dispatcher->hasListeners($event)) {
$io->getErrorStyle()->warning(sprintf('The event "%s" does not have any registered listeners.', $event));
return;
}
$options = ['event' => $event];
}
$helper = new DescriptorHelper();
$options['format'] = $input->getOption('format');
$options['raw_text'] = $input->getOption('raw');
$options['output'] = $io;
$helper->describe($io, $this->dispatcher, $options);
} | php | protected function execute(InputInterface $input, OutputInterface $output)
{
$io = new SymfonyStyle($input, $output);
$options = [];
if ($event = $input->getArgument('event')) {
if (!$this->dispatcher->hasListeners($event)) {
$io->getErrorStyle()->warning(sprintf('The event "%s" does not have any registered listeners.', $event));
return;
}
$options = ['event' => $event];
}
$helper = new DescriptorHelper();
$options['format'] = $input->getOption('format');
$options['raw_text'] = $input->getOption('raw');
$options['output'] = $io;
$helper->describe($io, $this->dispatcher, $options);
} | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"$",
"io",
"=",
"new",
"SymfonyStyle",
"(",
"$",
"input",
",",
"$",
"output",
")",
";",
"$",
"options",
"=",
"[",
"]",
";",
"if",
... | {@inheritdoc}
@throws \LogicException | [
"{",
"@inheritdoc",
"}"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/FrameworkBundle/Command/EventDispatcherDebugCommand.php#L72-L92 | train | Describe the language | [
30522,
5123,
3853,
15389,
1006,
7953,
18447,
2121,
12172,
1002,
7953,
1010,
6434,
18447,
2121,
12172,
1002,
6434,
1007,
1063,
1002,
22834,
1027,
2047,
25353,
2213,
14876,
4890,
21756,
2571,
1006,
1002,
7953,
1010,
1002,
6434,
1007,
1025,
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... |
domnikl/DesignPatternsPHP | More/ServiceLocator/ServiceLocator.php | ServiceLocator.addInstance | public function addInstance(string $class, $service, bool $share = true)
{
$this->services[$class] = $service;
$this->instantiated[$class] = $service;
$this->shared[$class] = $share;
} | php | public function addInstance(string $class, $service, bool $share = true)
{
$this->services[$class] = $service;
$this->instantiated[$class] = $service;
$this->shared[$class] = $share;
} | [
"public",
"function",
"addInstance",
"(",
"string",
"$",
"class",
",",
"$",
"service",
",",
"bool",
"$",
"share",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"services",
"[",
"$",
"class",
"]",
"=",
"$",
"service",
";",
"$",
"this",
"->",
"instantiated... | instead of supplying a class here, you could also store a service for an interface
@param string $class
@param object $service
@param bool $share | [
"instead",
"of",
"supplying",
"a",
"class",
"here",
"you",
"could",
"also",
"store",
"a",
"service",
"for",
"an",
"interface"
] | 5f5649b57ea94471e20b54eb439c6368dea07886 | https://github.com/domnikl/DesignPatternsPHP/blob/5f5649b57ea94471e20b54eb439c6368dea07886/More/ServiceLocator/ServiceLocator.php#L29-L34 | train | Adds an instance of a class to the list of available services. | [
30522,
2270,
3853,
5587,
7076,
26897,
1006,
5164,
1002,
2465,
1010,
1002,
2326,
1010,
22017,
2140,
1002,
3745,
1027,
2995,
1007,
1063,
1002,
2023,
1011,
1028,
2578,
1031,
1002,
2465,
1033,
1027,
1002,
2326,
1025,
1002,
2023,
1011,
1028,
7... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/Archive.php | Archive.getNumeric | public function getNumeric($names)
{
$data = $this->get($names, 'numeric');
$resultIndices = $this->getResultIndices();
$result = $data->getIndexedArray($resultIndices);
// if only one metric is returned, just return it as a numeric value
if (empty($resultIndices)
&& count($result) <= 1
&& (!is_array($names) || count($names) == 1)
) {
$result = (float)reset($result); // convert to float in case $result is empty
}
return $result;
} | php | public function getNumeric($names)
{
$data = $this->get($names, 'numeric');
$resultIndices = $this->getResultIndices();
$result = $data->getIndexedArray($resultIndices);
// if only one metric is returned, just return it as a numeric value
if (empty($resultIndices)
&& count($result) <= 1
&& (!is_array($names) || count($names) == 1)
) {
$result = (float)reset($result); // convert to float in case $result is empty
}
return $result;
} | [
"public",
"function",
"getNumeric",
"(",
"$",
"names",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"get",
"(",
"$",
"names",
",",
"'numeric'",
")",
";",
"$",
"resultIndices",
"=",
"$",
"this",
"->",
"getResultIndices",
"(",
")",
";",
"$",
"result"... | Queries and returns metric data in an array.
If multiple sites were requested in {@link build()} or {@link factory()} the result will
be indexed by site ID.
If multiple periods were requested in {@link build()} or {@link factory()} the result will
be indexed by period.
The site ID index is always first, so if multiple sites & periods were requested, the result
will be indexed by site ID first, then period.
@param string|array $names One or more archive names, eg, `'nb_visits'`, `'Referrers_distinctKeywords'`,
etc.
@return false|integer|array `false` if there is no data to return, a single numeric value if we're not querying
for multiple sites/periods, or an array if multiple sites, periods or names are
queried for. | [
"Queries",
"and",
"returns",
"metric",
"data",
"in",
"an",
"array",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Archive.php#L262-L278 | train | Get numeric value from the cache | [
30522,
2270,
3853,
2131,
19172,
22420,
1006,
1002,
3415,
1007,
1063,
1002,
2951,
1027,
1002,
2023,
1011,
1028,
2131,
1006,
1002,
3415,
1010,
1005,
16371,
25531,
1005,
1007,
1025,
1002,
2765,
22254,
23522,
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... |
octobercms/october | modules/backend/ServiceProvider.php | ServiceProvider.register | public function register()
{
parent::register('backend');
$this->registerMailer();
$this->registerAssetBundles();
/*
* Backend specific
*/
if (App::runningInBackend()) {
$this->registerBackendNavigation();
$this->registerBackendReportWidgets();
$this->registerBackendWidgets();
$this->registerBackendPermissions();
$this->registerBackendSettings();
}
} | php | public function register()
{
parent::register('backend');
$this->registerMailer();
$this->registerAssetBundles();
/*
* Backend specific
*/
if (App::runningInBackend()) {
$this->registerBackendNavigation();
$this->registerBackendReportWidgets();
$this->registerBackendWidgets();
$this->registerBackendPermissions();
$this->registerBackendSettings();
}
} | [
"public",
"function",
"register",
"(",
")",
"{",
"parent",
"::",
"register",
"(",
"'backend'",
")",
";",
"$",
"this",
"->",
"registerMailer",
"(",
")",
";",
"$",
"this",
"->",
"registerAssetBundles",
"(",
")",
";",
"/*\n * Backend specific\n */",... | Register the service provider.
@return void | [
"Register",
"the",
"service",
"provider",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/ServiceProvider.php#L20-L37 | train | Register the backend specific | [
30522,
2270,
3853,
4236,
1006,
1007,
1063,
6687,
1024,
1024,
4236,
1006,
1005,
2067,
10497,
1005,
1007,
1025,
1002,
2023,
1011,
1028,
4236,
21397,
2121,
1006,
1007,
1025,
1002,
2023,
1011,
1028,
4236,
27241,
2102,
27265,
4244,
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... |
google/flatbuffers | php/ByteBuffer.php | ByteBuffer.readLittleEndian | public function readLittleEndian($offset, $count, $force_bigendian = false)
{
$this->assertOffsetAndLength($offset, $count);
$r = 0;
if (ByteBuffer::isLittleEndian() && $force_bigendian == false) {
for ($i = 0; $i < $count; $i++) {
$r |= ord($this->_buffer[$offset + $i]) << $i * 8;
}
} else {
for ($i = 0; $i < $count; $i++) {
$r |= ord($this->_buffer[$offset + $count -1 - $i]) << $i * 8;
}
}
return $r;
} | php | public function readLittleEndian($offset, $count, $force_bigendian = false)
{
$this->assertOffsetAndLength($offset, $count);
$r = 0;
if (ByteBuffer::isLittleEndian() && $force_bigendian == false) {
for ($i = 0; $i < $count; $i++) {
$r |= ord($this->_buffer[$offset + $i]) << $i * 8;
}
} else {
for ($i = 0; $i < $count; $i++) {
$r |= ord($this->_buffer[$offset + $count -1 - $i]) << $i * 8;
}
}
return $r;
} | [
"public",
"function",
"readLittleEndian",
"(",
"$",
"offset",
",",
"$",
"count",
",",
"$",
"force_bigendian",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"assertOffsetAndLength",
"(",
"$",
"offset",
",",
"$",
"count",
")",
";",
"$",
"r",
"=",
"0",
";",
... | read little endian value from the buffer
@param $offset
@param $count acutal size
@return int | [
"read",
"little",
"endian",
"value",
"from",
"the",
"buffer"
] | af74f87ccd6ea9bcf9e325427dca7c7faf1d79c1 | https://github.com/google/flatbuffers/blob/af74f87ccd6ea9bcf9e325427dca7c7faf1d79c1/php/ByteBuffer.php#L140-L156 | train | Reads an unsigned short integer from the buffer. | [
30522,
2270,
3853,
3191,
15909,
9286,
10497,
2937,
1006,
1002,
16396,
1010,
1002,
4175,
1010,
1002,
2486,
1035,
2502,
10497,
2937,
1027,
6270,
1007,
1063,
1002,
2023,
1011,
1028,
20865,
27475,
12928,
4859,
7770,
13512,
2232,
1006,
1002,
163... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Markdown/ParsedownGravTrait.php | ParsedownGravTrait.isBlockContinuable | protected function isBlockContinuable($Type)
{
$continuable = \in_array($Type, $this->continuable_blocks) || method_exists($this, 'block' . $Type . 'Continue');
return $continuable;
} | php | protected function isBlockContinuable($Type)
{
$continuable = \in_array($Type, $this->continuable_blocks) || method_exists($this, 'block' . $Type . 'Continue');
return $continuable;
} | [
"protected",
"function",
"isBlockContinuable",
"(",
"$",
"Type",
")",
"{",
"$",
"continuable",
"=",
"\\",
"in_array",
"(",
"$",
"Type",
",",
"$",
"this",
"->",
"continuable_blocks",
")",
"||",
"method_exists",
"(",
"$",
"this",
",",
"'block'",
".",
"$",
... | Overrides the default behavior to allow for plugin-provided blocks to be continuable
@param string $Type
@return bool | [
"Overrides",
"the",
"default",
"behavior",
"to",
"allow",
"for",
"plugin",
"-",
"provided",
"blocks",
"to",
"be",
"continuable"
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Markdown/ParsedownGravTrait.php#L115-L120 | train | Check if a block type is continued | [
30522,
5123,
3853,
2003,
23467,
8663,
7629,
6692,
3468,
1006,
1002,
2828,
1007,
1063,
1002,
9530,
7629,
6692,
3468,
1027,
1032,
1999,
1035,
9140,
1006,
1002,
2828,
1010,
1002,
2023,
1011,
1028,
9530,
7629,
6692,
3468,
1035,
5991,
1007,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Database/Eloquent/SoftDeletes.php | SoftDeletes.forceDelete | public function forceDelete()
{
$this->forceDeleting = true;
return tap($this->delete(), function ($deleted) {
$this->forceDeleting = false;
if ($deleted) {
$this->fireModelEvent('forceDeleted', false);
}
});
} | php | public function forceDelete()
{
$this->forceDeleting = true;
return tap($this->delete(), function ($deleted) {
$this->forceDeleting = false;
if ($deleted) {
$this->fireModelEvent('forceDeleted', false);
}
});
} | [
"public",
"function",
"forceDelete",
"(",
")",
"{",
"$",
"this",
"->",
"forceDeleting",
"=",
"true",
";",
"return",
"tap",
"(",
"$",
"this",
"->",
"delete",
"(",
")",
",",
"function",
"(",
"$",
"deleted",
")",
"{",
"$",
"this",
"->",
"forceDeleting",
... | Force a hard delete on a soft deleted model.
@return bool|null | [
"Force",
"a",
"hard",
"delete",
"on",
"a",
"soft",
"deleted",
"model",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/SoftDeletes.php#L45-L56 | train | Force delete the record. | [
30522,
2270,
3853,
3140,
12260,
2618,
1006,
1007,
1063,
1002,
2023,
1011,
1028,
3140,
12260,
3436,
1027,
2995,
1025,
2709,
11112,
1006,
1002,
2023,
1011,
1028,
3972,
12870,
1006,
1007,
1010,
3853,
1006,
1002,
17159,
1007,
1063,
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/HttpKernel/Controller/ArgumentResolver/VariadicValueResolver.php | VariadicValueResolver.supports | public function supports(Request $request, ArgumentMetadata $argument)
{
return $argument->isVariadic() && $request->attributes->has($argument->getName());
} | php | public function supports(Request $request, ArgumentMetadata $argument)
{
return $argument->isVariadic() && $request->attributes->has($argument->getName());
} | [
"public",
"function",
"supports",
"(",
"Request",
"$",
"request",
",",
"ArgumentMetadata",
"$",
"argument",
")",
"{",
"return",
"$",
"argument",
"->",
"isVariadic",
"(",
")",
"&&",
"$",
"request",
"->",
"attributes",
"->",
"has",
"(",
"$",
"argument",
"->"... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/VariadicValueResolver.php#L28-L31 | train | Returns true if the argument is a variadic argument. | [
30522,
2270,
3853,
6753,
1006,
5227,
1002,
5227,
1010,
6685,
11368,
8447,
2696,
1002,
6685,
1007,
1063,
2709,
1002,
6685,
1011,
1028,
2003,
10755,
28665,
2594,
1006,
1007,
1004,
1004,
1002,
5227,
1011,
1028,
12332,
1011,
1028,
2038,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/Zend/Db/Profiler.php | Zend_Db_Profiler.getQueryProfiles | public function getQueryProfiles($queryType = null, $showUnfinished = false)
{
$queryProfiles = array();
foreach ($this->_queryProfiles as $key => $qp) {
if ($queryType === null) {
$condition = true;
} else {
$condition = ($qp->getQueryType() & $queryType);
}
if (($qp->hasEnded() || $showUnfinished) && $condition) {
$queryProfiles[$key] = $qp;
}
}
if (empty($queryProfiles)) {
$queryProfiles = false;
}
return $queryProfiles;
} | php | public function getQueryProfiles($queryType = null, $showUnfinished = false)
{
$queryProfiles = array();
foreach ($this->_queryProfiles as $key => $qp) {
if ($queryType === null) {
$condition = true;
} else {
$condition = ($qp->getQueryType() & $queryType);
}
if (($qp->hasEnded() || $showUnfinished) && $condition) {
$queryProfiles[$key] = $qp;
}
}
if (empty($queryProfiles)) {
$queryProfiles = false;
}
return $queryProfiles;
} | [
"public",
"function",
"getQueryProfiles",
"(",
"$",
"queryType",
"=",
"null",
",",
"$",
"showUnfinished",
"=",
"false",
")",
"{",
"$",
"queryProfiles",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"_queryProfiles",
"as",
"$",
"key",
"=... | Get an array of query profiles (Zend_Db_Profiler_Query objects). If $queryType
is set to one of the Zend_Db_Profiler::* constants then only queries of that
type will be returned. Normally, queries that have not yet ended will
not be returned unless $showUnfinished is set to True. If no
queries were found, False is returned. The returned array is indexed by the query
profile handles.
@param integer $queryType
@param boolean $showUnfinished
@return array|false | [
"Get",
"an",
"array",
"of",
"query",
"profiles",
"(",
"Zend_Db_Profiler_Query",
"objects",
")",
".",
"If",
"$queryType",
"is",
"set",
"to",
"one",
"of",
"the",
"Zend_Db_Profiler",
"::",
"*",
"constants",
"then",
"only",
"queries",
"of",
"that",
"type",
"will... | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Profiler.php#L381-L401 | train | Get Query Profiles | [
30522,
2270,
3853,
2131,
4226,
2854,
21572,
8873,
4244,
1006,
1002,
23032,
13874,
1027,
19701,
1010,
1002,
2265,
4609,
16294,
13295,
1027,
6270,
1007,
1063,
1002,
23032,
21572,
8873,
4244,
1027,
9140,
1006,
1007,
1025,
18921,
6776,
1006,
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... |
overtrue/wechat | src/Kernel/Log/LogManager.php | LogManager.createDailyDriver | protected function createDailyDriver(array $config)
{
return new Monolog($this->parseChannel($config), [
$this->prepareHandler(new RotatingFileHandler(
$config['path'], $config['days'] ?? 7, $this->level($config)
)),
]);
} | php | protected function createDailyDriver(array $config)
{
return new Monolog($this->parseChannel($config), [
$this->prepareHandler(new RotatingFileHandler(
$config['path'], $config['days'] ?? 7, $this->level($config)
)),
]);
} | [
"protected",
"function",
"createDailyDriver",
"(",
"array",
"$",
"config",
")",
"{",
"return",
"new",
"Monolog",
"(",
"$",
"this",
"->",
"parseChannel",
"(",
"$",
"config",
")",
",",
"[",
"$",
"this",
"->",
"prepareHandler",
"(",
"new",
"RotatingFileHandler"... | Create an instance of the daily file log driver.
@param array $config
@return \Psr\Log\LoggerInterface | [
"Create",
"an",
"instance",
"of",
"the",
"daily",
"file",
"log",
"driver",
"."
] | 120c72faaa93c270365bc75c73c362d5fd583209 | https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/Kernel/Log/LogManager.php#L231-L238 | train | Create daily log driver | [
30522,
5123,
3853,
2580,
12502,
25688,
24352,
1006,
9140,
1002,
9530,
8873,
2290,
1007,
1063,
2709,
2047,
18847,
21197,
1006,
1002,
2023,
1011,
1028,
11968,
3366,
26058,
1006,
1002,
9530,
8873,
2290,
1007,
1010,
1031,
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/Serializer/Encoder/JsonEncode.php | JsonEncode.encode | public function encode($data, $format, array $context = [])
{
$jsonEncodeOptions = $context[self::OPTIONS] ?? $this->defaultContext[self::OPTIONS];
$encodedJson = json_encode($data, $jsonEncodeOptions);
if (JSON_ERROR_NONE !== json_last_error() && (false === $encodedJson || !($jsonEncodeOptions & JSON_PARTIAL_OUTPUT_ON_ERROR))) {
throw new NotEncodableValueException(json_last_error_msg());
}
return $encodedJson;
} | php | public function encode($data, $format, array $context = [])
{
$jsonEncodeOptions = $context[self::OPTIONS] ?? $this->defaultContext[self::OPTIONS];
$encodedJson = json_encode($data, $jsonEncodeOptions);
if (JSON_ERROR_NONE !== json_last_error() && (false === $encodedJson || !($jsonEncodeOptions & JSON_PARTIAL_OUTPUT_ON_ERROR))) {
throw new NotEncodableValueException(json_last_error_msg());
}
return $encodedJson;
} | [
"public",
"function",
"encode",
"(",
"$",
"data",
",",
"$",
"format",
",",
"array",
"$",
"context",
"=",
"[",
"]",
")",
"{",
"$",
"jsonEncodeOptions",
"=",
"$",
"context",
"[",
"self",
"::",
"OPTIONS",
"]",
"??",
"$",
"this",
"->",
"defaultContext",
... | Encodes PHP data to a JSON string.
{@inheritdoc} | [
"Encodes",
"PHP",
"data",
"to",
"a",
"JSON",
"string",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Serializer/Encoder/JsonEncode.php#L48-L58 | train | Encodes the given data into JSON | [
30522,
2270,
3853,
4372,
16044,
1006,
1002,
2951,
1010,
1002,
4289,
1010,
9140,
1002,
6123,
1027,
1031,
1033,
1007,
1063,
1002,
1046,
3385,
2368,
16044,
7361,
9285,
1027,
1002,
6123,
1031,
2969,
1024,
1024,
7047,
1033,
1029,
1029,
1002,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Bridge/Doctrine/PropertyInfo/DoctrineExtractor.php | DoctrineExtractor.isAssociationNullable | private function isAssociationNullable(array $associationMapping): bool
{
if (isset($associationMapping['id']) && $associationMapping['id']) {
return false;
}
if (!isset($associationMapping['joinColumns'])) {
return true;
}
$joinColumns = $associationMapping['joinColumns'];
foreach ($joinColumns as $joinColumn) {
if (isset($joinColumn['nullable']) && !$joinColumn['nullable']) {
return false;
}
}
return true;
} | php | private function isAssociationNullable(array $associationMapping): bool
{
if (isset($associationMapping['id']) && $associationMapping['id']) {
return false;
}
if (!isset($associationMapping['joinColumns'])) {
return true;
}
$joinColumns = $associationMapping['joinColumns'];
foreach ($joinColumns as $joinColumn) {
if (isset($joinColumn['nullable']) && !$joinColumn['nullable']) {
return false;
}
}
return true;
} | [
"private",
"function",
"isAssociationNullable",
"(",
"array",
"$",
"associationMapping",
")",
":",
"bool",
"{",
"if",
"(",
"isset",
"(",
"$",
"associationMapping",
"[",
"'id'",
"]",
")",
"&&",
"$",
"associationMapping",
"[",
"'id'",
"]",
")",
"{",
"return",
... | Determines whether an association is nullable.
@see https://github.com/doctrine/doctrine2/blob/v2.5.4/lib/Doctrine/ORM/Tools/EntityGenerator.php#L1221-L1246 | [
"Determines",
"whether",
"an",
"association",
"is",
"nullable",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bridge/Doctrine/PropertyInfo/DoctrineExtractor.php#L184-L202 | train | Checks if association is nullable | [
30522,
2797,
3853,
18061,
24137,
23247,
11231,
4571,
3468,
1006,
9140,
1002,
2523,
2863,
14853,
1007,
1024,
22017,
2140,
1063,
2065,
1006,
26354,
3388,
1006,
1002,
2523,
2863,
14853,
1031,
1005,
8909,
1005,
1033,
1007,
1004,
1004,
1002,
252... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Markdown/ParsedownGravTrait.php | ParsedownGravTrait.addInlineType | public function addInlineType($type, $tag, $index = null)
{
if (null === $index || !isset($this->InlineTypes[$type])) {
$this->InlineTypes[$type] [] = $tag;
} else {
array_splice($this->InlineTypes[$type], $index, 0, [$tag]);
}
if (strpos($this->inlineMarkerList, $type) === false) {
$this->inlineMarkerList .= $type;
}
} | php | public function addInlineType($type, $tag, $index = null)
{
if (null === $index || !isset($this->InlineTypes[$type])) {
$this->InlineTypes[$type] [] = $tag;
} else {
array_splice($this->InlineTypes[$type], $index, 0, [$tag]);
}
if (strpos($this->inlineMarkerList, $type) === false) {
$this->inlineMarkerList .= $type;
}
} | [
"public",
"function",
"addInlineType",
"(",
"$",
"type",
",",
"$",
"tag",
",",
"$",
"index",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"index",
"||",
"!",
"isset",
"(",
"$",
"this",
"->",
"InlineTypes",
"[",
"$",
"type",
"]",
")",
")"... | Be able to define a new Inline type or override an existing one
@param string $type
@param string $tag
@param int|null $index | [
"Be",
"able",
"to",
"define",
"a",
"new",
"Inline",
"type",
"or",
"override",
"an",
"existing",
"one"
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Markdown/ParsedownGravTrait.php#L95-L106 | train | Add an inline type to the list | [
30522,
2270,
3853,
5587,
2378,
4179,
13874,
1006,
1002,
2828,
1010,
1002,
6415,
1010,
1002,
5950,
1027,
19701,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
1027,
1002,
5950,
1064,
1064,
999,
26354,
3388,
1006,
1002,
2023,
1011,
1028,
23881,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.recordLastTransactionID | protected function recordLastTransactionID()
{
$reply = $this->getLastReply();
if (empty($reply)) {
$this->last_smtp_transaction_id = null;
} else {
$this->last_smtp_transaction_id = false;
foreach ($this->smtp_transaction_id_patterns as $smtp_transaction_id_pattern) {
if (preg_match($smtp_transaction_id_pattern, $reply, $matches)) {
$this->last_smtp_transaction_id = trim($matches[1]);
break;
}
}
}
return $this->last_smtp_transaction_id;
} | php | protected function recordLastTransactionID()
{
$reply = $this->getLastReply();
if (empty($reply)) {
$this->last_smtp_transaction_id = null;
} else {
$this->last_smtp_transaction_id = false;
foreach ($this->smtp_transaction_id_patterns as $smtp_transaction_id_pattern) {
if (preg_match($smtp_transaction_id_pattern, $reply, $matches)) {
$this->last_smtp_transaction_id = trim($matches[1]);
break;
}
}
}
return $this->last_smtp_transaction_id;
} | [
"protected",
"function",
"recordLastTransactionID",
"(",
")",
"{",
"$",
"reply",
"=",
"$",
"this",
"->",
"getLastReply",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"reply",
")",
")",
"{",
"$",
"this",
"->",
"last_smtp_transaction_id",
"=",
"null",
";",... | Extract and return the ID of the last SMTP transaction based on
a list of patterns provided in SMTP::$smtp_transaction_id_patterns.
Relies on the host providing the ID in response to a DATA command.
If no reply has been received yet, it will return null.
If no pattern was matched, it will return false.
@return bool|null|string | [
"Extract",
"and",
"return",
"the",
"ID",
"of",
"the",
"last",
"SMTP",
"transaction",
"based",
"on",
"a",
"list",
"of",
"patterns",
"provided",
"in",
"SMTP",
"::",
"$smtp_transaction_id_patterns",
".",
"Relies",
"on",
"the",
"host",
"providing",
"the",
"ID",
... | 3d7132341659a8a201adbc3ba11b1e202ee2857c | https://github.com/PHPMailer/PHPMailer/blob/3d7132341659a8a201adbc3ba11b1e202ee2857c/src/SMTP.php#L1315-L1332 | train | Get Last Smtp Transaction ID | [
30522,
5123,
3853,
2501,
8523,
4779,
5521,
3736,
7542,
3593,
1006,
1007,
1063,
1002,
7514,
1027,
1002,
2023,
1011,
1028,
2131,
8523,
7913,
22086,
1006,
1007,
1025,
2065,
1006,
4064,
1006,
1002,
7514,
1007,
1007,
1063,
1002,
2023,
1011,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Foundation/Console/ViewClearCommand.php | ViewClearCommand.handle | public function handle()
{
$path = $this->laravel['config']['view.compiled'];
if (! $path) {
throw new RuntimeException('View path not found.');
}
foreach ($this->files->glob("{$path}/*") as $view) {
$this->files->delete($view);
}
$this->info('Compiled views cleared!');
} | php | public function handle()
{
$path = $this->laravel['config']['view.compiled'];
if (! $path) {
throw new RuntimeException('View path not found.');
}
foreach ($this->files->glob("{$path}/*") as $view) {
$this->files->delete($view);
}
$this->info('Compiled views cleared!');
} | [
"public",
"function",
"handle",
"(",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"laravel",
"[",
"'config'",
"]",
"[",
"'view.compiled'",
"]",
";",
"if",
"(",
"!",
"$",
"path",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"'View path not found.'... | Execute the console command.
@return void
@throws \RuntimeException | [
"Execute",
"the",
"console",
"command",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Foundation/Console/ViewClearCommand.php#L52-L65 | train | Delete compiled views | [
30522,
2270,
3853,
5047,
1006,
1007,
1063,
1002,
4130,
1027,
1002,
2023,
1011,
1028,
13679,
15985,
1031,
1005,
9530,
8873,
2290,
1005,
1033,
1031,
1005,
3193,
1012,
9227,
1005,
1033,
1025,
2065,
1006,
999,
1002,
4130,
1007,
1063,
5466,
20... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Form/AbstractRendererEngine.php | AbstractRendererEngine.loadResourceForBlockNameHierarchy | private function loadResourceForBlockNameHierarchy($cacheKey, FormView $view, array $blockNameHierarchy, $hierarchyLevel)
{
$blockName = $blockNameHierarchy[$hierarchyLevel];
// Try to find a template for that block
if ($this->loadResourceForBlockName($cacheKey, $view, $blockName)) {
// If loadTemplateForBlock() returns true, it was able to populate the
// cache. The only missing thing is to set the hierarchy level at which
// the template was found.
$this->resourceHierarchyLevels[$cacheKey][$blockName] = $hierarchyLevel;
return true;
}
if ($hierarchyLevel > 0) {
$parentLevel = $hierarchyLevel - 1;
$parentBlockName = $blockNameHierarchy[$parentLevel];
// The next two if statements contain slightly duplicated code. This is by intention
// and tries to avoid execution of unnecessary checks in order to increase performance.
if (isset($this->resources[$cacheKey][$parentBlockName])) {
// It may happen that the parent block is already loaded, but its level is not.
// In this case, the parent block must have been loaded by loadResourceForBlock(),
// which does not check the hierarchy of the block. Subsequently the block must have
// been found directly on the parent level.
if (!isset($this->resourceHierarchyLevels[$cacheKey][$parentBlockName])) {
$this->resourceHierarchyLevels[$cacheKey][$parentBlockName] = $parentLevel;
}
// Cache the shortcuts for further accesses
$this->resources[$cacheKey][$blockName] = $this->resources[$cacheKey][$parentBlockName];
$this->resourceHierarchyLevels[$cacheKey][$blockName] = $this->resourceHierarchyLevels[$cacheKey][$parentBlockName];
return true;
}
if ($this->loadResourceForBlockNameHierarchy($cacheKey, $view, $blockNameHierarchy, $parentLevel)) {
// Cache the shortcuts for further accesses
$this->resources[$cacheKey][$blockName] = $this->resources[$cacheKey][$parentBlockName];
$this->resourceHierarchyLevels[$cacheKey][$blockName] = $this->resourceHierarchyLevels[$cacheKey][$parentBlockName];
return true;
}
}
// Cache the result for further accesses
$this->resources[$cacheKey][$blockName] = false;
$this->resourceHierarchyLevels[$cacheKey][$blockName] = false;
return false;
} | php | private function loadResourceForBlockNameHierarchy($cacheKey, FormView $view, array $blockNameHierarchy, $hierarchyLevel)
{
$blockName = $blockNameHierarchy[$hierarchyLevel];
// Try to find a template for that block
if ($this->loadResourceForBlockName($cacheKey, $view, $blockName)) {
// If loadTemplateForBlock() returns true, it was able to populate the
// cache. The only missing thing is to set the hierarchy level at which
// the template was found.
$this->resourceHierarchyLevels[$cacheKey][$blockName] = $hierarchyLevel;
return true;
}
if ($hierarchyLevel > 0) {
$parentLevel = $hierarchyLevel - 1;
$parentBlockName = $blockNameHierarchy[$parentLevel];
// The next two if statements contain slightly duplicated code. This is by intention
// and tries to avoid execution of unnecessary checks in order to increase performance.
if (isset($this->resources[$cacheKey][$parentBlockName])) {
// It may happen that the parent block is already loaded, but its level is not.
// In this case, the parent block must have been loaded by loadResourceForBlock(),
// which does not check the hierarchy of the block. Subsequently the block must have
// been found directly on the parent level.
if (!isset($this->resourceHierarchyLevels[$cacheKey][$parentBlockName])) {
$this->resourceHierarchyLevels[$cacheKey][$parentBlockName] = $parentLevel;
}
// Cache the shortcuts for further accesses
$this->resources[$cacheKey][$blockName] = $this->resources[$cacheKey][$parentBlockName];
$this->resourceHierarchyLevels[$cacheKey][$blockName] = $this->resourceHierarchyLevels[$cacheKey][$parentBlockName];
return true;
}
if ($this->loadResourceForBlockNameHierarchy($cacheKey, $view, $blockNameHierarchy, $parentLevel)) {
// Cache the shortcuts for further accesses
$this->resources[$cacheKey][$blockName] = $this->resources[$cacheKey][$parentBlockName];
$this->resourceHierarchyLevels[$cacheKey][$blockName] = $this->resourceHierarchyLevels[$cacheKey][$parentBlockName];
return true;
}
}
// Cache the result for further accesses
$this->resources[$cacheKey][$blockName] = false;
$this->resourceHierarchyLevels[$cacheKey][$blockName] = false;
return false;
} | [
"private",
"function",
"loadResourceForBlockNameHierarchy",
"(",
"$",
"cacheKey",
",",
"FormView",
"$",
"view",
",",
"array",
"$",
"blockNameHierarchy",
",",
"$",
"hierarchyLevel",
")",
"{",
"$",
"blockName",
"=",
"$",
"blockNameHierarchy",
"[",
"$",
"hierarchyLev... | Loads the cache with the resource for a specific level of a block hierarchy.
@see getResourceForBlockHierarchy()
@param string $cacheKey The cache key used for storing the
resource
@param FormView $view The form view for finding the applying
themes
@param string[] $blockNameHierarchy The block hierarchy, with the most
specific block name at the end
@param int $hierarchyLevel The level in the block hierarchy that
should be loaded
@return bool True if the resource could be loaded, false otherwise | [
"Loads",
"the",
"cache",
"with",
"the",
"resource",
"for",
"a",
"specific",
"level",
"of",
"a",
"block",
"hierarchy",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/AbstractRendererEngine.php#L141-L192 | train | Load the resource for the given block name hierarchy level | [
30522,
2797,
3853,
7170,
6072,
8162,
3401,
29278,
23467,
18442,
4048,
6906,
29389,
1006,
1002,
17053,
14839,
1010,
2433,
8584,
1002,
3193,
1010,
9140,
1002,
3796,
18442,
4048,
6906,
29389,
1010,
1002,
12571,
20414,
2884,
1007,
1063,
1002,
3... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/BrowserKit/Client.php | Client.request | public function request(string $method, string $uri, array $parameters = [], array $files = [], array $server = [], string $content = null, bool $changeHistory = true)
{
if ($this->isMainRequest) {
$this->redirectCount = 0;
} else {
++$this->redirectCount;
}
$originalUri = $uri;
$uri = $this->getAbsoluteUri($uri);
$server = array_merge($this->server, $server);
if (!empty($server['HTTP_HOST']) && null === parse_url($originalUri, PHP_URL_HOST)) {
$uri = preg_replace('{^(https?\://)'.preg_quote($this->extractHost($uri)).'}', '${1}'.$server['HTTP_HOST'], $uri);
}
if (isset($server['HTTPS']) && null === parse_url($originalUri, PHP_URL_SCHEME)) {
$uri = preg_replace('{^'.parse_url($uri, PHP_URL_SCHEME).'}', $server['HTTPS'] ? 'https' : 'http', $uri);
}
if (!$this->history->isEmpty()) {
$server['HTTP_REFERER'] = $this->history->current()->getUri();
}
if (empty($server['HTTP_HOST'])) {
$server['HTTP_HOST'] = $this->extractHost($uri);
}
$server['HTTPS'] = 'https' == parse_url($uri, PHP_URL_SCHEME);
$this->internalRequest = new Request($uri, $method, $parameters, $files, $this->cookieJar->allValues($uri), $server, $content);
$this->request = $this->filterRequest($this->internalRequest);
if (true === $changeHistory) {
$this->history->add($this->internalRequest);
}
if ($this->insulated) {
$this->response = $this->doRequestInProcess($this->request);
} else {
$this->response = $this->doRequest($this->request);
}
$this->internalResponse = $this->filterResponse($this->response);
$this->cookieJar->updateFromResponse($this->internalResponse, $uri);
$status = $this->internalResponse->getStatusCode();
if ($status >= 300 && $status < 400) {
$this->redirect = $this->internalResponse->getHeader('Location');
} else {
$this->redirect = null;
}
if ($this->followRedirects && $this->redirect) {
$this->redirects[serialize($this->history->current())] = true;
return $this->crawler = $this->followRedirect();
}
$this->crawler = $this->createCrawlerFromContent($this->internalRequest->getUri(), $this->internalResponse->getContent(), $this->internalResponse->getHeader('Content-Type'));
// Check for meta refresh redirect
if ($this->followMetaRefresh && null !== $redirect = $this->getMetaRefreshUrl()) {
$this->redirect = $redirect;
$this->redirects[serialize($this->history->current())] = true;
$this->crawler = $this->followRedirect();
}
return $this->crawler;
} | php | public function request(string $method, string $uri, array $parameters = [], array $files = [], array $server = [], string $content = null, bool $changeHistory = true)
{
if ($this->isMainRequest) {
$this->redirectCount = 0;
} else {
++$this->redirectCount;
}
$originalUri = $uri;
$uri = $this->getAbsoluteUri($uri);
$server = array_merge($this->server, $server);
if (!empty($server['HTTP_HOST']) && null === parse_url($originalUri, PHP_URL_HOST)) {
$uri = preg_replace('{^(https?\://)'.preg_quote($this->extractHost($uri)).'}', '${1}'.$server['HTTP_HOST'], $uri);
}
if (isset($server['HTTPS']) && null === parse_url($originalUri, PHP_URL_SCHEME)) {
$uri = preg_replace('{^'.parse_url($uri, PHP_URL_SCHEME).'}', $server['HTTPS'] ? 'https' : 'http', $uri);
}
if (!$this->history->isEmpty()) {
$server['HTTP_REFERER'] = $this->history->current()->getUri();
}
if (empty($server['HTTP_HOST'])) {
$server['HTTP_HOST'] = $this->extractHost($uri);
}
$server['HTTPS'] = 'https' == parse_url($uri, PHP_URL_SCHEME);
$this->internalRequest = new Request($uri, $method, $parameters, $files, $this->cookieJar->allValues($uri), $server, $content);
$this->request = $this->filterRequest($this->internalRequest);
if (true === $changeHistory) {
$this->history->add($this->internalRequest);
}
if ($this->insulated) {
$this->response = $this->doRequestInProcess($this->request);
} else {
$this->response = $this->doRequest($this->request);
}
$this->internalResponse = $this->filterResponse($this->response);
$this->cookieJar->updateFromResponse($this->internalResponse, $uri);
$status = $this->internalResponse->getStatusCode();
if ($status >= 300 && $status < 400) {
$this->redirect = $this->internalResponse->getHeader('Location');
} else {
$this->redirect = null;
}
if ($this->followRedirects && $this->redirect) {
$this->redirects[serialize($this->history->current())] = true;
return $this->crawler = $this->followRedirect();
}
$this->crawler = $this->createCrawlerFromContent($this->internalRequest->getUri(), $this->internalResponse->getContent(), $this->internalResponse->getHeader('Content-Type'));
// Check for meta refresh redirect
if ($this->followMetaRefresh && null !== $redirect = $this->getMetaRefreshUrl()) {
$this->redirect = $redirect;
$this->redirects[serialize($this->history->current())] = true;
$this->crawler = $this->followRedirect();
}
return $this->crawler;
} | [
"public",
"function",
"request",
"(",
"string",
"$",
"method",
",",
"string",
"$",
"uri",
",",
"array",
"$",
"parameters",
"=",
"[",
"]",
",",
"array",
"$",
"files",
"=",
"[",
"]",
",",
"array",
"$",
"server",
"=",
"[",
"]",
",",
"string",
"$",
"... | Calls a URI.
@param string $method The request method
@param string $uri The URI to fetch
@param array $parameters The Request parameters
@param array $files The files
@param array $server The server parameters (HTTP headers are referenced with a HTTP_ prefix as PHP does)
@param string $content The raw body data
@param bool $changeHistory Whether to update the history or not (only used internally for back(), forward(), and reload())
@return Crawler | [
"Calls",
"a",
"URI",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/BrowserKit/Client.php#L364-L438 | train | Perform a request | [
30522,
2270,
3853,
5227,
1006,
5164,
1002,
4118,
1010,
5164,
1002,
24471,
2072,
1010,
9140,
1002,
11709,
1027,
1031,
1033,
1010,
9140,
1002,
6764,
1027,
1031,
1033,
1010,
9140,
1002,
8241,
1027,
1031,
1033,
1010,
5164,
1002,
4180,
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... |
symfony/symfony | src/Symfony/Component/HttpFoundation/Request.php | Request.getRequestFormat | public function getRequestFormat($default = 'html')
{
if (null === $this->format) {
$this->format = $this->attributes->get('_format');
}
return null === $this->format ? $default : $this->format;
} | php | public function getRequestFormat($default = 'html')
{
if (null === $this->format) {
$this->format = $this->attributes->get('_format');
}
return null === $this->format ? $default : $this->format;
} | [
"public",
"function",
"getRequestFormat",
"(",
"$",
"default",
"=",
"'html'",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"format",
")",
"{",
"$",
"this",
"->",
"format",
"=",
"$",
"this",
"->",
"attributes",
"->",
"get",
"(",
"'_format'",
... | Gets the request format.
Here is the process to determine the format:
* format defined by the user (with setRequestFormat())
* _format request attribute
* $default
@param string|null $default The default format
@return string|null The request format | [
"Gets",
"the",
"request",
"format",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpFoundation/Request.php#L1350-L1357 | train | Get request format | [
30522,
2270,
3853,
2131,
2890,
15500,
14192,
4017,
1006,
1002,
12398,
1027,
1005,
16129,
1005,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
1027,
1002,
2023,
1011,
1028,
4289,
1007,
1063,
1002,
2023,
1011,
1028,
4289,
1027,
1002,
2023,
1011,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/CoreAdminHome/Commands/RunScheduledTasks.php | RunScheduledTasks.execute | protected function execute(InputInterface $input, OutputInterface $output)
{
$this->forceRunAllTasksIfRequested($input);
FrontController::getInstance()->init();
// TODO use dependency injection
/** @var Scheduler $scheduler */
$scheduler = StaticContainer::get('Piwik\Scheduler\Scheduler');
$task = $input->getArgument('task');
if ($task) {
$this->runSingleTask($scheduler, $task, $output);
} else {
$scheduler->run();
}
$this->writeSuccessMessage($output, array('Scheduled Tasks executed'));
} | php | protected function execute(InputInterface $input, OutputInterface $output)
{
$this->forceRunAllTasksIfRequested($input);
FrontController::getInstance()->init();
// TODO use dependency injection
/** @var Scheduler $scheduler */
$scheduler = StaticContainer::get('Piwik\Scheduler\Scheduler');
$task = $input->getArgument('task');
if ($task) {
$this->runSingleTask($scheduler, $task, $output);
} else {
$scheduler->run();
}
$this->writeSuccessMessage($output, array('Scheduled Tasks executed'));
} | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"$",
"this",
"->",
"forceRunAllTasksIfRequested",
"(",
"$",
"input",
")",
";",
"FrontController",
"::",
"getInstance",
"(",
")",
"->",
"in... | Execute command like: ./console core:run-scheduled-tasks | [
"Execute",
"command",
"like",
":",
".",
"/",
"console",
"core",
":",
"run",
"-",
"scheduled",
"-",
"tasks"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/CoreAdminHome/Commands/RunScheduledTasks.php#L35-L54 | train | Executes the scheduled tasks | [
30522,
5123,
3853,
15389,
1006,
7953,
18447,
2121,
12172,
1002,
7953,
1010,
6434,
18447,
2121,
12172,
1002,
6434,
1007,
1063,
1002,
2023,
1011,
1028,
2486,
26605,
3363,
10230,
5705,
10128,
2890,
15500,
2098,
1006,
1002,
7953,
1007,
1025,
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... |
z-song/laravel-admin | src/Console/ExtendCommand.php | ExtendCommand.copy | protected function copy($from, $to = null)
{
if (is_array($from) && is_null($to)) {
foreach ($from as $key => $value) {
$this->copy($key, $value);
}
return;
}
if (!file_exists($from)) {
return;
}
$to = $this->extensionPath($to);
$this->filesystem->copy($from, $to);
} | php | protected function copy($from, $to = null)
{
if (is_array($from) && is_null($to)) {
foreach ($from as $key => $value) {
$this->copy($key, $value);
}
return;
}
if (!file_exists($from)) {
return;
}
$to = $this->extensionPath($to);
$this->filesystem->copy($from, $to);
} | [
"protected",
"function",
"copy",
"(",
"$",
"from",
",",
"$",
"to",
"=",
"null",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"from",
")",
"&&",
"is_null",
"(",
"$",
"to",
")",
")",
"{",
"foreach",
"(",
"$",
"from",
"as",
"$",
"key",
"=>",
"$",
... | Copy files to extension path.
@param string|array $from
@param string|null $to | [
"Copy",
"files",
"to",
"extension",
"path",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Console/ExtendCommand.php#L277-L294 | train | Copy file from one directory to another | [
30522,
5123,
3853,
6100,
1006,
1002,
2013,
1010,
1002,
2000,
1027,
19701,
1007,
1063,
2065,
1006,
2003,
1035,
9140,
1006,
1002,
2013,
1007,
1004,
1004,
2003,
1035,
19701,
1006,
1002,
2000,
1007,
1007,
1063,
18921,
6776,
1006,
1002,
2013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spatie/laravel-permission | src/Models/Permission.php | Permission.findById | public static function findById(int $id, $guardName = null): PermissionContract
{
$guardName = $guardName ?? Guard::getDefaultName(static::class);
$permission = static::getPermissions(['id' => $id, 'guard_name' => $guardName])->first();
if (! $permission) {
throw PermissionDoesNotExist::withId($id, $guardName);
}
return $permission;
} | php | public static function findById(int $id, $guardName = null): PermissionContract
{
$guardName = $guardName ?? Guard::getDefaultName(static::class);
$permission = static::getPermissions(['id' => $id, 'guard_name' => $guardName])->first();
if (! $permission) {
throw PermissionDoesNotExist::withId($id, $guardName);
}
return $permission;
} | [
"public",
"static",
"function",
"findById",
"(",
"int",
"$",
"id",
",",
"$",
"guardName",
"=",
"null",
")",
":",
"PermissionContract",
"{",
"$",
"guardName",
"=",
"$",
"guardName",
"??",
"Guard",
"::",
"getDefaultName",
"(",
"static",
"::",
"class",
")",
... | Find a permission by its id (and optionally guardName).
@param int $id
@param string|null $guardName
@throws \Spatie\Permission\Exceptions\PermissionDoesNotExist
@return \Spatie\Permission\Contracts\Permission | [
"Find",
"a",
"permission",
"by",
"its",
"id",
"(",
"and",
"optionally",
"guardName",
")",
"."
] | 81dbe9d372d70c255b66a2727a235076509f8d45 | https://github.com/spatie/laravel-permission/blob/81dbe9d372d70c255b66a2727a235076509f8d45/src/Models/Permission.php#L108-L118 | train | Find a permission by its ID and guard name. | [
30522,
2270,
10763,
3853,
2424,
3762,
3593,
1006,
20014,
1002,
8909,
1010,
1002,
3457,
18442,
1027,
19701,
1007,
1024,
6656,
8663,
6494,
6593,
1063,
1002,
3457,
18442,
1027,
1002,
3457,
18442,
1029,
1029,
3457,
1024,
1024,
2131,
3207,
7011,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/DevicesDetection/API.php | API.getBrand | public function getBrand($idSite, $period, $date, $segment = false)
{
$dataTable = $this->getDataTable('DevicesDetection_brands', $idSite, $period, $date, $segment);
$dataTable->filter('GroupBy', array('label', __NAMESPACE__ . '\getDeviceBrandLabel'));
$dataTable->filter('ColumnCallbackAddMetadata', array('label', 'logo', __NAMESPACE__ . '\getBrandLogo'));
$dataTable->filter('AddSegmentByLabel', array('deviceBrand'));
return $dataTable;
} | php | public function getBrand($idSite, $period, $date, $segment = false)
{
$dataTable = $this->getDataTable('DevicesDetection_brands', $idSite, $period, $date, $segment);
$dataTable->filter('GroupBy', array('label', __NAMESPACE__ . '\getDeviceBrandLabel'));
$dataTable->filter('ColumnCallbackAddMetadata', array('label', 'logo', __NAMESPACE__ . '\getBrandLogo'));
$dataTable->filter('AddSegmentByLabel', array('deviceBrand'));
return $dataTable;
} | [
"public",
"function",
"getBrand",
"(",
"$",
"idSite",
",",
"$",
"period",
",",
"$",
"date",
",",
"$",
"segment",
"=",
"false",
")",
"{",
"$",
"dataTable",
"=",
"$",
"this",
"->",
"getDataTable",
"(",
"'DevicesDetection_brands'",
",",
"$",
"idSite",
",",
... | Gets datatable displaying number of visits by device manufacturer name
@param int $idSite
@param string $period
@param string $date
@param bool|string $segment
@return DataTable | [
"Gets",
"datatable",
"displaying",
"number",
"of",
"visits",
"by",
"device",
"manufacturer",
"name"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/DevicesDetection/API.php#L94-L101 | train | Get the datatable for the brand | [
30522,
2270,
3853,
2131,
23544,
1006,
1002,
8909,
28032,
2063,
1010,
1002,
2558,
1010,
1002,
3058,
1010,
1002,
6903,
1027,
6270,
1007,
1063,
1002,
2951,
10880,
1027,
1002,
2023,
1011,
1028,
2131,
2850,
29336,
3085,
1006,
1005,
5733,
3207,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php | RequestDataCollector.collect | public function collect(Request $request, Response $response, \Exception $exception = null)
{
// attributes are serialized and as they can be anything, they need to be converted to strings.
$attributes = [];
$route = '';
foreach ($request->attributes->all() as $key => $value) {
if ('_route' === $key) {
$route = \is_object($value) ? $value->getPath() : $value;
$attributes[$key] = $route;
} else {
$attributes[$key] = $value;
}
}
$content = null;
try {
$content = $request->getContent();
} catch (\LogicException $e) {
// the user already got the request content as a resource
$content = false;
}
$sessionMetadata = [];
$sessionAttributes = [];
$session = null;
$flashes = [];
if ($request->hasSession()) {
$session = $request->getSession();
if ($session->isStarted()) {
$sessionMetadata['Created'] = date(DATE_RFC822, $session->getMetadataBag()->getCreated());
$sessionMetadata['Last used'] = date(DATE_RFC822, $session->getMetadataBag()->getLastUsed());
$sessionMetadata['Lifetime'] = $session->getMetadataBag()->getLifetime();
$sessionAttributes = $session->all();
$flashes = $session->getFlashBag()->peekAll();
}
}
$statusCode = $response->getStatusCode();
$responseCookies = [];
foreach ($response->headers->getCookies() as $cookie) {
$responseCookies[$cookie->getName()] = $cookie;
}
$dotenvVars = [];
foreach (explode(',', getenv('SYMFONY_DOTENV_VARS')) as $name) {
if ('' !== $name && false !== $value = getenv($name)) {
$dotenvVars[$name] = $value;
}
}
$this->data = [
'method' => $request->getMethod(),
'format' => $request->getRequestFormat(),
'content' => $content,
'content_type' => $response->headers->get('Content-Type', 'text/html'),
'status_text' => isset(Response::$statusTexts[$statusCode]) ? Response::$statusTexts[$statusCode] : '',
'status_code' => $statusCode,
'request_query' => $request->query->all(),
'request_request' => $request->request->all(),
'request_files' => $request->files->all(),
'request_headers' => $request->headers->all(),
'request_server' => $request->server->all(),
'request_cookies' => $request->cookies->all(),
'request_attributes' => $attributes,
'route' => $route,
'response_headers' => $response->headers->all(),
'response_cookies' => $responseCookies,
'session_metadata' => $sessionMetadata,
'session_attributes' => $sessionAttributes,
'flashes' => $flashes,
'path_info' => $request->getPathInfo(),
'controller' => 'n/a',
'locale' => $request->getLocale(),
'dotenv_vars' => $dotenvVars,
];
if (isset($this->data['request_headers']['php-auth-pw'])) {
$this->data['request_headers']['php-auth-pw'] = '******';
}
if (isset($this->data['request_server']['PHP_AUTH_PW'])) {
$this->data['request_server']['PHP_AUTH_PW'] = '******';
}
if (isset($this->data['request_request']['_password'])) {
$this->data['request_request']['_password'] = '******';
}
foreach ($this->data as $key => $value) {
if (!\is_array($value)) {
continue;
}
if ('request_headers' === $key || 'response_headers' === $key) {
$this->data[$key] = array_map(function ($v) { return isset($v[0]) && !isset($v[1]) ? $v[0] : $v; }, $value);
}
}
if (isset($this->controllers[$request])) {
$this->data['controller'] = $this->parseController($this->controllers[$request]);
unset($this->controllers[$request]);
}
if ($request->attributes->has('_redirected') && $redirectCookie = $request->cookies->get('sf_redirect')) {
$this->data['redirect'] = json_decode($redirectCookie, true);
$response->headers->clearCookie('sf_redirect');
}
if ($response->isRedirect()) {
$response->headers->setCookie(new Cookie(
'sf_redirect',
json_encode([
'token' => $response->headers->get('x-debug-token'),
'route' => $request->attributes->get('_route', 'n/a'),
'method' => $request->getMethod(),
'controller' => $this->parseController($request->attributes->get('_controller')),
'status_code' => $statusCode,
'status_text' => Response::$statusTexts[(int) $statusCode],
]),
0, '/', null, $request->isSecure(), true, false, 'lax'
));
}
$this->data['identifier'] = $this->data['route'] ?: (\is_array($this->data['controller']) ? $this->data['controller']['class'].'::'.$this->data['controller']['method'].'()' : $this->data['controller']);
if ($response->headers->has('x-previous-debug-token')) {
$this->data['forward_token'] = $response->headers->get('x-previous-debug-token');
}
} | php | public function collect(Request $request, Response $response, \Exception $exception = null)
{
// attributes are serialized and as they can be anything, they need to be converted to strings.
$attributes = [];
$route = '';
foreach ($request->attributes->all() as $key => $value) {
if ('_route' === $key) {
$route = \is_object($value) ? $value->getPath() : $value;
$attributes[$key] = $route;
} else {
$attributes[$key] = $value;
}
}
$content = null;
try {
$content = $request->getContent();
} catch (\LogicException $e) {
// the user already got the request content as a resource
$content = false;
}
$sessionMetadata = [];
$sessionAttributes = [];
$session = null;
$flashes = [];
if ($request->hasSession()) {
$session = $request->getSession();
if ($session->isStarted()) {
$sessionMetadata['Created'] = date(DATE_RFC822, $session->getMetadataBag()->getCreated());
$sessionMetadata['Last used'] = date(DATE_RFC822, $session->getMetadataBag()->getLastUsed());
$sessionMetadata['Lifetime'] = $session->getMetadataBag()->getLifetime();
$sessionAttributes = $session->all();
$flashes = $session->getFlashBag()->peekAll();
}
}
$statusCode = $response->getStatusCode();
$responseCookies = [];
foreach ($response->headers->getCookies() as $cookie) {
$responseCookies[$cookie->getName()] = $cookie;
}
$dotenvVars = [];
foreach (explode(',', getenv('SYMFONY_DOTENV_VARS')) as $name) {
if ('' !== $name && false !== $value = getenv($name)) {
$dotenvVars[$name] = $value;
}
}
$this->data = [
'method' => $request->getMethod(),
'format' => $request->getRequestFormat(),
'content' => $content,
'content_type' => $response->headers->get('Content-Type', 'text/html'),
'status_text' => isset(Response::$statusTexts[$statusCode]) ? Response::$statusTexts[$statusCode] : '',
'status_code' => $statusCode,
'request_query' => $request->query->all(),
'request_request' => $request->request->all(),
'request_files' => $request->files->all(),
'request_headers' => $request->headers->all(),
'request_server' => $request->server->all(),
'request_cookies' => $request->cookies->all(),
'request_attributes' => $attributes,
'route' => $route,
'response_headers' => $response->headers->all(),
'response_cookies' => $responseCookies,
'session_metadata' => $sessionMetadata,
'session_attributes' => $sessionAttributes,
'flashes' => $flashes,
'path_info' => $request->getPathInfo(),
'controller' => 'n/a',
'locale' => $request->getLocale(),
'dotenv_vars' => $dotenvVars,
];
if (isset($this->data['request_headers']['php-auth-pw'])) {
$this->data['request_headers']['php-auth-pw'] = '******';
}
if (isset($this->data['request_server']['PHP_AUTH_PW'])) {
$this->data['request_server']['PHP_AUTH_PW'] = '******';
}
if (isset($this->data['request_request']['_password'])) {
$this->data['request_request']['_password'] = '******';
}
foreach ($this->data as $key => $value) {
if (!\is_array($value)) {
continue;
}
if ('request_headers' === $key || 'response_headers' === $key) {
$this->data[$key] = array_map(function ($v) { return isset($v[0]) && !isset($v[1]) ? $v[0] : $v; }, $value);
}
}
if (isset($this->controllers[$request])) {
$this->data['controller'] = $this->parseController($this->controllers[$request]);
unset($this->controllers[$request]);
}
if ($request->attributes->has('_redirected') && $redirectCookie = $request->cookies->get('sf_redirect')) {
$this->data['redirect'] = json_decode($redirectCookie, true);
$response->headers->clearCookie('sf_redirect');
}
if ($response->isRedirect()) {
$response->headers->setCookie(new Cookie(
'sf_redirect',
json_encode([
'token' => $response->headers->get('x-debug-token'),
'route' => $request->attributes->get('_route', 'n/a'),
'method' => $request->getMethod(),
'controller' => $this->parseController($request->attributes->get('_controller')),
'status_code' => $statusCode,
'status_text' => Response::$statusTexts[(int) $statusCode],
]),
0, '/', null, $request->isSecure(), true, false, 'lax'
));
}
$this->data['identifier'] = $this->data['route'] ?: (\is_array($this->data['controller']) ? $this->data['controller']['class'].'::'.$this->data['controller']['method'].'()' : $this->data['controller']);
if ($response->headers->has('x-previous-debug-token')) {
$this->data['forward_token'] = $response->headers->get('x-previous-debug-token');
}
} | [
"public",
"function",
"collect",
"(",
"Request",
"$",
"request",
",",
"Response",
"$",
"response",
",",
"\\",
"Exception",
"$",
"exception",
"=",
"null",
")",
"{",
"// attributes are serialized and as they can be anything, they need to be converted to strings.",
"$",
"att... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php#L38-L167 | train | Collects all the information about the request and response | [
30522,
2270,
3853,
8145,
1006,
5227,
1002,
5227,
1010,
3433,
1002,
3433,
1010,
1032,
6453,
1002,
6453,
1027,
19701,
1007,
1063,
1013,
1013,
12332,
2024,
27289,
1998,
2004,
2027,
2064,
2022,
2505,
1010,
2027,
2342,
2000,
2022,
4991,
2000,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/EmailValidator.php | EmailValidator.validate | public function validate($value, Constraint $constraint)
{
if (!$constraint instanceof Email) {
throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Email');
}
if (null === $value || '' === $value) {
return;
}
if (!is_scalar($value) && !(\is_object($value) && method_exists($value, '__toString'))) {
throw new UnexpectedValueException($value, 'string');
}
$value = (string) $value;
if (null !== $constraint->normalizer) {
$value = ($constraint->normalizer)($value);
}
if (null !== $constraint->strict) {
@trigger_error(sprintf('The %s::$strict property is deprecated since Symfony 4.1. Use %s::mode="%s" instead.', Email::class, Email::class, Email::VALIDATION_MODE_STRICT), E_USER_DEPRECATED);
if ($constraint->strict) {
$constraint->mode = Email::VALIDATION_MODE_STRICT;
} else {
$constraint->mode = Email::VALIDATION_MODE_LOOSE;
}
}
if (null === $constraint->mode) {
$constraint->mode = $this->defaultMode;
}
if (!\in_array($constraint->mode, Email::$validationModes, true)) {
throw new \InvalidArgumentException(sprintf('The %s::$mode parameter value is not valid.', \get_class($constraint)));
}
if (Email::VALIDATION_MODE_STRICT === $constraint->mode) {
if (!class_exists('\Egulias\EmailValidator\EmailValidator')) {
throw new LogicException('Strict email validation requires egulias/email-validator ~1.2|~2.0');
}
$strictValidator = new \Egulias\EmailValidator\EmailValidator();
if (interface_exists(EmailValidation::class) && !$strictValidator->isValid($value, new NoRFCWarningsValidation())) {
$this->context->buildViolation($constraint->message)
->setParameter('{{ value }}', $this->formatValue($value))
->setCode(Email::INVALID_FORMAT_ERROR)
->addViolation();
return;
} elseif (!interface_exists(EmailValidation::class) && !$strictValidator->isValid($value, false, true)) {
$this->context->buildViolation($constraint->message)
->setParameter('{{ value }}', $this->formatValue($value))
->setCode(Email::INVALID_FORMAT_ERROR)
->addViolation();
return;
}
} elseif (!preg_match(self::$emailPatterns[$constraint->mode], $value)) {
$this->context->buildViolation($constraint->message)
->setParameter('{{ value }}', $this->formatValue($value))
->setCode(Email::INVALID_FORMAT_ERROR)
->addViolation();
return;
}
$host = (string) substr($value, strrpos($value, '@') + 1);
// Check for host DNS resource records
if ($constraint->checkMX) {
if (!$this->checkMX($host)) {
$this->context->buildViolation($constraint->message)
->setParameter('{{ value }}', $this->formatValue($value))
->setCode(Email::MX_CHECK_FAILED_ERROR)
->addViolation();
}
return;
}
if ($constraint->checkHost && !$this->checkHost($host)) {
$this->context->buildViolation($constraint->message)
->setParameter('{{ value }}', $this->formatValue($value))
->setCode(Email::HOST_CHECK_FAILED_ERROR)
->addViolation();
}
} | php | public function validate($value, Constraint $constraint)
{
if (!$constraint instanceof Email) {
throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Email');
}
if (null === $value || '' === $value) {
return;
}
if (!is_scalar($value) && !(\is_object($value) && method_exists($value, '__toString'))) {
throw new UnexpectedValueException($value, 'string');
}
$value = (string) $value;
if (null !== $constraint->normalizer) {
$value = ($constraint->normalizer)($value);
}
if (null !== $constraint->strict) {
@trigger_error(sprintf('The %s::$strict property is deprecated since Symfony 4.1. Use %s::mode="%s" instead.', Email::class, Email::class, Email::VALIDATION_MODE_STRICT), E_USER_DEPRECATED);
if ($constraint->strict) {
$constraint->mode = Email::VALIDATION_MODE_STRICT;
} else {
$constraint->mode = Email::VALIDATION_MODE_LOOSE;
}
}
if (null === $constraint->mode) {
$constraint->mode = $this->defaultMode;
}
if (!\in_array($constraint->mode, Email::$validationModes, true)) {
throw new \InvalidArgumentException(sprintf('The %s::$mode parameter value is not valid.', \get_class($constraint)));
}
if (Email::VALIDATION_MODE_STRICT === $constraint->mode) {
if (!class_exists('\Egulias\EmailValidator\EmailValidator')) {
throw new LogicException('Strict email validation requires egulias/email-validator ~1.2|~2.0');
}
$strictValidator = new \Egulias\EmailValidator\EmailValidator();
if (interface_exists(EmailValidation::class) && !$strictValidator->isValid($value, new NoRFCWarningsValidation())) {
$this->context->buildViolation($constraint->message)
->setParameter('{{ value }}', $this->formatValue($value))
->setCode(Email::INVALID_FORMAT_ERROR)
->addViolation();
return;
} elseif (!interface_exists(EmailValidation::class) && !$strictValidator->isValid($value, false, true)) {
$this->context->buildViolation($constraint->message)
->setParameter('{{ value }}', $this->formatValue($value))
->setCode(Email::INVALID_FORMAT_ERROR)
->addViolation();
return;
}
} elseif (!preg_match(self::$emailPatterns[$constraint->mode], $value)) {
$this->context->buildViolation($constraint->message)
->setParameter('{{ value }}', $this->formatValue($value))
->setCode(Email::INVALID_FORMAT_ERROR)
->addViolation();
return;
}
$host = (string) substr($value, strrpos($value, '@') + 1);
// Check for host DNS resource records
if ($constraint->checkMX) {
if (!$this->checkMX($host)) {
$this->context->buildViolation($constraint->message)
->setParameter('{{ value }}', $this->formatValue($value))
->setCode(Email::MX_CHECK_FAILED_ERROR)
->addViolation();
}
return;
}
if ($constraint->checkHost && !$this->checkHost($host)) {
$this->context->buildViolation($constraint->message)
->setParameter('{{ value }}', $this->formatValue($value))
->setCode(Email::HOST_CHECK_FAILED_ERROR)
->addViolation();
}
} | [
"public",
"function",
"validate",
"(",
"$",
"value",
",",
"Constraint",
"$",
"constraint",
")",
"{",
"if",
"(",
"!",
"$",
"constraint",
"instanceof",
"Email",
")",
"{",
"throw",
"new",
"UnexpectedTypeException",
"(",
"$",
"constraint",
",",
"__NAMESPACE__",
... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Validator/Constraints/EmailValidator.php#L68-L157 | train | Validates the given value with the given Email constraint. | [
30522,
2270,
3853,
9398,
3686,
1006,
1002,
3643,
1010,
27142,
1002,
27142,
1007,
1063,
2065,
1006,
999,
1002,
27142,
6013,
11253,
10373,
1007,
1063,
5466,
2047,
9223,
13874,
10288,
24422,
1006,
1002,
27142,
1010,
1035,
1035,
3415,
15327,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/UsersManager/API.php | API.getUsersPlusRole | public function getUsersPlusRole($idSite, $limit = null, $offset = 0, $filter_search = null, $filter_access = null)
{
if (!$this->isUserHasAdminAccessTo($idSite)) {
// if the user is not an admin to $idSite, they can only see their own user
if ($offset > 1) {
Common::sendHeader('X-Matomo-Total-Results: 1');
return [];
}
$user = $this->model->getUser($this->access->getLogin());
$user['role'] = $this->access->getRoleForSite($idSite);
$user['capabilities'] = $this->access->getCapabilitiesForSite($idSite);
$users = [$user];
$totalResults = 1;
} else {
// if the current user is not the superuser, only select users that have access to a site this user
// has admin access to
$loginsToLimit = null;
if (!Piwik::hasUserSuperUserAccess()) {
$adminIdSites = Access::getInstance()->getSitesIdWithAdminAccess();
if (empty($adminIdSites)) { // sanity check
throw new \Exception("The current admin user does not have access to any sites.");
}
$loginsToLimit = $this->model->getUsersWithAccessToSites($adminIdSites);
}
list($users, $totalResults) = $this->model->getUsersWithRole($idSite, $limit, $offset, $filter_search, $filter_access, $loginsToLimit);
foreach ($users as &$user) {
$user['superuser_access'] = $user['superuser_access'] == 1;
if ($user['superuser_access']) {
$user['role'] = 'superuser';
$user['capabilities'] = [];
} else {
list($user['role'], $user['capabilities']) = $this->getRoleAndCapabilitiesFromAccess($user['access']);
$user['role'] = empty($user['role']) ? 'noaccess' : reset($user['role']);
}
unset($user['access']);
}
}
$users = $this->enrichUsers($users);
$users = $this->enrichUsersWithLastSeen($users);
foreach ($users as &$user) {
unset($user['password']);
}
Common::sendHeader('X-Matomo-Total-Results: ' . $totalResults);
return $users;
} | php | public function getUsersPlusRole($idSite, $limit = null, $offset = 0, $filter_search = null, $filter_access = null)
{
if (!$this->isUserHasAdminAccessTo($idSite)) {
// if the user is not an admin to $idSite, they can only see their own user
if ($offset > 1) {
Common::sendHeader('X-Matomo-Total-Results: 1');
return [];
}
$user = $this->model->getUser($this->access->getLogin());
$user['role'] = $this->access->getRoleForSite($idSite);
$user['capabilities'] = $this->access->getCapabilitiesForSite($idSite);
$users = [$user];
$totalResults = 1;
} else {
// if the current user is not the superuser, only select users that have access to a site this user
// has admin access to
$loginsToLimit = null;
if (!Piwik::hasUserSuperUserAccess()) {
$adminIdSites = Access::getInstance()->getSitesIdWithAdminAccess();
if (empty($adminIdSites)) { // sanity check
throw new \Exception("The current admin user does not have access to any sites.");
}
$loginsToLimit = $this->model->getUsersWithAccessToSites($adminIdSites);
}
list($users, $totalResults) = $this->model->getUsersWithRole($idSite, $limit, $offset, $filter_search, $filter_access, $loginsToLimit);
foreach ($users as &$user) {
$user['superuser_access'] = $user['superuser_access'] == 1;
if ($user['superuser_access']) {
$user['role'] = 'superuser';
$user['capabilities'] = [];
} else {
list($user['role'], $user['capabilities']) = $this->getRoleAndCapabilitiesFromAccess($user['access']);
$user['role'] = empty($user['role']) ? 'noaccess' : reset($user['role']);
}
unset($user['access']);
}
}
$users = $this->enrichUsers($users);
$users = $this->enrichUsersWithLastSeen($users);
foreach ($users as &$user) {
unset($user['password']);
}
Common::sendHeader('X-Matomo-Total-Results: ' . $totalResults);
return $users;
} | [
"public",
"function",
"getUsersPlusRole",
"(",
"$",
"idSite",
",",
"$",
"limit",
"=",
"null",
",",
"$",
"offset",
"=",
"0",
",",
"$",
"filter_search",
"=",
"null",
",",
"$",
"filter_access",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
... | Returns all users with their role for $idSite.
@param int $idSite
@param int|null $limit
@param int|null $offset
@param string|null $filter_search text to search for in the user's login, email and alias (if any)
@param string|null $filter_access only select users with this access to $idSite. can be 'noaccess', 'some', 'view', 'admin', 'superuser'
Filtering by 'superuser' is only allowed for other superusers.
@return array | [
"Returns",
"all",
"users",
"with",
"their",
"role",
"for",
"$idSite",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/UsersManager/API.php#L298-L350 | train | Returns all users with a specific role and capabilities | [
30522,
2270,
3853,
2131,
20330,
13102,
7393,
13153,
2063,
1006,
1002,
8909,
28032,
2063,
1010,
1002,
5787,
1027,
19701,
1010,
1002,
16396,
1027,
1014,
1010,
1002,
11307,
1035,
3945,
1027,
19701,
1010,
1002,
11307,
1035,
3229,
1027,
19701,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getgrav/grav | system/src/Grav/Common/Page/Medium/ImageMedium.php | ImageMedium.saveImage | protected function saveImage()
{
if (!$this->image) {
return parent::path(false);
}
$this->filter();
if (isset($this->result)) {
return $this->result;
}
if (!$this->debug_watermarked && $this->get('debug')) {
$ratio = $this->get('ratio');
if (!$ratio) {
$ratio = 1;
}
$locator = Grav::instance()['locator'];
$overlay = $locator->findResource("system://assets/responsive-overlays/{$ratio}x.png") ?: $locator->findResource('system://assets/responsive-overlays/unknown.png');
$this->image->merge(ImageFile::open($overlay));
}
return $this->image->cacheFile($this->format, $this->quality, false, [$this->get('width'), $this->get('height'), $this->get('modified')]);
} | php | protected function saveImage()
{
if (!$this->image) {
return parent::path(false);
}
$this->filter();
if (isset($this->result)) {
return $this->result;
}
if (!$this->debug_watermarked && $this->get('debug')) {
$ratio = $this->get('ratio');
if (!$ratio) {
$ratio = 1;
}
$locator = Grav::instance()['locator'];
$overlay = $locator->findResource("system://assets/responsive-overlays/{$ratio}x.png") ?: $locator->findResource('system://assets/responsive-overlays/unknown.png');
$this->image->merge(ImageFile::open($overlay));
}
return $this->image->cacheFile($this->format, $this->quality, false, [$this->get('width'), $this->get('height'), $this->get('modified')]);
} | [
"protected",
"function",
"saveImage",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"image",
")",
"{",
"return",
"parent",
"::",
"path",
"(",
"false",
")",
";",
"}",
"$",
"this",
"->",
"filter",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
... | Save the image with cache.
@return string | [
"Save",
"the",
"image",
"with",
"cache",
"."
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Medium/ImageMedium.php#L599-L623 | train | Save image to cache | [
30522,
5123,
3853,
3828,
9581,
3351,
1006,
1007,
1063,
2065,
1006,
999,
1002,
2023,
1011,
1028,
3746,
1007,
1063,
2709,
6687,
1024,
1024,
4130,
1006,
6270,
1007,
1025,
1065,
1002,
2023,
1011,
1028,
11307,
1006,
30524,
2023,
1011,
1028,
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... |
symfony/symfony | src/Symfony/Component/Intl/Intl.php | Intl.getIcuDataVersion | public static function getIcuDataVersion()
{
if (false === self::$icuDataVersion) {
self::$icuDataVersion = trim(file_get_contents(self::getDataDirectory().'/version.txt'));
}
return self::$icuDataVersion;
} | php | public static function getIcuDataVersion()
{
if (false === self::$icuDataVersion) {
self::$icuDataVersion = trim(file_get_contents(self::getDataDirectory().'/version.txt'));
}
return self::$icuDataVersion;
} | [
"public",
"static",
"function",
"getIcuDataVersion",
"(",
")",
"{",
"if",
"(",
"false",
"===",
"self",
"::",
"$",
"icuDataVersion",
")",
"{",
"self",
"::",
"$",
"icuDataVersion",
"=",
"trim",
"(",
"file_get_contents",
"(",
"self",
"::",
"getDataDirectory",
"... | Returns the version of the installed ICU data.
@return string The version of the installed ICU data | [
"Returns",
"the",
"version",
"of",
"the",
"installed",
"ICU",
"data",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Intl/Intl.php#L243-L250 | train | Get the icu data version | [
30522,
2270,
10763,
3853,
2131,
2594,
14066,
2696,
27774,
1006,
1007,
1063,
2065,
1006,
6270,
1027,
1027,
1027,
2969,
1024,
1024,
1002,
24582,
14066,
2696,
27774,
1007,
1063,
2969,
1024,
1024,
1002,
24582,
14066,
2696,
27774,
1027,
12241,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/API/DataTableManipulator/LabelFilter.php | LabelFilter.doFilterRecursiveDescend | private function doFilterRecursiveDescend($labelParts, $dataTable)
{
// we need to make sure to rebuild the index as some filters change the label column directly via
// $row->setColumn('label', '') which would not be noticed in the label index otherwise.
$dataTable->rebuildIndex();
// search for the first part of the tree search
$labelPart = array_shift($labelParts);
$row = false;
foreach ($this->getLabelVariations($labelPart) as $labelPart) {
$row = $dataTable->getRowFromLabel($labelPart);
if ($row !== false) {
break;
}
}
if ($row === false) {
// not found
return false;
}
// end of tree search reached
if (count($labelParts) == 0) {
return $row;
}
$subTable = $this->loadSubtable($dataTable, $row);
if ($subTable === null) {
// no more subtables but label parts left => no match found
return false;
}
return $this->doFilterRecursiveDescend($labelParts, $subTable);
} | php | private function doFilterRecursiveDescend($labelParts, $dataTable)
{
// we need to make sure to rebuild the index as some filters change the label column directly via
// $row->setColumn('label', '') which would not be noticed in the label index otherwise.
$dataTable->rebuildIndex();
// search for the first part of the tree search
$labelPart = array_shift($labelParts);
$row = false;
foreach ($this->getLabelVariations($labelPart) as $labelPart) {
$row = $dataTable->getRowFromLabel($labelPart);
if ($row !== false) {
break;
}
}
if ($row === false) {
// not found
return false;
}
// end of tree search reached
if (count($labelParts) == 0) {
return $row;
}
$subTable = $this->loadSubtable($dataTable, $row);
if ($subTable === null) {
// no more subtables but label parts left => no match found
return false;
}
return $this->doFilterRecursiveDescend($labelParts, $subTable);
} | [
"private",
"function",
"doFilterRecursiveDescend",
"(",
"$",
"labelParts",
",",
"$",
"dataTable",
")",
"{",
"// we need to make sure to rebuild the index as some filters change the label column directly via",
"// $row->setColumn('label', '') which would not be noticed in the label index othe... | Method for the recursive descend
@param array $labelParts
@param DataTable $dataTable
@return Row|bool | [
"Method",
"for",
"the",
"recursive",
"descend"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/API/DataTableManipulator/LabelFilter.php#L65-L99 | train | Recursive descend of the tree | [
30522,
2797,
3853,
2079,
8873,
21928,
2890,
10841,
2869,
3512,
6155,
23865,
1006,
1002,
3830,
26950,
1010,
1002,
2951,
10880,
1007,
1063,
1013,
1013,
2057,
2342,
2000,
2191,
2469,
2000,
14591,
1996,
5950,
2004,
2070,
17736,
2689,
1996,
3830... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/WidgetManager.php | WidgetManager.listReportWidgets | public function listReportWidgets()
{
if ($this->reportWidgets === null) {
$this->reportWidgets = [];
/*
* Load module widgets
*/
foreach ($this->reportWidgetCallbacks as $callback) {
$callback($this);
}
/*
* Load plugin widgets
*/
$plugins = $this->pluginManager->getPlugins();
foreach ($plugins as $plugin) {
if (!is_array($widgets = $plugin->registerReportWidgets())) {
continue;
}
foreach ($widgets as $className => $widgetInfo) {
$this->registerReportWidget($className, $widgetInfo);
}
}
}
/**
* @event system.reportwidgets.extendItems
* Enables adding or removing report widgets.
*
* You will have access to the WidgetManager instance and be able to call the appropiate methods
* $manager->registerReportWidget();
* $manager->removeReportWidget();
*
* Example usage:
*
* Event::listen('system.reportwidgets.extendItems', function($manager) {
* $manager->removeReportWidget('Acme\ReportWidgets\YourWidget');
* });
*
*/
Event::fire('system.reportwidgets.extendItems', [$this]);
return $this->reportWidgets;
} | php | public function listReportWidgets()
{
if ($this->reportWidgets === null) {
$this->reportWidgets = [];
/*
* Load module widgets
*/
foreach ($this->reportWidgetCallbacks as $callback) {
$callback($this);
}
/*
* Load plugin widgets
*/
$plugins = $this->pluginManager->getPlugins();
foreach ($plugins as $plugin) {
if (!is_array($widgets = $plugin->registerReportWidgets())) {
continue;
}
foreach ($widgets as $className => $widgetInfo) {
$this->registerReportWidget($className, $widgetInfo);
}
}
}
/**
* @event system.reportwidgets.extendItems
* Enables adding or removing report widgets.
*
* You will have access to the WidgetManager instance and be able to call the appropiate methods
* $manager->registerReportWidget();
* $manager->removeReportWidget();
*
* Example usage:
*
* Event::listen('system.reportwidgets.extendItems', function($manager) {
* $manager->removeReportWidget('Acme\ReportWidgets\YourWidget');
* });
*
*/
Event::fire('system.reportwidgets.extendItems', [$this]);
return $this->reportWidgets;
} | [
"public",
"function",
"listReportWidgets",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"reportWidgets",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"reportWidgets",
"=",
"[",
"]",
";",
"/*\n * Load module widgets\n */",
"foreach",
"(",
"... | Returns a list of registered report widgets.
@return array Array keys are class names. | [
"Returns",
"a",
"list",
"of",
"registered",
"report",
"widgets",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/classes/WidgetManager.php#L164-L210 | train | Returns the list of report widgets | [
30522,
2270,
3853,
2862,
2890,
6442,
9148,
28682,
1006,
1007,
1063,
2065,
1006,
1002,
2023,
1011,
1028,
3189,
9148,
28682,
1027,
1027,
1027,
19701,
1007,
1063,
1002,
2023,
1011,
1028,
3189,
9148,
28682,
1027,
1031,
1033,
1025,
1013,
1008,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/system/classes/MarkupManager.php | MarkupManager.listExtensions | public function listExtensions($type)
{
$results = [];
if ($this->items === null) {
$this->loadExtensions();
}
if (isset($this->items[$type]) && is_array($this->items[$type])) {
$results = $this->items[$type];
}
if ($this->transactionItems !== null && isset($this->transactionItems[$type])) {
$results = array_merge($results, $this->transactionItems[$type]);
}
return $results;
} | php | public function listExtensions($type)
{
$results = [];
if ($this->items === null) {
$this->loadExtensions();
}
if (isset($this->items[$type]) && is_array($this->items[$type])) {
$results = $this->items[$type];
}
if ($this->transactionItems !== null && isset($this->transactionItems[$type])) {
$results = array_merge($results, $this->transactionItems[$type]);
}
return $results;
} | [
"public",
"function",
"listExtensions",
"(",
"$",
"type",
")",
"{",
"$",
"results",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"this",
"->",
"items",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"loadExtensions",
"(",
")",
";",
"}",
"if",
"(",
"isset",
"... | Returns a list of the registered Twig extensions of a type.
@param $type string The Twig extension type
@return array | [
"Returns",
"a",
"list",
"of",
"the",
"registered",
"Twig",
"extensions",
"of",
"a",
"type",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/MarkupManager.php#L172-L189 | train | List Extensions of a type | [
30522,
2270,
3853,
2862,
10288,
29048,
2015,
1006,
1002,
2828,
1007,
1063,
1002,
3463,
1027,
1031,
1033,
1025,
2065,
1006,
1002,
2023,
1011,
1028,
5167,
1027,
1027,
1027,
19701,
1007,
1063,
1002,
2023,
1011,
1028,
7170,
10288,
29048,
2015,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Validation/Validator.php | Validator.getPresenceVerifierFor | public function getPresenceVerifierFor($connection)
{
return tap($this->getPresenceVerifier(), function ($verifier) use ($connection) {
$verifier->setConnection($connection);
});
} | php | public function getPresenceVerifierFor($connection)
{
return tap($this->getPresenceVerifier(), function ($verifier) use ($connection) {
$verifier->setConnection($connection);
});
} | [
"public",
"function",
"getPresenceVerifierFor",
"(",
"$",
"connection",
")",
"{",
"return",
"tap",
"(",
"$",
"this",
"->",
"getPresenceVerifier",
"(",
")",
",",
"function",
"(",
"$",
"verifier",
")",
"use",
"(",
"$",
"connection",
")",
"{",
"$",
"verifier"... | Get the Presence Verifier implementation.
@param string $connection
@return \Illuminate\Validation\PresenceVerifierInterface
@throws \RuntimeException | [
"Get",
"the",
"Presence",
"Verifier",
"implementation",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Validation/Validator.php#L1088-L1093 | train | Returns the presence verifier for the given connection. | [
30522,
2270,
3853,
2131,
28994,
10127,
6299,
18095,
29278,
1006,
1002,
4434,
1007,
1063,
2709,
11112,
1006,
1002,
2023,
1011,
1028,
2131,
28994,
10127,
6299,
18095,
1006,
1007,
1010,
3853,
1006,
1002,
30524,
1028,
2275,
8663,
2638,
7542,
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/TableLogAction.php | TableLogAction.normaliseActionString | private static function normaliseActionString($actionType, $actionString)
{
$actionString = Common::unsanitizeInputValue($actionString);
if (self::isActionTypeStoredUnsanitized($actionType)) {
return $actionString;
}
return Common::sanitizeInputValue($actionString);
} | php | private static function normaliseActionString($actionType, $actionString)
{
$actionString = Common::unsanitizeInputValue($actionString);
if (self::isActionTypeStoredUnsanitized($actionType)) {
return $actionString;
}
return Common::sanitizeInputValue($actionString);
} | [
"private",
"static",
"function",
"normaliseActionString",
"(",
"$",
"actionType",
",",
"$",
"actionString",
")",
"{",
"$",
"actionString",
"=",
"Common",
"::",
"unsanitizeInputValue",
"(",
"$",
"actionString",
")",
";",
"if",
"(",
"self",
"::",
"isActionTypeStor... | This function will sanitize or not if it's needed for the specified action type
URLs (Download URL, Outlink URL) are stored raw (unsanitized)
while other action types are stored Sanitized
@param $actionType
@param $actionString
@return string | [
"This",
"function",
"will",
"sanitize",
"or",
"not",
"if",
"it",
"s",
"needed",
"for",
"the",
"specified",
"action",
"type"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Tracker/TableLogAction.php#L258-L267 | train | Sanitize the action string if the action type is stored unsanitized. | [
30522,
2797,
10763,
3853,
3671,
5562,
18908,
8496,
18886,
3070,
1006,
1002,
2895,
13874,
1010,
1002,
4506,
18886,
3070,
1007,
1063,
1002,
4506,
18886,
3070,
1027,
2691,
1024,
1024,
4895,
8791,
25090,
4371,
2378,
18780,
10175,
5657,
1006,
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... |
overtrue/wechat | src/OfficialAccount/User/UserClient.php | UserClient.changeOpenid | public function changeOpenid(string $oldAppId, array $openidList)
{
$params = [
'from_appid' => $oldAppId,
'openid_list' => $openidList,
];
return $this->httpPostJson('cgi-bin/changeopenid', $params);
} | php | public function changeOpenid(string $oldAppId, array $openidList)
{
$params = [
'from_appid' => $oldAppId,
'openid_list' => $openidList,
];
return $this->httpPostJson('cgi-bin/changeopenid', $params);
} | [
"public",
"function",
"changeOpenid",
"(",
"string",
"$",
"oldAppId",
",",
"array",
"$",
"openidList",
")",
"{",
"$",
"params",
"=",
"[",
"'from_appid'",
"=>",
"$",
"oldAppId",
",",
"'openid_list'",
"=>",
"$",
"openidList",
",",
"]",
";",
"return",
"$",
... | @param string $oldAppId
@param array $openidList
@return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
@throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException | [
"@param",
"string",
"$oldAppId",
"@param",
"array",
"$openidList"
] | 120c72faaa93c270365bc75c73c362d5fd583209 | https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/OfficialAccount/User/UserClient.php#L157-L165 | train | Change openids list | [
30522,
2270,
3853,
2689,
26915,
3593,
1006,
5164,
1002,
2214,
29098,
3593,
1010,
9140,
1002,
2330,
3593,
9863,
1007,
1063,
1002,
11498,
5244,
1027,
1031,
1005,
2013,
1035,
10439,
3593,
1005,
1027,
1028,
1002,
2214,
29098,
3593,
1010,
1005,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Console/Scheduling/Event.php | Event.nextRunDate | public function nextRunDate($currentTime = 'now', $nth = 0, $allowCurrentDate = false)
{
return Date::instance(CronExpression::factory(
$this->getExpression()
)->getNextRunDate($currentTime, $nth, $allowCurrentDate, $this->timezone));
} | php | public function nextRunDate($currentTime = 'now', $nth = 0, $allowCurrentDate = false)
{
return Date::instance(CronExpression::factory(
$this->getExpression()
)->getNextRunDate($currentTime, $nth, $allowCurrentDate, $this->timezone));
} | [
"public",
"function",
"nextRunDate",
"(",
"$",
"currentTime",
"=",
"'now'",
",",
"$",
"nth",
"=",
"0",
",",
"$",
"allowCurrentDate",
"=",
"false",
")",
"{",
"return",
"Date",
"::",
"instance",
"(",
"CronExpression",
"::",
"factory",
"(",
"$",
"this",
"->... | Determine the next due date for an event.
@param \DateTimeInterface|string $currentTime
@param int $nth
@param bool $allowCurrentDate
@return \Illuminate\Support\Carbon | [
"Determine",
"the",
"next",
"due",
"date",
"for",
"an",
"event",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Console/Scheduling/Event.php#L784-L789 | train | Get next run date | [
30522,
2270,
3853,
2279,
15532,
13701,
1006,
1002,
2783,
7292,
1027,
1005,
2085,
1005,
1010,
1002,
23961,
2232,
1027,
1014,
1010,
1002,
3499,
10841,
14343,
3372,
13701,
1027,
6270,
1007,
1063,
2709,
3058,
1024,
1024,
6013,
1006,
13675,
5643... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/ImageMedium.php | ImageMedium.quality | public function quality($quality = null)
{
if ($quality) {
if (!$this->image) {
$this->image();
}
$this->quality = $quality;
return $this;
}
return $this->quality;
} | php | public function quality($quality = null)
{
if ($quality) {
if (!$this->image) {
$this->image();
}
$this->quality = $quality;
return $this;
}
return $this->quality;
} | [
"public",
"function",
"quality",
"(",
"$",
"quality",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"quality",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"image",
")",
"{",
"$",
"this",
"->",
"image",
"(",
")",
";",
"}",
"$",
"this",
"->",
"quality"... | Sets or gets the quality of the image
@param int $quality 0-100 quality
@return int|$this | [
"Sets",
"or",
"gets",
"the",
"quality",
"of",
"the",
"image"
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Medium/ImageMedium.php#L423-L436 | train | Set quality of image | [
30522,
2270,
3853,
3737,
1006,
1002,
3737,
1027,
19701,
1007,
1063,
2065,
1006,
1002,
3737,
1007,
1063,
2065,
1006,
999,
1002,
2023,
1011,
1028,
3746,
1007,
1063,
1002,
2023,
1011,
1028,
3746,
1006,
1007,
1025,
1065,
1002,
2023,
1011,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/backend/formwidgets/DataTable.php | DataTable.prepareVars | public function prepareVars()
{
$this->populateTableWidget();
$this->vars['table'] = $this->table;
$this->vars['size'] = $this->size;
$this->vars['rowSorting'] = $this->rowSorting;
} | php | public function prepareVars()
{
$this->populateTableWidget();
$this->vars['table'] = $this->table;
$this->vars['size'] = $this->size;
$this->vars['rowSorting'] = $this->rowSorting;
} | [
"public",
"function",
"prepareVars",
"(",
")",
"{",
"$",
"this",
"->",
"populateTableWidget",
"(",
")",
";",
"$",
"this",
"->",
"vars",
"[",
"'table'",
"]",
"=",
"$",
"this",
"->",
"table",
";",
"$",
"this",
"->",
"vars",
"[",
"'size'",
"]",
"=",
"... | Prepares the list data | [
"Prepares",
"the",
"list",
"data"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/formwidgets/DataTable.php#L81-L87 | train | Prepares the vars of the taxonomy | [
30522,
2270,
3853,
7374,
10755,
2015,
1006,
1007,
1063,
1002,
2023,
1011,
1028,
3769,
9869,
10880,
9148,
24291,
1006,
1007,
1025,
1002,
2023,
1011,
1028,
13075,
2015,
1031,
1005,
2795,
1005,
1033,
1027,
1002,
2023,
1011,
1028,
2795,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php | AbstractNormalizer.setCircularReferenceLimit | public function setCircularReferenceLimit($circularReferenceLimit)
{
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.2, use the "circular_reference_limit" key of the context instead.', __METHOD__), E_USER_DEPRECATED);
$this->defaultContext[self::CIRCULAR_REFERENCE_LIMIT] = $this->circularReferenceLimit = $circularReferenceLimit;
return $this;
} | php | public function setCircularReferenceLimit($circularReferenceLimit)
{
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.2, use the "circular_reference_limit" key of the context instead.', __METHOD__), E_USER_DEPRECATED);
$this->defaultContext[self::CIRCULAR_REFERENCE_LIMIT] = $this->circularReferenceLimit = $circularReferenceLimit;
return $this;
} | [
"public",
"function",
"setCircularReferenceLimit",
"(",
"$",
"circularReferenceLimit",
")",
"{",
"@",
"trigger_error",
"(",
"sprintf",
"(",
"'The \"%s()\" method is deprecated since Symfony 4.2, use the \"circular_reference_limit\" key of the context instead.'",
",",
"__METHOD__",
")... | Sets circular reference limit.
@deprecated since Symfony 4.2
@param int $circularReferenceLimit Limit of iterations for the same object
@return self | [
"Sets",
"circular",
"reference",
"limit",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php#L197-L204 | train | Sets circular reference limit for the context | [
30522,
2270,
3853,
2275,
6895,
11890,
7934,
2890,
25523,
17960,
4183,
1006,
1002,
8206,
2890,
25523,
17960,
4183,
1007,
1063,
1030,
9495,
1035,
7561,
1006,
9043,
2546,
1006,
1005,
1996,
1000,
1003,
1055,
1006,
1007,
1000,
4118,
2003,
2139,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/Tracker/Db/Mysqli.php | Mysqli.prepare | private function prepare($query, $parameters)
{
if (!$parameters) {
$parameters = array();
} elseif (!is_array($parameters)) {
$parameters = array($parameters);
}
$this->paramNb = 0;
$this->params = & $parameters;
$query = preg_replace_callback('/\?/', array($this, 'replaceParam'), $query);
return $query;
} | php | private function prepare($query, $parameters)
{
if (!$parameters) {
$parameters = array();
} elseif (!is_array($parameters)) {
$parameters = array($parameters);
}
$this->paramNb = 0;
$this->params = & $parameters;
$query = preg_replace_callback('/\?/', array($this, 'replaceParam'), $query);
return $query;
} | [
"private",
"function",
"prepare",
"(",
"$",
"query",
",",
"$",
"parameters",
")",
"{",
"if",
"(",
"!",
"$",
"parameters",
")",
"{",
"$",
"parameters",
"=",
"array",
"(",
")",
";",
"}",
"elseif",
"(",
"!",
"is_array",
"(",
"$",
"parameters",
")",
")... | Input is a prepared SQL statement and parameters
Returns the SQL statement
@param string $query
@param array $parameters
@return string | [
"Input",
"is",
"a",
"prepared",
"SQL",
"statement",
"and",
"parameters",
"Returns",
"the",
"SQL",
"statement"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Tracker/Db/Mysqli.php#L281-L294 | train | Prepares the query with parameters | [
30522,
2797,
3853,
7374,
1006,
1002,
23032,
1010,
1002,
11709,
1007,
1063,
2065,
1006,
999,
1002,
11709,
1007,
1063,
1002,
11709,
1027,
9140,
1006,
1007,
1025,
1065,
2842,
10128,
1006,
999,
2003,
1035,
9140,
1006,
1002,
11709,
1007,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/BrowserKit/Client.php | Client.requestFromRequest | protected function requestFromRequest(Request $request, $changeHistory = true)
{
return $this->request($request->getMethod(), $request->getUri(), $request->getParameters(), $request->getFiles(), $request->getServer(), $request->getContent(), $changeHistory);
} | php | protected function requestFromRequest(Request $request, $changeHistory = true)
{
return $this->request($request->getMethod(), $request->getUri(), $request->getParameters(), $request->getFiles(), $request->getServer(), $request->getContent(), $changeHistory);
} | [
"protected",
"function",
"requestFromRequest",
"(",
"Request",
"$",
"request",
",",
"$",
"changeHistory",
"=",
"true",
")",
"{",
"return",
"$",
"this",
"->",
"request",
"(",
"$",
"request",
"->",
"getMethod",
"(",
")",
",",
"$",
"request",
"->",
"getUri",
... | Makes a request from a Request object directly.
@param Request $request A Request instance
@param bool $changeHistory Whether to update the history or not (only used internally for back(), forward(), and reload())
@return Crawler | [
"Makes",
"a",
"request",
"from",
"a",
"Request",
"object",
"directly",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/BrowserKit/Client.php#L713-L716 | train | Request from Request | [
30522,
5123,
3853,
5227,
19699,
5358,
2890,
15500,
1006,
5227,
1002,
5227,
1010,
1002,
2689,
24158,
7062,
1027,
2995,
1007,
1063,
2709,
1002,
2023,
1011,
1028,
5227,
1006,
1002,
5227,
1011,
1028,
2131,
11368,
6806,
2094,
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... |
php-ai/php-ml | src/DimensionReduction/LDA.php | LDA.transform | public function transform(array $sample): array
{
if (!$this->fit) {
throw new InvalidOperationException('LDA has not been fitted with respect to original dataset, please run LDA::fit() first');
}
if (!is_array($sample[0])) {
$sample = [$sample];
}
return $this->reduce($sample);
} | php | public function transform(array $sample): array
{
if (!$this->fit) {
throw new InvalidOperationException('LDA has not been fitted with respect to original dataset, please run LDA::fit() first');
}
if (!is_array($sample[0])) {
$sample = [$sample];
}
return $this->reduce($sample);
} | [
"public",
"function",
"transform",
"(",
"array",
"$",
"sample",
")",
":",
"array",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"fit",
")",
"{",
"throw",
"new",
"InvalidOperationException",
"(",
"'LDA has not been fitted with respect to original dataset, please run LDA::fi... | Transforms the given sample to a lower dimensional vector by using
the eigenVectors obtained in the last run of <code>fit</code>.
@throws InvalidOperationException | [
"Transforms",
"the",
"given",
"sample",
"to",
"a",
"lower",
"dimensional",
"vector",
"by",
"using",
"the",
"eigenVectors",
"obtained",
"in",
"the",
"last",
"run",
"of",
"<code",
">",
"fit<",
"/",
"code",
">",
"."
] | f6aa1a59b0525b8fca3d2786d661ab3e70904016 | https://github.com/php-ai/php-ml/blob/f6aa1a59b0525b8fca3d2786d661ab3e70904016/src/DimensionReduction/LDA.php#L100-L111 | train | Transform a sample into a single level | [
30522,
2270,
3853,
10938,
1006,
9140,
1002,
7099,
1007,
1024,
9140,
1063,
2065,
1006,
999,
1002,
2023,
1011,
1028,
4906,
1007,
1063,
5466,
2047,
19528,
25918,
3370,
10288,
24422,
1006,
1005,
25510,
2050,
2038,
2025,
2042,
7130,
2007,
4847,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/backend/widgets/MediaManager.php | MediaManager.onResizeImage | public function onResizeImage()
{
$this->abortIfReadOnly();
$cropSessionKey = Input::get('cropSessionKey');
if (!preg_match('/^[0-9a-z]+$/', $cropSessionKey)) {
throw new ApplicationException('Invalid input data');
}
$width = trim(Input::get('width'));
if (!strlen($width) || !ctype_digit($width)) {
throw new ApplicationException('Invalid input data');
}
$height = trim(Input::get('height'));
if (!strlen($height) || !ctype_digit($height)) {
throw new ApplicationException('Invalid input data');
}
$path = Input::get('path');
$path = MediaLibrary::validatePath($path);
$params = array(
'width' => $width,
'height' => $height
);
return $this->getCropEditImageUrlAndSize($path, $cropSessionKey, $params);
} | php | public function onResizeImage()
{
$this->abortIfReadOnly();
$cropSessionKey = Input::get('cropSessionKey');
if (!preg_match('/^[0-9a-z]+$/', $cropSessionKey)) {
throw new ApplicationException('Invalid input data');
}
$width = trim(Input::get('width'));
if (!strlen($width) || !ctype_digit($width)) {
throw new ApplicationException('Invalid input data');
}
$height = trim(Input::get('height'));
if (!strlen($height) || !ctype_digit($height)) {
throw new ApplicationException('Invalid input data');
}
$path = Input::get('path');
$path = MediaLibrary::validatePath($path);
$params = array(
'width' => $width,
'height' => $height
);
return $this->getCropEditImageUrlAndSize($path, $cropSessionKey, $params);
} | [
"public",
"function",
"onResizeImage",
"(",
")",
"{",
"$",
"this",
"->",
"abortIfReadOnly",
"(",
")",
";",
"$",
"cropSessionKey",
"=",
"Input",
"::",
"get",
"(",
"'cropSessionKey'",
")",
";",
"if",
"(",
"!",
"preg_match",
"(",
"'/^[0-9a-z]+$/'",
",",
"$",
... | Resize image AJAX handler
@return array | [
"Resize",
"image",
"AJAX",
"handler"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/MediaManager.php#L778-L806 | train | Resizes an image | [
30522,
2270,
3853,
2006,
6072,
4697,
9581,
3351,
1006,
1007,
1063,
1002,
2023,
1011,
1028,
11113,
11589,
10128,
16416,
5280,
2135,
1006,
1007,
1025,
1002,
8765,
7971,
3258,
14839,
1027,
7953,
1024,
1024,
2131,
1006,
1005,
8765,
7971,
3258,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Console/Gpm/InstallCommand.php | InstallCommand.askConfirmationIfMajorVersionUpdated | public function askConfirmationIfMajorVersionUpdated($package)
{
$helper = $this->getHelper('question');
$package_name = $package->name;
$new_version = $package->available ?: $this->gpm->getLatestVersionOfPackage($package->slug);
$old_version = $package->version;
$major_version_changed = explode('.', $new_version)[0] !== explode('.', $old_version)[0];
if ($major_version_changed) {
if ($this->all_yes) {
$this->output->writeln("The package <cyan>{$package_name}</cyan> will be updated to a new major version <green>{$new_version}</green>, from <magenta>{$old_version}</magenta>");
return;
}
$question = new ConfirmationQuestion("The package <cyan>{$package_name}</cyan> will be updated to a new major version <green>{$new_version}</green>, from <magenta>{$old_version}</magenta>. Be sure to read what changed with the new major release. Continue? [y|N] ", false);
if (!$helper->ask($this->input, $this->output, $question)) {
$this->output->writeln("<yellow>Package {$package_name} not updated</yellow>");
exit;
}
}
} | php | public function askConfirmationIfMajorVersionUpdated($package)
{
$helper = $this->getHelper('question');
$package_name = $package->name;
$new_version = $package->available ?: $this->gpm->getLatestVersionOfPackage($package->slug);
$old_version = $package->version;
$major_version_changed = explode('.', $new_version)[0] !== explode('.', $old_version)[0];
if ($major_version_changed) {
if ($this->all_yes) {
$this->output->writeln("The package <cyan>{$package_name}</cyan> will be updated to a new major version <green>{$new_version}</green>, from <magenta>{$old_version}</magenta>");
return;
}
$question = new ConfirmationQuestion("The package <cyan>{$package_name}</cyan> will be updated to a new major version <green>{$new_version}</green>, from <magenta>{$old_version}</magenta>. Be sure to read what changed with the new major release. Continue? [y|N] ", false);
if (!$helper->ask($this->input, $this->output, $question)) {
$this->output->writeln("<yellow>Package {$package_name} not updated</yellow>");
exit;
}
}
} | [
"public",
"function",
"askConfirmationIfMajorVersionUpdated",
"(",
"$",
"package",
")",
"{",
"$",
"helper",
"=",
"$",
"this",
"->",
"getHelper",
"(",
"'question'",
")",
";",
"$",
"package_name",
"=",
"$",
"package",
"->",
"name",
";",
"$",
"new_version",
"="... | If the package is updated from an older major release, show warning and ask confirmation
@param Package $package | [
"If",
"the",
"package",
"is",
"updated",
"from",
"an",
"older",
"major",
"release",
"show",
"warning",
"and",
"ask",
"confirmation"
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Console/Gpm/InstallCommand.php#L235-L257 | train | Ask confirmation if the package has a major release version. | [
30522,
2270,
3853,
3198,
8663,
27972,
3370,
10128,
2863,
5558,
2099,
27774,
6279,
13701,
2094,
1006,
1002,
7427,
1007,
1063,
1002,
2393,
2121,
1027,
1002,
2023,
1011,
1028,
2131,
16001,
4842,
1006,
1005,
3160,
1005,
1007,
1025,
1002,
7427,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/Zend/Db/Table/Abstract.php | Zend_Db_Table_Abstract._cascadeDelete | public function _cascadeDelete($parentTableClassname, array $primaryKey)
{
$this->_setupMetadata();
$rowsAffected = 0;
foreach ($this->_getReferenceMapNormalized() as $map) {
if ($map[self::REF_TABLE_CLASS] == $parentTableClassname && isset($map[self::ON_DELETE])) {
switch ($map[self::ON_DELETE]) {
case self::CASCADE:
$where = array();
for ($i = 0; $i < count($map[self::COLUMNS]); ++$i) {
$col = $this->_db->foldCase($map[self::COLUMNS][$i]);
$refCol = $this->_db->foldCase($map[self::REF_COLUMNS][$i]);
$type = $this->_metadata[$col]['DATA_TYPE'];
$where[] = $this->_db->quoteInto(
$this->_db->quoteIdentifier($col, true) . ' = ?',
$primaryKey[$refCol], $type);
}
$rowsAffected += $this->delete($where);
break;
default:
// no action
break;
}
}
}
return $rowsAffected;
} | php | public function _cascadeDelete($parentTableClassname, array $primaryKey)
{
$this->_setupMetadata();
$rowsAffected = 0;
foreach ($this->_getReferenceMapNormalized() as $map) {
if ($map[self::REF_TABLE_CLASS] == $parentTableClassname && isset($map[self::ON_DELETE])) {
switch ($map[self::ON_DELETE]) {
case self::CASCADE:
$where = array();
for ($i = 0; $i < count($map[self::COLUMNS]); ++$i) {
$col = $this->_db->foldCase($map[self::COLUMNS][$i]);
$refCol = $this->_db->foldCase($map[self::REF_COLUMNS][$i]);
$type = $this->_metadata[$col]['DATA_TYPE'];
$where[] = $this->_db->quoteInto(
$this->_db->quoteIdentifier($col, true) . ' = ?',
$primaryKey[$refCol], $type);
}
$rowsAffected += $this->delete($where);
break;
default:
// no action
break;
}
}
}
return $rowsAffected;
} | [
"public",
"function",
"_cascadeDelete",
"(",
"$",
"parentTableClassname",
",",
"array",
"$",
"primaryKey",
")",
"{",
"$",
"this",
"->",
"_setupMetadata",
"(",
")",
";",
"$",
"rowsAffected",
"=",
"0",
";",
"foreach",
"(",
"$",
"this",
"->",
"_getReferenceMapN... | Called by parent table's class during delete() method.
@param string $parentTableClassname
@param array $primaryKey
@return int Number of affected rows | [
"Called",
"by",
"parent",
"table",
"s",
"class",
"during",
"delete",
"()",
"method",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Table/Abstract.php#L1194-L1220 | train | Causes all foreign keys of the parent table from all columns of the parent table that are referenced by the parent table. | [
30522,
2270,
3853,
1035,
16690,
9247,
12870,
1006,
1002,
6687,
10880,
26266,
18442,
1010,
9140,
1002,
3078,
14839,
1007,
1063,
1002,
2023,
1011,
1028,
1035,
16437,
11368,
8447,
2696,
1006,
1007,
1025,
1002,
10281,
10354,
25969,
2098,
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/Storage/Factory.php | Factory.getPluginStorage | public function getPluginStorage($pluginName, $userLogin)
{
$id = $pluginName . '#' . $userLogin;
if (!isset($this->cache[$id])) {
$backend = new Backend\PluginSettingsTable($pluginName, $userLogin);
$this->cache[$id] = $this->makeStorage($backend);
}
return $this->cache[$id];
} | php | public function getPluginStorage($pluginName, $userLogin)
{
$id = $pluginName . '#' . $userLogin;
if (!isset($this->cache[$id])) {
$backend = new Backend\PluginSettingsTable($pluginName, $userLogin);
$this->cache[$id] = $this->makeStorage($backend);
}
return $this->cache[$id];
} | [
"public",
"function",
"getPluginStorage",
"(",
"$",
"pluginName",
",",
"$",
"userLogin",
")",
"{",
"$",
"id",
"=",
"$",
"pluginName",
".",
"'#'",
".",
"$",
"userLogin",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"cache",
"[",
"$",
"id",
... | Get a storage instance for plugin settings.
The storage will hold values that belong to the given plugin name and user login. Be aware that instances
for a specific plugin and login will be cached during one request for better performance.
@param string $pluginName
@param string $userLogin Use an empty string if settings should be not for a specific login
@return Storage | [
"Get",
"a",
"storage",
"instance",
"for",
"plugin",
"settings",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Settings/Storage/Factory.php#L35-L45 | train | Get Plugin Settings Table Storage | [
30522,
2270,
3853,
2131,
24759,
15916,
7076,
4263,
4270,
1006,
1002,
13354,
23111,
14074,
1010,
1002,
5310,
21197,
2378,
1007,
1063,
1002,
8909,
1027,
1002,
13354,
23111,
14074,
1012,
1005,
1001,
1005,
1012,
1002,
5310,
21197,
2378,
1025,
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... |
symfony/symfony | src/Symfony/Component/Translation/Dumper/FileDumper.php | FileDumper.dump | public function dump(MessageCatalogue $messages, $options = [])
{
if (!\array_key_exists('path', $options)) {
throw new InvalidArgumentException('The file dumper needs a path option.');
}
// save a file for each domain
foreach ($messages->getDomains() as $domain) {
$fullpath = $options['path'].'/'.$this->getRelativePath($domain, $messages->getLocale());
if (!file_exists($fullpath)) {
$directory = \dirname($fullpath);
if (!file_exists($directory) && !@mkdir($directory, 0777, true)) {
throw new RuntimeException(sprintf('Unable to create directory "%s".', $directory));
}
}
$intlDomain = $domain.MessageCatalogue::INTL_DOMAIN_SUFFIX;
$intlMessages = $messages->all($intlDomain);
if ($intlMessages) {
$intlPath = $options['path'].'/'.$this->getRelativePath($intlDomain, $messages->getLocale());
file_put_contents($intlPath, $this->formatCatalogue($messages, $intlDomain, $options));
$messages->replace([], $intlDomain);
try {
if ($messages->all($domain)) {
file_put_contents($fullpath, $this->formatCatalogue($messages, $domain, $options));
}
continue;
} finally {
$messages->replace($intlMessages, $intlDomain);
}
}
file_put_contents($fullpath, $this->formatCatalogue($messages, $domain, $options));
}
} | php | public function dump(MessageCatalogue $messages, $options = [])
{
if (!\array_key_exists('path', $options)) {
throw new InvalidArgumentException('The file dumper needs a path option.');
}
// save a file for each domain
foreach ($messages->getDomains() as $domain) {
$fullpath = $options['path'].'/'.$this->getRelativePath($domain, $messages->getLocale());
if (!file_exists($fullpath)) {
$directory = \dirname($fullpath);
if (!file_exists($directory) && !@mkdir($directory, 0777, true)) {
throw new RuntimeException(sprintf('Unable to create directory "%s".', $directory));
}
}
$intlDomain = $domain.MessageCatalogue::INTL_DOMAIN_SUFFIX;
$intlMessages = $messages->all($intlDomain);
if ($intlMessages) {
$intlPath = $options['path'].'/'.$this->getRelativePath($intlDomain, $messages->getLocale());
file_put_contents($intlPath, $this->formatCatalogue($messages, $intlDomain, $options));
$messages->replace([], $intlDomain);
try {
if ($messages->all($domain)) {
file_put_contents($fullpath, $this->formatCatalogue($messages, $domain, $options));
}
continue;
} finally {
$messages->replace($intlMessages, $intlDomain);
}
}
file_put_contents($fullpath, $this->formatCatalogue($messages, $domain, $options));
}
} | [
"public",
"function",
"dump",
"(",
"MessageCatalogue",
"$",
"messages",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"\\",
"array_key_exists",
"(",
"'path'",
",",
"$",
"options",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Translation/Dumper/FileDumper.php#L64-L101 | train | Dump the message catalogue to a file | [
30522,
2270,
3853,
15653,
1006,
4471,
11266,
23067,
9077,
1002,
7696,
1010,
1002,
7047,
1027,
1031,
1033,
1007,
1063,
2065,
1006,
999,
1032,
9140,
1035,
3145,
1035,
6526,
1006,
1005,
4130,
1005,
1010,
1002,
7047,
1007,
1007,
1063,
5466,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
z-song/laravel-admin | src/Grid/Tools.php | Tools.disableFilterButton | public function disableFilterButton(bool $disable = true)
{
$this->tools = $this->tools->map(function ($tool) use ($disable) {
if ($tool instanceof FilterButton) {
return $tool->disable($disable);
}
return $tool;
});
} | php | public function disableFilterButton(bool $disable = true)
{
$this->tools = $this->tools->map(function ($tool) use ($disable) {
if ($tool instanceof FilterButton) {
return $tool->disable($disable);
}
return $tool;
});
} | [
"public",
"function",
"disableFilterButton",
"(",
"bool",
"$",
"disable",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"tools",
"=",
"$",
"this",
"->",
"tools",
"->",
"map",
"(",
"function",
"(",
"$",
"tool",
")",
"use",
"(",
"$",
"disable",
")",
"{",
... | Disable filter button.
@return void | [
"Disable",
"filter",
"button",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid/Tools.php#L86-L95 | train | Disable filter button | [
30522,
2270,
3853,
4487,
19150,
8873,
21928,
8569,
15474,
1006,
22017,
2140,
1002,
4487,
19150,
1027,
2995,
1007,
1063,
1002,
2023,
1011,
1028,
5906,
1027,
1002,
2023,
1011,
1028,
5906,
1011,
1028,
4949,
1006,
3853,
1006,
1002,
6994,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/cms/classes/CmsCompoundObject.php | CmsCompoundObject.runComponents | public function runComponents()
{
foreach ($this->components as $component) {
if ($event = $component->fireEvent('component.beforeRun', [], true)) {
return $event;
}
if ($result = $component->onRun()) {
return $result;
}
if ($event = $component->fireEvent('component.run', [], true)) {
return $event;
}
}
} | php | public function runComponents()
{
foreach ($this->components as $component) {
if ($event = $component->fireEvent('component.beforeRun', [], true)) {
return $event;
}
if ($result = $component->onRun()) {
return $result;
}
if ($event = $component->fireEvent('component.run', [], true)) {
return $event;
}
}
} | [
"public",
"function",
"runComponents",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"components",
"as",
"$",
"component",
")",
"{",
"if",
"(",
"$",
"event",
"=",
"$",
"component",
"->",
"fireEvent",
"(",
"'component.beforeRun'",
",",
"[",
"]",
",",
... | Runs components defined in the settings
Process halts if a component returns a value
@return void | [
"Runs",
"components",
"defined",
"in",
"the",
"settings",
"Process",
"halts",
"if",
"a",
"component",
"returns",
"a",
"value"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/CmsCompoundObject.php#L165-L180 | train | Runs all components in the hierarchy | [
30522,
2270,
3853,
2448,
9006,
29513,
7666,
1006,
1007,
1063,
18921,
6776,
1006,
1002,
2023,
1011,
1028,
6177,
2004,
1002,
6922,
1007,
1063,
2065,
1006,
1002,
2724,
1027,
1002,
6922,
1011,
1028,
2543,
18697,
3372,
1006,
1005,
6922,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Container/Container.php | Container.call | public function call($callback, array $parameters = [], $defaultMethod = null)
{
return BoundMethod::call($this, $callback, $parameters, $defaultMethod);
} | php | public function call($callback, array $parameters = [], $defaultMethod = null)
{
return BoundMethod::call($this, $callback, $parameters, $defaultMethod);
} | [
"public",
"function",
"call",
"(",
"$",
"callback",
",",
"array",
"$",
"parameters",
"=",
"[",
"]",
",",
"$",
"defaultMethod",
"=",
"null",
")",
"{",
"return",
"BoundMethod",
"::",
"call",
"(",
"$",
"this",
",",
"$",
"callback",
",",
"$",
"parameters",... | Call the given Closure / class@method and inject its dependencies.
@param callable|string $callback
@param array $parameters
@param string|null $defaultMethod
@return mixed | [
"Call",
"the",
"given",
"Closure",
"/",
"class@method",
"and",
"inject",
"its",
"dependencies",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Container/Container.php#L574-L577 | train | Call the given callback with parameters | [
30522,
2270,
3853,
2655,
1006,
1002,
2655,
5963,
1010,
9140,
1002,
11709,
1027,
1031,
1033,
1010,
1002,
12398,
11368,
6806,
2094,
1027,
19701,
1007,
1063,
2709,
5391,
11368,
6806,
2094,
1024,
1024,
2655,
1006,
1002,
2023,
1010,
1002,
2655,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
ccxt/ccxt | php/Exchange.php | Exchange.throttle | public function throttle () {
$now = $this->milliseconds ();
$elapsed = $now - $this->lastRestRequestTimestamp;
if ($elapsed < $this->rateLimit) {
$delay = $this->rateLimit - $elapsed;
usleep ((int)($delay * 1000.0));
}
} | php | public function throttle () {
$now = $this->milliseconds ();
$elapsed = $now - $this->lastRestRequestTimestamp;
if ($elapsed < $this->rateLimit) {
$delay = $this->rateLimit - $elapsed;
usleep ((int)($delay * 1000.0));
}
} | [
"public",
"function",
"throttle",
"(",
")",
"{",
"$",
"now",
"=",
"$",
"this",
"->",
"milliseconds",
"(",
")",
";",
"$",
"elapsed",
"=",
"$",
"now",
"-",
"$",
"this",
"->",
"lastRestRequestTimestamp",
";",
"if",
"(",
"$",
"elapsed",
"<",
"$",
"this",... | this method is experimental | [
"this",
"method",
"is",
"experimental"
] | 0113da333a51acded0b44d9528809bbf654acfbd | https://github.com/ccxt/ccxt/blob/0113da333a51acded0b44d9528809bbf654acfbd/php/Exchange.php#L1019-L1026 | train | This method is used to throttle requests. | [
30522,
2270,
3853,
24420,
1006,
1007,
1063,
1002,
2085,
1027,
1002,
2023,
1011,
1028,
4971,
5562,
8663,
5104,
1006,
1007,
1025,
1002,
3449,
9331,
6924,
1027,
1002,
2085,
1011,
1002,
2023,
1011,
1028,
2197,
28533,
2890,
15500,
7292,
9153,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/system/classes/MediaLibrary.php | MediaLibrary.findFiles | public function findFiles($searchTerm, $sortBy = 'title', $filter = null)
{
$words = explode(' ', Str::lower($searchTerm));
$result = [];
$findInFolder = function ($folder) use (&$findInFolder, $words, &$result, $sortBy, $filter) {
$folderContents = $this->listFolderContents($folder, $sortBy, $filter);
foreach ($folderContents as $item) {
if ($item->type == MediaLibraryItem::TYPE_FOLDER) {
$findInFolder($item->path);
}
elseif ($this->pathMatchesSearch($item->path, $words)) {
$result[] = $item;
}
}
};
$findInFolder('/');
/*
* Sort the result
*/
if ($sortBy !== false) {
$this->sortItemList($result, $sortBy);
}
return $result;
} | php | public function findFiles($searchTerm, $sortBy = 'title', $filter = null)
{
$words = explode(' ', Str::lower($searchTerm));
$result = [];
$findInFolder = function ($folder) use (&$findInFolder, $words, &$result, $sortBy, $filter) {
$folderContents = $this->listFolderContents($folder, $sortBy, $filter);
foreach ($folderContents as $item) {
if ($item->type == MediaLibraryItem::TYPE_FOLDER) {
$findInFolder($item->path);
}
elseif ($this->pathMatchesSearch($item->path, $words)) {
$result[] = $item;
}
}
};
$findInFolder('/');
/*
* Sort the result
*/
if ($sortBy !== false) {
$this->sortItemList($result, $sortBy);
}
return $result;
} | [
"public",
"function",
"findFiles",
"(",
"$",
"searchTerm",
",",
"$",
"sortBy",
"=",
"'title'",
",",
"$",
"filter",
"=",
"null",
")",
"{",
"$",
"words",
"=",
"explode",
"(",
"' '",
",",
"Str",
"::",
"lower",
"(",
"$",
"searchTerm",
")",
")",
";",
"$... | Finds files in the Library.
@param string $searchTerm Specifies the search term.
@param mixed $sortBy Determines the sorting preference.
Supported values are 'title', 'size', 'lastModified' (see SORT_BY_XXX class constants), FALSE (to disable sorting), or an associative array with a 'by' key and a 'direction' key: ['by' => SORT_BY_XXX, 'direction' => SORT_DIRECTION_XXX].
@param string $filter Determines the document type filtering preference.
Supported values are 'image', 'video', 'audio', 'document' (see FILE_TYPE_XXX constants of MediaLibraryItem class).
@return array Returns an array of MediaLibraryItem objects. | [
"Finds",
"files",
"in",
"the",
"Library",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/MediaLibrary.php#L174-L203 | train | Find files in the folder with the specified search term | [
30522,
2270,
3853,
2424,
8873,
4244,
1006,
1002,
3945,
3334,
2213,
1010,
1002,
4066,
3762,
1027,
1005,
2516,
1005,
1010,
1002,
11307,
1027,
19701,
1007,
1063,
1002,
2616,
1027,
15044,
1006,
1005,
1005,
1010,
2358,
2099,
1024,
1024,
2896,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/system/ServiceProvider.php | ServiceProvider.registerBackendReportWidgets | protected function registerBackendReportWidgets()
{
WidgetManager::instance()->registerReportWidgets(function ($manager) {
$manager->registerReportWidget(\System\ReportWidgets\Status::class, [
'label' => 'backend::lang.dashboard.status.widget_title_default',
'context' => 'dashboard'
]);
});
} | php | protected function registerBackendReportWidgets()
{
WidgetManager::instance()->registerReportWidgets(function ($manager) {
$manager->registerReportWidget(\System\ReportWidgets\Status::class, [
'label' => 'backend::lang.dashboard.status.widget_title_default',
'context' => 'dashboard'
]);
});
} | [
"protected",
"function",
"registerBackendReportWidgets",
"(",
")",
"{",
"WidgetManager",
"::",
"instance",
"(",
")",
"->",
"registerReportWidgets",
"(",
"function",
"(",
"$",
"manager",
")",
"{",
"$",
"manager",
"->",
"registerReportWidget",
"(",
"\\",
"System",
... | /*
Register report widgets | [
"/",
"*",
"Register",
"report",
"widgets"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/ServiceProvider.php#L381-L389 | train | Registers status widgets | [
30522,
5123,
3853,
4236,
5963,
10497,
2890,
6442,
9148,
28682,
1006,
1007,
1063,
15536,
24291,
24805,
4590,
1024,
1024,
6013,
1006,
1007,
1011,
1028,
4236,
2890,
6442,
9148,
28682,
1006,
3853,
1006,
1002,
3208,
1007,
1063,
1002,
3208,
1011,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php | XmlFileLoader.load | public function load($resource, $type = null)
{
$path = $this->locator->locate($resource);
$xml = $this->parseFileToDOM($path);
$this->container->fileExists($path);
$defaults = $this->getServiceDefaults($xml, $path);
// anonymous services
$this->processAnonymousServices($xml, $path, $defaults);
// imports
$this->parseImports($xml, $path);
// parameters
$this->parseParameters($xml, $path);
// extensions
$this->loadFromExtensions($xml);
// services
try {
$this->parseDefinitions($xml, $path, $defaults);
} finally {
$this->instanceof = [];
}
} | php | public function load($resource, $type = null)
{
$path = $this->locator->locate($resource);
$xml = $this->parseFileToDOM($path);
$this->container->fileExists($path);
$defaults = $this->getServiceDefaults($xml, $path);
// anonymous services
$this->processAnonymousServices($xml, $path, $defaults);
// imports
$this->parseImports($xml, $path);
// parameters
$this->parseParameters($xml, $path);
// extensions
$this->loadFromExtensions($xml);
// services
try {
$this->parseDefinitions($xml, $path, $defaults);
} finally {
$this->instanceof = [];
}
} | [
"public",
"function",
"load",
"(",
"$",
"resource",
",",
"$",
"type",
"=",
"null",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"locator",
"->",
"locate",
"(",
"$",
"resource",
")",
";",
"$",
"xml",
"=",
"$",
"this",
"->",
"parseFileToDOM",
"(",
... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php#L42-L70 | train | Loads the content of a resource | [
30522,
2270,
3853,
7170,
1006,
1002,
7692,
1010,
1002,
2828,
1027,
19701,
1007,
1063,
1002,
4130,
1027,
1002,
2023,
1011,
1028,
8840,
11266,
2953,
1011,
1028,
12453,
1006,
1002,
7692,
1007,
1025,
1002,
20950,
1027,
1002,
2023,
1011,
1028,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Routing/RouteCollection.php | RouteCollection.addDefaults | public function addDefaults(array $defaults)
{
if ($defaults) {
foreach ($this->routes as $route) {
$route->addDefaults($defaults);
}
}
} | php | public function addDefaults(array $defaults)
{
if ($defaults) {
foreach ($this->routes as $route) {
$route->addDefaults($defaults);
}
}
} | [
"public",
"function",
"addDefaults",
"(",
"array",
"$",
"defaults",
")",
"{",
"if",
"(",
"$",
"defaults",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"routes",
"as",
"$",
"route",
")",
"{",
"$",
"route",
"->",
"addDefaults",
"(",
"$",
"defaults",
")... | Adds defaults to all routes.
An existing default value under the same name in a route will be overridden.
@param array $defaults An array of default values | [
"Adds",
"defaults",
"to",
"all",
"routes",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Routing/RouteCollection.php#L210-L217 | train | Adds default values to all routes | [
30522,
2270,
3853,
5587,
3207,
7011,
11314,
2015,
1006,
9140,
1002,
12398,
2015,
1007,
1063,
2065,
1006,
1002,
12398,
2015,
1007,
1063,
18921,
6776,
1006,
1002,
2023,
1011,
1028,
5847,
2004,
1002,
2799,
1007,
1063,
1002,
2799,
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/Config/Definition/Builder/IntegerNodeDefinition.php | IntegerNodeDefinition.instantiateNode | protected function instantiateNode()
{
return new IntegerNode($this->name, $this->parent, $this->min, $this->max, $this->pathSeparator);
} | php | protected function instantiateNode()
{
return new IntegerNode($this->name, $this->parent, $this->min, $this->max, $this->pathSeparator);
} | [
"protected",
"function",
"instantiateNode",
"(",
")",
"{",
"return",
"new",
"IntegerNode",
"(",
"$",
"this",
"->",
"name",
",",
"$",
"this",
"->",
"parent",
",",
"$",
"this",
"->",
"min",
",",
"$",
"this",
"->",
"max",
",",
"$",
"this",
"->",
"pathSe... | Instantiates a Node.
@return IntegerNode The node | [
"Instantiates",
"a",
"Node",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Config/Definition/Builder/IntegerNodeDefinition.php#L28-L31 | train | Instantiates IntegerNode | [
30522,
5123,
3853,
7107,
13143,
3630,
3207,
1006,
1007,
1063,
2709,
2047,
16109,
3630,
3207,
1006,
1002,
2023,
1011,
1028,
2171,
1010,
1002,
2023,
1011,
1028,
6687,
1010,
1002,
2023,
1011,
1028,
8117,
1010,
1002,
2023,
1011,
1028,
4098,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Intl/Intl.php | Intl.getLanguageBundle | public static function getLanguageBundle()
{
@trigger_error(sprintf('The method "%s()" is deprecated since Symfony 4.3, use "%s" or "%s" instead.', __METHOD__, Languages::class, Scripts::class), E_USER_DEPRECATED);
if (null === self::$languageBundle) {
self::$languageBundle = new LanguageBundle(
self::getDataDirectory().'/'.self::LANGUAGE_DIR,
self::getEntryReader(),
self::$localeBundle ?? self::$localeBundle = new LocaleBundle(self::getDataDirectory().'/'.self::LOCALE_DIR, self::getEntryReader()),
new ScriptDataProvider(
self::getDataDirectory().'/'.self::SCRIPT_DIR,
self::getEntryReader()
)
);
}
return self::$languageBundle;
} | php | public static function getLanguageBundle()
{
@trigger_error(sprintf('The method "%s()" is deprecated since Symfony 4.3, use "%s" or "%s" instead.', __METHOD__, Languages::class, Scripts::class), E_USER_DEPRECATED);
if (null === self::$languageBundle) {
self::$languageBundle = new LanguageBundle(
self::getDataDirectory().'/'.self::LANGUAGE_DIR,
self::getEntryReader(),
self::$localeBundle ?? self::$localeBundle = new LocaleBundle(self::getDataDirectory().'/'.self::LOCALE_DIR, self::getEntryReader()),
new ScriptDataProvider(
self::getDataDirectory().'/'.self::SCRIPT_DIR,
self::getEntryReader()
)
);
}
return self::$languageBundle;
} | [
"public",
"static",
"function",
"getLanguageBundle",
"(",
")",
"{",
"@",
"trigger_error",
"(",
"sprintf",
"(",
"'The method \"%s()\" is deprecated since Symfony 4.3, use \"%s\" or \"%s\" instead.'",
",",
"__METHOD__",
",",
"Languages",
"::",
"class",
",",
"Scripts",
"::",
... | Returns the bundle containing language information.
@return LanguageBundleInterface The language resource bundle
@deprecated since Symfony 4.3, to be removed in 5.0. Use {@see Languages} or {@see Scripts} instead. | [
"Returns",
"the",
"bundle",
"containing",
"language",
"information",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Intl/Intl.php#L146-L163 | train | Returns the language bundle | [
30522,
2270,
10763,
3853,
2131,
25023,
6692,
3351,
27265,
2571,
1006,
1007,
1063,
1030,
9495,
1035,
7561,
1006,
9043,
2546,
1006,
1005,
1996,
4118,
1000,
1003,
1055,
1006,
1007,
1000,
2003,
2139,
28139,
12921,
2144,
25353,
2213,
14876,
4890... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Intl/ResourceBundle/CurrencyBundle.php | CurrencyBundle.getCurrencySymbol | public function getCurrencySymbol($currency, $displayLocale = null)
{
try {
return $this->getSymbol($currency, $displayLocale);
} catch (MissingResourceException $e) {
return;
}
} | php | public function getCurrencySymbol($currency, $displayLocale = null)
{
try {
return $this->getSymbol($currency, $displayLocale);
} catch (MissingResourceException $e) {
return;
}
} | [
"public",
"function",
"getCurrencySymbol",
"(",
"$",
"currency",
",",
"$",
"displayLocale",
"=",
"null",
")",
"{",
"try",
"{",
"return",
"$",
"this",
"->",
"getSymbol",
"(",
"$",
"currency",
",",
"$",
"displayLocale",
")",
";",
"}",
"catch",
"(",
"Missin... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Intl/ResourceBundle/CurrencyBundle.php#L40-L47 | train | Get Currency Symbol | [
30522,
2270,
3853,
2131,
10841,
14343,
9407,
6508,
13344,
2140,
1006,
1002,
9598,
1010,
1002,
4653,
4135,
9289,
2063,
1027,
19701,
1007,
1063,
3046,
1063,
2709,
1002,
2023,
1011,
1028,
4152,
24335,
14956,
1006,
1002,
9598,
1010,
1002,
4653,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.getActionRow | public static function getActionRow($actionName, $actionType, $urlPrefix = null, &$actionsTablesByType)
{
// we work on the root table of the given TYPE (either ACTION_URL or DOWNLOAD or OUTLINK etc.)
/* @var DataTable $currentTable */
$currentTable =& $actionsTablesByType[$actionType];
if (is_null($currentTable)) {
throw new \Exception("Action table for type '$actionType' was not found during Actions archiving.");
}
// check for ranking query cut-off
if ($actionName == DataTable::LABEL_SUMMARY_ROW) {
$summaryRow = $currentTable->getRowFromId(DataTable::ID_SUMMARY_ROW);
if ($summaryRow === false) {
$summaryRow = $currentTable->addSummaryRow(self::createSummaryRow());
}
return $summaryRow;
}
// go to the level of the subcategory
$actionExplodedNames = self::getActionExplodedNames($actionName, $actionType, $urlPrefix);
list($row, $level) = $currentTable->walkPath(
$actionExplodedNames, self::getDefaultRowColumns(), self::$maximumRowsInSubDataTable);
return $row;
} | php | public static function getActionRow($actionName, $actionType, $urlPrefix = null, &$actionsTablesByType)
{
// we work on the root table of the given TYPE (either ACTION_URL or DOWNLOAD or OUTLINK etc.)
/* @var DataTable $currentTable */
$currentTable =& $actionsTablesByType[$actionType];
if (is_null($currentTable)) {
throw new \Exception("Action table for type '$actionType' was not found during Actions archiving.");
}
// check for ranking query cut-off
if ($actionName == DataTable::LABEL_SUMMARY_ROW) {
$summaryRow = $currentTable->getRowFromId(DataTable::ID_SUMMARY_ROW);
if ($summaryRow === false) {
$summaryRow = $currentTable->addSummaryRow(self::createSummaryRow());
}
return $summaryRow;
}
// go to the level of the subcategory
$actionExplodedNames = self::getActionExplodedNames($actionName, $actionType, $urlPrefix);
list($row, $level) = $currentTable->walkPath(
$actionExplodedNames, self::getDefaultRowColumns(), self::$maximumRowsInSubDataTable);
return $row;
} | [
"public",
"static",
"function",
"getActionRow",
"(",
"$",
"actionName",
",",
"$",
"actionType",
",",
"$",
"urlPrefix",
"=",
"null",
",",
"&",
"$",
"actionsTablesByType",
")",
"{",
"// we work on the root table of the given TYPE (either ACTION_URL or DOWNLOAD or OUTLINK etc.... | Given a page name and type, builds a recursive datatable where
each level of the tree is a category, based on the page name split by a delimiter (slash / by default)
@param string $actionName
@param int $actionType
@param int $urlPrefix
@param array $actionsTablesByType
@return DataTable | [
"Given",
"a",
"page",
"name",
"and",
"type",
"builds",
"a",
"recursive",
"datatable",
"where",
"each",
"level",
"of",
"the",
"tree",
"is",
"a",
"category",
"based",
"on",
"the",
"page",
"name",
"split",
"by",
"a",
"delimiter",
"(",
"slash",
"/",
"by",
... | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Actions/ArchivingHelper.php#L373-L398 | train | Get the action row | [
30522,
2270,
10763,
3853,
2131,
18908,
3258,
10524,
1006,
1002,
2895,
18442,
1010,
1002,
2895,
13874,
1010,
1002,
24471,
14277,
2890,
8873,
2595,
1027,
19701,
1010,
1004,
1002,
4506,
10880,
14478,
13874,
1007,
1063,
1013,
1013,
2057,
2147,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Adapter/CPDF.php | CPDF._set_line_style | protected function _set_line_style($width, $cap, $join, $dash)
{
$this->_pdf->setLineStyle($width, $cap, $join, $dash);
} | php | protected function _set_line_style($width, $cap, $join, $dash)
{
$this->_pdf->setLineStyle($width, $cap, $join, $dash);
} | [
"protected",
"function",
"_set_line_style",
"(",
"$",
"width",
",",
"$",
"cap",
",",
"$",
"join",
",",
"$",
"dash",
")",
"{",
"$",
"this",
"->",
"_pdf",
"->",
"setLineStyle",
"(",
"$",
"width",
",",
"$",
"cap",
",",
"$",
"join",
",",
"$",
"dash",
... | Sets the line style
@see Cpdf::setLineStyle()
@param float $width
@param string $cap
@param string $join
@param array $dash | [
"Sets",
"the",
"line",
"style"
] | 75f13c700009be21a1965dc2c5b68a8708c22ba2 | https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/src/Adapter/CPDF.php#L508-L511 | train | Set Line Style | [
30522,
5123,
3853,
1035,
2275,
1035,
2240,
1035,
2806,
1006,
1002,
9381,
1010,
1002,
6178,
1010,
1002,
3693,
1010,
1002,
11454,
1007,
1063,
1002,
2023,
1011,
1028,
1035,
11135,
1011,
1028,
2275,
12735,
27983,
1006,
1002,
9381,
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... |
matomo-org/matomo | core/Tracker/Db/Pdo/Mysql.php | Mysql.commit | public function commit($xid)
{
if ($this->activeTransaction != $xid || $this->activeTransaction === false) {
return;
}
$this->activeTransaction = false;
if (!$this->connection->commit()) {
throw new DbException("Commit failed");
}
} | php | public function commit($xid)
{
if ($this->activeTransaction != $xid || $this->activeTransaction === false) {
return;
}
$this->activeTransaction = false;
if (!$this->connection->commit()) {
throw new DbException("Commit failed");
}
} | [
"public",
"function",
"commit",
"(",
"$",
"xid",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"activeTransaction",
"!=",
"$",
"xid",
"||",
"$",
"this",
"->",
"activeTransaction",
"===",
"false",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"activeTransa... | Commit Transaction
@param $xid
@throws DbException
@internal param TransactionID $string from beginTransaction | [
"Commit",
"Transaction"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Tracker/Db/Pdo/Mysql.php#L302-L313 | train | Commit a transaction | [
30522,
2270,
3853,
10797,
1006,
1002,
8418,
2094,
1007,
1063,
2065,
1006,
1002,
2023,
1011,
1028,
3161,
6494,
3619,
18908,
3258,
999,
1027,
1002,
8418,
2094,
1064,
1064,
1002,
2023,
1011,
1028,
3161,
6494,
3619,
18908,
3258,
1027,
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... |
laravel/framework | src/Illuminate/Validation/Validator.php | Validator.callClassBasedExtension | protected function callClassBasedExtension($callback, $parameters)
{
[$class, $method] = Str::parseCallback($callback, 'validate');
return call_user_func_array([$this->container->make($class), $method], $parameters);
} | php | protected function callClassBasedExtension($callback, $parameters)
{
[$class, $method] = Str::parseCallback($callback, 'validate');
return call_user_func_array([$this->container->make($class), $method], $parameters);
} | [
"protected",
"function",
"callClassBasedExtension",
"(",
"$",
"callback",
",",
"$",
"parameters",
")",
"{",
"[",
"$",
"class",
",",
"$",
"method",
"]",
"=",
"Str",
"::",
"parseCallback",
"(",
"$",
"callback",
",",
"'validate'",
")",
";",
"return",
"call_us... | Call a class based validator extension.
@param string $callback
@param array $parameters
@return bool | [
"Call",
"a",
"class",
"based",
"validator",
"extension",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Validation/Validator.php#L1163-L1168 | train | Call a class based validation method on the container. | [
30522,
5123,
3853,
2655,
26266,
15058,
3207,
18413,
6132,
3258,
1006,
1002,
2655,
5963,
1010,
1002,
11709,
1007,
1063,
1031,
1002,
2465,
1010,
1002,
4118,
1033,
1027,
2358,
2099,
1024,
1024,
11968,
3366,
9289,
20850,
8684,
1006,
1002,
2655,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Collection.php | Collection.unique | public function unique($key = null, $strict = false)
{
if (! is_null($key)) {
return parent::unique($key, $strict);
}
return new static(array_values($this->getDictionary()));
} | php | public function unique($key = null, $strict = false)
{
if (! is_null($key)) {
return parent::unique($key, $strict);
}
return new static(array_values($this->getDictionary()));
} | [
"public",
"function",
"unique",
"(",
"$",
"key",
"=",
"null",
",",
"$",
"strict",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"key",
")",
")",
"{",
"return",
"parent",
"::",
"unique",
"(",
"$",
"key",
",",
"$",
"strict",
")",
"... | Return only unique items from the collection.
@param string|callable|null $key
@param bool $strict
@return static|\Illuminate\Support\Collection | [
"Return",
"only",
"unique",
"items",
"from",
"the",
"collection",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Collection.php#L336-L343 | train | Unique method. | [
30522,
2270,
3853,
4310,
1006,
1002,
3145,
1027,
19701,
1010,
1002,
9384,
1027,
6270,
1007,
1063,
2065,
1006,
999,
2003,
1035,
19701,
1006,
1002,
3145,
1007,
1007,
1063,
2709,
6687,
1024,
1024,
4310,
1006,
1002,
3145,
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... |
symfony/symfony | src/Symfony/Component/HttpKernel/Kernel.php | Kernel.getKernelParameters | protected function getKernelParameters()
{
$bundles = [];
$bundlesMetadata = [];
foreach ($this->bundles as $name => $bundle) {
$bundles[$name] = \get_class($bundle);
$bundlesMetadata[$name] = [
'path' => $bundle->getPath(),
'namespace' => $bundle->getNamespace(),
];
}
return [
/*
* @deprecated since Symfony 4.2, use kernel.project_dir instead
*/
'kernel.root_dir' => realpath($this->rootDir) ?: $this->rootDir,
'kernel.project_dir' => realpath($this->getProjectDir()) ?: $this->getProjectDir(),
'kernel.environment' => $this->environment,
'kernel.debug' => $this->debug,
/*
* @deprecated since Symfony 4.2
*/
'kernel.name' => $this->name,
'kernel.cache_dir' => realpath($cacheDir = $this->warmupDir ?: $this->getCacheDir()) ?: $cacheDir,
'kernel.logs_dir' => realpath($this->getLogDir()) ?: $this->getLogDir(),
'kernel.bundles' => $bundles,
'kernel.bundles_metadata' => $bundlesMetadata,
'kernel.charset' => $this->getCharset(),
'kernel.container_class' => $this->getContainerClass(),
];
} | php | protected function getKernelParameters()
{
$bundles = [];
$bundlesMetadata = [];
foreach ($this->bundles as $name => $bundle) {
$bundles[$name] = \get_class($bundle);
$bundlesMetadata[$name] = [
'path' => $bundle->getPath(),
'namespace' => $bundle->getNamespace(),
];
}
return [
/*
* @deprecated since Symfony 4.2, use kernel.project_dir instead
*/
'kernel.root_dir' => realpath($this->rootDir) ?: $this->rootDir,
'kernel.project_dir' => realpath($this->getProjectDir()) ?: $this->getProjectDir(),
'kernel.environment' => $this->environment,
'kernel.debug' => $this->debug,
/*
* @deprecated since Symfony 4.2
*/
'kernel.name' => $this->name,
'kernel.cache_dir' => realpath($cacheDir = $this->warmupDir ?: $this->getCacheDir()) ?: $cacheDir,
'kernel.logs_dir' => realpath($this->getLogDir()) ?: $this->getLogDir(),
'kernel.bundles' => $bundles,
'kernel.bundles_metadata' => $bundlesMetadata,
'kernel.charset' => $this->getCharset(),
'kernel.container_class' => $this->getContainerClass(),
];
} | [
"protected",
"function",
"getKernelParameters",
"(",
")",
"{",
"$",
"bundles",
"=",
"[",
"]",
";",
"$",
"bundlesMetadata",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"bundles",
"as",
"$",
"name",
"=>",
"$",
"bundle",
")",
"{",
"$",
"bundl... | Returns the kernel parameters.
@return array An array of kernel parameters | [
"Returns",
"the",
"kernel",
"parameters",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/Kernel.php#L603-L635 | train | Get kernel parameters | [
30522,
5123,
3853,
2131,
5484,
11877,
28689,
22828,
2015,
1006,
1007,
1063,
1002,
26825,
1027,
1031,
1033,
1025,
1002,
26825,
11368,
8447,
2696,
1027,
1031,
1033,
1025,
18921,
6776,
1006,
1002,
2023,
1011,
1028,
26825,
2004,
1002,
2171,
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... |
laravel/framework | src/Illuminate/Database/Query/Builder.php | Builder.cloneWithoutBindings | public function cloneWithoutBindings(array $except)
{
return tap(clone $this, function ($clone) use ($except) {
foreach ($except as $type) {
$clone->bindings[$type] = [];
}
});
} | php | public function cloneWithoutBindings(array $except)
{
return tap(clone $this, function ($clone) use ($except) {
foreach ($except as $type) {
$clone->bindings[$type] = [];
}
});
} | [
"public",
"function",
"cloneWithoutBindings",
"(",
"array",
"$",
"except",
")",
"{",
"return",
"tap",
"(",
"clone",
"$",
"this",
",",
"function",
"(",
"$",
"clone",
")",
"use",
"(",
"$",
"except",
")",
"{",
"foreach",
"(",
"$",
"except",
"as",
"$",
"... | Clone the query without the given bindings.
@param array $except
@return static | [
"Clone",
"the",
"query",
"without",
"the",
"given",
"bindings",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Query/Builder.php#L2972-L2979 | train | Clone the current instance without bindings. | [
30522,
2270,
3853,
17598,
24415,
5833,
8428,
4667,
2015,
1006,
9140,
1002,
3272,
1007,
1063,
2709,
11112,
1006,
17598,
1002,
2023,
1010,
3853,
1006,
1002,
17598,
1007,
2224,
1006,
1002,
3272,
1007,
1063,
18921,
6776,
1006,
1002,
3272,
2004,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/Menu/MenuAdmin.php | MenuAdmin.addDevelopmentItem | public function addDevelopmentItem($menuName, $url, $order = 50, $tooltip = false)
{
if (Development::isEnabled()) {
$this->addItem('CoreAdminHome_MenuDevelopment', $menuName, $url, $order, $tooltip);
}
} | php | public function addDevelopmentItem($menuName, $url, $order = 50, $tooltip = false)
{
if (Development::isEnabled()) {
$this->addItem('CoreAdminHome_MenuDevelopment', $menuName, $url, $order, $tooltip);
}
} | [
"public",
"function",
"addDevelopmentItem",
"(",
"$",
"menuName",
",",
"$",
"url",
",",
"$",
"order",
"=",
"50",
",",
"$",
"tooltip",
"=",
"false",
")",
"{",
"if",
"(",
"Development",
"::",
"isEnabled",
"(",
")",
")",
"{",
"$",
"this",
"->",
"addItem... | See {@link add()}. Adds a new menu item to the development section of the admin 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#L46-L51 | train | Add Development Menu | [
30522,
2270,
3853,
5587,
24844,
18349,
24073,
4221,
2213,
1006,
1002,
12183,
18442,
1010,
1002,
24471,
2140,
1010,
1002,
2344,
1027,
2753,
1010,
1002,
6994,
25101,
1027,
6270,
1007,
1063,
2065,
1006,
2458,
1024,
1024,
2003,
8189,
23242,
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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.