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 sequencelengths 29 2.15k | docstring stringlengths 11 2.85k | docstring_tokens sequencelengths 1 290 | sha stringclasses 21 values | url stringlengths 100 194 | partition stringclasses 1 value | summary stringlengths 8 319 | input_ids sequencelengths 502 502 | token_type_ids sequencelengths 502 502 | attention_mask sequencelengths 502 502 | labels sequencelengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
laravel/framework | src/Illuminate/Http/Resources/ConditionallyLoadsAttributes.php | ConditionallyLoadsAttributes.filter | protected function filter($data)
{
$index = -1;
foreach ($data as $key => $value) {
$index++;
if (is_array($value)) {
$data[$key] = $this->filter($value);
continue;
}
if (is_numeric($key) && $value instanceof MergeValue) {
return $this->mergeData(
$data, $index, $this->filter($value->data),
array_values($value->data) === $value->data
);
}
if ($value instanceof self && is_null($value->resource)) {
$data[$key] = null;
}
}
return $this->removeMissingValues($data);
} | php | protected function filter($data)
{
$index = -1;
foreach ($data as $key => $value) {
$index++;
if (is_array($value)) {
$data[$key] = $this->filter($value);
continue;
}
if (is_numeric($key) && $value instanceof MergeValue) {
return $this->mergeData(
$data, $index, $this->filter($value->data),
array_values($value->data) === $value->data
);
}
if ($value instanceof self && is_null($value->resource)) {
$data[$key] = null;
}
}
return $this->removeMissingValues($data);
} | [
"protected",
"function",
"filter",
"(",
"$",
"data",
")",
"{",
"$",
"index",
"=",
"-",
"1",
";",
"foreach",
"(",
"$",
"data",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"index",
"++",
";",
"if",
"(",
"is_array",
"(",
"$",
"value",
")"... | Filter the given data, removing any optional values.
@param array $data
@return array | [
"Filter",
"the",
"given",
"data",
"removing",
"any",
"optional",
"values",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Http/Resources/ConditionallyLoadsAttributes.php#L15-L41 | train | Filter the data and return the result | [
30522,
5123,
3853,
11307,
1006,
1002,
2951,
1007,
1063,
1002,
5950,
1027,
1011,
1015,
1025,
18921,
6776,
1006,
1002,
2951,
2004,
1002,
3145,
1027,
1028,
1002,
3643,
1007,
1063,
1002,
5950,
1009,
1009,
1025,
2065,
1006,
2003,
1035,
9140,
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/Archive.php | Archive.getDataTable | public function getDataTable($name, $idSubtable = null)
{
$data = $this->get($name, 'blob', $idSubtable);
return $data->getDataTable($this->getResultIndices());
} | php | public function getDataTable($name, $idSubtable = null)
{
$data = $this->get($name, 'blob', $idSubtable);
return $data->getDataTable($this->getResultIndices());
} | [
"public",
"function",
"getDataTable",
"(",
"$",
"name",
",",
"$",
"idSubtable",
"=",
"null",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"get",
"(",
"$",
"name",
",",
"'blob'",
",",
"$",
"idSubtable",
")",
";",
"return",
"$",
"data",
"->",
"getD... | Queries and returns one or more reports as DataTable instances.
This method will query blob data that is a serialized array of of {@link DataTable\Row}'s and
unserialize it.
If multiple sites were requested in {@link build()} or {@link factory()} the result will
be a {@link DataTable\Map} that is indexed by site ID.
If multiple periods were requested in {@link build()} or {@link factory()} the result will
be a DataTable\Map that is indexed by period.
The site ID index is always first, so if multiple sites & periods were requested, the result
will be a {@link DataTable\Map} indexed by site ID which contains {@link DataTable\Map} instances that are
indexed by period.
@param string $name The name of the record to get. This method can only query one record at a time.
@param int|string|null $idSubtable The ID of the subtable to get (if any).
@return DataTable|DataTable\Map A DataTable if multiple sites and periods were not requested.
An appropriately indexed {@link DataTable\Map} if otherwise. | [
"Queries",
"and",
"returns",
"one",
"or",
"more",
"reports",
"as",
"DataTable",
"instances",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Archive.php#L346-L350 | train | Get Data Table | [
30522,
2270,
3853,
2131,
2850,
29336,
3085,
1006,
1002,
2171,
1010,
1002,
8909,
6342,
19279,
3085,
1027,
19701,
1007,
1063,
1002,
2951,
30524,
2497,
1005,
1010,
1002,
8909,
6342,
19279,
3085,
1007,
1025,
2709,
1002,
2951,
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/cms/twig/Loader.php | Loader.exists | public function exists($name)
{
if (!$this->validateCmsObject($name)) {
return parent::exists($name);
}
return $this->obj->exists;
} | php | public function exists($name)
{
if (!$this->validateCmsObject($name)) {
return parent::exists($name);
}
return $this->obj->exists;
} | [
"public",
"function",
"exists",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"validateCmsObject",
"(",
"$",
"name",
")",
")",
"{",
"return",
"parent",
"::",
"exists",
"(",
"$",
"name",
")",
";",
"}",
"return",
"$",
"this",
"->",
... | Checks that the template exists. | [
"Checks",
"that",
"the",
"template",
"exists",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/twig/Loader.php#L105-L112 | train | Protected exists method | [
30522,
2270,
3853,
6526,
1006,
1002,
2171,
1007,
1063,
2065,
1006,
999,
1002,
2023,
1011,
1028,
9398,
3686,
27487,
6499,
2497,
20614,
1006,
1002,
2171,
1007,
1007,
1063,
2709,
6687,
1024,
1024,
6526,
1006,
1002,
2171,
1007,
1025,
1065,
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/DependencyInjection/Definition.php | Definition.setPublic | public function setPublic($boolean)
{
$this->changes['public'] = true;
$this->public = (bool) $boolean;
$this->private = false;
return $this;
} | php | public function setPublic($boolean)
{
$this->changes['public'] = true;
$this->public = (bool) $boolean;
$this->private = false;
return $this;
} | [
"public",
"function",
"setPublic",
"(",
"$",
"boolean",
")",
"{",
"$",
"this",
"->",
"changes",
"[",
"'public'",
"]",
"=",
"true",
";",
"$",
"this",
"->",
"public",
"=",
"(",
"bool",
")",
"$",
"boolean",
";",
"$",
"this",
"->",
"private",
"=",
"fal... | Sets the visibility of this service.
@param bool $boolean
@return $this | [
"Sets",
"the",
"visibility",
"of",
"this",
"service",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DependencyInjection/Definition.php#L603-L611 | train | Set the public flag | [
30522,
2270,
3853,
2275,
14289,
16558,
2594,
1006,
1002,
22017,
20898,
1007,
1063,
1002,
2023,
1011,
1028,
3431,
1031,
1005,
2270,
1005,
1033,
1027,
2995,
1025,
1002,
2023,
1011,
1028,
2270,
1027,
1006,
22017,
2140,
1007,
1002,
22017,
20898... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/Zend/Db/Adapter/Pdo/Abstract.php | Zend_Db_Adapter_Pdo_Abstract._dsn | protected function _dsn()
{
// baseline of DSN parts
$dsn = $this->_config;
// don't pass the username, password, charset, persistent and driver_options in the DSN
unset($dsn['username']);
unset($dsn['password']);
unset($dsn['options']);
unset($dsn['charset']);
unset($dsn['persistent']);
unset($dsn['driver_options']);
// use all remaining parts in the DSN
foreach ($dsn as $key => $val) {
$dsn[$key] = "$key=$val";
}
return $this->_pdoType . ':' . implode(';', $dsn);
} | php | protected function _dsn()
{
// baseline of DSN parts
$dsn = $this->_config;
// don't pass the username, password, charset, persistent and driver_options in the DSN
unset($dsn['username']);
unset($dsn['password']);
unset($dsn['options']);
unset($dsn['charset']);
unset($dsn['persistent']);
unset($dsn['driver_options']);
// use all remaining parts in the DSN
foreach ($dsn as $key => $val) {
$dsn[$key] = "$key=$val";
}
return $this->_pdoType . ':' . implode(';', $dsn);
} | [
"protected",
"function",
"_dsn",
"(",
")",
"{",
"// baseline of DSN parts",
"$",
"dsn",
"=",
"$",
"this",
"->",
"_config",
";",
"// don't pass the username, password, charset, persistent and driver_options in the DSN",
"unset",
"(",
"$",
"dsn",
"[",
"'username'",
"]",
"... | Creates a PDO DSN for the adapter from $this->_config settings.
@return string | [
"Creates",
"a",
"PDO",
"DSN",
"for",
"the",
"adapter",
"from",
"$this",
"-",
">",
"_config",
"settings",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Adapter/Pdo/Abstract.php#L60-L79 | train | Return the DSN string | [
30522,
5123,
3853,
1035,
16233,
2078,
1006,
1007,
1063,
1013,
1013,
26163,
1997,
16233,
2078,
3033,
1002,
16233,
2078,
1027,
1002,
2023,
1011,
1028,
1035,
9530,
8873,
2290,
1025,
1013,
1013,
2123,
1005,
1056,
3413,
1996,
5310,
18442,
1010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Database/Eloquent/Relations/HasOne.php | HasOne.newRelatedInstanceFor | public function newRelatedInstanceFor(Model $parent)
{
return $this->related->newInstance()->setAttribute(
$this->getForeignKeyName(), $parent->{$this->localKey}
);
} | php | public function newRelatedInstanceFor(Model $parent)
{
return $this->related->newInstance()->setAttribute(
$this->getForeignKeyName(), $parent->{$this->localKey}
);
} | [
"public",
"function",
"newRelatedInstanceFor",
"(",
"Model",
"$",
"parent",
")",
"{",
"return",
"$",
"this",
"->",
"related",
"->",
"newInstance",
"(",
")",
"->",
"setAttribute",
"(",
"$",
"this",
"->",
"getForeignKeyName",
"(",
")",
",",
"$",
"parent",
"-... | Make a new related instance for the given model.
@param \Illuminate\Database\Eloquent\Model $parent
@return \Illuminate\Database\Eloquent\Model | [
"Make",
"a",
"new",
"related",
"instance",
"for",
"the",
"given",
"model",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Relations/HasOne.php#L62-L67 | train | Create a new related instance for the given parent model. | [
30522,
2270,
3853,
2047,
16570,
4383,
7076,
26897,
29278,
1006,
2944,
1002,
6687,
1007,
1063,
2709,
1002,
2023,
1011,
1028,
3141,
1011,
1028,
2047,
7076,
30524,
29278,
7416,
16206,
14839,
18442,
1006,
1007,
1010,
1002,
6687,
1011,
1028,
106... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Container/Container.php | Container.flush | public function flush()
{
$this->aliases = [];
$this->resolved = [];
$this->bindings = [];
$this->instances = [];
$this->abstractAliases = [];
} | php | public function flush()
{
$this->aliases = [];
$this->resolved = [];
$this->bindings = [];
$this->instances = [];
$this->abstractAliases = [];
} | [
"public",
"function",
"flush",
"(",
")",
"{",
"$",
"this",
"->",
"aliases",
"=",
"[",
"]",
";",
"$",
"this",
"->",
"resolved",
"=",
"[",
"]",
";",
"$",
"this",
"->",
"bindings",
"=",
"[",
"]",
";",
"$",
"this",
"->",
"instances",
"=",
"[",
"]",... | Flush the container of all bindings and resolved instances.
@return void | [
"Flush",
"the",
"container",
"of",
"all",
"bindings",
"and",
"resolved",
"instances",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Container/Container.php#L1172-L1179 | train | Flushes all the caches | [
30522,
2270,
3853,
13862,
1006,
1007,
1063,
1002,
2023,
1011,
1028,
14593,
2229,
1027,
1031,
1033,
1025,
1002,
2023,
1011,
1028,
10395,
1027,
1031,
1033,
1025,
1002,
2023,
1011,
1028,
8031,
2015,
1027,
1031,
1033,
1025,
1002,
2023,
1011,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
php-ai/php-ml | src/Classification/Ensemble/AdaBoost.php | AdaBoost.getBestClassifier | protected function getBestClassifier(): Classifier
{
$ref = new ReflectionClass($this->baseClassifier);
/** @var Classifier $classifier */
$classifier = count($this->classifierOptions) === 0 ? $ref->newInstance() : $ref->newInstanceArgs($this->classifierOptions);
if ($classifier instanceof WeightedClassifier) {
$classifier->setSampleWeights($this->weights);
$classifier->train($this->samples, $this->targets);
} else {
[$samples, $targets] = $this->resample();
$classifier->train($samples, $targets);
}
return $classifier;
} | php | protected function getBestClassifier(): Classifier
{
$ref = new ReflectionClass($this->baseClassifier);
/** @var Classifier $classifier */
$classifier = count($this->classifierOptions) === 0 ? $ref->newInstance() : $ref->newInstanceArgs($this->classifierOptions);
if ($classifier instanceof WeightedClassifier) {
$classifier->setSampleWeights($this->weights);
$classifier->train($this->samples, $this->targets);
} else {
[$samples, $targets] = $this->resample();
$classifier->train($samples, $targets);
}
return $classifier;
} | [
"protected",
"function",
"getBestClassifier",
"(",
")",
":",
"Classifier",
"{",
"$",
"ref",
"=",
"new",
"ReflectionClass",
"(",
"$",
"this",
"->",
"baseClassifier",
")",
";",
"/** @var Classifier $classifier */",
"$",
"classifier",
"=",
"count",
"(",
"$",
"this"... | Returns the classifier with the lowest error rate with the
consideration of current sample weights | [
"Returns",
"the",
"classifier",
"with",
"the",
"lowest",
"error",
"rate",
"with",
"the",
"consideration",
"of",
"current",
"sample",
"weights"
] | f6aa1a59b0525b8fca3d2786d661ab3e70904016 | https://github.com/php-ai/php-ml/blob/f6aa1a59b0525b8fca3d2786d661ab3e70904016/src/Classification/Ensemble/AdaBoost.php#L159-L174 | train | Returns the best classifier for the current sample and target weights | [
30522,
5123,
3853,
2131,
12681,
13535,
27102,
18095,
1006,
1007,
1024,
2465,
18095,
1063,
1002,
25416,
1027,
2047,
9185,
26266,
1006,
1002,
2023,
1011,
1028,
2918,
26266,
18095,
1007,
1025,
1013,
1008,
1008,
1030,
13075,
2465,
18095,
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.invalid | public function invalid()
{
if (! $this->messages) {
$this->passes();
}
return array_intersect_key(
$this->data, $this->attributesThatHaveMessages()
);
} | php | public function invalid()
{
if (! $this->messages) {
$this->passes();
}
return array_intersect_key(
$this->data, $this->attributesThatHaveMessages()
);
} | [
"public",
"function",
"invalid",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"messages",
")",
"{",
"$",
"this",
"->",
"passes",
"(",
")",
";",
"}",
"return",
"array_intersect_key",
"(",
"$",
"this",
"->",
"data",
",",
"$",
"this",
"->",
"attr... | Returns the data which was invalid.
@return array | [
"Returns",
"the",
"data",
"which",
"was",
"invalid",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Validation/Validator.php#L652-L661 | train | Return array of invalid attributes | [
30522,
2270,
3853,
19528,
1006,
1007,
1063,
2065,
1006,
999,
1002,
2023,
1011,
1028,
7696,
1007,
1063,
1002,
2023,
1011,
1028,
5235,
1006,
1007,
1025,
1065,
2709,
9140,
1035,
29261,
1035,
3145,
1006,
1002,
2023,
1011,
1028,
2951,
1010,
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 | libs/Zend/Session/SaveHandler/DbTable.php | Zend_Session_SaveHandler_DbTable.gc | public function gc($maxlifetime)
{
$this->delete($this->getAdapter()->quoteIdentifier($this->_modifiedColumn, true) . ' + '
. $this->getAdapter()->quoteIdentifier($this->_lifetimeColumn, true) . ' < '
. $this->getAdapter()->quote(time()));
return true;
} | php | public function gc($maxlifetime)
{
$this->delete($this->getAdapter()->quoteIdentifier($this->_modifiedColumn, true) . ' + '
. $this->getAdapter()->quoteIdentifier($this->_lifetimeColumn, true) . ' < '
. $this->getAdapter()->quote(time()));
return true;
} | [
"public",
"function",
"gc",
"(",
"$",
"maxlifetime",
")",
"{",
"$",
"this",
"->",
"delete",
"(",
"$",
"this",
"->",
"getAdapter",
"(",
")",
"->",
"quoteIdentifier",
"(",
"$",
"this",
"->",
"_modifiedColumn",
",",
"true",
")",
".",
"' + '",
".",
"$",
... | Garbage Collection
@param int $maxlifetime
@return true | [
"Garbage",
"Collection"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Session/SaveHandler/DbTable.php#L387-L394 | train | Delete all records older than maxlifetime | [
30522,
2270,
3853,
1043,
2278,
1006,
1002,
4098,
15509,
7292,
1007,
1063,
1002,
2023,
1011,
1028,
3972,
12870,
1006,
1002,
2023,
1011,
1028,
2131,
8447,
13876,
2121,
1006,
1007,
1011,
1028,
14686,
5178,
16778,
8873,
2121,
1006,
1002,
2023,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/HttpFoundation/FileBag.php | FileBag.set | public function set($key, $value)
{
if (!\is_array($value) && !$value instanceof UploadedFile) {
throw new \InvalidArgumentException('An uploaded file must be an array or an instance of UploadedFile.');
}
parent::set($key, $this->convertFileInformation($value));
} | php | public function set($key, $value)
{
if (!\is_array($value) && !$value instanceof UploadedFile) {
throw new \InvalidArgumentException('An uploaded file must be an array or an instance of UploadedFile.');
}
parent::set($key, $this->convertFileInformation($value));
} | [
"public",
"function",
"set",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"\\",
"is_array",
"(",
"$",
"value",
")",
"&&",
"!",
"$",
"value",
"instanceof",
"UploadedFile",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpFoundation/FileBag.php#L46-L53 | train | Set an uploaded file | [
30522,
2270,
3853,
2275,
1006,
1002,
3145,
1010,
1002,
3643,
1007,
1063,
2065,
1006,
999,
1032,
2003,
1035,
9140,
1006,
1002,
3643,
1007,
1004,
1004,
999,
1002,
3643,
6013,
11253,
21345,
8873,
2571,
1007,
1063,
5466,
2047,
1032,
19528,
29... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/NavigationManager.php | NavigationManager.filterItemPermissions | protected function filterItemPermissions($user, array $items)
{
if (!$user) {
return $items;
}
$items = array_filter($items, function ($item) use ($user) {
if (!$item->permissions || !count($item->permissions)) {
return true;
}
return $user->hasAnyAccess($item->permissions);
});
return $items;
} | php | protected function filterItemPermissions($user, array $items)
{
if (!$user) {
return $items;
}
$items = array_filter($items, function ($item) use ($user) {
if (!$item->permissions || !count($item->permissions)) {
return true;
}
return $user->hasAnyAccess($item->permissions);
});
return $items;
} | [
"protected",
"function",
"filterItemPermissions",
"(",
"$",
"user",
",",
"array",
"$",
"items",
")",
"{",
"if",
"(",
"!",
"$",
"user",
")",
"{",
"return",
"$",
"items",
";",
"}",
"$",
"items",
"=",
"array_filter",
"(",
"$",
"items",
",",
"function",
... | Removes menu items from an array if the supplied user lacks permission.
@param User $user A user object
@param array $items A collection of menu items
@return array The filtered menu items | [
"Removes",
"menu",
"items",
"from",
"an",
"array",
"if",
"the",
"supplied",
"user",
"lacks",
"permission",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/classes/NavigationManager.php#L478-L493 | train | Filter items by permissions | [
30522,
5123,
3853,
11307,
4221,
8737,
2121,
25481,
2015,
1006,
1002,
5310,
1010,
9140,
1002,
5167,
1007,
1063,
2065,
1006,
999,
1002,
5310,
1007,
1063,
2709,
1002,
5167,
1025,
1065,
1002,
5167,
1027,
9140,
1035,
11307,
1006,
1002,
5167,
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/Cache/Backend/WinCache.php | Zend_Cache_Backend_WinCache.save | public function save($data, $id, $tags = array(), $specificLifetime = false)
{
$lifetime = $this->getLifetime($specificLifetime);
$result = wincache_ucache_set($id, array($data, time(), $lifetime), $lifetime);
if (count($tags) > 0) {
$this->_log(self::TAGS_UNSUPPORTED_BY_SAVE_OF_WINCACHE_BACKEND);
}
return $result;
} | php | public function save($data, $id, $tags = array(), $specificLifetime = false)
{
$lifetime = $this->getLifetime($specificLifetime);
$result = wincache_ucache_set($id, array($data, time(), $lifetime), $lifetime);
if (count($tags) > 0) {
$this->_log(self::TAGS_UNSUPPORTED_BY_SAVE_OF_WINCACHE_BACKEND);
}
return $result;
} | [
"public",
"function",
"save",
"(",
"$",
"data",
",",
"$",
"id",
",",
"$",
"tags",
"=",
"array",
"(",
")",
",",
"$",
"specificLifetime",
"=",
"false",
")",
"{",
"$",
"lifetime",
"=",
"$",
"this",
"->",
"getLifetime",
"(",
"$",
"specificLifetime",
")",... | Save some string datas into a cache record
Note : $data is always "string" (serialization is done by the
core not by the backend)
@param string $data datas to cache
@param string $id cache id
@param array $tags array of strings, the cache record will be tagged by each string entry
@param int $specificLifetime if != false, set a specific lifetime for this cache record (null => infinite lifetime)
@return boolean true if no problem | [
"Save",
"some",
"string",
"datas",
"into",
"a",
"cache",
"record"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Cache/Backend/WinCache.php#L109-L117 | train | Save data into the cache | [
30522,
2270,
3853,
3828,
1006,
1002,
2951,
1010,
1002,
8909,
1010,
1002,
22073,
1027,
9140,
1006,
1007,
1010,
1002,
3563,
15509,
7292,
1027,
6270,
1007,
1063,
1002,
6480,
1027,
1002,
2023,
1011,
1028,
2131,
15509,
7292,
1006,
1002,
3563,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php | NumberFormatter.getTextAttribute | public function getTextAttribute($attr)
{
return \array_key_exists($this->style, self::$enTextAttributes) && \array_key_exists($attr, self::$enTextAttributes[$this->style]) ? self::$enTextAttributes[$this->style][$attr] : false;
} | php | public function getTextAttribute($attr)
{
return \array_key_exists($this->style, self::$enTextAttributes) && \array_key_exists($attr, self::$enTextAttributes[$this->style]) ? self::$enTextAttributes[$this->style][$attr] : false;
} | [
"public",
"function",
"getTextAttribute",
"(",
"$",
"attr",
")",
"{",
"return",
"\\",
"array_key_exists",
"(",
"$",
"this",
"->",
"style",
",",
"self",
"::",
"$",
"enTextAttributes",
")",
"&&",
"\\",
"array_key_exists",
"(",
"$",
"attr",
",",
"self",
"::",... | Not supported. Returns a formatter text attribute value.
@param int $attr An attribute specifier, one of the text attribute constants
@return bool|string The attribute value or false on error
@see http://www.php.net/manual/en/numberformatter.gettextattribute.php | [
"Not",
"supported",
".",
"Returns",
"a",
"formatter",
"text",
"attribute",
"value",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php#L475-L478 | train | Get the value of a text attribute | [
30522,
2270,
3853,
2131,
18209,
19321,
3089,
8569,
2618,
1006,
1002,
2012,
16344,
1007,
1063,
2709,
1032,
9140,
1035,
3145,
1035,
6526,
1006,
1002,
2023,
1011,
1028,
2806,
1010,
2969,
1024,
1024,
1002,
4372,
18209,
19321,
3089,
8569,
4570,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Database/Connectors/Connector.php | Connector.createConnection | public function createConnection($dsn, array $config, array $options)
{
[$username, $password] = [
$config['username'] ?? null, $config['password'] ?? null,
];
try {
return $this->createPdoConnection(
$dsn, $username, $password, $options
);
} catch (Exception $e) {
return $this->tryAgainIfCausedByLostConnection(
$e, $dsn, $username, $password, $options
);
}
} | php | public function createConnection($dsn, array $config, array $options)
{
[$username, $password] = [
$config['username'] ?? null, $config['password'] ?? null,
];
try {
return $this->createPdoConnection(
$dsn, $username, $password, $options
);
} catch (Exception $e) {
return $this->tryAgainIfCausedByLostConnection(
$e, $dsn, $username, $password, $options
);
}
} | [
"public",
"function",
"createConnection",
"(",
"$",
"dsn",
",",
"array",
"$",
"config",
",",
"array",
"$",
"options",
")",
"{",
"[",
"$",
"username",
",",
"$",
"password",
"]",
"=",
"[",
"$",
"config",
"[",
"'username'",
"]",
"??",
"null",
",",
"$",
... | Create a new PDO connection.
@param string $dsn
@param array $config
@param array $options
@return \PDO
@throws \Exception | [
"Create",
"a",
"new",
"PDO",
"connection",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Connectors/Connector.php#L38-L53 | train | Create a new PDO connection | [
30522,
2270,
3853,
3443,
8663,
2638,
7542,
1006,
1002,
16233,
2078,
1010,
9140,
1002,
9530,
8873,
2290,
1010,
9140,
1002,
7047,
1007,
1063,
1031,
1002,
5310,
18442,
1010,
1002,
20786,
1033,
1027,
1031,
1002,
9530,
8873,
2290,
1031,
1005,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
dompdf/dompdf | lib/Cpdf.php | Cpdf.o_cidSystemInfo | protected function o_cidSystemInfo($id, $action)
{
switch ($action) {
case 'new':
$this->objects[$id] = array(
't' => 'cidSystemInfo'
);
break;
case 'add':
break;
case 'out':
$ordering = '(UCS)';
$registry = '(Adobe)';
if ($this->encrypted) {
$this->encryptInit($id);
$ordering = $this->ARC4($ordering);
$registry = $this->ARC4($registry);
}
$res = "\n$id 0 obj\n";
$res .= '<</Registry ' . $registry . "\n"; // A string identifying an issuer of character collections
$res .= '/Ordering ' . $ordering . "\n"; // A string that uniquely names a character collection issued by a specific registry
$res .= "/Supplement 0\n"; // The supplement number of the character collection.
$res .= ">>";
$res .= "\nendobj";;
return $res;
}
return null;
} | php | protected function o_cidSystemInfo($id, $action)
{
switch ($action) {
case 'new':
$this->objects[$id] = array(
't' => 'cidSystemInfo'
);
break;
case 'add':
break;
case 'out':
$ordering = '(UCS)';
$registry = '(Adobe)';
if ($this->encrypted) {
$this->encryptInit($id);
$ordering = $this->ARC4($ordering);
$registry = $this->ARC4($registry);
}
$res = "\n$id 0 obj\n";
$res .= '<</Registry ' . $registry . "\n"; // A string identifying an issuer of character collections
$res .= '/Ordering ' . $ordering . "\n"; // A string that uniquely names a character collection issued by a specific registry
$res .= "/Supplement 0\n"; // The supplement number of the character collection.
$res .= ">>";
$res .= "\nendobj";;
return $res;
}
return null;
} | [
"protected",
"function",
"o_cidSystemInfo",
"(",
"$",
"id",
",",
"$",
"action",
")",
"{",
"switch",
"(",
"$",
"action",
")",
"{",
"case",
"'new'",
":",
"$",
"this",
"->",
"objects",
"[",
"$",
"id",
"]",
"=",
"array",
"(",
"'t'",
"=>",
"'cidSystemInfo... | CID system info section, needed for unicode fonts
@param $id
@param $action
@return null|string | [
"CID",
"system",
"info",
"section",
"needed",
"for",
"unicode",
"fonts"
] | 75f13c700009be21a1965dc2c5b68a8708c22ba2 | https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/lib/Cpdf.php#L1230-L1264 | train | o_cidSystemInfo - cidSystemInfo - cidSystemInfo - cidSystemInfo - cidSystemInfo - cidSystemInfo - cidSystemInfo - cidSystemInfo - cidSystemInfo - cidSystemInfo - cidSystemInfo - cidSystemInfo - cidSystemInfo - cidSystemInfo - cidSystemInfo - cidSystemInfo - cidSystemInfo - cidSystemInfo - cidSystemInfo - cidSystemInfo | [
30522,
5123,
3853,
1051,
1035,
28744,
6508,
13473,
10020,
14876,
1006,
1002,
8909,
1010,
1002,
2895,
1007,
1063,
6942,
1006,
1002,
2895,
1007,
1063,
2553,
1005,
2047,
1005,
1024,
1002,
2023,
1011,
1028,
5200,
1031,
1002,
8909,
1033,
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/NumberFormatter.php | NumberFormatter.formatPercentEvolution | public function formatPercentEvolution($value)
{
$isPositiveEvolution = !empty($value) && ($value > 0 || $value[0] == '+');
$formatted = self::formatPercent($value);
if ($isPositiveEvolution) {
// $this->symbols has already been initialized from formatPercent().
$language = $this->translator->getCurrentLanguage();
return $this->symbols[$language]['+'] . $formatted;
}
return $formatted;
} | php | public function formatPercentEvolution($value)
{
$isPositiveEvolution = !empty($value) && ($value > 0 || $value[0] == '+');
$formatted = self::formatPercent($value);
if ($isPositiveEvolution) {
// $this->symbols has already been initialized from formatPercent().
$language = $this->translator->getCurrentLanguage();
return $this->symbols[$language]['+'] . $formatted;
}
return $formatted;
} | [
"public",
"function",
"formatPercentEvolution",
"(",
"$",
"value",
")",
"{",
"$",
"isPositiveEvolution",
"=",
"!",
"empty",
"(",
"$",
"value",
")",
"&&",
"(",
"$",
"value",
">",
"0",
"||",
"$",
"value",
"[",
"0",
"]",
"==",
"'+'",
")",
";",
"$",
"f... | Formats given number as percent value, but keep the leading + sign if found
@param $value
@return string | [
"Formats",
"given",
"number",
"as",
"percent",
"value",
"but",
"keep",
"the",
"leading",
"+",
"sign",
"if",
"found"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/NumberFormatter.php#L106-L118 | train | Format percent evolution | [
30522,
2270,
3853,
4289,
4842,
13013,
6777,
4747,
13700,
1006,
1002,
3643,
1007,
1063,
1002,
2003,
6873,
28032,
3512,
6777,
4747,
13700,
1027,
999,
4064,
1006,
1002,
3643,
1007,
1004,
1004,
1006,
1002,
3643,
1028,
1014,
1064,
1064,
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/Queue/Queue.php | Queue.withCreatePayloadHooks | protected function withCreatePayloadHooks($queue, array $payload)
{
if (! empty(static::$createPayloadCallbacks)) {
foreach (static::$createPayloadCallbacks as $callback) {
$payload = array_merge($payload, call_user_func(
$callback, $this->getConnectionName(), $queue, $payload
));
}
}
return $payload;
} | php | protected function withCreatePayloadHooks($queue, array $payload)
{
if (! empty(static::$createPayloadCallbacks)) {
foreach (static::$createPayloadCallbacks as $callback) {
$payload = array_merge($payload, call_user_func(
$callback, $this->getConnectionName(), $queue, $payload
));
}
}
return $payload;
} | [
"protected",
"function",
"withCreatePayloadHooks",
"(",
"$",
"queue",
",",
"array",
"$",
"payload",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"static",
"::",
"$",
"createPayloadCallbacks",
")",
")",
"{",
"foreach",
"(",
"static",
"::",
"$",
"createPayloadCallb... | Create the given payload using any registered payload hooks.
@param string $queue
@param array $payload
@return array | [
"Create",
"the",
"given",
"payload",
"using",
"any",
"registered",
"payload",
"hooks",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Queue/Queue.php#L234-L245 | train | Create payload hooks | [
30522,
5123,
3853,
2007,
16748,
3686,
4502,
8516,
10441,
16425,
14659,
2015,
1006,
1002,
24240,
1010,
9140,
1002,
18093,
1007,
1063,
2065,
1006,
999,
4064,
1006,
10763,
1024,
1024,
1002,
3443,
4502,
8516,
10441,
16409,
8095,
12221,
1007,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/HttpFoundation/BinaryFileResponse.php | BinaryFileResponse.sendContent | public function sendContent()
{
if (!$this->isSuccessful()) {
return parent::sendContent();
}
if (0 === $this->maxlen) {
return $this;
}
$out = fopen('php://output', 'wb');
$file = fopen($this->file->getPathname(), 'rb');
stream_copy_to_stream($file, $out, $this->maxlen, $this->offset);
fclose($out);
fclose($file);
if ($this->deleteFileAfterSend && file_exists($this->file->getPathname())) {
unlink($this->file->getPathname());
}
return $this;
} | php | public function sendContent()
{
if (!$this->isSuccessful()) {
return parent::sendContent();
}
if (0 === $this->maxlen) {
return $this;
}
$out = fopen('php://output', 'wb');
$file = fopen($this->file->getPathname(), 'rb');
stream_copy_to_stream($file, $out, $this->maxlen, $this->offset);
fclose($out);
fclose($file);
if ($this->deleteFileAfterSend && file_exists($this->file->getPathname())) {
unlink($this->file->getPathname());
}
return $this;
} | [
"public",
"function",
"sendContent",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isSuccessful",
"(",
")",
")",
"{",
"return",
"parent",
"::",
"sendContent",
"(",
")",
";",
"}",
"if",
"(",
"0",
"===",
"$",
"this",
"->",
"maxlen",
")",
"{",
... | Sends the file.
{@inheritdoc} | [
"Sends",
"the",
"file",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpFoundation/BinaryFileResponse.php#L285-L308 | train | Send content to the file | [
30522,
2270,
3853,
4604,
8663,
6528,
2102,
1006,
1007,
1063,
2065,
1006,
999,
1002,
2023,
1011,
1028,
26354,
14194,
9623,
22747,
5313,
1006,
1007,
1007,
1063,
2709,
6687,
1024,
1024,
4604,
8663,
6528,
2102,
1006,
1007,
1025,
1065,
2065,
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/Url.php | Url.getCurrentUrlWithoutQueryString | public static function getCurrentUrlWithoutQueryString($checkTrustedHost = true)
{
return self::getCurrentScheme() . '://'
. self::getCurrentHost($default = 'unknown', $checkTrustedHost)
. self::getCurrentScriptName(false);
} | php | public static function getCurrentUrlWithoutQueryString($checkTrustedHost = true)
{
return self::getCurrentScheme() . '://'
. self::getCurrentHost($default = 'unknown', $checkTrustedHost)
. self::getCurrentScriptName(false);
} | [
"public",
"static",
"function",
"getCurrentUrlWithoutQueryString",
"(",
"$",
"checkTrustedHost",
"=",
"true",
")",
"{",
"return",
"self",
"::",
"getCurrentScheme",
"(",
")",
".",
"'://'",
".",
"self",
"::",
"getCurrentHost",
"(",
"$",
"default",
"=",
"'unknown'"... | Returns the current URL without the query string.
@param bool $checkTrustedHost Whether to do trusted host check. Should ALWAYS be true,
except in {@link Piwik\Plugin\Controller}.
@return string eg, `"http://example.org/dir1/dir2/index.php"` if the current URL is
`"http://example.org/dir1/dir2/index.php?param1=value1¶m2=value2"`.
@api | [
"Returns",
"the",
"current",
"URL",
"without",
"the",
"query",
"string",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Url.php#L76-L81 | train | Get Current URL without Query String | [
30522,
2270,
10763,
3853,
2131,
10841,
14343,
3372,
3126,
2140,
24415,
5833,
4226,
24769,
18886,
3070,
1006,
1002,
4638,
24669,
2098,
15006,
2102,
1027,
2995,
1007,
1063,
2709,
2969,
1024,
1024,
2131,
10841,
14343,
7666,
5403,
4168,
1006,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Support/Str.php | Str.start | public static function start($value, $prefix)
{
$quoted = preg_quote($prefix, '/');
return $prefix.preg_replace('/^(?:'.$quoted.')+/u', '', $value);
} | php | public static function start($value, $prefix)
{
$quoted = preg_quote($prefix, '/');
return $prefix.preg_replace('/^(?:'.$quoted.')+/u', '', $value);
} | [
"public",
"static",
"function",
"start",
"(",
"$",
"value",
",",
"$",
"prefix",
")",
"{",
"$",
"quoted",
"=",
"preg_quote",
"(",
"$",
"prefix",
",",
"'/'",
")",
";",
"return",
"$",
"prefix",
".",
"preg_replace",
"(",
"'/^(?:'",
".",
"$",
"quoted",
".... | Begin a string with a single instance of a given value.
@param string $value
@param string $prefix
@return string | [
"Begin",
"a",
"string",
"with",
"a",
"single",
"instance",
"of",
"a",
"given",
"value",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Support/Str.php#L390-L395 | train | Starts the current namespace | [
30522,
2270,
10763,
3853,
2707,
1006,
1002,
3643,
1010,
1002,
17576,
1007,
1063,
1002,
9339,
1027,
3653,
2290,
1035,
14686,
1006,
1002,
17576,
1010,
1005,
1013,
1005,
1007,
1025,
2709,
1002,
17576,
1012,
3653,
2290,
1035,
5672,
1006,
1005,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getgrav/grav | system/src/Grav/Common/Utils.php | Utils.arrayFilterRecursive | public static function arrayFilterRecursive(Array $source, $fn)
{
$result = [];
foreach ($source as $key => $value) {
if (is_array($value)) {
$result[$key] = static::arrayFilterRecursive($value, $fn);
continue;
}
if ($fn($key, $value)) {
$result[$key] = $value; // KEEP
continue;
}
}
return $result;
} | php | public static function arrayFilterRecursive(Array $source, $fn)
{
$result = [];
foreach ($source as $key => $value) {
if (is_array($value)) {
$result[$key] = static::arrayFilterRecursive($value, $fn);
continue;
}
if ($fn($key, $value)) {
$result[$key] = $value; // KEEP
continue;
}
}
return $result;
} | [
"public",
"static",
"function",
"arrayFilterRecursive",
"(",
"Array",
"$",
"source",
",",
"$",
"fn",
")",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"source",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"is_array",
... | Recursively filter an array, filtering values by processing them through the $fn function argument
@param array $source the Array to filter
@param callable $fn the function to pass through each array item
@return array | [
"Recursively",
"filter",
"an",
"array",
"filtering",
"values",
"by",
"processing",
"them",
"through",
"the",
"$fn",
"function",
"argument"
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Utils.php#L883-L898 | train | Array Filter Recursive | [
30522,
2270,
10763,
3853,
9140,
8873,
21928,
2890,
10841,
2869,
3512,
1006,
9140,
1002,
3120,
1010,
1002,
1042,
2078,
1007,
1063,
1002,
2765,
1027,
1031,
1033,
1025,
18921,
6776,
1006,
1002,
3120,
2004,
1002,
3145,
1027,
1028,
1002,
3643,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Session/Store.php | Store.has | public function has($key)
{
return ! collect(is_array($key) ? $key : func_get_args())->contains(function ($key) {
return is_null($this->get($key));
});
} | php | public function has($key)
{
return ! collect(is_array($key) ? $key : func_get_args())->contains(function ($key) {
return is_null($this->get($key));
});
} | [
"public",
"function",
"has",
"(",
"$",
"key",
")",
"{",
"return",
"!",
"collect",
"(",
"is_array",
"(",
"$",
"key",
")",
"?",
"$",
"key",
":",
"func_get_args",
"(",
")",
")",
"->",
"contains",
"(",
"function",
"(",
"$",
"key",
")",
"{",
"return",
... | Checks if a key is present and not null.
@param string|array $key
@return bool | [
"Checks",
"if",
"a",
"key",
"is",
"present",
"and",
"not",
"null",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Session/Store.php#L191-L196 | train | Has a key? | [
30522,
2270,
3853,
2038,
1006,
1002,
3145,
1007,
1063,
2709,
999,
8145,
1006,
2003,
1035,
9140,
1006,
1002,
3145,
1007,
1029,
1002,
3145,
1024,
4569,
2278,
1035,
2131,
1035,
12098,
5620,
1006,
1007,
1007,
1011,
1028,
3397,
1006,
3853,
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... |
dompdf/dompdf | src/FrameDecorator/ListBulletImage.php | ListBulletImage.get_margin_width | function get_margin_width()
{
//ignore image width, use same width as on predefined bullet ListBullet
//for proper alignment of bullet image and text. Allow image to not fitting on left border.
//This controls the extra indentation of text to make room for the bullet image.
//Here use actual image size, not predefined bullet size
//return $this->_frame->get_style()->get_font_size()*ListBullet::BULLET_SIZE +
// 2 * ListBullet::BULLET_PADDING;
// Small hack to prevent indenting of list text
// Image Might not exist, then position like on list_bullet_frame_decorator fallback to none.
if ($this->_frame->get_style()->list_style_position === "outside" || $this->_width == 0) {
return 0;
}
//This aligns the "inside" image position with the text.
//The text starts to the right of the image.
//Between the image and the text there is an added margin of image width.
//Where this comes from is unknown.
//The corresponding ListBullet sets a smaller margin. bullet size?
return $this->_width + 2 * ListBullet::BULLET_PADDING;
} | php | function get_margin_width()
{
//ignore image width, use same width as on predefined bullet ListBullet
//for proper alignment of bullet image and text. Allow image to not fitting on left border.
//This controls the extra indentation of text to make room for the bullet image.
//Here use actual image size, not predefined bullet size
//return $this->_frame->get_style()->get_font_size()*ListBullet::BULLET_SIZE +
// 2 * ListBullet::BULLET_PADDING;
// Small hack to prevent indenting of list text
// Image Might not exist, then position like on list_bullet_frame_decorator fallback to none.
if ($this->_frame->get_style()->list_style_position === "outside" || $this->_width == 0) {
return 0;
}
//This aligns the "inside" image position with the text.
//The text starts to the right of the image.
//Between the image and the text there is an added margin of image width.
//Where this comes from is unknown.
//The corresponding ListBullet sets a smaller margin. bullet size?
return $this->_width + 2 * ListBullet::BULLET_PADDING;
} | [
"function",
"get_margin_width",
"(",
")",
"{",
"//ignore image width, use same width as on predefined bullet ListBullet",
"//for proper alignment of bullet image and text. Allow image to not fitting on left border.",
"//This controls the extra indentation of text to make room for the bullet image.",
... | Override get_margin_width
@return int | [
"Override",
"get_margin_width"
] | 75f13c700009be21a1965dc2c5b68a8708c22ba2 | https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/src/FrameDecorator/ListBulletImage.php#L110-L130 | train | Get the width of the bullet image | [
30522,
3853,
2131,
1035,
7785,
1035,
9381,
1006,
1007,
1063,
1013,
1013,
8568,
3746,
9381,
1010,
2224,
2168,
9381,
2004,
2006,
3653,
3207,
23460,
2094,
7960,
2862,
8569,
22592,
1013,
1013,
2005,
5372,
12139,
1997,
7960,
3746,
1998,
3793,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
End of preview. Expand
in Data Studio
README.md exists but content is empty.
- Downloads last month
- 6