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/Bundle/FrameworkBundle/Command/ConfigDebugCommand.php | ConfigDebugCommand.execute | protected function execute(InputInterface $input, OutputInterface $output)
{
$io = new SymfonyStyle($input, $output);
$errorIo = $io->getErrorStyle();
if (null === $name = $input->getArgument('name')) {
$this->listBundles($errorIo);
$errorIo->comment('Provide the name of a bundle as the first argument of this command to dump its configuration. (e.g. <comment>debug:config FrameworkBundle</comment>)');
$errorIo->comment('For dumping a specific option, add its path as the second argument of this command. (e.g. <comment>debug:config FrameworkBundle serializer</comment> to dump the <comment>framework.serializer</comment> configuration)');
return;
}
$extension = $this->findExtension($name);
$container = $this->compileContainer();
$extensionAlias = $extension->getAlias();
$extensionConfig = [];
foreach ($container->getCompilerPassConfig()->getPasses() as $pass) {
if ($pass instanceof ValidateEnvPlaceholdersPass) {
$extensionConfig = $pass->getExtensionConfig();
break;
}
}
if (!isset($extensionConfig[$extensionAlias])) {
throw new \LogicException(sprintf('The extension with alias "%s" does not have configuration.', $extensionAlias));
}
$config = $container->resolveEnvPlaceholders($extensionConfig[$extensionAlias]);
if (null === $path = $input->getArgument('path')) {
$io->title(
sprintf('Current configuration for %s', ($name === $extensionAlias ? sprintf('extension with alias "%s"', $extensionAlias) : sprintf('"%s"', $name)))
);
$io->writeln(Yaml::dump([$extensionAlias => $config], 10));
return;
}
try {
$config = $this->getConfigForPath($config, $path, $extensionAlias);
} catch (LogicException $e) {
$errorIo->error($e->getMessage());
return;
}
$io->title(sprintf('Current configuration for "%s.%s"', $extensionAlias, $path));
$io->writeln(Yaml::dump($config, 10));
} | php | protected function execute(InputInterface $input, OutputInterface $output)
{
$io = new SymfonyStyle($input, $output);
$errorIo = $io->getErrorStyle();
if (null === $name = $input->getArgument('name')) {
$this->listBundles($errorIo);
$errorIo->comment('Provide the name of a bundle as the first argument of this command to dump its configuration. (e.g. <comment>debug:config FrameworkBundle</comment>)');
$errorIo->comment('For dumping a specific option, add its path as the second argument of this command. (e.g. <comment>debug:config FrameworkBundle serializer</comment> to dump the <comment>framework.serializer</comment> configuration)');
return;
}
$extension = $this->findExtension($name);
$container = $this->compileContainer();
$extensionAlias = $extension->getAlias();
$extensionConfig = [];
foreach ($container->getCompilerPassConfig()->getPasses() as $pass) {
if ($pass instanceof ValidateEnvPlaceholdersPass) {
$extensionConfig = $pass->getExtensionConfig();
break;
}
}
if (!isset($extensionConfig[$extensionAlias])) {
throw new \LogicException(sprintf('The extension with alias "%s" does not have configuration.', $extensionAlias));
}
$config = $container->resolveEnvPlaceholders($extensionConfig[$extensionAlias]);
if (null === $path = $input->getArgument('path')) {
$io->title(
sprintf('Current configuration for %s', ($name === $extensionAlias ? sprintf('extension with alias "%s"', $extensionAlias) : sprintf('"%s"', $name)))
);
$io->writeln(Yaml::dump([$extensionAlias => $config], 10));
return;
}
try {
$config = $this->getConfigForPath($config, $path, $extensionAlias);
} catch (LogicException $e) {
$errorIo->error($e->getMessage());
return;
}
$io->title(sprintf('Current configuration for "%s.%s"', $extensionAlias, $path));
$io->writeln(Yaml::dump($config, 10));
} | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"$",
"io",
"=",
"new",
"SymfonyStyle",
"(",
"$",
"input",
",",
"$",
"output",
")",
";",
"$",
"errorIo",
"=",
"$",
"io",
"->",
"get... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/FrameworkBundle/Command/ConfigDebugCommand.php#L66-L118 | train | Execute the dump command | [
30522,
5123,
3853,
15389,
1006,
7953,
18447,
2121,
12172,
1002,
7953,
1010,
6434,
18447,
2121,
12172,
1002,
6434,
1007,
1063,
1002,
22834,
1027,
2047,
25353,
2213,
14876,
4890,
21756,
2571,
1006,
1002,
7953,
1010,
1002,
6434,
1007,
1025,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Queue/RedisQueue.php | RedisQueue.size | public function size($queue = null)
{
$queue = $this->getQueue($queue);
return $this->getConnection()->eval(
LuaScripts::size(), 3, $queue, $queue.':delayed', $queue.':reserved'
);
} | php | public function size($queue = null)
{
$queue = $this->getQueue($queue);
return $this->getConnection()->eval(
LuaScripts::size(), 3, $queue, $queue.':delayed', $queue.':reserved'
);
} | [
"public",
"function",
"size",
"(",
"$",
"queue",
"=",
"null",
")",
"{",
"$",
"queue",
"=",
"$",
"this",
"->",
"getQueue",
"(",
"$",
"queue",
")",
";",
"return",
"$",
"this",
"->",
"getConnection",
"(",
")",
"->",
"eval",
"(",
"LuaScripts",
"::",
"s... | Get the size of the queue.
@param string $queue
@return int | [
"Get",
"the",
"size",
"of",
"the",
"queue",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Queue/RedisQueue.php#L72-L79 | train | Returns the number of words in the queue | [
30522,
2270,
3853,
2946,
1006,
1002,
24240,
1027,
19701,
1007,
1063,
1002,
24240,
1027,
1002,
2023,
1011,
1028,
2131,
4226,
5657,
1006,
1002,
24240,
1007,
1025,
2709,
1002,
2023,
1011,
1028,
2131,
8663,
2638,
7542,
1006,
1007,
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... |
octobercms/october | modules/cms/widgets/ComponentList.php | ComponentList.getData | protected function getData()
{
$searchTerm = Str::lower($this->getSearchTerm());
$searchWords = [];
if (strlen($searchTerm)) {
$searchWords = explode(' ', $searchTerm);
}
$pluginManager = PluginManager::instance();
$plugins = $pluginManager->getPlugins();
$this->prepareComponentList();
$items = [];
foreach ($plugins as $plugin) {
$components = $this->getPluginComponents($plugin);
if (!is_array($components)) {
continue;
}
$pluginDetails = $plugin->pluginDetails();
$pluginName = $pluginDetails['name'] ?? Lang::get('system::lang.plugin.unnamed');
$pluginIcon = $pluginDetails['icon'] ?? 'icon-puzzle-piece';
$pluginDescription = $pluginDetails['description'] ?? null;
$pluginClass = get_class($plugin);
$pluginItems = [];
foreach ($components as $componentInfo) {
$className = $componentInfo->className;
$alias = $componentInfo->alias;
$component = App::make($className);
if ($component->isHidden) {
continue;
}
$componentDetails = $component->componentDetails();
$component->alias = '--alias--';
$item = (object)[
'title' => ComponentHelpers::getComponentName($component),
'description' => ComponentHelpers::getComponentDescription($component),
'plugin' => $pluginName,
'propertyConfig' => ComponentHelpers::getComponentsPropertyConfig($component),
'propertyValues' => ComponentHelpers::getComponentPropertyValues($component, $alias),
'className' => get_class($component),
'pluginIcon' => $pluginIcon,
'alias' => $alias,
'name' => $componentInfo->duplicateAlias
? $componentInfo->className
: $componentInfo->alias
];
if ($searchWords && !$this->itemMatchesSearch($searchWords, $item)) {
continue;
}
if (!array_key_exists($pluginClass, $items)) {
$group = (object)[
'title' => $pluginName,
'description' => $pluginDescription,
'pluginClass' => $pluginClass,
'icon' => $pluginIcon,
'items' => []
];
$items[$pluginClass] = $group;
}
$pluginItems[] = $item;
}
usort($pluginItems, function ($a, $b) {
return strcmp($a->title, $b->title);
});
if (isset($items[$pluginClass])) {
$items[$pluginClass]->items = $pluginItems;
}
}
uasort($items, function ($a, $b) {
return strcmp($a->title, $b->title);
});
return $items;
} | php | protected function getData()
{
$searchTerm = Str::lower($this->getSearchTerm());
$searchWords = [];
if (strlen($searchTerm)) {
$searchWords = explode(' ', $searchTerm);
}
$pluginManager = PluginManager::instance();
$plugins = $pluginManager->getPlugins();
$this->prepareComponentList();
$items = [];
foreach ($plugins as $plugin) {
$components = $this->getPluginComponents($plugin);
if (!is_array($components)) {
continue;
}
$pluginDetails = $plugin->pluginDetails();
$pluginName = $pluginDetails['name'] ?? Lang::get('system::lang.plugin.unnamed');
$pluginIcon = $pluginDetails['icon'] ?? 'icon-puzzle-piece';
$pluginDescription = $pluginDetails['description'] ?? null;
$pluginClass = get_class($plugin);
$pluginItems = [];
foreach ($components as $componentInfo) {
$className = $componentInfo->className;
$alias = $componentInfo->alias;
$component = App::make($className);
if ($component->isHidden) {
continue;
}
$componentDetails = $component->componentDetails();
$component->alias = '--alias--';
$item = (object)[
'title' => ComponentHelpers::getComponentName($component),
'description' => ComponentHelpers::getComponentDescription($component),
'plugin' => $pluginName,
'propertyConfig' => ComponentHelpers::getComponentsPropertyConfig($component),
'propertyValues' => ComponentHelpers::getComponentPropertyValues($component, $alias),
'className' => get_class($component),
'pluginIcon' => $pluginIcon,
'alias' => $alias,
'name' => $componentInfo->duplicateAlias
? $componentInfo->className
: $componentInfo->alias
];
if ($searchWords && !$this->itemMatchesSearch($searchWords, $item)) {
continue;
}
if (!array_key_exists($pluginClass, $items)) {
$group = (object)[
'title' => $pluginName,
'description' => $pluginDescription,
'pluginClass' => $pluginClass,
'icon' => $pluginIcon,
'items' => []
];
$items[$pluginClass] = $group;
}
$pluginItems[] = $item;
}
usort($pluginItems, function ($a, $b) {
return strcmp($a->title, $b->title);
});
if (isset($items[$pluginClass])) {
$items[$pluginClass]->items = $pluginItems;
}
}
uasort($items, function ($a, $b) {
return strcmp($a->title, $b->title);
});
return $items;
} | [
"protected",
"function",
"getData",
"(",
")",
"{",
"$",
"searchTerm",
"=",
"Str",
"::",
"lower",
"(",
"$",
"this",
"->",
"getSearchTerm",
"(",
")",
")",
";",
"$",
"searchWords",
"=",
"[",
"]",
";",
"if",
"(",
"strlen",
"(",
"$",
"searchTerm",
")",
... | /*
Methods for th internal use | [
"/",
"*",
"Methods",
"for",
"th",
"internal",
"use"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/widgets/ComponentList.php#L59-L147 | train | Returns the data for the search term | [
30522,
5123,
3853,
2131,
2850,
2696,
1006,
1007,
1063,
1002,
3945,
3334,
2213,
1027,
2358,
2099,
1024,
1024,
2896,
1006,
1002,
2023,
1011,
1028,
4152,
14644,
10143,
2121,
2213,
1006,
1007,
1007,
1025,
1002,
3945,
22104,
1027,
1031,
1033,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
z-song/laravel-admin | src/Widgets/Box.php | Box.style | public function style($styles)
{
if (is_string($styles)) {
return $this->style([$styles]);
}
$styles = array_map(function ($style) {
return 'box-'.$style;
}, $styles);
$this->class = $this->class.' '.implode(' ', $styles);
return $this;
} | php | public function style($styles)
{
if (is_string($styles)) {
return $this->style([$styles]);
}
$styles = array_map(function ($style) {
return 'box-'.$style;
}, $styles);
$this->class = $this->class.' '.implode(' ', $styles);
return $this;
} | [
"public",
"function",
"style",
"(",
"$",
"styles",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"styles",
")",
")",
"{",
"return",
"$",
"this",
"->",
"style",
"(",
"[",
"$",
"styles",
"]",
")",
";",
"}",
"$",
"styles",
"=",
"array_map",
"(",
"func... | Set box style.
@param string $styles
@return $this|Box | [
"Set",
"box",
"style",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Widgets/Box.php#L113-L126 | train | Set box styles | [
30522,
2270,
3853,
2806,
1006,
1002,
6782,
1007,
1063,
2065,
1006,
2003,
1035,
5164,
1006,
1002,
6782,
1007,
1007,
1063,
2709,
1002,
2023,
1011,
1028,
2806,
1006,
1031,
1002,
6782,
1033,
1007,
1025,
1065,
1002,
6782,
1027,
9140,
1035,
494... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Libmemcached.php | Zend_Cache_Backend_Libmemcached.clean | public function clean($mode = Zend_Cache::CLEANING_MODE_ALL, $tags = array())
{
switch ($mode) {
case Zend_Cache::CLEANING_MODE_ALL:
return $this->_memcache->flush();
break;
case Zend_Cache::CLEANING_MODE_OLD:
$this->_log("Zend_Cache_Backend_Libmemcached::clean() : CLEANING_MODE_OLD is unsupported by the Libmemcached backend");
break;
case Zend_Cache::CLEANING_MODE_MATCHING_TAG:
case Zend_Cache::CLEANING_MODE_NOT_MATCHING_TAG:
case Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG:
$this->_log(self::TAGS_UNSUPPORTED_BY_CLEAN_OF_LIBMEMCACHED_BACKEND);
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:
return $this->_memcache->flush();
break;
case Zend_Cache::CLEANING_MODE_OLD:
$this->_log("Zend_Cache_Backend_Libmemcached::clean() : CLEANING_MODE_OLD is unsupported by the Libmemcached backend");
break;
case Zend_Cache::CLEANING_MODE_MATCHING_TAG:
case Zend_Cache::CLEANING_MODE_NOT_MATCHING_TAG:
case Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG:
$this->_log(self::TAGS_UNSUPPORTED_BY_CLEAN_OF_LIBMEMCACHED_BACKEND);
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",
":",
"return",
"$",
... | Clean some cache records
Available modes are :
'all' (default) => remove all cache entries ($tags is not used)
'old' => unsupported
'matchingTag' => unsupported
'notMatchingTag' => unsupported
'matchingAnyTag' => unsupported
@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/Libmemcached.php#L245-L263 | train | Flushes all 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... |
laravel/framework | src/Illuminate/Redis/Connections/PhpRedisConnection.php | PhpRedisConnection.exists | public function exists(...$keys)
{
$keys = collect($keys)->map(function ($key) {
return $this->applyPrefix($key);
})->all();
return $this->executeRaw(array_merge(['exists'], $keys));
} | php | public function exists(...$keys)
{
$keys = collect($keys)->map(function ($key) {
return $this->applyPrefix($key);
})->all();
return $this->executeRaw(array_merge(['exists'], $keys));
} | [
"public",
"function",
"exists",
"(",
"...",
"$",
"keys",
")",
"{",
"$",
"keys",
"=",
"collect",
"(",
"$",
"keys",
")",
"->",
"map",
"(",
"function",
"(",
"$",
"key",
")",
"{",
"return",
"$",
"this",
"->",
"applyPrefix",
"(",
"$",
"key",
")",
";",... | Determine if the given keys exist.
@param dynamic $keys
@return int | [
"Determine",
"if",
"the",
"given",
"keys",
"exist",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Redis/Connections/PhpRedisConnection.php#L57-L64 | train | Check if a key exists in the cache. | [
30522,
2270,
3853,
6526,
1006,
1012,
1012,
1012,
1002,
6309,
1007,
1063,
1002,
6309,
1027,
8145,
1006,
1002,
6309,
1007,
1011,
1028,
4949,
1006,
3853,
1006,
1002,
3145,
1007,
1063,
2709,
1002,
2023,
1011,
1028,
6611,
28139,
8873,
2595,
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/Storage/SimpleStorage.php | SimpleStorage.getMediaPath | public function getMediaPath(string $key = null): string
{
return sprintf('%s/%s/%s', $this->dataFolder, basename($this->dataPattern, $this->dataFormatter->getDefaultFileExtension()), $key);
} | php | public function getMediaPath(string $key = null): string
{
return sprintf('%s/%s/%s', $this->dataFolder, basename($this->dataPattern, $this->dataFormatter->getDefaultFileExtension()), $key);
} | [
"public",
"function",
"getMediaPath",
"(",
"string",
"$",
"key",
"=",
"null",
")",
":",
"string",
"{",
"return",
"sprintf",
"(",
"'%s/%s/%s'",
",",
"$",
"this",
"->",
"dataFolder",
",",
"basename",
"(",
"$",
"this",
"->",
"dataPattern",
",",
"$",
"this",... | {@inheritdoc}
@see FlexStorageInterface::getMediaPath() | [
"{"
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Framework/Flex/Storage/SimpleStorage.php#L248-L251 | train | Get Media Path | [
30522,
2270,
3853,
2131,
16969,
15069,
1006,
5164,
1002,
3145,
1027,
19701,
1007,
1024,
5164,
1063,
2709,
9043,
2546,
1006,
1005,
1003,
1055,
1013,
1003,
1055,
1013,
1003,
1055,
1005,
1010,
1002,
2023,
1011,
1028,
2951,
10371,
2121,
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/Cache/Backend/ZendPlatform.php | Zend_Cache_Backend_ZendPlatform.load | public function load($id, $doNotTestCacheValidity = false)
{
// doNotTestCacheValidity implemented by giving zero lifetime to the cache
if ($doNotTestCacheValidity) {
$lifetime = 0;
} else {
$lifetime = $this->_directives['lifetime'];
}
$res = output_cache_get($id, $lifetime);
if($res) {
return $res[0];
} else {
return false;
}
} | php | public function load($id, $doNotTestCacheValidity = false)
{
// doNotTestCacheValidity implemented by giving zero lifetime to the cache
if ($doNotTestCacheValidity) {
$lifetime = 0;
} else {
$lifetime = $this->_directives['lifetime'];
}
$res = output_cache_get($id, $lifetime);
if($res) {
return $res[0];
} else {
return false;
}
} | [
"public",
"function",
"load",
"(",
"$",
"id",
",",
"$",
"doNotTestCacheValidity",
"=",
"false",
")",
"{",
"// doNotTestCacheValidity implemented by giving zero lifetime to the cache",
"if",
"(",
"$",
"doNotTestCacheValidity",
")",
"{",
"$",
"lifetime",
"=",
"0",
";",
... | 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 Cached data (or false) | [
"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/ZendPlatform.php#L86-L100 | train | Load an entry from the cache | [
30522,
2270,
3853,
7170,
1006,
1002,
8909,
1010,
1002,
2123,
28495,
3367,
3540,
16179,
11475,
25469,
1027,
6270,
1007,
1063,
1013,
1013,
2123,
28495,
3367,
3540,
16179,
11475,
25469,
7528,
2011,
3228,
5717,
6480,
2000,
1996,
17053,
2065,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/HTML/Common2.php | HTML_Common2.mergeAttributes | public function mergeAttributes($attributes)
{
$attributes = self::prepareAttributes($attributes);
foreach ($this->watchedAttributes as $watchedKey) {
if (isset($attributes[$watchedKey])) {
$this->onAttributeChange($watchedKey, $attributes[$watchedKey]);
unset($attributes[$watchedKey]);
}
}
$this->attributes = array_merge($this->attributes, $attributes);
return $this;
} | php | public function mergeAttributes($attributes)
{
$attributes = self::prepareAttributes($attributes);
foreach ($this->watchedAttributes as $watchedKey) {
if (isset($attributes[$watchedKey])) {
$this->onAttributeChange($watchedKey, $attributes[$watchedKey]);
unset($attributes[$watchedKey]);
}
}
$this->attributes = array_merge($this->attributes, $attributes);
return $this;
} | [
"public",
"function",
"mergeAttributes",
"(",
"$",
"attributes",
")",
"{",
"$",
"attributes",
"=",
"self",
"::",
"prepareAttributes",
"(",
"$",
"attributes",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"watchedAttributes",
"as",
"$",
"watchedKey",
")",
"{",... | Merges the existing attributes with the new ones
@param mixed Array of attribute 'name' => 'value' pairs or HTML attribute string
@return HTML_Common2 | [
"Merges",
"the",
"existing",
"attributes",
"with",
"the",
"new",
"ones"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/HTML/Common2.php#L314-L325 | train | Merge attributes of this node with the attributes of this node | [
30522,
2270,
3853,
13590,
19321,
3089,
8569,
4570,
1006,
1002,
12332,
1007,
1063,
1002,
12332,
1027,
2969,
1024,
1024,
7374,
19321,
3089,
8569,
4570,
1006,
1002,
12332,
1007,
1025,
18921,
6776,
1006,
1002,
2023,
1011,
1028,
3427,
19321,
308... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Psr7/Traits/MessageDecoratorTrait.php | MessageDecoratorTrait.withBody | public function withBody(StreamInterface $body): self
{
$new = clone $this;
$new->message = $this->message->withBody($body);
return $new;
} | php | public function withBody(StreamInterface $body): self
{
$new = clone $this;
$new->message = $this->message->withBody($body);
return $new;
} | [
"public",
"function",
"withBody",
"(",
"StreamInterface",
"$",
"body",
")",
":",
"self",
"{",
"$",
"new",
"=",
"clone",
"$",
"this",
";",
"$",
"new",
"->",
"message",
"=",
"$",
"this",
"->",
"message",
"->",
"withBody",
"(",
"$",
"body",
")",
";",
... | {@inheritdoc} | [
"{"
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Framework/Psr7/Traits/MessageDecoratorTrait.php#L133-L139 | train | Create a new instance with the specified body. | [
30522,
2270,
3853,
2007,
23684,
1006,
5460,
18447,
2121,
12172,
1002,
2303,
1007,
1024,
2969,
1063,
1002,
2047,
1027,
17598,
1002,
2023,
1025,
1002,
2047,
1011,
1028,
4471,
1027,
1002,
2023,
1011,
1028,
4471,
1011,
1028,
2007,
23684,
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/Container/Container.php | Container.offsetUnset | public function offsetUnset($key)
{
unset($this->bindings[$key], $this->instances[$key], $this->resolved[$key]);
} | php | public function offsetUnset($key)
{
unset($this->bindings[$key], $this->instances[$key], $this->resolved[$key]);
} | [
"public",
"function",
"offsetUnset",
"(",
"$",
"key",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"bindings",
"[",
"$",
"key",
"]",
",",
"$",
"this",
"->",
"instances",
"[",
"$",
"key",
"]",
",",
"$",
"this",
"->",
"resolved",
"[",
"$",
"key",
"]"... | Unset the value at a given offset.
@param string $key
@return void | [
"Unset",
"the",
"value",
"at",
"a",
"given",
"offset",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Container/Container.php#L1248-L1251 | train | Unsets a binding and instance from the container | [
30522,
2270,
3853,
16396,
4609,
13462,
1006,
1002,
3145,
1007,
1063,
4895,
13462,
1006,
1002,
2023,
1011,
1028,
8031,
2015,
1031,
1002,
3145,
1033,
1010,
1002,
2023,
1011,
1028,
12107,
1031,
1002,
3145,
1033,
1010,
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... |
matomo-org/matomo | plugins/SitesManager/API.php | API.setDefaultCurrency | public function setDefaultCurrency($defaultCurrency)
{
Piwik::checkUserHasSuperUserAccess();
$this->checkValidCurrency($defaultCurrency);
Option::set(self::OPTION_DEFAULT_CURRENCY, $defaultCurrency);
return true;
} | php | public function setDefaultCurrency($defaultCurrency)
{
Piwik::checkUserHasSuperUserAccess();
$this->checkValidCurrency($defaultCurrency);
Option::set(self::OPTION_DEFAULT_CURRENCY, $defaultCurrency);
return true;
} | [
"public",
"function",
"setDefaultCurrency",
"(",
"$",
"defaultCurrency",
")",
"{",
"Piwik",
"::",
"checkUserHasSuperUserAccess",
"(",
")",
";",
"$",
"this",
"->",
"checkValidCurrency",
"(",
"$",
"defaultCurrency",
")",
";",
"Option",
"::",
"set",
"(",
"self",
... | Sets the default currency that will be used when creating websites
@param string $defaultCurrency Currency code, eg. 'USD'
@return bool | [
"Sets",
"the",
"default",
"currency",
"that",
"will",
"be",
"used",
"when",
"creating",
"websites"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/SitesManager/API.php#L1170-L1176 | train | Set default currency | [
30522,
2270,
3853,
2275,
3207,
7011,
11314,
10841,
14343,
9407,
1006,
1002,
12398,
10841,
14343,
9407,
1007,
1063,
14255,
9148,
2243,
1024,
1024,
4638,
20330,
14949,
6342,
4842,
20330,
6305,
9623,
2015,
1006,
1007,
1025,
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... |
dompdf/dompdf | src/Dompdf.php | Dompdf.setCallbacks | public function setCallbacks($callbacks)
{
if (is_array($callbacks)) {
$this->callbacks = array();
foreach ($callbacks as $c) {
if (is_array($c) && isset($c['event']) && isset($c['f'])) {
$event = $c['event'];
$f = $c['f'];
if (is_callable($f) && is_string($event)) {
$this->callbacks[$event][] = $f;
}
}
}
}
} | php | public function setCallbacks($callbacks)
{
if (is_array($callbacks)) {
$this->callbacks = array();
foreach ($callbacks as $c) {
if (is_array($c) && isset($c['event']) && isset($c['f'])) {
$event = $c['event'];
$f = $c['f'];
if (is_callable($f) && is_string($event)) {
$this->callbacks[$event][] = $f;
}
}
}
}
} | [
"public",
"function",
"setCallbacks",
"(",
"$",
"callbacks",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"callbacks",
")",
")",
"{",
"$",
"this",
"->",
"callbacks",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"callbacks",
"as",
"$",
"c",
")",
... | Sets callbacks for events like rendering of pages and elements.
The callbacks array contains arrays with 'event' set to 'begin_page',
'end_page', 'begin_frame', or 'end_frame' and 'f' set to a function or
object plus method to be called.
The function 'f' must take an array as argument, which contains info
about the event.
@param array $callbacks the set of callbacks to set | [
"Sets",
"callbacks",
"for",
"events",
"like",
"rendering",
"of",
"pages",
"and",
"elements",
".",
"The",
"callbacks",
"array",
"contains",
"arrays",
"with",
"event",
"set",
"to",
"begin_page",
"end_page",
"begin_frame",
"or",
"end_frame",
"and",
"f",
"set",
"t... | 75f13c700009be21a1965dc2c5b68a8708c22ba2 | https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/src/Dompdf.php#L1442-L1456 | train | setCallbacks - Set the callbacks | [
30522,
2270,
3853,
2275,
9289,
20850,
8684,
2015,
1006,
1002,
2655,
12221,
1007,
1063,
2065,
1006,
2003,
30524,
6776,
1006,
1002,
2655,
12221,
2004,
1002,
1039,
1007,
1063,
2065,
1006,
2003,
1035,
9140,
1006,
1002,
1039,
1007,
1004,
1004,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
overtrue/wechat | src/OfficialAccount/Menu/Client.php | Client.delete | public function delete(int $menuId = null)
{
if (is_null($menuId)) {
return $this->httpGet('cgi-bin/menu/delete');
}
return $this->httpPostJson('cgi-bin/menu/delconditional', ['menuid' => $menuId]);
} | php | public function delete(int $menuId = null)
{
if (is_null($menuId)) {
return $this->httpGet('cgi-bin/menu/delete');
}
return $this->httpPostJson('cgi-bin/menu/delconditional', ['menuid' => $menuId]);
} | [
"public",
"function",
"delete",
"(",
"int",
"$",
"menuId",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"menuId",
")",
")",
"{",
"return",
"$",
"this",
"->",
"httpGet",
"(",
"'cgi-bin/menu/delete'",
")",
";",
"}",
"return",
"$",
"this",
"->... | Destroy menu.
@param int $menuId
@return mixed | [
"Destroy",
"menu",
"."
] | 120c72faaa93c270365bc75c73c362d5fd583209 | https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/OfficialAccount/Menu/Client.php#L70-L77 | train | Delete a menu | [
30522,
2270,
3853,
3972,
12870,
1006,
20014,
1002,
12183,
3593,
1027,
19701,
1007,
1063,
2065,
1006,
2003,
1035,
19701,
1006,
1002,
12183,
3593,
1007,
1007,
1063,
2709,
1002,
2023,
1011,
1028,
8299,
18150,
1006,
1005,
1039,
5856,
1011,
8026... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getgrav/grav | system/src/Grav/Console/Gpm/InstallCommand.php | InstallCommand.processDemo | private function processDemo($package)
{
$demo_dir = $this->destination . DS . $package->install_path . DS . '_demo';
if (file_exists($demo_dir)) {
$this->demo_processing[] = $package;
}
} | php | private function processDemo($package)
{
$demo_dir = $this->destination . DS . $package->install_path . DS . '_demo';
if (file_exists($demo_dir)) {
$this->demo_processing[] = $package;
}
} | [
"private",
"function",
"processDemo",
"(",
"$",
"package",
")",
"{",
"$",
"demo_dir",
"=",
"$",
"this",
"->",
"destination",
".",
"DS",
".",
"$",
"package",
"->",
"install_path",
".",
"DS",
".",
"'_demo'",
";",
"if",
"(",
"file_exists",
"(",
"$",
"demo... | Add package to the queue to process the demo content, if demo content exists
@param Package $package | [
"Add",
"package",
"to",
"the",
"queue",
"to",
"process",
"the",
"demo",
"content",
"if",
"demo",
"content",
"exists"
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Console/Gpm/InstallCommand.php#L349-L355 | train | Process demo file | [
30522,
2797,
3853,
2832,
3207,
5302,
1006,
1002,
7427,
1007,
1063,
1002,
9703,
1035,
16101,
1027,
1002,
2023,
1011,
1028,
7688,
1012,
16233,
1012,
1002,
7427,
1011,
1028,
30524,
1027,
1002,
7427,
1025,
1065,
1065,
102,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Process/Process.php | Process.getIncrementalErrorOutput | public function getIncrementalErrorOutput()
{
$this->readPipesForOutput(__FUNCTION__);
$latest = stream_get_contents($this->stderr, -1, $this->incrementalErrorOutputOffset);
$this->incrementalErrorOutputOffset = ftell($this->stderr);
if (false === $latest) {
return '';
}
return $latest;
} | php | public function getIncrementalErrorOutput()
{
$this->readPipesForOutput(__FUNCTION__);
$latest = stream_get_contents($this->stderr, -1, $this->incrementalErrorOutputOffset);
$this->incrementalErrorOutputOffset = ftell($this->stderr);
if (false === $latest) {
return '';
}
return $latest;
} | [
"public",
"function",
"getIncrementalErrorOutput",
"(",
")",
"{",
"$",
"this",
"->",
"readPipesForOutput",
"(",
"__FUNCTION__",
")",
";",
"$",
"latest",
"=",
"stream_get_contents",
"(",
"$",
"this",
"->",
"stderr",
",",
"-",
"1",
",",
"$",
"this",
"->",
"i... | Returns the errorOutput incrementally.
In comparison with the getErrorOutput method which always return the
whole error output, this one returns the new error output since the last
call.
@return string The process error output since the last call
@throws LogicException in case the output has been disabled
@throws LogicException In case the process is not started | [
"Returns",
"the",
"errorOutput",
"incrementally",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Process/Process.php#L701-L713 | train | Get the incremental error output | [
30522,
2270,
3853,
2131,
2378,
16748,
26901,
2121,
29165,
5833,
18780,
1006,
1007,
1063,
1002,
2023,
1011,
1028,
3191,
24548,
22747,
14604,
4904,
18780,
1006,
1035,
1035,
3853,
1035,
1035,
1007,
1025,
1002,
6745,
1027,
5460,
1035,
2131,
103... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/Zend/Validate/Isbn.php | Zend_Validate_Isbn.isValid | public function isValid($value)
{
if (!is_string($value) && !is_int($value)) {
$this->_error(self::INVALID);
return false;
}
$value = (string) $value;
$this->_setValue($value);
switch ($this->_detectFormat()) {
case self::ISBN10:
// sum
$isbn10 = str_replace($this->_separator, '', $value);
$sum = 0;
for ($i = 0; $i < 9; $i++) {
$sum += (10 - $i) * $isbn10{$i};
}
// checksum
$checksum = 11 - ($sum % 11);
if ($checksum == 11) {
$checksum = '0';
} elseif ($checksum == 10) {
$checksum = 'X';
}
break;
case self::ISBN13:
// sum
$isbn13 = str_replace($this->_separator, '', $value);
$sum = 0;
for ($i = 0; $i < 12; $i++) {
if ($i % 2 == 0) {
$sum += $isbn13{$i};
} else {
$sum += 3 * $isbn13{$i};
}
}
// checksum
$checksum = 10 - ($sum % 10);
if ($checksum == 10) {
$checksum = '0';
}
break;
default:
$this->_error(self::NO_ISBN);
return false;
}
// validate
if (substr($this->_value, -1) != $checksum) {
$this->_error(self::NO_ISBN);
return false;
}
return true;
} | php | public function isValid($value)
{
if (!is_string($value) && !is_int($value)) {
$this->_error(self::INVALID);
return false;
}
$value = (string) $value;
$this->_setValue($value);
switch ($this->_detectFormat()) {
case self::ISBN10:
// sum
$isbn10 = str_replace($this->_separator, '', $value);
$sum = 0;
for ($i = 0; $i < 9; $i++) {
$sum += (10 - $i) * $isbn10{$i};
}
// checksum
$checksum = 11 - ($sum % 11);
if ($checksum == 11) {
$checksum = '0';
} elseif ($checksum == 10) {
$checksum = 'X';
}
break;
case self::ISBN13:
// sum
$isbn13 = str_replace($this->_separator, '', $value);
$sum = 0;
for ($i = 0; $i < 12; $i++) {
if ($i % 2 == 0) {
$sum += $isbn13{$i};
} else {
$sum += 3 * $isbn13{$i};
}
}
// checksum
$checksum = 10 - ($sum % 10);
if ($checksum == 10) {
$checksum = '0';
}
break;
default:
$this->_error(self::NO_ISBN);
return false;
}
// validate
if (substr($this->_value, -1) != $checksum) {
$this->_error(self::NO_ISBN);
return false;
}
return true;
} | [
"public",
"function",
"isValid",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"value",
")",
"&&",
"!",
"is_int",
"(",
"$",
"value",
")",
")",
"{",
"$",
"this",
"->",
"_error",
"(",
"self",
"::",
"INVALID",
")",
";",
"return... | Defined by Zend_Validate_Interface.
Returns true if and only if $value is a valid ISBN.
@param string $value
@return boolean | [
"Defined",
"by",
"Zend_Validate_Interface",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Validate/Isbn.php#L155-L212 | train | Checks if the field is valid. | [
30522,
2270,
3853,
2003,
10175,
3593,
1006,
1002,
3643,
1007,
1063,
2065,
1006,
999,
2003,
1035,
5164,
1006,
1002,
3643,
1007,
1004,
1004,
999,
2003,
1035,
20014,
1006,
1002,
3643,
1007,
1007,
1063,
1002,
2023,
1011,
1028,
1035,
7561,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/Url.php | Url.getCurrentQueryStringWithParametersModified | public static function getCurrentQueryStringWithParametersModified($params)
{
$urlValues = self::getArrayFromCurrentQueryString();
foreach ($params as $key => $value) {
$urlValues[$key] = $value;
}
$query = self::getQueryStringFromParameters($urlValues);
if (strlen($query) > 0) {
return '?' . $query;
}
return '';
} | php | public static function getCurrentQueryStringWithParametersModified($params)
{
$urlValues = self::getArrayFromCurrentQueryString();
foreach ($params as $key => $value) {
$urlValues[$key] = $value;
}
$query = self::getQueryStringFromParameters($urlValues);
if (strlen($query) > 0) {
return '?' . $query;
}
return '';
} | [
"public",
"static",
"function",
"getCurrentQueryStringWithParametersModified",
"(",
"$",
"params",
")",
"{",
"$",
"urlValues",
"=",
"self",
"::",
"getArrayFromCurrentQueryString",
"(",
")",
";",
"foreach",
"(",
"$",
"params",
"as",
"$",
"key",
"=>",
"$",
"value"... | Modifies the current query string with the supplied parameters and returns
the result. Parameters in the current URL will be overwritten with values
in `$params` and parameters absent from the current URL but present in `$params`
will be added to the result.
@param array $params set of parameters to modify/add in the current URL
eg, `array('param3' => 'value3')`
@return string eg, `"?param2=value2¶m3=value3"`
@api | [
"Modifies",
"the",
"current",
"query",
"string",
"with",
"the",
"supplied",
"parameters",
"and",
"returns",
"the",
"result",
".",
"Parameters",
"in",
"the",
"current",
"URL",
"will",
"be",
"overwritten",
"with",
"values",
"in",
"$params",
"and",
"parameters",
... | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Url.php#L406-L417 | train | Returns the current query string with parameters modified | [
30522,
2270,
10763,
3853,
2131,
10841,
14343,
3372,
4226,
24769,
18886,
3070,
24415,
28689,
22828,
25855,
4305,
10451,
1006,
1002,
11498,
5244,
1007,
1063,
1002,
24471,
22144,
7630,
2229,
1027,
2969,
1024,
1024,
2131,
2906,
9447,
19699,
5358,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Http/Kernel.php | Kernel.renderException | protected function renderException($request, Exception $e)
{
return $this->app[ExceptionHandler::class]->render($request, $e);
} | php | protected function renderException($request, Exception $e)
{
return $this->app[ExceptionHandler::class]->render($request, $e);
} | [
"protected",
"function",
"renderException",
"(",
"$",
"request",
",",
"Exception",
"$",
"e",
")",
"{",
"return",
"$",
"this",
"->",
"app",
"[",
"ExceptionHandler",
"::",
"class",
"]",
"->",
"render",
"(",
"$",
"request",
",",
"$",
"e",
")",
";",
"}"
] | Render the exception to a response.
@param \Illuminate\Http\Request $request
@param \Exception $e
@return \Symfony\Component\HttpFoundation\Response | [
"Render",
"the",
"exception",
"to",
"a",
"response",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Foundation/Http/Kernel.php#L324-L327 | train | Render exception into a string | [
30522,
5123,
3853,
17552,
10288,
24422,
1006,
1002,
5227,
1010,
6453,
1002,
1041,
1007,
1063,
2709,
1002,
2023,
1011,
1028,
10439,
1031,
6453,
11774,
3917,
1024,
1024,
2465,
1033,
1011,
1028,
17552,
1006,
1002,
5227,
1010,
1002,
1041,
1007,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Database/Console/Migrations/RefreshCommand.php | RefreshCommand.runReset | protected function runReset($database, $path)
{
$this->call('migrate:reset', array_filter([
'--database' => $database,
'--path' => $path,
'--realpath' => $this->input->getOption('realpath'),
'--force' => true,
]));
} | php | protected function runReset($database, $path)
{
$this->call('migrate:reset', array_filter([
'--database' => $database,
'--path' => $path,
'--realpath' => $this->input->getOption('realpath'),
'--force' => true,
]));
} | [
"protected",
"function",
"runReset",
"(",
"$",
"database",
",",
"$",
"path",
")",
"{",
"$",
"this",
"->",
"call",
"(",
"'migrate:reset'",
",",
"array_filter",
"(",
"[",
"'--database'",
"=>",
"$",
"database",
",",
"'--path'",
"=>",
"$",
"path",
",",
"'--r... | Run the reset command.
@param string $database
@param string $path
@return void | [
"Run",
"the",
"reset",
"command",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Console/Migrations/RefreshCommand.php#L97-L105 | train | Runs the reset command on the next reset process. | [
30522,
5123,
3853,
2448,
6072,
3388,
1006,
1002,
7809,
1010,
1002,
4130,
1007,
1063,
1002,
2023,
1011,
1028,
2655,
1006,
1005,
22806,
1024,
25141,
1005,
1010,
9140,
1035,
11307,
1006,
1031,
1005,
1011,
1011,
7809,
1005,
1027,
1028,
1002,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getgrav/grav | system/src/Grav/Common/GPM/Remote/GravCore.php | GravCore.getChangelog | public function getChangelog($diff = null)
{
if (!$diff) {
return $this->data['changelog'];
}
$diffLog = [];
foreach ((array)$this->data['changelog'] as $version => $changelog) {
preg_match("/[\w\-\.]+/", $version, $cleanVersion);
if (!$cleanVersion || version_compare($diff, $cleanVersion[0], '>=')) {
continue;
}
$diffLog[$version] = $changelog;
}
return $diffLog;
} | php | public function getChangelog($diff = null)
{
if (!$diff) {
return $this->data['changelog'];
}
$diffLog = [];
foreach ((array)$this->data['changelog'] as $version => $changelog) {
preg_match("/[\w\-\.]+/", $version, $cleanVersion);
if (!$cleanVersion || version_compare($diff, $cleanVersion[0], '>=')) {
continue;
}
$diffLog[$version] = $changelog;
}
return $diffLog;
} | [
"public",
"function",
"getChangelog",
"(",
"$",
"diff",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"diff",
")",
"{",
"return",
"$",
"this",
"->",
"data",
"[",
"'changelog'",
"]",
";",
"}",
"$",
"diffLog",
"=",
"[",
"]",
";",
"foreach",
"(",
"(",... | Returns the changelog list for each version of Grav
@param string $diff the version number to start the diff from
@return array changelog list for each version | [
"Returns",
"the",
"changelog",
"list",
"for",
"each",
"version",
"of",
"Grav"
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/GPM/Remote/GravCore.php#L68-L86 | train | Get Changelog of the version | [
30522,
2270,
3853,
2131,
22305,
18349,
2290,
1006,
1002,
4487,
4246,
1027,
19701,
1007,
1063,
2065,
1006,
999,
1002,
4487,
4246,
1007,
1063,
2709,
1002,
2023,
1011,
1028,
2951,
1031,
1005,
2689,
21197,
1005,
1033,
1025,
1065,
1002,
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/Foundation/Bootstrap/LoadConfiguration.php | LoadConfiguration.loadConfigurationFiles | protected function loadConfigurationFiles(Application $app, RepositoryContract $repository)
{
$files = $this->getConfigurationFiles($app);
if (! isset($files['app'])) {
throw new Exception('Unable to load the "app" configuration file.');
}
foreach ($files as $key => $path) {
$repository->set($key, require $path);
}
} | php | protected function loadConfigurationFiles(Application $app, RepositoryContract $repository)
{
$files = $this->getConfigurationFiles($app);
if (! isset($files['app'])) {
throw new Exception('Unable to load the "app" configuration file.');
}
foreach ($files as $key => $path) {
$repository->set($key, require $path);
}
} | [
"protected",
"function",
"loadConfigurationFiles",
"(",
"Application",
"$",
"app",
",",
"RepositoryContract",
"$",
"repository",
")",
"{",
"$",
"files",
"=",
"$",
"this",
"->",
"getConfigurationFiles",
"(",
"$",
"app",
")",
";",
"if",
"(",
"!",
"isset",
"(",... | Load the configuration items from all of the files.
@param \Illuminate\Contracts\Foundation\Application $app
@param \Illuminate\Contracts\Config\Repository $repository
@return void
@throws \Exception | [
"Load",
"the",
"configuration",
"items",
"from",
"all",
"of",
"the",
"files",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php#L63-L74 | train | Load the configuration files for the application | [
30522,
5123,
3853,
7170,
8663,
8873,
27390,
3370,
8873,
4244,
1006,
4646,
1002,
10439,
1010,
22409,
8663,
6494,
6593,
1002,
22409,
1007,
1063,
1002,
6764,
1027,
1002,
2023,
1011,
1028,
2131,
8663,
8873,
27390,
3370,
8873,
4244,
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... |
matomo-org/matomo | plugins/SitesManager/Model.php | Model.getSitesFromGroup | public function getSitesFromGroup($group)
{
$db = $this->getDb();
$sites = $db->fetchAll("SELECT * FROM " . $this->table . "
WHERE `group` = ?", $group);
return $sites;
} | php | public function getSitesFromGroup($group)
{
$db = $this->getDb();
$sites = $db->fetchAll("SELECT * FROM " . $this->table . "
WHERE `group` = ?", $group);
return $sites;
} | [
"public",
"function",
"getSitesFromGroup",
"(",
"$",
"group",
")",
"{",
"$",
"db",
"=",
"$",
"this",
"->",
"getDb",
"(",
")",
";",
"$",
"sites",
"=",
"$",
"db",
"->",
"fetchAll",
"(",
"\"SELECT * FROM \"",
".",
"$",
"this",
"->",
"table",
".",
"\"\n ... | Returns all websites belonging to the specified group
@param string $group Group name
@return array of sites | [
"Returns",
"all",
"websites",
"belonging",
"to",
"the",
"specified",
"group"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/SitesManager/Model.php#L42-L49 | train | Get all the sites from a group | [
30522,
2270,
3853,
4152,
7616,
19699,
5358,
17058,
1006,
1002,
2177,
1007,
1063,
1002,
16962,
1027,
1002,
2023,
1011,
1028,
2131,
18939,
1006,
1007,
1025,
1002,
4573,
1027,
1002,
16962,
1011,
1028,
18584,
8095,
1006,
1000,
7276,
1008,
2013,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/MultiSites/API.php | API.getAll | public function getAll($period, $date, $segment = false, $_restrictSitesToLogin = false, $enhanced = false, $pattern = false, $showColumns = array())
{
Piwik::checkUserHasSomeViewAccess();
$sites = $this->getSitesIdFromPattern($pattern, $_restrictSitesToLogin);
if (!empty($showColumns) && !is_array($showColumns)) {
$showColumns = explode(',', $showColumns);
}
if (empty($sites)) {
return new DataTable();
}
return $this->buildDataTable(
$sites,
$period,
$date,
$segment,
$_restrictSitesToLogin,
$enhanced,
$multipleWebsitesRequested = true,
$showColumns
);
} | php | public function getAll($period, $date, $segment = false, $_restrictSitesToLogin = false, $enhanced = false, $pattern = false, $showColumns = array())
{
Piwik::checkUserHasSomeViewAccess();
$sites = $this->getSitesIdFromPattern($pattern, $_restrictSitesToLogin);
if (!empty($showColumns) && !is_array($showColumns)) {
$showColumns = explode(',', $showColumns);
}
if (empty($sites)) {
return new DataTable();
}
return $this->buildDataTable(
$sites,
$period,
$date,
$segment,
$_restrictSitesToLogin,
$enhanced,
$multipleWebsitesRequested = true,
$showColumns
);
} | [
"public",
"function",
"getAll",
"(",
"$",
"period",
",",
"$",
"date",
",",
"$",
"segment",
"=",
"false",
",",
"$",
"_restrictSitesToLogin",
"=",
"false",
",",
"$",
"enhanced",
"=",
"false",
",",
"$",
"pattern",
"=",
"false",
",",
"$",
"showColumns",
"=... | Returns a report displaying the total visits, actions and revenue, as
well as the evolution of these values, of all existing sites over a
specified period of time.
If the specified period is not a 'range', this function will calculcate
evolution metrics. Evolution metrics are metrics that display the
percent increase/decrease of another metric since the last period.
This function will merge the result of the archive query so each
row in the result DataTable will correspond to the metrics of a single
site. If a date range is specified, the result will be a
DataTable\Map, but it will still be merged.
@param string $period The period type to get data for.
@param string $date The date(s) to get data for.
@param bool|string $segment The segments to get data for.
@param bool|string $_restrictSitesToLogin Hack used to enforce we restrict the returned data to the specified username
Only used when a scheduled task is running
@param bool|string $enhanced When true, return additional goal & ecommerce metrics
@param bool|string $pattern If specified, only the website which names (or site ID) match the pattern will be returned using SitesManager.getPatternMatchSites
@param array $showColumns If specified, only the requested columns will be fetched
@return DataTable | [
"Returns",
"a",
"report",
"displaying",
"the",
"total",
"visits",
"actions",
"and",
"revenue",
"as",
"well",
"as",
"the",
"evolution",
"of",
"these",
"values",
"of",
"all",
"existing",
"sites",
"over",
"a",
"specified",
"period",
"of",
"time",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/MultiSites/API.php#L88-L112 | train | Get all the sites in the site list | [
30522,
2270,
3853,
2131,
8095,
1006,
1002,
2558,
1010,
1002,
3058,
1010,
1002,
6903,
1027,
6270,
1010,
1002,
1035,
21573,
28032,
4355,
12898,
11528,
1027,
6270,
1010,
1002,
9412,
1027,
6270,
1010,
1002,
5418,
1027,
6270,
1010,
1002,
2265,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Mailable.php | Mailable.later | public function later($delay, Queue $queue)
{
$connection = property_exists($this, 'connection') ? $this->connection : null;
$queueName = property_exists($this, 'queue') ? $this->queue : null;
return $queue->connection($connection)->laterOn(
$queueName ?: null, $delay, new SendQueuedMailable($this)
);
} | php | public function later($delay, Queue $queue)
{
$connection = property_exists($this, 'connection') ? $this->connection : null;
$queueName = property_exists($this, 'queue') ? $this->queue : null;
return $queue->connection($connection)->laterOn(
$queueName ?: null, $delay, new SendQueuedMailable($this)
);
} | [
"public",
"function",
"later",
"(",
"$",
"delay",
",",
"Queue",
"$",
"queue",
")",
"{",
"$",
"connection",
"=",
"property_exists",
"(",
"$",
"this",
",",
"'connection'",
")",
"?",
"$",
"this",
"->",
"connection",
":",
"null",
";",
"$",
"queueName",
"="... | Deliver the queued message after the given delay.
@param \DateTimeInterface|\DateInterval|int $delay
@param \Illuminate\Contracts\Queue\Factory $queue
@return mixed | [
"Deliver",
"the",
"queued",
"message",
"after",
"the",
"given",
"delay",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Mail/Mailable.php#L191-L200 | train | This method will be called by the queue to send the message to the next frame in the queue | [
30522,
2270,
3853,
2101,
1006,
1002,
8536,
1010,
24240,
1002,
24240,
1007,
1063,
1002,
4434,
1027,
3200,
1035,
6526,
1006,
1002,
2023,
1010,
1005,
4434,
1005,
1007,
1029,
1002,
2023,
1011,
1028,
4434,
1024,
19701,
1025,
1002,
24240,
18442,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Console/Application.php | Application.findAlternatives | private function findAlternatives($name, $collection)
{
$threshold = 1e3;
$alternatives = [];
$collectionParts = [];
foreach ($collection as $item) {
$collectionParts[$item] = explode(':', $item);
}
foreach (explode(':', $name) as $i => $subname) {
foreach ($collectionParts as $collectionName => $parts) {
$exists = isset($alternatives[$collectionName]);
if (!isset($parts[$i]) && $exists) {
$alternatives[$collectionName] += $threshold;
continue;
} elseif (!isset($parts[$i])) {
continue;
}
$lev = levenshtein($subname, $parts[$i]);
if ($lev <= \strlen($subname) / 3 || '' !== $subname && false !== strpos($parts[$i], $subname)) {
$alternatives[$collectionName] = $exists ? $alternatives[$collectionName] + $lev : $lev;
} elseif ($exists) {
$alternatives[$collectionName] += $threshold;
}
}
}
foreach ($collection as $item) {
$lev = levenshtein($name, $item);
if ($lev <= \strlen($name) / 3 || false !== strpos($item, $name)) {
$alternatives[$item] = isset($alternatives[$item]) ? $alternatives[$item] - $lev : $lev;
}
}
$alternatives = array_filter($alternatives, function ($lev) use ($threshold) { return $lev < 2 * $threshold; });
ksort($alternatives, SORT_NATURAL | SORT_FLAG_CASE);
return array_keys($alternatives);
} | php | private function findAlternatives($name, $collection)
{
$threshold = 1e3;
$alternatives = [];
$collectionParts = [];
foreach ($collection as $item) {
$collectionParts[$item] = explode(':', $item);
}
foreach (explode(':', $name) as $i => $subname) {
foreach ($collectionParts as $collectionName => $parts) {
$exists = isset($alternatives[$collectionName]);
if (!isset($parts[$i]) && $exists) {
$alternatives[$collectionName] += $threshold;
continue;
} elseif (!isset($parts[$i])) {
continue;
}
$lev = levenshtein($subname, $parts[$i]);
if ($lev <= \strlen($subname) / 3 || '' !== $subname && false !== strpos($parts[$i], $subname)) {
$alternatives[$collectionName] = $exists ? $alternatives[$collectionName] + $lev : $lev;
} elseif ($exists) {
$alternatives[$collectionName] += $threshold;
}
}
}
foreach ($collection as $item) {
$lev = levenshtein($name, $item);
if ($lev <= \strlen($name) / 3 || false !== strpos($item, $name)) {
$alternatives[$item] = isset($alternatives[$item]) ? $alternatives[$item] - $lev : $lev;
}
}
$alternatives = array_filter($alternatives, function ($lev) use ($threshold) { return $lev < 2 * $threshold; });
ksort($alternatives, SORT_NATURAL | SORT_FLAG_CASE);
return array_keys($alternatives);
} | [
"private",
"function",
"findAlternatives",
"(",
"$",
"name",
",",
"$",
"collection",
")",
"{",
"$",
"threshold",
"=",
"1e3",
";",
"$",
"alternatives",
"=",
"[",
"]",
";",
"$",
"collectionParts",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"collection",
"a... | Finds alternative of $name among $collection,
if nothing is found in $collection, try in $abbrevs.
@param string $name The string
@param iterable $collection The collection
@return string[] A sorted array of similar string | [
"Finds",
"alternative",
"of",
"$name",
"among",
"$collection",
"if",
"nothing",
"is",
"found",
"in",
"$collection",
"try",
"in",
"$abbrevs",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Console/Application.php#L1048-L1088 | train | Find alternatives of the name | [
30522,
2797,
3853,
2424,
2389,
16451,
8082,
2015,
1006,
1002,
2171,
1010,
1002,
3074,
1007,
1063,
1002,
11207,
1027,
1015,
2063,
2509,
1025,
1002,
15955,
1027,
1031,
1033,
1025,
1002,
3074,
26950,
1027,
1031,
1033,
1025,
18921,
6776,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Security/Core/Role/SwitchUserRole.php | SwitchUserRole.getSource | public function getSource()
{
if (!$this->deprecationTriggered && (\func_num_args() < 1 || func_get_arg(0))) {
@trigger_error(sprintf('The "%s" class is deprecated since version 4.3 and will be removed in 5.0. Use strings as roles instead.', __CLASS__), E_USER_DEPRECATED);
$this->deprecationTriggered = true;
}
return $this->source;
} | php | public function getSource()
{
if (!$this->deprecationTriggered && (\func_num_args() < 1 || func_get_arg(0))) {
@trigger_error(sprintf('The "%s" class is deprecated since version 4.3 and will be removed in 5.0. Use strings as roles instead.', __CLASS__), E_USER_DEPRECATED);
$this->deprecationTriggered = true;
}
return $this->source;
} | [
"public",
"function",
"getSource",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"deprecationTriggered",
"&&",
"(",
"\\",
"func_num_args",
"(",
")",
"<",
"1",
"||",
"func_get_arg",
"(",
"0",
")",
")",
")",
"{",
"@",
"trigger_error",
"(",
"sprintf",... | Returns the original Token.
@return TokenInterface The original TokenInterface instance | [
"Returns",
"the",
"original",
"Token",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Security/Core/Role/SwitchUserRole.php#L51-L60 | train | Returns the source of the role | [
30522,
2270,
3853,
4152,
8162,
3401,
1006,
1007,
1063,
2065,
1006,
999,
1002,
2023,
1011,
1028,
2139,
28139,
10719,
18886,
13327,
2098,
1004,
1004,
1006,
1032,
4569,
2278,
1035,
16371,
2213,
1035,
12098,
5620,
1006,
1007,
1026,
1015,
1064,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/ReportRenderer/Csv.php | Csv.sendToBrowserDownload | public function sendToBrowserDownload($filename)
{
ReportRenderer::sendToBrowser(
$filename,
ReportRenderer::CSV_FORMAT,
"text/" . ReportRenderer::CSV_FORMAT,
$this->getRenderedReport()
);
} | php | public function sendToBrowserDownload($filename)
{
ReportRenderer::sendToBrowser(
$filename,
ReportRenderer::CSV_FORMAT,
"text/" . ReportRenderer::CSV_FORMAT,
$this->getRenderedReport()
);
} | [
"public",
"function",
"sendToBrowserDownload",
"(",
"$",
"filename",
")",
"{",
"ReportRenderer",
"::",
"sendToBrowser",
"(",
"$",
"filename",
",",
"ReportRenderer",
"::",
"CSV_FORMAT",
",",
"\"text/\"",
".",
"ReportRenderer",
"::",
"CSV_FORMAT",
",",
"$",
"this",
... | Send rendering to browser with a 'download file' prompt
@param string $filename without path & without format extension | [
"Send",
"rendering",
"to",
"browser",
"with",
"a",
"download",
"file",
"prompt"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/ReportRenderer/Csv.php#L57-L65 | train | Sends the report to browser download | [
30522,
2270,
3853,
4604,
3406,
12618,
9333,
2121,
7698,
11066,
1006,
1002,
5371,
18442,
1007,
1063,
3189,
7389,
4063,
2121,
1024,
1024,
4604,
3406,
12618,
9333,
2121,
1006,
1002,
5371,
18442,
1010,
3189,
7389,
4063,
2121,
1024,
1024,
20116,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/HTML/QuickForm2/Renderer/Default.php | HTML_QuickForm2_Renderer_Default.outputError | public function outputError($elTpl, $error)
{
if ($error && !$this->options['group_errors']) {
$elTpl = str_replace(array('<qf:error>', '</qf:error>', '{error}'),
array('', '', $error), $elTpl);
} else {
if ($error && $this->options['group_errors']) {
$this->errors[] = $error;
}
$elTpl = preg_replace('!<qf:error>.*</qf:error>!isU', '', $elTpl);
}
return $elTpl;
} | php | public function outputError($elTpl, $error)
{
if ($error && !$this->options['group_errors']) {
$elTpl = str_replace(array('<qf:error>', '</qf:error>', '{error}'),
array('', '', $error), $elTpl);
} else {
if ($error && $this->options['group_errors']) {
$this->errors[] = $error;
}
$elTpl = preg_replace('!<qf:error>.*</qf:error>!isU', '', $elTpl);
}
return $elTpl;
} | [
"public",
"function",
"outputError",
"(",
"$",
"elTpl",
",",
"$",
"error",
")",
"{",
"if",
"(",
"$",
"error",
"&&",
"!",
"$",
"this",
"->",
"options",
"[",
"'group_errors'",
"]",
")",
"{",
"$",
"elTpl",
"=",
"str_replace",
"(",
"array",
"(",
"'<qf:er... | Outputs element error, removes empty error blocks
@param string Element template
@param string Validation error for the element
@return string Template with error substitutions done | [
"Outputs",
"element",
"error",
"removes",
"empty",
"error",
"blocks"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/HTML/QuickForm2/Renderer/Default.php#L553-L565 | train | Output error message | [
30522,
2270,
3853,
6434,
2121,
29165,
1006,
1002,
3449,
25856,
2140,
1010,
1002,
7561,
1007,
1063,
2065,
1006,
1002,
7561,
1004,
1004,
999,
1002,
2023,
1011,
1028,
7047,
1031,
1005,
2177,
1035,
10697,
1005,
1033,
1007,
1063,
1002,
3449,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/system/traits/ViewMaker.php | ViewMaker.makePartial | public function makePartial($partial, $params = [], $throwException = true)
{
$notRealPath = realpath($partial) === false || is_dir($partial) === true;
if (!File::isPathSymbol($partial) && $notRealPath) {
$folder = strpos($partial, '/') !== false ? dirname($partial) . '/' : '';
$partial = $folder . '_' . strtolower(basename($partial)).'.htm';
}
$partialPath = $this->getViewPath($partial);
if (!File::exists($partialPath)) {
if ($throwException) {
throw new SystemException(Lang::get('backend::lang.partial.not_found_name', ['name' => $partialPath]));
}
return false;
}
return $this->makeFileContents($partialPath, $params);
} | php | public function makePartial($partial, $params = [], $throwException = true)
{
$notRealPath = realpath($partial) === false || is_dir($partial) === true;
if (!File::isPathSymbol($partial) && $notRealPath) {
$folder = strpos($partial, '/') !== false ? dirname($partial) . '/' : '';
$partial = $folder . '_' . strtolower(basename($partial)).'.htm';
}
$partialPath = $this->getViewPath($partial);
if (!File::exists($partialPath)) {
if ($throwException) {
throw new SystemException(Lang::get('backend::lang.partial.not_found_name', ['name' => $partialPath]));
}
return false;
}
return $this->makeFileContents($partialPath, $params);
} | [
"public",
"function",
"makePartial",
"(",
"$",
"partial",
",",
"$",
"params",
"=",
"[",
"]",
",",
"$",
"throwException",
"=",
"true",
")",
"{",
"$",
"notRealPath",
"=",
"realpath",
"(",
"$",
"partial",
")",
"===",
"false",
"||",
"is_dir",
"(",
"$",
"... | Render a partial file contents located in the views folder.
@param string $partial The view to load.
@param array $params Parameter variables to pass to the view.
@param bool $throwException Throw an exception if the partial is not found.
@return mixed Partial contents or false if not throwing an exception. | [
"Render",
"a",
"partial",
"file",
"contents",
"located",
"in",
"the",
"views",
"folder",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/traits/ViewMaker.php#L79-L98 | train | Make partial file | [
30522,
2270,
3853,
2191,
19362,
20925,
1006,
1002,
7704,
1010,
1002,
11498,
5244,
1027,
1031,
1033,
1010,
1002,
5466,
10288,
24422,
1027,
2995,
1007,
1063,
1002,
10289,
2389,
15069,
1027,
2613,
15069,
1006,
1002,
7704,
1007,
1027,
1027,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/API/DataTablePostProcessor.php | DataTablePostProcessor.getLabelFromRequest | public static function getLabelFromRequest($request)
{
$label = Common::getRequestVar('label', array(), 'array', $request);
if (empty($label)) {
$label = Common::getRequestVar('label', '', 'string', $request);
if (!empty($label)) {
$label = array($label);
}
}
$label = self::unsanitizeLabelParameter($label);
return $label;
} | php | public static function getLabelFromRequest($request)
{
$label = Common::getRequestVar('label', array(), 'array', $request);
if (empty($label)) {
$label = Common::getRequestVar('label', '', 'string', $request);
if (!empty($label)) {
$label = array($label);
}
}
$label = self::unsanitizeLabelParameter($label);
return $label;
} | [
"public",
"static",
"function",
"getLabelFromRequest",
"(",
"$",
"request",
")",
"{",
"$",
"label",
"=",
"Common",
"::",
"getRequestVar",
"(",
"'label'",
",",
"array",
"(",
")",
",",
"'array'",
",",
"$",
"request",
")",
";",
"if",
"(",
"empty",
"(",
"$... | Returns the value for the label query parameter which can be either a string
(ie, label=...) or array (ie, label[]=...).
@param array $request
@return array | [
"Returns",
"the",
"value",
"for",
"the",
"label",
"query",
"parameter",
"which",
"can",
"be",
"either",
"a",
"string",
"(",
"ie",
"label",
"=",
"...",
")",
"or",
"array",
"(",
"ie",
"label",
"[]",
"=",
"...",
")",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/API/DataTablePostProcessor.php#L384-L396 | train | Returns the label of the language | [
30522,
2270,
10763,
3853,
2131,
20470,
2884,
19699,
5358,
2890,
15500,
1006,
1002,
5227,
1007,
1063,
1002,
3830,
1027,
2691,
1024,
1024,
2131,
2890,
15500,
10755,
1006,
1005,
3830,
1005,
1010,
9140,
1006,
1007,
1010,
1005,
9140,
1005,
1010,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/EventDispatcher/EventDispatcher.php | EventDispatcher.hasListeners | public function hasListeners($eventName = null)
{
if (null !== $eventName) {
return !empty($this->listeners[$eventName]);
}
foreach ($this->listeners as $eventListeners) {
if ($eventListeners) {
return true;
}
}
return false;
} | php | public function hasListeners($eventName = null)
{
if (null !== $eventName) {
return !empty($this->listeners[$eventName]);
}
foreach ($this->listeners as $eventListeners) {
if ($eventListeners) {
return true;
}
}
return false;
} | [
"public",
"function",
"hasListeners",
"(",
"$",
"eventName",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"eventName",
")",
"{",
"return",
"!",
"empty",
"(",
"$",
"this",
"->",
"listeners",
"[",
"$",
"eventName",
"]",
")",
";",
"}",
"foreach... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/EventDispatcher/EventDispatcher.php#L135-L148 | train | Has listeners? | [
30522,
2270,
3853,
2038,
9863,
24454,
2015,
1006,
1002,
2724,
18442,
1027,
19701,
1007,
1063,
2065,
1006,
19701,
999,
1027,
1027,
1002,
2724,
18442,
1007,
1063,
2709,
999,
4064,
1006,
1002,
2023,
1011,
1028,
13810,
1031,
1002,
2724,
18442,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
opencart/opencart | upload/admin/controller/extension/payment/pp_express.php | ControllerExtensionPaymentPPExpress.void | public function void() {
$json = array();
$this->load->language('extension/payment/pp_express_order');
if (isset($this->request->get['order_id'])) {
$order_id = $this->request->get['order_id'];
} else {
$order_id = 0;
}
$this->load->model('extension/payment/pp_express');
$paypal_info = $this->model_extension_payment_pp_express->getOrder($order_id);
if ($paypal_info) {
$request = array(
'METHOD' => 'DoVoid',
'AUTHORIZATIONID' => $paypal_info['authorization_id'],
'MSGSUBID' => uniqid(mt_rand(), true)
);
$response = $this->model_extension_payment_pp_express->call($request);
if (isset($response['ACK']) && ($response['ACK'] != 'Failure') && ($response['ACK'] != 'FailureWithWarning')) {
$transaction = array(
'paypal_order_id' => $paypal_info['paypal_order_id'],
'transaction_id' => '',
'parent_id' => $paypal_info['authorization_id'],
'note' => '',
'msgsubid' => '',
'receipt_id' => '',
'payment_type' => 'void',
'payment_status' => 'Void',
'pending_reason' => '',
'transaction_entity' => 'auth',
'amount' => '',
'debug_data' => json_encode($response)
);
$this->model_extension_payment_pp_express->addTransaction($transaction);
$this->model_extension_payment_pp_express->editPayPalOrderStatus($order_id, 'Complete');
$json['capture_status'] = 'Complete';
$json['success'] = $this->language->get('text_success');
} else {
$json['error'] = (isset($response['L_SHORTMESSAGE0']) ? $response['L_SHORTMESSAGE0'] : $this->language->get('error_transaction'));
}
} else {
$json['error'] = $this->language->get('error_not_found');
}
$this->response->addHeader('Content-Type: application/json');
$this->response->setOutput(json_encode($json));
} | php | public function void() {
$json = array();
$this->load->language('extension/payment/pp_express_order');
if (isset($this->request->get['order_id'])) {
$order_id = $this->request->get['order_id'];
} else {
$order_id = 0;
}
$this->load->model('extension/payment/pp_express');
$paypal_info = $this->model_extension_payment_pp_express->getOrder($order_id);
if ($paypal_info) {
$request = array(
'METHOD' => 'DoVoid',
'AUTHORIZATIONID' => $paypal_info['authorization_id'],
'MSGSUBID' => uniqid(mt_rand(), true)
);
$response = $this->model_extension_payment_pp_express->call($request);
if (isset($response['ACK']) && ($response['ACK'] != 'Failure') && ($response['ACK'] != 'FailureWithWarning')) {
$transaction = array(
'paypal_order_id' => $paypal_info['paypal_order_id'],
'transaction_id' => '',
'parent_id' => $paypal_info['authorization_id'],
'note' => '',
'msgsubid' => '',
'receipt_id' => '',
'payment_type' => 'void',
'payment_status' => 'Void',
'pending_reason' => '',
'transaction_entity' => 'auth',
'amount' => '',
'debug_data' => json_encode($response)
);
$this->model_extension_payment_pp_express->addTransaction($transaction);
$this->model_extension_payment_pp_express->editPayPalOrderStatus($order_id, 'Complete');
$json['capture_status'] = 'Complete';
$json['success'] = $this->language->get('text_success');
} else {
$json['error'] = (isset($response['L_SHORTMESSAGE0']) ? $response['L_SHORTMESSAGE0'] : $this->language->get('error_transaction'));
}
} else {
$json['error'] = $this->language->get('error_not_found');
}
$this->response->addHeader('Content-Type: application/json');
$this->response->setOutput(json_encode($json));
} | [
"public",
"function",
"void",
"(",
")",
"{",
"$",
"json",
"=",
"array",
"(",
")",
";",
"$",
"this",
"->",
"load",
"->",
"language",
"(",
"'extension/payment/pp_express_order'",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"request",
"->",
"get... | used to void an authorised payment | [
"used",
"to",
"void",
"an",
"authorised",
"payment"
] | e7933b56ba05aafb3655c6b490c9733cd18b5c69 | https://github.com/opencart/opencart/blob/e7933b56ba05aafb3655c6b490c9733cd18b5c69/upload/admin/controller/extension/payment/pp_express.php#L770-L826 | train | Void an order | [
30522,
2270,
3853,
11675,
1006,
1007,
1063,
1002,
1046,
3385,
1027,
9140,
1006,
1007,
1025,
1002,
2023,
1011,
1028,
7170,
1011,
1028,
2653,
1006,
1005,
5331,
1013,
7909,
1013,
4903,
1035,
4671,
1035,
2344,
1005,
1007,
1025,
2065,
1006,
26... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Dashboard/API.php | API.getUserDashboards | private function getUserDashboards($userLogin)
{
$userDashboards = $this->dashboard->getAllDashboards($userLogin);
$dashboards = array();
foreach ($userDashboards as $userDashboard) {
$widgets = $this->getVisibleWidgetsWithinDashboard($userDashboard);
$dashboards[] = $this->buildDashboard($userDashboard, $widgets);
}
return $dashboards;
} | php | private function getUserDashboards($userLogin)
{
$userDashboards = $this->dashboard->getAllDashboards($userLogin);
$dashboards = array();
foreach ($userDashboards as $userDashboard) {
$widgets = $this->getVisibleWidgetsWithinDashboard($userDashboard);
$dashboards[] = $this->buildDashboard($userDashboard, $widgets);
}
return $dashboards;
} | [
"private",
"function",
"getUserDashboards",
"(",
"$",
"userLogin",
")",
"{",
"$",
"userDashboards",
"=",
"$",
"this",
"->",
"dashboard",
"->",
"getAllDashboards",
"(",
"$",
"userLogin",
")",
";",
"$",
"dashboards",
"=",
"array",
"(",
")",
";",
"foreach",
"... | Get all dashboards which a user has created.
@param string $userLogin login of the user
@return \array[] | [
"Get",
"all",
"dashboards",
"which",
"a",
"user",
"has",
"created",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Dashboard/API.php#L183-L195 | train | Get all dashboards for a user | [
30522,
2797,
3853,
2131,
20330,
8883,
2232,
15271,
1006,
1002,
5310,
21197,
2378,
1007,
1063,
1002,
5310,
8883,
2232,
15271,
1027,
1002,
2023,
1011,
1028,
24923,
1011,
1028,
2131,
8095,
8883,
2232,
15271,
1006,
1002,
5310,
21197,
2378,
1007... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/View/Factory.php | Factory.first | public function first(array $views, $data = [], $mergeData = [])
{
$view = Arr::first($views, function ($view) {
return $this->exists($view);
});
if (! $view) {
throw new InvalidArgumentException('None of the views in the given array exist.');
}
return $this->make($view, $data, $mergeData);
} | php | public function first(array $views, $data = [], $mergeData = [])
{
$view = Arr::first($views, function ($view) {
return $this->exists($view);
});
if (! $view) {
throw new InvalidArgumentException('None of the views in the given array exist.');
}
return $this->make($view, $data, $mergeData);
} | [
"public",
"function",
"first",
"(",
"array",
"$",
"views",
",",
"$",
"data",
"=",
"[",
"]",
",",
"$",
"mergeData",
"=",
"[",
"]",
")",
"{",
"$",
"view",
"=",
"Arr",
"::",
"first",
"(",
"$",
"views",
",",
"function",
"(",
"$",
"view",
")",
"{",
... | Get the first view that actually exists from the given list.
@param array $views
@param \Illuminate\Contracts\Support\Arrayable|array $data
@param array $mergeData
@return \Illuminate\Contracts\View\View
@throws \InvalidArgumentException | [
"Get",
"the",
"first",
"view",
"that",
"actually",
"exists",
"from",
"the",
"given",
"list",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/View/Factory.php#L153-L164 | train | Get the first view in the given array | [
30522,
2270,
3853,
2034,
1006,
9140,
1002,
5328,
1010,
1002,
2951,
1027,
1031,
1033,
1010,
1002,
5314,
6790,
1027,
1031,
1033,
1007,
1063,
1002,
3193,
1027,
12098,
2099,
1024,
1024,
2034,
1006,
1002,
5328,
1010,
3853,
1006,
1002,
3193,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/Login/SessionInitializer.php | SessionInitializer.getAuthCookie | protected function getAuthCookie($rememberMe)
{
$authCookieExpiry = $rememberMe ? time() + $this->authCookieValidTime : 0;
$cookie = new Cookie($this->authCookieName, $authCookieExpiry, $this->authCookiePath);
return $cookie;
} | php | protected function getAuthCookie($rememberMe)
{
$authCookieExpiry = $rememberMe ? time() + $this->authCookieValidTime : 0;
$cookie = new Cookie($this->authCookieName, $authCookieExpiry, $this->authCookiePath);
return $cookie;
} | [
"protected",
"function",
"getAuthCookie",
"(",
"$",
"rememberMe",
")",
"{",
"$",
"authCookieExpiry",
"=",
"$",
"rememberMe",
"?",
"time",
"(",
")",
"+",
"$",
"this",
"->",
"authCookieValidTime",
":",
"0",
";",
"$",
"cookie",
"=",
"new",
"Cookie",
"(",
"$... | Returns a Cookie instance that manages the browser cookie used to store session
information.
@param bool $rememberMe Whether the authenticated session should be remembered after
the browser is closed or not.
@return Cookie | [
"Returns",
"a",
"Cookie",
"instance",
"that",
"manages",
"the",
"browser",
"cookie",
"used",
"to",
"store",
"session",
"information",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Login/SessionInitializer.php#L153-L158 | train | Get auth cookie | [
30522,
5123,
3853,
2131,
4887,
2705,
3597,
23212,
2063,
1006,
1002,
3342,
4168,
1007,
1063,
1002,
8740,
2705,
3597,
23212,
4402,
2595,
8197,
2854,
1027,
1002,
3342,
4168,
1029,
2051,
1006,
1007,
30524,
1027,
2047,
17387,
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... |
matomo-org/matomo | libs/HTML/QuickForm2/Container/Group.php | HTML_QuickForm2_Container_Group.appendChild | public function appendChild(HTML_QuickForm2_Node $element)
{
if (null !== ($container = $element->getContainer())) {
$container->removeChild($element);
}
// Element can be renamed only after being removed from container
$this->renameChild($element);
$element->setContainer($this);
$this->elements[] = $element;
return $element;
} | php | public function appendChild(HTML_QuickForm2_Node $element)
{
if (null !== ($container = $element->getContainer())) {
$container->removeChild($element);
}
// Element can be renamed only after being removed from container
$this->renameChild($element);
$element->setContainer($this);
$this->elements[] = $element;
return $element;
} | [
"public",
"function",
"appendChild",
"(",
"HTML_QuickForm2_Node",
"$",
"element",
")",
"{",
"if",
"(",
"null",
"!==",
"(",
"$",
"container",
"=",
"$",
"element",
"->",
"getContainer",
"(",
")",
")",
")",
"{",
"$",
"container",
"->",
"removeChild",
"(",
"... | Appends an element to the container
If the element was previously added to the container or to another
container, it is first removed there.
@param HTML_QuickForm2_Node Element to add
@return HTML_QuickForm2_Node Added element
@throws HTML_QuickForm2_InvalidArgumentException | [
"Appends",
"an",
"element",
"to",
"the",
"container"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/HTML/QuickForm2/Container/Group.php#L231-L242 | train | Append a child to the container | [
30522,
2270,
30524,
1028,
6366,
19339,
1006,
1002,
5783,
1007,
1025,
1065,
1013,
1013,
5783,
2064,
2022,
4096,
2069,
2044,
2108,
3718,
2013,
11661,
1002,
2023,
1011,
1028,
14916,
14074,
19339,
1006,
1002,
5783,
1007,
1025,
1002,
5783,
1011,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Validation/Concerns/ValidatesAttributes.php | ValidatesAttributes.guessColumnForQuery | public function guessColumnForQuery($attribute)
{
if (in_array($attribute, Arr::collapse($this->implicitAttributes))
&& ! is_numeric($last = last(explode('.', $attribute)))) {
return $last;
}
return $attribute;
} | php | public function guessColumnForQuery($attribute)
{
if (in_array($attribute, Arr::collapse($this->implicitAttributes))
&& ! is_numeric($last = last(explode('.', $attribute)))) {
return $last;
}
return $attribute;
} | [
"public",
"function",
"guessColumnForQuery",
"(",
"$",
"attribute",
")",
"{",
"if",
"(",
"in_array",
"(",
"$",
"attribute",
",",
"Arr",
"::",
"collapse",
"(",
"$",
"this",
"->",
"implicitAttributes",
")",
")",
"&&",
"!",
"is_numeric",
"(",
"$",
"last",
"... | Guess the database column from the given attribute name.
@param string $attribute
@return string | [
"Guess",
"the",
"database",
"column",
"from",
"the",
"given",
"attribute",
"name",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Validation/Concerns/ValidatesAttributes.php#L817-L825 | train | Guess column for query | [
30522,
2270,
3853,
3984,
25778,
2819,
2078,
29278,
4226,
2854,
1006,
1002,
17961,
1007,
1063,
2065,
1006,
1999,
1035,
9140,
1006,
1002,
17961,
1010,
12098,
2099,
1024,
1024,
7859,
1006,
1002,
2023,
1011,
1028,
24655,
19321,
3089,
8569,
4570... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/PropertyAccess/PropertyPathBuilder.php | PropertyPathBuilder.replaceByProperty | public function replaceByProperty($offset, $name = null)
{
if (!isset($this->elements[$offset])) {
throw new OutOfBoundsException(sprintf('The offset %s is not within the property path', $offset));
}
if (null !== $name) {
$this->elements[$offset] = $name;
}
$this->isIndex[$offset] = false;
} | php | public function replaceByProperty($offset, $name = null)
{
if (!isset($this->elements[$offset])) {
throw new OutOfBoundsException(sprintf('The offset %s is not within the property path', $offset));
}
if (null !== $name) {
$this->elements[$offset] = $name;
}
$this->isIndex[$offset] = false;
} | [
"public",
"function",
"replaceByProperty",
"(",
"$",
"offset",
",",
"$",
"name",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"elements",
"[",
"$",
"offset",
"]",
")",
")",
"{",
"throw",
"new",
"OutOfBoundsException",
"(",
... | Replaces an index element by a property element.
@param int $offset The offset at which to replace
@param string $name The new name of the element. Optional
@throws OutOfBoundsException If the offset is invalid | [
"Replaces",
"an",
"index",
"element",
"by",
"a",
"property",
"element",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/PropertyAccess/PropertyPathBuilder.php#L170-L181 | train | Replace the element at the given offset with the given name | [
30522,
2270,
3853,
5672,
3762,
21572,
4842,
3723,
1006,
1002,
16396,
1010,
1002,
2171,
1027,
19701,
1007,
1063,
2065,
1006,
999,
26354,
3388,
1006,
1002,
2023,
1011,
1028,
3787,
1031,
1002,
16396,
1033,
1007,
1007,
1063,
5466,
2047,
2041,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Protocol/Pop3.php | Zend_Mail_Protocol_Pop3.uniqueid | public function uniqueid($msgno = null)
{
if ($msgno !== null) {
$result = $this->request("UIDL $msgno");
list(, $result) = explode(' ', $result);
return $result;
}
$result = $this->request('UIDL', true);
$result = explode("\n", $result);
$messages = array();
foreach ($result as $line) {
if (!$line) {
continue;
}
list($no, $id) = explode(' ', trim($line), 2);
$messages[(int)$no] = $id;
}
return $messages;
} | php | public function uniqueid($msgno = null)
{
if ($msgno !== null) {
$result = $this->request("UIDL $msgno");
list(, $result) = explode(' ', $result);
return $result;
}
$result = $this->request('UIDL', true);
$result = explode("\n", $result);
$messages = array();
foreach ($result as $line) {
if (!$line) {
continue;
}
list($no, $id) = explode(' ', trim($line), 2);
$messages[(int)$no] = $id;
}
return $messages;
} | [
"public",
"function",
"uniqueid",
"(",
"$",
"msgno",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"msgno",
"!==",
"null",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"request",
"(",
"\"UIDL $msgno\"",
")",
";",
"list",
"(",
",",
"$",
"result",
")",
... | Make UIDL call for getting a uniqueid
@param int|null $msgno number of message, null for all
@return string|array uniqueid of message or list with array(num => uniqueid)
@throws Zend_Mail_Protocol_Exception | [
"Make",
"UIDL",
"call",
"for",
"getting",
"a",
"uniqueid"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Mail/Protocol/Pop3.php#L340-L363 | train | Get uniqueid from UIDL | [
30522,
2270,
3853,
4310,
3593,
1006,
1002,
5796,
26745,
1027,
19701,
1007,
1063,
2065,
1006,
1002,
5796,
26745,
999,
1027,
1027,
19701,
1007,
1063,
1002,
2765,
1027,
1002,
2023,
1011,
1028,
5227,
1006,
1000,
21318,
19422,
1002,
5796,
26745,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Support/XML.php | XML.parse | public static function parse($xml)
{
$backup = libxml_disable_entity_loader(true);
$result = self::normalize(simplexml_load_string(self::sanitize($xml), 'SimpleXMLElement', LIBXML_COMPACT | LIBXML_NOCDATA | LIBXML_NOBLANKS));
libxml_disable_entity_loader($backup);
return $result;
} | php | public static function parse($xml)
{
$backup = libxml_disable_entity_loader(true);
$result = self::normalize(simplexml_load_string(self::sanitize($xml), 'SimpleXMLElement', LIBXML_COMPACT | LIBXML_NOCDATA | LIBXML_NOBLANKS));
libxml_disable_entity_loader($backup);
return $result;
} | [
"public",
"static",
"function",
"parse",
"(",
"$",
"xml",
")",
"{",
"$",
"backup",
"=",
"libxml_disable_entity_loader",
"(",
"true",
")",
";",
"$",
"result",
"=",
"self",
"::",
"normalize",
"(",
"simplexml_load_string",
"(",
"self",
"::",
"sanitize",
"(",
... | XML to array.
@param string $xml XML string
@return array | [
"XML",
"to",
"array",
"."
] | 120c72faaa93c270365bc75c73c362d5fd583209 | https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/Kernel/Support/XML.php#L28-L37 | train | Parse a string into an array of SimpleXMLElement | [
30522,
2270,
10763,
3853,
11968,
3366,
1006,
1002,
20950,
1007,
1063,
1002,
10200,
1027,
5622,
2497,
2595,
19968,
1035,
4487,
19150,
1035,
9178,
1035,
7170,
2121,
1006,
2995,
1007,
1025,
1002,
2765,
1027,
2969,
1024,
1024,
3671,
4697,
1006,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Database/Eloquent/Relations/Concerns/InteractsWithPivotTable.php | InteractsWithPivotTable.withPivot | public function withPivot($columns)
{
$this->pivotColumns = array_merge(
$this->pivotColumns, is_array($columns) ? $columns : func_get_args()
);
return $this;
} | php | public function withPivot($columns)
{
$this->pivotColumns = array_merge(
$this->pivotColumns, is_array($columns) ? $columns : func_get_args()
);
return $this;
} | [
"public",
"function",
"withPivot",
"(",
"$",
"columns",
")",
"{",
"$",
"this",
"->",
"pivotColumns",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"pivotColumns",
",",
"is_array",
"(",
"$",
"columns",
")",
"?",
"$",
"columns",
":",
"func_get_args",
"(",
")... | Set the columns on the pivot table to retrieve.
@param array|mixed $columns
@return $this | [
"Set",
"the",
"columns",
"on",
"the",
"pivot",
"table",
"to",
"retrieve",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Relations/Concerns/InteractsWithPivotTable.php#L531-L538 | train | Set the columns to pivot on the table | [
30522,
2270,
3853,
2007,
8197,
22994,
1006,
1002,
7753,
1007,
1063,
1002,
2023,
1011,
1028,
14255,
22994,
25778,
2819,
3619,
1027,
9140,
1035,
13590,
1006,
1002,
2023,
1011,
1028,
14255,
22994,
25778,
2819,
3619,
1010,
2003,
1035,
9140,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Queue/Jobs/Job.php | Job.fire | public function fire()
{
$payload = $this->payload();
[$class, $method] = JobName::parse($payload['job']);
($this->instance = $this->resolve($class))->{$method}($this, $payload['data']);
} | php | public function fire()
{
$payload = $this->payload();
[$class, $method] = JobName::parse($payload['job']);
($this->instance = $this->resolve($class))->{$method}($this, $payload['data']);
} | [
"public",
"function",
"fire",
"(",
")",
"{",
"$",
"payload",
"=",
"$",
"this",
"->",
"payload",
"(",
")",
";",
"[",
"$",
"class",
",",
"$",
"method",
"]",
"=",
"JobName",
"::",
"parse",
"(",
"$",
"payload",
"[",
"'job'",
"]",
")",
";",
"(",
"$"... | Fire the job.
@return void | [
"Fire",
"the",
"job",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Queue/Jobs/Job.php#L80-L87 | train | Fire the event and return the result of the execution. | [
30522,
2270,
3853,
2543,
1006,
1007,
1063,
1002,
18093,
1027,
1002,
2023,
1011,
1028,
18093,
1006,
1007,
1025,
1031,
1002,
2465,
1010,
1002,
4118,
1033,
1027,
3105,
18442,
1024,
1024,
11968,
3366,
1006,
1002,
18093,
1031,
1005,
3105,
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... |
symfony/symfony | src/Symfony/Component/Security/Core/Encoder/UserPasswordEncoder.php | UserPasswordEncoder.encodePassword | public function encodePassword(UserInterface $user, $plainPassword)
{
$encoder = $this->encoderFactory->getEncoder($user);
return $encoder->encodePassword($plainPassword, $user->getSalt());
} | php | public function encodePassword(UserInterface $user, $plainPassword)
{
$encoder = $this->encoderFactory->getEncoder($user);
return $encoder->encodePassword($plainPassword, $user->getSalt());
} | [
"public",
"function",
"encodePassword",
"(",
"UserInterface",
"$",
"user",
",",
"$",
"plainPassword",
")",
"{",
"$",
"encoder",
"=",
"$",
"this",
"->",
"encoderFactory",
"->",
"getEncoder",
"(",
"$",
"user",
")",
";",
"return",
"$",
"encoder",
"->",
"encod... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Security/Core/Encoder/UserPasswordEncoder.php#L33-L38 | train | Encode a plain password using the user s encoder | [
30522,
2270,
3853,
4372,
16044,
15194,
18351,
1006,
5310,
18447,
2121,
12172,
1002,
5310,
1010,
1002,
5810,
15194,
18351,
1007,
1063,
1002,
4372,
16044,
2099,
1027,
1002,
2023,
1011,
1028,
4372,
16044,
12881,
18908,
10253,
1011,
1028,
2131,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Database/Query/Builder.php | Builder.orderBy | public function orderBy($column, $direction = 'asc')
{
$direction = strtolower($direction);
if (! in_array($direction, ['asc', 'desc'], true)) {
throw new InvalidArgumentException('Order direction must be "asc" or "desc".');
}
$this->{$this->unions ? 'unionOrders' : 'orders'}[] = [
'column' => $column,
'direction' => $direction,
];
return $this;
} | php | public function orderBy($column, $direction = 'asc')
{
$direction = strtolower($direction);
if (! in_array($direction, ['asc', 'desc'], true)) {
throw new InvalidArgumentException('Order direction must be "asc" or "desc".');
}
$this->{$this->unions ? 'unionOrders' : 'orders'}[] = [
'column' => $column,
'direction' => $direction,
];
return $this;
} | [
"public",
"function",
"orderBy",
"(",
"$",
"column",
",",
"$",
"direction",
"=",
"'asc'",
")",
"{",
"$",
"direction",
"=",
"strtolower",
"(",
"$",
"direction",
")",
";",
"if",
"(",
"!",
"in_array",
"(",
"$",
"direction",
",",
"[",
"'asc'",
",",
"'des... | Add an "order by" clause to the query.
@param string $column
@param string $direction
@return $this
@throws \InvalidArgumentException | [
"Add",
"an",
"order",
"by",
"clause",
"to",
"the",
"query",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Query/Builder.php#L1801-L1815 | train | Order by method | [
30522,
2270,
3853,
2344,
3762,
1006,
1002,
5930,
1010,
1002,
3257,
1027,
1005,
2004,
2278,
1005,
1007,
1063,
1002,
3257,
1027,
2358,
5339,
12898,
13777,
1006,
1002,
3257,
1007,
1025,
2065,
1006,
999,
1999,
1035,
9140,
1006,
1002,
3257,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/DependencyInjection/ContainerBuilder.php | ContainerBuilder.registerAliasForArgument | public function registerAliasForArgument(string $id, string $type, string $name = null): Alias
{
$name = lcfirst(str_replace(' ', '', ucwords(preg_replace('/[^a-zA-Z0-9\x7f-\xff]++/', ' ', $name ?? $id))));
if (!preg_match('/^[a-zA-Z_\x7f-\xff]/', $name)) {
throw new InvalidArgumentException(sprintf('Invalid argument name "%s" for service "%s": the first character must be a letter.', $name, $id));
}
return $this->setAlias($type.' $'.$name, $id);
} | php | public function registerAliasForArgument(string $id, string $type, string $name = null): Alias
{
$name = lcfirst(str_replace(' ', '', ucwords(preg_replace('/[^a-zA-Z0-9\x7f-\xff]++/', ' ', $name ?? $id))));
if (!preg_match('/^[a-zA-Z_\x7f-\xff]/', $name)) {
throw new InvalidArgumentException(sprintf('Invalid argument name "%s" for service "%s": the first character must be a letter.', $name, $id));
}
return $this->setAlias($type.' $'.$name, $id);
} | [
"public",
"function",
"registerAliasForArgument",
"(",
"string",
"$",
"id",
",",
"string",
"$",
"type",
",",
"string",
"$",
"name",
"=",
"null",
")",
":",
"Alias",
"{",
"$",
"name",
"=",
"lcfirst",
"(",
"str_replace",
"(",
"' '",
",",
"''",
",",
"ucwor... | Registers an autowiring alias that only binds to a specific argument name.
The argument name is derived from $name if provided (from $id otherwise)
using camel case: "foo.bar" or "foo_bar" creates an alias bound to
"$fooBar"-named arguments with $type as type-hint. Such arguments will
receive the service $id when autowiring is used. | [
"Registers",
"an",
"autowiring",
"alias",
"that",
"only",
"binds",
"to",
"a",
"specific",
"argument",
"name",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DependencyInjection/ContainerBuilder.php#L1377-L1386 | train | Register an alias for an argument | [
30522,
2270,
3853,
4236,
22786,
22747,
6525,
10623,
27417,
2102,
1006,
5164,
1002,
8909,
1010,
5164,
1002,
2828,
1010,
5164,
1002,
2171,
1027,
19701,
1007,
1024,
14593,
1063,
1002,
2171,
1027,
29215,
8873,
12096,
1006,
2358,
2099,
1035,
567... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/Db/BatchInsert.php | BatchInsert.createTableFromCSVFile | public static function createTableFromCSVFile($tableName, $fields, $filePath, $fileSpec)
{
// Chroot environment: prefix the path with the absolute chroot path
$chrootPath = Config::getInstance()->General['absolute_chroot_path'];
if (!empty($chrootPath)) {
$filePath = $chrootPath . $filePath;
}
// On Windows, MySQL expects forward slashes as directory separators
if (SettingsServer::isWindows()) {
$filePath = str_replace('\\', '/', $filePath);
}
$query = "
'$filePath'
REPLACE
INTO TABLE
`" . $tableName . "`";
if (isset($fileSpec['charset'])) {
$query .= ' CHARACTER SET ' . $fileSpec['charset'];
}
$fieldList = '(' . join(',', $fields) . ')';
$query .= "
FIELDS TERMINATED BY
'" . $fileSpec['delim'] . "'
ENCLOSED BY
'" . $fileSpec['quote'] . "'
";
if (isset($fileSpec['escape'])) {
$query .= " ESCAPED BY '" . $fileSpec['escape'] . "'";
}
$query .= "
LINES TERMINATED BY
'" . $fileSpec['eol'] . "'
$fieldList
";
/*
* First attempt: assume web server and MySQL server are on the same machine;
* this requires that the db user have the FILE privilege; however, since this is
* a global privilege, it may not be granted due to security concerns
*/
if (Config::getInstance()->General['multi_server_environment']) {
$keywords = array(); // don't try 'LOAD DATA INFILE' if in a multi_server_environment
} else {
$keywords = array('');
}
/*
* Second attempt: using the LOCAL keyword means the client reads the file and sends it to the server;
* the LOCAL keyword may trigger a known PHP PDO\MYSQL bug when MySQL not built with --enable-local-infile
* @see http://bugs.php.net/bug.php?id=54158
*/
$openBaseDir = ini_get('open_basedir');
$isUsingNonBuggyMysqlnd = function_exists('mysqli_get_client_stats') && version_compare(PHP_VERSION, '5.6.17', '>=');
$safeMode = ini_get('safe_mode');
if (($isUsingNonBuggyMysqlnd || empty($openBaseDir)) && empty($safeMode)) {
// php 5.x - LOAD DATA LOCAL INFILE only used if open_basedir is not set (or we're using a non-buggy version of mysqlnd)
// and if safe mode is not enabled
$keywords[] = 'LOCAL ';
}
$exceptions = array();
foreach ($keywords as $keyword) {
$queryStart = 'LOAD DATA ' . $keyword . 'INFILE ';
$sql = $queryStart . $query;
try {
$result = @Db::exec($sql);
if (empty($result) || $result < 0) {
continue;
}
return true;
} catch (Exception $e) {
$code = $e->getCode();
$message = $e->getMessage() . ($code ? "[$code]" : '');
$exceptions[] = "\n Try #" . (count($exceptions) + 1) . ': ' . $queryStart . ": " . $message;
}
}
if (count($exceptions)) {
$message = "LOAD DATA INFILE failed... Error was: " . implode(",", $exceptions);
Log::info($message);
throw new Exception($message);
}
return false;
} | php | public static function createTableFromCSVFile($tableName, $fields, $filePath, $fileSpec)
{
// Chroot environment: prefix the path with the absolute chroot path
$chrootPath = Config::getInstance()->General['absolute_chroot_path'];
if (!empty($chrootPath)) {
$filePath = $chrootPath . $filePath;
}
// On Windows, MySQL expects forward slashes as directory separators
if (SettingsServer::isWindows()) {
$filePath = str_replace('\\', '/', $filePath);
}
$query = "
'$filePath'
REPLACE
INTO TABLE
`" . $tableName . "`";
if (isset($fileSpec['charset'])) {
$query .= ' CHARACTER SET ' . $fileSpec['charset'];
}
$fieldList = '(' . join(',', $fields) . ')';
$query .= "
FIELDS TERMINATED BY
'" . $fileSpec['delim'] . "'
ENCLOSED BY
'" . $fileSpec['quote'] . "'
";
if (isset($fileSpec['escape'])) {
$query .= " ESCAPED BY '" . $fileSpec['escape'] . "'";
}
$query .= "
LINES TERMINATED BY
'" . $fileSpec['eol'] . "'
$fieldList
";
/*
* First attempt: assume web server and MySQL server are on the same machine;
* this requires that the db user have the FILE privilege; however, since this is
* a global privilege, it may not be granted due to security concerns
*/
if (Config::getInstance()->General['multi_server_environment']) {
$keywords = array(); // don't try 'LOAD DATA INFILE' if in a multi_server_environment
} else {
$keywords = array('');
}
/*
* Second attempt: using the LOCAL keyword means the client reads the file and sends it to the server;
* the LOCAL keyword may trigger a known PHP PDO\MYSQL bug when MySQL not built with --enable-local-infile
* @see http://bugs.php.net/bug.php?id=54158
*/
$openBaseDir = ini_get('open_basedir');
$isUsingNonBuggyMysqlnd = function_exists('mysqli_get_client_stats') && version_compare(PHP_VERSION, '5.6.17', '>=');
$safeMode = ini_get('safe_mode');
if (($isUsingNonBuggyMysqlnd || empty($openBaseDir)) && empty($safeMode)) {
// php 5.x - LOAD DATA LOCAL INFILE only used if open_basedir is not set (or we're using a non-buggy version of mysqlnd)
// and if safe mode is not enabled
$keywords[] = 'LOCAL ';
}
$exceptions = array();
foreach ($keywords as $keyword) {
$queryStart = 'LOAD DATA ' . $keyword . 'INFILE ';
$sql = $queryStart . $query;
try {
$result = @Db::exec($sql);
if (empty($result) || $result < 0) {
continue;
}
return true;
} catch (Exception $e) {
$code = $e->getCode();
$message = $e->getMessage() . ($code ? "[$code]" : '');
$exceptions[] = "\n Try #" . (count($exceptions) + 1) . ': ' . $queryStart . ": " . $message;
}
}
if (count($exceptions)) {
$message = "LOAD DATA INFILE failed... Error was: " . implode(",", $exceptions);
Log::info($message);
throw new Exception($message);
}
return false;
} | [
"public",
"static",
"function",
"createTableFromCSVFile",
"(",
"$",
"tableName",
",",
"$",
"fields",
",",
"$",
"filePath",
",",
"$",
"fileSpec",
")",
"{",
"// Chroot environment: prefix the path with the absolute chroot path",
"$",
"chrootPath",
"=",
"Config",
"::",
"... | Batch insert into table from CSV (or other delimited) file.
@param string $tableName Name of table
@param array $fields Field names
@param string $filePath Path name of a file.
@param array $fileSpec File specifications (delimiter, line terminator, etc)
@throws Exception
@return bool True if successful; false otherwise | [
"Batch",
"insert",
"into",
"table",
"from",
"CSV",
"(",
"or",
"other",
"delimited",
")",
"file",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Db/BatchInsert.php#L137-L228 | train | Create a table from a CSV file | [
30522,
2270,
10763,
3853,
3443,
10880,
19699,
5358,
6169,
2615,
8873,
2571,
1006,
1002,
2795,
18442,
1010,
1002,
4249,
1010,
1002,
5371,
15069,
1010,
1002,
6764,
5051,
2278,
1007,
1063,
1013,
1013,
10381,
3217,
4140,
4044,
1024,
17576,
1996... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/RelationNotFoundException.php | RelationNotFoundException.make | public static function make($model, $relation)
{
$class = get_class($model);
$instance = new static("Call to undefined relationship [{$relation}] on model [{$class}].");
$instance->model = $model;
$instance->relation = $relation;
return $instance;
} | php | public static function make($model, $relation)
{
$class = get_class($model);
$instance = new static("Call to undefined relationship [{$relation}] on model [{$class}].");
$instance->model = $model;
$instance->relation = $relation;
return $instance;
} | [
"public",
"static",
"function",
"make",
"(",
"$",
"model",
",",
"$",
"relation",
")",
"{",
"$",
"class",
"=",
"get_class",
"(",
"$",
"model",
")",
";",
"$",
"instance",
"=",
"new",
"static",
"(",
"\"Call to undefined relationship [{$relation}] on model [{$class}... | Create a new exception instance.
@param mixed $model
@param string $relation
@return static | [
"Create",
"a",
"new",
"exception",
"instance",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/RelationNotFoundException.php#L30-L40 | train | Create an instance of the class that has undefined relationship on the model | [
30522,
2270,
10763,
3853,
2191,
1006,
1002,
2944,
1010,
1002,
7189,
1007,
1063,
1002,
2465,
1027,
2131,
1035,
2465,
1006,
1002,
2944,
1007,
1025,
1002,
6013,
1027,
2047,
10763,
1006,
1000,
2655,
2000,
6151,
28344,
3276,
1031,
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... |
octobercms/october | modules/system/classes/PluginManager.php | PluginManager.init | protected function init()
{
$this->bindContainerObjects();
$this->metaFile = storage_path('cms/disabled.json');
$this->loadDisabled();
$this->loadPlugins();
if ($this->app->runningInBackend()) {
$this->loadDependencies();
}
} | php | protected function init()
{
$this->bindContainerObjects();
$this->metaFile = storage_path('cms/disabled.json');
$this->loadDisabled();
$this->loadPlugins();
if ($this->app->runningInBackend()) {
$this->loadDependencies();
}
} | [
"protected",
"function",
"init",
"(",
")",
"{",
"$",
"this",
"->",
"bindContainerObjects",
"(",
")",
";",
"$",
"this",
"->",
"metaFile",
"=",
"storage_path",
"(",
"'cms/disabled.json'",
")",
";",
"$",
"this",
"->",
"loadDisabled",
"(",
")",
";",
"$",
"th... | Initializes the plugin manager | [
"Initializes",
"the",
"plugin",
"manager"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/PluginManager.php#L74-L84 | train | Initializes the class variables. | [
30522,
5123,
3853,
1999,
4183,
1006,
1007,
1063,
1002,
2023,
1011,
1028,
14187,
8663,
18249,
10624,
2497,
20614,
2015,
1006,
1007,
1025,
1002,
2023,
1011,
1028,
18804,
8873,
2571,
1027,
5527,
1035,
4130,
1006,
1005,
4642,
2015,
1013,
9776,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Validate/File/Extension.php | Zend_Validate_File_Extension.addExtension | public function addExtension($extension)
{
$extensions = $this->getExtension();
if (is_string($extension)) {
$extension = explode(',', $extension);
}
foreach ($extension as $content) {
if (empty($content) || !is_string($content)) {
continue;
}
$extensions[] = trim($content);
}
$extensions = array_unique($extensions);
// Sanity check to ensure no empty values
foreach ($extensions as $key => $ext) {
if (empty($ext)) {
unset($extensions[$key]);
}
}
$this->_extension = implode(',', $extensions);
return $this;
} | php | public function addExtension($extension)
{
$extensions = $this->getExtension();
if (is_string($extension)) {
$extension = explode(',', $extension);
}
foreach ($extension as $content) {
if (empty($content) || !is_string($content)) {
continue;
}
$extensions[] = trim($content);
}
$extensions = array_unique($extensions);
// Sanity check to ensure no empty values
foreach ($extensions as $key => $ext) {
if (empty($ext)) {
unset($extensions[$key]);
}
}
$this->_extension = implode(',', $extensions);
return $this;
} | [
"public",
"function",
"addExtension",
"(",
"$",
"extension",
")",
"{",
"$",
"extensions",
"=",
"$",
"this",
"->",
"getExtension",
"(",
")",
";",
"if",
"(",
"is_string",
"(",
"$",
"extension",
")",
")",
"{",
"$",
"extension",
"=",
"explode",
"(",
"','",... | Adds the file extensions
@param string|array $extension The extensions to add for validation
@return Zend_Validate_File_Extension Provides a fluent interface | [
"Adds",
"the",
"file",
"extensions"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Validate/File/Extension.php#L149-L175 | train | Adds an extension to the list of available extensions | [
30522,
2270,
3853,
5587,
10288,
29048,
1006,
1002,
5331,
1007,
1063,
1002,
14305,
1027,
1002,
2023,
1011,
1028,
2131,
10288,
29048,
1006,
1007,
1025,
2065,
1006,
2003,
1035,
5164,
1006,
1002,
5331,
1007,
1007,
1063,
1002,
5331,
1027,
15044,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/CombineAssets.php | CombineAssets.getCombinedUrl | protected function getCombinedUrl($outputFilename = 'undefined.css')
{
$combineAction = 'System\Classes\Controller@combine';
$actionExists = Route::getRoutes()->getByAction($combineAction) !== null;
if ($actionExists) {
return Url::action($combineAction, [$outputFilename], false);
}
return '/combine/'.$outputFilename;
} | php | protected function getCombinedUrl($outputFilename = 'undefined.css')
{
$combineAction = 'System\Classes\Controller@combine';
$actionExists = Route::getRoutes()->getByAction($combineAction) !== null;
if ($actionExists) {
return Url::action($combineAction, [$outputFilename], false);
}
return '/combine/'.$outputFilename;
} | [
"protected",
"function",
"getCombinedUrl",
"(",
"$",
"outputFilename",
"=",
"'undefined.css'",
")",
"{",
"$",
"combineAction",
"=",
"'System\\Classes\\Controller@combine'",
";",
"$",
"actionExists",
"=",
"Route",
"::",
"getRoutes",
"(",
")",
"->",
"getByAction",
"("... | Returns the URL used for accessing the combined files.
@param string $outputFilename A custom file name to use.
@return string | [
"Returns",
"the",
"URL",
"used",
"for",
"accessing",
"the",
"combined",
"files",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/CombineAssets.php#L495-L505 | train | Get combined URL | [
30522,
5123,
3853,
2131,
18274,
21280,
3126,
2140,
1006,
1002,
6434,
8873,
20844,
4168,
1027,
1005,
6151,
28344,
1012,
20116,
2015,
1005,
1007,
1063,
1002,
11506,
18908,
3258,
1027,
1005,
2291,
1032,
4280,
1032,
11486,
1030,
11506,
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... |
octobercms/october | modules/backend/widgets/Form.php | Form.validateModel | protected function validateModel()
{
if (!$this->model) {
throw new ApplicationException(Lang::get(
'backend::lang.form.missing_model',
['class'=>get_class($this->controller)]
));
}
$this->data = isset($this->data)
? (object) $this->data
: $this->model;
return $this->model;
} | php | protected function validateModel()
{
if (!$this->model) {
throw new ApplicationException(Lang::get(
'backend::lang.form.missing_model',
['class'=>get_class($this->controller)]
));
}
$this->data = isset($this->data)
? (object) $this->data
: $this->model;
return $this->model;
} | [
"protected",
"function",
"validateModel",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"model",
")",
"{",
"throw",
"new",
"ApplicationException",
"(",
"Lang",
"::",
"get",
"(",
"'backend::lang.form.missing_model'",
",",
"[",
"'class'",
"=>",
"get_class",
... | Validate the supplied form model.
@return mixed | [
"Validate",
"the",
"supplied",
"form",
"model",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/Form.php#L284-L298 | train | Validate model of controller | [
30522,
5123,
3853,
9398,
3686,
5302,
9247,
1006,
1007,
1063,
2065,
1006,
999,
1002,
2023,
1011,
1028,
2944,
1007,
1063,
5466,
2047,
4646,
10288,
24422,
1006,
11374,
1024,
1024,
2131,
1006,
1005,
2067,
10497,
1024,
1024,
11374,
1012,
2433,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/Referrers/Controller.php | Controller.getDistinctReferrersMetrics | private function getDistinctReferrersMetrics($date = false)
{
$propertyToAccessorMapping = array(
'numberDistinctSearchEngines' => 'getNumberOfDistinctSearchEngines',
'numberDistinctSocialNetworks' => 'getNumberOfDistinctSocialNetworks',
'numberDistinctKeywords' => 'getNumberOfDistinctKeywords',
'numberDistinctWebsites' => 'getNumberOfDistinctWebsites',
'numberDistinctWebsitesUrls' => 'getNumberOfDistinctWebsitesUrls',
'numberDistinctCampaigns' => 'getNumberOfDistinctCampaigns',
);
$result = array();
foreach ($propertyToAccessorMapping as $property => $method) {
$result[$property] = $this->getNumericValue('Referrers.' . $method, $date);
}
return $result;
} | php | private function getDistinctReferrersMetrics($date = false)
{
$propertyToAccessorMapping = array(
'numberDistinctSearchEngines' => 'getNumberOfDistinctSearchEngines',
'numberDistinctSocialNetworks' => 'getNumberOfDistinctSocialNetworks',
'numberDistinctKeywords' => 'getNumberOfDistinctKeywords',
'numberDistinctWebsites' => 'getNumberOfDistinctWebsites',
'numberDistinctWebsitesUrls' => 'getNumberOfDistinctWebsitesUrls',
'numberDistinctCampaigns' => 'getNumberOfDistinctCampaigns',
);
$result = array();
foreach ($propertyToAccessorMapping as $property => $method) {
$result[$property] = $this->getNumericValue('Referrers.' . $method, $date);
}
return $result;
} | [
"private",
"function",
"getDistinctReferrersMetrics",
"(",
"$",
"date",
"=",
"false",
")",
"{",
"$",
"propertyToAccessorMapping",
"=",
"array",
"(",
"'numberDistinctSearchEngines'",
"=>",
"'getNumberOfDistinctSearchEngines'",
",",
"'numberDistinctSocialNetworks'",
"=>",
"'g... | Returns an array containing the number of distinct referrers for each
referrer type.
@param bool|string $date The date to use when getting metrics. If false, the
date query param is used.
@return array The metrics. | [
"Returns",
"an",
"array",
"containing",
"the",
"number",
"of",
"distinct",
"referrers",
"for",
"each",
"referrer",
"type",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Referrers/Controller.php#L399-L415 | train | Returns the number of distinct referrers | [
30522,
2797,
3853,
2131,
10521,
7629,
6593,
2890,
7512,
14544,
6491,
3388,
7277,
2015,
1006,
1002,
3058,
1027,
6270,
1007,
1063,
1002,
3200,
3406,
6305,
9623,
21748,
2863,
14853,
1027,
9140,
1006,
1005,
2193,
10521,
7629,
16649,
14644,
2104... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/SitesManager/API.php | API.getIpsForRange | public function getIpsForRange($ipRange)
{
$range = IPUtils::getIPRangeBounds($ipRange);
if ($range === null) {
return false;
}
return array(IPUtils::binaryToStringIP($range[0]), IPUtils::binaryToStringIP($range[1]));
} | php | public function getIpsForRange($ipRange)
{
$range = IPUtils::getIPRangeBounds($ipRange);
if ($range === null) {
return false;
}
return array(IPUtils::binaryToStringIP($range[0]), IPUtils::binaryToStringIP($range[1]));
} | [
"public",
"function",
"getIpsForRange",
"(",
"$",
"ipRange",
")",
"{",
"$",
"range",
"=",
"IPUtils",
"::",
"getIPRangeBounds",
"(",
"$",
"ipRange",
")",
";",
"if",
"(",
"$",
"range",
"===",
"null",
")",
"{",
"return",
"false",
";",
"}",
"return",
"arra... | Get the start and end IP addresses for an IP address range
@param string $ipRange IP address range in presentation format
@return array|false Array( low, high ) IP addresses in presentation format; or false if error | [
"Get",
"the",
"start",
"and",
"end",
"IP",
"addresses",
"for",
"an",
"IP",
"address",
"range"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/SitesManager/API.php#L951-L959 | train | Returns an array of IPs for the given IP range | [
30522,
2270,
3853,
2131,
11514,
22747,
24285,
15465,
1006,
1002,
12997,
24388,
2063,
1007,
1063,
1002,
2846,
1027,
12997,
21823,
4877,
1024,
1024,
2131,
11514,
24388,
15878,
28819,
2015,
1006,
1002,
12997,
24388,
2063,
1007,
1025,
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... |
symfony/symfony | src/Symfony/Component/Process/Process.php | Process.close | private function close(): int
{
$this->processPipes->close();
if (\is_resource($this->process)) {
proc_close($this->process);
}
$this->exitcode = $this->processInformation['exitcode'];
$this->status = self::STATUS_TERMINATED;
if (-1 === $this->exitcode) {
if ($this->processInformation['signaled'] && 0 < $this->processInformation['termsig']) {
// if process has been signaled, no exitcode but a valid termsig, apply Unix convention
$this->exitcode = 128 + $this->processInformation['termsig'];
} elseif ($this->isSigchildEnabled()) {
$this->processInformation['signaled'] = true;
$this->processInformation['termsig'] = -1;
}
}
// Free memory from self-reference callback created by buildCallback
// Doing so in other contexts like __destruct or by garbage collector is ineffective
// Now pipes are closed, so the callback is no longer necessary
$this->callback = null;
return $this->exitcode;
} | php | private function close(): int
{
$this->processPipes->close();
if (\is_resource($this->process)) {
proc_close($this->process);
}
$this->exitcode = $this->processInformation['exitcode'];
$this->status = self::STATUS_TERMINATED;
if (-1 === $this->exitcode) {
if ($this->processInformation['signaled'] && 0 < $this->processInformation['termsig']) {
// if process has been signaled, no exitcode but a valid termsig, apply Unix convention
$this->exitcode = 128 + $this->processInformation['termsig'];
} elseif ($this->isSigchildEnabled()) {
$this->processInformation['signaled'] = true;
$this->processInformation['termsig'] = -1;
}
}
// Free memory from self-reference callback created by buildCallback
// Doing so in other contexts like __destruct or by garbage collector is ineffective
// Now pipes are closed, so the callback is no longer necessary
$this->callback = null;
return $this->exitcode;
} | [
"private",
"function",
"close",
"(",
")",
":",
"int",
"{",
"$",
"this",
"->",
"processPipes",
"->",
"close",
"(",
")",
";",
"if",
"(",
"\\",
"is_resource",
"(",
"$",
"this",
"->",
"process",
")",
")",
"{",
"proc_close",
"(",
"$",
"this",
"->",
"pro... | Closes process resource, closes file handles, sets the exitcode.
@return int The exitcode | [
"Closes",
"process",
"resource",
"closes",
"file",
"handles",
"sets",
"the",
"exitcode",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Process/Process.php#L1440-L1465 | train | Closes the process and returns exit code | [
30522,
2797,
3853,
2485,
1006,
1007,
1024,
20014,
1063,
1002,
2023,
1011,
1028,
2832,
24548,
2015,
1011,
1028,
2485,
1006,
1007,
1025,
2065,
1006,
1032,
2003,
1035,
7692,
1006,
1002,
2023,
1011,
1028,
2832,
1007,
1007,
1063,
4013,
2278,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/Zend/Db/Adapter/Db2.php | Zend_Db_Adapter_Db2._determineI5 | protected function _determineI5()
{
// first us the compiled flag.
$this->_isI5 = (php_uname('s') == 'OS400') ? true : false;
// if this is set, then us it
if (isset($this->_config['os'])){
if (strtolower($this->_config['os']) === 'i5') {
$this->_isI5 = true;
} else {
// any other value passed in, its null
$this->_isI5 = false;
}
}
} | php | protected function _determineI5()
{
// first us the compiled flag.
$this->_isI5 = (php_uname('s') == 'OS400') ? true : false;
// if this is set, then us it
if (isset($this->_config['os'])){
if (strtolower($this->_config['os']) === 'i5') {
$this->_isI5 = true;
} else {
// any other value passed in, its null
$this->_isI5 = false;
}
}
} | [
"protected",
"function",
"_determineI5",
"(",
")",
"{",
"// first us the compiled flag.",
"$",
"this",
"->",
"_isI5",
"=",
"(",
"php_uname",
"(",
"'s'",
")",
"==",
"'OS400'",
")",
"?",
"true",
":",
"false",
";",
"// if this is set, then us it",
"if",
"(",
"iss... | Check the connection parameters according to verify
type of used OS
@return void | [
"Check",
"the",
"connection",
"parameters",
"according",
"to",
"verify",
"type",
"of",
"used",
"OS"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Adapter/Db2.php#L761-L776 | train | determine I5 if the OS is i5 | [
30522,
5123,
3853,
1035,
5646,
2072,
2629,
1006,
1007,
1063,
1013,
1013,
2034,
2149,
1996,
9227,
5210,
1012,
1002,
2023,
1011,
1028,
1035,
2003,
2072,
2629,
1027,
1006,
25718,
1035,
14477,
4168,
1006,
1005,
1055,
1005,
1007,
1027,
1027,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getgrav/grav | system/src/Grav/Common/Data/Validation.php | Validation.typeDate | public static function typeDate($value, array $params, array $field)
{
if (!isset($params['format'])) {
$params['format'] = 'Y-m-d';
}
return self::typeDatetime($value, $params, $field);
} | php | public static function typeDate($value, array $params, array $field)
{
if (!isset($params['format'])) {
$params['format'] = 'Y-m-d';
}
return self::typeDatetime($value, $params, $field);
} | [
"public",
"static",
"function",
"typeDate",
"(",
"$",
"value",
",",
"array",
"$",
"params",
",",
"array",
"$",
"field",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"params",
"[",
"'format'",
"]",
")",
")",
"{",
"$",
"params",
"[",
"'format'",
"]",... | HTML5 input: date
@param mixed $value Value to be validated.
@param array $params Validation parameters.
@param array $field Blueprint for the field.
@return bool True if validation succeeded. | [
"HTML5",
"input",
":",
"date"
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Data/Validation.php#L485-L492 | train | Type date. | [
30522,
2270,
10763,
3853,
21189,
3686,
1006,
1002,
3643,
1010,
9140,
1002,
11498,
5244,
1010,
9140,
1002,
2492,
1007,
1063,
2065,
1006,
999,
26354,
3388,
1006,
1002,
11498,
5244,
1031,
1005,
4289,
1005,
1033,
1007,
1007,
1063,
1002,
11498,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/JsonResponse.php | JsonResponse.hasValidJson | protected function hasValidJson($jsonError)
{
if ($jsonError === JSON_ERROR_NONE) {
return true;
}
return $this->hasEncodingOption(JSON_PARTIAL_OUTPUT_ON_ERROR) &&
in_array($jsonError, [
JSON_ERROR_RECURSION,
JSON_ERROR_INF_OR_NAN,
JSON_ERROR_UNSUPPORTED_TYPE,
]);
} | php | protected function hasValidJson($jsonError)
{
if ($jsonError === JSON_ERROR_NONE) {
return true;
}
return $this->hasEncodingOption(JSON_PARTIAL_OUTPUT_ON_ERROR) &&
in_array($jsonError, [
JSON_ERROR_RECURSION,
JSON_ERROR_INF_OR_NAN,
JSON_ERROR_UNSUPPORTED_TYPE,
]);
} | [
"protected",
"function",
"hasValidJson",
"(",
"$",
"jsonError",
")",
"{",
"if",
"(",
"$",
"jsonError",
"===",
"JSON_ERROR_NONE",
")",
"{",
"return",
"true",
";",
"}",
"return",
"$",
"this",
"->",
"hasEncodingOption",
"(",
"JSON_PARTIAL_OUTPUT_ON_ERROR",
")",
"... | Determine if an error occurred during JSON encoding.
@param int $jsonError
@return bool | [
"Determine",
"if",
"an",
"error",
"occurred",
"during",
"JSON",
"encoding",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Http/JsonResponse.php#L87-L99 | train | Checks if the given JSON error is a valid JSON error | [
30522,
5123,
3853,
2038,
10175,
3593,
22578,
2239,
1006,
1002,
1046,
3385,
2121,
29165,
1007,
1063,
2065,
1006,
1002,
1046,
3385,
2121,
29165,
1027,
1027,
1027,
1046,
3385,
1035,
7561,
1035,
3904,
1007,
1063,
2709,
2995,
1025,
1065,
2709,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
z-song/laravel-admin | src/Form/Field/Embeds.php | Embeds.resetInputKey | public function resetInputKey(array &$input, array $column)
{
$column = array_flip($column);
foreach ($input[$this->column] as $key => $value) {
if (!array_key_exists($key, $column)) {
continue;
}
$newKey = $key.$column[$key];
/*
* set new key
*/
Arr::set($input, "{$this->column}.$newKey", $value);
/*
* forget the old key and value
*/
Arr::forget($input, "{$this->column}.$key");
}
} | php | public function resetInputKey(array &$input, array $column)
{
$column = array_flip($column);
foreach ($input[$this->column] as $key => $value) {
if (!array_key_exists($key, $column)) {
continue;
}
$newKey = $key.$column[$key];
/*
* set new key
*/
Arr::set($input, "{$this->column}.$newKey", $value);
/*
* forget the old key and value
*/
Arr::forget($input, "{$this->column}.$key");
}
} | [
"public",
"function",
"resetInputKey",
"(",
"array",
"&",
"$",
"input",
",",
"array",
"$",
"column",
")",
"{",
"$",
"column",
"=",
"array_flip",
"(",
"$",
"column",
")",
";",
"foreach",
"(",
"$",
"input",
"[",
"$",
"this",
"->",
"column",
"]",
"as",
... | Reset input key for validation.
@param array $input
@param array $column $column is the column name array set
@return void. | [
"Reset",
"input",
"key",
"for",
"validation",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Form/Field/Embeds.php#L179-L199 | train | Reset the input array key and value of the column | [
30522,
2270,
3853,
25141,
2378,
18780,
14839,
1006,
9140,
1004,
1002,
7953,
1010,
9140,
1002,
5930,
1007,
1063,
1002,
5930,
1027,
9140,
1035,
11238,
1006,
1002,
5930,
1007,
1025,
18921,
6776,
1006,
1002,
7953,
1031,
1002,
2023,
1011,
1028,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/Referrers/API.php | API.setSocialIdSubtables | private function setSocialIdSubtables($dataTable)
{
if ($dataTable instanceof DataTable\Map) {
foreach ($dataTable->getDataTables() as $childTable) {
$this->setSocialIdSubtables($childTable);
}
} else {
foreach ($dataTable->getRows() as $row) {
$socialName = $row->getColumn('label');
$i = 1; // start at one because idSubtable=0 is equivalent to idSubtable=false
foreach (Social::getInstance()->getDefinitions() as $name) {
if ($name == $socialName) {
$row->setNonLoadedSubtableId($i);
break;
}
++$i;
}
}
}
} | php | private function setSocialIdSubtables($dataTable)
{
if ($dataTable instanceof DataTable\Map) {
foreach ($dataTable->getDataTables() as $childTable) {
$this->setSocialIdSubtables($childTable);
}
} else {
foreach ($dataTable->getRows() as $row) {
$socialName = $row->getColumn('label');
$i = 1; // start at one because idSubtable=0 is equivalent to idSubtable=false
foreach (Social::getInstance()->getDefinitions() as $name) {
if ($name == $socialName) {
$row->setNonLoadedSubtableId($i);
break;
}
++$i;
}
}
}
} | [
"private",
"function",
"setSocialIdSubtables",
"(",
"$",
"dataTable",
")",
"{",
"if",
"(",
"$",
"dataTable",
"instanceof",
"DataTable",
"\\",
"Map",
")",
"{",
"foreach",
"(",
"$",
"dataTable",
"->",
"getDataTables",
"(",
")",
"as",
"$",
"childTable",
")",
... | Sets the subtable IDs for the DataTable returned by getSocial.
The IDs are int indexes into the array in of defined socials.
@param DataTable $dataTable | [
"Sets",
"the",
"subtable",
"IDs",
"for",
"the",
"DataTable",
"returned",
"by",
"getSocial",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Referrers/API.php#L562-L583 | train | Set the subtables of the data table | [
30522,
2797,
3853,
4520,
10085,
4818,
9821,
12083,
10880,
2015,
1006,
1002,
2951,
10880,
1007,
1063,
2065,
1006,
1002,
2951,
10880,
6013,
11253,
2951,
10880,
1032,
4949,
1007,
1063,
18921,
6776,
1006,
1002,
2951,
10880,
1011,
1028,
2131,
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/ConfigurationUrlParser.php | ConfigurationUrlParser.getQueryOptions | protected function getQueryOptions($url)
{
$queryString = $url['query'] ?? null;
if (! $queryString) {
return [];
}
$query = [];
parse_str($queryString, $query);
return $this->parseStringsToNativeTypes($query);
} | php | protected function getQueryOptions($url)
{
$queryString = $url['query'] ?? null;
if (! $queryString) {
return [];
}
$query = [];
parse_str($queryString, $query);
return $this->parseStringsToNativeTypes($query);
} | [
"protected",
"function",
"getQueryOptions",
"(",
"$",
"url",
")",
"{",
"$",
"queryString",
"=",
"$",
"url",
"[",
"'query'",
"]",
"??",
"null",
";",
"if",
"(",
"!",
"$",
"queryString",
")",
"{",
"return",
"[",
"]",
";",
"}",
"$",
"query",
"=",
"[",
... | Get all of the additional database options from the query string.
@param array $url
@return array | [
"Get",
"all",
"of",
"the",
"additional",
"database",
"options",
"from",
"the",
"query",
"string",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/ConfigurationUrlParser.php#L108-L121 | train | Get Query Options | [
30522,
5123,
3853,
2131,
4226,
2854,
7361,
9285,
1006,
1002,
24471,
2140,
1007,
1063,
1002,
23032,
3367,
4892,
1027,
1002,
24471,
2140,
1031,
1005,
23032,
1005,
1033,
1029,
1029,
19701,
1025,
2065,
1006,
999,
1002,
23032,
3367,
4892,
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/Login/Controller.php | Controller.resetPasswordFirstStep | protected function resetPasswordFirstStep($form)
{
$loginMail = $form->getSubmitValue('form_login');
$password = $form->getSubmitValue('form_password');
try {
$this->passwordResetter->initiatePasswordResetProcess($loginMail, $password);
} catch (Exception $ex) {
Log::debug($ex);
return array($ex->getMessage());
}
return null;
} | php | protected function resetPasswordFirstStep($form)
{
$loginMail = $form->getSubmitValue('form_login');
$password = $form->getSubmitValue('form_password');
try {
$this->passwordResetter->initiatePasswordResetProcess($loginMail, $password);
} catch (Exception $ex) {
Log::debug($ex);
return array($ex->getMessage());
}
return null;
} | [
"protected",
"function",
"resetPasswordFirstStep",
"(",
"$",
"form",
")",
"{",
"$",
"loginMail",
"=",
"$",
"form",
"->",
"getSubmitValue",
"(",
"'form_login'",
")",
";",
"$",
"password",
"=",
"$",
"form",
"->",
"getSubmitValue",
"(",
"'form_password'",
")",
... | Saves password reset info and sends confirmation email.
@param QuickForm2 $form
@return array Error message(s) if an error occurs. | [
"Saves",
"password",
"reset",
"info",
"and",
"sends",
"confirmation",
"email",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Login/Controller.php#L402-L416 | train | Reset password first step | [
30522,
5123,
3853,
25141,
15194,
18351,
8873,
12096,
13473,
2361,
1006,
1002,
2433,
1007,
1063,
1002,
8833,
2378,
21397,
1027,
1002,
2433,
1011,
1028,
4152,
12083,
22930,
10175,
5657,
1006,
1005,
2433,
1035,
8833,
2378,
1005,
1007,
1025,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getgrav/grav | system/src/Grav/Common/Language/Language.php | Language.getBrowserLanguages | public function getBrowserLanguages($accept_langs = [])
{
user_error(__CLASS__ . '::' . __FUNCTION__ . '() is deprecated since Grav 1.6, no longer used', E_USER_DEPRECATED);
if (empty($this->http_accept_language)) {
if (empty($accept_langs) && isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
$accept_langs = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
} else {
return $accept_langs;
}
$langs = [];
foreach (explode(',', $accept_langs) as $k => $pref) {
// split $pref again by ';q='
// and decorate the language entries by inverted position
if (false !== ($i = strpos($pref, ';q='))) {
$langs[substr($pref, 0, $i)] = [(float)substr($pref, $i + 3), -$k];
} else {
$langs[$pref] = [1, -$k];
}
}
arsort($langs);
// no need to undecorate, because we're only interested in the keys
$this->http_accept_language = array_keys($langs);
}
return $this->http_accept_language;
} | php | public function getBrowserLanguages($accept_langs = [])
{
user_error(__CLASS__ . '::' . __FUNCTION__ . '() is deprecated since Grav 1.6, no longer used', E_USER_DEPRECATED);
if (empty($this->http_accept_language)) {
if (empty($accept_langs) && isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
$accept_langs = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
} else {
return $accept_langs;
}
$langs = [];
foreach (explode(',', $accept_langs) as $k => $pref) {
// split $pref again by ';q='
// and decorate the language entries by inverted position
if (false !== ($i = strpos($pref, ';q='))) {
$langs[substr($pref, 0, $i)] = [(float)substr($pref, $i + 3), -$k];
} else {
$langs[$pref] = [1, -$k];
}
}
arsort($langs);
// no need to undecorate, because we're only interested in the keys
$this->http_accept_language = array_keys($langs);
}
return $this->http_accept_language;
} | [
"public",
"function",
"getBrowserLanguages",
"(",
"$",
"accept_langs",
"=",
"[",
"]",
")",
"{",
"user_error",
"(",
"__CLASS__",
".",
"'::'",
".",
"__FUNCTION__",
".",
"'() is deprecated since Grav 1.6, no longer used'",
",",
"E_USER_DEPRECATED",
")",
";",
"if",
"(",... | Get the browser accepted languages
@param array $accept_langs
@return array
@deprecated 1.6 No longer used - using content negotiation. | [
"Get",
"the",
"browser",
"accepted",
"languages"
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Language/Language.php#L495-L523 | train | Get the browser languages | [
30522,
2270,
3853,
2131,
12618,
9333,
2121,
25023,
6692,
8449,
1006,
1002,
5138,
1035,
11374,
2015,
1027,
1031,
1033,
1007,
1063,
5310,
1035,
7561,
1006,
1035,
1035,
2465,
1035,
1035,
1012,
1005,
1024,
1024,
1005,
1012,
1035,
1035,
3853,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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._hash | protected function _hash($data, $controlType)
{
switch ($controlType) {
case 'md5':
return md5($data);
case 'crc32':
return crc32($data);
case 'strlen':
return strlen($data);
case 'adler32':
return hash('adler32', $data);
default:
Zend_Cache::throwException("Incorrect hash function : $controlType");
}
} | php | protected function _hash($data, $controlType)
{
switch ($controlType) {
case 'md5':
return md5($data);
case 'crc32':
return crc32($data);
case 'strlen':
return strlen($data);
case 'adler32':
return hash('adler32', $data);
default:
Zend_Cache::throwException("Incorrect hash function : $controlType");
}
} | [
"protected",
"function",
"_hash",
"(",
"$",
"data",
",",
"$",
"controlType",
")",
"{",
"switch",
"(",
"$",
"controlType",
")",
"{",
"case",
"'md5'",
":",
"return",
"md5",
"(",
"$",
"data",
")",
";",
"case",
"'crc32'",
":",
"return",
"crc32",
"(",
"$"... | Make a control key with the string containing datas
@param string $data Data
@param string $controlType Type of control 'md5', 'crc32' or 'strlen'
@throws Zend_Cache_Exception
@return string Control key | [
"Make",
"a",
"control",
"key",
"with",
"the",
"string",
"containing",
"datas"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Cache/Backend/File.php#L840-L854 | train | Hash function used by the cache manager | [
30522,
5123,
3853,
1035,
23325,
1006,
1002,
2951,
1010,
1002,
2491,
13874,
1007,
1063,
6942,
1006,
1002,
2491,
13874,
1007,
1063,
2553,
1005,
9108,
2629,
1005,
1024,
2709,
9108,
2629,
1006,
1002,
2951,
1007,
1025,
2553,
1005,
13675,
2278,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Database/Schema/Grammars/Grammar.php | Grammar.getDefaultValue | protected function getDefaultValue($value)
{
if ($value instanceof Expression) {
return $value;
}
return is_bool($value)
? "'".(int) $value."'"
: "'".(string) $value."'";
} | php | protected function getDefaultValue($value)
{
if ($value instanceof Expression) {
return $value;
}
return is_bool($value)
? "'".(int) $value."'"
: "'".(string) $value."'";
} | [
"protected",
"function",
"getDefaultValue",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"value",
"instanceof",
"Expression",
")",
"{",
"return",
"$",
"value",
";",
"}",
"return",
"is_bool",
"(",
"$",
"value",
")",
"?",
"\"'\"",
".",
"(",
"int",
")",
... | Format a value so that it can be used in "default" clauses.
@param mixed $value
@return string | [
"Format",
"a",
"value",
"so",
"that",
"it",
"can",
"be",
"used",
"in",
"default",
"clauses",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Schema/Grammars/Grammar.php#L240-L249 | train | Returns the default value for the expression | [
30522,
5123,
3853,
2131,
3207,
7011,
11314,
10175,
5657,
1006,
1002,
3643,
1007,
1063,
2065,
1006,
1002,
3643,
6013,
11253,
3670,
1007,
1063,
2709,
1002,
3643,
1025,
1065,
2709,
2003,
1035,
22017,
2140,
1006,
1002,
3643,
1007,
1029,
1000,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Notifications/NotificationSender.php | NotificationSender.send | public function send($notifiables, $notification)
{
$notifiables = $this->formatNotifiables($notifiables);
if ($notification instanceof ShouldQueue) {
return $this->queueNotification($notifiables, $notification);
}
return $this->sendNow($notifiables, $notification);
} | php | public function send($notifiables, $notification)
{
$notifiables = $this->formatNotifiables($notifiables);
if ($notification instanceof ShouldQueue) {
return $this->queueNotification($notifiables, $notification);
}
return $this->sendNow($notifiables, $notification);
} | [
"public",
"function",
"send",
"(",
"$",
"notifiables",
",",
"$",
"notification",
")",
"{",
"$",
"notifiables",
"=",
"$",
"this",
"->",
"formatNotifiables",
"(",
"$",
"notifiables",
")",
";",
"if",
"(",
"$",
"notification",
"instanceof",
"ShouldQueue",
")",
... | Send the given notification to the given notifiable entities.
@param \Illuminate\Support\Collection|array|mixed $notifiables
@param mixed $notification
@return void | [
"Send",
"the",
"given",
"notification",
"to",
"the",
"given",
"notifiable",
"entities",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Notifications/NotificationSender.php#L69-L78 | train | Send a notification to all notifiables | [
30522,
2270,
3853,
4604,
1006,
1002,
2025,
10128,
19210,
2015,
1010,
1002,
26828,
1007,
1063,
1002,
2025,
10128,
19210,
2015,
1027,
1002,
2023,
1011,
1028,
4289,
17048,
10128,
19210,
2015,
1006,
1002,
2025,
10128,
19210,
2015,
1007,
1025,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Security/Http/Firewall/LogoutListener.php | LogoutListener.requiresLogout | protected function requiresLogout(Request $request)
{
return isset($this->options['logout_path']) && $this->httpUtils->checkRequestPath($request, $this->options['logout_path']);
} | php | protected function requiresLogout(Request $request)
{
return isset($this->options['logout_path']) && $this->httpUtils->checkRequestPath($request, $this->options['logout_path']);
} | [
"protected",
"function",
"requiresLogout",
"(",
"Request",
"$",
"request",
")",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"options",
"[",
"'logout_path'",
"]",
")",
"&&",
"$",
"this",
"->",
"httpUtils",
"->",
"checkRequestPath",
"(",
"$",
"request",
... | Whether this request is asking for logout.
The default implementation only processed requests to a specific path,
but a subclass could change this to logout requests where
certain parameters is present.
@return bool | [
"Whether",
"this",
"request",
"is",
"asking",
"for",
"logout",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Security/Http/Firewall/LogoutListener.php#L121-L124 | train | Checks if the request requires a logout | [
30522,
5123,
3853,
5942,
21197,
5833,
1006,
5227,
1002,
5227,
1007,
1063,
2709,
26354,
3388,
1006,
1002,
2023,
1011,
1028,
7047,
1031,
1005,
8154,
4904,
1035,
4130,
1005,
1033,
1007,
1004,
1004,
1002,
2023,
1011,
1028,
8299,
21823,
4877,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Cookie.php | Cookie.loadContentFromCookie | protected function loadContentFromCookie()
{
$cookieStr = $this->extractSignedContent($_COOKIE[$this->name]);
if ($cookieStr === false) {
return;
}
$values = explode(self::VALUE_SEPARATOR, $cookieStr);
foreach ($values as $nameValue) {
$equalPos = strpos($nameValue, '=');
$varName = substr($nameValue, 0, $equalPos);
$varValue = substr($nameValue, $equalPos + 1);
// no numeric value are base64 encoded so we need to decode them
if (!is_numeric($varValue)) {
$tmpValue = base64_decode($varValue);
$varValue = safe_unserialize($tmpValue);
// discard entire cookie
// note: this assumes we never serialize a boolean
if ($varValue === false && $tmpValue !== 'b:0;') {
$this->value = array();
unset($_COOKIE[$this->name]);
break;
}
}
$this->value[$varName] = $varValue;
}
} | php | protected function loadContentFromCookie()
{
$cookieStr = $this->extractSignedContent($_COOKIE[$this->name]);
if ($cookieStr === false) {
return;
}
$values = explode(self::VALUE_SEPARATOR, $cookieStr);
foreach ($values as $nameValue) {
$equalPos = strpos($nameValue, '=');
$varName = substr($nameValue, 0, $equalPos);
$varValue = substr($nameValue, $equalPos + 1);
// no numeric value are base64 encoded so we need to decode them
if (!is_numeric($varValue)) {
$tmpValue = base64_decode($varValue);
$varValue = safe_unserialize($tmpValue);
// discard entire cookie
// note: this assumes we never serialize a boolean
if ($varValue === false && $tmpValue !== 'b:0;') {
$this->value = array();
unset($_COOKIE[$this->name]);
break;
}
}
$this->value[$varName] = $varValue;
}
} | [
"protected",
"function",
"loadContentFromCookie",
"(",
")",
"{",
"$",
"cookieStr",
"=",
"$",
"this",
"->",
"extractSignedContent",
"(",
"$",
"_COOKIE",
"[",
"$",
"this",
"->",
"name",
"]",
")",
";",
"if",
"(",
"$",
"cookieStr",
"===",
"false",
")",
"{",
... | Load the cookie content into a php array.
Parses the cookie string to extract the different variables.
Unserialize the array when necessary.
Decode the non numeric values that were base64 encoded. | [
"Load",
"the",
"cookie",
"content",
"into",
"a",
"php",
"array",
".",
"Parses",
"the",
"cookie",
"string",
"to",
"extract",
"the",
"different",
"variables",
".",
"Unserialize",
"the",
"array",
"when",
"necessary",
".",
"Decode",
"the",
"non",
"numeric",
"val... | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Cookie.php#L222-L252 | train | Load content from cookie | [
30522,
5123,
3853,
7170,
8663,
6528,
24475,
21716,
3597,
23212,
2063,
1006,
1007,
1063,
1002,
16324,
16344,
1027,
1002,
2023,
1011,
1028,
27059,
23773,
2098,
8663,
6528,
2102,
1006,
1002,
1035,
17387,
1031,
1002,
2023,
1011,
1028,
2171,
103... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Cache/Adapter/PhpArrayAdapter.php | PhpArrayAdapter.create | public static function create($file, CacheItemPoolInterface $fallbackPool)
{
// Shared memory is available in PHP 7.0+ with OPCache enabled
if (filter_var(ini_get('opcache.enable'), FILTER_VALIDATE_BOOLEAN)) {
if (!$fallbackPool instanceof AdapterInterface) {
$fallbackPool = new ProxyAdapter($fallbackPool);
}
return new static($file, $fallbackPool);
}
return $fallbackPool;
} | php | public static function create($file, CacheItemPoolInterface $fallbackPool)
{
// Shared memory is available in PHP 7.0+ with OPCache enabled
if (filter_var(ini_get('opcache.enable'), FILTER_VALIDATE_BOOLEAN)) {
if (!$fallbackPool instanceof AdapterInterface) {
$fallbackPool = new ProxyAdapter($fallbackPool);
}
return new static($file, $fallbackPool);
}
return $fallbackPool;
} | [
"public",
"static",
"function",
"create",
"(",
"$",
"file",
",",
"CacheItemPoolInterface",
"$",
"fallbackPool",
")",
"{",
"// Shared memory is available in PHP 7.0+ with OPCache enabled",
"if",
"(",
"filter_var",
"(",
"ini_get",
"(",
"'opcache.enable'",
")",
",",
"FILTE... | This adapter takes advantage of how PHP stores arrays in its latest versions.
@param string $file The PHP file were values are cached
@param CacheItemPoolInterface $fallbackPool Fallback when opcache is disabled
@return CacheItemPoolInterface | [
"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/Adapter/PhpArrayAdapter.php#L68-L80 | train | Create a new cache object | [
30522,
2270,
10763,
3853,
3443,
1006,
1002,
5371,
1010,
17053,
4221,
8737,
13669,
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,
9124... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Workflow/Workflow.php | Workflow.can | public function can($subject, $transitionName)
{
$transitions = $this->definition->getTransitions();
$marking = $this->getMarking($subject);
foreach ($transitions as $transition) {
if ($transition->getName() !== $transitionName) {
continue;
}
$transitionBlockerList = $this->buildTransitionBlockerListForTransition($subject, $marking, $transition);
if ($transitionBlockerList->isEmpty()) {
return true;
}
}
return false;
} | php | public function can($subject, $transitionName)
{
$transitions = $this->definition->getTransitions();
$marking = $this->getMarking($subject);
foreach ($transitions as $transition) {
if ($transition->getName() !== $transitionName) {
continue;
}
$transitionBlockerList = $this->buildTransitionBlockerListForTransition($subject, $marking, $transition);
if ($transitionBlockerList->isEmpty()) {
return true;
}
}
return false;
} | [
"public",
"function",
"can",
"(",
"$",
"subject",
",",
"$",
"transitionName",
")",
"{",
"$",
"transitions",
"=",
"$",
"this",
"->",
"definition",
"->",
"getTransitions",
"(",
")",
";",
"$",
"marking",
"=",
"$",
"this",
"->",
"getMarking",
"(",
"$",
"su... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Workflow/Workflow.php#L95-L113 | train | Checks if the subject can transition with the given name | [
30522,
2270,
3853,
2064,
1006,
1002,
3395,
1010,
1002,
6653,
18442,
1007,
1063,
1002,
22166,
1027,
1002,
2023,
1011,
1028,
6210,
1011,
1028,
2131,
6494,
3619,
22753,
2015,
1006,
1007,
1025,
1002,
10060,
1027,
1002,
2023,
1011,
1028,
2131,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | core/Plugin/Menu.php | Menu.urlForModuleAction | protected function urlForModuleAction($module, $controllerAction, $additionalParams = array())
{
$this->checkisValidCallable($module, $controllerAction);
$pluginManager = PluginManager::getInstance();
if (!$pluginManager->isPluginLoaded($module) ||
!$pluginManager->isPluginActivated($module)) {
return null;
}
$params = (array) $additionalParams;
$params['action'] = $controllerAction;
$params['module'] = $module;
return $params;
} | php | protected function urlForModuleAction($module, $controllerAction, $additionalParams = array())
{
$this->checkisValidCallable($module, $controllerAction);
$pluginManager = PluginManager::getInstance();
if (!$pluginManager->isPluginLoaded($module) ||
!$pluginManager->isPluginActivated($module)) {
return null;
}
$params = (array) $additionalParams;
$params['action'] = $controllerAction;
$params['module'] = $module;
return $params;
} | [
"protected",
"function",
"urlForModuleAction",
"(",
"$",
"module",
",",
"$",
"controllerAction",
",",
"$",
"additionalParams",
"=",
"array",
"(",
")",
")",
"{",
"$",
"this",
"->",
"checkisValidCallable",
"(",
"$",
"module",
",",
"$",
"controllerAction",
")",
... | Generates a URL for the given action of the given module. We usually do not recommend to use this method as you
should make sure the method of that module actually exists. If the plugin owner of that module changes the method
in a future version your link might no longer work. If you want to link to an action of your controller use the
method {@link urlForAction()}. Note: We will generate a link only if the given module is installed and activated.
@param string $module The name of the module/plugin the action belongs to. The module name is case sensitive.
@param string $controllerAction The name of the action that should be executed within your controller
@param array $additionalParams Optional URL parameters that will be appended to the URL
@return array|null Returns null if the given module is either not installed or not activated. Returns the array
of query parameter names and values to the given module action otherwise.
@since 2.7.0
// not API for now | [
"Generates",
"a",
"URL",
"for",
"the",
"given",
"action",
"of",
"the",
"given",
"module",
".",
"We",
"usually",
"do",
"not",
"recommend",
"to",
"use",
"this",
"method",
"as",
"you",
"should",
"make",
"sure",
"the",
"method",
"of",
"that",
"module",
"actu... | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Plugin/Menu.php#L110-L126 | train | Returns the url parameters for a module action | [
30522,
5123,
3853,
24471,
10270,
2953,
5302,
8566,
19738,
7542,
1006,
1002,
11336,
1010,
1002,
11486,
18908,
3258,
1010,
1002,
3176,
28689,
5244,
1027,
9140,
1006,
1007,
1007,
1063,
1002,
2023,
1011,
1028,
4638,
2483,
10175,
3593,
9289,
204... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/DependencyInjection/ContainerBuilder.php | ContainerBuilder.compile | public function compile(bool $resolveEnvPlaceholders = false)
{
$compiler = $this->getCompiler();
if ($this->trackResources) {
foreach ($compiler->getPassConfig()->getPasses() as $pass) {
$this->addObjectResource($pass);
}
}
$bag = $this->getParameterBag();
if ($resolveEnvPlaceholders && $bag instanceof EnvPlaceholderParameterBag) {
$compiler->addPass(new ResolveEnvPlaceholdersPass(), PassConfig::TYPE_AFTER_REMOVING, -1000);
}
$compiler->compile($this);
foreach ($this->definitions as $id => $definition) {
if ($this->trackResources && $definition->isLazy()) {
$this->getReflectionClass($definition->getClass());
}
}
$this->extensionConfigs = [];
if ($bag instanceof EnvPlaceholderParameterBag) {
if ($resolveEnvPlaceholders) {
$this->parameterBag = new ParameterBag($this->resolveEnvPlaceholders($bag->all(), true));
}
$this->envPlaceholders = $bag->getEnvPlaceholders();
}
parent::compile();
foreach ($this->definitions + $this->aliasDefinitions as $id => $definition) {
if (!$definition->isPublic() || $definition->isPrivate()) {
$this->removedIds[$id] = true;
}
}
} | php | public function compile(bool $resolveEnvPlaceholders = false)
{
$compiler = $this->getCompiler();
if ($this->trackResources) {
foreach ($compiler->getPassConfig()->getPasses() as $pass) {
$this->addObjectResource($pass);
}
}
$bag = $this->getParameterBag();
if ($resolveEnvPlaceholders && $bag instanceof EnvPlaceholderParameterBag) {
$compiler->addPass(new ResolveEnvPlaceholdersPass(), PassConfig::TYPE_AFTER_REMOVING, -1000);
}
$compiler->compile($this);
foreach ($this->definitions as $id => $definition) {
if ($this->trackResources && $definition->isLazy()) {
$this->getReflectionClass($definition->getClass());
}
}
$this->extensionConfigs = [];
if ($bag instanceof EnvPlaceholderParameterBag) {
if ($resolveEnvPlaceholders) {
$this->parameterBag = new ParameterBag($this->resolveEnvPlaceholders($bag->all(), true));
}
$this->envPlaceholders = $bag->getEnvPlaceholders();
}
parent::compile();
foreach ($this->definitions + $this->aliasDefinitions as $id => $definition) {
if (!$definition->isPublic() || $definition->isPrivate()) {
$this->removedIds[$id] = true;
}
}
} | [
"public",
"function",
"compile",
"(",
"bool",
"$",
"resolveEnvPlaceholders",
"=",
"false",
")",
"{",
"$",
"compiler",
"=",
"$",
"this",
"->",
"getCompiler",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"trackResources",
")",
"{",
"foreach",
"(",
"$",
"... | Compiles the container.
This method passes the container to compiler
passes whose job is to manipulate and optimize
the container.
The main compiler passes roughly do four things:
* The extension configurations are merged;
* Parameter values are resolved;
* The parameter bag is frozen;
* Extension loading is disabled.
@param bool $resolveEnvPlaceholders Whether %env()% parameters should be resolved using the current
env vars or be replaced by uniquely identifiable placeholders.
Set to "true" when you want to use the current ContainerBuilder
directly, keep to "false" when the container is dumped instead. | [
"Compiles",
"the",
"container",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DependencyInjection/ContainerBuilder.php#L741-L781 | train | Compiles the class hierarchy | [
30522,
2270,
3853,
4012,
22090,
1006,
22017,
2140,
1002,
10663,
2368,
2615,
24759,
10732,
17794,
1027,
6270,
1007,
1063,
1002,
21624,
1027,
1002,
2023,
1011,
1028,
2131,
9006,
22090,
2099,
1006,
1007,
1025,
2065,
1006,
1002,
2023,
1011,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Log/Logger.php | Logger.listen | public function listen(Closure $callback)
{
if (! isset($this->dispatcher)) {
throw new RuntimeException('Events dispatcher has not been set.');
}
$this->dispatcher->listen(MessageLogged::class, $callback);
} | php | public function listen(Closure $callback)
{
if (! isset($this->dispatcher)) {
throw new RuntimeException('Events dispatcher has not been set.');
}
$this->dispatcher->listen(MessageLogged::class, $callback);
} | [
"public",
"function",
"listen",
"(",
"Closure",
"$",
"callback",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"dispatcher",
")",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"'Events dispatcher has not been set.'",
")",
";",
"}",
"$",
"... | Register a new callback handler for when a log event is triggered.
@param \Closure $callback
@return void
@throws \RuntimeException | [
"Register",
"a",
"new",
"callback",
"handler",
"for",
"when",
"a",
"log",
"event",
"is",
"triggered",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Log/Logger.php#L187-L194 | train | Listen for messages logged | [
30522,
2270,
3853,
4952,
1006,
8503,
1002,
2655,
5963,
1007,
1063,
2065,
1006,
999,
26354,
3388,
1006,
1002,
2023,
1011,
1028,
18365,
2121,
1007,
1007,
1063,
5466,
2047,
2448,
7292,
10288,
24422,
1006,
1005,
2824,
18365,
2121,
2038,
2025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Group.php | Group.groupNames | public static function groupNames()
{
$groups = [];
foreach(static::groups() as $groupname => $group) {
$groups[$groupname] = $group['readableName'] ?? $groupname;
}
return $groups;
} | php | public static function groupNames()
{
$groups = [];
foreach(static::groups() as $groupname => $group) {
$groups[$groupname] = $group['readableName'] ?? $groupname;
}
return $groups;
} | [
"public",
"static",
"function",
"groupNames",
"(",
")",
"{",
"$",
"groups",
"=",
"[",
"]",
";",
"foreach",
"(",
"static",
"::",
"groups",
"(",
")",
"as",
"$",
"groupname",
"=>",
"$",
"group",
")",
"{",
"$",
"groups",
"[",
"$",
"groupname",
"]",
"="... | Get the groups list
@return array | [
"Get",
"the",
"groups",
"list"
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/User/Group.php#L36-L45 | train | Get all the groups names | [
30522,
2270,
10763,
3853,
2177,
18442,
2015,
1006,
1007,
1063,
1002,
2967,
1027,
1031,
1033,
1025,
18921,
6776,
1006,
10763,
1024,
1024,
2967,
1006,
1007,
2004,
1002,
2177,
18442,
1027,
1028,
1002,
2177,
1007,
1063,
1002,
2967,
1031,
1002,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Database/Concerns/BuildsQueries.php | BuildsQueries.simplePaginator | protected function simplePaginator($items, $perPage, $currentPage, $options)
{
return Container::getInstance()->makeWith(Paginator::class, compact(
'items', 'perPage', 'currentPage', 'options'
));
} | php | protected function simplePaginator($items, $perPage, $currentPage, $options)
{
return Container::getInstance()->makeWith(Paginator::class, compact(
'items', 'perPage', 'currentPage', 'options'
));
} | [
"protected",
"function",
"simplePaginator",
"(",
"$",
"items",
",",
"$",
"perPage",
",",
"$",
"currentPage",
",",
"$",
"options",
")",
"{",
"return",
"Container",
"::",
"getInstance",
"(",
")",
"->",
"makeWith",
"(",
"Paginator",
"::",
"class",
",",
"compa... | Create a new simple paginator instance.
@param \Illuminate\Support\Collection $items
@param int $perPage
@param int $currentPage
@param array $options
@return \Illuminate\Pagination\Paginator | [
"Create",
"a",
"new",
"simple",
"paginator",
"instance",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Concerns/BuildsQueries.php#L155-L160 | train | Create a paginator for the items | [
30522,
5123,
3853,
3722,
4502,
20876,
4263,
1006,
1002,
5167,
1010,
1002,
2566,
13704,
1010,
1002,
2783,
13704,
1010,
1002,
7047,
1007,
1063,
2709,
11661,
1024,
1024,
2131,
7076,
26897,
1006,
1007,
1011,
1028,
2191,
24415,
1006,
6643,
20876... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/backend/widgets/MediaManager.php | MediaManager.getLocalTempFilePath | protected function getLocalTempFilePath($fileName)
{
$fileName = md5($fileName.uniqid().microtime());
$mediaFolder = Config::get('cms.storage.media.folder', 'media');
$path = temp_path() . MediaLibrary::validatePath($mediaFolder, true);
if (!File::isDirectory($path)) {
File::makeDirectory($path, 0777, true, true);
}
return $path.'/'.$fileName;
} | php | protected function getLocalTempFilePath($fileName)
{
$fileName = md5($fileName.uniqid().microtime());
$mediaFolder = Config::get('cms.storage.media.folder', 'media');
$path = temp_path() . MediaLibrary::validatePath($mediaFolder, true);
if (!File::isDirectory($path)) {
File::makeDirectory($path, 0777, true, true);
}
return $path.'/'.$fileName;
} | [
"protected",
"function",
"getLocalTempFilePath",
"(",
"$",
"fileName",
")",
"{",
"$",
"fileName",
"=",
"md5",
"(",
"$",
"fileName",
".",
"uniqid",
"(",
")",
".",
"microtime",
"(",
")",
")",
";",
"$",
"mediaFolder",
"=",
"Config",
"::",
"get",
"(",
"'cm... | Get temporary local file path
@param string $fileName
@return string | [
"Get",
"temporary",
"local",
"file",
"path"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/MediaManager.php#L1247-L1260 | train | Returns the local file path for the given file name | [
30522,
5123,
3853,
2131,
4135,
9289,
18532,
14376,
9463,
15069,
1006,
1002,
5371,
18442,
1007,
1063,
1002,
5371,
18442,
1027,
9108,
2629,
1006,
1002,
5371,
18442,
1012,
4895,
18515,
3593,
1006,
1007,
1012,
12702,
7292,
1006,
1007,
1007,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/cms/classes/Controller.php | Controller.findComponentByPartial | public function findComponentByPartial($partial)
{
foreach ($this->page->components as $component) {
if (ComponentPartial::check($component, $partial)) {
return $component;
}
}
foreach ($this->layout->components as $component) {
if (ComponentPartial::check($component, $partial)) {
return $component;
}
}
return null;
} | php | public function findComponentByPartial($partial)
{
foreach ($this->page->components as $component) {
if (ComponentPartial::check($component, $partial)) {
return $component;
}
}
foreach ($this->layout->components as $component) {
if (ComponentPartial::check($component, $partial)) {
return $component;
}
}
return null;
} | [
"public",
"function",
"findComponentByPartial",
"(",
"$",
"partial",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"page",
"->",
"components",
"as",
"$",
"component",
")",
"{",
"if",
"(",
"ComponentPartial",
"::",
"check",
"(",
"$",
"component",
",",
"$",
... | Searches the layout and page components by a partial file
@param string $partial
@return ComponentBase The component object, if found | [
"Searches",
"the",
"layout",
"and",
"page",
"components",
"by",
"a",
"partial",
"file"
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/Controller.php#L1518-L1533 | train | Find Component By Partial | [
30522,
2270,
3853,
2424,
9006,
29513,
3372,
3762,
19362,
20925,
1006,
1002,
7704,
1007,
1063,
18921,
6776,
1006,
1002,
2023,
1011,
1028,
3931,
1011,
1028,
6177,
2004,
1002,
6922,
1007,
1063,
2065,
1006,
6922,
19362,
20925,
1024,
1024,
4638,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/DependencyInjection/Compiler/ResolvePrivatesPass.php | ResolvePrivatesPass.process | public function process(ContainerBuilder $container)
{
foreach ($container->getDefinitions() as $id => $definition) {
if ($definition->isPrivate()) {
$definition->setPublic(false);
$definition->setPrivate(true);
}
}
foreach ($container->getAliases() as $id => $alias) {
if ($alias->isPrivate()) {
$alias->setPublic(false);
$alias->setPrivate(true);
}
}
} | php | public function process(ContainerBuilder $container)
{
foreach ($container->getDefinitions() as $id => $definition) {
if ($definition->isPrivate()) {
$definition->setPublic(false);
$definition->setPrivate(true);
}
}
foreach ($container->getAliases() as $id => $alias) {
if ($alias->isPrivate()) {
$alias->setPublic(false);
$alias->setPrivate(true);
}
}
} | [
"public",
"function",
"process",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"foreach",
"(",
"$",
"container",
"->",
"getDefinitions",
"(",
")",
"as",
"$",
"id",
"=>",
"$",
"definition",
")",
"{",
"if",
"(",
"$",
"definition",
"->",
"isPrivate",
... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DependencyInjection/Compiler/ResolvePrivatesPass.php#L24-L39 | train | Process the container builder | [
30522,
2270,
3853,
2832,
1006,
11661,
8569,
23891,
2099,
1002,
11661,
1007,
1063,
18921,
6776,
1006,
1002,
11661,
1011,
1028,
2131,
3207,
16294,
22753,
2015,
1006,
1007,
2004,
1002,
8909,
1027,
1028,
1002,
6210,
1007,
1063,
2065,
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... |
symfony/symfony | src/Symfony/Component/HttpKernel/Controller/TraceableArgumentResolver.php | TraceableArgumentResolver.getArguments | public function getArguments(Request $request, $controller)
{
$e = $this->stopwatch->start('controller.get_arguments');
$ret = $this->resolver->getArguments($request, $controller);
$e->stop();
return $ret;
} | php | public function getArguments(Request $request, $controller)
{
$e = $this->stopwatch->start('controller.get_arguments');
$ret = $this->resolver->getArguments($request, $controller);
$e->stop();
return $ret;
} | [
"public",
"function",
"getArguments",
"(",
"Request",
"$",
"request",
",",
"$",
"controller",
")",
"{",
"$",
"e",
"=",
"$",
"this",
"->",
"stopwatch",
"->",
"start",
"(",
"'controller.get_arguments'",
")",
";",
"$",
"ret",
"=",
"$",
"this",
"->",
"resolv... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/Controller/TraceableArgumentResolver.php#L34-L43 | train | Get the arguments of the controller | [
30522,
2270,
3853,
2131,
2906,
22850,
11187,
1006,
5227,
1002,
5227,
1010,
1002,
11486,
1007,
1063,
1002,
1041,
1027,
1002,
2023,
1011,
1028,
2644,
18866,
1011,
1028,
2707,
1006,
1005,
11486,
1012,
2131,
1035,
9918,
1005,
1007,
1025,
1002,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Database/Query/Grammars/Grammar.php | Grammar.whereSub | protected function whereSub(Builder $query, $where)
{
$select = $this->compileSelect($where['query']);
return $this->wrap($where['column']).' '.$where['operator']." ($select)";
} | php | protected function whereSub(Builder $query, $where)
{
$select = $this->compileSelect($where['query']);
return $this->wrap($where['column']).' '.$where['operator']." ($select)";
} | [
"protected",
"function",
"whereSub",
"(",
"Builder",
"$",
"query",
",",
"$",
"where",
")",
"{",
"$",
"select",
"=",
"$",
"this",
"->",
"compileSelect",
"(",
"$",
"where",
"[",
"'query'",
"]",
")",
";",
"return",
"$",
"this",
"->",
"wrap",
"(",
"$",
... | Compile a where condition with a sub-select.
@param \Illuminate\Database\Query\Builder $query
@param array $where
@return string | [
"Compile",
"a",
"where",
"condition",
"with",
"a",
"sub",
"-",
"select",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Query/Grammars/Grammar.php#L495-L500 | train | Internal method to wrap a where sub clause in a query | [
30522,
5123,
3853,
2073,
6342,
2497,
1006,
12508,
1002,
23032,
1010,
1002,
2073,
1007,
1063,
1002,
7276,
1027,
1002,
2023,
1011,
1028,
4012,
22090,
11246,
22471,
1006,
1002,
2073,
1031,
1005,
23032,
1005,
1033,
1007,
1025,
2709,
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/Form/Extension/Core/Type/CheckboxType.php | CheckboxType.buildForm | public function buildForm(FormBuilderInterface $builder, array $options)
{
// Unlike in other types, where the data is NULL by default, it
// needs to be a Boolean here. setData(null) is not acceptable
// for checkboxes and radio buttons (unless a custom model
// transformer handles this case).
// We cannot solve this case via overriding the "data" option, because
// doing so also calls setDataLocked(true).
$builder->setData(isset($options['data']) ? $options['data'] : false);
$builder->addViewTransformer(new BooleanToStringTransformer($options['value'], $options['false_values']));
} | php | public function buildForm(FormBuilderInterface $builder, array $options)
{
// Unlike in other types, where the data is NULL by default, it
// needs to be a Boolean here. setData(null) is not acceptable
// for checkboxes and radio buttons (unless a custom model
// transformer handles this case).
// We cannot solve this case via overriding the "data" option, because
// doing so also calls setDataLocked(true).
$builder->setData(isset($options['data']) ? $options['data'] : false);
$builder->addViewTransformer(new BooleanToStringTransformer($options['value'], $options['false_values']));
} | [
"public",
"function",
"buildForm",
"(",
"FormBuilderInterface",
"$",
"builder",
",",
"array",
"$",
"options",
")",
"{",
"// Unlike in other types, where the data is NULL by default, it",
"// needs to be a Boolean here. setData(null) is not acceptable",
"// for checkboxes and radio butt... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Extension/Core/Type/CheckboxType.php#L26-L36 | train | Adds the data and view transformers to the form builder | [
30522,
2270,
3853,
3857,
14192,
1006,
2433,
8569,
23891,
6657,
3334,
12172,
1002,
12508,
1010,
9140,
1002,
7047,
1007,
1063,
1013,
1013,
4406,
1999,
2060,
4127,
1010,
2073,
1996,
2951,
2003,
19701,
2011,
12398,
1010,
2009,
1013,
1013,
3791,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Workflow/MarkingStore/SingleStateMarkingStore.php | SingleStateMarkingStore.getMarking | public function getMarking($subject)
{
$placeName = $this->propertyAccessor->getValue($subject, $this->property);
if (!$placeName) {
return new Marking();
}
return new Marking([$placeName => 1]);
} | php | public function getMarking($subject)
{
$placeName = $this->propertyAccessor->getValue($subject, $this->property);
if (!$placeName) {
return new Marking();
}
return new Marking([$placeName => 1]);
} | [
"public",
"function",
"getMarking",
"(",
"$",
"subject",
")",
"{",
"$",
"placeName",
"=",
"$",
"this",
"->",
"propertyAccessor",
"->",
"getValue",
"(",
"$",
"subject",
",",
"$",
"this",
"->",
"property",
")",
";",
"if",
"(",
"!",
"$",
"placeName",
")",... | {@inheritdoc} | [
"{"
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Workflow/MarkingStore/SingleStateMarkingStore.php#L44-L53 | train | Get the Marking object | [
30522,
2270,
3853,
2131,
10665,
2075,
1006,
1002,
3395,
1007,
1063,
1002,
2173,
18442,
1027,
1002,
2023,
1011,
1028,
3200,
6305,
9623,
21748,
1011,
1028,
2131,
10175,
5657,
1006,
1002,
3395,
1010,
1002,
2023,
1011,
1028,
3200,
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... |
getgrav/grav | system/src/Grav/Common/Data/BlueprintSchema.php | BlueprintSchema.filter | public function filter(array $data, $missingValuesAsNull = false, $keepEmptyValues = false)
{
return $this->filterArray($data, $this->nested, $missingValuesAsNull, $keepEmptyValues);
} | php | public function filter(array $data, $missingValuesAsNull = false, $keepEmptyValues = false)
{
return $this->filterArray($data, $this->nested, $missingValuesAsNull, $keepEmptyValues);
} | [
"public",
"function",
"filter",
"(",
"array",
"$",
"data",
",",
"$",
"missingValuesAsNull",
"=",
"false",
",",
"$",
"keepEmptyValues",
"=",
"false",
")",
"{",
"return",
"$",
"this",
"->",
"filterArray",
"(",
"$",
"data",
",",
"$",
"this",
"->",
"nested",... | Filter data by using blueprints.
@param array $data Incoming data, for example from a form.
@param bool $missingValuesAsNull Include missing values as nulls.
@param bool $keepEmptyValues Include empty values.
@return array | [
"Filter",
"data",
"by",
"using",
"blueprints",
"."
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Data/BlueprintSchema.php#L85-L88 | train | Filter an array of data into a single level | [
30522,
2270,
3853,
11307,
1006,
9140,
1002,
2951,
1010,
1002,
4394,
10175,
15808,
3022,
11231,
3363,
1027,
6270,
1010,
1002,
2562,
6633,
13876,
2100,
10175,
15808,
1027,
6270,
1007,
1063,
2709,
1002,
2023,
1011,
1028,
11307,
2906,
9447,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/cms/classes/CmsObject.php | CmsObject.inTheme | public static function inTheme($theme)
{
if (is_string($theme)) {
$theme = Theme::load($theme);
}
return static::on($theme->getDirName());
} | php | public static function inTheme($theme)
{
if (is_string($theme)) {
$theme = Theme::load($theme);
}
return static::on($theme->getDirName());
} | [
"public",
"static",
"function",
"inTheme",
"(",
"$",
"theme",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"theme",
")",
")",
"{",
"$",
"theme",
"=",
"Theme",
"::",
"load",
"(",
"$",
"theme",
")",
";",
"}",
"return",
"static",
"::",
"on",
"(",
"$"... | Prepares the theme datasource for the model.
@param \Cms\Classes\Theme $theme Specifies a parent theme.
@return $this | [
"Prepares",
"the",
"theme",
"datasource",
"for",
"the",
"model",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/CmsObject.php#L178-L185 | train | Return the current context for the given theme | [
30522,
2270,
10763,
3853,
20014,
29122,
2063,
1006,
1002,
4323,
1007,
1063,
2065,
1006,
2003,
1035,
5164,
1006,
1002,
4323,
1007,
1007,
1063,
1002,
4323,
1027,
4323,
1024,
1024,
7170,
30524,
1024,
1024,
2006,
1006,
1002,
4323,
1011,
1028,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
symfony/symfony | src/Symfony/Component/Process/Process.php | Process.getDescriptors | private function getDescriptors(): array
{
if ($this->input instanceof \Iterator) {
$this->input->rewind();
}
if ('\\' === \DIRECTORY_SEPARATOR) {
$this->processPipes = new WindowsPipes($this->input, !$this->outputDisabled || $this->hasCallback);
} else {
$this->processPipes = new UnixPipes($this->isTty(), $this->isPty(), $this->input, !$this->outputDisabled || $this->hasCallback);
}
return $this->processPipes->getDescriptors();
} | php | private function getDescriptors(): array
{
if ($this->input instanceof \Iterator) {
$this->input->rewind();
}
if ('\\' === \DIRECTORY_SEPARATOR) {
$this->processPipes = new WindowsPipes($this->input, !$this->outputDisabled || $this->hasCallback);
} else {
$this->processPipes = new UnixPipes($this->isTty(), $this->isPty(), $this->input, !$this->outputDisabled || $this->hasCallback);
}
return $this->processPipes->getDescriptors();
} | [
"private",
"function",
"getDescriptors",
"(",
")",
":",
"array",
"{",
"if",
"(",
"$",
"this",
"->",
"input",
"instanceof",
"\\",
"Iterator",
")",
"{",
"$",
"this",
"->",
"input",
"->",
"rewind",
"(",
")",
";",
"}",
"if",
"(",
"'\\\\'",
"===",
"\\",
... | Creates the descriptors needed by the proc_open. | [
"Creates",
"the",
"descriptors",
"needed",
"by",
"the",
"proc_open",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Process/Process.php#L1283-L1295 | train | Get descriptors from input | [
30522,
2797,
3853,
2131,
6155,
23235,
5668,
1006,
1007,
1024,
9140,
1063,
2065,
1006,
1002,
2023,
1011,
1028,
7953,
6013,
11253,
1032,
2009,
6906,
4263,
1007,
1063,
1002,
2023,
1011,
1028,
7953,
1011,
1028,
2128,
11101,
1006,
1007,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getgrav/grav | system/src/Grav/Common/Twig/TwigExtension.php | TwigExtension.containsFilter | public function containsFilter($haystack, $needle)
{
if (empty($needle)) {
return $haystack;
}
return (strpos($haystack, (string) $needle) !== false);
} | php | public function containsFilter($haystack, $needle)
{
if (empty($needle)) {
return $haystack;
}
return (strpos($haystack, (string) $needle) !== false);
} | [
"public",
"function",
"containsFilter",
"(",
"$",
"haystack",
",",
"$",
"needle",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"needle",
")",
")",
"{",
"return",
"$",
"haystack",
";",
"}",
"return",
"(",
"strpos",
"(",
"$",
"haystack",
",",
"(",
"string",... | determine if a string contains another
@param string $haystack
@param string $needle
@return bool | [
"determine",
"if",
"a",
"string",
"contains",
"another"
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Twig/TwigExtension.php#L448-L455 | train | Return true if the string contains the specified filter | [
30522,
2270,
3853,
3397,
8873,
21928,
1006,
1002,
29051,
2696,
3600,
1010,
1002,
12201,
1007,
1063,
2065,
1006,
4064,
1006,
1002,
12201,
1007,
1007,
1063,
2709,
1002,
29051,
2696,
3600,
1025,
1065,
2709,
1006,
2358,
14536,
2891,
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... |
getgrav/grav | system/src/Grav/Common/Session.php | Session.init | public function init()
{
if ($this->autoStart && !$this->isStarted()) {
$this->start();
$this->autoStart = false;
}
} | php | public function init()
{
if ($this->autoStart && !$this->isStarted()) {
$this->start();
$this->autoStart = false;
}
} | [
"public",
"function",
"init",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"autoStart",
"&&",
"!",
"$",
"this",
"->",
"isStarted",
"(",
")",
")",
"{",
"$",
"this",
"->",
"start",
"(",
")",
";",
"$",
"this",
"->",
"autoStart",
"=",
"false",
";",
... | Initialize session.
Code in this function has been moved into SessionServiceProvider class. | [
"Initialize",
"session",
"."
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Session.php#L35-L42 | train | Initiates the exception | [
30522,
2270,
3853,
1999,
4183,
1006,
1007,
1063,
2065,
1006,
1002,
2023,
1011,
1028,
8285,
14117,
2102,
1004,
1004,
999,
1002,
2023,
1011,
1028,
26354,
7559,
3064,
1006,
1007,
1007,
1063,
1002,
2023,
1011,
1028,
2707,
1006,
1007,
1025,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Queue/Listener.php | Listener.handleWorkerOutput | protected function handleWorkerOutput($type, $line)
{
if (isset($this->outputHandler)) {
call_user_func($this->outputHandler, $type, $line);
}
} | php | protected function handleWorkerOutput($type, $line)
{
if (isset($this->outputHandler)) {
call_user_func($this->outputHandler, $type, $line);
}
} | [
"protected",
"function",
"handleWorkerOutput",
"(",
"$",
"type",
",",
"$",
"line",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"outputHandler",
")",
")",
"{",
"call_user_func",
"(",
"$",
"this",
"->",
"outputHandler",
",",
"$",
"type",
",",
"... | Handle output from the worker process.
@param int $type
@param string $line
@return void | [
"Handle",
"output",
"from",
"the",
"worker",
"process",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Queue/Listener.php#L192-L197 | train | Handle output from worker | [
30522,
5123,
3853,
5047,
6198,
10624,
4904,
18780,
1006,
1002,
2828,
1010,
1002,
2240,
1007,
1063,
2065,
1006,
26354,
3388,
1006,
1002,
2023,
1011,
1028,
6434,
11774,
3917,
1007,
1007,
1063,
2655,
1035,
5310,
1035,
4569,
2278,
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/Validation/Validator.php | Validator.passesOptionalCheck | protected function passesOptionalCheck($attribute)
{
if (! $this->hasRule($attribute, ['Sometimes'])) {
return true;
}
$data = ValidationData::initializeAndGatherData($attribute, $this->data);
return array_key_exists($attribute, $data)
|| array_key_exists($attribute, $this->data);
} | php | protected function passesOptionalCheck($attribute)
{
if (! $this->hasRule($attribute, ['Sometimes'])) {
return true;
}
$data = ValidationData::initializeAndGatherData($attribute, $this->data);
return array_key_exists($attribute, $data)
|| array_key_exists($attribute, $this->data);
} | [
"protected",
"function",
"passesOptionalCheck",
"(",
"$",
"attribute",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasRule",
"(",
"$",
"attribute",
",",
"[",
"'Sometimes'",
"]",
")",
")",
"{",
"return",
"true",
";",
"}",
"$",
"data",
"=",
"Validation... | Determine if the attribute passes any optional check.
@param string $attribute
@return bool | [
"Determine",
"if",
"the",
"attribute",
"passes",
"any",
"optional",
"check",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Validation/Validator.php#L520-L530 | train | Checks if the attribute passes the optional check | [
30522,
5123,
3853,
5235,
7361,
3508,
2389,
5403,
3600,
1006,
1002,
17961,
1007,
1063,
2065,
1006,
999,
1002,
2023,
1011,
1028,
2038,
6820,
2571,
1006,
1002,
17961,
1010,
1031,
1005,
2823,
1005,
1033,
1007,
1007,
1063,
2709,
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... |
matomo-org/matomo | plugins/Referrers/Columns/Base.php | Base.getReferrerInformation | protected function getReferrerInformation($referrerUrl, $currentUrl, $idSite, Request $request, Visitor $visitor)
{
$this->idsite = $idSite;
// default values for the referer_* fields
$referrerUrl = Common::unsanitizeInputValue($referrerUrl);
if (!empty($referrerUrl)
&& !UrlHelper::isLookLikeUrl($referrerUrl)
) {
$referrerUrl = '';
}
$currentUrl = PageUrl::cleanupUrl($currentUrl);
$this->referrerUrl = $referrerUrl;
$this->referrerUrlParse = @parse_url($this->referrerUrl);
$this->currentUrlParse = @parse_url($currentUrl);
$this->typeReferrerAnalyzed = Common::REFERRER_TYPE_DIRECT_ENTRY;
$this->nameReferrerAnalyzed = '';
$this->keywordReferrerAnalyzed = '';
$this->referrerHost = '';
if (isset($this->referrerUrlParse['host'])) {
$this->referrerHost = $this->referrerUrlParse['host'];
}
$referrerDetected = $this->detectReferrerCampaign($request, $visitor);
if (!$referrerDetected) {
if ($this->detectReferrerDirectEntry()
|| $this->detectReferrerSearchEngine()
|| $this->detectReferrerSocialNetwork()
) {
$referrerDetected = true;
}
}
if (!$referrerDetected && !empty($this->referrerHost)) {
$this->typeReferrerAnalyzed = Common::REFERRER_TYPE_WEBSITE;
$this->nameReferrerAnalyzed = Common::mb_strtolower($this->referrerHost);
$urlsByHost = $this->getCachedUrlsByHostAndIdSite();
$directEntry = new SiteUrls();
$path = $directEntry->getPathMatchingUrl($this->referrerUrlParse, $urlsByHost);
if (!empty($path) && $path !== '/') {
$this->nameReferrerAnalyzed .= rtrim($path, '/');
}
}
$referrerInformation = array(
'referer_type' => $this->typeReferrerAnalyzed,
'referer_name' => $this->nameReferrerAnalyzed,
'referer_keyword' => $this->keywordReferrerAnalyzed,
'referer_url' => $this->referrerUrl,
);
if (!empty($referrerInformation['referer_name'])) {
$referrerInformation['referer_name'] = $this->truncateReferrerName($referrerInformation['referer_name']);
}
if (!empty($referrerInformation['referer_keyword'])) {
$referrerInformation['referer_keyword'] = $this->truncateReferrerKeyword($referrerInformation['referer_keyword']);
}
return $referrerInformation;
} | php | protected function getReferrerInformation($referrerUrl, $currentUrl, $idSite, Request $request, Visitor $visitor)
{
$this->idsite = $idSite;
// default values for the referer_* fields
$referrerUrl = Common::unsanitizeInputValue($referrerUrl);
if (!empty($referrerUrl)
&& !UrlHelper::isLookLikeUrl($referrerUrl)
) {
$referrerUrl = '';
}
$currentUrl = PageUrl::cleanupUrl($currentUrl);
$this->referrerUrl = $referrerUrl;
$this->referrerUrlParse = @parse_url($this->referrerUrl);
$this->currentUrlParse = @parse_url($currentUrl);
$this->typeReferrerAnalyzed = Common::REFERRER_TYPE_DIRECT_ENTRY;
$this->nameReferrerAnalyzed = '';
$this->keywordReferrerAnalyzed = '';
$this->referrerHost = '';
if (isset($this->referrerUrlParse['host'])) {
$this->referrerHost = $this->referrerUrlParse['host'];
}
$referrerDetected = $this->detectReferrerCampaign($request, $visitor);
if (!$referrerDetected) {
if ($this->detectReferrerDirectEntry()
|| $this->detectReferrerSearchEngine()
|| $this->detectReferrerSocialNetwork()
) {
$referrerDetected = true;
}
}
if (!$referrerDetected && !empty($this->referrerHost)) {
$this->typeReferrerAnalyzed = Common::REFERRER_TYPE_WEBSITE;
$this->nameReferrerAnalyzed = Common::mb_strtolower($this->referrerHost);
$urlsByHost = $this->getCachedUrlsByHostAndIdSite();
$directEntry = new SiteUrls();
$path = $directEntry->getPathMatchingUrl($this->referrerUrlParse, $urlsByHost);
if (!empty($path) && $path !== '/') {
$this->nameReferrerAnalyzed .= rtrim($path, '/');
}
}
$referrerInformation = array(
'referer_type' => $this->typeReferrerAnalyzed,
'referer_name' => $this->nameReferrerAnalyzed,
'referer_keyword' => $this->keywordReferrerAnalyzed,
'referer_url' => $this->referrerUrl,
);
if (!empty($referrerInformation['referer_name'])) {
$referrerInformation['referer_name'] = $this->truncateReferrerName($referrerInformation['referer_name']);
}
if (!empty($referrerInformation['referer_keyword'])) {
$referrerInformation['referer_keyword'] = $this->truncateReferrerKeyword($referrerInformation['referer_keyword']);
}
return $referrerInformation;
} | [
"protected",
"function",
"getReferrerInformation",
"(",
"$",
"referrerUrl",
",",
"$",
"currentUrl",
",",
"$",
"idSite",
",",
"Request",
"$",
"request",
",",
"Visitor",
"$",
"visitor",
")",
"{",
"$",
"this",
"->",
"idsite",
"=",
"$",
"idSite",
";",
"// defa... | Returns an array containing the following information:
- referer_type
- direct -- absence of referrer URL OR referrer URL has the same host
- site -- based on the referrer URL
- search_engine -- based on the referrer URL
- campaign -- based on campaign URL parameter
- referer_name
- ()
- piwik.net -- site host name
- google.fr -- search engine host name
- adwords-search -- campaign name
- referer_keyword
- ()
- ()
- my keyword
- my paid keyword
- ()
- ()
- referer_url : the same for all the referrer types
@param string $referrerUrl must be URL Encoded
@param string $currentUrl
@param int $idSite
@return array | [
"Returns",
"an",
"array",
"containing",
"the",
"following",
"information",
":",
"-",
"referer_type",
"-",
"direct",
"--",
"absence",
"of",
"referrer",
"URL",
"OR",
"referrer",
"URL",
"has",
"the",
"same",
"host",
"-",
"site",
"--",
"based",
"on",
"the",
"r... | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Referrers/Columns/Base.php#L70-L136 | train | Get Referrer Information | [
30522,
5123,
3853,
2131,
2890,
7512,
14544,
2378,
14192,
3370,
1006,
1002,
6523,
14544,
3126,
2140,
1010,
1002,
2783,
3126,
2140,
1010,
1002,
8909,
28032,
2063,
1010,
5227,
1002,
5227,
1010,
10367,
1002,
10367,
1007,
1063,
1002,
2023,
1011,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/backend/models/Preference.php | Preference.getFallbackLocale | protected function getFallbackLocale($locale)
{
if ($position = strpos($locale, '-')) {
$target = substr($locale, 0, $position);
$available = $this->getLocaleOptions();
if (isset($available[$target])) {
return $target;
}
}
return Config::get('app.fallback_locale');
} | php | protected function getFallbackLocale($locale)
{
if ($position = strpos($locale, '-')) {
$target = substr($locale, 0, $position);
$available = $this->getLocaleOptions();
if (isset($available[$target])) {
return $target;
}
}
return Config::get('app.fallback_locale');
} | [
"protected",
"function",
"getFallbackLocale",
"(",
"$",
"locale",
")",
"{",
"if",
"(",
"$",
"position",
"=",
"strpos",
"(",
"$",
"locale",
",",
"'-'",
")",
")",
"{",
"$",
"target",
"=",
"substr",
"(",
"$",
"locale",
",",
"0",
",",
"$",
"position",
... | Attempt to extract the language from the locale,
otherwise use the configuration.
@return string | [
"Attempt",
"to",
"extract",
"the",
"language",
"from",
"the",
"locale",
"otherwise",
"use",
"the",
"configuration",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/models/Preference.php#L161-L172 | train | Returns the fallback locale | [
30522,
5123,
3853,
2131,
13976,
5963,
4135,
9289,
2063,
1006,
1002,
2334,
2063,
1007,
1063,
30524,
2015,
1006,
1007,
1025,
2065,
1006,
26354,
3388,
1006,
1002,
2800,
1031,
1002,
4539,
1033,
1007,
1007,
1063,
2709,
1002,
4539,
1025,
1065,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/Zend/Mail/Storage/Writable/Maildir.php | Zend_Mail_Storage_Writable_Maildir.renameFolder | public function renameFolder($oldName, $newName)
{
// TODO: This is also not atomar and has similar problems as removeFolder()
if ($oldName instanceof Zend_Mail_Storage_Folder) {
$oldName = $oldName->getGlobalName();
}
$oldName = trim($oldName, $this->_delim);
if (strpos($oldName, 'INBOX' . $this->_delim) === 0) {
$oldName = substr($oldName, 6);
}
$newName = trim($newName, $this->_delim);
if (strpos($newName, 'INBOX' . $this->_delim) === 0) {
$newName = substr($newName, 6);
}
if (strpos($newName, $oldName . $this->_delim) === 0) {
/**
* @see Zend_Mail_Storage_Exception
*/
// require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('new folder cannot be a child of old folder');
}
// check if folder exists and has no children
$folder = $this->getFolders($oldName);
if ($oldName == 'INBOX' || $oldName == DIRECTORY_SEPARATOR || $oldName == '/') {
/**
* @see Zend_Mail_Storage_Exception
*/
// require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('wont rename INBOX');
}
if ($oldName == $this->getCurrentFolder()) {
/**
* @see Zend_Mail_Storage_Exception
*/
// require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('wont rename selected folder');
}
$newdir = $this->createFolder($newName);
if (!$folder->isLeaf()) {
foreach ($folder as $k => $v) {
$this->renameFolder($v->getGlobalName(), $newName . $this->_delim . $k);
}
}
$olddir = $this->_rootdir . '.' . $folder;
foreach (array('tmp', 'new', 'cur') as $subdir) {
$subdir = DIRECTORY_SEPARATOR . $subdir;
if (!file_exists($olddir . $subdir)) {
continue;
}
// using copy or moving files would be even better - but also much slower
if (!rename($olddir . $subdir, $newdir . $subdir)) {
/**
* @see Zend_Mail_Storage_Exception
*/
// require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('error while moving ' . $subdir);
}
}
// create a dummy if removing fails - otherwise we can't read it next time
mkdir($olddir . DIRECTORY_SEPARATOR . 'cur');
$this->removeFolder($oldName);
} | php | public function renameFolder($oldName, $newName)
{
// TODO: This is also not atomar and has similar problems as removeFolder()
if ($oldName instanceof Zend_Mail_Storage_Folder) {
$oldName = $oldName->getGlobalName();
}
$oldName = trim($oldName, $this->_delim);
if (strpos($oldName, 'INBOX' . $this->_delim) === 0) {
$oldName = substr($oldName, 6);
}
$newName = trim($newName, $this->_delim);
if (strpos($newName, 'INBOX' . $this->_delim) === 0) {
$newName = substr($newName, 6);
}
if (strpos($newName, $oldName . $this->_delim) === 0) {
/**
* @see Zend_Mail_Storage_Exception
*/
// require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('new folder cannot be a child of old folder');
}
// check if folder exists and has no children
$folder = $this->getFolders($oldName);
if ($oldName == 'INBOX' || $oldName == DIRECTORY_SEPARATOR || $oldName == '/') {
/**
* @see Zend_Mail_Storage_Exception
*/
// require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('wont rename INBOX');
}
if ($oldName == $this->getCurrentFolder()) {
/**
* @see Zend_Mail_Storage_Exception
*/
// require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('wont rename selected folder');
}
$newdir = $this->createFolder($newName);
if (!$folder->isLeaf()) {
foreach ($folder as $k => $v) {
$this->renameFolder($v->getGlobalName(), $newName . $this->_delim . $k);
}
}
$olddir = $this->_rootdir . '.' . $folder;
foreach (array('tmp', 'new', 'cur') as $subdir) {
$subdir = DIRECTORY_SEPARATOR . $subdir;
if (!file_exists($olddir . $subdir)) {
continue;
}
// using copy or moving files would be even better - but also much slower
if (!rename($olddir . $subdir, $newdir . $subdir)) {
/**
* @see Zend_Mail_Storage_Exception
*/
// require_once 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('error while moving ' . $subdir);
}
}
// create a dummy if removing fails - otherwise we can't read it next time
mkdir($olddir . DIRECTORY_SEPARATOR . 'cur');
$this->removeFolder($oldName);
} | [
"public",
"function",
"renameFolder",
"(",
"$",
"oldName",
",",
"$",
"newName",
")",
"{",
"// TODO: This is also not atomar and has similar problems as removeFolder()",
"if",
"(",
"$",
"oldName",
"instanceof",
"Zend_Mail_Storage_Folder",
")",
"{",
"$",
"oldName",
"=",
"... | rename and/or move folder
The new name has the same restrictions as in createFolder()
@param string|Zend_Mail_Storage_Folder $oldName name or instance of folder
@param string $newName new global name of folder
@return null
@throws Zend_Mail_Storage_Exception | [
"rename",
"and",
"/",
"or",
"move",
"folder"
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Mail/Storage/Writable/Maildir.php#L326-L397 | train | Rename folder in folder | [
30522,
2270,
3853,
14916,
14074,
10371,
2121,
1006,
1002,
2214,
18442,
1010,
1002,
2047,
18442,
1007,
1063,
1013,
1013,
28681,
2080,
1024,
2023,
2003,
2036,
2025,
13787,
2906,
1998,
2038,
2714,
3471,
2004,
6366,
10371,
2121,
1006,
1007,
206... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octobercms/october | modules/backend/widgets/Filter.php | Filter.filterOptionsBySearch | protected function filterOptionsBySearch($options, $query)
{
$filteredOptions = [];
$optionMatchesSearch = function ($words, $option) {
foreach ($words as $word) {
$word = trim($word);
if (!strlen($word)) {
continue;
}
if (!Str::contains(Str::lower($option), $word)) {
return false;
}
}
return true;
};
/*
* Exact
*/
foreach ($options as $index => $option) {
if (Str::is(Str::lower($option), $query)) {
$filteredOptions[$index] = $option;
unset($options[$index]);
}
}
/*
* Fuzzy
*/
$words = explode(' ', $query);
foreach ($options as $index => $option) {
if ($optionMatchesSearch($words, $option)) {
$filteredOptions[$index] = $option;
}
}
return $filteredOptions;
} | php | protected function filterOptionsBySearch($options, $query)
{
$filteredOptions = [];
$optionMatchesSearch = function ($words, $option) {
foreach ($words as $word) {
$word = trim($word);
if (!strlen($word)) {
continue;
}
if (!Str::contains(Str::lower($option), $word)) {
return false;
}
}
return true;
};
/*
* Exact
*/
foreach ($options as $index => $option) {
if (Str::is(Str::lower($option), $query)) {
$filteredOptions[$index] = $option;
unset($options[$index]);
}
}
/*
* Fuzzy
*/
$words = explode(' ', $query);
foreach ($options as $index => $option) {
if ($optionMatchesSearch($words, $option)) {
$filteredOptions[$index] = $option;
}
}
return $filteredOptions;
} | [
"protected",
"function",
"filterOptionsBySearch",
"(",
"$",
"options",
",",
"$",
"query",
")",
"{",
"$",
"filteredOptions",
"=",
"[",
"]",
";",
"$",
"optionMatchesSearch",
"=",
"function",
"(",
"$",
"words",
",",
"$",
"option",
")",
"{",
"foreach",
"(",
... | Filters an array of options by a search term.
@param array $options
@param string $query
@return array | [
"Filters",
"an",
"array",
"of",
"options",
"by",
"a",
"search",
"term",
"."
] | 3118660d834f161d513da08477be92281a2eb96a | https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/Filter.php#L459-L499 | train | Filters options by search | [
30522,
5123,
3853,
11307,
7361,
9285,
3762,
17310,
11140,
1006,
1002,
7047,
1010,
1002,
23032,
1007,
1063,
1002,
21839,
7361,
9285,
1027,
1031,
1033,
1025,
1002,
5724,
18900,
8376,
17310,
11140,
1027,
3853,
1006,
1002,
2616,
1010,
1002,
572... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | plugins/SitesManager/API.php | API.setGlobalExcludedQueryParameters | public function setGlobalExcludedQueryParameters($excludedQueryParameters)
{
Piwik::checkUserHasSuperUserAccess();
$excludedQueryParameters = $this->checkAndReturnCommaSeparatedStringList($excludedQueryParameters);
Option::set(self::OPTION_EXCLUDED_QUERY_PARAMETERS_GLOBAL, $excludedQueryParameters);
Cache::deleteTrackerCache();
return true;
} | php | public function setGlobalExcludedQueryParameters($excludedQueryParameters)
{
Piwik::checkUserHasSuperUserAccess();
$excludedQueryParameters = $this->checkAndReturnCommaSeparatedStringList($excludedQueryParameters);
Option::set(self::OPTION_EXCLUDED_QUERY_PARAMETERS_GLOBAL, $excludedQueryParameters);
Cache::deleteTrackerCache();
return true;
} | [
"public",
"function",
"setGlobalExcludedQueryParameters",
"(",
"$",
"excludedQueryParameters",
")",
"{",
"Piwik",
"::",
"checkUserHasSuperUserAccess",
"(",
")",
";",
"$",
"excludedQueryParameters",
"=",
"$",
"this",
"->",
"checkAndReturnCommaSeparatedStringList",
"(",
"$"... | Sets list of URL query parameters to be excluded on all websites.
Will also apply to websites created in the future.
@param string $excludedQueryParameters Comma separated list of URL query parameters to exclude from URLs
@return bool | [
"Sets",
"list",
"of",
"URL",
"query",
"parameters",
"to",
"be",
"excluded",
"on",
"all",
"websites",
".",
"Will",
"also",
"apply",
"to",
"websites",
"created",
"in",
"the",
"future",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/SitesManager/API.php#L1129-L1136 | train | Sets the list of query parameters that should be excluded from the query. | [
30522,
2270,
3853,
2275,
23296,
16429,
9453,
2595,
20464,
13936,
4226,
2854,
28689,
22828,
2015,
1006,
1002,
12421,
4226,
2854,
28689,
22828,
2015,
1007,
1063,
14255,
9148,
2243,
1024,
1024,
4638,
20330,
14949,
6342,
4842,
20330,
6305,
9623,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getgrav/grav | system/src/Grav/Common/Assets/Traits/AssetUtilsTrait.php | AssetUtilsTrait.gatherLinks | protected function gatherLinks(array $assets, $css = true)
{
$buffer = '';
foreach ($assets as $id => $asset) {
$local = true;
$link = $asset->getAsset();
$relative_path = $link;
if (static::isRemoteLink($link)) {
$local = false;
if (0 === strpos($link, '//')) {
$link = 'http:' . $link;
}
$relative_dir = \dirname($relative_path);
} else {
// Fix to remove relative dir if grav is in one
if (($this->base_url !== '/') && Utils::startsWith($relative_path, $this->base_url)) {
$base_url = '#' . preg_quote($this->base_url, '#') . '#';
$relative_path = ltrim(preg_replace($base_url, '/', $link, 1), '/');
}
$relative_dir = \dirname($relative_path);
$link = ROOT_DIR . $relative_path;
}
$file = ($this->fetch_command instanceof \Closure) ? @$this->fetch_command->__invoke($link) : @file_get_contents($link);
// No file found, skip it...
if ($file === false) {
continue;
}
// Double check last character being
if (!$css) {
$file = rtrim($file, ' ;') . ';';
}
// If this is CSS + the file is local + rewrite enabled
if ($css && $this->css_rewrite) {
$file = $this->cssRewrite($file, $relative_dir, $local);
}
$file = rtrim($file) . PHP_EOL;
$buffer .= $file;
}
// Pull out @imports and move to top
if ($css) {
$buffer = $this->moveImports($buffer);
}
return $buffer;
} | php | protected function gatherLinks(array $assets, $css = true)
{
$buffer = '';
foreach ($assets as $id => $asset) {
$local = true;
$link = $asset->getAsset();
$relative_path = $link;
if (static::isRemoteLink($link)) {
$local = false;
if (0 === strpos($link, '//')) {
$link = 'http:' . $link;
}
$relative_dir = \dirname($relative_path);
} else {
// Fix to remove relative dir if grav is in one
if (($this->base_url !== '/') && Utils::startsWith($relative_path, $this->base_url)) {
$base_url = '#' . preg_quote($this->base_url, '#') . '#';
$relative_path = ltrim(preg_replace($base_url, '/', $link, 1), '/');
}
$relative_dir = \dirname($relative_path);
$link = ROOT_DIR . $relative_path;
}
$file = ($this->fetch_command instanceof \Closure) ? @$this->fetch_command->__invoke($link) : @file_get_contents($link);
// No file found, skip it...
if ($file === false) {
continue;
}
// Double check last character being
if (!$css) {
$file = rtrim($file, ' ;') . ';';
}
// If this is CSS + the file is local + rewrite enabled
if ($css && $this->css_rewrite) {
$file = $this->cssRewrite($file, $relative_dir, $local);
}
$file = rtrim($file) . PHP_EOL;
$buffer .= $file;
}
// Pull out @imports and move to top
if ($css) {
$buffer = $this->moveImports($buffer);
}
return $buffer;
} | [
"protected",
"function",
"gatherLinks",
"(",
"array",
"$",
"assets",
",",
"$",
"css",
"=",
"true",
")",
"{",
"$",
"buffer",
"=",
"''",
";",
"foreach",
"(",
"$",
"assets",
"as",
"$",
"id",
"=>",
"$",
"asset",
")",
"{",
"$",
"local",
"=",
"true",
"... | Download and concatenate the content of several links.
@param array $assets
@param bool $css
@return string | [
"Download",
"and",
"concatenate",
"the",
"content",
"of",
"several",
"links",
"."
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Assets/Traits/AssetUtilsTrait.php#L44-L99 | train | Gathers all links from asset list | [
30522,
5123,
3853,
8587,
13767,
2015,
1006,
9140,
1002,
7045,
1010,
1002,
20116,
2015,
1027,
2995,
1007,
1063,
1002,
17698,
1027,
1005,
1005,
1025,
18921,
6776,
1006,
1002,
7045,
2004,
1002,
8909,
1027,
1028,
1002,
11412,
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/HttpFoundation/Response.php | Response.isCacheable | public function isCacheable(): bool
{
if (!\in_array($this->statusCode, [200, 203, 300, 301, 302, 404, 410])) {
return false;
}
if ($this->headers->hasCacheControlDirective('no-store') || $this->headers->getCacheControlDirective('private')) {
return false;
}
return $this->isValidateable() || $this->isFresh();
} | php | public function isCacheable(): bool
{
if (!\in_array($this->statusCode, [200, 203, 300, 301, 302, 404, 410])) {
return false;
}
if ($this->headers->hasCacheControlDirective('no-store') || $this->headers->getCacheControlDirective('private')) {
return false;
}
return $this->isValidateable() || $this->isFresh();
} | [
"public",
"function",
"isCacheable",
"(",
")",
":",
"bool",
"{",
"if",
"(",
"!",
"\\",
"in_array",
"(",
"$",
"this",
"->",
"statusCode",
",",
"[",
"200",
",",
"203",
",",
"300",
",",
"301",
",",
"302",
",",
"404",
",",
"410",
"]",
")",
")",
"{"... | Returns true if the response may safely be kept in a shared (surrogate) cache.
Responses marked "private" with an explicit Cache-Control directive are
considered uncacheable.
Responses with neither a freshness lifetime (Expires, max-age) nor cache
validator (Last-Modified, ETag) are considered uncacheable because there is
no way to tell when or how to remove them from the cache.
Note that RFC 7231 and RFC 7234 possibly allow for a more permissive implementation,
for example "status codes that are defined as cacheable by default [...]
can be reused by a cache with heuristic expiration unless otherwise indicated"
(https://tools.ietf.org/html/rfc7231#section-6.1)
@final | [
"Returns",
"true",
"if",
"the",
"response",
"may",
"safely",
"be",
"kept",
"in",
"a",
"shared",
"(",
"surrogate",
")",
"cache",
"."
] | b82b09eefb084e487997f4af753400d721edd0a8 | https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpFoundation/Response.php#L530-L541 | train | Is Cacheable - Returns true if response is cacheable false if response is not fresh | [
30522,
2270,
3853,
2003,
3540,
5403,
3085,
1006,
1007,
1024,
22017,
2140,
1063,
2065,
1006,
999,
1032,
1999,
1035,
9140,
1006,
1002,
2023,
1011,
1028,
3570,
16044,
1010,
1031,
3263,
1010,
18540,
1010,
3998,
1010,
19123,
1010,
22060,
1010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Queue/Jobs/SqsJob.php | SqsJob.release | public function release($delay = 0)
{
parent::release($delay);
$this->sqs->changeMessageVisibility([
'QueueUrl' => $this->queue,
'ReceiptHandle' => $this->job['ReceiptHandle'],
'VisibilityTimeout' => $delay,
]);
} | php | public function release($delay = 0)
{
parent::release($delay);
$this->sqs->changeMessageVisibility([
'QueueUrl' => $this->queue,
'ReceiptHandle' => $this->job['ReceiptHandle'],
'VisibilityTimeout' => $delay,
]);
} | [
"public",
"function",
"release",
"(",
"$",
"delay",
"=",
"0",
")",
"{",
"parent",
"::",
"release",
"(",
"$",
"delay",
")",
";",
"$",
"this",
"->",
"sqs",
"->",
"changeMessageVisibility",
"(",
"[",
"'QueueUrl'",
"=>",
"$",
"this",
"->",
"queue",
",",
... | Release the job back into the queue.
@param int $delay
@return void | [
"Release",
"the",
"job",
"back",
"into",
"the",
"queue",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Queue/Jobs/SqsJob.php#L50-L59 | train | Release the message | [
30522,
2270,
3853,
2713,
1006,
1002,
8536,
1027,
1014,
1007,
1063,
30524,
1006,
1002,
8536,
1007,
1025,
1002,
2023,
1011,
1028,
5490,
2015,
1011,
1028,
2689,
7834,
3736,
3351,
11365,
13464,
1006,
1031,
1005,
24240,
3126,
2140,
1005,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getgrav/grav | system/src/Grav/Framework/Psr7/Traits/ResponseDecoratorTrait.php | ResponseDecoratorTrait.withStatus | public function withStatus($code, $reasonPhrase = ''): self
{
$new = clone $this;
$new->message = $this->getResponse()->withStatus($code, $reasonPhrase);
return $new;
} | php | public function withStatus($code, $reasonPhrase = ''): self
{
$new = clone $this;
$new->message = $this->getResponse()->withStatus($code, $reasonPhrase);
return $new;
} | [
"public",
"function",
"withStatus",
"(",
"$",
"code",
",",
"$",
"reasonPhrase",
"=",
"''",
")",
":",
"self",
"{",
"$",
"new",
"=",
"clone",
"$",
"this",
";",
"$",
"new",
"->",
"message",
"=",
"$",
"this",
"->",
"getResponse",
"(",
")",
"->",
"withS... | {@inheritdoc} | [
"{"
] | 1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72 | https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Framework/Psr7/Traits/ResponseDecoratorTrait.php#L67-L73 | train | Create a new response with status code and phrase | [
30522,
2270,
3853,
2007,
9153,
5809,
1006,
1002,
3642,
1010,
1002,
3114,
8458,
23797,
1027,
1005,
1005,
1007,
1024,
2969,
1063,
1002,
2047,
1027,
17598,
1002,
2023,
1025,
1002,
2047,
1011,
1028,
4471,
1027,
1002,
2023,
1011,
1028,
2131,
6... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
laravel/framework | src/Illuminate/Filesystem/FilesystemAdapter.php | FilesystemAdapter.getAwsUrl | protected function getAwsUrl($adapter, $path)
{
// If an explicit base URL has been set on the disk configuration then we will use
// it as the base URL instead of the default path. This allows the developer to
// have full control over the base path for this filesystem's generated URLs.
if (! is_null($url = $this->driver->getConfig()->get('url'))) {
return $this->concatPathToUrl($url, $adapter->getPathPrefix().$path);
}
return $adapter->getClient()->getObjectUrl(
$adapter->getBucket(), $adapter->getPathPrefix().$path
);
} | php | protected function getAwsUrl($adapter, $path)
{
// If an explicit base URL has been set on the disk configuration then we will use
// it as the base URL instead of the default path. This allows the developer to
// have full control over the base path for this filesystem's generated URLs.
if (! is_null($url = $this->driver->getConfig()->get('url'))) {
return $this->concatPathToUrl($url, $adapter->getPathPrefix().$path);
}
return $adapter->getClient()->getObjectUrl(
$adapter->getBucket(), $adapter->getPathPrefix().$path
);
} | [
"protected",
"function",
"getAwsUrl",
"(",
"$",
"adapter",
",",
"$",
"path",
")",
"{",
"// If an explicit base URL has been set on the disk configuration then we will use",
"// it as the base URL instead of the default path. This allows the developer to",
"// have full control over the bas... | Get the URL for the file at the given path.
@param \League\Flysystem\AwsS3v3\AwsS3Adapter $adapter
@param string $path
@return string | [
"Get",
"the",
"URL",
"for",
"the",
"file",
"at",
"the",
"given",
"path",
"."
] | 0e0a428a50fc8378e3f77d18f3caae76c19e8c7a | https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Filesystem/FilesystemAdapter.php#L445-L457 | train | Get the AWS URL for a given path | [
30522,
5123,
3853,
2131,
10376,
26210,
2140,
1006,
1002,
15581,
2121,
1010,
1002,
4130,
1007,
1063,
1013,
1013,
2065,
2019,
13216,
2918,
24471,
2140,
2038,
2042,
2275,
2006,
1996,
9785,
9563,
2059,
2057,
2097,
2224,
1013,
1013,
2009,
2004,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
matomo-org/matomo | libs/Zend/Db/Statement.php | Zend_Db_Statement.bindValue | public function bindValue($parameter, $value, $type = null)
{
return $this->bindParam($parameter, $value, $type);
} | php | public function bindValue($parameter, $value, $type = null)
{
return $this->bindParam($parameter, $value, $type);
} | [
"public",
"function",
"bindValue",
"(",
"$",
"parameter",
",",
"$",
"value",
",",
"$",
"type",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"bindParam",
"(",
"$",
"parameter",
",",
"$",
"value",
",",
"$",
"type",
")",
";",
"}"
] | Binds a value to a parameter.
@param mixed $parameter Name the parameter, either integer or string.
@param mixed $value Scalar value to bind to the parameter.
@param mixed $type OPTIONAL Datatype of the parameter.
@return bool | [
"Binds",
"a",
"value",
"to",
"a",
"parameter",
"."
] | 72df150735664275a60a7861e468c6ff3b152a14 | https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Statement.php#L283-L286 | train | Binds a parameter value to a value type | [
30522,
2270,
3853,
14187,
10175,
5657,
1006,
1002,
16381,
1010,
1002,
3643,
1010,
1002,
2828,
1027,
19701,
1007,
1063,
2709,
1002,
2023,
1011,
1028,
14187,
28689,
2213,
1006,
1002,
16381,
1010,
1002,
3643,
1010,
1002,
2828,
1007,
1025,
1065... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.