repo stringclasses 21 values | path stringlengths 10 100 | func_name stringlengths 6 71 | original_string stringlengths 115 97k | language stringclasses 1 value | code stringlengths 115 97k | code_tokens listlengths 27 7.5k | docstring stringlengths 6 1.88k | docstring_tokens listlengths 1 177 | sha stringclasses 21 values | url stringlengths 100 189 | partition stringclasses 1 value | summary stringlengths 9 340 | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
symfony/symfony | src/Symfony/Component/Serializer/Normalizer/PropertyNormalizer.php | PropertyNormalizer.extractAttributes | protected function extractAttributes($object, $format = null, array $context = [])
{
$reflectionObject = new \ReflectionObject($object);
$attributes = [];
do {
foreach ($reflectionObject->getProperties() as $property) {
if (!$this->isAllowedAttribute($reflectionObject->getName(), $property->name, $format, $context)) {
continue;
}
$attributes[] = $property->name;
}
} while ($reflectionObject = $reflectionObject->getParentClass());
return $attributes;
} | php | protected function extractAttributes($object, $format = null, array $context = [])
{
$reflectionObject = new \ReflectionObject($object);
$attributes = [];
do {
foreach ($reflectionObject->getProperties() as $property) {
if (!$this->isAllowedAttribute($reflectionObject->getName(), $property->name, $format, $context)) {
continue;
}
$attributes[] = $property->name;
}
} while ($reflectionObject = $reflectionObject->getParentClass());
return $attributes;
} | [
"protected",
"function",
"extractAttributes",
"(",
"$",
"object",
",",
"$",
"format",
"=",
"null",
",",
"array",
"$",
"context",
"=",
"[",
"]",
")",
"{",
"$",
"reflectionObject",
"=",
"new",
"\\",
"ReflectionObject",
"(",
"$",
"object",
")",
";",
"$",
... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Serializer/Normalizer/PropertyNormalizer.php#L100-L116 | train | Extract attributes from object | [
30522,
5123,
3853,
14817,
19321,
3089,
8569,
4570,
1006,
1002,
4874,
1010,
1002,
4289,
1027,
19701,
1010,
9140,
1002,
6123,
1027,
1031,
1033,
1007,
1063,
1002,
9185,
16429,
20614,
1027,
2047,
1032,
9185,
16429,
20614,
1006,
1002,
4874,
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/HttpKernel/Kernel.php | Kernel.buildContainer | protected function buildContainer()
{
foreach (['cache' => $this->warmupDir ?: $this->getCacheDir(), 'logs' => $this->getLogDir()] as $name => $dir) {
if (!is_dir($dir)) {
if (false === @mkdir($dir, 0777, true) && !is_dir($dir)) {
throw new \RuntimeException(sprintf("Unable to create the %s directory (%s)\n", $name, $dir));
}
} elseif (!is_writable($dir)) {
throw new \RuntimeException(sprintf("Unable to write in the %s directory (%s)\n", $name, $dir));
}
}
$container = $this->getContainerBuilder();
$container->addObjectResource($this);
$this->prepareContainer($container);
if (null !== $cont = $this->registerContainerConfiguration($this->getContainerLoader($container))) {
$container->merge($cont);
}
$container->addCompilerPass(new AddAnnotatedClassesToCachePass($this));
return $container;
} | php | protected function buildContainer()
{
foreach (['cache' => $this->warmupDir ?: $this->getCacheDir(), 'logs' => $this->getLogDir()] as $name => $dir) {
if (!is_dir($dir)) {
if (false === @mkdir($dir, 0777, true) && !is_dir($dir)) {
throw new \RuntimeException(sprintf("Unable to create the %s directory (%s)\n", $name, $dir));
}
} elseif (!is_writable($dir)) {
throw new \RuntimeException(sprintf("Unable to write in the %s directory (%s)\n", $name, $dir));
}
}
$container = $this->getContainerBuilder();
$container->addObjectResource($this);
$this->prepareContainer($container);
if (null !== $cont = $this->registerContainerConfiguration($this->getContainerLoader($container))) {
$container->merge($cont);
}
$container->addCompilerPass(new AddAnnotatedClassesToCachePass($this));
return $container;
} | [
"protected",
"function",
"buildContainer",
"(",
")",
"{",
"foreach",
"(",
"[",
"'cache'",
"=>",
"$",
"this",
"->",
"warmupDir",
"?",
":",
"$",
"this",
"->",
"getCacheDir",
"(",
")",
",",
"'logs'",
"=>",
"$",
"this",
"->",
"getLogDir",
"(",
")",
"]",
... | Builds the service container.
@return ContainerBuilder The compiled service container
@throws \RuntimeException | [
"Builds",
"the",
"service",
"container",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/Kernel.php#L644-L667 | train | Build the container | [
30522,
5123,
3853,
3857,
8663,
18249,
2121,
1006,
1007,
1063,
18921,
6776,
1006,
1031,
1005,
17053,
1005,
1027,
1028,
1002,
2023,
1011,
1028,
4010,
6279,
4305,
2099,
1029,
1024,
1002,
2023,
1011,
1028,
2131,
3540,
7690,
4313,
1006,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/GeoIp2/LocationProvider/GeoIp2/Php.php | Php.getGeoIpInstance | private function getGeoIpInstance($key)
{
if (empty($this->readerCache[$key])) {
$pathToDb = self::getPathToGeoIpDatabase($this->customDbNames[$key]);
if ($pathToDb !== false) {
try {
$this->readerCache[$key] = new Reader($pathToDb);
} catch (InvalidDatabaseException $e) {
// ignore invalid database exception
}
}
}
return empty($this->readerCache[$key]) ? false : $this->readerCache[$key];
} | php | private function getGeoIpInstance($key)
{
if (empty($this->readerCache[$key])) {
$pathToDb = self::getPathToGeoIpDatabase($this->customDbNames[$key]);
if ($pathToDb !== false) {
try {
$this->readerCache[$key] = new Reader($pathToDb);
} catch (InvalidDatabaseException $e) {
// ignore invalid database exception
}
}
}
return empty($this->readerCache[$key]) ? false : $this->readerCache[$key];
} | [
"private",
"function",
"getGeoIpInstance",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"readerCache",
"[",
"$",
"key",
"]",
")",
")",
"{",
"$",
"pathToDb",
"=",
"self",
"::",
"getPathToGeoIpDatabase",
"(",
"$",
"this",
"->",
... | Returns a GeoIP2 reader instance. Creates it if necessary.
@param string $key 'loc' or 'isp'. Determines the type of GeoIP database
to load.
@return Reader|false | [
"Returns",
"a",
"GeoIP2",
"reader",
"instance",
".",
"Creates",
"it",
"if",
"necessary",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/GeoIp2/LocationProvider/GeoIp2/Php.php#L320-L334 | train | Get a GeoIP instance from the reader cache | [
30522,
2797,
3853,
2131,
3351,
10448,
27915,
26897,
1006,
1002,
3145,
1007,
1063,
2065,
1006,
4064,
1006,
1002,
2023,
1011,
1028,
8068,
3540,
5403,
1031,
1002,
3145,
1033,
1007,
1007,
1063,
1002,
4130,
3406,
18939,
1027,
2969,
1024,
1024,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Cache/RedisTaggedCache.php | RedisTaggedCache.put | public function put($key, $value, $ttl = null)
{
if ($ttl === null) {
return $this->forever($key, $value);
}
$this->pushStandardKeys($this->tags->getNamespace(), $key);
return parent::put($key, $value, $ttl);
} | php | public function put($key, $value, $ttl = null)
{
if ($ttl === null) {
return $this->forever($key, $value);
}
$this->pushStandardKeys($this->tags->getNamespace(), $key);
return parent::put($key, $value, $ttl);
} | [
"public",
"function",
"put",
"(",
"$",
"key",
",",
"$",
"value",
",",
"$",
"ttl",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"ttl",
"===",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"forever",
"(",
"$",
"key",
",",
"$",
"value",
")",
";",
"}"... | Store an item in the cache.
@param string $key
@param mixed $value
@param \DateTimeInterface|\DateInterval|int|null $ttl
@return bool | [
"Store",
"an",
"item",
"in",
"the",
"cache",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Cache/RedisTaggedCache.php#L28-L37 | train | Put a value into the cache | [
30522,
2270,
3853,
2404,
1006,
1002,
3145,
1010,
1002,
3643,
1010,
1002,
23746,
2140,
1027,
19701,
1007,
1063,
2065,
1006,
1002,
23746,
2140,
1027,
1027,
1027,
19701,
1007,
1063,
2709,
1002,
2023,
1011,
1028,
5091,
1006,
1002,
3145,
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... |
matomo-org/matomo | libs/Zend/Session.php | Zend_Session.destroy | public static function destroy($remove_cookie = true, $readonly = true)
{
if (self::$_unitTestEnabled) {
return;
}
if (self::$_destroyed) {
return;
}
if ($readonly) {
parent::$_writable = false;
}
session_destroy();
self::$_destroyed = true;
if ($remove_cookie) {
self::expireSessionCookie();
}
} | php | public static function destroy($remove_cookie = true, $readonly = true)
{
if (self::$_unitTestEnabled) {
return;
}
if (self::$_destroyed) {
return;
}
if ($readonly) {
parent::$_writable = false;
}
session_destroy();
self::$_destroyed = true;
if ($remove_cookie) {
self::expireSessionCookie();
}
} | [
"public",
"static",
"function",
"destroy",
"(",
"$",
"remove_cookie",
"=",
"true",
",",
"$",
"readonly",
"=",
"true",
")",
"{",
"if",
"(",
"self",
"::",
"$",
"_unitTestEnabled",
")",
"{",
"return",
";",
"}",
"if",
"(",
"self",
"::",
"$",
"_destroyed",
... | destroy() - This is used to destroy session data, and optionally, the session cookie itself
@param bool $remove_cookie - OPTIONAL remove session id cookie, defaults to true (remove cookie)
@param bool $readonly - OPTIONAL remove write access (i.e. throw error if Zend_Session's attempt writes)
@return void | [
"destroy",
"()",
"-",
"This",
"is",
"used",
"to",
"destroy",
"session",
"data",
"and",
"optionally",
"the",
"session",
"cookie",
"itself"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Session.php#L716-L736 | train | Destroy the session | [
30522,
2270,
10763,
3853,
6033,
1006,
1002,
6366,
1035,
17387,
1027,
2995,
1010,
1002,
3191,
2239,
2135,
1027,
2995,
1007,
1063,
2065,
1006,
2969,
1024,
1024,
1002,
1035,
3131,
22199,
8189,
23242,
1007,
1063,
2709,
1025,
1065,
2065,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/DataTable/Renderer/Xml.php | Xml.renderArray | private function renderArray($array, $prefixLines)
{
$isAssociativeArray = Piwik::isAssociativeArray($array);
// check if array contains arrays, and if not wrap the result in an extra <row> element
// (only check if this is the root renderArray call)
// NOTE: this is for backwards compatibility. before, array's were added to a new DataTable.
// if the array had arrays, they were added as multiple rows, otherwise it was treated as
// one row. removing will change API output.
$wrapInRow = $prefixLines === "\t"
&& self::shouldWrapArrayBeforeRendering($array, $wrapSingleValues = false, $isAssociativeArray);
// render the array
$result = "";
if ($wrapInRow) {
$result .= "$prefixLines<row>\n";
$prefixLines .= "\t";
}
foreach ($array as $key => $value) {
// based on the type of array & the key, determine how this node will look
if ($isAssociativeArray) {
if (strpos($key, '=') !== false) {
list($keyAttributeName, $key) = explode('=', $key, 2);
$prefix = "<row $keyAttributeName=\"$key\">";
$suffix = "</row>";
$emptyNode = "<row $keyAttributeName=\"$key\">";
} elseif (!self::isValidXmlTagName($key)) {
$prefix = "<row key=\"$key\">";
$suffix = "</row>";
$emptyNode = "<row key=\"$key\"/>";
} else {
$prefix = "<$key>";
$suffix = "</$key>";
$emptyNode = "<$key />";
}
} else {
$prefix = "<row>";
$suffix = "</row>";
$emptyNode = "<row/>";
}
// render the array item
if (is_array($value) || $value instanceof \stdClass) {
$result .= $prefixLines . $prefix . "\n";
$result .= $this->renderArray((array) $value, $prefixLines . "\t");
$result .= $prefixLines . $suffix . "\n";
} elseif ($value instanceof DataTable
|| $value instanceof Map
) {
if ($value->getRowsCount() == 0) {
$result .= $prefixLines . $emptyNode . "\n";
} else {
$result .= $prefixLines . $prefix . "\n";
if ($value instanceof Map) {
$result .= $this->renderDataTableMap($value, $this->getArrayFromDataTable($value), $prefixLines);
} elseif ($value instanceof Simple) {
$result .= $this->renderDataTableSimple($this->getArrayFromDataTable($value), $prefixLines);
} else {
$result .= $this->renderDataTable($this->getArrayFromDataTable($value), $prefixLines);
}
$result .= $prefixLines . $suffix . "\n";
}
} else {
$xmlValue = self::formatValueXml($value);
if (strlen($xmlValue) != 0) {
$result .= $prefixLines . $prefix . $xmlValue . $suffix . "\n";
} else {
$result .= $prefixLines . $emptyNode . "\n";
}
}
}
if ($wrapInRow) {
$result .= substr($prefixLines, 0, strlen($prefixLines) - 1) . "</row>\n";
}
return $result;
} | php | private function renderArray($array, $prefixLines)
{
$isAssociativeArray = Piwik::isAssociativeArray($array);
// check if array contains arrays, and if not wrap the result in an extra <row> element
// (only check if this is the root renderArray call)
// NOTE: this is for backwards compatibility. before, array's were added to a new DataTable.
// if the array had arrays, they were added as multiple rows, otherwise it was treated as
// one row. removing will change API output.
$wrapInRow = $prefixLines === "\t"
&& self::shouldWrapArrayBeforeRendering($array, $wrapSingleValues = false, $isAssociativeArray);
// render the array
$result = "";
if ($wrapInRow) {
$result .= "$prefixLines<row>\n";
$prefixLines .= "\t";
}
foreach ($array as $key => $value) {
// based on the type of array & the key, determine how this node will look
if ($isAssociativeArray) {
if (strpos($key, '=') !== false) {
list($keyAttributeName, $key) = explode('=', $key, 2);
$prefix = "<row $keyAttributeName=\"$key\">";
$suffix = "</row>";
$emptyNode = "<row $keyAttributeName=\"$key\">";
} elseif (!self::isValidXmlTagName($key)) {
$prefix = "<row key=\"$key\">";
$suffix = "</row>";
$emptyNode = "<row key=\"$key\"/>";
} else {
$prefix = "<$key>";
$suffix = "</$key>";
$emptyNode = "<$key />";
}
} else {
$prefix = "<row>";
$suffix = "</row>";
$emptyNode = "<row/>";
}
// render the array item
if (is_array($value) || $value instanceof \stdClass) {
$result .= $prefixLines . $prefix . "\n";
$result .= $this->renderArray((array) $value, $prefixLines . "\t");
$result .= $prefixLines . $suffix . "\n";
} elseif ($value instanceof DataTable
|| $value instanceof Map
) {
if ($value->getRowsCount() == 0) {
$result .= $prefixLines . $emptyNode . "\n";
} else {
$result .= $prefixLines . $prefix . "\n";
if ($value instanceof Map) {
$result .= $this->renderDataTableMap($value, $this->getArrayFromDataTable($value), $prefixLines);
} elseif ($value instanceof Simple) {
$result .= $this->renderDataTableSimple($this->getArrayFromDataTable($value), $prefixLines);
} else {
$result .= $this->renderDataTable($this->getArrayFromDataTable($value), $prefixLines);
}
$result .= $prefixLines . $suffix . "\n";
}
} else {
$xmlValue = self::formatValueXml($value);
if (strlen($xmlValue) != 0) {
$result .= $prefixLines . $prefix . $xmlValue . $suffix . "\n";
} else {
$result .= $prefixLines . $emptyNode . "\n";
}
}
}
if ($wrapInRow) {
$result .= substr($prefixLines, 0, strlen($prefixLines) - 1) . "</row>\n";
}
return $result;
} | [
"private",
"function",
"renderArray",
"(",
"$",
"array",
",",
"$",
"prefixLines",
")",
"{",
"$",
"isAssociativeArray",
"=",
"Piwik",
"::",
"isAssociativeArray",
"(",
"$",
"array",
")",
";",
"// check if array contains arrays, and if not wrap the result in an extra <row> e... | Renders an array as XML.
@param array $array The array to render.
@param string $prefixLines The string to prefix each line in the output.
@return string | [
"Renders",
"an",
"array",
"as",
"XML",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/DataTable/Renderer/Xml.php#L136-L213 | train | Renders the array | [
30522,
2797,
3853,
17552,
2906,
9447,
1006,
1002,
9140,
1010,
1002,
17576,
30524,
5783,
1013,
1013,
1006,
2069,
4638,
2065,
2023,
2003,
1996,
7117,
17552,
2906,
9447,
2655,
1007,
1013,
1013,
3602,
1024,
2023,
2003,
2005,
11043,
21778,
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... |
getgrav/grav | system/src/Grav/Common/Helpers/Truncator.php | Truncator.htmlToDomDocument | public static function htmlToDomDocument($html)
{
if (!$html) {
$html = '';
}
// Transform multibyte entities which otherwise display incorrectly.
$html = mb_convert_encoding($html, 'HTML-ENTITIES', 'UTF-8');
// Internal errors enabled as HTML5 not fully supported.
libxml_use_internal_errors(true);
// Instantiate new DOMDocument object, and then load in UTF-8 HTML.
$dom = new DOMDocument();
$dom->encoding = 'UTF-8';
$dom->loadHTML("<div>$html</div>");
return $dom;
} | php | public static function htmlToDomDocument($html)
{
if (!$html) {
$html = '';
}
// Transform multibyte entities which otherwise display incorrectly.
$html = mb_convert_encoding($html, 'HTML-ENTITIES', 'UTF-8');
// Internal errors enabled as HTML5 not fully supported.
libxml_use_internal_errors(true);
// Instantiate new DOMDocument object, and then load in UTF-8 HTML.
$dom = new DOMDocument();
$dom->encoding = 'UTF-8';
$dom->loadHTML("<div>$html</div>");
return $dom;
} | [
"public",
"static",
"function",
"htmlToDomDocument",
"(",
"$",
"html",
")",
"{",
"if",
"(",
"!",
"$",
"html",
")",
"{",
"$",
"html",
"=",
"''",
";",
"}",
"// Transform multibyte entities which otherwise display incorrectly.",
"$",
"html",
"=",
"mb_convert_encoding... | Builds a DOMDocument object from a string containing HTML.
@param string $html HTML to load
@returns DOMDocument Returns a DOMDocument object. | [
"Builds",
"a",
"DOMDocument",
"object",
"from",
"a",
"string",
"containing",
"HTML",
"."
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Helpers/Truncator.php#L141-L159 | train | Convert HTML to DOMDocument | [
30522,
30524,
2618,
11422,
2029,
4728,
4653,
19721,
1012,
1002,
16129,
1027,
16914,
1035,
10463,
1035,
17181,
1006,
1002,
16129,
1010,
1005,
16129,
1011,
11422,
1005,
1010,
1005,
21183,
2546,
1011,
1022,
1005,
1007,
1025,
1013,
1013,
4722,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/HttpClient/Response/ResponseTrait.php | ResponseTrait.stream | public static function stream(iterable $responses, float $timeout = null): \Generator
{
$runningResponses = [];
foreach ($responses as $response) {
self::schedule($response, $runningResponses);
}
$lastActivity = microtime(true);
$isTimeout = false;
while (true) {
$hasActivity = false;
$timeoutMax = 0;
$timeoutMin = $timeout ?? INF;
/** @var ClientState $multi */
foreach ($runningResponses as $i => [$multi]) {
$responses = &$runningResponses[$i][1];
self::perform($multi, $responses);
foreach ($responses as $j => $response) {
$timeoutMax = $timeout ?? max($timeoutMax, $response->timeout);
$timeoutMin = min($timeoutMin, $response->timeout, 1);
$chunk = false;
if (isset($multi->handlesActivity[$j])) {
// no-op
} elseif (!isset($multi->openHandles[$j])) {
unset($responses[$j]);
continue;
} elseif ($isTimeout) {
$multi->handlesActivity[$j] = [new ErrorChunk($response->offset)];
} else {
continue;
}
while ($multi->handlesActivity[$j] ?? false) {
$hasActivity = true;
$isTimeout = false;
if (\is_string($chunk = array_shift($multi->handlesActivity[$j]))) {
$response->offset += \strlen($chunk);
$chunk = new DataChunk($response->offset, $chunk);
} elseif (null === $chunk) {
$e = $multi->handlesActivity[$j][0];
unset($responses[$j], $multi->handlesActivity[$j]);
$response->close();
if (null !== $e) {
$response->info['error'] = $e->getMessage();
if ($e instanceof \Error) {
throw $e;
}
$chunk = new ErrorChunk($response->offset, $e);
} else {
$chunk = new LastChunk($response->offset);
}
} elseif ($chunk instanceof ErrorChunk) {
unset($responses[$j]);
$isTimeout = true;
} elseif ($chunk instanceof FirstChunk && $response->logger) {
$info = $response->getInfo();
$response->logger->info(sprintf('Response: "%s %s"', $info['http_code'], $info['url']));
}
yield $response => $chunk;
}
unset($multi->handlesActivity[$j]);
if ($chunk instanceof FirstChunk && null === $response->initializer) {
// Ensure the HTTP status code is always checked
$response->getHeaders(true);
} elseif ($chunk instanceof ErrorChunk && !$chunk->didThrow()) {
// Ensure transport exceptions are always thrown
$chunk->getContent();
}
}
if (!$responses) {
unset($runningResponses[$i]);
}
// Prevent memory leaks
$multi->handlesActivity = $multi->handlesActivity ?: [];
$multi->openHandles = $multi->openHandles ?: [];
}
if (!$runningResponses) {
break;
}
if ($hasActivity) {
$lastActivity = microtime(true);
continue;
}
switch (self::select($multi, $timeoutMin)) {
case -1: usleep(min(500, 1E6 * $timeoutMin)); break;
case 0: $isTimeout = microtime(true) - $lastActivity > $timeoutMax; break;
}
}
} | php | public static function stream(iterable $responses, float $timeout = null): \Generator
{
$runningResponses = [];
foreach ($responses as $response) {
self::schedule($response, $runningResponses);
}
$lastActivity = microtime(true);
$isTimeout = false;
while (true) {
$hasActivity = false;
$timeoutMax = 0;
$timeoutMin = $timeout ?? INF;
/** @var ClientState $multi */
foreach ($runningResponses as $i => [$multi]) {
$responses = &$runningResponses[$i][1];
self::perform($multi, $responses);
foreach ($responses as $j => $response) {
$timeoutMax = $timeout ?? max($timeoutMax, $response->timeout);
$timeoutMin = min($timeoutMin, $response->timeout, 1);
$chunk = false;
if (isset($multi->handlesActivity[$j])) {
// no-op
} elseif (!isset($multi->openHandles[$j])) {
unset($responses[$j]);
continue;
} elseif ($isTimeout) {
$multi->handlesActivity[$j] = [new ErrorChunk($response->offset)];
} else {
continue;
}
while ($multi->handlesActivity[$j] ?? false) {
$hasActivity = true;
$isTimeout = false;
if (\is_string($chunk = array_shift($multi->handlesActivity[$j]))) {
$response->offset += \strlen($chunk);
$chunk = new DataChunk($response->offset, $chunk);
} elseif (null === $chunk) {
$e = $multi->handlesActivity[$j][0];
unset($responses[$j], $multi->handlesActivity[$j]);
$response->close();
if (null !== $e) {
$response->info['error'] = $e->getMessage();
if ($e instanceof \Error) {
throw $e;
}
$chunk = new ErrorChunk($response->offset, $e);
} else {
$chunk = new LastChunk($response->offset);
}
} elseif ($chunk instanceof ErrorChunk) {
unset($responses[$j]);
$isTimeout = true;
} elseif ($chunk instanceof FirstChunk && $response->logger) {
$info = $response->getInfo();
$response->logger->info(sprintf('Response: "%s %s"', $info['http_code'], $info['url']));
}
yield $response => $chunk;
}
unset($multi->handlesActivity[$j]);
if ($chunk instanceof FirstChunk && null === $response->initializer) {
// Ensure the HTTP status code is always checked
$response->getHeaders(true);
} elseif ($chunk instanceof ErrorChunk && !$chunk->didThrow()) {
// Ensure transport exceptions are always thrown
$chunk->getContent();
}
}
if (!$responses) {
unset($runningResponses[$i]);
}
// Prevent memory leaks
$multi->handlesActivity = $multi->handlesActivity ?: [];
$multi->openHandles = $multi->openHandles ?: [];
}
if (!$runningResponses) {
break;
}
if ($hasActivity) {
$lastActivity = microtime(true);
continue;
}
switch (self::select($multi, $timeoutMin)) {
case -1: usleep(min(500, 1E6 * $timeoutMin)); break;
case 0: $isTimeout = microtime(true) - $lastActivity > $timeoutMax; break;
}
}
} | [
"public",
"static",
"function",
"stream",
"(",
"iterable",
"$",
"responses",
",",
"float",
"$",
"timeout",
"=",
"null",
")",
":",
"\\",
"Generator",
"{",
"$",
"runningResponses",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"responses",
"as",
"$",
"response"... | Implements an event loop based on a buffer activity queue.
@internal | [
"Implements",
"an",
"event",
"loop",
"based",
"on",
"a",
"buffer",
"activity",
"queue",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpClient/Response/ResponseTrait.php#L242-L347 | train | Streams the responses and returns a generator that can be used to create the response stream. | [
30522,
2270,
10763,
3853,
5460,
1006,
2009,
6906,
3468,
1002,
10960,
1010,
14257,
1002,
2051,
5833,
1027,
19701,
1007,
1024,
1032,
13103,
1063,
1002,
2770,
6072,
26029,
8583,
1027,
1031,
1033,
1025,
18921,
6776,
1006,
1002,
10960,
2004,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/DomCrawler/Field/TextareaFormField.php | TextareaFormField.initialize | protected function initialize()
{
if ('textarea' !== $this->node->nodeName) {
throw new \LogicException(sprintf('A TextareaFormField can only be created from a textarea tag (%s given).', $this->node->nodeName));
}
$this->value = '';
foreach ($this->node->childNodes as $node) {
$this->value .= $node->wholeText;
}
} | php | protected function initialize()
{
if ('textarea' !== $this->node->nodeName) {
throw new \LogicException(sprintf('A TextareaFormField can only be created from a textarea tag (%s given).', $this->node->nodeName));
}
$this->value = '';
foreach ($this->node->childNodes as $node) {
$this->value .= $node->wholeText;
}
} | [
"protected",
"function",
"initialize",
"(",
")",
"{",
"if",
"(",
"'textarea'",
"!==",
"$",
"this",
"->",
"node",
"->",
"nodeName",
")",
"{",
"throw",
"new",
"\\",
"LogicException",
"(",
"sprintf",
"(",
"'A TextareaFormField can only be created from a textarea tag (%... | Initializes the form field.
@throws \LogicException When node type is incorrect | [
"Initializes",
"the",
"form",
"field",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DomCrawler/Field/TextareaFormField.php#L26-L36 | train | Initializes the value property of the textareaFormField | [
30522,
5123,
3853,
3988,
4697,
1006,
1007,
1063,
2065,
1006,
1005,
3793,
12069,
2050,
1005,
999,
1027,
1027,
1002,
2023,
1011,
1028,
13045,
1011,
1028,
13045,
18442,
1007,
1063,
5466,
2047,
1032,
7961,
10288,
24422,
1006,
9043,
2546,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/HTML/QuickForm2/Element/Static.php | HTML_QuickForm2_Element_Static.updateValue | public function updateValue()
{
foreach ($this->getDataSources() as $ds) {
if (!$ds instanceof HTML_QuickForm2_DataSource_Submit &&
null !== ($value = $ds->getValue($this->getName())))
{
$this->setContent($value);
return;
}
}
} | php | public function updateValue()
{
foreach ($this->getDataSources() as $ds) {
if (!$ds instanceof HTML_QuickForm2_DataSource_Submit &&
null !== ($value = $ds->getValue($this->getName())))
{
$this->setContent($value);
return;
}
}
} | [
"public",
"function",
"updateValue",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"getDataSources",
"(",
")",
"as",
"$",
"ds",
")",
"{",
"if",
"(",
"!",
"$",
"ds",
"instanceof",
"HTML_QuickForm2_DataSource_Submit",
"&&",
"null",
"!==",
"(",
"$",
"va... | Called when the element needs to update its value from form's data sources
Static elements content can be updated with default form values. | [
"Called",
"when",
"the",
"element",
"needs",
"to",
"update",
"its",
"value",
"from",
"form",
"s",
"data",
"sources"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/HTML/QuickForm2/Element/Static.php#L141-L151 | train | Update the value of the form element | [
30522,
2270,
3853,
10651,
10175,
5657,
1006,
1007,
1063,
18921,
6776,
1006,
1002,
2023,
1011,
1028,
2131,
2850,
10230,
8162,
9623,
1006,
1007,
2004,
1002,
16233,
1007,
1063,
2065,
1006,
999,
1002,
16233,
6013,
11253,
16129,
1035,
4248,
1419... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/ViewDataTable/Manager.php | Manager.getIdsWithInheritance | public static function getIdsWithInheritance($klass)
{
$klasses = Common::getClassLineage($klass);
$result = array();
foreach ($klasses as $klass) {
try {
$result[] = $klass::getViewDataTableId();
} catch (\Exception $e) {
// in case $klass did not define an id: eg Plugin\ViewDataTable
continue;
}
}
return $result;
} | php | public static function getIdsWithInheritance($klass)
{
$klasses = Common::getClassLineage($klass);
$result = array();
foreach ($klasses as $klass) {
try {
$result[] = $klass::getViewDataTableId();
} catch (\Exception $e) {
// in case $klass did not define an id: eg Plugin\ViewDataTable
continue;
}
}
return $result;
} | [
"public",
"static",
"function",
"getIdsWithInheritance",
"(",
"$",
"klass",
")",
"{",
"$",
"klasses",
"=",
"Common",
"::",
"getClassLineage",
"(",
"$",
"klass",
")",
";",
"$",
"result",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"klasses",
"as",
... | Returns the viewDataTable IDs of a visualization's class lineage.
@see self::getVisualizationClassLineage
@param string $klass The visualization class.
@return array | [
"Returns",
"the",
"viewDataTable",
"IDs",
"of",
"a",
"visualization",
"s",
"class",
"lineage",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/ViewDataTable/Manager.php#L40-L55 | train | Returns an array of all viewDataTable IDs that have a parent class | [
30522,
2270,
10763,
3853,
2131,
9821,
24415,
2378,
5886,
25451,
3401,
1006,
1002,
1047,
27102,
1007,
1063,
1002,
1047,
27102,
2229,
1027,
2691,
1024,
1024,
2131,
26266,
4179,
4270,
1006,
1002,
1047,
27102,
1007,
1025,
1002,
2765,
1027,
9140... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Foundation/Console/EventGenerateCommand.php | EventGenerateCommand.handle | public function handle()
{
$providers = $this->laravel->getProviders(EventServiceProvider::class);
foreach ($providers as $provider) {
foreach ($provider->listens() as $event => $listeners) {
$this->makeEventAndListeners($event, $listeners);
}
}
$this->info('Events and listeners generated successfully!');
} | php | public function handle()
{
$providers = $this->laravel->getProviders(EventServiceProvider::class);
foreach ($providers as $provider) {
foreach ($provider->listens() as $event => $listeners) {
$this->makeEventAndListeners($event, $listeners);
}
}
$this->info('Events and listeners generated successfully!');
} | [
"public",
"function",
"handle",
"(",
")",
"{",
"$",
"providers",
"=",
"$",
"this",
"->",
"laravel",
"->",
"getProviders",
"(",
"EventServiceProvider",
"::",
"class",
")",
";",
"foreach",
"(",
"$",
"providers",
"as",
"$",
"provider",
")",
"{",
"foreach",
... | Execute the console command.
@return void | [
"Execute",
"the",
"console",
"command",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Foundation/Console/EventGenerateCommand.php#L30-L41 | train | Generate events and listeners | [
30522,
2270,
3853,
5047,
1006,
1007,
1063,
1002,
11670,
1027,
1002,
2023,
1011,
1028,
13679,
15985,
1011,
1028,
2131,
21572,
17258,
2545,
1006,
2824,
2121,
7903,
13699,
12298,
18688,
1024,
1024,
2465,
1007,
1025,
18921,
6776,
1006,
1002,
11... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Parser.php | Parser.parse | public static function parse($expression)
{
$name = static::name($expression);
if (preg_match_all('/\{\s*(.*?)\s*\}/', $expression, $matches)) {
if (count($matches[1])) {
return array_merge([$name], static::parameters($matches[1]));
}
}
return [$name, [], []];
} | php | public static function parse($expression)
{
$name = static::name($expression);
if (preg_match_all('/\{\s*(.*?)\s*\}/', $expression, $matches)) {
if (count($matches[1])) {
return array_merge([$name], static::parameters($matches[1]));
}
}
return [$name, [], []];
} | [
"public",
"static",
"function",
"parse",
"(",
"$",
"expression",
")",
"{",
"$",
"name",
"=",
"static",
"::",
"name",
"(",
"$",
"expression",
")",
";",
"if",
"(",
"preg_match_all",
"(",
"'/\\{\\s*(.*?)\\s*\\}/'",
",",
"$",
"expression",
",",
"$",
"matches",... | Parse the given console command definition into an array.
@param string $expression
@return array
@throws \InvalidArgumentException | [
"Parse",
"the",
"given",
"console",
"command",
"definition",
"into",
"an",
"array",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Console/Parser.php#L20-L31 | train | Parse the given string into an array of parameters | [
30522,
2270,
10763,
3853,
11968,
3366,
1006,
1002,
3670,
1007,
1063,
1002,
2171,
1027,
10763,
1024,
1024,
2171,
1006,
1002,
3670,
1007,
1025,
2065,
1006,
3653,
2290,
1035,
2674,
1035,
2035,
1006,
1005,
1013,
1032,
1063,
1032,
1055,
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/backend/classes/Controller.php | Controller.onHideBackendHint | public function onHideBackendHint()
{
if (!$name = post('name')) {
throw new ApplicationException('Missing a hint name.');
}
$preferences = UserPreference::forUser();
$hiddenHints = $preferences->get('backend::hints.hidden', []);
$hiddenHints[$name] = 1;
$preferences->set('backend::hints.hidden', $hiddenHints);
} | php | public function onHideBackendHint()
{
if (!$name = post('name')) {
throw new ApplicationException('Missing a hint name.');
}
$preferences = UserPreference::forUser();
$hiddenHints = $preferences->get('backend::hints.hidden', []);
$hiddenHints[$name] = 1;
$preferences->set('backend::hints.hidden', $hiddenHints);
} | [
"public",
"function",
"onHideBackendHint",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"name",
"=",
"post",
"(",
"'name'",
")",
")",
"{",
"throw",
"new",
"ApplicationException",
"(",
"'Missing a hint name.'",
")",
";",
"}",
"$",
"preferences",
"=",
"UserPreference",... | Ajax handler to hide a backend hint, once hidden the partial
will no longer display for the user.
@return void | [
"Ajax",
"handler",
"to",
"hide",
"a",
"backend",
"hint",
"once",
"hidden",
"the",
"partial",
"will",
"no",
"longer",
"display",
"for",
"the",
"user",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/classes/Controller.php#L689-L700 | train | Hides a backend hint | [
30522,
2270,
3853,
2006,
26100,
5963,
10497,
10606,
2102,
1006,
1007,
1063,
2065,
1006,
999,
1002,
2171,
1027,
2695,
1006,
1005,
2171,
1005,
1007,
1007,
1063,
5466,
2047,
4646,
10288,
24422,
1006,
1005,
4394,
1037,
9374,
2171,
1012,
1005,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/API/Request.php | Request.processRequest | public static function processRequest($method, $paramOverride = array(), $defaultRequest = null)
{
$params = array();
$params['format'] = 'original';
$params['serialize'] = '0';
$params['module'] = 'API';
$params['method'] = $method;
$params = $paramOverride + $params;
// process request
$request = new Request($params, $defaultRequest);
return $request->process();
} | php | public static function processRequest($method, $paramOverride = array(), $defaultRequest = null)
{
$params = array();
$params['format'] = 'original';
$params['serialize'] = '0';
$params['module'] = 'API';
$params['method'] = $method;
$params = $paramOverride + $params;
// process request
$request = new Request($params, $defaultRequest);
return $request->process();
} | [
"public",
"static",
"function",
"processRequest",
"(",
"$",
"method",
",",
"$",
"paramOverride",
"=",
"array",
"(",
")",
",",
"$",
"defaultRequest",
"=",
"null",
")",
"{",
"$",
"params",
"=",
"array",
"(",
")",
";",
"$",
"params",
"[",
"'format'",
"]",... | Helper method that processes an API request in one line using the variables in `$_GET`
and `$_POST`.
@param string $method The API method to call, ie, `'Actions.getPageTitles'`.
@param array $paramOverride The parameter name-value pairs to use instead of what's
in `$_GET` & `$_POST`.
@param array $defaultRequest Default query parameters. If a query parameter is absent in `$request`, it will be loaded
from this. Defaults to `$_GET + $_POST`.
To avoid using any parameters from $_GET or $_POST, set this to an empty `array()`.
@return mixed The result of the API request. See {@link process()}. | [
"Helper",
"method",
"that",
"processes",
"an",
"API",
"request",
"in",
"one",
"line",
"using",
"the",
"variables",
"in",
"$_GET",
"and",
"$_POST",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/API/Request.php#L496-L508 | train | Process request by method | [
30522,
2270,
10763,
3853,
2832,
2890,
15500,
1006,
1002,
4118,
1010,
1002,
11498,
5302,
6299,
15637,
1027,
9140,
1006,
1007,
1010,
1002,
12398,
2890,
15500,
1027,
19701,
1007,
1063,
1002,
11498,
5244,
1027,
9140,
1006,
1007,
1025,
1002,
114... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/API/API.php | API.getMostFrequentValues | private function getMostFrequentValues($values)
{
// remove false values (while keeping zeros)
$values = array_filter($values, 'strlen');
// array_count_values requires strings or integer, convert floats to string (mysqli)
foreach ($values as &$value) {
if (is_numeric($value)) {
$value = (string)round($value, 3);
}
}
// we have a list of all values. let's show the most frequently used first.
$values = array_count_values($values);
// Sort this list by converting and sorting the array with custom method, so the result doesn't differ between PHP versions
$sortArray = [];
foreach ($values as $value => $count) {
$sortArray[] = [
'value' => $value,
'count' => $count
];
}
usort($sortArray, function($a, $b) {
if ($a['count'] == $b['count']) {
return strcmp($a['value'], $b['value']);
}
return $a['count'] > $b['count'] ? -1 : 1;
});
return array_column($sortArray, 'value');
} | php | private function getMostFrequentValues($values)
{
// remove false values (while keeping zeros)
$values = array_filter($values, 'strlen');
// array_count_values requires strings or integer, convert floats to string (mysqli)
foreach ($values as &$value) {
if (is_numeric($value)) {
$value = (string)round($value, 3);
}
}
// we have a list of all values. let's show the most frequently used first.
$values = array_count_values($values);
// Sort this list by converting and sorting the array with custom method, so the result doesn't differ between PHP versions
$sortArray = [];
foreach ($values as $value => $count) {
$sortArray[] = [
'value' => $value,
'count' => $count
];
}
usort($sortArray, function($a, $b) {
if ($a['count'] == $b['count']) {
return strcmp($a['value'], $b['value']);
}
return $a['count'] > $b['count'] ? -1 : 1;
});
return array_column($sortArray, 'value');
} | [
"private",
"function",
"getMostFrequentValues",
"(",
"$",
"values",
")",
"{",
"// remove false values (while keeping zeros)",
"$",
"values",
"=",
"array_filter",
"(",
"$",
"values",
",",
"'strlen'",
")",
";",
"// array_count_values requires strings or integer, convert floats ... | @param $values
@return array | [
"@param",
"$values"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/API/API.php#L732-L765 | train | Get most frequently used values | [
30522,
2797,
3853,
2131,
11800,
19699,
2063,
15417,
10175,
15808,
1006,
1002,
5300,
1007,
1063,
1013,
1013,
6366,
6270,
5300,
1006,
2096,
4363,
5717,
2015,
1007,
1002,
5300,
1027,
9140,
1035,
11307,
1006,
1002,
5300,
1010,
1005,
2358,
20927... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Db2.php | Zend_Db_Adapter_Db2._i5listTables | protected function _i5listTables($schema = null)
{
//list of i5 libraries.
$tables = array();
if ($schema) {
$tablesStatement = db2_tables($this->_connection, null, $schema);
while ($rowTables = db2_fetch_assoc($tablesStatement) ) {
if ($rowTables['TABLE_NAME'] !== null) {
$tables[] = $rowTables['TABLE_NAME'];
}
}
} else {
$schemaStatement = db2_tables($this->_connection);
while ($schema = db2_fetch_assoc($schemaStatement)) {
if ($schema['TABLE_SCHEM'] !== null) {
// list of the tables which belongs to the selected library
$tablesStatement = db2_tables($this->_connection, NULL, $schema['TABLE_SCHEM']);
if (is_resource($tablesStatement)) {
while ($rowTables = db2_fetch_assoc($tablesStatement) ) {
if ($rowTables['TABLE_NAME'] !== null) {
$tables[] = $rowTables['TABLE_NAME'];
}
}
}
}
}
}
return $tables;
} | php | protected function _i5listTables($schema = null)
{
//list of i5 libraries.
$tables = array();
if ($schema) {
$tablesStatement = db2_tables($this->_connection, null, $schema);
while ($rowTables = db2_fetch_assoc($tablesStatement) ) {
if ($rowTables['TABLE_NAME'] !== null) {
$tables[] = $rowTables['TABLE_NAME'];
}
}
} else {
$schemaStatement = db2_tables($this->_connection);
while ($schema = db2_fetch_assoc($schemaStatement)) {
if ($schema['TABLE_SCHEM'] !== null) {
// list of the tables which belongs to the selected library
$tablesStatement = db2_tables($this->_connection, NULL, $schema['TABLE_SCHEM']);
if (is_resource($tablesStatement)) {
while ($rowTables = db2_fetch_assoc($tablesStatement) ) {
if ($rowTables['TABLE_NAME'] !== null) {
$tables[] = $rowTables['TABLE_NAME'];
}
}
}
}
}
}
return $tables;
} | [
"protected",
"function",
"_i5listTables",
"(",
"$",
"schema",
"=",
"null",
")",
"{",
"//list of i5 libraries.",
"$",
"tables",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"schema",
")",
"{",
"$",
"tablesStatement",
"=",
"db2_tables",
"(",
"$",
"this",
"... | Db2 On I5 specific method
Returns a list of the tables in the database .
Used only for DB2/400.
@return array | [
"Db2",
"On",
"I5",
"specific",
"method"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Adapter/Db2.php#L786-L815 | train | Return list of tables in i5 libraries | [
30522,
5123,
3853,
1035,
1045,
2629,
9863,
10880,
2015,
1006,
1002,
8040,
28433,
1027,
19701,
1007,
1063,
1013,
1013,
2862,
1997,
1045,
2629,
8860,
1012,
1002,
7251,
1027,
9140,
1006,
1007,
1025,
2065,
1006,
1002,
8040,
28433,
1007,
1063,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/HttpKernel/DataCollector/LoggerDataCollector.php | LoggerDataCollector.collect | public function collect(Request $request, Response $response, \Exception $exception = null)
{
$this->currentRequest = $this->requestStack && $this->requestStack->getMasterRequest() !== $request ? $request : null;
} | php | public function collect(Request $request, Response $response, \Exception $exception = null)
{
$this->currentRequest = $this->requestStack && $this->requestStack->getMasterRequest() !== $request ? $request : null;
} | [
"public",
"function",
"collect",
"(",
"Request",
"$",
"request",
",",
"Response",
"$",
"response",
",",
"\\",
"Exception",
"$",
"exception",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"currentRequest",
"=",
"$",
"this",
"->",
"requestStack",
"&&",
"$",
"t... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/DataCollector/LoggerDataCollector.php#L45-L48 | train | Collect the current request and response | [
30522,
2270,
3853,
8145,
1006,
5227,
1002,
5227,
1010,
3433,
1002,
3433,
1010,
1032,
6453,
1002,
6453,
1027,
19701,
1007,
1063,
1002,
2023,
1011,
1028,
2783,
2890,
15500,
1027,
1002,
2023,
1011,
1028,
11186,
2696,
3600,
1004,
1004,
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/Form/FormErrorIterator.php | FormErrorIterator.findByCodes | public function findByCodes($codes)
{
$codes = (array) $codes;
$errors = [];
foreach ($this as $error) {
$cause = $error->getCause();
if ($cause instanceof ConstraintViolation && \in_array($cause->getCode(), $codes, true)) {
$errors[] = $error;
}
}
return new static($this->form, $errors);
} | php | public function findByCodes($codes)
{
$codes = (array) $codes;
$errors = [];
foreach ($this as $error) {
$cause = $error->getCause();
if ($cause instanceof ConstraintViolation && \in_array($cause->getCode(), $codes, true)) {
$errors[] = $error;
}
}
return new static($this->form, $errors);
} | [
"public",
"function",
"findByCodes",
"(",
"$",
"codes",
")",
"{",
"$",
"codes",
"=",
"(",
"array",
")",
"$",
"codes",
";",
"$",
"errors",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"as",
"$",
"error",
")",
"{",
"$",
"cause",
"=",
"$",
"er... | Creates iterator for errors with specific codes.
@param string|string[] $codes The codes to find
@return static new instance which contains only specific errors | [
"Creates",
"iterator",
"for",
"errors",
"with",
"specific",
"codes",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/FormErrorIterator.php#L259-L271 | train | Find a form by codes | [
30522,
2270,
3853,
2424,
3762,
23237,
1006,
1002,
9537,
1007,
1063,
1002,
9537,
1027,
1006,
9140,
1007,
1002,
9537,
1025,
1002,
10697,
1027,
1031,
1033,
1025,
18921,
6776,
1006,
1002,
2023,
2004,
1002,
7561,
1007,
1063,
1002,
3426,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/LanguagesManager/TranslationWriter/Writer.php | Writer.setTranslations | public function setTranslations($translations)
{
$this->currentState = self::UNFILTERED;
$this->translations = $translations;
$this->applyFilters();
} | php | public function setTranslations($translations)
{
$this->currentState = self::UNFILTERED;
$this->translations = $translations;
$this->applyFilters();
} | [
"public",
"function",
"setTranslations",
"(",
"$",
"translations",
")",
"{",
"$",
"this",
"->",
"currentState",
"=",
"self",
"::",
"UNFILTERED",
";",
"$",
"this",
"->",
"translations",
"=",
"$",
"translations",
";",
"$",
"this",
"->",
"applyFilters",
"(",
... | Set the translations to write (and cleans them)
@param $translations | [
"Set",
"the",
"translations",
"to",
"write",
"(",
"and",
"cleans",
"them",
")"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/LanguagesManager/TranslationWriter/Writer.php#L138-L143 | train | Set translations for this page | [
30522,
2270,
3853,
2275,
6494,
3619,
13490,
2015,
1006,
1002,
11913,
1007,
1063,
1002,
2023,
1011,
1028,
14731,
12259,
1027,
2969,
1024,
1024,
4895,
8873,
21928,
2098,
1025,
1002,
2023,
1011,
1028,
11913,
1027,
1002,
11913,
1025,
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... |
matomo-org/matomo | core/API/DataTableManipulator/ReportTotalsCalculator.php | ReportTotalsCalculator.manipulateSubtableRequest | protected function manipulateSubtableRequest($request)
{
$request['totals'] = 0;
$request['expanded'] = 0;
$request['filter_limit'] = -1;
$request['filter_offset'] = 0;
$request['filter_sort_column'] = '';
$parametersToRemove = array('flat');
if (!array_key_exists('idSubtable', $this->request)) {
$parametersToRemove[] = 'idSubtable';
}
foreach ($parametersToRemove as $param) {
if (array_key_exists($param, $request)) {
unset($request[$param]);
}
}
return $request;
} | php | protected function manipulateSubtableRequest($request)
{
$request['totals'] = 0;
$request['expanded'] = 0;
$request['filter_limit'] = -1;
$request['filter_offset'] = 0;
$request['filter_sort_column'] = '';
$parametersToRemove = array('flat');
if (!array_key_exists('idSubtable', $this->request)) {
$parametersToRemove[] = 'idSubtable';
}
foreach ($parametersToRemove as $param) {
if (array_key_exists($param, $request)) {
unset($request[$param]);
}
}
return $request;
} | [
"protected",
"function",
"manipulateSubtableRequest",
"(",
"$",
"request",
")",
"{",
"$",
"request",
"[",
"'totals'",
"]",
"=",
"0",
";",
"$",
"request",
"[",
"'expanded'",
"]",
"=",
"0",
";",
"$",
"request",
"[",
"'filter_limit'",
"]",
"=",
"-",
"1",
... | Make sure to get all rows of the first level table.
@param array $request
@return array | [
"Make",
"sure",
"to",
"get",
"all",
"rows",
"of",
"the",
"first",
"level",
"table",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/API/DataTableManipulator/ReportTotalsCalculator.php#L209-L229 | train | manipulate the subtable request | [
30522,
5123,
3853,
17708,
6342,
19279,
3085,
2890,
15500,
1006,
1002,
5227,
1007,
1063,
1002,
5227,
1031,
1005,
21948,
1005,
1033,
1027,
1014,
1025,
1002,
5227,
1031,
1005,
4423,
1005,
1033,
1027,
1014,
1025,
1002,
5227,
1031,
1005,
11307,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Select.php | Zend_Db_Select.distinct | public function distinct($flag = true)
{
$this->_parts[self::DISTINCT] = (bool) $flag;
return $this;
} | php | public function distinct($flag = true)
{
$this->_parts[self::DISTINCT] = (bool) $flag;
return $this;
} | [
"public",
"function",
"distinct",
"(",
"$",
"flag",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"_parts",
"[",
"self",
"::",
"DISTINCT",
"]",
"=",
"(",
"bool",
")",
"$",
"flag",
";",
"return",
"$",
"this",
";",
"}"
] | Makes the query SELECT DISTINCT.
@param bool $flag Whether or not the SELECT is DISTINCT (default true).
@return Zend_Db_Select This Zend_Db_Select object. | [
"Makes",
"the",
"query",
"SELECT",
"DISTINCT",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Select.php#L198-L202 | train | Set the distinct flag | [
30522,
2270,
3853,
5664,
1006,
1002,
5210,
1027,
2995,
1007,
1063,
1002,
2023,
1011,
1028,
1035,
3033,
1031,
2969,
1024,
1024,
5664,
1033,
1027,
1006,
22017,
2140,
1007,
1002,
5210,
1025,
2709,
1002,
2023,
1025,
1065,
102,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Select.php | Zend_Db_Select.joinLeft | public function joinLeft($name, $cond, $cols = self::SQL_WILDCARD, $schema = null)
{
return $this->_join(self::LEFT_JOIN, $name, $cond, $cols, $schema);
} | php | public function joinLeft($name, $cond, $cols = self::SQL_WILDCARD, $schema = null)
{
return $this->_join(self::LEFT_JOIN, $name, $cond, $cols, $schema);
} | [
"public",
"function",
"joinLeft",
"(",
"$",
"name",
",",
"$",
"cond",
",",
"$",
"cols",
"=",
"self",
"::",
"SQL_WILDCARD",
",",
"$",
"schema",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"_join",
"(",
"self",
"::",
"LEFT_JOIN",
",",
"$",
"n... | Add a LEFT OUTER JOIN table and colums to the query
All rows from the left operand table are included,
matching rows from the right operand table included,
and the columns from the right operand table are filled
with NULLs if no row exists matching the left table.
The $name and $cols parameters follow the same logic
as described in the from() method.
@param array|string|Zend_Db_Expr $name The table name.
@param string $cond Join on this condition.
@param array|string $cols The columns to select from the joined table.
@param string $schema The database name to specify, if any.
@return Zend_Db_Select This Zend_Db_Select object. | [
"Add",
"a",
"LEFT",
"OUTER",
"JOIN",
"table",
"and",
"colums",
"to",
"the",
"query",
"All",
"rows",
"from",
"the",
"left",
"operand",
"table",
"are",
"included",
"matching",
"rows",
"from",
"the",
"right",
"operand",
"table",
"included",
"and",
"the",
"col... | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Select.php#L355-L358 | train | Left Join - Join a table or a join - join a table or a join - join a table or a join - join a table or a join - join a table or a join - join a table or a join - join a table or a join - join a table name to a table name | [
30522,
2270,
3853,
3693,
2571,
6199,
1006,
1002,
2171,
1010,
1002,
9530,
2094,
1010,
1002,
8902,
2015,
1027,
2969,
1024,
1024,
29296,
1035,
3748,
11522,
1010,
1002,
8040,
28433,
1027,
19701,
1007,
1063,
2709,
1002,
2023,
1011,
1028,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getgrav/grav | system/src/Grav/Common/Page/Page.php | Page.summary | public function summary($size = null, $textOnly = false)
{
$config = (array)Grav::instance()['config']->get('site.summary');
if (isset($this->header->summary)) {
$config = array_merge($config, $this->header->summary);
}
// Return summary based on settings in site config file
if (!$config['enabled']) {
return $this->content();
}
// Set up variables to process summary from page or from custom summary
if ($this->summary === null) {
$content = $textOnly ? strip_tags($this->content()) : $this->content();
$summary_size = $this->summary_size;
} else {
$content = strip_tags($this->summary);
// Use mb_strwidth to deal with the 2 character widths characters
$summary_size = mb_strwidth($content, 'utf-8');
}
// Return calculated summary based on summary divider's position
$format = $config['format'];
// Return entire page content on wrong/ unknown format
if (!in_array($format, ['short', 'long'])) {
return $content;
}
if (($format === 'short') && isset($summary_size)) {
// Use mb_strimwidth to slice the string
if (mb_strwidth($content, 'utf8') > $summary_size) {
return mb_substr($content, 0, $summary_size);
}
return $content;
}
// Get summary size from site config's file
if ($size === null) {
$size = $config['size'];
}
// If the size is zero, return the entire page content
if ($size === 0) {
return $content;
// Return calculated summary based on defaults
}
if (!is_numeric($size) || ($size < 0)) {
$size = 300;
}
// Only return string but not html, wrap whatever html tag you want when using
if ($textOnly) {
if (mb_strwidth($content, 'utf-8') <= $size) {
return $content;
}
return mb_strimwidth($content, 0, $size, '...', 'utf-8');
}
$summary = Utils::truncateHtml($content, $size);
return html_entity_decode($summary);
} | php | public function summary($size = null, $textOnly = false)
{
$config = (array)Grav::instance()['config']->get('site.summary');
if (isset($this->header->summary)) {
$config = array_merge($config, $this->header->summary);
}
// Return summary based on settings in site config file
if (!$config['enabled']) {
return $this->content();
}
// Set up variables to process summary from page or from custom summary
if ($this->summary === null) {
$content = $textOnly ? strip_tags($this->content()) : $this->content();
$summary_size = $this->summary_size;
} else {
$content = strip_tags($this->summary);
// Use mb_strwidth to deal with the 2 character widths characters
$summary_size = mb_strwidth($content, 'utf-8');
}
// Return calculated summary based on summary divider's position
$format = $config['format'];
// Return entire page content on wrong/ unknown format
if (!in_array($format, ['short', 'long'])) {
return $content;
}
if (($format === 'short') && isset($summary_size)) {
// Use mb_strimwidth to slice the string
if (mb_strwidth($content, 'utf8') > $summary_size) {
return mb_substr($content, 0, $summary_size);
}
return $content;
}
// Get summary size from site config's file
if ($size === null) {
$size = $config['size'];
}
// If the size is zero, return the entire page content
if ($size === 0) {
return $content;
// Return calculated summary based on defaults
}
if (!is_numeric($size) || ($size < 0)) {
$size = 300;
}
// Only return string but not html, wrap whatever html tag you want when using
if ($textOnly) {
if (mb_strwidth($content, 'utf-8') <= $size) {
return $content;
}
return mb_strimwidth($content, 0, $size, '...', 'utf-8');
}
$summary = Utils::truncateHtml($content, $size);
return html_entity_decode($summary);
} | [
"public",
"function",
"summary",
"(",
"$",
"size",
"=",
"null",
",",
"$",
"textOnly",
"=",
"false",
")",
"{",
"$",
"config",
"=",
"(",
"array",
")",
"Grav",
"::",
"instance",
"(",
")",
"[",
"'config'",
"]",
"->",
"get",
"(",
"'site.summary'",
")",
... | Get the summary.
@param int $size Max summary size.
@param bool $textOnly Only count text size.
@return string | [
"Get",
"the",
"summary",
"."
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L554-L617 | train | Return the summary of the page | [
30522,
2270,
3853,
12654,
1006,
1002,
2946,
1027,
19701,
1010,
1002,
3793,
2239,
2135,
1027,
6270,
1007,
1063,
1002,
9530,
8873,
2290,
1027,
1006,
9140,
1007,
24665,
11431,
1024,
1024,
6013,
1006,
1007,
1031,
1005,
9530,
8873,
2290,
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/Database/Schema/Builder.php | Builder.rename | public function rename($from, $to)
{
$this->build(tap($this->createBlueprint($from), function ($blueprint) use ($to) {
$blueprint->rename($to);
}));
} | php | public function rename($from, $to)
{
$this->build(tap($this->createBlueprint($from), function ($blueprint) use ($to) {
$blueprint->rename($to);
}));
} | [
"public",
"function",
"rename",
"(",
"$",
"from",
",",
"$",
"to",
")",
"{",
"$",
"this",
"->",
"build",
"(",
"tap",
"(",
"$",
"this",
"->",
"createBlueprint",
"(",
"$",
"from",
")",
",",
"function",
"(",
"$",
"blueprint",
")",
"use",
"(",
"$",
"t... | Rename a table on the schema.
@param string $from
@param string $to
@return void | [
"Rename",
"a",
"table",
"on",
"the",
"schema",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Schema/Builder.php#L227-L232 | train | Rename a node in the hierarchy. | [
30522,
2270,
3853,
14916,
14074,
1006,
1002,
2013,
1010,
1002,
2000,
1007,
1063,
1002,
2023,
1011,
1028,
3857,
1006,
11112,
1006,
1002,
2023,
1011,
1028,
3443,
16558,
5657,
16550,
1006,
1002,
2013,
1007,
1010,
3853,
1006,
1002,
2630,
16550,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/system/behaviors/SettingsModel.php | SettingsModel.isKeyAllowed | protected function isKeyAllowed($key)
{
/*
* Let the core columns through
*/
if ($key == 'id' || $key == 'value' || $key == 'item') {
return true;
}
/*
* Let relations through
*/
if ($this->model->hasRelation($key)) {
return true;
}
return false;
} | php | protected function isKeyAllowed($key)
{
/*
* Let the core columns through
*/
if ($key == 'id' || $key == 'value' || $key == 'item') {
return true;
}
/*
* Let relations through
*/
if ($this->model->hasRelation($key)) {
return true;
}
return false;
} | [
"protected",
"function",
"isKeyAllowed",
"(",
"$",
"key",
")",
"{",
"/*\n * Let the core columns through\n */",
"if",
"(",
"$",
"key",
"==",
"'id'",
"||",
"$",
"key",
"==",
"'value'",
"||",
"$",
"key",
"==",
"'item'",
")",
"{",
"return",
"true"... | Checks if a key is legitimate or should be added to
the field value collection | [
"Checks",
"if",
"a",
"key",
"is",
"legitimate",
"or",
"should",
"be",
"added",
"to",
"the",
"field",
"value",
"collection"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/behaviors/SettingsModel.php#L220-L237 | train | Check if a key is allowed | [
30522,
5123,
3853,
2003,
14839,
8095,
15096,
1006,
1002,
3145,
1007,
1063,
1013,
1008,
1008,
2292,
1996,
4563,
7753,
2083,
1008,
1013,
2065,
1006,
1002,
3145,
1027,
1027,
1005,
30524,
1027,
1027,
1005,
8875,
1005,
1007,
1063,
2709,
2995,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getgrav/grav | system/src/Grav/Common/Themes.php | Themes.configure | public function configure()
{
$name = $this->current();
$config = $this->config;
$this->loadConfiguration($name, $config);
/** @var UniformResourceLocator $locator */
$locator = $this->grav['locator'];
$registered = stream_get_wrappers();
$schemes = $config->get("themes.{$name}.streams.schemes", []);
$schemes += [
'theme' => [
'type' => 'ReadOnlyStream',
'paths' => $locator->findResources("themes://{$name}", false)
]
];
foreach ($schemes as $scheme => $config) {
if (isset($config['paths'])) {
$locator->addPath($scheme, '', $config['paths']);
}
if (isset($config['prefixes'])) {
foreach ($config['prefixes'] as $prefix => $paths) {
$locator->addPath($scheme, $prefix, $paths);
}
}
if (\in_array($scheme, $registered, true)) {
stream_wrapper_unregister($scheme);
}
$type = !empty($config['type']) ? $config['type'] : 'ReadOnlyStream';
if ($type[0] !== '\\') {
$type = '\\RocketTheme\\Toolbox\\StreamWrapper\\' . $type;
}
if (!stream_wrapper_register($scheme, $type)) {
throw new \InvalidArgumentException("Stream '{$type}' could not be initialized.");
}
}
// Load languages after streams has been properly initialized
$this->loadLanguages($this->config);
} | php | public function configure()
{
$name = $this->current();
$config = $this->config;
$this->loadConfiguration($name, $config);
/** @var UniformResourceLocator $locator */
$locator = $this->grav['locator'];
$registered = stream_get_wrappers();
$schemes = $config->get("themes.{$name}.streams.schemes", []);
$schemes += [
'theme' => [
'type' => 'ReadOnlyStream',
'paths' => $locator->findResources("themes://{$name}", false)
]
];
foreach ($schemes as $scheme => $config) {
if (isset($config['paths'])) {
$locator->addPath($scheme, '', $config['paths']);
}
if (isset($config['prefixes'])) {
foreach ($config['prefixes'] as $prefix => $paths) {
$locator->addPath($scheme, $prefix, $paths);
}
}
if (\in_array($scheme, $registered, true)) {
stream_wrapper_unregister($scheme);
}
$type = !empty($config['type']) ? $config['type'] : 'ReadOnlyStream';
if ($type[0] !== '\\') {
$type = '\\RocketTheme\\Toolbox\\StreamWrapper\\' . $type;
}
if (!stream_wrapper_register($scheme, $type)) {
throw new \InvalidArgumentException("Stream '{$type}' could not be initialized.");
}
}
// Load languages after streams has been properly initialized
$this->loadLanguages($this->config);
} | [
"public",
"function",
"configure",
"(",
")",
"{",
"$",
"name",
"=",
"$",
"this",
"->",
"current",
"(",
")",
";",
"$",
"config",
"=",
"$",
"this",
"->",
"config",
";",
"$",
"this",
"->",
"loadConfiguration",
"(",
"$",
"name",
",",
"$",
"config",
")"... | Configure and prepare streams for current template.
@throws \InvalidArgumentException | [
"Configure",
"and",
"prepare",
"streams",
"for",
"current",
"template",
"."
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Themes.php#L223-L268 | train | Configure the stream wrapper | [
30522,
2270,
3853,
9530,
8873,
27390,
2063,
1006,
1007,
1063,
1002,
2171,
1027,
1002,
2023,
1011,
1028,
2783,
1006,
1007,
1025,
1002,
9530,
8873,
2290,
1027,
1002,
2023,
1011,
1028,
9530,
8873,
2290,
1025,
1002,
2023,
1011,
1028,
7170,
86... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/DataTableFactory.php | DataTableFactory.expandDataTable | public function expandDataTable($maxSubtableDepth = null, $addMetadataSubtableId = false)
{
$this->expandDataTable = true;
$this->maxSubtableDepth = $maxSubtableDepth;
$this->addMetadataSubtableId = $addMetadataSubtableId;
} | php | public function expandDataTable($maxSubtableDepth = null, $addMetadataSubtableId = false)
{
$this->expandDataTable = true;
$this->maxSubtableDepth = $maxSubtableDepth;
$this->addMetadataSubtableId = $addMetadataSubtableId;
} | [
"public",
"function",
"expandDataTable",
"(",
"$",
"maxSubtableDepth",
"=",
"null",
",",
"$",
"addMetadataSubtableId",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"expandDataTable",
"=",
"true",
";",
"$",
"this",
"->",
"maxSubtableDepth",
"=",
"$",
"maxSubtable... | Tells the factory instance to expand the DataTables that are created by
creating subtables and setting the subtable IDs of rows w/ subtables correctly.
@param null|int $maxSubtableDepth max depth for subtables.
@param bool $addMetadataSubtableId Whether to add the subtable ID used in the
database to the in-memory DataTables as
metadata or not. | [
"Tells",
"the",
"factory",
"instance",
"to",
"expand",
"the",
"DataTables",
"that",
"are",
"created",
"by",
"creating",
"subtables",
"and",
"setting",
"the",
"subtable",
"IDs",
"of",
"rows",
"w",
"/",
"subtables",
"correctly",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Archive/DataTableFactory.php#L125-L130 | train | Expand the datatable | [
30522,
2270,
3853,
7818,
2850,
29336,
3085,
1006,
1002,
4098,
6342,
19279,
3085,
3207,
13876,
2232,
30524,
11368,
8447,
10230,
12083,
10880,
3593,
1027,
6270,
1007,
1063,
1002,
2023,
1011,
1028,
7818,
2850,
29336,
3085,
1027,
2995,
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... |
symfony/symfony | src/Symfony/Component/Config/Definition/Builder/NodeBuilder.php | NodeBuilder.node | public function node($name, $type)
{
$class = $this->getNodeClass($type);
$node = new $class($name);
$this->append($node);
return $node;
} | php | public function node($name, $type)
{
$class = $this->getNodeClass($type);
$node = new $class($name);
$this->append($node);
return $node;
} | [
"public",
"function",
"node",
"(",
"$",
"name",
",",
"$",
"type",
")",
"{",
"$",
"class",
"=",
"$",
"this",
"->",
"getNodeClass",
"(",
"$",
"type",
")",
";",
"$",
"node",
"=",
"new",
"$",
"class",
"(",
"$",
"name",
")",
";",
"$",
"this",
"->",
... | Creates a child node.
@param string|null $name The name of the node
@param string $type The type of the node
@return NodeDefinition The child node
@throws \RuntimeException When the node type is not registered
@throws \RuntimeException When the node class is not found | [
"Creates",
"a",
"child",
"node",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Config/Definition/Builder/NodeBuilder.php#L154-L163 | train | Create new node and append it to the stack | [
30522,
2270,
3853,
13045,
1006,
1002,
2171,
1010,
1002,
2828,
1007,
1063,
1002,
2465,
1027,
1002,
2023,
1011,
1028,
2131,
3630,
3207,
26266,
1006,
1002,
2828,
1007,
1025,
1002,
13045,
1027,
2047,
1002,
2465,
1006,
1002,
2171,
1007,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Database/DatabaseManager.php | DatabaseManager.parseConnectionName | protected function parseConnectionName($name)
{
$name = $name ?: $this->getDefaultConnection();
return Str::endsWith($name, ['::read', '::write'])
? explode('::', $name, 2) : [$name, null];
} | php | protected function parseConnectionName($name)
{
$name = $name ?: $this->getDefaultConnection();
return Str::endsWith($name, ['::read', '::write'])
? explode('::', $name, 2) : [$name, null];
} | [
"protected",
"function",
"parseConnectionName",
"(",
"$",
"name",
")",
"{",
"$",
"name",
"=",
"$",
"name",
"?",
":",
"$",
"this",
"->",
"getDefaultConnection",
"(",
")",
";",
"return",
"Str",
"::",
"endsWith",
"(",
"$",
"name",
",",
"[",
"'::read'",
",... | Parse the connection into an array of the name and read / write type.
@param string $name
@return array | [
"Parse",
"the",
"connection",
"into",
"an",
"array",
"of",
"the",
"name",
"and",
"read",
"/",
"write",
"type",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/DatabaseManager.php#L98-L104 | train | Parse connection name | [
30522,
5123,
3853,
11968,
3366,
8663,
2638,
7542,
18442,
1006,
1002,
2171,
1007,
1063,
1002,
2171,
1027,
1002,
2171,
1029,
1024,
1002,
2023,
1011,
1028,
2131,
3207,
7011,
11314,
8663,
2638,
7542,
1006,
1007,
1025,
2709,
2358,
2099,
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... |
matomo-org/matomo | libs/Zend/Cache/Backend/File.php | Zend_Cache_Backend_File.load | public function load($id, $doNotTestCacheValidity = false)
{
if (!($this->_test($id, $doNotTestCacheValidity))) {
// The cache is not hit !
return false;
}
$metadatas = $this->_getMetadatas($id);
$file = $this->_file($id);
$data = $this->_fileGetContents($file);
if ($this->_options['read_control']) {
$hashData = $this->_hash($data, $this->_options['read_control_type']);
$hashControl = $metadatas['hash'];
if ($hashData != $hashControl) {
// Problem detected by the read control !
$this->_log('Zend_Cache_Backend_File::load() / read_control : stored hash and computed hash do not match');
$this->remove($id);
return false;
}
}
return $data;
} | php | public function load($id, $doNotTestCacheValidity = false)
{
if (!($this->_test($id, $doNotTestCacheValidity))) {
// The cache is not hit !
return false;
}
$metadatas = $this->_getMetadatas($id);
$file = $this->_file($id);
$data = $this->_fileGetContents($file);
if ($this->_options['read_control']) {
$hashData = $this->_hash($data, $this->_options['read_control_type']);
$hashControl = $metadatas['hash'];
if ($hashData != $hashControl) {
// Problem detected by the read control !
$this->_log('Zend_Cache_Backend_File::load() / read_control : stored hash and computed hash do not match');
$this->remove($id);
return false;
}
}
return $data;
} | [
"public",
"function",
"load",
"(",
"$",
"id",
",",
"$",
"doNotTestCacheValidity",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"(",
"$",
"this",
"->",
"_test",
"(",
"$",
"id",
",",
"$",
"doNotTestCacheValidity",
")",
")",
")",
"{",
"// The cache is not hit !"... | Test if a cache is available for the given id and (if yes) return it (false else)
@param string $id cache id
@param boolean $doNotTestCacheValidity if set to true, the cache validity won't be tested
@return string|false cached datas | [
"Test",
"if",
"a",
"cache",
"is",
"available",
"for",
"the",
"given",
"id",
"and",
"(",
"if",
"yes",
")",
"return",
"it",
"(",
"false",
"else",
")"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Cache/Backend/File.php#L173-L193 | train | Load the cache file | [
30522,
2270,
3853,
7170,
1006,
1002,
8909,
1010,
1002,
2123,
28495,
3367,
3540,
16179,
11475,
25469,
1027,
6270,
1007,
1063,
2065,
1006,
999,
1006,
1002,
2023,
1011,
1028,
1035,
3231,
1006,
1002,
8909,
1010,
1002,
2123,
28495,
3367,
3540,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Database/Eloquent/Model.php | Model.isIgnoringTouch | public static function isIgnoringTouch($class = null)
{
$class = $class ?: static::class;
foreach (static::$ignoreOnTouch as $ignoredClass) {
if ($class === $ignoredClass || is_subclass_of($class, $ignoredClass)) {
return true;
}
}
return false;
} | php | public static function isIgnoringTouch($class = null)
{
$class = $class ?: static::class;
foreach (static::$ignoreOnTouch as $ignoredClass) {
if ($class === $ignoredClass || is_subclass_of($class, $ignoredClass)) {
return true;
}
}
return false;
} | [
"public",
"static",
"function",
"isIgnoringTouch",
"(",
"$",
"class",
"=",
"null",
")",
"{",
"$",
"class",
"=",
"$",
"class",
"?",
":",
"static",
"::",
"class",
";",
"foreach",
"(",
"static",
"::",
"$",
"ignoreOnTouch",
"as",
"$",
"ignoredClass",
")",
... | Determine if the given model is ignoring touches.
@param string|null $class
@return bool | [
"Determine",
"if",
"the",
"given",
"model",
"is",
"ignoring",
"touches",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Model.php#L293-L304 | train | Returns true if the class is ignoring touch | [
30522,
2270,
10763,
3853,
2003,
23773,
28741,
13512,
7140,
2818,
1006,
1002,
2465,
1027,
19701,
1007,
1063,
1002,
2465,
1027,
1002,
2465,
1029,
1024,
10763,
1024,
1024,
2465,
1025,
18921,
6776,
1006,
10763,
1024,
1024,
1002,
8568,
12162,
71... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/SystemController.php | SystemController.combine | public function combine($name)
{
try {
if (!strpos($name, '-')) {
throw new ApplicationException(Lang::get('system::lang.combiner.not_found', ['name' => $name]));
}
$parts = explode('-', $name);
$cacheId = $parts[0];
$combiner = CombineAssets::instance();
return $combiner->getContents($cacheId);
}
catch (Exception $ex) {
return '/* '.e($ex->getMessage()).' */';
}
} | php | public function combine($name)
{
try {
if (!strpos($name, '-')) {
throw new ApplicationException(Lang::get('system::lang.combiner.not_found', ['name' => $name]));
}
$parts = explode('-', $name);
$cacheId = $parts[0];
$combiner = CombineAssets::instance();
return $combiner->getContents($cacheId);
}
catch (Exception $ex) {
return '/* '.e($ex->getMessage()).' */';
}
} | [
"public",
"function",
"combine",
"(",
"$",
"name",
")",
"{",
"try",
"{",
"if",
"(",
"!",
"strpos",
"(",
"$",
"name",
",",
"'-'",
")",
")",
"{",
"throw",
"new",
"ApplicationException",
"(",
"Lang",
"::",
"get",
"(",
"'system::lang.combiner.not_found'",
",... | Combines JavaScript and StyleSheet assets.
@param string $name Combined file code
@return string Combined content. | [
"Combines",
"JavaScript",
"and",
"StyleSheet",
"assets",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/SystemController.php#L23-L41 | train | Combine assets from cache | [
30522,
2270,
3853,
11506,
1006,
1002,
2171,
1007,
1063,
3046,
1063,
2065,
1006,
999,
2358,
14536,
2891,
1006,
1002,
2171,
1010,
1005,
1011,
1005,
1007,
1007,
1063,
5466,
2047,
4646,
10288,
24422,
1006,
11374,
1024,
1024,
2131,
1006,
1005,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/system/classes/SettingsManager.php | SettingsManager.setContext | public static function setContext($owner, $code)
{
$instance = self::instance();
$instance->contextOwner = strtolower($owner);
$instance->contextItemCode = strtolower($code);
} | php | public static function setContext($owner, $code)
{
$instance = self::instance();
$instance->contextOwner = strtolower($owner);
$instance->contextItemCode = strtolower($code);
} | [
"public",
"static",
"function",
"setContext",
"(",
"$",
"owner",
",",
"$",
"code",
")",
"{",
"$",
"instance",
"=",
"self",
"::",
"instance",
"(",
")",
";",
"$",
"instance",
"->",
"contextOwner",
"=",
"strtolower",
"(",
"$",
"owner",
")",
";",
"$",
"i... | Sets the navigation context.
@param string $owner Specifies the setting items owner plugin or module in the format Vendor.Module.
@param string $code Specifies the settings item code. | [
"Sets",
"the",
"navigation",
"context",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/SettingsManager.php#L314-L320 | train | Set the context owner and code of the item | [
30522,
2270,
10763,
3853,
2275,
8663,
18209,
1006,
1002,
3954,
1010,
1002,
3642,
1007,
1063,
1002,
6013,
1027,
2969,
1024,
1024,
6013,
1006,
1007,
1025,
1002,
6013,
1011,
1028,
6123,
12384,
2121,
1027,
2358,
5339,
12898,
13777,
1006,
1002,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Support/Arr.php | Arr.sortRecursive | public static function sortRecursive($array)
{
foreach ($array as &$value) {
if (is_array($value)) {
$value = static::sortRecursive($value);
}
}
if (static::isAssoc($array)) {
ksort($array);
} else {
sort($array);
}
return $array;
} | php | public static function sortRecursive($array)
{
foreach ($array as &$value) {
if (is_array($value)) {
$value = static::sortRecursive($value);
}
}
if (static::isAssoc($array)) {
ksort($array);
} else {
sort($array);
}
return $array;
} | [
"public",
"static",
"function",
"sortRecursive",
"(",
"$",
"array",
")",
"{",
"foreach",
"(",
"$",
"array",
"as",
"&",
"$",
"value",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"value",
")",
")",
"{",
"$",
"value",
"=",
"static",
"::",
"sortRecursive"... | Recursively sort an array by keys and values.
@param array $array
@return array | [
"Recursively",
"sort",
"an",
"array",
"by",
"keys",
"and",
"values",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Support/Arr.php#L570-L585 | train | Sort recursive array | [
30522,
2270,
10763,
3853,
4066,
2890,
10841,
2869,
3512,
1006,
1002,
9140,
1007,
1063,
18921,
6776,
1006,
1002,
9140,
2004,
1004,
1002,
3643,
1007,
1063,
2065,
1006,
2003,
1035,
9140,
1006,
1002,
3643,
1007,
1007,
1063,
1002,
3643,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php | HasAttributes.castAttributeAsJson | protected function castAttributeAsJson($key, $value)
{
$value = $this->asJson($value);
if ($value === false) {
throw JsonEncodingException::forAttribute(
$this, $key, json_last_error_msg()
);
}
return $value;
} | php | protected function castAttributeAsJson($key, $value)
{
$value = $this->asJson($value);
if ($value === false) {
throw JsonEncodingException::forAttribute(
$this, $key, json_last_error_msg()
);
}
return $value;
} | [
"protected",
"function",
"castAttributeAsJson",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"asJson",
"(",
"$",
"value",
")",
";",
"if",
"(",
"$",
"value",
"===",
"false",
")",
"{",
"throw",
"JsonEncodingExceptio... | Cast the given attribute to JSON.
@param string $key
@param mixed $value
@return string | [
"Cast",
"the",
"given",
"attribute",
"to",
"JSON",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php#L678-L689 | train | Casts a attribute value to a JSON string | [
30522,
5123,
3853,
3459,
19321,
3089,
8569,
27058,
2015,
22578,
2239,
1006,
1002,
3145,
1010,
1002,
3643,
1007,
1063,
1002,
3643,
1027,
1002,
2023,
1011,
1028,
2004,
22578,
2239,
1006,
1002,
3643,
1007,
1025,
2065,
1006,
1002,
3643,
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... |
walkor/Workerman | Worker.php | Worker.runAll | public static function runAll()
{
static::checkSapiEnv();
static::init();
static::lock();
static::parseCommand();
static::daemonize();
static::initWorkers();
static::installSignal();
static::saveMasterPid();
static::unlock();
static::displayUI();
static::forkWorkers();
static::resetStd();
static::monitorWorkers();
} | php | public static function runAll()
{
static::checkSapiEnv();
static::init();
static::lock();
static::parseCommand();
static::daemonize();
static::initWorkers();
static::installSignal();
static::saveMasterPid();
static::unlock();
static::displayUI();
static::forkWorkers();
static::resetStd();
static::monitorWorkers();
} | [
"public",
"static",
"function",
"runAll",
"(",
")",
"{",
"static",
"::",
"checkSapiEnv",
"(",
")",
";",
"static",
"::",
"init",
"(",
")",
";",
"static",
"::",
"lock",
"(",
")",
";",
"static",
"::",
"parseCommand",
"(",
")",
";",
"static",
"::",
"daem... | Run all worker instances.
@return void | [
"Run",
"all",
"worker",
"instances",
"."
] | 13649907f05014fcfffcfccaef01e63ad3339351 | https://github.com/walkor/Workerman/blob/13649907f05014fcfffcfccaef01e63ad3339351/Worker.php#L497-L512 | train | Runs all the workers | [
30522,
2270,
10763,
3853,
2448,
8095,
1006,
1007,
1063,
10763,
1024,
1024,
14148,
9331,
9013,
2615,
1006,
1007,
1025,
10763,
1024,
1024,
1999,
4183,
1006,
1007,
1025,
10763,
1024,
1024,
5843,
1006,
1007,
1025,
10763,
1024,
1024,
11968,
3366... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/DataTable/Renderer/Json.php | Json.renderTable | protected function renderTable($table)
{
if (is_array($table)) {
$array = $table;
if (self::shouldWrapArrayBeforeRendering($array, $wrapSingleValues = true)) {
$array = array($array);
}
foreach ($array as $key => $tab) {
if ($tab instanceof DataTable\Map
|| $tab instanceof DataTable
|| $tab instanceof DataTable\Simple) {
$array[$key] = $this->convertDataTableToArray($tab);
if (!is_array($array[$key])) {
$array[$key] = array('value' => $array[$key]);
}
}
}
} else {
$array = $this->convertDataTableToArray($table);
}
if (!is_array($array)) {
$array = array('value' => $array);
}
// decode all entities
$callback = function (&$value, $key) {
if (is_string($value)) {
$value = html_entity_decode($value, ENT_QUOTES, "UTF-8");
};
};
array_walk_recursive($array, $callback);
// silence "Warning: json_encode(): Invalid UTF-8 sequence in argument"
$str = @json_encode($array);
if ($str === false
&& json_last_error() === JSON_ERROR_UTF8
&& $this->canMakeArrayUtf8()) {
$array = $this->makeArrayUtf8($array);
$str = json_encode($array);
}
return $str;
} | php | protected function renderTable($table)
{
if (is_array($table)) {
$array = $table;
if (self::shouldWrapArrayBeforeRendering($array, $wrapSingleValues = true)) {
$array = array($array);
}
foreach ($array as $key => $tab) {
if ($tab instanceof DataTable\Map
|| $tab instanceof DataTable
|| $tab instanceof DataTable\Simple) {
$array[$key] = $this->convertDataTableToArray($tab);
if (!is_array($array[$key])) {
$array[$key] = array('value' => $array[$key]);
}
}
}
} else {
$array = $this->convertDataTableToArray($table);
}
if (!is_array($array)) {
$array = array('value' => $array);
}
// decode all entities
$callback = function (&$value, $key) {
if (is_string($value)) {
$value = html_entity_decode($value, ENT_QUOTES, "UTF-8");
};
};
array_walk_recursive($array, $callback);
// silence "Warning: json_encode(): Invalid UTF-8 sequence in argument"
$str = @json_encode($array);
if ($str === false
&& json_last_error() === JSON_ERROR_UTF8
&& $this->canMakeArrayUtf8()) {
$array = $this->makeArrayUtf8($array);
$str = json_encode($array);
}
return $str;
} | [
"protected",
"function",
"renderTable",
"(",
"$",
"table",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"table",
")",
")",
"{",
"$",
"array",
"=",
"$",
"table",
";",
"if",
"(",
"self",
"::",
"shouldWrapArrayBeforeRendering",
"(",
"$",
"array",
",",
"$",
... | Computes the output for the given data table
@param DataTable $table
@return string | [
"Computes",
"the",
"output",
"for",
"the",
"given",
"data",
"table"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/DataTable/Renderer/Json.php#L38-L84 | train | Render the table | [
30522,
5123,
3853,
17552,
10880,
1006,
1002,
2795,
1007,
1063,
2065,
1006,
2003,
1035,
9140,
1006,
1002,
2795,
1007,
1007,
1063,
1002,
9140,
1027,
1002,
2795,
1025,
2065,
1006,
2969,
1024,
1024,
2323,
13088,
22068,
11335,
2100,
4783,
29278,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Form/Extension/DataCollector/FormDataCollector.php | FormDataCollector.collectViewVariables | public function collectViewVariables(FormView $view)
{
$hash = spl_object_hash($view);
if (!isset($this->dataByView[$hash])) {
$this->dataByView[$hash] = [];
}
$this->dataByView[$hash] = array_replace(
$this->dataByView[$hash],
$this->dataExtractor->extractViewVariables($view)
);
foreach ($view->children as $child) {
$this->collectViewVariables($child);
}
} | php | public function collectViewVariables(FormView $view)
{
$hash = spl_object_hash($view);
if (!isset($this->dataByView[$hash])) {
$this->dataByView[$hash] = [];
}
$this->dataByView[$hash] = array_replace(
$this->dataByView[$hash],
$this->dataExtractor->extractViewVariables($view)
);
foreach ($view->children as $child) {
$this->collectViewVariables($child);
}
} | [
"public",
"function",
"collectViewVariables",
"(",
"FormView",
"$",
"view",
")",
"{",
"$",
"hash",
"=",
"spl_object_hash",
"(",
"$",
"view",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"dataByView",
"[",
"$",
"hash",
"]",
")",
")",
"{"... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Extension/DataCollector/FormDataCollector.php#L184-L200 | train | Collect all view variables from the form view | [
30522,
2270,
3853,
8145,
8584,
10755,
19210,
2015,
1006,
2433,
8584,
1002,
3193,
1007,
1063,
1002,
23325,
1027,
11867,
2140,
1035,
4874,
1035,
23325,
1006,
1002,
3193,
1007,
1025,
2065,
1006,
999,
26354,
3388,
1006,
1002,
2023,
1011,
1028,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Database/Eloquent/Concerns/HasRelationships.php | HasRelationships.hasManyThrough | public function hasManyThrough($related, $through, $firstKey = null, $secondKey = null, $localKey = null, $secondLocalKey = null)
{
$through = new $through;
$firstKey = $firstKey ?: $this->getForeignKey();
$secondKey = $secondKey ?: $through->getForeignKey();
return $this->newHasManyThrough(
$this->newRelatedInstance($related)->newQuery(), $this, $through,
$firstKey, $secondKey, $localKey ?: $this->getKeyName(),
$secondLocalKey ?: $through->getKeyName()
);
} | php | public function hasManyThrough($related, $through, $firstKey = null, $secondKey = null, $localKey = null, $secondLocalKey = null)
{
$through = new $through;
$firstKey = $firstKey ?: $this->getForeignKey();
$secondKey = $secondKey ?: $through->getForeignKey();
return $this->newHasManyThrough(
$this->newRelatedInstance($related)->newQuery(), $this, $through,
$firstKey, $secondKey, $localKey ?: $this->getKeyName(),
$secondLocalKey ?: $through->getKeyName()
);
} | [
"public",
"function",
"hasManyThrough",
"(",
"$",
"related",
",",
"$",
"through",
",",
"$",
"firstKey",
"=",
"null",
",",
"$",
"secondKey",
"=",
"null",
",",
"$",
"localKey",
"=",
"null",
",",
"$",
"secondLocalKey",
"=",
"null",
")",
"{",
"$",
"through... | Define a has-many-through relationship.
@param string $related
@param string $through
@param string|null $firstKey
@param string|null $secondKey
@param string|null $localKey
@param string|null $secondLocalKey
@return \Illuminate\Database\Eloquent\Relations\HasManyThrough | [
"Define",
"a",
"has",
"-",
"many",
"-",
"through",
"relationship",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Concerns/HasRelationships.php#L363-L376 | train | Return a has - many - through relationship | [
30522,
2270,
3853,
2038,
2386,
22123,
8093,
10593,
1006,
1002,
3141,
1010,
1002,
2083,
1010,
1002,
2034,
14839,
1027,
19701,
1010,
1002,
2117,
14839,
1027,
19701,
1010,
1002,
2334,
14839,
1027,
19701,
1010,
1002,
2117,
4135,
9289,
14839,
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/Query/Builder.php | Builder.whereJsonDoesntContain | public function whereJsonDoesntContain($column, $value, $boolean = 'and')
{
return $this->whereJsonContains($column, $value, $boolean, true);
} | php | public function whereJsonDoesntContain($column, $value, $boolean = 'and')
{
return $this->whereJsonContains($column, $value, $boolean, true);
} | [
"public",
"function",
"whereJsonDoesntContain",
"(",
"$",
"column",
",",
"$",
"value",
",",
"$",
"boolean",
"=",
"'and'",
")",
"{",
"return",
"$",
"this",
"->",
"whereJsonContains",
"(",
"$",
"column",
",",
"$",
"value",
",",
"$",
"boolean",
",",
"true",... | Add a "where JSON not contains" clause to the query.
@param string $column
@param mixed $value
@param string $boolean
@return $this | [
"Add",
"a",
"where",
"JSON",
"not",
"contains",
"clause",
"to",
"the",
"query",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Query/Builder.php#L1548-L1551 | train | Devuelve el whereJsonDoesntContain de la tabla | [
30522,
2270,
3853,
2073,
22578,
15422,
22504,
3372,
8663,
18249,
1006,
1002,
5930,
1010,
1002,
3643,
1010,
1002,
22017,
20898,
1027,
1005,
1998,
1005,
1007,
1063,
2709,
1002,
2023,
1011,
1028,
2073,
22578,
2239,
8663,
18249,
2015,
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/Twig/TwigExtension.php | TwigExtension.getFilters | public function getFilters()
{
return [
new \Twig_SimpleFilter('*ize', [$this, 'inflectorFilter']),
new \Twig_SimpleFilter('absolute_url', [$this, 'absoluteUrlFilter']),
new \Twig_SimpleFilter('contains', [$this, 'containsFilter']),
new \Twig_SimpleFilter('chunk_split', [$this, 'chunkSplitFilter']),
new \Twig_SimpleFilter('nicenumber', [$this, 'niceNumberFunc']),
new \Twig_SimpleFilter('nicefilesize', [$this, 'niceFilesizeFunc']),
new \Twig_SimpleFilter('nicetime', [$this, 'nicetimeFunc']),
new \Twig_SimpleFilter('defined', [$this, 'definedDefaultFilter']),
new \Twig_SimpleFilter('ends_with', [$this, 'endsWithFilter']),
new \Twig_SimpleFilter('fieldName', [$this, 'fieldNameFilter']),
new \Twig_SimpleFilter('ksort', [$this, 'ksortFilter']),
new \Twig_SimpleFilter('ltrim', [$this, 'ltrimFilter']),
new \Twig_SimpleFilter('markdown', [$this, 'markdownFunction'], ['is_safe' => ['html']]),
new \Twig_SimpleFilter('md5', [$this, 'md5Filter']),
new \Twig_SimpleFilter('base32_encode', [$this, 'base32EncodeFilter']),
new \Twig_SimpleFilter('base32_decode', [$this, 'base32DecodeFilter']),
new \Twig_SimpleFilter('base64_encode', [$this, 'base64EncodeFilter']),
new \Twig_SimpleFilter('base64_decode', [$this, 'base64DecodeFilter']),
new \Twig_SimpleFilter('randomize', [$this, 'randomizeFilter']),
new \Twig_SimpleFilter('modulus', [$this, 'modulusFilter']),
new \Twig_SimpleFilter('rtrim', [$this, 'rtrimFilter']),
new \Twig_SimpleFilter('pad', [$this, 'padFilter']),
new \Twig_SimpleFilter('regex_replace', [$this, 'regexReplace']),
new \Twig_SimpleFilter('safe_email', [$this, 'safeEmailFilter']),
new \Twig_SimpleFilter('safe_truncate', ['\Grav\Common\Utils', 'safeTruncate']),
new \Twig_SimpleFilter('safe_truncate_html', ['\Grav\Common\Utils', 'safeTruncateHTML']),
new \Twig_SimpleFilter('sort_by_key', [$this, 'sortByKeyFilter']),
new \Twig_SimpleFilter('starts_with', [$this, 'startsWithFilter']),
new \Twig_SimpleFilter('truncate', ['\Grav\Common\Utils', 'truncate']),
new \Twig_SimpleFilter('truncate_html', ['\Grav\Common\Utils', 'truncateHTML']),
new \Twig_SimpleFilter('json_decode', [$this, 'jsonDecodeFilter']),
new \Twig_SimpleFilter('array_unique', 'array_unique'),
new \Twig_SimpleFilter('basename', 'basename'),
new \Twig_SimpleFilter('dirname', 'dirname'),
new \Twig_SimpleFilter('print_r', 'print_r'),
new \Twig_SimpleFilter('yaml_encode', [$this, 'yamlEncodeFilter']),
new \Twig_SimpleFilter('yaml_decode', [$this, 'yamlDecodeFilter']),
new \Twig_SimpleFilter('nicecron', [$this, 'niceCronFilter']),
// Translations
new \Twig_SimpleFilter('t', [$this, 'translate'], ['needs_environment' => true]),
new \Twig_SimpleFilter('tl', [$this, 'translateLanguage']),
new \Twig_SimpleFilter('ta', [$this, 'translateArray']),
// Casting values
new \Twig_SimpleFilter('string', [$this, 'stringFilter']),
new \Twig_SimpleFilter('int', [$this, 'intFilter'], ['is_safe' => ['all']]),
new \Twig_SimpleFilter('bool', [$this, 'boolFilter']),
new \Twig_SimpleFilter('float', [$this, 'floatFilter'], ['is_safe' => ['all']]),
new \Twig_SimpleFilter('array', [$this, 'arrayFilter']),
// Object Types
new \Twig_SimpleFilter('get_type', [$this, 'getTypeFunc']),
new \Twig_SimpleFilter('of_type', [$this, 'ofTypeFunc'])
];
} | php | public function getFilters()
{
return [
new \Twig_SimpleFilter('*ize', [$this, 'inflectorFilter']),
new \Twig_SimpleFilter('absolute_url', [$this, 'absoluteUrlFilter']),
new \Twig_SimpleFilter('contains', [$this, 'containsFilter']),
new \Twig_SimpleFilter('chunk_split', [$this, 'chunkSplitFilter']),
new \Twig_SimpleFilter('nicenumber', [$this, 'niceNumberFunc']),
new \Twig_SimpleFilter('nicefilesize', [$this, 'niceFilesizeFunc']),
new \Twig_SimpleFilter('nicetime', [$this, 'nicetimeFunc']),
new \Twig_SimpleFilter('defined', [$this, 'definedDefaultFilter']),
new \Twig_SimpleFilter('ends_with', [$this, 'endsWithFilter']),
new \Twig_SimpleFilter('fieldName', [$this, 'fieldNameFilter']),
new \Twig_SimpleFilter('ksort', [$this, 'ksortFilter']),
new \Twig_SimpleFilter('ltrim', [$this, 'ltrimFilter']),
new \Twig_SimpleFilter('markdown', [$this, 'markdownFunction'], ['is_safe' => ['html']]),
new \Twig_SimpleFilter('md5', [$this, 'md5Filter']),
new \Twig_SimpleFilter('base32_encode', [$this, 'base32EncodeFilter']),
new \Twig_SimpleFilter('base32_decode', [$this, 'base32DecodeFilter']),
new \Twig_SimpleFilter('base64_encode', [$this, 'base64EncodeFilter']),
new \Twig_SimpleFilter('base64_decode', [$this, 'base64DecodeFilter']),
new \Twig_SimpleFilter('randomize', [$this, 'randomizeFilter']),
new \Twig_SimpleFilter('modulus', [$this, 'modulusFilter']),
new \Twig_SimpleFilter('rtrim', [$this, 'rtrimFilter']),
new \Twig_SimpleFilter('pad', [$this, 'padFilter']),
new \Twig_SimpleFilter('regex_replace', [$this, 'regexReplace']),
new \Twig_SimpleFilter('safe_email', [$this, 'safeEmailFilter']),
new \Twig_SimpleFilter('safe_truncate', ['\Grav\Common\Utils', 'safeTruncate']),
new \Twig_SimpleFilter('safe_truncate_html', ['\Grav\Common\Utils', 'safeTruncateHTML']),
new \Twig_SimpleFilter('sort_by_key', [$this, 'sortByKeyFilter']),
new \Twig_SimpleFilter('starts_with', [$this, 'startsWithFilter']),
new \Twig_SimpleFilter('truncate', ['\Grav\Common\Utils', 'truncate']),
new \Twig_SimpleFilter('truncate_html', ['\Grav\Common\Utils', 'truncateHTML']),
new \Twig_SimpleFilter('json_decode', [$this, 'jsonDecodeFilter']),
new \Twig_SimpleFilter('array_unique', 'array_unique'),
new \Twig_SimpleFilter('basename', 'basename'),
new \Twig_SimpleFilter('dirname', 'dirname'),
new \Twig_SimpleFilter('print_r', 'print_r'),
new \Twig_SimpleFilter('yaml_encode', [$this, 'yamlEncodeFilter']),
new \Twig_SimpleFilter('yaml_decode', [$this, 'yamlDecodeFilter']),
new \Twig_SimpleFilter('nicecron', [$this, 'niceCronFilter']),
// Translations
new \Twig_SimpleFilter('t', [$this, 'translate'], ['needs_environment' => true]),
new \Twig_SimpleFilter('tl', [$this, 'translateLanguage']),
new \Twig_SimpleFilter('ta', [$this, 'translateArray']),
// Casting values
new \Twig_SimpleFilter('string', [$this, 'stringFilter']),
new \Twig_SimpleFilter('int', [$this, 'intFilter'], ['is_safe' => ['all']]),
new \Twig_SimpleFilter('bool', [$this, 'boolFilter']),
new \Twig_SimpleFilter('float', [$this, 'floatFilter'], ['is_safe' => ['all']]),
new \Twig_SimpleFilter('array', [$this, 'arrayFilter']),
// Object Types
new \Twig_SimpleFilter('get_type', [$this, 'getTypeFunc']),
new \Twig_SimpleFilter('of_type', [$this, 'ofTypeFunc'])
];
} | [
"public",
"function",
"getFilters",
"(",
")",
"{",
"return",
"[",
"new",
"\\",
"Twig_SimpleFilter",
"(",
"'*ize'",
",",
"[",
"$",
"this",
",",
"'inflectorFilter'",
"]",
")",
",",
"new",
"\\",
"Twig_SimpleFilter",
"(",
"'absolute_url'",
",",
"[",
"$",
"this... | Return a list of all filters.
@return array | [
"Return",
"a",
"list",
"of",
"all",
"filters",
"."
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Twig/TwigExtension.php#L72-L130 | train | Get all filters | [
30522,
2270,
3853,
2131,
8873,
21928,
2015,
1006,
1007,
1063,
2709,
1031,
2047,
1032,
1056,
16279,
1035,
3722,
8873,
21928,
1006,
1005,
1008,
1045,
4371,
1005,
1010,
1031,
1002,
2023,
1010,
1005,
1999,
21031,
16761,
8873,
21928,
1005,
1033,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Form/Extension/Validator/ValidatorTypeGuesser.php | ValidatorTypeGuesser.guessPattern | public function guessPattern($class, $property)
{
return $this->guess($class, $property, function (Constraint $constraint) {
return $this->guessPatternForConstraint($constraint);
});
} | php | public function guessPattern($class, $property)
{
return $this->guess($class, $property, function (Constraint $constraint) {
return $this->guessPatternForConstraint($constraint);
});
} | [
"public",
"function",
"guessPattern",
"(",
"$",
"class",
",",
"$",
"property",
")",
"{",
"return",
"$",
"this",
"->",
"guess",
"(",
"$",
"class",
",",
"$",
"property",
",",
"function",
"(",
"Constraint",
"$",
"constraint",
")",
"{",
"return",
"$",
"thi... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Extension/Validator/ValidatorTypeGuesser.php#L66-L71 | train | Guesses the pattern for a property of a class. | [
30522,
2270,
3853,
3984,
4502,
12079,
2078,
1006,
1002,
2465,
1010,
1002,
3200,
1007,
1063,
2709,
1002,
2023,
1011,
1028,
3984,
1006,
1002,
2465,
1010,
1002,
3200,
1010,
3853,
1006,
27142,
1002,
27142,
1007,
1063,
2709,
1002,
2023,
1011,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Templating/TemplateNameParser.php | TemplateNameParser.parse | public function parse($name)
{
if ($name instanceof TemplateReferenceInterface) {
return $name;
}
$engine = null;
if (false !== $pos = strrpos($name, '.')) {
$engine = substr($name, $pos + 1);
}
return new TemplateReference($name, $engine);
} | php | public function parse($name)
{
if ($name instanceof TemplateReferenceInterface) {
return $name;
}
$engine = null;
if (false !== $pos = strrpos($name, '.')) {
$engine = substr($name, $pos + 1);
}
return new TemplateReference($name, $engine);
} | [
"public",
"function",
"parse",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"$",
"name",
"instanceof",
"TemplateReferenceInterface",
")",
"{",
"return",
"$",
"name",
";",
"}",
"$",
"engine",
"=",
"null",
";",
"if",
"(",
"false",
"!==",
"$",
"pos",
"=",
"st... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Templating/TemplateNameParser.php#L27-L39 | train | Parse a template reference name | [
30522,
2270,
3853,
11968,
3366,
1006,
1002,
2171,
1007,
1063,
2065,
1006,
1002,
2171,
6013,
11253,
23561,
2890,
25523,
18447,
2121,
12172,
1007,
1063,
2709,
1002,
2171,
1025,
1065,
1002,
3194,
1027,
19701,
1025,
2065,
1006,
6270,
999,
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 | libs/Zend/Db/Select.php | Zend_Db_Select._tableCols | protected function _tableCols($correlationName, $cols, $afterCorrelationName = null)
{
if (!is_array($cols)) {
$cols = array($cols);
}
if ($correlationName == null) {
$correlationName = '';
}
$columnValues = array();
foreach (array_filter($cols) as $alias => $col) {
$currentCorrelationName = $correlationName;
if (is_string($col)) {
// Check for a column matching "<column> AS <alias>" and extract the alias name
if (preg_match('/^(.+)\s+' . self::SQL_AS . '\s+(.+)$/i', $col, $m)) {
$col = $m[1];
$alias = $m[2];
}
// Check for columns that look like functions and convert to Zend_Db_Expr
if (preg_match('/\(.*\)/', $col)) {
$col = new Zend_Db_Expr($col);
} elseif (preg_match('/(.+)\.(.+)/', $col, $m)) {
$currentCorrelationName = $m[1];
$col = $m[2];
}
}
$columnValues[] = array($currentCorrelationName, $col, is_string($alias) ? $alias : null);
}
if ($columnValues) {
// should we attempt to prepend or insert these values?
if ($afterCorrelationName === true || is_string($afterCorrelationName)) {
$tmpColumns = $this->_parts[self::COLUMNS];
$this->_parts[self::COLUMNS] = array();
} else {
$tmpColumns = array();
}
// find the correlation name to insert after
if (is_string($afterCorrelationName)) {
while ($tmpColumns) {
$this->_parts[self::COLUMNS][] = $currentColumn = array_shift($tmpColumns);
if ($currentColumn[0] == $afterCorrelationName) {
break;
}
}
}
// apply current values to current stack
foreach ($columnValues as $columnValue) {
array_push($this->_parts[self::COLUMNS], $columnValue);
}
// finish ensuring that all previous values are applied (if they exist)
while ($tmpColumns) {
array_push($this->_parts[self::COLUMNS], array_shift($tmpColumns));
}
}
} | php | protected function _tableCols($correlationName, $cols, $afterCorrelationName = null)
{
if (!is_array($cols)) {
$cols = array($cols);
}
if ($correlationName == null) {
$correlationName = '';
}
$columnValues = array();
foreach (array_filter($cols) as $alias => $col) {
$currentCorrelationName = $correlationName;
if (is_string($col)) {
// Check for a column matching "<column> AS <alias>" and extract the alias name
if (preg_match('/^(.+)\s+' . self::SQL_AS . '\s+(.+)$/i', $col, $m)) {
$col = $m[1];
$alias = $m[2];
}
// Check for columns that look like functions and convert to Zend_Db_Expr
if (preg_match('/\(.*\)/', $col)) {
$col = new Zend_Db_Expr($col);
} elseif (preg_match('/(.+)\.(.+)/', $col, $m)) {
$currentCorrelationName = $m[1];
$col = $m[2];
}
}
$columnValues[] = array($currentCorrelationName, $col, is_string($alias) ? $alias : null);
}
if ($columnValues) {
// should we attempt to prepend or insert these values?
if ($afterCorrelationName === true || is_string($afterCorrelationName)) {
$tmpColumns = $this->_parts[self::COLUMNS];
$this->_parts[self::COLUMNS] = array();
} else {
$tmpColumns = array();
}
// find the correlation name to insert after
if (is_string($afterCorrelationName)) {
while ($tmpColumns) {
$this->_parts[self::COLUMNS][] = $currentColumn = array_shift($tmpColumns);
if ($currentColumn[0] == $afterCorrelationName) {
break;
}
}
}
// apply current values to current stack
foreach ($columnValues as $columnValue) {
array_push($this->_parts[self::COLUMNS], $columnValue);
}
// finish ensuring that all previous values are applied (if they exist)
while ($tmpColumns) {
array_push($this->_parts[self::COLUMNS], array_shift($tmpColumns));
}
}
} | [
"protected",
"function",
"_tableCols",
"(",
"$",
"correlationName",
",",
"$",
"cols",
",",
"$",
"afterCorrelationName",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"cols",
")",
")",
"{",
"$",
"cols",
"=",
"array",
"(",
"$",
"cols",
"... | Adds to the internal table-to-column mapping array.
@param string $tbl The table/join the columns come from.
@param array|string $cols The list of columns; preferably as
an array, but possibly as a string containing one column.
@param bool|string True if it should be prepended, a correlation name if it should be inserted
@return void | [
"Adds",
"to",
"the",
"internal",
"table",
"-",
"to",
"-",
"column",
"mapping",
"array",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Select.php#L920-L981 | train | Converts column names to Zend_Db_Expr objects | [
30522,
5123,
3853,
1035,
2795,
25778,
2015,
1006,
1002,
16902,
18442,
1010,
1002,
8902,
2015,
1010,
1002,
2044,
27108,
16570,
3370,
18442,
1027,
19701,
1007,
1063,
2065,
1006,
999,
2003,
1035,
9140,
1006,
1002,
8902,
2015,
1007,
1007,
1063,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
z-song/laravel-admin | src/Form/Field/Textarea.php | Textarea.render | public function render()
{
if (is_array($this->value)) {
$this->value = json_encode($this->value, JSON_PRETTY_PRINT);
}
return parent::render()->with(['rows' => $this->rows]);
} | php | public function render()
{
if (is_array($this->value)) {
$this->value = json_encode($this->value, JSON_PRETTY_PRINT);
}
return parent::render()->with(['rows' => $this->rows]);
} | [
"public",
"function",
"render",
"(",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"this",
"->",
"value",
")",
")",
"{",
"$",
"this",
"->",
"value",
"=",
"json_encode",
"(",
"$",
"this",
"->",
"value",
",",
"JSON_PRETTY_PRINT",
")",
";",
"}",
"return",
... | {@inheritdoc} | [
"{"
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Form/Field/Textarea.php#L33-L40 | train | Render the form field | [
30522,
2270,
3853,
17552,
1006,
1007,
1063,
2065,
1006,
2003,
1035,
9140,
1006,
1002,
2023,
1011,
1028,
3643,
1007,
1007,
1063,
1002,
2023,
1011,
1028,
3643,
1027,
1046,
3385,
1035,
4372,
16044,
1006,
1002,
2023,
1011,
1028,
3643,
1010,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/Zend/Cache/Backend/ZendPlatform.php | Zend_Cache_Backend_ZendPlatform.clean | public function clean($mode = Zend_Cache::CLEANING_MODE_ALL, $tags = array())
{
switch ($mode) {
case Zend_Cache::CLEANING_MODE_ALL:
case Zend_Cache::CLEANING_MODE_OLD:
$cache_dir = ini_get('zend_accelerator.output_cache_dir');
if (!$cache_dir) {
return false;
}
$cache_dir .= '/.php_cache_api/';
return $this->_clean($cache_dir, $mode);
break;
case Zend_Cache::CLEANING_MODE_MATCHING_TAG:
$idlist = null;
foreach ($tags as $tag) {
$next_idlist = output_cache_get(self::TAGS_PREFIX.$tag, $this->_directives['lifetime']);
if ($idlist) {
$idlist = array_intersect_assoc($idlist, $next_idlist);
} else {
$idlist = $next_idlist;
}
if (count($idlist) == 0) {
// if ID list is already empty - we may skip checking other IDs
$idlist = null;
break;
}
}
if ($idlist) {
foreach ($idlist as $id) {
output_cache_remove_key($id);
}
}
return true;
break;
case Zend_Cache::CLEANING_MODE_NOT_MATCHING_TAG:
$this->_log("Zend_Cache_Backend_ZendPlatform::clean() : CLEANING_MODE_NOT_MATCHING_TAG is not supported by the Zend Platform backend");
return false;
break;
case Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG:
$idlist = null;
foreach ($tags as $tag) {
$next_idlist = output_cache_get(self::TAGS_PREFIX.$tag, $this->_directives['lifetime']);
if ($idlist) {
$idlist = array_merge_recursive($idlist, $next_idlist);
} else {
$idlist = $next_idlist;
}
if (count($idlist) == 0) {
// if ID list is already empty - we may skip checking other IDs
$idlist = null;
break;
}
}
if ($idlist) {
foreach ($idlist as $id) {
output_cache_remove_key($id);
}
}
return true;
break;
default:
Zend_Cache::throwException('Invalid mode for clean() method');
break;
}
} | php | public function clean($mode = Zend_Cache::CLEANING_MODE_ALL, $tags = array())
{
switch ($mode) {
case Zend_Cache::CLEANING_MODE_ALL:
case Zend_Cache::CLEANING_MODE_OLD:
$cache_dir = ini_get('zend_accelerator.output_cache_dir');
if (!$cache_dir) {
return false;
}
$cache_dir .= '/.php_cache_api/';
return $this->_clean($cache_dir, $mode);
break;
case Zend_Cache::CLEANING_MODE_MATCHING_TAG:
$idlist = null;
foreach ($tags as $tag) {
$next_idlist = output_cache_get(self::TAGS_PREFIX.$tag, $this->_directives['lifetime']);
if ($idlist) {
$idlist = array_intersect_assoc($idlist, $next_idlist);
} else {
$idlist = $next_idlist;
}
if (count($idlist) == 0) {
// if ID list is already empty - we may skip checking other IDs
$idlist = null;
break;
}
}
if ($idlist) {
foreach ($idlist as $id) {
output_cache_remove_key($id);
}
}
return true;
break;
case Zend_Cache::CLEANING_MODE_NOT_MATCHING_TAG:
$this->_log("Zend_Cache_Backend_ZendPlatform::clean() : CLEANING_MODE_NOT_MATCHING_TAG is not supported by the Zend Platform backend");
return false;
break;
case Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG:
$idlist = null;
foreach ($tags as $tag) {
$next_idlist = output_cache_get(self::TAGS_PREFIX.$tag, $this->_directives['lifetime']);
if ($idlist) {
$idlist = array_merge_recursive($idlist, $next_idlist);
} else {
$idlist = $next_idlist;
}
if (count($idlist) == 0) {
// if ID list is already empty - we may skip checking other IDs
$idlist = null;
break;
}
}
if ($idlist) {
foreach ($idlist as $id) {
output_cache_remove_key($id);
}
}
return true;
break;
default:
Zend_Cache::throwException('Invalid mode for clean() method');
break;
}
} | [
"public",
"function",
"clean",
"(",
"$",
"mode",
"=",
"Zend_Cache",
"::",
"CLEANING_MODE_ALL",
",",
"$",
"tags",
"=",
"array",
"(",
")",
")",
"{",
"switch",
"(",
"$",
"mode",
")",
"{",
"case",
"Zend_Cache",
"::",
"CLEANING_MODE_ALL",
":",
"case",
"Zend_C... | Clean some cache records
Available modes are :
Zend_Cache::CLEANING_MODE_ALL (default) => remove all cache entries ($tags is not used)
Zend_Cache::CLEANING_MODE_OLD => remove too old cache entries ($tags is not used)
This mode is not supported in this backend
Zend_Cache::CLEANING_MODE_MATCHING_TAG => remove cache entries matching all given tags
($tags can be an array of strings or a single string)
Zend_Cache::CLEANING_MODE_NOT_MATCHING_TAG => unsupported
Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG => remove cache entries matching any given tags
($tags can be an array of strings or a single string)
@param string $mode Clean mode
@param array $tags Array of tags
@throws Zend_Cache_Exception
@return boolean True if no problem | [
"Clean",
"some",
"cache",
"records"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Cache/Backend/ZendPlatform.php#L185-L249 | train | Clean the cache | [
30522,
2270,
3853,
4550,
1006,
1002,
5549,
1027,
16729,
2094,
1035,
17053,
1024,
1024,
9344,
1035,
5549,
1035,
2035,
1010,
1002,
22073,
1027,
9140,
1006,
1007,
1007,
1063,
6942,
1006,
1002,
5549,
1007,
1063,
2553,
16729,
2094,
1035,
17053,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/DataTable/Filter/RemoveSubtables.php | RemoveSubtables.filter | public function filter($table)
{
$rows = $table->getRows();
foreach ($rows as $row) {
$row->removeSubtable();
}
} | php | public function filter($table)
{
$rows = $table->getRows();
foreach ($rows as $row) {
$row->removeSubtable();
}
} | [
"public",
"function",
"filter",
"(",
"$",
"table",
")",
"{",
"$",
"rows",
"=",
"$",
"table",
"->",
"getRows",
"(",
")",
";",
"foreach",
"(",
"$",
"rows",
"as",
"$",
"row",
")",
"{",
"$",
"row",
"->",
"removeSubtable",
"(",
")",
";",
"}",
"}"
] | See {@link Limit}.
@param DataTable $table | [
"See",
"{",
"@link",
"Limit",
"}",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/DataTable/Filter/RemoveSubtables.php#L40-L46 | train | Filter the table to remove subtables | [
30522,
2270,
3853,
11307,
1006,
1002,
2795,
1007,
1063,
1002,
10281,
1027,
1002,
2795,
1011,
1028,
2131,
10524,
2015,
1006,
1007,
1025,
18921,
6776,
1006,
1002,
10281,
2004,
1002,
5216,
1007,
1063,
1002,
5216,
1011,
1028,
20362,
12083,
1088... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/Updater/Migration/Db/Factory.php | Factory.addPrimaryKey | public function addPrimaryKey($table, $columnNames)
{
$table = $this->prefixTable($table);
if (!is_array($columnNames)) {
$columnNames = array($columnNames);
}
return $this->container->make('Piwik\Updater\Migration\Db\AddPrimaryKey', array(
'table' => $table, 'columnNames' => $columnNames
));
} | php | public function addPrimaryKey($table, $columnNames)
{
$table = $this->prefixTable($table);
if (!is_array($columnNames)) {
$columnNames = array($columnNames);
}
return $this->container->make('Piwik\Updater\Migration\Db\AddPrimaryKey', array(
'table' => $table, 'columnNames' => $columnNames
));
} | [
"public",
"function",
"addPrimaryKey",
"(",
"$",
"table",
",",
"$",
"columnNames",
")",
"{",
"$",
"table",
"=",
"$",
"this",
"->",
"prefixTable",
"(",
"$",
"table",
")",
";",
"if",
"(",
"!",
"is_array",
"(",
"$",
"columnNames",
")",
")",
"{",
"$",
... | Adds a primary key to an existing database table.
This is equivalent to an `ADD PRIMARY KEY(column_name_1, column_name_2)` in SQL.
@param string $table Unprefixed database table name, eg 'log_visit'.
@param string[]|string $columnNames Either one or multiple column names, eg array('column_name_1', 'column_name_2')
@return AddPrimaryKey | [
"Adds",
"a",
"primary",
"key",
"to",
"an",
"existing",
"database",
"table",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Updater/Migration/Db/Factory.php#L337-L347 | train | Adds a primary key to the database table. | [
30522,
2270,
3853,
5587,
18098,
9581,
2854,
14839,
1006,
1002,
2795,
1010,
1002,
5930,
18442,
2015,
1007,
1063,
1002,
2795,
1027,
1002,
2023,
1011,
1028,
17576,
10880,
1006,
1002,
2795,
1007,
1025,
2065,
1006,
999,
2003,
1035,
9140,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getgrav/grav | system/src/Grav/Common/User/FlexUser/User.php | User.getFormValue | public function getFormValue(string $name, $default = null, string $separator = null)
{
$value = parent::getFormValue($name, null, $separator);
if ($name === 'avatar') {
return $this->parseFileProperty($value);
}
if (null === $value) {
if ($name === 'media_order') {
return implode(',', $this->getMediaOrder());
}
}
return $value ?? $default;
} | php | public function getFormValue(string $name, $default = null, string $separator = null)
{
$value = parent::getFormValue($name, null, $separator);
if ($name === 'avatar') {
return $this->parseFileProperty($value);
}
if (null === $value) {
if ($name === 'media_order') {
return implode(',', $this->getMediaOrder());
}
}
return $value ?? $default;
} | [
"public",
"function",
"getFormValue",
"(",
"string",
"$",
"name",
",",
"$",
"default",
"=",
"null",
",",
"string",
"$",
"separator",
"=",
"null",
")",
"{",
"$",
"value",
"=",
"parent",
"::",
"getFormValue",
"(",
"$",
"name",
",",
"null",
",",
"$",
"s... | Get value from a page variable (used mostly for creating edit forms).
@param string $name Variable name.
@param mixed $default
@param string|null $separator
@return mixed | [
"Get",
"value",
"from",
"a",
"page",
"variable",
"(",
"used",
"mostly",
"for",
"creating",
"edit",
"forms",
")",
"."
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/User/FlexUser/User.php#L164-L179 | train | Get form value | [
30522,
2270,
3853,
2131,
14192,
10175,
5657,
1006,
5164,
1002,
2171,
1010,
1002,
12398,
1027,
19701,
1010,
5164,
1002,
19802,
25879,
2953,
1027,
19701,
1007,
1063,
1002,
3643,
1027,
6687,
1024,
1024,
2131,
14192,
10175,
5657,
1006,
1002,
21... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Support/AggregateServiceProvider.php | AggregateServiceProvider.register | public function register()
{
$this->instances = [];
foreach ($this->providers as $provider) {
$this->instances[] = $this->app->register($provider);
}
} | php | public function register()
{
$this->instances = [];
foreach ($this->providers as $provider) {
$this->instances[] = $this->app->register($provider);
}
} | [
"public",
"function",
"register",
"(",
")",
"{",
"$",
"this",
"->",
"instances",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"providers",
"as",
"$",
"provider",
")",
"{",
"$",
"this",
"->",
"instances",
"[",
"]",
"=",
"$",
"this",
"->",
... | Register the service provider.
@return void | [
"Register",
"the",
"service",
"provider",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Support/AggregateServiceProvider.php#L26-L33 | train | Register all providers | [
30522,
2270,
3853,
4236,
1006,
1007,
1063,
1002,
2023,
1011,
1028,
12107,
1027,
1031,
1033,
1025,
18921,
6776,
1006,
1002,
2023,
1011,
1028,
11670,
2004,
1002,
10802,
1007,
1063,
1002,
2023,
1011,
1028,
12107,
1031,
1033,
1027,
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/Session/Storage/NativeSessionStorage.php | NativeSessionStorage.save | public function save()
{
$session = $_SESSION;
foreach ($this->bags as $bag) {
if (empty($_SESSION[$key = $bag->getStorageKey()])) {
unset($_SESSION[$key]);
}
}
if ([$key = $this->metadataBag->getStorageKey()] === array_keys($_SESSION)) {
unset($_SESSION[$key]);
}
// Register error handler to add information about the current save handler
$previousHandler = set_error_handler(function ($type, $msg, $file, $line) use (&$previousHandler) {
if (E_WARNING === $type && 0 === strpos($msg, 'session_write_close():')) {
$handler = $this->saveHandler instanceof SessionHandlerProxy ? $this->saveHandler->getHandler() : $this->saveHandler;
$msg = sprintf('session_write_close(): Failed to write session data with "%s" handler', \get_class($handler));
}
return $previousHandler ? $previousHandler($type, $msg, $file, $line) : false;
});
try {
session_write_close();
} finally {
restore_error_handler();
$_SESSION = $session;
}
$this->closed = true;
$this->started = false;
} | php | public function save()
{
$session = $_SESSION;
foreach ($this->bags as $bag) {
if (empty($_SESSION[$key = $bag->getStorageKey()])) {
unset($_SESSION[$key]);
}
}
if ([$key = $this->metadataBag->getStorageKey()] === array_keys($_SESSION)) {
unset($_SESSION[$key]);
}
// Register error handler to add information about the current save handler
$previousHandler = set_error_handler(function ($type, $msg, $file, $line) use (&$previousHandler) {
if (E_WARNING === $type && 0 === strpos($msg, 'session_write_close():')) {
$handler = $this->saveHandler instanceof SessionHandlerProxy ? $this->saveHandler->getHandler() : $this->saveHandler;
$msg = sprintf('session_write_close(): Failed to write session data with "%s" handler', \get_class($handler));
}
return $previousHandler ? $previousHandler($type, $msg, $file, $line) : false;
});
try {
session_write_close();
} finally {
restore_error_handler();
$_SESSION = $session;
}
$this->closed = true;
$this->started = false;
} | [
"public",
"function",
"save",
"(",
")",
"{",
"$",
"session",
"=",
"$",
"_SESSION",
";",
"foreach",
"(",
"$",
"this",
"->",
"bags",
"as",
"$",
"bag",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"_SESSION",
"[",
"$",
"key",
"=",
"$",
"bag",
"->",
"ge... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php#L238-L270 | train | Save session data | [
30522,
2270,
3853,
3828,
1006,
1007,
1063,
1002,
5219,
1027,
1002,
1035,
5219,
1025,
18921,
6776,
1006,
1002,
2023,
1011,
1028,
8641,
2004,
1002,
4524,
1007,
1063,
2065,
1006,
4064,
1006,
1002,
1035,
5219,
1031,
1002,
3145,
1027,
1002,
45... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Form/Extension/Core/Type/CollectionType.php | CollectionType.configureOptions | public function configureOptions(OptionsResolver $resolver)
{
$entryOptionsNormalizer = function (Options $options, $value) {
$value['block_name'] = 'entry';
return $value;
};
$resolver->setDefaults([
'allow_add' => false,
'allow_delete' => false,
'prototype' => true,
'prototype_data' => null,
'prototype_name' => '__name__',
'entry_type' => __NAMESPACE__.'\TextType',
'entry_options' => [],
'delete_empty' => false,
]);
$resolver->setNormalizer('entry_options', $entryOptionsNormalizer);
$resolver->setAllowedTypes('delete_empty', ['bool', 'callable']);
} | php | public function configureOptions(OptionsResolver $resolver)
{
$entryOptionsNormalizer = function (Options $options, $value) {
$value['block_name'] = 'entry';
return $value;
};
$resolver->setDefaults([
'allow_add' => false,
'allow_delete' => false,
'prototype' => true,
'prototype_data' => null,
'prototype_name' => '__name__',
'entry_type' => __NAMESPACE__.'\TextType',
'entry_options' => [],
'delete_empty' => false,
]);
$resolver->setNormalizer('entry_options', $entryOptionsNormalizer);
$resolver->setAllowedTypes('delete_empty', ['bool', 'callable']);
} | [
"public",
"function",
"configureOptions",
"(",
"OptionsResolver",
"$",
"resolver",
")",
"{",
"$",
"entryOptionsNormalizer",
"=",
"function",
"(",
"Options",
"$",
"options",
",",
"$",
"value",
")",
"{",
"$",
"value",
"[",
"'block_name'",
"]",
"=",
"'entry'",
... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Extension/Core/Type/CollectionType.php#L83-L104 | train | Configure the options for the entry section | [
30522,
2270,
3853,
9530,
8873,
27390,
8780,
16790,
2015,
1006,
7047,
6072,
4747,
6299,
1002,
10663,
2099,
1007,
1063,
1002,
4443,
7361,
9285,
12131,
9067,
17629,
1027,
3853,
1006,
30524,
1033,
1027,
1005,
4443,
1005,
1025,
2709,
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... |
getgrav/grav | system/src/Grav/Common/Utils.php | Utils.arrayMergeRecursiveUnique | public static function arrayMergeRecursiveUnique($array1, $array2)
{
if (empty($array1)) {
// Optimize the base case
return $array2;
}
foreach ($array2 as $key => $value) {
if (is_array($value) && isset($array1[$key]) && is_array($array1[$key])) {
$value = static::arrayMergeRecursiveUnique($array1[$key], $value);
}
$array1[$key] = $value;
}
return $array1;
} | php | public static function arrayMergeRecursiveUnique($array1, $array2)
{
if (empty($array1)) {
// Optimize the base case
return $array2;
}
foreach ($array2 as $key => $value) {
if (is_array($value) && isset($array1[$key]) && is_array($array1[$key])) {
$value = static::arrayMergeRecursiveUnique($array1[$key], $value);
}
$array1[$key] = $value;
}
return $array1;
} | [
"public",
"static",
"function",
"arrayMergeRecursiveUnique",
"(",
"$",
"array1",
",",
"$",
"array2",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"array1",
")",
")",
"{",
"// Optimize the base case",
"return",
"$",
"array2",
";",
"}",
"foreach",
"(",
"$",
"arra... | Recursive Merge with uniqueness
@param array $array1
@param array $array2
@return array | [
"Recursive",
"Merge",
"with",
"uniqueness"
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Utils.php#L284-L299 | train | Recursive merge array1 = > array2 | [
30522,
2270,
10763,
3853,
9140,
5017,
4590,
8586,
9236,
3512,
19496,
4226,
1006,
1002,
9140,
2487,
1010,
1002,
9140,
2475,
1007,
1063,
2065,
1006,
4064,
1006,
1002,
9140,
2487,
1007,
1007,
1063,
1013,
1013,
23569,
27605,
4371,
1996,
2918,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/backend/classes/Controller.php | Controller.actionExists | public function actionExists($name, $internal = false)
{
if (!strlen($name) || substr($name, 0, 1) == '_' || !$this->methodExists($name)) {
return false;
}
foreach ($this->hiddenActions as $method) {
if (strtolower($name) == strtolower($method)) {
return false;
}
}
$ownMethod = method_exists($this, $name);
if ($ownMethod) {
$methodInfo = new \ReflectionMethod($this, $name);
$public = $methodInfo->isPublic();
if ($public) {
return true;
}
}
if ($internal && (($ownMethod && $methodInfo->isProtected()) || !$ownMethod)) {
return true;
}
if (!$ownMethod) {
return true;
}
return false;
} | php | public function actionExists($name, $internal = false)
{
if (!strlen($name) || substr($name, 0, 1) == '_' || !$this->methodExists($name)) {
return false;
}
foreach ($this->hiddenActions as $method) {
if (strtolower($name) == strtolower($method)) {
return false;
}
}
$ownMethod = method_exists($this, $name);
if ($ownMethod) {
$methodInfo = new \ReflectionMethod($this, $name);
$public = $methodInfo->isPublic();
if ($public) {
return true;
}
}
if ($internal && (($ownMethod && $methodInfo->isProtected()) || !$ownMethod)) {
return true;
}
if (!$ownMethod) {
return true;
}
return false;
} | [
"public",
"function",
"actionExists",
"(",
"$",
"name",
",",
"$",
"internal",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"strlen",
"(",
"$",
"name",
")",
"||",
"substr",
"(",
"$",
"name",
",",
"0",
",",
"1",
")",
"==",
"'_'",
"||",
"!",
"$",
"this... | This method is used internally.
Determines whether an action with the specified name exists.
Action must be a class public method. Action name can not be prefixed with the underscore character.
@param string $name Specifies the action name.
@param bool $internal Allow protected actions.
@return boolean | [
"This",
"method",
"is",
"used",
"internally",
".",
"Determines",
"whether",
"an",
"action",
"with",
"the",
"specified",
"name",
"exists",
".",
"Action",
"must",
"be",
"a",
"class",
"public",
"method",
".",
"Action",
"name",
"can",
"not",
"be",
"prefixed",
... | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/classes/Controller.php#L263-L294 | train | Check if action exists | [
30522,
2270,
3853,
2895,
10288,
5130,
1006,
1002,
2171,
1010,
1002,
4722,
1027,
6270,
1007,
1063,
2065,
1006,
999,
2358,
20927,
2078,
1006,
1002,
2171,
1007,
1064,
1064,
4942,
3367,
2099,
1006,
1002,
2171,
1010,
1014,
1010,
1015,
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... |
slimphp/Slim | Slim/Handlers/PhpError.php | PhpError.renderHtmlError | protected function renderHtmlError(Throwable $error)
{
$html = sprintf('<div><strong>Type:</strong> %s</div>', get_class($error));
if (($code = $error->getCode())) {
$html .= sprintf('<div><strong>Code:</strong> %s</div>', $code);
}
if (($message = $error->getMessage())) {
$html .= sprintf('<div><strong>Message:</strong> %s</div>', htmlentities($message));
}
if (($file = $error->getFile())) {
$html .= sprintf('<div><strong>File:</strong> %s</div>', $file);
}
if (($line = $error->getLine())) {
$html .= sprintf('<div><strong>Line:</strong> %s</div>', $line);
}
if (($trace = $error->getTraceAsString())) {
$html .= '<h2>Trace</h2>';
$html .= sprintf('<pre>%s</pre>', htmlentities($trace));
}
return $html;
} | php | protected function renderHtmlError(Throwable $error)
{
$html = sprintf('<div><strong>Type:</strong> %s</div>', get_class($error));
if (($code = $error->getCode())) {
$html .= sprintf('<div><strong>Code:</strong> %s</div>', $code);
}
if (($message = $error->getMessage())) {
$html .= sprintf('<div><strong>Message:</strong> %s</div>', htmlentities($message));
}
if (($file = $error->getFile())) {
$html .= sprintf('<div><strong>File:</strong> %s</div>', $file);
}
if (($line = $error->getLine())) {
$html .= sprintf('<div><strong>Line:</strong> %s</div>', $line);
}
if (($trace = $error->getTraceAsString())) {
$html .= '<h2>Trace</h2>';
$html .= sprintf('<pre>%s</pre>', htmlentities($trace));
}
return $html;
} | [
"protected",
"function",
"renderHtmlError",
"(",
"Throwable",
"$",
"error",
")",
"{",
"$",
"html",
"=",
"sprintf",
"(",
"'<div><strong>Type:</strong> %s</div>'",
",",
"get_class",
"(",
"$",
"error",
")",
")",
";",
"if",
"(",
"(",
"$",
"code",
"=",
"$",
"er... | Render error as HTML.
@param Throwable $error
@return string | [
"Render",
"error",
"as",
"HTML",
"."
] | ccef5f7d8bcd469d59cbe64f6210d83764f91543 | https://github.com/slimphp/Slim/blob/ccef5f7d8bcd469d59cbe64f6210d83764f91543/Slim/Handlers/PhpError.php#L102-L128 | train | Render Html Error | [
30522,
5123,
3853,
17552,
11039,
18602,
29165,
1006,
5466,
3085,
1002,
7561,
1007,
1063,
1002,
16129,
1027,
9043,
2546,
1006,
1005,
1026,
4487,
2615,
1028,
1026,
2844,
1028,
2828,
1024,
1026,
1013,
2844,
1028,
1003,
1055,
1026,
1013,
4487,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Traits/Localizable.php | Localizable.withLocale | public function withLocale($locale, $callback)
{
if (! $locale) {
return $callback();
}
$app = Container::getInstance();
$original = $app->getLocale();
try {
$app->setLocale($locale);
return $callback();
} finally {
$app->setLocale($original);
}
} | php | public function withLocale($locale, $callback)
{
if (! $locale) {
return $callback();
}
$app = Container::getInstance();
$original = $app->getLocale();
try {
$app->setLocale($locale);
return $callback();
} finally {
$app->setLocale($original);
}
} | [
"public",
"function",
"withLocale",
"(",
"$",
"locale",
",",
"$",
"callback",
")",
"{",
"if",
"(",
"!",
"$",
"locale",
")",
"{",
"return",
"$",
"callback",
"(",
")",
";",
"}",
"$",
"app",
"=",
"Container",
"::",
"getInstance",
"(",
")",
";",
"$",
... | Run the callback with the given locale.
@param string $locale
@param \Closure $callback
@return mixed | [
"Run",
"the",
"callback",
"with",
"the",
"given",
"locale",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Support/Traits/Localizable.php#L16-L33 | train | Return a callback that will set the locale for the current request. | [
30522,
2270,
3853,
2007,
4135,
9289,
2063,
1006,
1002,
2334,
2063,
1010,
1002,
2655,
5963,
1007,
1063,
2065,
1006,
999,
1002,
2334,
2063,
1007,
1063,
2709,
1002,
2655,
5963,
1006,
1007,
1025,
1065,
1002,
10439,
1027,
11661,
1024,
1024,
21... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/Zend/Db/Adapter/Abstract.php | Zend_Db_Adapter_Abstract.commit | public function commit()
{
$this->_connect();
$q = $this->_profiler->queryStart('commit', Zend_Db_Profiler::TRANSACTION);
$this->_commit();
$this->_profiler->queryEnd($q);
return $this;
} | php | public function commit()
{
$this->_connect();
$q = $this->_profiler->queryStart('commit', Zend_Db_Profiler::TRANSACTION);
$this->_commit();
$this->_profiler->queryEnd($q);
return $this;
} | [
"public",
"function",
"commit",
"(",
")",
"{",
"$",
"this",
"->",
"_connect",
"(",
")",
";",
"$",
"q",
"=",
"$",
"this",
"->",
"_profiler",
"->",
"queryStart",
"(",
"'commit'",
",",
"Zend_Db_Profiler",
"::",
"TRANSACTION",
")",
";",
"$",
"this",
"->",
... | Commit a transaction and return to autocommit mode.
@return Zend_Db_Adapter_Abstract | [
"Commit",
"a",
"transaction",
"and",
"return",
"to",
"autocommit",
"mode",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Adapter/Abstract.php#L505-L512 | train | Commit all changes to the database | [
30522,
2270,
3853,
10797,
1006,
1007,
1063,
1002,
2023,
1011,
1028,
1035,
7532,
1006,
1007,
1025,
1002,
1053,
1027,
1002,
2023,
1011,
1028,
1035,
6337,
2099,
1011,
1028,
23032,
14117,
2102,
1006,
1005,
10797,
1005,
1010,
16729,
2094,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
slimphp/Slim | Slim/Http/Uri.php | Uri.withPath | public function withPath($path)
{
if (!is_string($path)) {
throw new InvalidArgumentException('Uri path must be a string');
}
$clone = clone $this;
$clone->path = $this->filterPath($path);
// if the path is absolute, then clear basePath
if (substr($path, 0, 1) == '/') {
$clone->basePath = '';
}
return $clone;
} | php | public function withPath($path)
{
if (!is_string($path)) {
throw new InvalidArgumentException('Uri path must be a string');
}
$clone = clone $this;
$clone->path = $this->filterPath($path);
// if the path is absolute, then clear basePath
if (substr($path, 0, 1) == '/') {
$clone->basePath = '';
}
return $clone;
} | [
"public",
"function",
"withPath",
"(",
"$",
"path",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"path",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'Uri path must be a string'",
")",
";",
"}",
"$",
"clone",
"=",
"clone",
"$",
"t... | Return an instance with the specified path.
This method MUST retain the state of the current instance, and return
an instance that contains the specified path.
The path can either be empty or absolute (starting with a slash) or
rootless (not starting with a slash). Implementations MUST support all three syntaxes.
If the path is intended to be domain-relative rather than path relative then
it must begin with a slash ("/"). Paths not starting with a slash ("/")
are assumed to be relative to some base path known to the application or
consumer.
Users can provide both encoded and decoded path characters.
Implementations ensure the correct encoding as outlined in getPath().
@param string $path The path to use with the new instance.
@return static A new instance with the specified path.
@throws InvalidArgumentException For invalid paths. | [
"Return",
"an",
"instance",
"with",
"the",
"specified",
"path",
"."
] | ccef5f7d8bcd469d59cbe64f6210d83764f91543 | https://github.com/slimphp/Slim/blob/ccef5f7d8bcd469d59cbe64f6210d83764f91543/Slim/Http/Uri.php#L567-L582 | train | Return a new instance with the specified path | [
30522,
2270,
3853,
2007,
15069,
1006,
1002,
4130,
1007,
1063,
2065,
1006,
999,
2003,
1035,
5164,
1006,
1002,
4130,
1007,
1007,
1063,
5466,
2047,
19528,
2906,
22850,
15781,
2595,
24422,
1006,
1005,
24471,
2072,
4130,
2442,
2022,
1037,
5164,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/InteractsWithTime.php | InteractsWithTime.secondsUntil | protected function secondsUntil($delay)
{
$delay = $this->parseDateInterval($delay);
return $delay instanceof DateTimeInterface
? max(0, $delay->getTimestamp() - $this->currentTime())
: (int) $delay;
} | php | protected function secondsUntil($delay)
{
$delay = $this->parseDateInterval($delay);
return $delay instanceof DateTimeInterface
? max(0, $delay->getTimestamp() - $this->currentTime())
: (int) $delay;
} | [
"protected",
"function",
"secondsUntil",
"(",
"$",
"delay",
")",
"{",
"$",
"delay",
"=",
"$",
"this",
"->",
"parseDateInterval",
"(",
"$",
"delay",
")",
";",
"return",
"$",
"delay",
"instanceof",
"DateTimeInterface",
"?",
"max",
"(",
"0",
",",
"$",
"dela... | Get the number of seconds until the given DateTime.
@param \DateTimeInterface|\DateInterval|int $delay
@return int | [
"Get",
"the",
"number",
"of",
"seconds",
"until",
"the",
"given",
"DateTime",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Support/InteractsWithTime.php#L16-L23 | train | Returns the number of seconds until the given delay | [
30522,
5123,
3853,
3823,
16671,
4014,
1006,
1002,
8536,
1007,
1063,
1002,
8536,
1027,
1002,
2023,
1011,
1028,
11968,
6924,
3686,
18447,
2121,
10175,
1006,
1002,
8536,
1007,
1025,
2709,
1002,
8536,
6013,
11253,
3058,
7292,
18447,
2121,
12172... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Scheduler/Job.php | Job.emailOutput | private function emailOutput()
{
if (!count($this->outputTo) || !count($this->emailTo)) {
return false;
}
if (is_callable('Grav\Plugin\Email\Utils::sendEmail')) {
$subject ='Grav Scheduled Job [' . $this->getId() . ']';
$content = "<h1>Output from Job ID: {$this->getId()}</h1>\n<h4>Command: {$this->getCommand()}</h4><br /><pre style=\"font-size: 12px; font-family: Monaco, Consolas, monospace\">\n".$this->getOutput()."\n</pre>";
$to = $this->emailTo;
\Grav\Plugin\Email\Utils::sendEmail($subject, $content, $to);
}
return true;
} | php | private function emailOutput()
{
if (!count($this->outputTo) || !count($this->emailTo)) {
return false;
}
if (is_callable('Grav\Plugin\Email\Utils::sendEmail')) {
$subject ='Grav Scheduled Job [' . $this->getId() . ']';
$content = "<h1>Output from Job ID: {$this->getId()}</h1>\n<h4>Command: {$this->getCommand()}</h4><br /><pre style=\"font-size: 12px; font-family: Monaco, Consolas, monospace\">\n".$this->getOutput()."\n</pre>";
$to = $this->emailTo;
\Grav\Plugin\Email\Utils::sendEmail($subject, $content, $to);
}
return true;
} | [
"private",
"function",
"emailOutput",
"(",
")",
"{",
"if",
"(",
"!",
"count",
"(",
"$",
"this",
"->",
"outputTo",
")",
"||",
"!",
"count",
"(",
"$",
"this",
"->",
"emailTo",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"is_callable",
"(",... | Email the output of the job, if any.
@return bool | [
"Email",
"the",
"output",
"of",
"the",
"job",
"if",
"any",
"."
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Scheduler/Job.php#L468-L483 | train | Send output to email | [
30522,
2797,
3853,
10373,
5833,
18780,
1006,
1007,
1063,
2065,
1006,
999,
4175,
1006,
1002,
2023,
1011,
1028,
6434,
3406,
1007,
1064,
1064,
999,
4175,
1006,
1002,
2023,
1011,
1028,
10373,
3406,
1007,
1007,
1063,
2709,
6270,
1025,
1065,
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... |
matomo-org/matomo | core/DataTable.php | DataTable.queueFilterSubtables | public function queueFilterSubtables($className, $parameters = array())
{
foreach ($this->getRowsWithoutSummaryRow() as $row) {
$subtable = $row->getSubtable();
if ($subtable) {
$subtable->queueFilter($className, $parameters);
$subtable->queueFilterSubtables($className, $parameters);
}
}
} | php | public function queueFilterSubtables($className, $parameters = array())
{
foreach ($this->getRowsWithoutSummaryRow() as $row) {
$subtable = $row->getSubtable();
if ($subtable) {
$subtable->queueFilter($className, $parameters);
$subtable->queueFilterSubtables($className, $parameters);
}
}
} | [
"public",
"function",
"queueFilterSubtables",
"(",
"$",
"className",
",",
"$",
"parameters",
"=",
"array",
"(",
")",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"getRowsWithoutSummaryRow",
"(",
")",
"as",
"$",
"row",
")",
"{",
"$",
"subtable",
"=",
"$",... | Adds a filter and a list of parameters to the list of queued filters of all subtables. These filters will be
executed when {@link applyQueuedFilters()} is called.
Filters that prettify the column values or don't need the full set of rows should be queued. This
way they will be run after the table is truncated which will result in better performance.
@param string|Closure $className The class name of the filter, eg. `'Limit'`.
@param array $parameters The parameters to give to the filter, eg. `array($offset, $limit)` for the Limit filter. | [
"Adds",
"a",
"filter",
"and",
"a",
"list",
"of",
"parameters",
"to",
"the",
"list",
"of",
"queued",
"filters",
"of",
"all",
"subtables",
".",
"These",
"filters",
"will",
"be",
"executed",
"when",
"{",
"@link",
"applyQueuedFilters",
"()",
"}",
"is",
"called... | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/DataTable.php#L551-L560 | train | Queue Filter Subtables | [
30522,
2270,
3853,
24240,
8873,
21928,
6342,
19279,
3085,
2015,
1006,
1002,
2465,
18442,
1010,
1002,
11709,
1027,
9140,
1006,
1007,
1007,
1063,
18921,
6776,
1006,
1002,
2023,
1011,
1028,
2131,
10524,
26760,
8939,
12166,
2819,
7849,
12541,
5... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/Zend/Mail/Part.php | Zend_Mail_Part._cacheContent | protected function _cacheContent()
{
// caching content if we can't fetch parts
if ($this->_content === null && $this->_mail) {
$this->_content = $this->_mail->getRawContent($this->_messageNum);
}
if (!$this->isMultipart()) {
return;
}
// split content in parts
$boundary = $this->getHeaderField('content-type', 'boundary');
if (!$boundary) {
/**
* @see Zend_Mail_Exception
*/
// require_once 'Zend/Mail/Exception.php';
throw new Zend_Mail_Exception('no boundary found in content type to split message');
}
$parts = Zend_Mime_Decode::splitMessageStruct($this->_content, $boundary);
if ($parts === null) {
return;
}
$counter = 1;
foreach ($parts as $part) {
$this->_parts[$counter++] = new self(array('headers' => $part['header'], 'content' => $part['body']));
}
} | php | protected function _cacheContent()
{
// caching content if we can't fetch parts
if ($this->_content === null && $this->_mail) {
$this->_content = $this->_mail->getRawContent($this->_messageNum);
}
if (!$this->isMultipart()) {
return;
}
// split content in parts
$boundary = $this->getHeaderField('content-type', 'boundary');
if (!$boundary) {
/**
* @see Zend_Mail_Exception
*/
// require_once 'Zend/Mail/Exception.php';
throw new Zend_Mail_Exception('no boundary found in content type to split message');
}
$parts = Zend_Mime_Decode::splitMessageStruct($this->_content, $boundary);
if ($parts === null) {
return;
}
$counter = 1;
foreach ($parts as $part) {
$this->_parts[$counter++] = new self(array('headers' => $part['header'], 'content' => $part['body']));
}
} | [
"protected",
"function",
"_cacheContent",
"(",
")",
"{",
"// caching content if we can't fetch parts",
"if",
"(",
"$",
"this",
"->",
"_content",
"===",
"null",
"&&",
"$",
"this",
"->",
"_mail",
")",
"{",
"$",
"this",
"->",
"_content",
"=",
"$",
"this",
"->",... | Cache content and split in parts if multipart
@return null
@throws Zend_Mail_Exception | [
"Cache",
"content",
"and",
"split",
"in",
"parts",
"if",
"multipart"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Mail/Part.php#L202-L230 | train | caches the message content | [
30522,
5123,
3853,
1035,
17053,
8663,
6528,
2102,
1006,
1007,
1063,
1013,
1013,
6187,
8450,
4180,
2065,
2057,
2064,
1005,
1056,
18584,
3033,
2065,
1006,
1002,
2023,
1011,
1028,
1035,
4180,
1027,
1027,
1027,
19701,
1004,
1004,
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/Security/Core/Encoder/UserPasswordEncoder.php | UserPasswordEncoder.isPasswordValid | public function isPasswordValid(UserInterface $user, $raw)
{
$encoder = $this->encoderFactory->getEncoder($user);
return $encoder->isPasswordValid($user->getPassword(), $raw, $user->getSalt());
} | php | public function isPasswordValid(UserInterface $user, $raw)
{
$encoder = $this->encoderFactory->getEncoder($user);
return $encoder->isPasswordValid($user->getPassword(), $raw, $user->getSalt());
} | [
"public",
"function",
"isPasswordValid",
"(",
"UserInterface",
"$",
"user",
",",
"$",
"raw",
")",
"{",
"$",
"encoder",
"=",
"$",
"this",
"->",
"encoderFactory",
"->",
"getEncoder",
"(",
"$",
"user",
")",
";",
"return",
"$",
"encoder",
"->",
"isPasswordVali... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Security/Core/Encoder/UserPasswordEncoder.php#L43-L48 | train | Check if the password is valid for the user | [
30522,
2270,
3853,
2003,
15194,
18351,
10175,
3593,
1006,
5310,
18447,
2121,
12172,
1002,
5310,
1010,
1002,
6315,
1007,
1063,
1002,
4372,
16044,
2099,
1027,
1002,
2023,
1011,
1028,
4372,
16044,
12881,
18908,
10253,
1011,
1028,
2131,
2368,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getgrav/grav | system/src/Grav/Framework/Flex/Storage/AbstractFilesystemStorage.php | AbstractFilesystemStorage.hasKeys | public function hasKeys(array $keys): array
{
$list = [];
foreach ($keys as $key) {
$list[$key] = $this->hasKey((string)$key);
}
return $list;
} | php | public function hasKeys(array $keys): array
{
$list = [];
foreach ($keys as $key) {
$list[$key] = $this->hasKey((string)$key);
}
return $list;
} | [
"public",
"function",
"hasKeys",
"(",
"array",
"$",
"keys",
")",
":",
"array",
"{",
"$",
"list",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"keys",
"as",
"$",
"key",
")",
"{",
"$",
"list",
"[",
"$",
"key",
"]",
"=",
"$",
"this",
"->",
"hasKey",
... | {@inheritdoc}
@see FlexStorageInterface::hasKey() | [
"{"
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Framework/Flex/Storage/AbstractFilesystemStorage.php#L43-L51 | train | Returns an array of all keys in the dictionary | [
30522,
2270,
3853,
2038,
14839,
2015,
1006,
9140,
1002,
6309,
1007,
1024,
9140,
1063,
1002,
2862,
1027,
1031,
1033,
1025,
18921,
6776,
1006,
1002,
6309,
2004,
1002,
3145,
1007,
1063,
1002,
2862,
1031,
1002,
3145,
1033,
1027,
1002,
2023,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/Installation/Controller.php | Controller.extractHost | private function extractHost($url)
{
$urlParts = parse_url($url);
if (isset($urlParts['host']) && strlen($host = $urlParts['host'])) {
return $host;
}
return false;
} | php | private function extractHost($url)
{
$urlParts = parse_url($url);
if (isset($urlParts['host']) && strlen($host = $urlParts['host'])) {
return $host;
}
return false;
} | [
"private",
"function",
"extractHost",
"(",
"$",
"url",
")",
"{",
"$",
"urlParts",
"=",
"parse_url",
"(",
"$",
"url",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"urlParts",
"[",
"'host'",
"]",
")",
"&&",
"strlen",
"(",
"$",
"host",
"=",
"$",
"urlParts"... | Extract host from URL
@param string $url URL
@return string|false | [
"Extract",
"host",
"from",
"URL"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Installation/Controller.php#L643-L651 | train | Extract host from url | [
30522,
2797,
3853,
14817,
15006,
2102,
1006,
1002,
24471,
2140,
1007,
1063,
1002,
24471,
14277,
20591,
1027,
11968,
3366,
1035,
24471,
2140,
1006,
1002,
24471,
2140,
1007,
1025,
2065,
1006,
26354,
3388,
1006,
1002,
24471,
14277,
20591,
1031,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/backend/behaviors/ImportExportController.php | ImportExportController.getFormatOptionsFromPost | protected function getFormatOptionsFromPost()
{
$presetMode = post('format_preset');
$options = [
'delimiter' => null,
'enclosure' => null,
'escape' => null,
'encoding' => null
];
if ($presetMode == 'custom') {
$options['delimiter'] = post('format_delimiter');
$options['enclosure'] = post('format_enclosure');
$options['escape'] = post('format_escape');
$options['encoding'] = post('format_encoding');
}
return $options;
} | php | protected function getFormatOptionsFromPost()
{
$presetMode = post('format_preset');
$options = [
'delimiter' => null,
'enclosure' => null,
'escape' => null,
'encoding' => null
];
if ($presetMode == 'custom') {
$options['delimiter'] = post('format_delimiter');
$options['enclosure'] = post('format_enclosure');
$options['escape'] = post('format_escape');
$options['encoding'] = post('format_encoding');
}
return $options;
} | [
"protected",
"function",
"getFormatOptionsFromPost",
"(",
")",
"{",
"$",
"presetMode",
"=",
"post",
"(",
"'format_preset'",
")",
";",
"$",
"options",
"=",
"[",
"'delimiter'",
"=>",
"null",
",",
"'enclosure'",
"=>",
"null",
",",
"'escape'",
"=>",
"null",
",",... | Returns the file format options from postback. This method
can be used to define presets.
@return array | [
"Returns",
"the",
"file",
"format",
"options",
"from",
"postback",
".",
"This",
"method",
"can",
"be",
"used",
"to",
"define",
"presets",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/behaviors/ImportExportController.php#L797-L816 | train | Get format options from post | [
30522,
5123,
3853,
2131,
14192,
10610,
16790,
22747,
21716,
19894,
1006,
1007,
1063,
1002,
3653,
13462,
5302,
3207,
1027,
2695,
1006,
1005,
4289,
1035,
3653,
13462,
1005,
1007,
1025,
1002,
7047,
1027,
1031,
1005,
3972,
27605,
3334,
1005,
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/Live/VisitorDetails.php | VisitorDetails.getVisitorProfileVisitSummary | private function getVisitorProfileVisitSummary($visit)
{
$today = Date::today();
$serverDate = $visit->getColumn('firstActionTimestamp');
return array(
'date' => $serverDate,
'prettyDate' => Date::factory($serverDate)->getLocalized(Date::DATE_FORMAT_LONG),
'daysAgo' => (int)Date::secondsToDays($today->getTimestamp() - Date::factory($serverDate)->getTimestamp()),
'referrerType' => $visit->getColumn('referrerType'),
'referrerUrl' => $visit->getColumn('referrerUrl') ?: '',
'referralSummary' => self::getReferrerSummaryForVisit($visit),
);
} | php | private function getVisitorProfileVisitSummary($visit)
{
$today = Date::today();
$serverDate = $visit->getColumn('firstActionTimestamp');
return array(
'date' => $serverDate,
'prettyDate' => Date::factory($serverDate)->getLocalized(Date::DATE_FORMAT_LONG),
'daysAgo' => (int)Date::secondsToDays($today->getTimestamp() - Date::factory($serverDate)->getTimestamp()),
'referrerType' => $visit->getColumn('referrerType'),
'referrerUrl' => $visit->getColumn('referrerUrl') ?: '',
'referralSummary' => self::getReferrerSummaryForVisit($visit),
);
} | [
"private",
"function",
"getVisitorProfileVisitSummary",
"(",
"$",
"visit",
")",
"{",
"$",
"today",
"=",
"Date",
"::",
"today",
"(",
")",
";",
"$",
"serverDate",
"=",
"$",
"visit",
"->",
"getColumn",
"(",
"'firstActionTimestamp'",
")",
";",
"return",
"array",... | Returns a summary for an important visit. Used to describe the first & last visits of a visitor.
@param DataTable\Row $visit
@return array | [
"Returns",
"a",
"summary",
"for",
"an",
"important",
"visit",
".",
"Used",
"to",
"describe",
"the",
"first",
"&",
"last",
"visits",
"of",
"a",
"visitor",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Live/VisitorDetails.php#L233-L246 | train | Returns array with summary information for visit | [
30522,
2797,
3853,
2131,
11365,
15660,
21572,
8873,
20414,
17417,
10422,
14760,
2854,
1006,
1002,
3942,
1007,
1063,
1002,
2651,
1027,
3058,
1024,
1024,
2651,
1006,
1007,
1025,
1002,
8241,
13701,
1027,
1002,
3942,
1011,
1028,
2131,
25778,
28... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/PostgresBuilder.php | PostgresBuilder.parseSchemaAndTable | protected function parseSchemaAndTable($table)
{
$table = explode('.', $table);
if (is_array($schema = $this->connection->getConfig('schema'))) {
if (in_array($table[0], $schema)) {
return [array_shift($table), implode('.', $table)];
}
$schema = head($schema);
}
return [$schema ?: 'public', implode('.', $table)];
} | php | protected function parseSchemaAndTable($table)
{
$table = explode('.', $table);
if (is_array($schema = $this->connection->getConfig('schema'))) {
if (in_array($table[0], $schema)) {
return [array_shift($table), implode('.', $table)];
}
$schema = head($schema);
}
return [$schema ?: 'public', implode('.', $table)];
} | [
"protected",
"function",
"parseSchemaAndTable",
"(",
"$",
"table",
")",
"{",
"$",
"table",
"=",
"explode",
"(",
"'.'",
",",
"$",
"table",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"schema",
"=",
"$",
"this",
"->",
"connection",
"->",
"getConfig",
"(",... | Parse the table name and extract the schema and table.
@param string $table
@return array | [
"Parse",
"the",
"table",
"name",
"and",
"extract",
"the",
"schema",
"and",
"table",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Schema/PostgresBuilder.php#L127-L140 | train | Parse schema and table name | [
30522,
5123,
3853,
11968,
8583,
5403,
2863,
5685,
10880,
1006,
1002,
2795,
1007,
1063,
1002,
2795,
1027,
15044,
1006,
1005,
1012,
1005,
1010,
1002,
2795,
1007,
1025,
2065,
1006,
2003,
1035,
9140,
1006,
1002,
8040,
28433,
1027,
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... |
matomo-org/matomo | core/DataTable/Filter/CalculateEvolutionFilter.php | CalculateEvolutionFilter.getDividend | protected function getDividend($row)
{
$currentValue = $row->getColumn($this->columnValueToRead);
// if the site this is for doesn't support ecommerce & this is for the revenue_evolution column,
// we don't add the new column
if ($currentValue === false
&& $this->isRevenueEvolution
&& !Site::isEcommerceEnabledFor($row->getColumn('label'))
) {
return false;
}
$pastRow = $this->getPastRowFromCurrent($row);
if ($pastRow) {
$pastValue = $pastRow->getColumn($this->columnValueToRead);
} else {
$pastValue = 0;
}
return $currentValue - $pastValue;
} | php | protected function getDividend($row)
{
$currentValue = $row->getColumn($this->columnValueToRead);
// if the site this is for doesn't support ecommerce & this is for the revenue_evolution column,
// we don't add the new column
if ($currentValue === false
&& $this->isRevenueEvolution
&& !Site::isEcommerceEnabledFor($row->getColumn('label'))
) {
return false;
}
$pastRow = $this->getPastRowFromCurrent($row);
if ($pastRow) {
$pastValue = $pastRow->getColumn($this->columnValueToRead);
} else {
$pastValue = 0;
}
return $currentValue - $pastValue;
} | [
"protected",
"function",
"getDividend",
"(",
"$",
"row",
")",
"{",
"$",
"currentValue",
"=",
"$",
"row",
"->",
"getColumn",
"(",
"$",
"this",
"->",
"columnValueToRead",
")",
";",
"// if the site this is for doesn't support ecommerce & this is for the revenue_evolution col... | Returns the difference between the column in the specific row and its
sister column in the past DataTable.
@param Row $row
@return int|float | [
"Returns",
"the",
"difference",
"between",
"the",
"column",
"in",
"the",
"specific",
"row",
"and",
"its",
"sister",
"column",
"in",
"the",
"past",
"DataTable",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/DataTable/Filter/CalculateEvolutionFilter.php#L73-L94 | train | Returns the difference between the current column and the value of the row | [
30522,
5123,
3853,
2131,
4305,
17258,
10497,
1006,
1002,
5216,
1007,
1063,
1002,
2783,
10175,
5657,
1027,
1002,
5216,
1011,
1028,
2131,
25778,
2819,
2078,
1006,
1002,
2023,
1011,
1028,
5930,
10175,
23361,
5686,
4215,
1007,
1025,
1013,
1013,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/ExampleUI/Reports/GetTemperaturesEvolution.php | GetTemperaturesEvolution.configureView | public function configureView(ViewDataTable $view)
{
if ($view->isViewDataTableId(Sparklines::ID)) {
/** @var Sparklines $view */
$view->config->addSparklineMetric(array('server1'));
$view->config->addSparklineMetric(array('server2'));
$view->config->addTranslations(array('server1' => 'Evolution of temperature for server piwik.org'));
$view->config->addTranslations(array('server2' => 'Evolution of temperature for server dev.piwik.org'));
} elseif ($view->isViewDataTableId(Evolution::ID)) {
/** @var Evolution $view */
$selectableColumns = array('server1', 'server2');
$columns = Common::getRequestVar('columns', false);
if (!empty($columns)) {
$columns = Piwik::getArrayFromApiParameter($columns);
}
$columns = array_merge($columns ? $columns : array(), $selectableColumns);
$view->config->columns_to_display = $columns;
$view->config->addTranslations(array_combine($columns, $columns));
$view->config->selectable_columns = $selectableColumns;
$view->requestConfig->filter_sort_column = 'label';
$view->requestConfig->filter_sort_order = 'asc';
$view->config->documentation = 'My documentation';
$view->config->show_goals = false;
}
} | php | public function configureView(ViewDataTable $view)
{
if ($view->isViewDataTableId(Sparklines::ID)) {
/** @var Sparklines $view */
$view->config->addSparklineMetric(array('server1'));
$view->config->addSparklineMetric(array('server2'));
$view->config->addTranslations(array('server1' => 'Evolution of temperature for server piwik.org'));
$view->config->addTranslations(array('server2' => 'Evolution of temperature for server dev.piwik.org'));
} elseif ($view->isViewDataTableId(Evolution::ID)) {
/** @var Evolution $view */
$selectableColumns = array('server1', 'server2');
$columns = Common::getRequestVar('columns', false);
if (!empty($columns)) {
$columns = Piwik::getArrayFromApiParameter($columns);
}
$columns = array_merge($columns ? $columns : array(), $selectableColumns);
$view->config->columns_to_display = $columns;
$view->config->addTranslations(array_combine($columns, $columns));
$view->config->selectable_columns = $selectableColumns;
$view->requestConfig->filter_sort_column = 'label';
$view->requestConfig->filter_sort_order = 'asc';
$view->config->documentation = 'My documentation';
$view->config->show_goals = false;
}
} | [
"public",
"function",
"configureView",
"(",
"ViewDataTable",
"$",
"view",
")",
"{",
"if",
"(",
"$",
"view",
"->",
"isViewDataTableId",
"(",
"Sparklines",
"::",
"ID",
")",
")",
"{",
"/** @var Sparklines $view */",
"$",
"view",
"->",
"config",
"->",
"addSparklin... | Here you can configure how your report should be displayed. For instance whether your report supports a search
etc. You can also change the default request config. For instance change how many rows are displayed by default.
@param ViewDataTable $view | [
"Here",
"you",
"can",
"configure",
"how",
"your",
"report",
"should",
"be",
"displayed",
".",
"For",
"instance",
"whether",
"your",
"report",
"supports",
"a",
"search",
"etc",
".",
"You",
"can",
"also",
"change",
"the",
"default",
"request",
"config",
".",
... | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/ExampleUI/Reports/GetTemperaturesEvolution.php#L63-L93 | train | Configure the viewDataTable with the necessary data | [
30522,
2270,
3853,
9530,
8873,
27390,
6777,
2666,
2860,
1006,
3193,
2850,
29336,
3085,
1002,
3193,
1007,
1063,
2065,
1006,
1002,
3193,
1011,
1028,
2003,
8584,
2850,
29336,
3085,
3593,
1006,
12125,
12735,
1024,
1024,
8909,
1007,
1007,
1063,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Foundation/Console/Kernel.php | Kernel.getArtisan | protected function getArtisan()
{
if (is_null($this->artisan)) {
return $this->artisan = (new Artisan($this->app, $this->events, $this->app->version()))
->resolveCommands($this->commands);
}
return $this->artisan;
} | php | protected function getArtisan()
{
if (is_null($this->artisan)) {
return $this->artisan = (new Artisan($this->app, $this->events, $this->app->version()))
->resolveCommands($this->commands);
}
return $this->artisan;
} | [
"protected",
"function",
"getArtisan",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"artisan",
")",
")",
"{",
"return",
"$",
"this",
"->",
"artisan",
"=",
"(",
"new",
"Artisan",
"(",
"$",
"this",
"->",
"app",
",",
"$",
"this",
"->",... | Get the Artisan application instance.
@return \Illuminate\Console\Application | [
"Get",
"the",
"Artisan",
"application",
"instance",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Foundation/Console/Kernel.php#L328-L336 | train | Get Artisan instance | [
30522,
5123,
3853,
2131,
8445,
29196,
1006,
1007,
1063,
2065,
1006,
2003,
1035,
19701,
1006,
1002,
2023,
1011,
1028,
2396,
29196,
1007,
1007,
1063,
2709,
1002,
2023,
1011,
1028,
2396,
29196,
1027,
1006,
2047,
2396,
29196,
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... |
overtrue/wechat | src/Kernel/AccessToken.php | AccessToken.sendRequest | protected function sendRequest(array $credentials): ResponseInterface
{
$options = [
('GET' === $this->requestMethod) ? 'query' : 'json' => $credentials,
];
return $this->setHttpClient($this->app['http_client'])->request($this->getEndpoint(), $this->requestMethod, $options);
} | php | protected function sendRequest(array $credentials): ResponseInterface
{
$options = [
('GET' === $this->requestMethod) ? 'query' : 'json' => $credentials,
];
return $this->setHttpClient($this->app['http_client'])->request($this->getEndpoint(), $this->requestMethod, $options);
} | [
"protected",
"function",
"sendRequest",
"(",
"array",
"$",
"credentials",
")",
":",
"ResponseInterface",
"{",
"$",
"options",
"=",
"[",
"(",
"'GET'",
"===",
"$",
"this",
"->",
"requestMethod",
")",
"?",
"'query'",
":",
"'json'",
"=>",
"$",
"credentials",
"... | Send http request.
@param array $credentials
@return ResponseInterface
@throws \EasyWeChat\Kernel\Exceptions\InvalidArgumentException | [
"Send",
"http",
"request",
"."
] | 120c72faaa93c270365bc75c73c362d5fd583209 | https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/Kernel/AccessToken.php#L216-L223 | train | Sends the request to the API. | [
30522,
5123,
3853,
4604,
2890,
15500,
1006,
9140,
1002,
22496,
1007,
1024,
3433,
18447,
2121,
12172,
1063,
1002,
7047,
1027,
1031,
1006,
1005,
2131,
1005,
1027,
1027,
1027,
1002,
2023,
1011,
1028,
5227,
11368,
6806,
2094,
1007,
1029,
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... |
z-song/laravel-admin | src/Form.php | Form.input | public function input($key, $value = null)
{
if (is_null($value)) {
return Arr::get($this->inputs, $key);
}
return Arr::set($this->inputs, $key, $value);
} | php | public function input($key, $value = null)
{
if (is_null($value)) {
return Arr::get($this->inputs, $key);
}
return Arr::set($this->inputs, $key, $value);
} | [
"public",
"function",
"input",
"(",
"$",
"key",
",",
"$",
"value",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"value",
")",
")",
"{",
"return",
"Arr",
"::",
"get",
"(",
"$",
"this",
"->",
"inputs",
",",
"$",
"key",
")",
";",
"}",
... | Get or set input data.
@param string $key
@param null $value
@return array|mixed | [
"Get",
"or",
"set",
"input",
"data",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Form.php#L1378-L1385 | train | Get or set the input value | [
30522,
2270,
3853,
7953,
1006,
1002,
3145,
1010,
1002,
3643,
1027,
19701,
1007,
1063,
2065,
1006,
2003,
1035,
19701,
1006,
1002,
3643,
1007,
1007,
1063,
2709,
12098,
2099,
1024,
1024,
2131,
30524,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/Piwik.php | Piwik.isUserHasCapability | public static function isUserHasCapability($idSites, $capability)
{
try {
self::checkUserHasCapability($idSites, $capability);
return true;
} catch (Exception $e) {
return false;
}
} | php | public static function isUserHasCapability($idSites, $capability)
{
try {
self::checkUserHasCapability($idSites, $capability);
return true;
} catch (Exception $e) {
return false;
}
} | [
"public",
"static",
"function",
"isUserHasCapability",
"(",
"$",
"idSites",
",",
"$",
"capability",
")",
"{",
"try",
"{",
"self",
"::",
"checkUserHasCapability",
"(",
"$",
"idSites",
",",
"$",
"capability",
")",
";",
"return",
"true",
";",
"}",
"catch",
"(... | Returns `true` if the current user has the given capability for the given sites.
@return bool
@api | [
"Returns",
"true",
"if",
"the",
"current",
"user",
"has",
"the",
"given",
"capability",
"for",
"the",
"given",
"sites",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Piwik.php#L447-L455 | train | Check if user has capability | [
30522,
2270,
10763,
3853,
2003,
20330,
14949,
17695,
8010,
1006,
1002,
8909,
28032,
2229,
1010,
1002,
10673,
1007,
1063,
3046,
1063,
2969,
1024,
1024,
4638,
20330,
14949,
17695,
8010,
1006,
1002,
8909,
28032,
2229,
1010,
1002,
10673,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/ExampleTracker/Columns/ExampleConversionDimension.php | ExampleConversionDimension.onEcommerceCartUpdateConversion | public function onEcommerceCartUpdateConversion(Request $request, Visitor $visitor, $action, GoalManager $goalManager)
{
return Common::getRequestVar('myCustomParam', $default = false, 'int', $request->getParams());
} | php | public function onEcommerceCartUpdateConversion(Request $request, Visitor $visitor, $action, GoalManager $goalManager)
{
return Common::getRequestVar('myCustomParam', $default = false, 'int', $request->getParams());
} | [
"public",
"function",
"onEcommerceCartUpdateConversion",
"(",
"Request",
"$",
"request",
",",
"Visitor",
"$",
"visitor",
",",
"$",
"action",
",",
"GoalManager",
"$",
"goalManager",
")",
"{",
"return",
"Common",
"::",
"getRequestVar",
"(",
"'myCustomParam'",
",",
... | This event is triggered when an ecommerce cart update is converted. In this example we would store a
the value of the tracking url parameter "myCustomParam" in the "example_conversion_dimension" column.
Return boolean false if you do not want to change the value in some cases. If you do not want to perform any
action on an ecommerce order at all it is recommended to just remove this method.
@param Request $request
@param Visitor $visitor
@param Action|null $action
@param GoalManager $goalManager
@return mixed|false | [
"This",
"event",
"is",
"triggered",
"when",
"an",
"ecommerce",
"cart",
"update",
"is",
"converted",
".",
"In",
"this",
"example",
"we",
"would",
"store",
"a",
"the",
"value",
"of",
"the",
"tracking",
"url",
"parameter",
"myCustomParam",
"in",
"the",
"example... | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/ExampleTracker/Columns/ExampleConversionDimension.php#L103-L106 | train | This method is triggered when an ecommerce cart update conversion is triggered. | [
30522,
2270,
3853,
2028,
9006,
5017,
3401,
10010,
8525,
17299,
3686,
8663,
27774,
1006,
5227,
1002,
5227,
1010,
10367,
1002,
10367,
1010,
1002,
2895,
1010,
3125,
24805,
4590,
1002,
3125,
24805,
4590,
1007,
1063,
2709,
2691,
1024,
1024,
2131... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
overtrue/wechat | src/OpenWork/Server/Guard.php | Guard.decryptMessage | protected function decryptMessage(array $message)
{
$encryptor = new Encryptor($message['ToUserName'], $this->app['config']->get('token'), $this->app['config']->get('aes_key'));
return $message = $encryptor->decrypt(
$message['Encrypt'],
$this->app['request']->get('msg_signature'),
$this->app['request']->get('nonce'),
$this->app['request']->get('timestamp')
);
} | php | protected function decryptMessage(array $message)
{
$encryptor = new Encryptor($message['ToUserName'], $this->app['config']->get('token'), $this->app['config']->get('aes_key'));
return $message = $encryptor->decrypt(
$message['Encrypt'],
$this->app['request']->get('msg_signature'),
$this->app['request']->get('nonce'),
$this->app['request']->get('timestamp')
);
} | [
"protected",
"function",
"decryptMessage",
"(",
"array",
"$",
"message",
")",
"{",
"$",
"encryptor",
"=",
"new",
"Encryptor",
"(",
"$",
"message",
"[",
"'ToUserName'",
"]",
",",
"$",
"this",
"->",
"app",
"[",
"'config'",
"]",
"->",
"get",
"(",
"'token'",... | @param array $message
@return mixed
@throws \EasyWeChat\Kernel\Exceptions\RuntimeException | [
"@param",
"array",
"$message"
] | 120c72faaa93c270365bc75c73c362d5fd583209 | https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/OpenWork/Server/Guard.php#L57-L67 | train | Decrypt message and return decrypted message | [
30522,
5123,
3853,
11703,
2854,
13876,
7834,
3736,
3351,
1006,
9140,
1002,
4471,
1007,
1063,
1002,
4372,
26775,
22571,
4263,
1027,
2047,
4372,
26775,
22571,
4263,
1006,
1002,
4471,
1031,
1005,
2000,
20330,
18442,
1005,
1033,
1010,
1002,
202... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.getQueryProfile | public function getQueryProfile($queryId)
{
if (!array_key_exists($queryId, $this->_queryProfiles)) {
/**
* @see Zend_Db_Profiler_Exception
*/
// require_once 'Zend/Db/Profiler/Exception.php';
throw new Zend_Db_Profiler_Exception("Query handle '$queryId' not found in profiler log.");
}
return $this->_queryProfiles[$queryId];
} | php | public function getQueryProfile($queryId)
{
if (!array_key_exists($queryId, $this->_queryProfiles)) {
/**
* @see Zend_Db_Profiler_Exception
*/
// require_once 'Zend/Db/Profiler/Exception.php';
throw new Zend_Db_Profiler_Exception("Query handle '$queryId' not found in profiler log.");
}
return $this->_queryProfiles[$queryId];
} | [
"public",
"function",
"getQueryProfile",
"(",
"$",
"queryId",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"queryId",
",",
"$",
"this",
"->",
"_queryProfiles",
")",
")",
"{",
"/**\n * @see Zend_Db_Profiler_Exception\n */",
"// requir... | Get a profile for a query. Pass it the same handle that was returned
by queryStart() and it will return a Zend_Db_Profiler_Query object.
@param integer $queryId
@throws Zend_Db_Profiler_Exception
@return Zend_Db_Profiler_Query | [
"Get",
"a",
"profile",
"for",
"a",
"query",
".",
"Pass",
"it",
"the",
"same",
"handle",
"that",
"was",
"returned",
"by",
"queryStart",
"()",
"and",
"it",
"will",
"return",
"a",
"Zend_Db_Profiler_Query",
"object",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Profiler.php#L356-L367 | train | Get query profile | [
30522,
2270,
3853,
2131,
4226,
2854,
21572,
8873,
2571,
1006,
1002,
23032,
3593,
1007,
1063,
2065,
1006,
999,
9140,
1035,
3145,
1035,
6526,
1006,
1002,
23032,
3593,
1010,
1002,
2023,
1011,
1028,
1035,
23032,
21572,
8873,
4244,
1007,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/DataTable.php | DataTable.isEqual | public static function isEqual(DataTable $table1, DataTable $table2)
{
$table1->rebuildIndex();
$table2->rebuildIndex();
if ($table1->getRowsCount() != $table2->getRowsCount()) {
return false;
}
$rows1 = $table1->getRows();
foreach ($rows1 as $row1) {
$row2 = $table2->getRowFromLabel($row1->getColumn('label'));
if ($row2 === false
|| !Row::isEqual($row1, $row2)
) {
return false;
}
}
return true;
} | php | public static function isEqual(DataTable $table1, DataTable $table2)
{
$table1->rebuildIndex();
$table2->rebuildIndex();
if ($table1->getRowsCount() != $table2->getRowsCount()) {
return false;
}
$rows1 = $table1->getRows();
foreach ($rows1 as $row1) {
$row2 = $table2->getRowFromLabel($row1->getColumn('label'));
if ($row2 === false
|| !Row::isEqual($row1, $row2)
) {
return false;
}
}
return true;
} | [
"public",
"static",
"function",
"isEqual",
"(",
"DataTable",
"$",
"table1",
",",
"DataTable",
"$",
"table2",
")",
"{",
"$",
"table1",
"->",
"rebuildIndex",
"(",
")",
";",
"$",
"table2",
"->",
"rebuildIndex",
"(",
")",
";",
"if",
"(",
"$",
"table1",
"->... | Returns true if both DataTable instances are exactly the same.
DataTables are equal if they have the same number of rows, if
each row has a label that exists in the other table, and if each row
is equal to the row in the other table with the same label. The order
of rows is not important.
@param \Piwik\DataTable $table1
@param \Piwik\DataTable $table2
@return bool | [
"Returns",
"true",
"if",
"both",
"DataTable",
"instances",
"are",
"exactly",
"the",
"same",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/DataTable.php#L1225-L1246 | train | Returns true if two tables are equal. | [
30522,
2270,
10763,
3853,
2003,
2063,
26426,
1006,
2951,
10880,
1002,
2795,
2487,
1010,
2951,
10880,
1002,
2795,
2475,
1007,
1063,
1002,
2795,
2487,
1011,
1028,
14591,
22254,
10288,
1006,
1007,
1025,
1002,
2795,
2475,
1011,
1028,
14591,
222... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Security/Core/Exception/AuthenticationException.php | AuthenticationException.serialize | public function serialize()
{
$serialized = $this->__serialize();
if (null === $isCalledFromOverridingMethod = \func_num_args() ? \func_get_arg(0) : null) {
$trace = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT, 2);
$isCalledFromOverridingMethod = isset($trace[1]['function'], $trace[1]['object']) && 'serialize' === $trace[1]['function'] && $this === $trace[1]['object'];
}
return $isCalledFromOverridingMethod ? $serialized : serialize($serialized);
} | php | public function serialize()
{
$serialized = $this->__serialize();
if (null === $isCalledFromOverridingMethod = \func_num_args() ? \func_get_arg(0) : null) {
$trace = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT, 2);
$isCalledFromOverridingMethod = isset($trace[1]['function'], $trace[1]['object']) && 'serialize' === $trace[1]['function'] && $this === $trace[1]['object'];
}
return $isCalledFromOverridingMethod ? $serialized : serialize($serialized);
} | [
"public",
"function",
"serialize",
"(",
")",
"{",
"$",
"serialized",
"=",
"$",
"this",
"->",
"__serialize",
"(",
")",
";",
"if",
"(",
"null",
"===",
"$",
"isCalledFromOverridingMethod",
"=",
"\\",
"func_num_args",
"(",
")",
"?",
"\\",
"func_get_arg",
"(",
... | {@inheritdoc}
@final since Symfony 4.3, use __serialize() instead
@internal since Symfony 4.3, use __serialize() instead | [
"{",
"@inheritdoc",
"}"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Security/Core/Exception/AuthenticationException.php#L68-L78 | train | Serializes the object into a string | [
30522,
2270,
3853,
7642,
4697,
1006,
1007,
1063,
1002,
27289,
1027,
1002,
2023,
1011,
1028,
1035,
1035,
7642,
4697,
1006,
1007,
1025,
2065,
1006,
19701,
1027,
1027,
1027,
1002,
2003,
9289,
3709,
19699,
19506,
6299,
21930,
11368,
6806,
2094,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/DatabaseSessionHandler.php | DatabaseSessionHandler.write | public function write($sessionId, $data)
{
$payload = $this->getDefaultPayload($data);
if (! $this->exists) {
$this->read($sessionId);
}
if ($this->exists) {
$this->performUpdate($sessionId, $payload);
} else {
$this->performInsert($sessionId, $payload);
}
return $this->exists = true;
} | php | public function write($sessionId, $data)
{
$payload = $this->getDefaultPayload($data);
if (! $this->exists) {
$this->read($sessionId);
}
if ($this->exists) {
$this->performUpdate($sessionId, $payload);
} else {
$this->performInsert($sessionId, $payload);
}
return $this->exists = true;
} | [
"public",
"function",
"write",
"(",
"$",
"sessionId",
",",
"$",
"data",
")",
"{",
"$",
"payload",
"=",
"$",
"this",
"->",
"getDefaultPayload",
"(",
"$",
"data",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"exists",
")",
"{",
"$",
"this",
"->",
"... | {@inheritdoc} | [
"{"
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Session/DatabaseSessionHandler.php#L123-L138 | train | Write session data | [
30522,
2270,
3853,
4339,
1006,
1002,
5219,
3593,
1010,
1002,
2951,
1007,
1063,
1002,
18093,
1027,
1002,
2023,
1011,
1028,
2131,
3207,
7011,
11314,
4502,
8516,
10441,
2094,
1006,
1002,
2951,
1007,
1025,
2065,
1006,
999,
1002,
2023,
1011,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Notifications/Channels/MailChannel.php | MailChannel.buildView | protected function buildView($message)
{
if ($message->view) {
return $message->view;
}
return [
'html' => $this->markdown->render($message->markdown, $message->data()),
'text' => $this->markdown->renderText($message->markdown, $message->data()),
];
} | php | protected function buildView($message)
{
if ($message->view) {
return $message->view;
}
return [
'html' => $this->markdown->render($message->markdown, $message->data()),
'text' => $this->markdown->renderText($message->markdown, $message->data()),
];
} | [
"protected",
"function",
"buildView",
"(",
"$",
"message",
")",
"{",
"if",
"(",
"$",
"message",
"->",
"view",
")",
"{",
"return",
"$",
"message",
"->",
"view",
";",
"}",
"return",
"[",
"'html'",
"=>",
"$",
"this",
"->",
"markdown",
"->",
"render",
"(... | Build the notification's view.
@param \Illuminate\Notifications\Messages\MailMessage $message
@return string|array | [
"Build",
"the",
"notification",
"s",
"view",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Notifications/Channels/MailChannel.php#L90-L100 | train | Build View of Message | [
30522,
5123,
3853,
3857,
8584,
1006,
1002,
4471,
1007,
1063,
2065,
1006,
1002,
4471,
1011,
1028,
3193,
1007,
1063,
2709,
1002,
4471,
1011,
1028,
3193,
1025,
1065,
2709,
1031,
1005,
16129,
1005,
1027,
1028,
1002,
2023,
1011,
1028,
2928,
76... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.onceWithColumns | protected function onceWithColumns($columns, $callback)
{
$original = $this->columns;
if (is_null($original)) {
$this->columns = $columns;
}
$result = $callback();
$this->columns = $original;
return $result;
} | php | protected function onceWithColumns($columns, $callback)
{
$original = $this->columns;
if (is_null($original)) {
$this->columns = $columns;
}
$result = $callback();
$this->columns = $original;
return $result;
} | [
"protected",
"function",
"onceWithColumns",
"(",
"$",
"columns",
",",
"$",
"callback",
")",
"{",
"$",
"original",
"=",
"$",
"this",
"->",
"columns",
";",
"if",
"(",
"is_null",
"(",
"$",
"original",
")",
")",
"{",
"$",
"this",
"->",
"columns",
"=",
"$... | Execute the given callback while selecting the given columns.
After running the callback, the columns are reset to the original value.
@param array $columns
@param callable $callback
@return mixed | [
"Execute",
"the",
"given",
"callback",
"while",
"selecting",
"the",
"given",
"columns",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Query/Builder.php#L2590-L2603 | train | Executes a callback for each column | [
30522,
5123,
3853,
2320,
24415,
25778,
2819,
3619,
1006,
1002,
7753,
1010,
1002,
2655,
5963,
1007,
1063,
1002,
2434,
1027,
1002,
2023,
1011,
1028,
7753,
1025,
2065,
1006,
2003,
1035,
19701,
1006,
1002,
2434,
1007,
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... |
octobercms/october | modules/backend/behaviors/ImportExportController.php | ImportExportController.exportFromList | public function exportFromList($definition = null, $options = [])
{
$lists = $this->controller->makeLists();
$widget = $lists[$definition] ?? reset($lists);
/*
* Parse options
*/
$defaultOptions = [
'fileName' => $this->exportFileName,
'delimiter' => ',',
'enclosure' => '"'
];
$options = array_merge($defaultOptions, $options);
/*
* Prepare CSV
*/
$csv = CsvWriter::createFromFileObject(new SplTempFileObject);
$csv->setDelimiter($options['delimiter']);
$csv->setEnclosure($options['enclosure']);
/*
* Add headers
*/
$headers = [];
$columns = $widget->getVisibleColumns();
foreach ($columns as $column) {
$headers[] = Lang::get($column->label);
}
$csv->insertOne($headers);
/*
* Add records
*/
$getter = $this->getConfig('export[useList][raw]', false)
? 'getColumnValueRaw'
: 'getColumnValue';
$query = $widget->prepareQuery();
$results = $query->get();
foreach ($results as $result) {
$record = [];
foreach ($columns as $column) {
$value = $widget->$getter($result, $column);
if (is_array($value)) {
$value = implode('|', $value);
}
$record[] = $value;
}
$csv->insertOne($record);
}
/*
* Output
*/
$csv->output($options['fileName']);
exit;
} | php | public function exportFromList($definition = null, $options = [])
{
$lists = $this->controller->makeLists();
$widget = $lists[$definition] ?? reset($lists);
/*
* Parse options
*/
$defaultOptions = [
'fileName' => $this->exportFileName,
'delimiter' => ',',
'enclosure' => '"'
];
$options = array_merge($defaultOptions, $options);
/*
* Prepare CSV
*/
$csv = CsvWriter::createFromFileObject(new SplTempFileObject);
$csv->setDelimiter($options['delimiter']);
$csv->setEnclosure($options['enclosure']);
/*
* Add headers
*/
$headers = [];
$columns = $widget->getVisibleColumns();
foreach ($columns as $column) {
$headers[] = Lang::get($column->label);
}
$csv->insertOne($headers);
/*
* Add records
*/
$getter = $this->getConfig('export[useList][raw]', false)
? 'getColumnValueRaw'
: 'getColumnValue';
$query = $widget->prepareQuery();
$results = $query->get();
foreach ($results as $result) {
$record = [];
foreach ($columns as $column) {
$value = $widget->$getter($result, $column);
if (is_array($value)) {
$value = implode('|', $value);
}
$record[] = $value;
}
$csv->insertOne($record);
}
/*
* Output
*/
$csv->output($options['fileName']);
exit;
} | [
"public",
"function",
"exportFromList",
"(",
"$",
"definition",
"=",
"null",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"lists",
"=",
"$",
"this",
"->",
"controller",
"->",
"makeLists",
"(",
")",
";",
"$",
"widget",
"=",
"$",
"lists",
"[",
... | Outputs the list results as a CSV export.
@param string $definition
@param array $options
@return void | [
"Outputs",
"the",
"list",
"results",
"as",
"a",
"CSV",
"export",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/behaviors/ImportExportController.php#L589-L649 | train | Export from list | [
30522,
2270,
3853,
9167,
19699,
5358,
9863,
1006,
1002,
6210,
1027,
19701,
1010,
1002,
7047,
1027,
1031,
1033,
1007,
1063,
1002,
7201,
1027,
1002,
2023,
1011,
1028,
11486,
1011,
1028,
2191,
27103,
1006,
1007,
1025,
1002,
15536,
24291,
1027,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Cache/Simple/ChainCache.php | ChainCache.delete | public function delete($key)
{
$deleted = true;
$i = $this->cacheCount;
while ($i--) {
$deleted = $this->caches[$i]->delete($key) && $deleted;
}
return $deleted;
} | php | public function delete($key)
{
$deleted = true;
$i = $this->cacheCount;
while ($i--) {
$deleted = $this->caches[$i]->delete($key) && $deleted;
}
return $deleted;
} | [
"public",
"function",
"delete",
"(",
"$",
"key",
")",
"{",
"$",
"deleted",
"=",
"true",
";",
"$",
"i",
"=",
"$",
"this",
"->",
"cacheCount",
";",
"while",
"(",
"$",
"i",
"--",
")",
"{",
"$",
"deleted",
"=",
"$",
"this",
"->",
"caches",
"[",
"$"... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Cache/Simple/ChainCache.php#L156-L166 | train | Delete a key from the cache | [
30522,
2270,
3853,
3972,
12870,
1006,
1002,
3145,
1007,
1063,
1002,
17159,
1027,
2995,
1025,
1002,
1045,
1027,
1002,
2023,
1011,
1028,
17053,
3597,
16671,
1025,
2096,
1006,
1002,
1045,
1011,
1011,
1007,
1063,
1002,
17159,
1027,
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/Database/Eloquent/Concerns/HasAttributes.php | HasAttributes.originalIsEquivalent | public function originalIsEquivalent($key, $current)
{
if (! array_key_exists($key, $this->original)) {
return false;
}
$original = $this->getOriginal($key);
if ($current === $original) {
return true;
} elseif (is_null($current)) {
return false;
} elseif ($this->isDateAttribute($key)) {
return $this->fromDateTime($current) ===
$this->fromDateTime($original);
} elseif ($this->hasCast($key)) {
return $this->castAttribute($key, $current) ===
$this->castAttribute($key, $original);
}
return is_numeric($current) && is_numeric($original)
&& strcmp((string) $current, (string) $original) === 0;
} | php | public function originalIsEquivalent($key, $current)
{
if (! array_key_exists($key, $this->original)) {
return false;
}
$original = $this->getOriginal($key);
if ($current === $original) {
return true;
} elseif (is_null($current)) {
return false;
} elseif ($this->isDateAttribute($key)) {
return $this->fromDateTime($current) ===
$this->fromDateTime($original);
} elseif ($this->hasCast($key)) {
return $this->castAttribute($key, $current) ===
$this->castAttribute($key, $original);
}
return is_numeric($current) && is_numeric($original)
&& strcmp((string) $current, (string) $original) === 0;
} | [
"public",
"function",
"originalIsEquivalent",
"(",
"$",
"key",
",",
"$",
"current",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"key",
",",
"$",
"this",
"->",
"original",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"original",
"=",
"... | Determine if the new and old values for a given key are equivalent.
@param string $key
@param mixed $current
@return bool | [
"Determine",
"if",
"the",
"new",
"and",
"old",
"values",
"for",
"a",
"given",
"key",
"are",
"equivalent",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php#L1152-L1174 | train | Returns true if the original value of the specified key is equivalent to the current value of the attribute | [
30522,
2270,
3853,
2434,
5562,
15549,
24879,
1006,
1002,
3145,
1010,
1002,
2783,
1007,
1063,
2065,
1006,
999,
9140,
1035,
3145,
1035,
6526,
1006,
1002,
3145,
1010,
1002,
2023,
1011,
1028,
2434,
1007,
1007,
1063,
2709,
6270,
1025,
1065,
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/Console/Scheduling/CacheSchedulingMutex.php | CacheSchedulingMutex.create | public function create(Event $event, DateTimeInterface $time)
{
return $this->cache->store($this->store)->add(
$event->mutexName().$time->format('Hi'), true, 3600
);
} | php | public function create(Event $event, DateTimeInterface $time)
{
return $this->cache->store($this->store)->add(
$event->mutexName().$time->format('Hi'), true, 3600
);
} | [
"public",
"function",
"create",
"(",
"Event",
"$",
"event",
",",
"DateTimeInterface",
"$",
"time",
")",
"{",
"return",
"$",
"this",
"->",
"cache",
"->",
"store",
"(",
"$",
"this",
"->",
"store",
")",
"->",
"add",
"(",
"$",
"event",
"->",
"mutexName",
... | Attempt to obtain a scheduling mutex for the given event.
@param \Illuminate\Console\Scheduling\Event $event
@param \DateTimeInterface $time
@return bool | [
"Attempt",
"to",
"obtain",
"a",
"scheduling",
"mutex",
"for",
"the",
"given",
"event",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Console/Scheduling/CacheSchedulingMutex.php#L42-L47 | train | Create a new entry in the cache | [
30522,
2270,
3853,
3443,
1006,
2724,
1002,
2724,
1010,
3058,
7292,
18447,
2121,
12172,
1002,
2051,
1007,
1063,
2709,
1002,
2023,
1011,
1028,
17053,
1011,
1028,
3573,
1006,
1002,
2023,
1011,
1028,
3573,
1007,
1011,
1028,
5587,
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/Form/Field.php | Field.getElementClassString | protected function getElementClassString()
{
$elementClass = $this->getElementClass();
if (Arr::isAssoc($elementClass)) {
$classes = [];
foreach ($elementClass as $index => $class) {
$classes[$index] = is_array($class) ? implode(' ', $class) : $class;
}
return $classes;
}
return implode(' ', $elementClass);
} | php | protected function getElementClassString()
{
$elementClass = $this->getElementClass();
if (Arr::isAssoc($elementClass)) {
$classes = [];
foreach ($elementClass as $index => $class) {
$classes[$index] = is_array($class) ? implode(' ', $class) : $class;
}
return $classes;
}
return implode(' ', $elementClass);
} | [
"protected",
"function",
"getElementClassString",
"(",
")",
"{",
"$",
"elementClass",
"=",
"$",
"this",
"->",
"getElementClass",
"(",
")",
";",
"if",
"(",
"Arr",
"::",
"isAssoc",
"(",
"$",
"elementClass",
")",
")",
"{",
"$",
"classes",
"=",
"[",
"]",
"... | Get element class string.
@return mixed | [
"Get",
"element",
"class",
"string",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Form/Field.php#L947-L962 | train | Get the element class string | [
30522,
5123,
3853,
2131,
12260,
3672,
26266,
3367,
4892,
1006,
1007,
1063,
1002,
5783,
26266,
1027,
1002,
2023,
1011,
1028,
2131,
12260,
3672,
26266,
1006,
1007,
1025,
2065,
1006,
12098,
2099,
1024,
1024,
18061,
24137,
2278,
1006,
1002,
578... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Security/Core/Authentication/Token/AbstractToken.php | AbstractToken.setUser | public function setUser($user)
{
if (!($user instanceof UserInterface || (\is_object($user) && method_exists($user, '__toString')) || \is_string($user))) {
throw new \InvalidArgumentException('$user must be an instanceof UserInterface, an object implementing a __toString method, or a primitive string.');
}
if (null === $this->user) {
$changed = false;
} elseif ($this->user instanceof UserInterface) {
if (!$user instanceof UserInterface) {
$changed = true;
} else {
$changed = $this->hasUserChanged($user);
}
} elseif ($user instanceof UserInterface) {
$changed = true;
} else {
$changed = (string) $this->user !== (string) $user;
}
if ($changed) {
$this->setAuthenticated(false);
}
$this->user = $user;
} | php | public function setUser($user)
{
if (!($user instanceof UserInterface || (\is_object($user) && method_exists($user, '__toString')) || \is_string($user))) {
throw new \InvalidArgumentException('$user must be an instanceof UserInterface, an object implementing a __toString method, or a primitive string.');
}
if (null === $this->user) {
$changed = false;
} elseif ($this->user instanceof UserInterface) {
if (!$user instanceof UserInterface) {
$changed = true;
} else {
$changed = $this->hasUserChanged($user);
}
} elseif ($user instanceof UserInterface) {
$changed = true;
} else {
$changed = (string) $this->user !== (string) $user;
}
if ($changed) {
$this->setAuthenticated(false);
}
$this->user = $user;
} | [
"public",
"function",
"setUser",
"(",
"$",
"user",
")",
"{",
"if",
"(",
"!",
"(",
"$",
"user",
"instanceof",
"UserInterface",
"||",
"(",
"\\",
"is_object",
"(",
"$",
"user",
")",
"&&",
"method_exists",
"(",
"$",
"user",
",",
"'__toString'",
")",
")",
... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Security/Core/Authentication/Token/AbstractToken.php#L92-L117 | train | Set the user | [
30522,
2270,
3853,
2275,
20330,
1006,
1002,
5310,
1007,
1063,
2065,
1006,
999,
1006,
1002,
5310,
6013,
11253,
5310,
18447,
2121,
12172,
1064,
1064,
1006,
1032,
2003,
1035,
4874,
1006,
1002,
5310,
1007,
1004,
1004,
4118,
1035,
6526,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Http/Middleware/SetCacheHeaders.php | SetCacheHeaders.parseOptions | protected function parseOptions($options)
{
return collect(explode(';', $options))->mapWithKeys(function ($option) {
$data = explode('=', $option, 2);
return [$data[0] => $data[1] ?? true];
})->all();
} | php | protected function parseOptions($options)
{
return collect(explode(';', $options))->mapWithKeys(function ($option) {
$data = explode('=', $option, 2);
return [$data[0] => $data[1] ?? true];
})->all();
} | [
"protected",
"function",
"parseOptions",
"(",
"$",
"options",
")",
"{",
"return",
"collect",
"(",
"explode",
"(",
"';'",
",",
"$",
"options",
")",
")",
"->",
"mapWithKeys",
"(",
"function",
"(",
"$",
"option",
")",
"{",
"$",
"data",
"=",
"explode",
"("... | Parse the given header options.
@param string $options
@return array | [
"Parse",
"the",
"given",
"header",
"options",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Http/Middleware/SetCacheHeaders.php#L47-L54 | train | Parse options into array of taxonomy options | [
30522,
5123,
3853,
11968,
3366,
7361,
9285,
1006,
1002,
7047,
1007,
1063,
2709,
8145,
1006,
15044,
1006,
1005,
1025,
1005,
1010,
1002,
7047,
1007,
1007,
1011,
1028,
4949,
24415,
14839,
2015,
1006,
3853,
1006,
1002,
5724,
1007,
1063,
1002,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Cache/Simple/PhpArrayCache.php | PhpArrayCache.create | public static function create($file, Psr16CacheInterface $fallbackPool)
{
// Shared memory is available in PHP 7.0+ with OPCache enabled
if (filter_var(ini_get('opcache.enable'), FILTER_VALIDATE_BOOLEAN)) {
return new static($file, $fallbackPool);
}
return $fallbackPool;
} | php | public static function create($file, Psr16CacheInterface $fallbackPool)
{
// Shared memory is available in PHP 7.0+ with OPCache enabled
if (filter_var(ini_get('opcache.enable'), FILTER_VALIDATE_BOOLEAN)) {
return new static($file, $fallbackPool);
}
return $fallbackPool;
} | [
"public",
"static",
"function",
"create",
"(",
"$",
"file",
",",
"Psr16CacheInterface",
"$",
"fallbackPool",
")",
"{",
"// Shared memory is available in PHP 7.0+ with OPCache enabled",
"if",
"(",
"filter_var",
"(",
"ini_get",
"(",
"'opcache.enable'",
")",
",",
"FILTER_V... | This adapter takes advantage of how PHP stores arrays in its latest versions.
@param string $file The PHP file were values are cached
@return Psr16CacheInterface | [
"This",
"adapter",
"takes",
"advantage",
"of",
"how",
"PHP",
"stores",
"arrays",
"in",
"its",
"latest",
"versions",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Cache/Simple/PhpArrayCache.php#L48-L56 | train | Create a new instance of the class | [
30522,
2270,
10763,
3853,
3443,
1006,
1002,
5371,
1010,
8827,
2099,
16048,
3540,
5403,
18447,
2121,
12172,
1002,
2991,
5963,
16869,
1007,
1063,
1013,
1013,
4207,
3638,
2003,
2800,
1999,
25718,
1021,
1012,
1014,
1009,
2007,
6728,
3540,
5403,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Auth/Access/Gate.php | Gate.canBeCalledWithUser | protected function canBeCalledWithUser($user, $class, $method = null)
{
if (! is_null($user)) {
return true;
}
if (! is_null($method)) {
return $this->methodAllowsGuests($class, $method);
}
if (is_array($class)) {
$className = is_string($class[0]) ? $class[0] : get_class($class[0]);
return $this->methodAllowsGuests($className, $class[1]);
}
return $this->callbackAllowsGuests($class);
} | php | protected function canBeCalledWithUser($user, $class, $method = null)
{
if (! is_null($user)) {
return true;
}
if (! is_null($method)) {
return $this->methodAllowsGuests($class, $method);
}
if (is_array($class)) {
$className = is_string($class[0]) ? $class[0] : get_class($class[0]);
return $this->methodAllowsGuests($className, $class[1]);
}
return $this->callbackAllowsGuests($class);
} | [
"protected",
"function",
"canBeCalledWithUser",
"(",
"$",
"user",
",",
"$",
"class",
",",
"$",
"method",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"user",
")",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"!",
"is_null",
"(",
... | Determine whether the callback/method can be called with the given user.
@param \Illuminate\Contracts\Auth\Authenticatable|null $user
@param \Closure|string|array $class
@param string|null $method
@return bool | [
"Determine",
"whether",
"the",
"callback",
"/",
"method",
"can",
"be",
"called",
"with",
"the",
"given",
"user",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Auth/Access/Gate.php#L370-L387 | train | Can be called with user | [
30522,
5123,
3853,
2064,
4783,
9289,
3709,
24415,
20330,
1006,
1002,
5310,
1010,
1002,
2465,
1010,
1002,
4118,
1027,
19701,
1007,
1063,
2065,
1006,
999,
2003,
1035,
19701,
1006,
1002,
5310,
1007,
1007,
1063,
2709,
2995,
1025,
1065,
2065,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Http/Resources/Json/ResourceResponse.php | ResourceResponse.haveAdditionalInformationAndDataIsUnwrapped | protected function haveAdditionalInformationAndDataIsUnwrapped($data, $with, $additional)
{
return (! empty($with) || ! empty($additional)) &&
(! $this->wrapper() ||
! array_key_exists($this->wrapper(), $data));
} | php | protected function haveAdditionalInformationAndDataIsUnwrapped($data, $with, $additional)
{
return (! empty($with) || ! empty($additional)) &&
(! $this->wrapper() ||
! array_key_exists($this->wrapper(), $data));
} | [
"protected",
"function",
"haveAdditionalInformationAndDataIsUnwrapped",
"(",
"$",
"data",
",",
"$",
"with",
",",
"$",
"additional",
")",
"{",
"return",
"(",
"!",
"empty",
"(",
"$",
"with",
")",
"||",
"!",
"empty",
"(",
"$",
"additional",
")",
")",
"&&",
... | Determine if "with" data has been added and our data is unwrapped.
@param array $data
@param array $with
@param array $additional
@return bool | [
"Determine",
"if",
"with",
"data",
"has",
"been",
"added",
"and",
"our",
"data",
"is",
"unwrapped",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Http/Resources/Json/ResourceResponse.php#L93-L98 | train | Checks if additional information is wrapped in the data array | [
30522,
5123,
3853,
2031,
4215,
27064,
2378,
14192,
3370,
5685,
2850,
15444,
19729,
13088,
29098,
2098,
1006,
1002,
2951,
1010,
1002,
2007,
1010,
1002,
3176,
1007,
1063,
2709,
1006,
999,
4064,
1006,
1002,
2007,
1007,
1064,
1064,
999,
4064,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getgrav/grav | system/src/Grav/Common/Page/Page.php | Page.modularTwig | public function modularTwig($var = null)
{
if ($var !== null) {
$this->modular_twig = (bool)$var;
if ($var) {
$this->visible(false);
// some routable logic
if (empty($this->header->routable)) {
$this->routable = false;
}
}
}
return $this->modular_twig;
} | php | public function modularTwig($var = null)
{
if ($var !== null) {
$this->modular_twig = (bool)$var;
if ($var) {
$this->visible(false);
// some routable logic
if (empty($this->header->routable)) {
$this->routable = false;
}
}
}
return $this->modular_twig;
} | [
"public",
"function",
"modularTwig",
"(",
"$",
"var",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"var",
"!==",
"null",
")",
"{",
"$",
"this",
"->",
"modular_twig",
"=",
"(",
"bool",
")",
"$",
"var",
";",
"if",
"(",
"$",
"var",
")",
"{",
"$",
"this"... | Gets and sets the modular_twig var that helps identify this page as a modular child page that will need
twig processing handled differently from a regular page.
@param bool $var true if modular_twig
@return bool true if modular_twig | [
"Gets",
"and",
"sets",
"the",
"modular_twig",
"var",
"that",
"helps",
"identify",
"this",
"page",
"as",
"a",
"modular",
"child",
"page",
"that",
"will",
"need",
"twig",
"processing",
"handled",
"differently",
"from",
"a",
"regular",
"page",
"."
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L2331-L2345 | train | Protected modular Twig | [
30522,
2270,
3853,
19160,
2102,
16279,
1006,
1002,
13075,
1027,
19701,
1007,
1063,
2065,
1006,
1002,
13075,
999,
1027,
1027,
19701,
1007,
1063,
1002,
2023,
1011,
1028,
19160,
1035,
1056,
16279,
1027,
1006,
22017,
2140,
1007,
1002,
13075,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getgrav/grav | system/src/Grav/Common/Page/Medium/MediumFactory.php | MediumFactory.fromUploadedFile | public static function fromUploadedFile(FormFlashFile $uploadedFile, array $params = [])
{
$parts = pathinfo($uploadedFile->getClientFilename());
$filename = $parts['basename'];
$ext = $parts['extension'];
$basename = $parts['filename'];
$file = $uploadedFile->getTmpFile();
$path = dirname($file);
$config = Grav::instance()['config'];
$media_params = $config->get('media.types.' . strtolower($ext));
if (!\is_array($media_params)) {
return null;
}
$params += $media_params;
// Add default settings for undefined variables.
$params += (array)$config->get('media.types.defaults');
$params += [
'type' => 'file',
'thumb' => 'media/thumb.png',
'mime' => 'application/octet-stream',
'filepath' => $file,
'filename' => $filename,
'basename' => $basename,
'extension' => $ext,
'path' => $path,
'modified' => filemtime($file),
'thumbnails' => []
];
$locator = Grav::instance()['locator'];
$file = $locator->findResource("image://{$params['thumb']}");
if ($file) {
$params['thumbnails']['default'] = $file;
}
return static::fromArray($params);
} | php | public static function fromUploadedFile(FormFlashFile $uploadedFile, array $params = [])
{
$parts = pathinfo($uploadedFile->getClientFilename());
$filename = $parts['basename'];
$ext = $parts['extension'];
$basename = $parts['filename'];
$file = $uploadedFile->getTmpFile();
$path = dirname($file);
$config = Grav::instance()['config'];
$media_params = $config->get('media.types.' . strtolower($ext));
if (!\is_array($media_params)) {
return null;
}
$params += $media_params;
// Add default settings for undefined variables.
$params += (array)$config->get('media.types.defaults');
$params += [
'type' => 'file',
'thumb' => 'media/thumb.png',
'mime' => 'application/octet-stream',
'filepath' => $file,
'filename' => $filename,
'basename' => $basename,
'extension' => $ext,
'path' => $path,
'modified' => filemtime($file),
'thumbnails' => []
];
$locator = Grav::instance()['locator'];
$file = $locator->findResource("image://{$params['thumb']}");
if ($file) {
$params['thumbnails']['default'] = $file;
}
return static::fromArray($params);
} | [
"public",
"static",
"function",
"fromUploadedFile",
"(",
"FormFlashFile",
"$",
"uploadedFile",
",",
"array",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"$",
"parts",
"=",
"pathinfo",
"(",
"$",
"uploadedFile",
"->",
"getClientFilename",
"(",
")",
")",
";",
"$"... | Create Medium from an uploaded file
@param FormFlashFile $uploadedFile
@param array $params
@return Medium | [
"Create",
"Medium",
"from",
"an",
"uploaded",
"file"
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Medium/MediumFactory.php#L78-L119 | train | Create a new Media from an uploaded file | [
30522,
2270,
10763,
3853,
2013,
6279,
17468,
8873,
2571,
1006,
2433,
10258,
11823,
8873,
2571,
1002,
21345,
8873,
2571,
1010,
9140,
1002,
11498,
5244,
1027,
1031,
1033,
1007,
1063,
1002,
3033,
1027,
4130,
2378,
14876,
1006,
1002,
21345,
887... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/Zend/Cache/Backend/Sqlite.php | Zend_Cache_Backend_Sqlite.save | public function save($data, $id, $tags = array(), $specificLifetime = false)
{
$this->_checkAndBuildStructure();
$lifetime = $this->getLifetime($specificLifetime);
$data = @sqlite_escape_string($data);
$mktime = time();
if ($lifetime === null) {
$expire = 0;
} else {
$expire = $mktime + $lifetime;
}
$this->_query("DELETE FROM cache WHERE id='$id'");
$sql = "INSERT INTO cache (id, content, lastModified, expire) VALUES ('$id', '$data', $mktime, $expire)";
$res = $this->_query($sql);
if (!$res) {
$this->_log("Zend_Cache_Backend_Sqlite::save() : impossible to store the cache id=$id");
return false;
}
$res = true;
foreach ($tags as $tag) {
$res = $this->_registerTag($id, $tag) && $res;
}
return $res;
} | php | public function save($data, $id, $tags = array(), $specificLifetime = false)
{
$this->_checkAndBuildStructure();
$lifetime = $this->getLifetime($specificLifetime);
$data = @sqlite_escape_string($data);
$mktime = time();
if ($lifetime === null) {
$expire = 0;
} else {
$expire = $mktime + $lifetime;
}
$this->_query("DELETE FROM cache WHERE id='$id'");
$sql = "INSERT INTO cache (id, content, lastModified, expire) VALUES ('$id', '$data', $mktime, $expire)";
$res = $this->_query($sql);
if (!$res) {
$this->_log("Zend_Cache_Backend_Sqlite::save() : impossible to store the cache id=$id");
return false;
}
$res = true;
foreach ($tags as $tag) {
$res = $this->_registerTag($id, $tag) && $res;
}
return $res;
} | [
"public",
"function",
"save",
"(",
"$",
"data",
",",
"$",
"id",
",",
"$",
"tags",
"=",
"array",
"(",
")",
",",
"$",
"specificLifetime",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"_checkAndBuildStructure",
"(",
")",
";",
"$",
"lifetime",
"=",
"$",
... | 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)
@throws Zend_Cache_Exception
@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/Sqlite.php#L159-L182 | train | Save cache data | [
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,
2023,
1011,
1028,
1035,
4638,
5685,
8569,
4014,
5104,
18300,
5397,
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... |
dompdf/dompdf | src/Css/Style.php | Style.debug_print | function debug_print()
{
/*DEBUGCSS*/
print "parent_font_size:" . $this->_parent_font_size . ";\n";
/*DEBUGCSS*/
foreach ($this->_props as $prop => $val) {
/*DEBUGCSS*/
print $prop . ':' . $val;
/*DEBUGCSS*/
if (isset($this->_important_props[$prop])) {
/*DEBUGCSS*/
print '!important';
/*DEBUGCSS*/
}
/*DEBUGCSS*/
print ";\n";
/*DEBUGCSS*/
}
/*DEBUGCSS*/
} | php | function debug_print()
{
/*DEBUGCSS*/
print "parent_font_size:" . $this->_parent_font_size . ";\n";
/*DEBUGCSS*/
foreach ($this->_props as $prop => $val) {
/*DEBUGCSS*/
print $prop . ':' . $val;
/*DEBUGCSS*/
if (isset($this->_important_props[$prop])) {
/*DEBUGCSS*/
print '!important';
/*DEBUGCSS*/
}
/*DEBUGCSS*/
print ";\n";
/*DEBUGCSS*/
}
/*DEBUGCSS*/
} | [
"function",
"debug_print",
"(",
")",
"{",
"/*DEBUGCSS*/",
"print",
"\"parent_font_size:\"",
".",
"$",
"this",
"->",
"_parent_font_size",
".",
"\";\\n\"",
";",
"/*DEBUGCSS*/",
"foreach",
"(",
"$",
"this",
"->",
"_props",
"as",
"$",
"prop",
"=>",
"$",
"val",
"... | /*DEBUGCSS | [
"/",
"*",
"DEBUGCSS"
] | 75f13c700009be21a1965dc2c5b68a8708c22ba2 | https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/src/Css/Style.php#L2932-L2951 | train | Debug print function | [
30522,
3853,
2139,
8569,
2290,
1035,
6140,
1006,
1007,
1063,
1013,
1008,
2139,
8569,
18195,
4757,
1008,
1013,
6140,
1000,
6687,
1035,
15489,
1035,
2946,
1024,
1000,
1012,
1002,
2023,
1011,
1028,
1035,
6687,
1035,
15489,
1035,
2946,
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/Http/Concerns/InteractsWithInput.php | InteractsWithInput.except | public function except($keys)
{
$keys = is_array($keys) ? $keys : func_get_args();
$results = $this->all();
Arr::forget($results, $keys);
return $results;
} | php | public function except($keys)
{
$keys = is_array($keys) ? $keys : func_get_args();
$results = $this->all();
Arr::forget($results, $keys);
return $results;
} | [
"public",
"function",
"except",
"(",
"$",
"keys",
")",
"{",
"$",
"keys",
"=",
"is_array",
"(",
"$",
"keys",
")",
"?",
"$",
"keys",
":",
"func_get_args",
"(",
")",
";",
"$",
"results",
"=",
"$",
"this",
"->",
"all",
"(",
")",
";",
"Arr",
"::",
"... | Get all of the input except for a specified array of items.
@param array|mixed $keys
@return array | [
"Get",
"all",
"of",
"the",
"input",
"except",
"for",
"a",
"specified",
"array",
"of",
"items",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Http/Concerns/InteractsWithInput.php#L244-L253 | train | Get all the pages except the given keys. | [
30522,
2270,
3853,
3272,
1006,
1002,
6309,
1007,
1063,
1002,
6309,
1027,
2003,
1035,
9140,
1006,
1002,
6309,
1007,
1029,
1002,
6309,
1024,
4569,
2278,
1035,
2131,
1035,
12098,
5620,
1006,
1007,
1025,
1002,
3463,
1027,
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... |
getgrav/grav | system/src/Grav/Framework/Flex/FlexForm.php | FlexForm.unserialize | public function unserialize($data): void
{
$data = unserialize($data, ['allowed_classes' => [FlexObject::class]]);
$this->doUnserialize($data);
} | php | public function unserialize($data): void
{
$data = unserialize($data, ['allowed_classes' => [FlexObject::class]]);
$this->doUnserialize($data);
} | [
"public",
"function",
"unserialize",
"(",
"$",
"data",
")",
":",
"void",
"{",
"$",
"data",
"=",
"unserialize",
"(",
"$",
"data",
",",
"[",
"'allowed_classes'",
"=>",
"[",
"FlexObject",
"::",
"class",
"]",
"]",
")",
";",
"$",
"this",
"->",
"doUnserializ... | Implements \Serializable::unserialize().
@param string $data | [
"Implements",
"\\",
"Serializable",
"::",
"unserialize",
"()",
"."
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Framework/Flex/FlexForm.php#L222-L227 | train | Unserialize the record | [
30522,
2270,
3853,
4895,
8043,
4818,
4697,
1006,
1002,
2951,
1007,
1024,
11675,
1063,
1002,
2951,
1027,
4895,
8043,
4818,
4697,
1006,
1002,
2951,
1010,
1031,
1005,
3039,
1035,
4280,
1005,
1027,
1028,
1031,
23951,
16429,
20614,
1024,
1024,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Mail/MailServiceProvider.php | MailServiceProvider.registerSwiftMailer | public function registerSwiftMailer()
{
$this->registerSwiftTransport();
// Once we have the transporter registered, we will register the actual Swift
// mailer instance, passing in the transport instances, which allows us to
// override this transporter instances during app start-up if necessary.
$this->app->singleton('swift.mailer', function () {
if ($domain = $this->app->make('config')->get('mail.domain')) {
Swift_DependencyContainer::getInstance()
->register('mime.idgenerator.idright')
->asValue($domain);
}
return new Swift_Mailer($this->app['swift.transport']->driver());
});
} | php | public function registerSwiftMailer()
{
$this->registerSwiftTransport();
// Once we have the transporter registered, we will register the actual Swift
// mailer instance, passing in the transport instances, which allows us to
// override this transporter instances during app start-up if necessary.
$this->app->singleton('swift.mailer', function () {
if ($domain = $this->app->make('config')->get('mail.domain')) {
Swift_DependencyContainer::getInstance()
->register('mime.idgenerator.idright')
->asValue($domain);
}
return new Swift_Mailer($this->app['swift.transport']->driver());
});
} | [
"public",
"function",
"registerSwiftMailer",
"(",
")",
"{",
"$",
"this",
"->",
"registerSwiftTransport",
"(",
")",
";",
"// Once we have the transporter registered, we will register the actual Swift",
"// mailer instance, passing in the transport instances, which allows us to",
"// ove... | Register the Swift Mailer instance.
@return void | [
"Register",
"the",
"Swift",
"Mailer",
"instance",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Mail/MailServiceProvider.php#L82-L98 | train | Register the Swift_Mailer instance. | [
30522,
2270,
3853,
18687,
9148,
6199,
21397,
2121,
1006,
1007,
1063,
1002,
2023,
1011,
1028,
18687,
9148,
6199,
6494,
3619,
6442,
1006,
1007,
1025,
1013,
1013,
2320,
2057,
2031,
1996,
3665,
2121,
5068,
1010,
2057,
2097,
4236,
1996,
5025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.