repo
stringclasses
21 values
path
stringlengths
10
105
func_name
stringlengths
6
64
original_string
stringlengths
105
15.6k
language
stringclasses
1 value
code
stringlengths
105
15.6k
code_tokens
listlengths
29
2.15k
docstring
stringlengths
11
2.85k
docstring_tokens
listlengths
1
290
sha
stringclasses
21 values
url
stringlengths
100
194
partition
stringclasses
1 value
summary
stringlengths
8
319
input_ids
listlengths
502
502
token_type_ids
listlengths
502
502
attention_mask
listlengths
502
502
labels
listlengths
502
502
laravel/framework
src/Illuminate/View/View.php
View.render
public function render(callable $callback = null) { try { $contents = $this->renderContents(); $response = isset($callback) ? call_user_func($callback, $this, $contents) : null; // Once we have the contents of the view, we will flush the sections if we are // done rendering all views so that there is nothing left hanging over when // another view gets rendered in the future by the application developer. $this->factory->flushStateIfDoneRendering(); return ! is_null($response) ? $response : $contents; } catch (Exception $e) { $this->factory->flushState(); throw $e; } catch (Throwable $e) { $this->factory->flushState(); throw $e; } }
php
public function render(callable $callback = null) { try { $contents = $this->renderContents(); $response = isset($callback) ? call_user_func($callback, $this, $contents) : null; // Once we have the contents of the view, we will flush the sections if we are // done rendering all views so that there is nothing left hanging over when // another view gets rendered in the future by the application developer. $this->factory->flushStateIfDoneRendering(); return ! is_null($response) ? $response : $contents; } catch (Exception $e) { $this->factory->flushState(); throw $e; } catch (Throwable $e) { $this->factory->flushState(); throw $e; } }
[ "public", "function", "render", "(", "callable", "$", "callback", "=", "null", ")", "{", "try", "{", "$", "contents", "=", "$", "this", "->", "renderContents", "(", ")", ";", "$", "response", "=", "isset", "(", "$", "callback", ")", "?", "call_user_fun...
Get the string contents of the view. @param callable|null $callback @return array|string @throws \Throwable
[ "Get", "the", "string", "contents", "of", "the", "view", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/View/View.php#L87-L109
train
Render the view
[ 30522, 2270, 3853, 17552, 1006, 2655, 3085, 1002, 2655, 5963, 1027, 19701, 1007, 1063, 3046, 1063, 1002, 8417, 1027, 1002, 2023, 1011, 1028, 17552, 8663, 6528, 3215, 1006, 1007, 1025, 1002, 3433, 1027, 26354, 3388, 1006, 1002, 2655, 5963, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Routing/Matcher/Dumper/CompiledUrlMatcherDumper.php
CompiledUrlMatcherDumper.compileRoute
private function compileRoute(Route $route, string $name, $vars, bool $hasTrailingSlash, bool $hasTrailingVar, array &$conditions): array { $defaults = $route->getDefaults(); if (isset($defaults['_canonical_route'])) { $name = $defaults['_canonical_route']; unset($defaults['_canonical_route']); } if ($condition = $route->getCondition()) { $condition = $this->getExpressionLanguage()->compile($condition, ['context', 'request']); $condition = $conditions[$condition] ?? $conditions[$condition] = (false !== strpos($condition, '$request') ? 1 : -1) * \count($conditions); } else { $condition = null; } return [ ['_route' => $name] + $defaults, $vars, array_flip($route->getMethods()) ?: null, array_flip($route->getSchemes()) ?: null, $hasTrailingSlash, $hasTrailingVar, $condition, ]; }
php
private function compileRoute(Route $route, string $name, $vars, bool $hasTrailingSlash, bool $hasTrailingVar, array &$conditions): array { $defaults = $route->getDefaults(); if (isset($defaults['_canonical_route'])) { $name = $defaults['_canonical_route']; unset($defaults['_canonical_route']); } if ($condition = $route->getCondition()) { $condition = $this->getExpressionLanguage()->compile($condition, ['context', 'request']); $condition = $conditions[$condition] ?? $conditions[$condition] = (false !== strpos($condition, '$request') ? 1 : -1) * \count($conditions); } else { $condition = null; } return [ ['_route' => $name] + $defaults, $vars, array_flip($route->getMethods()) ?: null, array_flip($route->getSchemes()) ?: null, $hasTrailingSlash, $hasTrailingVar, $condition, ]; }
[ "private", "function", "compileRoute", "(", "Route", "$", "route", ",", "string", "$", "name", ",", "$", "vars", ",", "bool", "$", "hasTrailingSlash", ",", "bool", "$", "hasTrailingVar", ",", "array", "&", "$", "conditions", ")", ":", "array", "{", "$", ...
Compiles a single Route to PHP code used to match it against the path info.
[ "Compiles", "a", "single", "Route", "to", "PHP", "code", "used", "to", "match", "it", "against", "the", "path", "info", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Routing/Matcher/Dumper/CompiledUrlMatcherDumper.php#L419-L444
train
Compiles a route into an array of parameters
[ 30522, 2797, 3853, 21624, 5833, 2063, 1006, 2799, 1002, 2799, 1010, 5164, 1002, 2171, 1010, 1002, 13075, 2015, 1010, 22017, 2140, 1002, 2038, 6494, 16281, 14540, 11823, 1010, 22017, 2140, 1002, 2038, 6494, 16281, 10755, 1010, 9140, 1004, 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/Installation/ServerFilesGenerator.php
ServerFilesGenerator.deleteHtAccessFiles
public static function deleteHtAccessFiles() { $files = Filesystem::globr(PIWIK_INCLUDE_PATH, ".htaccess"); // that match the list of directories we create htaccess files // (ie. not the root /.htaccess) $directoriesWithAutoHtaccess = array( '/js', '/libs', '/vendor', '/plugins', '/misc/user', '/config', '/core', '/lang', '/tmp', ); foreach ($files as $file) { foreach ($directoriesWithAutoHtaccess as $dirToDelete) { // only delete the first .htaccess and not the ones in sub-directories $pathToDelete = $dirToDelete . '/.htaccess'; if (strpos($file, $pathToDelete) !== false) { @unlink($file); } } } }
php
public static function deleteHtAccessFiles() { $files = Filesystem::globr(PIWIK_INCLUDE_PATH, ".htaccess"); // that match the list of directories we create htaccess files // (ie. not the root /.htaccess) $directoriesWithAutoHtaccess = array( '/js', '/libs', '/vendor', '/plugins', '/misc/user', '/config', '/core', '/lang', '/tmp', ); foreach ($files as $file) { foreach ($directoriesWithAutoHtaccess as $dirToDelete) { // only delete the first .htaccess and not the ones in sub-directories $pathToDelete = $dirToDelete . '/.htaccess'; if (strpos($file, $pathToDelete) !== false) { @unlink($file); } } } }
[ "public", "static", "function", "deleteHtAccessFiles", "(", ")", "{", "$", "files", "=", "Filesystem", "::", "globr", "(", "PIWIK_INCLUDE_PATH", ",", "\".htaccess\"", ")", ";", "// that match the list of directories we create htaccess files", "// (ie. not the root /.htaccess)...
Deletes all existing .htaccess files and web.config files that Matomo may have created,
[ "Deletes", "all", "existing", ".", "htaccess", "files", "and", "web", ".", "config", "files", "that", "Matomo", "may", "have", "created" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Installation/ServerFilesGenerator.php#L292-L319
train
Delete all. htaccess files in the current directory
[ 30522, 2270, 10763, 3853, 3972, 12870, 22893, 9468, 7971, 8873, 30524, 3111, 2057, 3443, 1044, 2696, 9468, 7971, 6764, 1013, 1013, 1006, 29464, 1012, 2025, 1996, 7117, 1013, 1012, 1044, 2696, 9468, 7971, 1007, 1002, 2472, 3111, 24415, 4887,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Util/OrderedHashMap.php
OrderedHashMap.offsetGet
public function offsetGet($key) { if (!isset($this->elements[$key])) { throw new \OutOfBoundsException('The offset "'.$key.'" does not exist.'); } return $this->elements[$key]; }
php
public function offsetGet($key) { if (!isset($this->elements[$key])) { throw new \OutOfBoundsException('The offset "'.$key.'" does not exist.'); } return $this->elements[$key]; }
[ "public", "function", "offsetGet", "(", "$", "key", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "elements", "[", "$", "key", "]", ")", ")", "{", "throw", "new", "\\", "OutOfBoundsException", "(", "'The offset \"'", ".", "$", "key", "."...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Util/OrderedHashMap.php#L112-L119
train
Get the element at the given offset.
[ 30522, 2270, 3853, 16396, 18150, 1006, 1002, 3145, 1007, 1063, 2065, 1006, 999, 26354, 3388, 1006, 1002, 2023, 1011, 1028, 3787, 1031, 1002, 30524, 4839, 1012, 1005, 1007, 1025, 1065, 2709, 1002, 2023, 1011, 1028, 3787, 1031, 1002, 3145, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
overtrue/wechat
src/Kernel/Log/LogManager.php
LogManager.get
protected function get($name) { try { return $this->channels[$name] ?? ($this->channels[$name] = $this->resolve($name)); } catch (\Throwable $e) { $logger = $this->createEmergencyLogger(); $logger->emergency('Unable to create configured logger. Using emergency logger.', [ 'exception' => $e, ]); return $logger; } }
php
protected function get($name) { try { return $this->channels[$name] ?? ($this->channels[$name] = $this->resolve($name)); } catch (\Throwable $e) { $logger = $this->createEmergencyLogger(); $logger->emergency('Unable to create configured logger. Using emergency logger.', [ 'exception' => $e, ]); return $logger; } }
[ "protected", "function", "get", "(", "$", "name", ")", "{", "try", "{", "return", "$", "this", "->", "channels", "[", "$", "name", "]", "??", "(", "$", "this", "->", "channels", "[", "$", "name", "]", "=", "$", "this", "->", "resolve", "(", "$", ...
Attempt to get the log from the local cache. @param string $name @return \Psr\Log\LoggerInterface
[ "Attempt", "to", "get", "the", "log", "from", "the", "local", "cache", "." ]
120c72faaa93c270365bc75c73c362d5fd583209
https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/Kernel/Log/LogManager.php#L121-L134
train
Get the channel by name
[ 30522, 5123, 3853, 2131, 1006, 1002, 2171, 1007, 1063, 3046, 1063, 2709, 1002, 2023, 1011, 1028, 6833, 1031, 1002, 2171, 1033, 1029, 1029, 1006, 1002, 2023, 1011, 1028, 6833, 1031, 1002, 2171, 1033, 1027, 1002, 2023, 1011, 1028, 10663, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Mime/Decode.php
Zend_Mime_Decode.splitMessage
public static function splitMessage($message, &$headers, &$body, $EOL = Zend_Mime::LINEEND) { // check for valid header at first line $firstline = strtok($message, "\n"); if (!preg_match('%^[^\s]+[^:]*:%', $firstline)) { $headers = array(); // TODO: we're ignoring \r for now - is this function fast enough and is it safe to asume noone needs \r? $body = str_replace(array("\r", "\n"), array('', $EOL), $message); return; } // find an empty line between headers and body // default is set new line if (strpos($message, $EOL . $EOL)) { list($headers, $body) = explode($EOL . $EOL, $message, 2); // next is the standard new line } else if ($EOL != "\r\n" && strpos($message, "\r\n\r\n")) { list($headers, $body) = explode("\r\n\r\n", $message, 2); // next is the other "standard" new line } else if ($EOL != "\n" && strpos($message, "\n\n")) { list($headers, $body) = explode("\n\n", $message, 2); // at last resort find anything that looks like a new line } else { @list($headers, $body) = @preg_split("%([\r\n]+)\\1%U", $message, 2); } $headers = iconv_mime_decode_headers($headers, ICONV_MIME_DECODE_CONTINUE_ON_ERROR); if ($headers === false ) { // an error occurs during the decoding return; } // normalize header names foreach ($headers as $name => $header) { $lower = strtolower($name); if ($lower == $name) { continue; } unset($headers[$name]); if (!isset($headers[$lower])) { $headers[$lower] = $header; continue; } if (is_array($headers[$lower])) { $headers[$lower][] = $header; continue; } $headers[$lower] = array($headers[$lower], $header); } }
php
public static function splitMessage($message, &$headers, &$body, $EOL = Zend_Mime::LINEEND) { // check for valid header at first line $firstline = strtok($message, "\n"); if (!preg_match('%^[^\s]+[^:]*:%', $firstline)) { $headers = array(); // TODO: we're ignoring \r for now - is this function fast enough and is it safe to asume noone needs \r? $body = str_replace(array("\r", "\n"), array('', $EOL), $message); return; } // find an empty line between headers and body // default is set new line if (strpos($message, $EOL . $EOL)) { list($headers, $body) = explode($EOL . $EOL, $message, 2); // next is the standard new line } else if ($EOL != "\r\n" && strpos($message, "\r\n\r\n")) { list($headers, $body) = explode("\r\n\r\n", $message, 2); // next is the other "standard" new line } else if ($EOL != "\n" && strpos($message, "\n\n")) { list($headers, $body) = explode("\n\n", $message, 2); // at last resort find anything that looks like a new line } else { @list($headers, $body) = @preg_split("%([\r\n]+)\\1%U", $message, 2); } $headers = iconv_mime_decode_headers($headers, ICONV_MIME_DECODE_CONTINUE_ON_ERROR); if ($headers === false ) { // an error occurs during the decoding return; } // normalize header names foreach ($headers as $name => $header) { $lower = strtolower($name); if ($lower == $name) { continue; } unset($headers[$name]); if (!isset($headers[$lower])) { $headers[$lower] = $header; continue; } if (is_array($headers[$lower])) { $headers[$lower][] = $header; continue; } $headers[$lower] = array($headers[$lower], $header); } }
[ "public", "static", "function", "splitMessage", "(", "$", "message", ",", "&", "$", "headers", ",", "&", "$", "body", ",", "$", "EOL", "=", "Zend_Mime", "::", "LINEEND", ")", "{", "// check for valid header at first line", "$", "firstline", "=", "strtok", "(...
split a message in header and body part, if no header or an invalid header is found $headers is empty The charset of the returned headers depend on your iconv settings. @param string $message raw message with header and optional content @param array $headers output param, array with headers as array(name => value) @param string $body output param, content of message @param string $EOL EOL string; defaults to {@link Zend_Mime::LINEEND} @return null
[ "split", "a", "message", "in", "header", "and", "body", "part", "if", "no", "header", "or", "an", "invalid", "header", "is", "found", "$headers", "is", "empty" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Mime/Decode.php#L117-L167
train
Split message into headers and body
[ 30522, 2270, 10763, 3853, 3975, 7834, 3736, 3351, 1006, 1002, 4471, 1010, 1004, 1002, 20346, 2015, 1010, 1004, 1002, 2303, 1010, 1002, 1041, 4747, 1027, 16729, 2094, 1035, 2771, 4168, 1024, 1024, 2240, 10497, 1007, 1063, 1013, 1013, 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...
getgrav/grav
system/src/Grav/Framework/Flex/FlexCollection.php
FlexCollection.getCacheKey
public function getCacheKey(): string { return $this->getTypePrefix() . $this->getFlexType() . '.' . sha1(json_encode($this->call('getKey'))); }
php
public function getCacheKey(): string { return $this->getTypePrefix() . $this->getFlexType() . '.' . sha1(json_encode($this->call('getKey'))); }
[ "public", "function", "getCacheKey", "(", ")", ":", "string", "{", "return", "$", "this", "->", "getTypePrefix", "(", ")", ".", "$", "this", "->", "getFlexType", "(", ")", ".", "'.'", ".", "sha1", "(", "json_encode", "(", "$", "this", "->", "call", "...
{@inheritdoc} @see FlexCollectionInterface::getFlexDirectory()
[ "{" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Framework/Flex/FlexCollection.php#L175-L178
train
Get Cache Key
[ 30522, 2270, 3853, 2131, 3540, 5403, 14839, 1006, 1007, 1024, 5164, 1063, 2709, 1002, 2023, 1011, 1028, 2131, 13874, 28139, 8873, 2595, 1006, 1007, 1012, 1002, 2023, 1011, 1028, 2131, 21031, 18413, 18863, 1006, 1007, 1012, 1005, 1012, 1005,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
slimphp/Slim
Slim/Router.php
Router.pushGroup
public function pushGroup($pattern, $callable) { $group = new RouteGroup($pattern, $callable); array_push($this->routeGroups, $group); return $group; }
php
public function pushGroup($pattern, $callable) { $group = new RouteGroup($pattern, $callable); array_push($this->routeGroups, $group); return $group; }
[ "public", "function", "pushGroup", "(", "$", "pattern", ",", "$", "callable", ")", "{", "$", "group", "=", "new", "RouteGroup", "(", "$", "pattern", ",", "$", "callable", ")", ";", "array_push", "(", "$", "this", "->", "routeGroups", ",", "$", "group",...
{@inheritdoc}
[ "{" ]
ccef5f7d8bcd469d59cbe64f6210d83764f91543
https://github.com/slimphp/Slim/blob/ccef5f7d8bcd469d59cbe64f6210d83764f91543/Slim/Router.php#L310-L315
train
Push a new route group to the end of the routeGroups stack
[ 30522, 2270, 3853, 5245, 17058, 1006, 1002, 5418, 1010, 1002, 2655, 3085, 1007, 1063, 1002, 2177, 1027, 2047, 2799, 17058, 1006, 1002, 5418, 1010, 1002, 2655, 3085, 1007, 1025, 9140, 1035, 5245, 1006, 1002, 2023, 1011, 1028, 2799, 17058, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
barryvdh/laravel-debugbar
src/Storage/FilesystemStorage.php
FilesystemStorage.find
public function find(array $filters = [], $max = 20, $offset = 0) { // Sort by modified time, newest first $sort = function (\SplFileInfo $a, \SplFileInfo $b) { return strcmp($b->getMTime(), $a->getMTime()); }; // Loop through .json files, filter the metadata and stop when max is found. $i = 0; $results = []; foreach (Finder::create()->files()->name('*.json')->in($this->dirname)->sort($sort) as $file) { if ($i++ < $offset && empty($filters)) { $results[] = null; continue; } $data = json_decode($file->getContents(), true); $meta = $data['__meta']; unset($data); if ($this->filter($meta, $filters)) { $results[] = $meta; } if (count($results) >= ($max + $offset)) { break; } } return array_slice($results, $offset, $max); }
php
public function find(array $filters = [], $max = 20, $offset = 0) { // Sort by modified time, newest first $sort = function (\SplFileInfo $a, \SplFileInfo $b) { return strcmp($b->getMTime(), $a->getMTime()); }; // Loop through .json files, filter the metadata and stop when max is found. $i = 0; $results = []; foreach (Finder::create()->files()->name('*.json')->in($this->dirname)->sort($sort) as $file) { if ($i++ < $offset && empty($filters)) { $results[] = null; continue; } $data = json_decode($file->getContents(), true); $meta = $data['__meta']; unset($data); if ($this->filter($meta, $filters)) { $results[] = $meta; } if (count($results) >= ($max + $offset)) { break; } } return array_slice($results, $offset, $max); }
[ "public", "function", "find", "(", "array", "$", "filters", "=", "[", "]", ",", "$", "max", "=", "20", ",", "$", "offset", "=", "0", ")", "{", "// Sort by modified time, newest first", "$", "sort", "=", "function", "(", "\\", "SplFileInfo", "$", "a", "...
{@inheritDoc}
[ "{" ]
2d195779ea4f809f69764a795e2ec371dbb76a96
https://github.com/barryvdh/laravel-debugbar/blob/2d195779ea4f809f69764a795e2ec371dbb76a96/src/Storage/FilesystemStorage.php#L88-L114
train
Find all metadata in the directory
[ 30522, 2270, 3853, 2424, 1006, 9140, 1002, 17736, 1027, 1031, 1033, 1010, 1002, 4098, 1027, 2322, 1010, 1002, 16396, 1027, 1014, 1007, 1063, 1013, 1013, 4066, 2011, 6310, 2051, 1010, 14751, 2034, 1002, 4066, 1027, 3853, 1006, 1032, 11867, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Validator/Validator/TraceableValidator.php
TraceableValidator.validatePropertyValue
public function validatePropertyValue($objectOrClass, $propertyName, $value, $groups = null) { return $this->validator->validatePropertyValue($objectOrClass, $propertyName, $value, $groups); }
php
public function validatePropertyValue($objectOrClass, $propertyName, $value, $groups = null) { return $this->validator->validatePropertyValue($objectOrClass, $propertyName, $value, $groups); }
[ "public", "function", "validatePropertyValue", "(", "$", "objectOrClass", ",", "$", "propertyName", ",", "$", "value", ",", "$", "groups", "=", "null", ")", "{", "return", "$", "this", "->", "validator", "->", "validatePropertyValue", "(", "$", "objectOrClass"...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Validator/Validator/TraceableValidator.php#L116-L119
train
Validate a value in the object or class
[ 30522, 2270, 3853, 9398, 3686, 21572, 4842, 3723, 10175, 5657, 1006, 1002, 4874, 2953, 26266, 1010, 1002, 3200, 18442, 1010, 1002, 3643, 1010, 1002, 2967, 1027, 19701, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 9398, 8844, 1011, 1028, 9398, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Http/Request.php
Request.createFromBase
public static function createFromBase(SymfonyRequest $request) { if ($request instanceof static) { return $request; } $content = $request->content; $newRequest = (new static)->duplicate( $request->query->all(), $request->request->all(), $request->attributes->all(), $request->cookies->all(), $request->files->all(), $request->server->all() ); $newRequest->headers->replace($request->headers->all()); $newRequest->content = $content; $newRequest->request = $newRequest->getInputSource(); return $newRequest; }
php
public static function createFromBase(SymfonyRequest $request) { if ($request instanceof static) { return $request; } $content = $request->content; $newRequest = (new static)->duplicate( $request->query->all(), $request->request->all(), $request->attributes->all(), $request->cookies->all(), $request->files->all(), $request->server->all() ); $newRequest->headers->replace($request->headers->all()); $newRequest->content = $content; $newRequest->request = $newRequest->getInputSource(); return $newRequest; }
[ "public", "static", "function", "createFromBase", "(", "SymfonyRequest", "$", "request", ")", "{", "if", "(", "$", "request", "instanceof", "static", ")", "{", "return", "$", "request", ";", "}", "$", "content", "=", "$", "request", "->", "content", ";", ...
Create an Illuminate request from a Symfony instance. @param \Symfony\Component\HttpFoundation\Request $request @return static
[ "Create", "an", "Illuminate", "request", "from", "a", "Symfony", "instance", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Http/Request.php#L419-L439
train
Create a new request from a base Symfony request
[ 30522, 2270, 10763, 3853, 3443, 19699, 24991, 3366, 1006, 25353, 2213, 14876, 4890, 2890, 15500, 1002, 5227, 1007, 1063, 2065, 1006, 1002, 5227, 6013, 11253, 10763, 1007, 1063, 2709, 1002, 5227, 1025, 1065, 1002, 4180, 1027, 1002, 5227, 101...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/HTML/QuickForm2/Controller/Page.php
HTML_QuickForm2_Controller_Page.handle
public function handle($actionName) { if (isset($this->handlers[$actionName])) { return $this->handlers[$actionName]->perform($this, $actionName); } else { return $this->getController()->handle($this, $actionName); } }
php
public function handle($actionName) { if (isset($this->handlers[$actionName])) { return $this->handlers[$actionName]->perform($this, $actionName); } else { return $this->getController()->handle($this, $actionName); } }
[ "public", "function", "handle", "(", "$", "actionName", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "handlers", "[", "$", "actionName", "]", ")", ")", "{", "return", "$", "this", "->", "handlers", "[", "$", "actionName", "]", "->", "perform...
Handles an action If the page does not contain a handler for this action, controller's handle() method will be called. @param string Name of the action @throws HTML_QuickForm2_NotFoundException if handler for an action is missing
[ "Handles", "an", "action" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/HTML/QuickForm2/Controller/Page.php#L150-L157
train
Handle an action
[ 30522, 2270, 3853, 5047, 1006, 1002, 2895, 18442, 1007, 1063, 2065, 1006, 26354, 3388, 1006, 1002, 2023, 1011, 1028, 28213, 2015, 1031, 1002, 2895, 18442, 1033, 1007, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 28213, 2015, 1031, 1002, 2895, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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.prepareCombiner
protected function prepareCombiner(array $assets, $rewritePath = null) { /* * Extensibility */ Event::fire('cms.combiner.beforePrepare', [$this, $assets]); $files = []; $filesSalt = null; foreach ($assets as $asset) { $filters = $this->getFilters(File::extension($asset)) ?: []; $path = file_exists($asset) ? $asset : File::symbolizePath($asset, null) ?: $this->localPath . $asset; $files[] = new FileAsset($path, $filters, public_path()); $filesSalt .= $this->localPath . $asset; } $filesSalt = md5($filesSalt); $collection = new AssetCollection($files, [], $filesSalt); $collection->setTargetPath($this->getTargetPath($rewritePath)); if ($this->storagePath === null) { return $collection; } if (!File::isDirectory($this->storagePath)) { @File::makeDirectory($this->storagePath); } $cache = new FilesystemCache($this->storagePath); $cachedFiles = []; foreach ($files as $file) { $cachedFiles[] = new AssetCache($file, $cache); } $cachedCollection = new AssetCollection($cachedFiles, [], $filesSalt); $cachedCollection->setTargetPath($this->getTargetPath($rewritePath)); return $cachedCollection; }
php
protected function prepareCombiner(array $assets, $rewritePath = null) { /* * Extensibility */ Event::fire('cms.combiner.beforePrepare', [$this, $assets]); $files = []; $filesSalt = null; foreach ($assets as $asset) { $filters = $this->getFilters(File::extension($asset)) ?: []; $path = file_exists($asset) ? $asset : File::symbolizePath($asset, null) ?: $this->localPath . $asset; $files[] = new FileAsset($path, $filters, public_path()); $filesSalt .= $this->localPath . $asset; } $filesSalt = md5($filesSalt); $collection = new AssetCollection($files, [], $filesSalt); $collection->setTargetPath($this->getTargetPath($rewritePath)); if ($this->storagePath === null) { return $collection; } if (!File::isDirectory($this->storagePath)) { @File::makeDirectory($this->storagePath); } $cache = new FilesystemCache($this->storagePath); $cachedFiles = []; foreach ($files as $file) { $cachedFiles[] = new AssetCache($file, $cache); } $cachedCollection = new AssetCollection($cachedFiles, [], $filesSalt); $cachedCollection->setTargetPath($this->getTargetPath($rewritePath)); return $cachedCollection; }
[ "protected", "function", "prepareCombiner", "(", "array", "$", "assets", ",", "$", "rewritePath", "=", "null", ")", "{", "/*\n * Extensibility\n */", "Event", "::", "fire", "(", "'cms.combiner.beforePrepare'", ",", "[", "$", "this", ",", "$", "asse...
Returns the combined contents from a prepared cache identifier. @param array $assets List of asset files. @param string $rewritePath @return string Combined file contents.
[ "Returns", "the", "combined", "contents", "from", "a", "prepared", "cache", "identifier", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/CombineAssets.php#L409-L447
train
Prepares the asset combiner
[ 30522, 5123, 3853, 7374, 18274, 26455, 1006, 9140, 1002, 7045, 1010, 1002, 2128, 26373, 15069, 1027, 30524, 2077, 28139, 19362, 2063, 1005, 1010, 1031, 1002, 2023, 1010, 1002, 7045, 1033, 1007, 1025, 1002, 6764, 1027, 1031, 1033, 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...
matomo-org/matomo
plugins/DBStats/API.php
API.getReportDataSummaryByYear
public function getReportDataSummaryByYear() { Piwik::checkUserHasSuperUserAccess(); $dataTable = $this->getReportDataSummary(); $dataTable->filter('GroupBy', array('label', __NAMESPACE__ . '\API::getArchiveTableYear')); return $dataTable; }
php
public function getReportDataSummaryByYear() { Piwik::checkUserHasSuperUserAccess(); $dataTable = $this->getReportDataSummary(); $dataTable->filter('GroupBy', array('label', __NAMESPACE__ . '\API::getArchiveTableYear')); return $dataTable; }
[ "public", "function", "getReportDataSummaryByYear", "(", ")", "{", "Piwik", "::", "checkUserHasSuperUserAccess", "(", ")", ";", "$", "dataTable", "=", "$", "this", "->", "getReportDataSummary", "(", ")", ";", "$", "dataTable", "->", "filter", "(", "'GroupBy'", ...
Returns a datatable describing how much space is taken up by each blob archive table, grouped by year. @return DataTable A datatable with three columns: 'data_size', 'index_size', 'row_count'.
[ "Returns", "a", "datatable", "describing", "how", "much", "space", "is", "taken", "up", "by", "each", "blob", "archive", "table", "grouped", "by", "year", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/DBStats/API.php#L165-L174
train
Returns a summary of archive table items grouped by year
[ 30522, 2270, 3853, 2131, 2890, 6442, 2850, 10230, 2819, 7849, 2100, 3762, 29100, 1006, 1007, 1063, 14255, 9148, 2243, 1024, 1024, 4638, 20330, 14949, 6342, 4842, 20330, 6305, 9623, 2015, 1006, 1007, 1025, 1002, 2951, 10880, 1027, 1002, 2023...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Form/Extension/Core/Type/TimeType.php
TimeType.buildForm
public function buildForm(FormBuilderInterface $builder, array $options) { $parts = ['hour']; $format = 'H'; if ($options['with_seconds'] && !$options['with_minutes']) { throw new InvalidConfigurationException('You can not disable minutes if you have enabled seconds.'); } if ($options['with_minutes']) { $format .= ':i'; $parts[] = 'minute'; } if ($options['with_seconds']) { $format .= ':s'; $parts[] = 'second'; } if ('single_text' === $options['widget']) { $builder->addViewTransformer(new DateTimeToStringTransformer($options['model_timezone'], $options['view_timezone'], $format)); // handle seconds ignored by user's browser when with_seconds enabled // https://codereview.chromium.org/450533009/ if ($options['with_seconds']) { $builder->addEventListener(FormEvents::PRE_SUBMIT, function (FormEvent $e) { $data = $e->getData(); if ($data && preg_match('/^\d{2}:\d{2}$/', $data)) { $e->setData($data.':00'); } }); } } else { $hourOptions = $minuteOptions = $secondOptions = [ 'error_bubbling' => true, 'empty_data' => '', ]; // when the form is compound the entries of the array are ignored in favor of children data // so we need to handle the cascade setting here $emptyData = $builder->getEmptyData() ?: []; if (isset($emptyData['hour'])) { $hourOptions['empty_data'] = $emptyData['hour']; } if (isset($options['invalid_message'])) { $hourOptions['invalid_message'] = $options['invalid_message']; $minuteOptions['invalid_message'] = $options['invalid_message']; $secondOptions['invalid_message'] = $options['invalid_message']; } if (isset($options['invalid_message_parameters'])) { $hourOptions['invalid_message_parameters'] = $options['invalid_message_parameters']; $minuteOptions['invalid_message_parameters'] = $options['invalid_message_parameters']; $secondOptions['invalid_message_parameters'] = $options['invalid_message_parameters']; } if ('choice' === $options['widget']) { $hours = $minutes = []; foreach ($options['hours'] as $hour) { $hours[str_pad($hour, 2, '0', STR_PAD_LEFT)] = $hour; } // Only pass a subset of the options to children $hourOptions['choices'] = $hours; $hourOptions['placeholder'] = $options['placeholder']['hour']; $hourOptions['choice_translation_domain'] = $options['choice_translation_domain']['hour']; if ($options['with_minutes']) { foreach ($options['minutes'] as $minute) { $minutes[str_pad($minute, 2, '0', STR_PAD_LEFT)] = $minute; } $minuteOptions['choices'] = $minutes; $minuteOptions['placeholder'] = $options['placeholder']['minute']; $minuteOptions['choice_translation_domain'] = $options['choice_translation_domain']['minute']; } if ($options['with_seconds']) { $seconds = []; foreach ($options['seconds'] as $second) { $seconds[str_pad($second, 2, '0', STR_PAD_LEFT)] = $second; } $secondOptions['choices'] = $seconds; $secondOptions['placeholder'] = $options['placeholder']['second']; $secondOptions['choice_translation_domain'] = $options['choice_translation_domain']['second']; } // Append generic carry-along options foreach (['required', 'translation_domain'] as $passOpt) { $hourOptions[$passOpt] = $options[$passOpt]; if ($options['with_minutes']) { $minuteOptions[$passOpt] = $options[$passOpt]; } if ($options['with_seconds']) { $secondOptions[$passOpt] = $options[$passOpt]; } } } $builder->add('hour', self::$widgets[$options['widget']], $hourOptions); if ($options['with_minutes']) { if (isset($emptyData['minute'])) { $minuteOptions['empty_data'] = $emptyData['minute']; } $builder->add('minute', self::$widgets[$options['widget']], $minuteOptions); } if ($options['with_seconds']) { if (isset($emptyData['second'])) { $secondOptions['empty_data'] = $emptyData['second']; } $builder->add('second', self::$widgets[$options['widget']], $secondOptions); } $builder->addViewTransformer(new DateTimeToArrayTransformer($options['model_timezone'], $options['view_timezone'], $parts, 'text' === $options['widget'])); } if ('datetime_immutable' === $options['input']) { $builder->addModelTransformer(new DateTimeImmutableToDateTimeTransformer()); } elseif ('string' === $options['input']) { $builder->addModelTransformer(new ReversedTransformer( new DateTimeToStringTransformer($options['model_timezone'], $options['model_timezone'], $options['input_format']) )); } elseif ('timestamp' === $options['input']) { $builder->addModelTransformer(new ReversedTransformer( new DateTimeToTimestampTransformer($options['model_timezone'], $options['model_timezone']) )); } elseif ('array' === $options['input']) { $builder->addModelTransformer(new ReversedTransformer( new DateTimeToArrayTransformer($options['model_timezone'], $options['model_timezone'], $parts) )); } }
php
public function buildForm(FormBuilderInterface $builder, array $options) { $parts = ['hour']; $format = 'H'; if ($options['with_seconds'] && !$options['with_minutes']) { throw new InvalidConfigurationException('You can not disable minutes if you have enabled seconds.'); } if ($options['with_minutes']) { $format .= ':i'; $parts[] = 'minute'; } if ($options['with_seconds']) { $format .= ':s'; $parts[] = 'second'; } if ('single_text' === $options['widget']) { $builder->addViewTransformer(new DateTimeToStringTransformer($options['model_timezone'], $options['view_timezone'], $format)); // handle seconds ignored by user's browser when with_seconds enabled // https://codereview.chromium.org/450533009/ if ($options['with_seconds']) { $builder->addEventListener(FormEvents::PRE_SUBMIT, function (FormEvent $e) { $data = $e->getData(); if ($data && preg_match('/^\d{2}:\d{2}$/', $data)) { $e->setData($data.':00'); } }); } } else { $hourOptions = $minuteOptions = $secondOptions = [ 'error_bubbling' => true, 'empty_data' => '', ]; // when the form is compound the entries of the array are ignored in favor of children data // so we need to handle the cascade setting here $emptyData = $builder->getEmptyData() ?: []; if (isset($emptyData['hour'])) { $hourOptions['empty_data'] = $emptyData['hour']; } if (isset($options['invalid_message'])) { $hourOptions['invalid_message'] = $options['invalid_message']; $minuteOptions['invalid_message'] = $options['invalid_message']; $secondOptions['invalid_message'] = $options['invalid_message']; } if (isset($options['invalid_message_parameters'])) { $hourOptions['invalid_message_parameters'] = $options['invalid_message_parameters']; $minuteOptions['invalid_message_parameters'] = $options['invalid_message_parameters']; $secondOptions['invalid_message_parameters'] = $options['invalid_message_parameters']; } if ('choice' === $options['widget']) { $hours = $minutes = []; foreach ($options['hours'] as $hour) { $hours[str_pad($hour, 2, '0', STR_PAD_LEFT)] = $hour; } // Only pass a subset of the options to children $hourOptions['choices'] = $hours; $hourOptions['placeholder'] = $options['placeholder']['hour']; $hourOptions['choice_translation_domain'] = $options['choice_translation_domain']['hour']; if ($options['with_minutes']) { foreach ($options['minutes'] as $minute) { $minutes[str_pad($minute, 2, '0', STR_PAD_LEFT)] = $minute; } $minuteOptions['choices'] = $minutes; $minuteOptions['placeholder'] = $options['placeholder']['minute']; $minuteOptions['choice_translation_domain'] = $options['choice_translation_domain']['minute']; } if ($options['with_seconds']) { $seconds = []; foreach ($options['seconds'] as $second) { $seconds[str_pad($second, 2, '0', STR_PAD_LEFT)] = $second; } $secondOptions['choices'] = $seconds; $secondOptions['placeholder'] = $options['placeholder']['second']; $secondOptions['choice_translation_domain'] = $options['choice_translation_domain']['second']; } // Append generic carry-along options foreach (['required', 'translation_domain'] as $passOpt) { $hourOptions[$passOpt] = $options[$passOpt]; if ($options['with_minutes']) { $minuteOptions[$passOpt] = $options[$passOpt]; } if ($options['with_seconds']) { $secondOptions[$passOpt] = $options[$passOpt]; } } } $builder->add('hour', self::$widgets[$options['widget']], $hourOptions); if ($options['with_minutes']) { if (isset($emptyData['minute'])) { $minuteOptions['empty_data'] = $emptyData['minute']; } $builder->add('minute', self::$widgets[$options['widget']], $minuteOptions); } if ($options['with_seconds']) { if (isset($emptyData['second'])) { $secondOptions['empty_data'] = $emptyData['second']; } $builder->add('second', self::$widgets[$options['widget']], $secondOptions); } $builder->addViewTransformer(new DateTimeToArrayTransformer($options['model_timezone'], $options['view_timezone'], $parts, 'text' === $options['widget'])); } if ('datetime_immutable' === $options['input']) { $builder->addModelTransformer(new DateTimeImmutableToDateTimeTransformer()); } elseif ('string' === $options['input']) { $builder->addModelTransformer(new ReversedTransformer( new DateTimeToStringTransformer($options['model_timezone'], $options['model_timezone'], $options['input_format']) )); } elseif ('timestamp' === $options['input']) { $builder->addModelTransformer(new ReversedTransformer( new DateTimeToTimestampTransformer($options['model_timezone'], $options['model_timezone']) )); } elseif ('array' === $options['input']) { $builder->addModelTransformer(new ReversedTransformer( new DateTimeToArrayTransformer($options['model_timezone'], $options['model_timezone'], $parts) )); } }
[ "public", "function", "buildForm", "(", "FormBuilderInterface", "$", "builder", ",", "array", "$", "options", ")", "{", "$", "parts", "=", "[", "'hour'", "]", ";", "$", "format", "=", "'H'", ";", "if", "(", "$", "options", "[", "'with_seconds'", "]", "...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Extension/Core/Type/TimeType.php#L39-L178
train
Build the form
[ 30522, 2270, 3853, 3857, 14192, 1006, 2433, 8569, 23891, 6657, 3334, 12172, 1002, 12508, 1010, 9140, 1002, 7047, 1007, 1063, 1002, 3033, 1027, 1031, 1005, 3178, 1005, 1033, 1025, 1002, 4289, 1027, 1005, 1044, 1005, 1025, 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...
matomo-org/matomo
libs/Zend/Mail.php
Zend_Mail.addAttachment
public function addAttachment(Zend_Mime_Part $attachment) { $this->addPart($attachment); $this->hasAttachments = true; return $this; }
php
public function addAttachment(Zend_Mime_Part $attachment) { $this->addPart($attachment); $this->hasAttachments = true; return $this; }
[ "public", "function", "addAttachment", "(", "Zend_Mime_Part", "$", "attachment", ")", "{", "$", "this", "->", "addPart", "(", "$", "attachment", ")", ";", "$", "this", "->", "hasAttachments", "=", "true", ";", "return", "$", "this", ";", "}" ]
Adds an existing attachment to the mail message @param Zend_Mime_Part $attachment @return Zend_Mail Provides fluent interface
[ "Adds", "an", "existing", "attachment", "to", "the", "mail", "message" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Mail.php#L441-L447
train
Add an attachment to the message
[ 30522, 2270, 3853, 5587, 19321, 6776, 3672, 1006, 16729, 2094, 1035, 2771, 4168, 1035, 2112, 1002, 14449, 1007, 1063, 1002, 2023, 1011, 1028, 5587, 19362, 2102, 1006, 1002, 14449, 1007, 1025, 1002, 2023, 1011, 1028, 2038, 19321, 6776, 8163,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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.getQueryColumn
public function getQueryColumn($parameters, $attribute) { return isset($parameters[1]) && $parameters[1] !== 'NULL' ? $parameters[1] : $this->guessColumnForQuery($attribute); }
php
public function getQueryColumn($parameters, $attribute) { return isset($parameters[1]) && $parameters[1] !== 'NULL' ? $parameters[1] : $this->guessColumnForQuery($attribute); }
[ "public", "function", "getQueryColumn", "(", "$", "parameters", ",", "$", "attribute", ")", "{", "return", "isset", "(", "$", "parameters", "[", "1", "]", ")", "&&", "$", "parameters", "[", "1", "]", "!==", "'NULL'", "?", "$", "parameters", "[", "1", ...
Get the column name for an exists / unique query. @param array $parameters @param string $attribute @return bool
[ "Get", "the", "column", "name", "for", "an", "exists", "/", "unique", "query", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Validation/Concerns/ValidatesAttributes.php#L805-L809
train
Returns the column name for a query.
[ 30522, 2270, 3853, 2131, 4226, 2854, 25778, 30524, 999, 1027, 1027, 1005, 19701, 1005, 1029, 1002, 11709, 1031, 1015, 1033, 1024, 1002, 2023, 1011, 1028, 3984, 25778, 2819, 2078, 29278, 4226, 2854, 1006, 1002, 17961, 1007, 1025, 1065, 102, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/Page/Medium/MediumFactory.php
MediumFactory.fromFile
public static function fromFile($file, array $params = []) { if (!file_exists($file)) { return null; } $parts = pathinfo($file); $path = $parts['dirname']; $filename = $parts['basename']; $ext = $parts['extension']; $basename = $parts['filename']; $config = Grav::instance()['config']; $media_params = $config->get('media.types.' . strtolower($ext)); if (!\is_array($media_params)) { return null; } $params += $media_params; // Add default settings for undefined variables. $params += (array)$config->get('media.types.defaults'); $params += [ 'type' => 'file', 'thumb' => 'media/thumb.png', 'mime' => 'application/octet-stream', 'filepath' => $file, 'filename' => $filename, 'basename' => $basename, 'extension' => $ext, 'path' => $path, 'modified' => filemtime($file), 'thumbnails' => [] ]; $locator = Grav::instance()['locator']; $file = $locator->findResource("image://{$params['thumb']}"); if ($file) { $params['thumbnails']['default'] = $file; } return static::fromArray($params); }
php
public static function fromFile($file, array $params = []) { if (!file_exists($file)) { return null; } $parts = pathinfo($file); $path = $parts['dirname']; $filename = $parts['basename']; $ext = $parts['extension']; $basename = $parts['filename']; $config = Grav::instance()['config']; $media_params = $config->get('media.types.' . strtolower($ext)); if (!\is_array($media_params)) { return null; } $params += $media_params; // Add default settings for undefined variables. $params += (array)$config->get('media.types.defaults'); $params += [ 'type' => 'file', 'thumb' => 'media/thumb.png', 'mime' => 'application/octet-stream', 'filepath' => $file, 'filename' => $filename, 'basename' => $basename, 'extension' => $ext, 'path' => $path, 'modified' => filemtime($file), 'thumbnails' => [] ]; $locator = Grav::instance()['locator']; $file = $locator->findResource("image://{$params['thumb']}"); if ($file) { $params['thumbnails']['default'] = $file; } return static::fromArray($params); }
[ "public", "static", "function", "fromFile", "(", "$", "file", ",", "array", "$", "params", "=", "[", "]", ")", "{", "if", "(", "!", "file_exists", "(", "$", "file", ")", ")", "{", "return", "null", ";", "}", "$", "parts", "=", "pathinfo", "(", "$...
Create Medium from a file @param string $file @param array $params @return Medium
[ "Create", "Medium", "from", "a", "file" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Medium/MediumFactory.php#L25-L69
train
Create a new Media from a file
[ 30522, 2270, 10763, 3853, 2013, 8873, 2571, 1006, 1002, 5371, 1010, 9140, 1002, 11498, 5244, 1027, 1031, 1033, 1007, 1063, 2065, 1006, 999, 5371, 1035, 6526, 1006, 1002, 5371, 1007, 1007, 1063, 2709, 19701, 1025, 1065, 1002, 3033, 1027, 4...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/Archive/DataCollection.php
DataCollection.getMergedDataTable
public function getMergedDataTable($resultIndices) { $dataTableFactory = new DataTableFactory( $this->dataNames, $this->dataType, $this->sitesId, $this->periods, $this->defaultRow); $index = $this->getIndexedArray($resultIndices); return $dataTableFactory->makeMerged($index, $resultIndices); }
php
public function getMergedDataTable($resultIndices) { $dataTableFactory = new DataTableFactory( $this->dataNames, $this->dataType, $this->sitesId, $this->periods, $this->defaultRow); $index = $this->getIndexedArray($resultIndices); return $dataTableFactory->makeMerged($index, $resultIndices); }
[ "public", "function", "getMergedDataTable", "(", "$", "resultIndices", ")", "{", "$", "dataTableFactory", "=", "new", "DataTableFactory", "(", "$", "this", "->", "dataNames", ",", "$", "this", "->", "dataType", ",", "$", "this", "->", "sitesId", ",", "$", ...
See {@link DataTableFactory::makeMerged()} @param array $resultIndices @return DataTable|DataTable\Map @throws Exception
[ "See", "{", "@link", "DataTableFactory", "::", "makeMerged", "()", "}" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Archive/DataCollection.php#L238-L246
train
Returns a merged DataTable for the given result indices
[ 30522, 2270, 3853, 2131, 5017, 5999, 2850, 29336, 3085, 1006, 1002, 2765, 22254, 23522, 1007, 1063, 1002, 2951, 10880, 21450, 1027, 2047, 2951, 10880, 21450, 1006, 1002, 2023, 1011, 1028, 2951, 18442, 2015, 1010, 30524, 11335, 2100, 1006, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/UserCountry/VisitorGeolocator.php
VisitorGeolocator.attributeExistingVisit
public function attributeExistingVisit($visit, $useClassCache = true) { if (empty($visit['idvisit'])) { $this->logger->debug('Empty idvisit field. Skipping re-attribution..'); return null; } $idVisit = $visit['idvisit']; if (empty($visit['location_ip'])) { $this->logger->debug('Empty location_ip field for idvisit = %s. Skipping re-attribution.', array('idvisit' => $idVisit)); return null; } $ip = IPUtils::binaryToStringIP($visit['location_ip']); $location = $this->getLocation(array('ip' => $ip), $useClassCache); $valuesToUpdate = $this->getVisitFieldsToUpdate($visit, $location); if (!empty($valuesToUpdate)) { $this->logger->debug('Updating visit with idvisit = {idVisit} (IP = {ip}). Changes: {changes}', array( 'idVisit' => $idVisit, 'ip' => $ip, 'changes' => json_encode($valuesToUpdate) )); $this->dao->updateVisits($valuesToUpdate, $idVisit); $this->dao->updateConversions($valuesToUpdate, $idVisit); } else { $this->logger->debug('Nothing to update for idvisit = %s (IP = {ip}). Existing location info is same as geolocated.', array( 'idVisit' => $idVisit, 'ip' => $ip )); } return $valuesToUpdate; }
php
public function attributeExistingVisit($visit, $useClassCache = true) { if (empty($visit['idvisit'])) { $this->logger->debug('Empty idvisit field. Skipping re-attribution..'); return null; } $idVisit = $visit['idvisit']; if (empty($visit['location_ip'])) { $this->logger->debug('Empty location_ip field for idvisit = %s. Skipping re-attribution.', array('idvisit' => $idVisit)); return null; } $ip = IPUtils::binaryToStringIP($visit['location_ip']); $location = $this->getLocation(array('ip' => $ip), $useClassCache); $valuesToUpdate = $this->getVisitFieldsToUpdate($visit, $location); if (!empty($valuesToUpdate)) { $this->logger->debug('Updating visit with idvisit = {idVisit} (IP = {ip}). Changes: {changes}', array( 'idVisit' => $idVisit, 'ip' => $ip, 'changes' => json_encode($valuesToUpdate) )); $this->dao->updateVisits($valuesToUpdate, $idVisit); $this->dao->updateConversions($valuesToUpdate, $idVisit); } else { $this->logger->debug('Nothing to update for idvisit = %s (IP = {ip}). Existing location info is same as geolocated.', array( 'idVisit' => $idVisit, 'ip' => $ip )); } return $valuesToUpdate; }
[ "public", "function", "attributeExistingVisit", "(", "$", "visit", ",", "$", "useClassCache", "=", "true", ")", "{", "if", "(", "empty", "(", "$", "visit", "[", "'idvisit'", "]", ")", ")", "{", "$", "this", "->", "logger", "->", "debug", "(", "'Empty i...
Geolcates an existing visit and then updates it if it's current attributes are different than what was geolocated. Also updates all conversions of a visit. **This method should NOT be used from within the tracker.** @param array $visit The visit information. Must contain an `"idvisit"` element and `"location_ip"` element. @param bool $useClassCache @return array|null The visit properties that were updated in the DB mapped to the updated values. If null, required information was missing from `$visit`.
[ "Geolcates", "an", "existing", "visit", "and", "then", "updates", "it", "if", "it", "s", "current", "attributes", "are", "different", "than", "what", "was", "geolocated", ".", "Also", "updates", "all", "conversions", "of", "a", "visit", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/UserCountry/VisitorGeolocator.php#L169-L205
train
Attribute existing visit
[ 30522, 2270, 3853, 17961, 10288, 2923, 2075, 11365, 4183, 1006, 1002, 3942, 1010, 1002, 2224, 26266, 3540, 5403, 1027, 2995, 1007, 1063, 2065, 1006, 4064, 1006, 1002, 3942, 1031, 1005, 8909, 11365, 4183, 1005, 1033, 1007, 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/Workflow/MarkingStore/MethodMarkingStore.php
MethodMarkingStore.setMarking
public function setMarking($subject, Marking $marking, array $context = []) { $marking = $marking->getPlaces(); if ($this->singleState) { $marking = key($marking); } $method = 'set'.ucfirst($this->property); if (!method_exists($subject, $method)) { throw new LogicException(sprintf('The method "%s::%s()" does not exists.', \get_class($subject), $method)); } $subject->{$method}($marking, $context); }
php
public function setMarking($subject, Marking $marking, array $context = []) { $marking = $marking->getPlaces(); if ($this->singleState) { $marking = key($marking); } $method = 'set'.ucfirst($this->property); if (!method_exists($subject, $method)) { throw new LogicException(sprintf('The method "%s::%s()" does not exists.', \get_class($subject), $method)); } $subject->{$method}($marking, $context); }
[ "public", "function", "setMarking", "(", "$", "subject", ",", "Marking", "$", "marking", ",", "array", "$", "context", "=", "[", "]", ")", "{", "$", "marking", "=", "$", "marking", "->", "getPlaces", "(", ")", ";", "if", "(", "$", "this", "->", "si...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Workflow/MarkingStore/MethodMarkingStore.php#L73-L88
train
Set the marking for the subject
[ 30522, 2270, 3853, 2275, 10665, 2075, 1006, 1002, 3395, 1010, 10060, 1002, 10060, 1010, 9140, 1002, 6123, 1027, 1031, 1033, 1007, 1063, 1002, 10060, 1027, 1002, 10060, 1011, 1028, 2131, 24759, 10732, 2015, 1006, 1007, 1025, 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...
laravel/framework
src/Illuminate/Foundation/ProviderRepository.php
ProviderRepository.registerLoadEvents
protected function registerLoadEvents($provider, array $events) { if (count($events) < 1) { return; } $this->app->make('events')->listen($events, function () use ($provider) { $this->app->register($provider); }); }
php
protected function registerLoadEvents($provider, array $events) { if (count($events) < 1) { return; } $this->app->make('events')->listen($events, function () use ($provider) { $this->app->register($provider); }); }
[ "protected", "function", "registerLoadEvents", "(", "$", "provider", ",", "array", "$", "events", ")", "{", "if", "(", "count", "(", "$", "events", ")", "<", "1", ")", "{", "return", ";", "}", "$", "this", "->", "app", "->", "make", "(", "'events'", ...
Register the load events for the given provider. @param string $provider @param array $events @return void
[ "Register", "the", "load", "events", "for", "the", "given", "provider", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Foundation/ProviderRepository.php#L119-L128
train
Register load events
[ 30522, 5123, 3853, 4236, 11066, 18697, 7666, 1006, 1002, 10802, 1010, 9140, 1002, 2824, 1007, 1063, 2065, 1006, 4175, 1006, 1002, 2824, 1007, 1026, 1015, 1007, 1063, 2709, 1025, 1065, 1002, 2023, 1011, 1028, 10439, 1011, 1028, 2191, 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/Foundation/Bootstrap/LoadEnvironmentVariables.php
LoadEnvironmentVariables.writeErrorAndDie
protected function writeErrorAndDie(InvalidFileException $e) { $output = (new ConsoleOutput)->getErrorOutput(); $output->writeln('The environment file is invalid!'); $output->writeln($e->getMessage()); die(1); }
php
protected function writeErrorAndDie(InvalidFileException $e) { $output = (new ConsoleOutput)->getErrorOutput(); $output->writeln('The environment file is invalid!'); $output->writeln($e->getMessage()); die(1); }
[ "protected", "function", "writeErrorAndDie", "(", "InvalidFileException", "$", "e", ")", "{", "$", "output", "=", "(", "new", "ConsoleOutput", ")", "->", "getErrorOutput", "(", ")", ";", "$", "output", "->", "writeln", "(", "'The environment file is invalid!'", ...
Write the error information to the screen and exit. @param \Dotenv\Exception\InvalidFileException $e @return void
[ "Write", "the", "error", "information", "to", "the", "screen", "and", "exit", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Foundation/Bootstrap/LoadEnvironmentVariables.php#L102-L110
train
Write the error and die
[ 30522, 5123, 3853, 4339, 2121, 29165, 5685, 10265, 1006, 19528, 8873, 10559, 2595, 24422, 1002, 1041, 1007, 1063, 1002, 6434, 1027, 1006, 2047, 10122, 5833, 18780, 1007, 1011, 1028, 2131, 2121, 29165, 5833, 18780, 1006, 1007, 1025, 1002, 64...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
guzzle/guzzle
src/Middleware.php
Middleware.mapRequest
public static function mapRequest(callable $fn) { return function (callable $handler) use ($fn) { return function ($request, array $options) use ($handler, $fn) { return $handler($fn($request), $options); }; }; }
php
public static function mapRequest(callable $fn) { return function (callable $handler) use ($fn) { return function ($request, array $options) use ($handler, $fn) { return $handler($fn($request), $options); }; }; }
[ "public", "static", "function", "mapRequest", "(", "callable", "$", "fn", ")", "{", "return", "function", "(", "callable", "$", "handler", ")", "use", "(", "$", "fn", ")", "{", "return", "function", "(", "$", "request", ",", "array", "$", "options", ")...
Middleware that applies a map function to the request before passing to the next handler. @param callable $fn Function that accepts a RequestInterface and returns a RequestInterface. @return callable
[ "Middleware", "that", "applies", "a", "map", "function", "to", "the", "request", "before", "passing", "to", "the", "next", "handler", "." ]
bf595424e4d442a190582e088985dc835a789071
https://github.com/guzzle/guzzle/blob/bf595424e4d442a190582e088985dc835a789071/src/Middleware.php#L230-L237
train
Returns a closure that wraps the given function in a closure that can be used to map the request to the response.
[ 30522, 2270, 10763, 3853, 4949, 2890, 15500, 1006, 2655, 3085, 1002, 1042, 2078, 1007, 1063, 2709, 3853, 1006, 2655, 3085, 1002, 28213, 1007, 2224, 1006, 1002, 1042, 2078, 1007, 1063, 2709, 3853, 1006, 1002, 5227, 1010, 9140, 1002, 7047, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/SodiumPasswordEncoder.php
SodiumPasswordEncoder.encodePassword
public function encodePassword($raw, $salt) { if (\strlen($raw) > self::MAX_PASSWORD_LENGTH) { throw new BadCredentialsException('Invalid password.'); } if (\function_exists('sodium_crypto_pwhash_str')) { return \sodium_crypto_pwhash_str($raw, $this->opsLimit, $this->memLimit); } if (\extension_loaded('libsodium')) { return \Sodium\crypto_pwhash_str($raw, $this->opsLimit, $this->memLimit); } throw new LogicException('Libsodium is not available. You should either install the sodium extension, upgrade to PHP 7.2+ or use a different encoder.'); }
php
public function encodePassword($raw, $salt) { if (\strlen($raw) > self::MAX_PASSWORD_LENGTH) { throw new BadCredentialsException('Invalid password.'); } if (\function_exists('sodium_crypto_pwhash_str')) { return \sodium_crypto_pwhash_str($raw, $this->opsLimit, $this->memLimit); } if (\extension_loaded('libsodium')) { return \Sodium\crypto_pwhash_str($raw, $this->opsLimit, $this->memLimit); } throw new LogicException('Libsodium is not available. You should either install the sodium extension, upgrade to PHP 7.2+ or use a different encoder.'); }
[ "public", "function", "encodePassword", "(", "$", "raw", ",", "$", "salt", ")", "{", "if", "(", "\\", "strlen", "(", "$", "raw", ")", ">", "self", "::", "MAX_PASSWORD_LENGTH", ")", "{", "throw", "new", "BadCredentialsException", "(", "'Invalid password.'", ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Security/Core/Encoder/SodiumPasswordEncoder.php#L61-L76
train
Encode a password using the sodium extension
[ 30522, 2270, 3853, 4372, 16044, 15194, 18351, 1006, 1002, 6315, 1010, 1002, 5474, 1007, 1063, 2065, 1006, 1032, 2358, 20927, 2078, 1006, 1002, 6315, 1007, 1028, 2969, 1024, 1024, 4098, 1035, 20786, 1035, 3091, 1007, 1063, 5466, 2047, 2919, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/Tracker/Request.php
Request.setThirdPartyCookie
public function setThirdPartyCookie($idVisitor) { if (!$this->shouldUseThirdPartyCookie()) { return; } $cookie = $this->makeThirdPartyCookieUID(); $idVisitor = bin2hex($idVisitor); $cookie->set(0, $idVisitor); $cookie->save(); Common::printDebug(sprintf("We set the visitor ID to %s in the 3rd party cookie...", $idVisitor)); }
php
public function setThirdPartyCookie($idVisitor) { if (!$this->shouldUseThirdPartyCookie()) { return; } $cookie = $this->makeThirdPartyCookieUID(); $idVisitor = bin2hex($idVisitor); $cookie->set(0, $idVisitor); $cookie->save(); Common::printDebug(sprintf("We set the visitor ID to %s in the 3rd party cookie...", $idVisitor)); }
[ "public", "function", "setThirdPartyCookie", "(", "$", "idVisitor", ")", "{", "if", "(", "!", "$", "this", "->", "shouldUseThirdPartyCookie", "(", ")", ")", "{", "return", ";", "}", "$", "cookie", "=", "$", "this", "->", "makeThirdPartyCookieUID", "(", ")"...
Update the cookie information.
[ "Update", "the", "cookie", "information", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Tracker/Request.php#L667-L679
train
Set the visitor ID in the 3rd party cookie
[ 30522, 2270, 3853, 2275, 15222, 4103, 19362, 3723, 3597, 23212, 2063, 1006, 1002, 8909, 11365, 15660, 1007, 1063, 2065, 1006, 999, 1002, 2023, 1011, 1028, 2323, 8557, 15222, 4103, 19362, 3723, 3597, 23212, 2063, 1006, 1007, 1007, 1063, 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...
laravel/framework
src/Illuminate/Database/Query/Processors/SqlServerProcessor.php
SqlServerProcessor.processInsertGetIdForOdbc
protected function processInsertGetIdForOdbc(Connection $connection) { $result = $connection->selectFromWriteConnection( 'SELECT CAST(COALESCE(SCOPE_IDENTITY(), @@IDENTITY) AS int) AS insertid' ); if (! $result) { throw new Exception('Unable to retrieve lastInsertID for ODBC.'); } $row = $result[0]; return is_object($row) ? $row->insertid : $row['insertid']; }
php
protected function processInsertGetIdForOdbc(Connection $connection) { $result = $connection->selectFromWriteConnection( 'SELECT CAST(COALESCE(SCOPE_IDENTITY(), @@IDENTITY) AS int) AS insertid' ); if (! $result) { throw new Exception('Unable to retrieve lastInsertID for ODBC.'); } $row = $result[0]; return is_object($row) ? $row->insertid : $row['insertid']; }
[ "protected", "function", "processInsertGetIdForOdbc", "(", "Connection", "$", "connection", ")", "{", "$", "result", "=", "$", "connection", "->", "selectFromWriteConnection", "(", "'SELECT CAST(COALESCE(SCOPE_IDENTITY(), @@IDENTITY) AS int) AS insertid'", ")", ";", "if", "...
Process an "insert get ID" query for ODBC. @param \Illuminate\Database\Connection $connection @return int @throws \Exception
[ "Process", "an", "insert", "get", "ID", "query", "for", "ODBC", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Query/Processors/SqlServerProcessor.php#L43-L56
train
Process insert get id for ODBC
[ 30522, 30524, 1028, 7276, 19699, 5358, 26373, 8663, 2638, 7542, 1006, 1005, 7276, 3459, 1006, 5317, 2229, 3401, 1006, 9531, 1035, 4767, 1006, 1007, 1010, 1030, 1030, 4767, 1007, 2004, 20014, 1007, 2004, 19274, 3593, 1005, 1007, 1025, 2065, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/Tracker/Request.php
Request.authenticateTrackingApi
protected function authenticateTrackingApi($tokenAuth) { $shouldAuthenticate = TrackerConfig::getConfigValue('tracking_requests_require_authentication'); if ($shouldAuthenticate) { try { $idSite = $this->getIdSite(); } catch (Exception $e) { Common::printDebug("failed to authenticate: invalid idSite"); $this->isAuthenticated = false; return; } if (empty($tokenAuth)) { $tokenAuth = Common::getRequestVar('token_auth', false, 'string', $this->params); } $cache = PiwikCache::getTransientCache(); $cacheKey = 'tracker_request_authentication_' . $idSite . '_' . $tokenAuth; if ($cache->contains($cacheKey)) { Common::printDebug("token_auth is authenticated in cache!"); $this->isAuthenticated = $cache->fetch($cacheKey); return; } try { $this->isAuthenticated = self::authenticateSuperUserOrAdminOrWrite($tokenAuth, $idSite); $cache->save($cacheKey, $this->isAuthenticated); } catch (Exception $e) { Common::printDebug("could not authenticate, caught exception: " . $e->getMessage()); $this->isAuthenticated = false; } if ($this->isAuthenticated) { Common::printDebug("token_auth is authenticated!"); } else { StaticContainer::get('Piwik\Tracker\Failures')->logFailure(Failures::FAILURE_ID_NOT_AUTHENTICATED, $this); } } else { $this->isAuthenticated = true; Common::printDebug("token_auth authentication not required"); } }
php
protected function authenticateTrackingApi($tokenAuth) { $shouldAuthenticate = TrackerConfig::getConfigValue('tracking_requests_require_authentication'); if ($shouldAuthenticate) { try { $idSite = $this->getIdSite(); } catch (Exception $e) { Common::printDebug("failed to authenticate: invalid idSite"); $this->isAuthenticated = false; return; } if (empty($tokenAuth)) { $tokenAuth = Common::getRequestVar('token_auth', false, 'string', $this->params); } $cache = PiwikCache::getTransientCache(); $cacheKey = 'tracker_request_authentication_' . $idSite . '_' . $tokenAuth; if ($cache->contains($cacheKey)) { Common::printDebug("token_auth is authenticated in cache!"); $this->isAuthenticated = $cache->fetch($cacheKey); return; } try { $this->isAuthenticated = self::authenticateSuperUserOrAdminOrWrite($tokenAuth, $idSite); $cache->save($cacheKey, $this->isAuthenticated); } catch (Exception $e) { Common::printDebug("could not authenticate, caught exception: " . $e->getMessage()); $this->isAuthenticated = false; } if ($this->isAuthenticated) { Common::printDebug("token_auth is authenticated!"); } else { StaticContainer::get('Piwik\Tracker\Failures')->logFailure(Failures::FAILURE_ID_NOT_AUTHENTICATED, $this); } } else { $this->isAuthenticated = true; Common::printDebug("token_auth authentication not required"); } }
[ "protected", "function", "authenticateTrackingApi", "(", "$", "tokenAuth", ")", "{", "$", "shouldAuthenticate", "=", "TrackerConfig", "::", "getConfigValue", "(", "'tracking_requests_require_authentication'", ")", ";", "if", "(", "$", "shouldAuthenticate", ")", "{", "...
This method allows to set custom IP + server time + visitor ID, when using Tracking API. These two attributes can be only set by the Super User (passing token_auth).
[ "This", "method", "allows", "to", "set", "custom", "IP", "+", "server", "time", "+", "visitor", "ID", "when", "using", "Tracking", "API", ".", "These", "two", "attributes", "can", "be", "only", "set", "by", "the", "Super", "User", "(", "passing", "token_...
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Tracker/Request.php#L141-L185
train
Authenticate tracking api
[ 30522, 5123, 3853, 14469, 3686, 6494, 23177, 9331, 2072, 1006, 1002, 19204, 4887, 2705, 1007, 1063, 1002, 2323, 4887, 10760, 16778, 16280, 1027, 27080, 8663, 8873, 2290, 1024, 1024, 2131, 8663, 8873, 2290, 10175, 5657, 1006, 1005, 9651, 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...
laravel/framework
src/Illuminate/Cache/ApcStore.php
ApcStore.get
public function get($key) { $value = $this->apc->get($this->prefix.$key); if ($value !== false) { return $value; } }
php
public function get($key) { $value = $this->apc->get($this->prefix.$key); if ($value !== false) { return $value; } }
[ "public", "function", "get", "(", "$", "key", ")", "{", "$", "value", "=", "$", "this", "->", "apc", "->", "get", "(", "$", "this", "->", "prefix", ".", "$", "key", ")", ";", "if", "(", "$", "value", "!==", "false", ")", "{", "return", "$", "...
Retrieve an item from the cache by key. @param string|array $key @return mixed
[ "Retrieve", "an", "item", "from", "the", "cache", "by", "key", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Cache/ApcStore.php#L42-L49
train
Get the value of the key in the cache
[ 30522, 2270, 3853, 2131, 1006, 1002, 3145, 1007, 1063, 1002, 3643, 1027, 1002, 2023, 1011, 1028, 9706, 2278, 1011, 1028, 2131, 1006, 1002, 2023, 1011, 1028, 17576, 1012, 1002, 3145, 1007, 1025, 2065, 1006, 1002, 3643, 999, 1027, 1027, 627...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Mail.php
Zend_Mail.createMessageId
public function createMessageId() { $time = time(); if ($this->_from !== null) { $user = $this->_from; } elseif (isset($_SERVER['REMOTE_ADDR'])) { $user = $_SERVER['REMOTE_ADDR']; } else { $user = getmypid(); } $rand = mt_rand(); if ($this->_recipients !== array()) { $recipient = array_rand($this->_recipients); } else { $recipient = 'unknown'; } if (isset($_SERVER["SERVER_NAME"])) { $hostName = $_SERVER["SERVER_NAME"]; } else { $hostName = php_uname('n'); } return sha1($time . $user . $rand . $recipient) . '@' . $hostName; }
php
public function createMessageId() { $time = time(); if ($this->_from !== null) { $user = $this->_from; } elseif (isset($_SERVER['REMOTE_ADDR'])) { $user = $_SERVER['REMOTE_ADDR']; } else { $user = getmypid(); } $rand = mt_rand(); if ($this->_recipients !== array()) { $recipient = array_rand($this->_recipients); } else { $recipient = 'unknown'; } if (isset($_SERVER["SERVER_NAME"])) { $hostName = $_SERVER["SERVER_NAME"]; } else { $hostName = php_uname('n'); } return sha1($time . $user . $rand . $recipient) . '@' . $hostName; }
[ "public", "function", "createMessageId", "(", ")", "{", "$", "time", "=", "time", "(", ")", ";", "if", "(", "$", "this", "->", "_from", "!==", "null", ")", "{", "$", "user", "=", "$", "this", "->", "_from", ";", "}", "elseif", "(", "isset", "(", ...
Creates the Message-ID @return string
[ "Creates", "the", "Message", "-", "ID" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Mail.php#L1094-L1121
train
Create a unique message id
[ 30522, 2270, 3853, 3443, 7834, 3736, 3351, 3593, 1006, 1007, 1063, 1002, 2051, 1027, 2051, 1006, 1007, 1025, 2065, 1006, 1002, 2023, 1011, 1028, 1035, 2013, 999, 1027, 1027, 19701, 1007, 1063, 1002, 5310, 1027, 1002, 2023, 1011, 1028, 103...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/Uri.php
Uri.fragment
public function fragment($fragment = null) { if ($fragment !== null) { $this->fragment = $fragment; } return $this->fragment; }
php
public function fragment($fragment = null) { if ($fragment !== null) { $this->fragment = $fragment; } return $this->fragment; }
[ "public", "function", "fragment", "(", "$", "fragment", "=", "null", ")", "{", "if", "(", "$", "fragment", "!==", "null", ")", "{", "$", "this", "->", "fragment", "=", "$", "fragment", ";", "}", "return", "$", "this", "->", "fragment", ";", "}" ]
Gets the Fragment portion of a URI (eg #target) @param string $fragment @return string|null
[ "Gets", "the", "Fragment", "portion", "of", "a", "URI", "(", "eg", "#target", ")" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Uri.php#L322-L328
train
Get the fragment
[ 30522, 2270, 3853, 15778, 1006, 1002, 15778, 1027, 19701, 1007, 1063, 2065, 1006, 1002, 15778, 999, 1027, 1027, 19701, 1007, 1063, 1002, 2023, 1011, 1028, 15778, 1027, 1002, 15778, 1025, 1065, 2709, 1002, 2023, 1011, 1028, 15778, 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...
apache/thrift
lib/php/lib/Server/TForkingServer.php
TForkingServer.collectChildren
private function collectChildren() { foreach ($this->children_ as $pid => $transport) { if (pcntl_waitpid($pid, $status, WNOHANG) > 0) { unset($this->children_[$pid]); if ($transport) { @$transport->close(); } } } }
php
private function collectChildren() { foreach ($this->children_ as $pid => $transport) { if (pcntl_waitpid($pid, $status, WNOHANG) > 0) { unset($this->children_[$pid]); if ($transport) { @$transport->close(); } } } }
[ "private", "function", "collectChildren", "(", ")", "{", "foreach", "(", "$", "this", "->", "children_", "as", "$", "pid", "=>", "$", "transport", ")", "{", "if", "(", "pcntl_waitpid", "(", "$", "pid", ",", "$", "status", ",", "WNOHANG", ")", ">", "0...
Collects any children we may have @return void
[ "Collects", "any", "children", "we", "may", "have" ]
acdd4226c210336e9e15eb812e5932a645fcd5ce
https://github.com/apache/thrift/blob/acdd4226c210336e9e15eb812e5932a645fcd5ce/lib/php/lib/Server/TForkingServer.php#L102-L112
train
Collect children from child processes
[ 30522, 2797, 3853, 8145, 19339, 7389, 1006, 30524, 1006, 1002, 2023, 1011, 1028, 2336, 1035, 2004, 1002, 14255, 2094, 1027, 1028, 1002, 3665, 1007, 1063, 2065, 1006, 7473, 3372, 2140, 1035, 3524, 23267, 1006, 1002, 14255, 2094, 1010, 1002, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/DataTable/Manager.php
Manager.getTable
public function getTable($idTable) { if (!isset($this[$idTable])) { throw new TableNotFoundException(sprintf("Error: table id %s not found in memory. (If this error is causing you problems in production, please report it in Matomo issue tracker.)", $idTable)); } return $this[$idTable]; }
php
public function getTable($idTable) { if (!isset($this[$idTable])) { throw new TableNotFoundException(sprintf("Error: table id %s not found in memory. (If this error is causing you problems in production, please report it in Matomo issue tracker.)", $idTable)); } return $this[$idTable]; }
[ "public", "function", "getTable", "(", "$", "idTable", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "[", "$", "idTable", "]", ")", ")", "{", "throw", "new", "TableNotFoundException", "(", "sprintf", "(", "\"Error: table id %s not found in memory. (If t...
Returns the DataTable associated to the ID $idTable. NB: The datatable has to have been instanciated before! This method will not fetch the DataTable from the DB. @param int $idTable @throws Exception If the table can't be found @return DataTable The table
[ "Returns", "the", "DataTable", "associated", "to", "the", "ID", "$idTable", ".", "NB", ":", "The", "datatable", "has", "to", "have", "been", "instanciated", "before!", "This", "method", "will", "not", "fetch", "the", "DataTable", "from", "the", "DB", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/DataTable/Manager.php#L62-L69
train
Get the table from the memory
[ 30522, 2270, 3853, 2131, 10880, 1006, 1002, 8909, 10880, 1007, 1063, 2065, 1006, 999, 26354, 3388, 1006, 1002, 2023, 1031, 1002, 8909, 10880, 1033, 1007, 1007, 1063, 5466, 2047, 2795, 17048, 14876, 8630, 10288, 24422, 1006, 9043, 2546, 1006...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Routing/Matching/UriValidator.php
UriValidator.matches
public function matches(Route $route, Request $request) { $path = $request->path() === '/' ? '/' : '/'.$request->path(); return preg_match($route->getCompiled()->getRegex(), rawurldecode($path)); }
php
public function matches(Route $route, Request $request) { $path = $request->path() === '/' ? '/' : '/'.$request->path(); return preg_match($route->getCompiled()->getRegex(), rawurldecode($path)); }
[ "public", "function", "matches", "(", "Route", "$", "route", ",", "Request", "$", "request", ")", "{", "$", "path", "=", "$", "request", "->", "path", "(", ")", "===", "'/'", "?", "'/'", ":", "'/'", ".", "$", "request", "->", "path", "(", ")", ";...
Validate a given rule against a route and request. @param \Illuminate\Routing\Route $route @param \Illuminate\Http\Request $request @return bool
[ "Validate", "a", "given", "rule", "against", "a", "route", "and", "request", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Routing/Matching/UriValidator.php#L17-L22
train
Returns true if the route matches the request
[ 30522, 2270, 3853, 3503, 1006, 2799, 1002, 2799, 1010, 5227, 1002, 5227, 1007, 1063, 1002, 4130, 1027, 1002, 5227, 1011, 1028, 4130, 1006, 1007, 1027, 1027, 1027, 1005, 1013, 1005, 1029, 1005, 1013, 1005, 1024, 1005, 1013, 1005, 1012, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/Goals/API.php
API.getGoal
public function getGoal($idSite, $idGoal) { Piwik::checkUserHasViewAccess($idSite); $goal = $this->getModel()->getActiveGoal($idSite, $idGoal); if (!empty($goal)) { return $this->formatGoal($goal); } }
php
public function getGoal($idSite, $idGoal) { Piwik::checkUserHasViewAccess($idSite); $goal = $this->getModel()->getActiveGoal($idSite, $idGoal); if (!empty($goal)) { return $this->formatGoal($goal); } }
[ "public", "function", "getGoal", "(", "$", "idSite", ",", "$", "idGoal", ")", "{", "Piwik", "::", "checkUserHasViewAccess", "(", "$", "idSite", ")", ";", "$", "goal", "=", "$", "this", "->", "getModel", "(", ")", "->", "getActiveGoal", "(", "$", "idSit...
Return a single goal. @param int $idSite @param int $idGoal @return array An array of goal attributes.
[ "Return", "a", "single", "goal", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Goals/API.php#L68-L77
train
Returns the goal for the given site and goal name.
[ 30522, 2270, 3853, 2131, 3995, 2389, 1006, 1002, 8909, 28032, 2063, 1010, 1002, 8909, 3995, 2389, 1007, 1063, 14255, 9148, 2243, 1024, 1024, 4638, 20330, 14949, 8584, 6305, 9623, 2015, 1006, 1002, 8909, 28032, 2063, 1007, 1025, 1002, 3125, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Http.php
Http.downloadChunk
public static function downloadChunk($url, $outputPath, $isContinuation) { // make sure file doesn't already exist if we're starting a new download if (!$isContinuation && file_exists($outputPath) ) { throw new Exception( Piwik::translate('General_DownloadFail_FileExists', "'" . $outputPath . "'") . ' ' . Piwik::translate('General_DownloadPleaseRemoveExisting')); } // if we're starting a download, get the expected file size & save as an option $downloadOption = $outputPath . '_expectedDownloadSize'; if (!$isContinuation) { $expectedFileSizeResult = Http::sendHttpRequest( $url, $timeout = 300, $userAgent = null, $destinationPath = null, $followDepth = 0, $acceptLanguage = false, $byteRange = false, $getExtendedInfo = true, $httpMethod = 'HEAD' ); $expectedFileSize = 0; if (isset($expectedFileSizeResult['headers']['Content-Length'])) { $expectedFileSize = (int)$expectedFileSizeResult['headers']['Content-Length']; } if ($expectedFileSize == 0) { Log::info("HEAD request for '%s' failed, got following: %s", $url, print_r($expectedFileSizeResult, true)); throw new Exception(Piwik::translate('General_DownloadFail_HttpRequestFail')); } Option::set($downloadOption, $expectedFileSize); } else { $expectedFileSize = (int)Option::get($downloadOption); if ($expectedFileSize === false) { // sanity check throw new Exception("Trying to continue a download that never started?! That's not supposed to happen..."); } } // if existing file is already big enough, then fail so we don't accidentally overwrite // existing DB $existingSize = file_exists($outputPath) ? filesize($outputPath) : 0; if ($existingSize >= $expectedFileSize) { throw new Exception( Piwik::translate('General_DownloadFail_FileExistsContinue', "'" . $outputPath . "'") . ' ' . Piwik::translate('General_DownloadPleaseRemoveExisting')); } // download a chunk of the file $result = Http::sendHttpRequest( $url, $timeout = 300, $userAgent = null, $destinationPath = null, $followDepth = 0, $acceptLanguage = false, $byteRange = array($existingSize, min($existingSize + 1024 * 1024 - 1, $expectedFileSize)), $getExtendedInfo = true ); if ($result === false || $result['status'] < 200 || $result['status'] > 299 ) { $result['data'] = self::truncateStr($result['data'], 1024); Log::info("Failed to download range '%s-%s' of file from url '%s'. Got result: %s", $byteRange[0], $byteRange[1], $url, print_r($result, true)); throw new Exception(Piwik::translate('General_DownloadFail_HttpRequestFail')); } // write chunk to file $f = fopen($outputPath, 'ab'); fwrite($f, $result['data']); fclose($f); clearstatcache($clear_realpath_cache = true, $outputPath); return array( 'current_size' => filesize($outputPath), 'expected_file_size' => $expectedFileSize, ); }
php
public static function downloadChunk($url, $outputPath, $isContinuation) { // make sure file doesn't already exist if we're starting a new download if (!$isContinuation && file_exists($outputPath) ) { throw new Exception( Piwik::translate('General_DownloadFail_FileExists', "'" . $outputPath . "'") . ' ' . Piwik::translate('General_DownloadPleaseRemoveExisting')); } // if we're starting a download, get the expected file size & save as an option $downloadOption = $outputPath . '_expectedDownloadSize'; if (!$isContinuation) { $expectedFileSizeResult = Http::sendHttpRequest( $url, $timeout = 300, $userAgent = null, $destinationPath = null, $followDepth = 0, $acceptLanguage = false, $byteRange = false, $getExtendedInfo = true, $httpMethod = 'HEAD' ); $expectedFileSize = 0; if (isset($expectedFileSizeResult['headers']['Content-Length'])) { $expectedFileSize = (int)$expectedFileSizeResult['headers']['Content-Length']; } if ($expectedFileSize == 0) { Log::info("HEAD request for '%s' failed, got following: %s", $url, print_r($expectedFileSizeResult, true)); throw new Exception(Piwik::translate('General_DownloadFail_HttpRequestFail')); } Option::set($downloadOption, $expectedFileSize); } else { $expectedFileSize = (int)Option::get($downloadOption); if ($expectedFileSize === false) { // sanity check throw new Exception("Trying to continue a download that never started?! That's not supposed to happen..."); } } // if existing file is already big enough, then fail so we don't accidentally overwrite // existing DB $existingSize = file_exists($outputPath) ? filesize($outputPath) : 0; if ($existingSize >= $expectedFileSize) { throw new Exception( Piwik::translate('General_DownloadFail_FileExistsContinue', "'" . $outputPath . "'") . ' ' . Piwik::translate('General_DownloadPleaseRemoveExisting')); } // download a chunk of the file $result = Http::sendHttpRequest( $url, $timeout = 300, $userAgent = null, $destinationPath = null, $followDepth = 0, $acceptLanguage = false, $byteRange = array($existingSize, min($existingSize + 1024 * 1024 - 1, $expectedFileSize)), $getExtendedInfo = true ); if ($result === false || $result['status'] < 200 || $result['status'] > 299 ) { $result['data'] = self::truncateStr($result['data'], 1024); Log::info("Failed to download range '%s-%s' of file from url '%s'. Got result: %s", $byteRange[0], $byteRange[1], $url, print_r($result, true)); throw new Exception(Piwik::translate('General_DownloadFail_HttpRequestFail')); } // write chunk to file $f = fopen($outputPath, 'ab'); fwrite($f, $result['data']); fclose($f); clearstatcache($clear_realpath_cache = true, $outputPath); return array( 'current_size' => filesize($outputPath), 'expected_file_size' => $expectedFileSize, ); }
[ "public", "static", "function", "downloadChunk", "(", "$", "url", ",", "$", "outputPath", ",", "$", "isContinuation", ")", "{", "// make sure file doesn't already exist if we're starting a new download", "if", "(", "!", "$", "isContinuation", "&&", "file_exists", "(", ...
Downloads the next chunk of a specific file. The next chunk's byte range is determined by the existing file's size and the expected file size, which is stored in the option table before starting a download. The expected file size is obtained through a `HEAD` HTTP request. _Note: this function uses the **Range** HTTP header to accomplish downloading in parts. Not every server supports this header._ The proper use of this function is to call it once per request. The browser should continue to send requests to Piwik which will in turn call this method until the file has completely downloaded. In this way, the user can be informed of a download's progress. **Example Usage** ``` // browser JavaScript var downloadFile = function (isStart) { var ajax = new ajaxHelper(); ajax.addParams({ module: 'MyPlugin', action: 'myAction', isStart: isStart ? 1 : 0 }, 'post'); ajax.setCallback(function (response) { var progress = response.progress // ...update progress... downloadFile(false); }); ajax.send(); } downloadFile(true); ``` ``` // PHP controller action public function myAction() { $outputPath = PIWIK_INCLUDE_PATH . '/tmp/averybigfile.zip'; $isStart = Common::getRequestVar('isStart', 1, 'int'); Http::downloadChunk("http://bigfiles.com/averybigfile.zip", $outputPath, $isStart == 1); } ``` @param string $url The url to download from. @param string $outputPath The path to the file to save/append to. @param bool $isContinuation `true` if this is the continuation of a download, or if we're starting a fresh one. @throws Exception if the file already exists and we're starting a new download, if we're trying to continue a download that never started @return array @api
[ "Downloads", "the", "next", "chunk", "of", "a", "specific", "file", ".", "The", "next", "chunk", "s", "byte", "range", "is", "determined", "by", "the", "existing", "file", "s", "size", "and", "the", "expected", "file", "size", "which", "is", "stored", "i...
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Http.php#L711-L797
train
Downloads a chunk of a URL and saves it to the specified output path.
[ 30522, 2270, 10763, 3853, 8816, 20760, 8950, 1006, 1002, 24471, 2140, 1010, 1002, 6434, 15069, 1010, 1002, 2003, 8663, 7629, 14505, 1007, 1063, 1013, 1013, 2191, 2469, 5371, 2987, 1005, 1056, 2525, 4839, 2065, 2057, 1005, 2128, 3225, 1037, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/BrandSetting.php
BrandSetting.initSettingsData
public function initSettingsData() { $config = App::make('config'); $this->app_name = $config->get('brand.appName', Lang::get('system::lang.app.name')); $this->app_tagline = $config->get('brand.tagline', Lang::get('system::lang.app.tagline')); $this->primary_color = $config->get('brand.primaryColor', self::PRIMARY_COLOR); $this->secondary_color = $config->get('brand.secondaryColor', self::SECONDARY_COLOR); $this->accent_color = $config->get('brand.accentColor', self::ACCENT_COLOR); $this->menu_mode = $config->get('brand.menuMode', self::INLINE_MENU); }
php
public function initSettingsData() { $config = App::make('config'); $this->app_name = $config->get('brand.appName', Lang::get('system::lang.app.name')); $this->app_tagline = $config->get('brand.tagline', Lang::get('system::lang.app.tagline')); $this->primary_color = $config->get('brand.primaryColor', self::PRIMARY_COLOR); $this->secondary_color = $config->get('brand.secondaryColor', self::SECONDARY_COLOR); $this->accent_color = $config->get('brand.accentColor', self::ACCENT_COLOR); $this->menu_mode = $config->get('brand.menuMode', self::INLINE_MENU); }
[ "public", "function", "initSettingsData", "(", ")", "{", "$", "config", "=", "App", "::", "make", "(", "'config'", ")", ";", "$", "this", "->", "app_name", "=", "$", "config", "->", "get", "(", "'brand.appName'", ",", "Lang", "::", "get", "(", "'system...
Initialize the seed data for this model. This only executes when the model is first created or reset to default. @return void
[ "Initialize", "the", "seed", "data", "for", "this", "model", ".", "This", "only", "executes", "when", "the", "model", "is", "first", "created", "or", "reset", "to", "default", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/models/BrandSetting.php#L73-L83
train
Initialize the settings data
[ 30522, 2270, 3853, 1999, 12762, 18319, 3070, 16150, 6790, 1006, 1007, 1063, 1002, 9530, 8873, 2290, 1027, 10439, 1024, 1024, 2191, 1006, 1005, 9530, 8873, 2290, 1005, 1007, 1025, 1002, 2023, 1011, 1028, 10439, 1035, 2171, 1027, 1002, 9530, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/DataTable.php
DataTable.unserializeRows
private function unserializeRows($serialized) { $serialized = str_replace(self::$previousRowClasses, self::$rowClassToUseForUnserialize, $serialized); $rows = Common::safe_unserialize($serialized, [ Row::class, DataTableSummaryRow::class, \Piwik_DataTable_SerializedRow::class ]); if ($rows === false) { throw new Exception("The unserialization has failed!"); } return $rows; }
php
private function unserializeRows($serialized) { $serialized = str_replace(self::$previousRowClasses, self::$rowClassToUseForUnserialize, $serialized); $rows = Common::safe_unserialize($serialized, [ Row::class, DataTableSummaryRow::class, \Piwik_DataTable_SerializedRow::class ]); if ($rows === false) { throw new Exception("The unserialization has failed!"); } return $rows; }
[ "private", "function", "unserializeRows", "(", "$", "serialized", ")", "{", "$", "serialized", "=", "str_replace", "(", "self", "::", "$", "previousRowClasses", ",", "self", "::", "$", "rowClassToUseForUnserialize", ",", "$", "serialized", ")", ";", "$", "rows...
It is faster to unserialize existing serialized Row instances to "Piwik_DataTable_SerializedRow" and access the `$row->c` property than implementing a "__wakeup" method in the Row instance to map the "$row->c" to $row->columns etc. We're talking here about 15% faster reports aggregation in some cases. To be concrete: We have a test where Archiving a year takes 1700 seconds with "__wakeup" and 1400 seconds with this method. Yes, it takes 300 seconds to wake up millions of rows. We should be able to remove this code here end 2015 and use the "__wakeup" way by then. Why? By then most new archives will have only arrays serialized anyway and therefore this mapping is rather an overhead. @param string $serialized @return array @throws Exception In case the unserialize fails
[ "It", "is", "faster", "to", "unserialize", "existing", "serialized", "Row", "instances", "to", "Piwik_DataTable_SerializedRow", "and", "access", "the", "$row", "-", ">", "c", "property", "than", "implementing", "a", "__wakeup", "method", "in", "the", "Row", "ins...
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/DataTable.php#L1365-L1379
train
Unserializes the rows from the given serialized string
[ 30522, 2797, 3853, 4895, 8043, 4818, 17629, 15568, 1006, 1002, 27289, 1007, 1063, 1002, 27289, 1027, 2358, 2099, 1035, 5672, 1006, 2969, 1024, 1024, 1002, 3025, 10524, 26266, 2229, 1010, 2969, 1024, 1024, 1002, 5216, 26266, 24826, 20106, 29...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Messenger/HandleTrait.php
HandleTrait.handle
private function handle($message) { if (!$this->messageBus instanceof MessageBusInterface) { throw new LogicException(sprintf('You must provide a "%s" instance in the "%s::$messageBus" property, "%s" given.', MessageBusInterface::class, \get_class($this), \is_object($this->messageBus) ? \get_class($this->messageBus) : \gettype($this->messageBus))); } $envelope = $this->messageBus->dispatch($message); /** @var HandledStamp[] $handledStamps */ $handledStamps = $envelope->all(HandledStamp::class); if (!$handledStamps) { throw new LogicException(sprintf('Message of type "%s" was handled zero times. Exactly one handler is expected when using "%s::%s()".', \get_class($envelope->getMessage()), \get_class($this), __FUNCTION__)); } if (\count($handledStamps) > 1) { $handlers = implode(', ', array_map(function (HandledStamp $stamp): string { return sprintf('"%s"', $stamp->getHandlerName()); }, $handledStamps)); throw new LogicException(sprintf('Message of type "%s" was handled multiple times. Only one handler is expected when using "%s::%s()", got %d: %s.', \get_class($envelope->getMessage()), \get_class($this), __FUNCTION__, \count($handledStamps), $handlers)); } return $handledStamps[0]->getResult(); }
php
private function handle($message) { if (!$this->messageBus instanceof MessageBusInterface) { throw new LogicException(sprintf('You must provide a "%s" instance in the "%s::$messageBus" property, "%s" given.', MessageBusInterface::class, \get_class($this), \is_object($this->messageBus) ? \get_class($this->messageBus) : \gettype($this->messageBus))); } $envelope = $this->messageBus->dispatch($message); /** @var HandledStamp[] $handledStamps */ $handledStamps = $envelope->all(HandledStamp::class); if (!$handledStamps) { throw new LogicException(sprintf('Message of type "%s" was handled zero times. Exactly one handler is expected when using "%s::%s()".', \get_class($envelope->getMessage()), \get_class($this), __FUNCTION__)); } if (\count($handledStamps) > 1) { $handlers = implode(', ', array_map(function (HandledStamp $stamp): string { return sprintf('"%s"', $stamp->getHandlerName()); }, $handledStamps)); throw new LogicException(sprintf('Message of type "%s" was handled multiple times. Only one handler is expected when using "%s::%s()", got %d: %s.', \get_class($envelope->getMessage()), \get_class($this), __FUNCTION__, \count($handledStamps), $handlers)); } return $handledStamps[0]->getResult(); }
[ "private", "function", "handle", "(", "$", "message", ")", "{", "if", "(", "!", "$", "this", "->", "messageBus", "instanceof", "MessageBusInterface", ")", "{", "throw", "new", "LogicException", "(", "sprintf", "(", "'You must provide a \"%s\" instance in the \"%s::$...
Dispatches the given message, expecting to be handled by a single handler and returns the result from the handler returned value. This behavior is useful for both synchronous command & query buses, the last one usually returning the handler result. @param object|Envelope $message The message or the message pre-wrapped in an envelope @return mixed The handler returned value
[ "Dispatches", "the", "given", "message", "expecting", "to", "be", "handled", "by", "a", "single", "handler", "and", "returns", "the", "result", "from", "the", "handler", "returned", "value", ".", "This", "behavior", "is", "useful", "for", "both", "synchronous"...
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Messenger/HandleTrait.php#L39-L62
train
Handle the message
[ 30522, 2797, 3853, 5047, 1006, 1002, 4471, 1007, 1063, 2065, 1006, 999, 1002, 2023, 1011, 1028, 4471, 8286, 6013, 11253, 4471, 8286, 18447, 2121, 12172, 1007, 1063, 5466, 2047, 7961, 10288, 24422, 1006, 9043, 2546, 1006, 1005, 2017, 2442, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/Updater/Migration/Db/Factory.php
Factory.batchInsert
public function batchInsert($table, $columnNames, $values, $throwException = false, $charset = 'utf8') { $table = $this->prefixTable($table); return $this->container->make('Piwik\Updater\Migration\Db\BatchInsert', array( 'table' => $table, 'columnNames' => $columnNames, 'values' => $values, 'throwException' => $throwException, 'charset' => $charset )); }
php
public function batchInsert($table, $columnNames, $values, $throwException = false, $charset = 'utf8') { $table = $this->prefixTable($table); return $this->container->make('Piwik\Updater\Migration\Db\BatchInsert', array( 'table' => $table, 'columnNames' => $columnNames, 'values' => $values, 'throwException' => $throwException, 'charset' => $charset )); }
[ "public", "function", "batchInsert", "(", "$", "table", ",", "$", "columnNames", ",", "$", "values", ",", "$", "throwException", "=", "false", ",", "$", "charset", "=", "'utf8'", ")", "{", "$", "table", "=", "$", "this", "->", "prefixTable", "(", "$", ...
Performs a batch insert into a specific table using either LOAD DATA INFILE or plain INSERTs, as a fallback. On MySQL, LOAD DATA INFILE is 20x faster than a series of plain INSERTs. Please note that queries for batch inserts are currently not shown to an end user and should therefore not be returned in an `Updates::getMigrations` method. Instead it needs to be execute directly in `Updates::doUpdate` via `$updater->executeMigration($factory->dbBatchInsert(...));` @param string $table Unprefixed database table name, eg 'log_visit'. @param string[] $columnNames An array of unquoted column names, eg array('column_name1', 'column_name_2') @param array $values An array of data to be inserted, eg array(array('row1column1', 'row1column2'),array('row2column1', 'row2column2')) @param bool $throwException Whether to throw an exception that was caught while trying LOAD DATA INFILE, or not. @param string $charset The charset to use, defaults to utf8 @return BatchInsert
[ "Performs", "a", "batch", "insert", "into", "a", "specific", "table", "using", "either", "LOAD", "DATA", "INFILE", "or", "plain", "INSERTs", "as", "a", "fallback", ".", "On", "MySQL", "LOAD", "DATA", "INFILE", "is", "20x", "faster", "than", "a", "series", ...
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Updater/Migration/Db/Factory.php#L384-L392
train
Batch insert data into the database
[ 30522, 2270, 3853, 14108, 7076, 8743, 1006, 1002, 2795, 1010, 1002, 5930, 18442, 2015, 1010, 1002, 5300, 1010, 1002, 5466, 10288, 24422, 1027, 6270, 1010, 1002, 25869, 13462, 1027, 1005, 21183, 2546, 2620, 1005, 1007, 1063, 1002, 2795, 1027...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Db/Adapter/Oracle.php
Zend_Db_Adapter_Oracle.lastInsertId
public function lastInsertId($tableName = null, $primaryKey = null) { if ($tableName !== null) { $sequenceName = $tableName; if ($primaryKey) { $sequenceName .= "_$primaryKey"; } $sequenceName .= '_seq'; return $this->lastSequenceId($sequenceName); } // No support for IDENTITY columns; return null return null; }
php
public function lastInsertId($tableName = null, $primaryKey = null) { if ($tableName !== null) { $sequenceName = $tableName; if ($primaryKey) { $sequenceName .= "_$primaryKey"; } $sequenceName .= '_seq'; return $this->lastSequenceId($sequenceName); } // No support for IDENTITY columns; return null return null; }
[ "public", "function", "lastInsertId", "(", "$", "tableName", "=", "null", ",", "$", "primaryKey", "=", "null", ")", "{", "if", "(", "$", "tableName", "!==", "null", ")", "{", "$", "sequenceName", "=", "$", "tableName", ";", "if", "(", "$", "primaryKey"...
Gets the last ID generated automatically by an IDENTITY/AUTOINCREMENT column. As a convention, on RDBMS brands that support sequences (e.g. Oracle, PostgreSQL, DB2), this method forms the name of a sequence from the arguments and returns the last id generated by that sequence. On RDBMS brands that support IDENTITY/AUTOINCREMENT columns, this method returns the last value generated for such a column, and the table name argument is disregarded. Oracle does not support IDENTITY columns, so if the sequence is not specified, this method returns null. @param string $tableName OPTIONAL Name of table. @param string $primaryKey OPTIONAL Name of primary key column. @return string
[ "Gets", "the", "last", "ID", "generated", "automatically", "by", "an", "IDENTITY", "/", "AUTOINCREMENT", "column", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Adapter/Oracle.php#L298-L311
train
Returns last ID of the table
[ 30522, 2270, 3853, 2197, 7076, 8743, 3593, 1006, 1002, 2795, 18442, 1027, 19701, 1010, 1002, 3078, 14839, 1027, 19701, 1007, 1063, 2065, 1006, 1002, 2795, 18442, 999, 1027, 1027, 19701, 1007, 1063, 1002, 5537, 18442, 1027, 1002, 2795, 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...
walkor/Workerman
Connection/AsyncUdpConnection.php
AsyncUdpConnection.connect
public function connect() { if ($this->connected === true) { return; } if ($this->_contextOption) { $context = stream_context_create($this->_contextOption); $this->_socket = stream_socket_client("udp://{$this->_remoteAddress}", $errno, $errmsg, 30, STREAM_CLIENT_CONNECT, $context); } else { $this->_socket = stream_socket_client("udp://{$this->_remoteAddress}", $errno, $errmsg); } if (!$this->_socket) { Worker::safeEcho(new \Exception($errmsg)); return; } stream_set_blocking($this->_socket, false); if ($this->onMessage) { Worker::$globalEvent->add($this->_socket, EventInterface::EV_READ, array($this, 'baseRead')); } $this->connected = true; // Try to emit onConnect callback. if ($this->onConnect) { try { call_user_func($this->onConnect, $this); } catch (\Exception $e) { Worker::log($e); exit(250); } catch (\Error $e) { Worker::log($e); exit(250); } } }
php
public function connect() { if ($this->connected === true) { return; } if ($this->_contextOption) { $context = stream_context_create($this->_contextOption); $this->_socket = stream_socket_client("udp://{$this->_remoteAddress}", $errno, $errmsg, 30, STREAM_CLIENT_CONNECT, $context); } else { $this->_socket = stream_socket_client("udp://{$this->_remoteAddress}", $errno, $errmsg); } if (!$this->_socket) { Worker::safeEcho(new \Exception($errmsg)); return; } stream_set_blocking($this->_socket, false); if ($this->onMessage) { Worker::$globalEvent->add($this->_socket, EventInterface::EV_READ, array($this, 'baseRead')); } $this->connected = true; // Try to emit onConnect callback. if ($this->onConnect) { try { call_user_func($this->onConnect, $this); } catch (\Exception $e) { Worker::log($e); exit(250); } catch (\Error $e) { Worker::log($e); exit(250); } } }
[ "public", "function", "connect", "(", ")", "{", "if", "(", "$", "this", "->", "connected", "===", "true", ")", "{", "return", ";", "}", "if", "(", "$", "this", "->", "_contextOption", ")", "{", "$", "context", "=", "stream_context_create", "(", "$", ...
Connect. @return void
[ "Connect", "." ]
13649907f05014fcfffcfccaef01e63ad3339351
https://github.com/walkor/Workerman/blob/13649907f05014fcfffcfccaef01e63ad3339351/Connection/AsyncUdpConnection.php#L171-L207
train
Connect to the local server
[ 30522, 2270, 3853, 7532, 1006, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 4198, 1027, 1027, 1027, 2995, 1007, 1063, 2709, 1025, 1065, 2065, 1006, 1002, 2023, 1011, 1028, 1035, 6123, 7361, 3508, 1007, 1063, 1002, 6123, 1027, 5460, 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...
slimphp/Slim
Slim/Router.php
Router.urlFor
public function urlFor($name, array $data = [], array $queryParams = []) { $url = $this->relativePathFor($name, $data, $queryParams); if ($this->basePath) { $url = $this->basePath . $url; } return $url; }
php
public function urlFor($name, array $data = [], array $queryParams = []) { $url = $this->relativePathFor($name, $data, $queryParams); if ($this->basePath) { $url = $this->basePath . $url; } return $url; }
[ "public", "function", "urlFor", "(", "$", "name", ",", "array", "$", "data", "=", "[", "]", ",", "array", "$", "queryParams", "=", "[", "]", ")", "{", "$", "url", "=", "$", "this", "->", "relativePathFor", "(", "$", "name", ",", "$", "data", ",",...
Build the path for a named route including the base path @param string $name Route name @param array $data Named argument replacement data @param array $queryParams Optional query string parameters @return string @throws RuntimeException If named route does not exist @throws InvalidArgumentException If required data not provided
[ "Build", "the", "path", "for", "a", "named", "route", "including", "the", "base", "path" ]
ccef5f7d8bcd469d59cbe64f6210d83764f91543
https://github.com/slimphp/Slim/blob/ccef5f7d8bcd469d59cbe64f6210d83764f91543/Slim/Router.php#L412-L421
train
Get the url for a given name
[ 30522, 2270, 3853, 24471, 10270, 2953, 1006, 1002, 2171, 1010, 9140, 1002, 2951, 1027, 1031, 1033, 1010, 9140, 1002, 23032, 28689, 5244, 1027, 1031, 1033, 1007, 1063, 1002, 24471, 2140, 1027, 1002, 2023, 1011, 1028, 5816, 15069, 29278, 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...
walkor/Workerman
Worker.php
Worker.run
public function run() { //Update process state. static::$_status = static::STATUS_RUNNING; // Register shutdown function for checking errors. register_shutdown_function(array("\\Workerman\\Worker", 'checkErrors')); // Set autoload root path. Autoloader::setRootPath($this->_autoloadRootPath); // Create a global event loop. if (!static::$globalEvent) { $event_loop_class = static::getEventLoopName(); static::$globalEvent = new $event_loop_class; $this->resumeAccept(); } // Reinstall signal. static::reinstallSignal(); // Init Timer. Timer::init(static::$globalEvent); // Set an empty onMessage callback. if (empty($this->onMessage)) { $this->onMessage = function () {}; } restore_error_handler(); // Try to emit onWorkerStart callback. if ($this->onWorkerStart) { try { call_user_func($this->onWorkerStart, $this); } catch (\Exception $e) { static::log($e); // Avoid rapid infinite loop exit. sleep(1); exit(250); } catch (\Error $e) { static::log($e); // Avoid rapid infinite loop exit. sleep(1); exit(250); } } // Main loop. static::$globalEvent->loop(); }
php
public function run() { //Update process state. static::$_status = static::STATUS_RUNNING; // Register shutdown function for checking errors. register_shutdown_function(array("\\Workerman\\Worker", 'checkErrors')); // Set autoload root path. Autoloader::setRootPath($this->_autoloadRootPath); // Create a global event loop. if (!static::$globalEvent) { $event_loop_class = static::getEventLoopName(); static::$globalEvent = new $event_loop_class; $this->resumeAccept(); } // Reinstall signal. static::reinstallSignal(); // Init Timer. Timer::init(static::$globalEvent); // Set an empty onMessage callback. if (empty($this->onMessage)) { $this->onMessage = function () {}; } restore_error_handler(); // Try to emit onWorkerStart callback. if ($this->onWorkerStart) { try { call_user_func($this->onWorkerStart, $this); } catch (\Exception $e) { static::log($e); // Avoid rapid infinite loop exit. sleep(1); exit(250); } catch (\Error $e) { static::log($e); // Avoid rapid infinite loop exit. sleep(1); exit(250); } } // Main loop. static::$globalEvent->loop(); }
[ "public", "function", "run", "(", ")", "{", "//Update process state.", "static", "::", "$", "_status", "=", "static", "::", "STATUS_RUNNING", ";", "// Register shutdown function for checking errors.", "register_shutdown_function", "(", "array", "(", "\"\\\\Workerman\\\\Work...
Run worker instance. @return void
[ "Run", "worker", "instance", "." ]
13649907f05014fcfffcfccaef01e63ad3339351
https://github.com/walkor/Workerman/blob/13649907f05014fcfffcfccaef01e63ad3339351/Worker.php#L2308-L2358
train
Runs the main process
[ 30522, 2270, 3853, 2448, 1006, 1007, 1063, 1013, 1013, 10651, 2832, 2110, 1012, 10763, 1024, 1024, 1002, 1035, 3570, 1027, 10763, 1024, 1024, 3570, 1035, 2770, 1025, 1013, 1013, 4236, 3844, 7698, 3853, 2005, 9361, 10697, 1012, 4236, 1035, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/backend/traits/WidgetMaker.php
WidgetMaker.makeWidget
public function makeWidget($class, $widgetConfig = []) { $controller = property_exists($this, 'controller') && $this->controller ? $this->controller : $this; if (!class_exists($class)) { throw new SystemException(Lang::get('backend::lang.widget.not_registered', [ 'name' => $class ])); } return new $class($controller, $widgetConfig); }
php
public function makeWidget($class, $widgetConfig = []) { $controller = property_exists($this, 'controller') && $this->controller ? $this->controller : $this; if (!class_exists($class)) { throw new SystemException(Lang::get('backend::lang.widget.not_registered', [ 'name' => $class ])); } return new $class($controller, $widgetConfig); }
[ "public", "function", "makeWidget", "(", "$", "class", ",", "$", "widgetConfig", "=", "[", "]", ")", "{", "$", "controller", "=", "property_exists", "(", "$", "this", ",", "'controller'", ")", "&&", "$", "this", "->", "controller", "?", "$", "this", "-...
Makes a widget object with the supplied configuration file. @param string $class Widget class name @param array $widgetConfig An array of config. @return \Backend\Classes\WidgetBase The widget object
[ "Makes", "a", "widget", "object", "with", "the", "supplied", "configuration", "file", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/traits/WidgetMaker.php#L24-L37
train
Create a widget
[ 30522, 2270, 3853, 2191, 9148, 24291, 1006, 1002, 2465, 1010, 1002, 15536, 24291, 8663, 8873, 2290, 1027, 1031, 1033, 1007, 1063, 1002, 11486, 1027, 3200, 1035, 6526, 1006, 1002, 2023, 1010, 1005, 11486, 1005, 1007, 1004, 1004, 1002, 2023, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Cache/Backend/File.php
Zend_Cache_Backend_File.touch
public function touch($id, $extraLifetime) { $metadatas = $this->_getMetadatas($id); if (!$metadatas) { return false; } if (time() > $metadatas['expire']) { return false; } $newMetadatas = array( 'hash' => $metadatas['hash'], 'mtime' => time(), 'expire' => $metadatas['expire'] + $extraLifetime, 'tags' => $metadatas['tags'] ); $res = $this->_setMetadatas($id, $newMetadatas); if (!$res) { return false; } return true; }
php
public function touch($id, $extraLifetime) { $metadatas = $this->_getMetadatas($id); if (!$metadatas) { return false; } if (time() > $metadatas['expire']) { return false; } $newMetadatas = array( 'hash' => $metadatas['hash'], 'mtime' => time(), 'expire' => $metadatas['expire'] + $extraLifetime, 'tags' => $metadatas['tags'] ); $res = $this->_setMetadatas($id, $newMetadatas); if (!$res) { return false; } return true; }
[ "public", "function", "touch", "(", "$", "id", ",", "$", "extraLifetime", ")", "{", "$", "metadatas", "=", "$", "this", "->", "_getMetadatas", "(", "$", "id", ")", ";", "if", "(", "!", "$", "metadatas", ")", "{", "return", "false", ";", "}", "if", ...
Give (if possible) an extra lifetime to the given cache id @param string $id cache id @param int $extraLifetime @return boolean true if ok
[ "Give", "(", "if", "possible", ")", "an", "extra", "lifetime", "to", "the", "given", "cache", "id" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Cache/Backend/File.php#L405-L425
train
Touch a record
[ 30522, 2270, 3853, 3543, 1006, 1002, 8909, 1010, 1002, 4469, 15509, 7292, 1007, 1063, 1002, 27425, 2015, 1027, 1002, 2023, 1011, 1028, 1035, 2131, 11368, 8447, 10230, 1006, 1002, 8909, 1007, 1025, 2065, 1006, 999, 1002, 27425, 2015, 1007, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/backend/traits/FormModelWidget.php
FormModelWidget.getRelationObject
protected function getRelationObject() { list($model, $attribute) = $this->resolveModelAttribute($this->valueFrom); if (!$model) { throw new ApplicationException(Lang::get('backend::lang.model.missing_relation', [ 'class' => get_class($this->model), 'relation' => $this->valueFrom ])); } if (!$model->hasRelation($attribute)) { throw new ApplicationException(Lang::get('backend::lang.model.missing_relation', [ 'class' => get_class($model), 'relation' => $attribute ])); } return $model->{$attribute}(); }
php
protected function getRelationObject() { list($model, $attribute) = $this->resolveModelAttribute($this->valueFrom); if (!$model) { throw new ApplicationException(Lang::get('backend::lang.model.missing_relation', [ 'class' => get_class($this->model), 'relation' => $this->valueFrom ])); } if (!$model->hasRelation($attribute)) { throw new ApplicationException(Lang::get('backend::lang.model.missing_relation', [ 'class' => get_class($model), 'relation' => $attribute ])); } return $model->{$attribute}(); }
[ "protected", "function", "getRelationObject", "(", ")", "{", "list", "(", "$", "model", ",", "$", "attribute", ")", "=", "$", "this", "->", "resolveModelAttribute", "(", "$", "this", "->", "valueFrom", ")", ";", "if", "(", "!", "$", "model", ")", "{", ...
Returns the value as a relation object from the model, supports nesting via HTML array. @return Relation
[ "Returns", "the", "value", "as", "a", "relation", "object", "from", "the", "model", "supports", "nesting", "via", "HTML", "array", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/traits/FormModelWidget.php#L70-L89
train
Get the relation object
[ 30522, 5123, 3853, 2131, 16570, 3370, 16429, 20614, 1006, 1007, 1063, 2862, 1006, 1002, 2944, 1010, 1002, 17961, 1007, 1027, 1002, 2023, 1011, 1028, 10663, 5302, 9247, 19321, 3089, 8569, 2618, 1006, 1002, 2023, 1011, 1028, 3643, 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...
octobercms/october
modules/cms/twig/DebugExtension.php
DebugExtension.evalMethodDesc
protected function evalMethodDesc($variable) { $parts = explode('|', $variable); if (count($parts) < 2) { return null; } $method = $parts[1]; return $this->commentMap[$method] ?? null; }
php
protected function evalMethodDesc($variable) { $parts = explode('|', $variable); if (count($parts) < 2) { return null; } $method = $parts[1]; return $this->commentMap[$method] ?? null; }
[ "protected", "function", "evalMethodDesc", "(", "$", "variable", ")", "{", "$", "parts", "=", "explode", "(", "'|'", ",", "$", "variable", ")", ";", "if", "(", "count", "(", "$", "parts", ")", "<", "2", ")", "{", "return", "null", ";", "}", "$", ...
Evaluate an method type for description @param object $variable @return string
[ "Evaluate", "an", "method", "type", "for", "description" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/twig/DebugExtension.php#L370-L379
train
Evaluate method description
[ 30522, 5123, 3853, 9345, 13728, 11031, 7716, 6155, 2278, 1006, 1002, 8023, 1007, 1063, 1002, 3033, 1027, 15044, 1006, 1005, 1064, 1005, 1010, 1002, 8023, 1007, 1025, 2065, 1006, 4175, 1006, 1002, 3033, 1007, 1026, 1016, 1007, 1063, 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...
laravel/framework
src/Illuminate/Database/Query/Grammars/Grammar.php
Grammar.concatenateWhereClauses
protected function concatenateWhereClauses($query, $sql) { $conjunction = $query instanceof JoinClause ? 'on' : 'where'; return $conjunction.' '.$this->removeLeadingBoolean(implode(' ', $sql)); }
php
protected function concatenateWhereClauses($query, $sql) { $conjunction = $query instanceof JoinClause ? 'on' : 'where'; return $conjunction.' '.$this->removeLeadingBoolean(implode(' ', $sql)); }
[ "protected", "function", "concatenateWhereClauses", "(", "$", "query", ",", "$", "sql", ")", "{", "$", "conjunction", "=", "$", "query", "instanceof", "JoinClause", "?", "'on'", ":", "'where'", ";", "return", "$", "conjunction", ".", "' '", ".", "$", "this...
Format the where clause statements into one string. @param \Illuminate\Database\Query\Builder $query @param array $sql @return string
[ "Format", "the", "where", "clause", "statements", "into", "one", "string", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Query/Grammars/Grammar.php#L217-L222
train
Concatenates where clauses
[ 30522, 5123, 3853, 9530, 16280, 12556, 2860, 5886, 8586, 28128, 2229, 1006, 1002, 23032, 1010, 1002, 29296, 1007, 1063, 1002, 9595, 1027, 1002, 23032, 6013, 11253, 3693, 20464, 20559, 2063, 1029, 1005, 2006, 1005, 1024, 1005, 2073, 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...
symfony/symfony
src/Symfony/Component/Console/Question/Question.php
Question.setMaxAttempts
public function setMaxAttempts($attempts) { if (null !== $attempts && $attempts < 1) { throw new InvalidArgumentException('Maximum number of attempts must be a positive value.'); } $this->attempts = $attempts; return $this; }
php
public function setMaxAttempts($attempts) { if (null !== $attempts && $attempts < 1) { throw new InvalidArgumentException('Maximum number of attempts must be a positive value.'); } $this->attempts = $attempts; return $this; }
[ "public", "function", "setMaxAttempts", "(", "$", "attempts", ")", "{", "if", "(", "null", "!==", "$", "attempts", "&&", "$", "attempts", "<", "1", ")", "{", "throw", "new", "InvalidArgumentException", "(", "'Maximum number of attempts must be a positive value.'", ...
Sets the maximum number of attempts. Null means an unlimited number of attempts. @param int|null $attempts @return $this @throws InvalidArgumentException in case the number of attempts is invalid
[ "Sets", "the", "maximum", "number", "of", "attempts", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Console/Question/Question.php#L222-L231
train
Set maximum number of attempts
[ 30522, 2270, 3853, 2275, 17848, 19321, 6633, 22798, 1006, 1002, 4740, 1007, 1063, 2065, 1006, 19701, 999, 1027, 1027, 1002, 4740, 1004, 1004, 1002, 4740, 1026, 1015, 1007, 1063, 5466, 2047, 19528, 2906, 22850, 15781, 2595, 24422, 1006, 1005...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
guzzle/guzzle
src/MessageFormatter.php
MessageFormatter.format
public function format( RequestInterface $request, ResponseInterface $response = null, \Exception $error = null ) { $cache = []; return preg_replace_callback( '/{\s*([A-Za-z_\-\.0-9]+)\s*}/', function (array $matches) use ($request, $response, $error, &$cache) { if (isset($cache[$matches[1]])) { return $cache[$matches[1]]; } $result = ''; switch ($matches[1]) { case 'request': $result = Psr7\str($request); break; case 'response': $result = $response ? Psr7\str($response) : ''; break; case 'req_headers': $result = trim($request->getMethod() . ' ' . $request->getRequestTarget()) . ' HTTP/' . $request->getProtocolVersion() . "\r\n" . $this->headers($request); break; case 'res_headers': $result = $response ? sprintf( 'HTTP/%s %d %s', $response->getProtocolVersion(), $response->getStatusCode(), $response->getReasonPhrase() ) . "\r\n" . $this->headers($response) : 'NULL'; break; case 'req_body': $result = $request->getBody(); break; case 'res_body': $result = $response ? $response->getBody() : 'NULL'; break; case 'ts': case 'date_iso_8601': $result = gmdate('c'); break; case 'date_common_log': $result = date('d/M/Y:H:i:s O'); break; case 'method': $result = $request->getMethod(); break; case 'version': $result = $request->getProtocolVersion(); break; case 'uri': case 'url': $result = $request->getUri(); break; case 'target': $result = $request->getRequestTarget(); break; case 'req_version': $result = $request->getProtocolVersion(); break; case 'res_version': $result = $response ? $response->getProtocolVersion() : 'NULL'; break; case 'host': $result = $request->getHeaderLine('Host'); break; case 'hostname': $result = gethostname(); break; case 'code': $result = $response ? $response->getStatusCode() : 'NULL'; break; case 'phrase': $result = $response ? $response->getReasonPhrase() : 'NULL'; break; case 'error': $result = $error ? $error->getMessage() : 'NULL'; break; default: // handle prefixed dynamic headers if (strpos($matches[1], 'req_header_') === 0) { $result = $request->getHeaderLine(substr($matches[1], 11)); } elseif (strpos($matches[1], 'res_header_') === 0) { $result = $response ? $response->getHeaderLine(substr($matches[1], 11)) : 'NULL'; } } $cache[$matches[1]] = $result; return $result; }, $this->template ); }
php
public function format( RequestInterface $request, ResponseInterface $response = null, \Exception $error = null ) { $cache = []; return preg_replace_callback( '/{\s*([A-Za-z_\-\.0-9]+)\s*}/', function (array $matches) use ($request, $response, $error, &$cache) { if (isset($cache[$matches[1]])) { return $cache[$matches[1]]; } $result = ''; switch ($matches[1]) { case 'request': $result = Psr7\str($request); break; case 'response': $result = $response ? Psr7\str($response) : ''; break; case 'req_headers': $result = trim($request->getMethod() . ' ' . $request->getRequestTarget()) . ' HTTP/' . $request->getProtocolVersion() . "\r\n" . $this->headers($request); break; case 'res_headers': $result = $response ? sprintf( 'HTTP/%s %d %s', $response->getProtocolVersion(), $response->getStatusCode(), $response->getReasonPhrase() ) . "\r\n" . $this->headers($response) : 'NULL'; break; case 'req_body': $result = $request->getBody(); break; case 'res_body': $result = $response ? $response->getBody() : 'NULL'; break; case 'ts': case 'date_iso_8601': $result = gmdate('c'); break; case 'date_common_log': $result = date('d/M/Y:H:i:s O'); break; case 'method': $result = $request->getMethod(); break; case 'version': $result = $request->getProtocolVersion(); break; case 'uri': case 'url': $result = $request->getUri(); break; case 'target': $result = $request->getRequestTarget(); break; case 'req_version': $result = $request->getProtocolVersion(); break; case 'res_version': $result = $response ? $response->getProtocolVersion() : 'NULL'; break; case 'host': $result = $request->getHeaderLine('Host'); break; case 'hostname': $result = gethostname(); break; case 'code': $result = $response ? $response->getStatusCode() : 'NULL'; break; case 'phrase': $result = $response ? $response->getReasonPhrase() : 'NULL'; break; case 'error': $result = $error ? $error->getMessage() : 'NULL'; break; default: // handle prefixed dynamic headers if (strpos($matches[1], 'req_header_') === 0) { $result = $request->getHeaderLine(substr($matches[1], 11)); } elseif (strpos($matches[1], 'res_header_') === 0) { $result = $response ? $response->getHeaderLine(substr($matches[1], 11)) : 'NULL'; } } $cache[$matches[1]] = $result; return $result; }, $this->template ); }
[ "public", "function", "format", "(", "RequestInterface", "$", "request", ",", "ResponseInterface", "$", "response", "=", "null", ",", "\\", "Exception", "$", "error", "=", "null", ")", "{", "$", "cache", "=", "[", "]", ";", "return", "preg_replace_callback",...
Returns a formatted message string. @param RequestInterface $request Request that was sent @param ResponseInterface $response Response that was received @param \Exception $error Exception that was received @return string
[ "Returns", "a", "formatted", "message", "string", "." ]
bf595424e4d442a190582e088985dc835a789071
https://github.com/guzzle/guzzle/blob/bf595424e4d442a190582e088985dc835a789071/src/MessageFormatter.php#L66-L169
train
Formats the response and error into a string
[ 30522, 2270, 3853, 4289, 1006, 5227, 18447, 2121, 12172, 1002, 5227, 1010, 3433, 18447, 2121, 12172, 1002, 3433, 1027, 19701, 1010, 1032, 6453, 1002, 7561, 1027, 19701, 1007, 1063, 1002, 17053, 1027, 1031, 1033, 1025, 2709, 3653, 2290, 1035...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Form/Extension/DataCollector/FormDataCollector.php
FormDataCollector.buildPreliminaryFormTree
public function buildPreliminaryFormTree(FormInterface $form) { $this->data['forms'][$form->getName()] = &$this->recursiveBuildPreliminaryFormTree($form, $this->data['forms_by_hash']); }
php
public function buildPreliminaryFormTree(FormInterface $form) { $this->data['forms'][$form->getName()] = &$this->recursiveBuildPreliminaryFormTree($form, $this->data['forms_by_hash']); }
[ "public", "function", "buildPreliminaryFormTree", "(", "FormInterface", "$", "form", ")", "{", "$", "this", "->", "data", "[", "'forms'", "]", "[", "$", "form", "->", "getName", "(", ")", "]", "=", "&", "$", "this", "->", "recursiveBuildPreliminaryFormTree",...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Extension/DataCollector/FormDataCollector.php#L205-L208
train
Build preliminary form tree
[ 30522, 2270, 3853, 3857, 28139, 17960, 3981, 2854, 14192, 13334, 1006, 2433, 18447, 2121, 12172, 1002, 2433, 1007, 1063, 1002, 2023, 1011, 1028, 2951, 1031, 1005, 3596, 1005, 1033, 1031, 1002, 2433, 1011, 1028, 2131, 18442, 1006, 1007, 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...
laravel/framework
src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php
HasAttributes.wasChanged
public function wasChanged($attributes = null) { return $this->hasChanges( $this->getChanges(), is_array($attributes) ? $attributes : func_get_args() ); }
php
public function wasChanged($attributes = null) { return $this->hasChanges( $this->getChanges(), is_array($attributes) ? $attributes : func_get_args() ); }
[ "public", "function", "wasChanged", "(", "$", "attributes", "=", "null", ")", "{", "return", "$", "this", "->", "hasChanges", "(", "$", "this", "->", "getChanges", "(", ")", ",", "is_array", "(", "$", "attributes", ")", "?", "$", "attributes", ":", "fu...
Determine if the model or any of the given attribute(s) have been modified. @param array|string|null $attributes @return bool
[ "Determine", "if", "the", "model", "or", "any", "of", "the", "given", "attribute", "(", "s", ")", "have", "been", "modified", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php#L1082-L1087
train
Returns true if the record was changed
[ 30522, 2270, 3853, 2001, 22305, 2098, 1006, 1002, 12332, 1027, 19701, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 2038, 22305, 2229, 1006, 1002, 2023, 1011, 1028, 2131, 22305, 2229, 1006, 1007, 1010, 2003, 1035, 9140, 1006, 1002, 12332, 1007,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Intl/Data/Bundle/Writer/TextBundleWriter.php
TextBundleWriter.writeResource
private function writeResource($file, $value, $indentation, $requireBraces = true) { if (\is_int($value)) { $this->writeInteger($file, $value); return; } if ($value instanceof \Traversable) { $value = iterator_to_array($value); } if (\is_array($value)) { $intValues = \count($value) === \count(array_filter($value, 'is_int')); $keys = array_keys($value); // check that the keys are 0-indexed and ascending $intKeys = $keys === range(0, \count($keys) - 1); if ($intValues && $intKeys) { $this->writeIntVector($file, $value, $indentation); return; } if ($intKeys) { $this->writeArray($file, $value, $indentation); return; } $this->writeTable($file, $value, $indentation); return; } if (\is_bool($value)) { $value = $value ? 'true' : 'false'; } $this->writeString($file, (string) $value, $requireBraces); }
php
private function writeResource($file, $value, $indentation, $requireBraces = true) { if (\is_int($value)) { $this->writeInteger($file, $value); return; } if ($value instanceof \Traversable) { $value = iterator_to_array($value); } if (\is_array($value)) { $intValues = \count($value) === \count(array_filter($value, 'is_int')); $keys = array_keys($value); // check that the keys are 0-indexed and ascending $intKeys = $keys === range(0, \count($keys) - 1); if ($intValues && $intKeys) { $this->writeIntVector($file, $value, $indentation); return; } if ($intKeys) { $this->writeArray($file, $value, $indentation); return; } $this->writeTable($file, $value, $indentation); return; } if (\is_bool($value)) { $value = $value ? 'true' : 'false'; } $this->writeString($file, (string) $value, $requireBraces); }
[ "private", "function", "writeResource", "(", "$", "file", ",", "$", "value", ",", "$", "indentation", ",", "$", "requireBraces", "=", "true", ")", "{", "if", "(", "\\", "is_int", "(", "$", "value", ")", ")", "{", "$", "this", "->", "writeInteger", "(...
Writes a "resource" node. @param resource $file The file handle to write to @param mixed $value The value of the node @param int $indentation The number of levels to indent @param bool $requireBraces Whether to require braces to be printedaround the value @see http://source.icu-project.org/repos/icu/icuhtml/trunk/design/bnf_rb.txt
[ "Writes", "a", "resource", "node", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Intl/Data/Bundle/Writer/TextBundleWriter.php#L73-L115
train
Write the resource
[ 30522, 2797, 3853, 3213, 2229, 8162, 3401, 1006, 1002, 5371, 1010, 1002, 3643, 1010, 1002, 27427, 19304, 1010, 1002, 5478, 10024, 9623, 1027, 2995, 1007, 1063, 2065, 1006, 1032, 2003, 1035, 20014, 1006, 1002, 3643, 1007, 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...
octobercms/october
modules/cms/ServiceProvider.php
ServiceProvider.registerBackendReportWidgets
protected function registerBackendReportWidgets() { WidgetManager::instance()->registerReportWidgets(function ($manager) { $manager->registerReportWidget(\Cms\ReportWidgets\ActiveTheme::class, [ 'label' => 'cms::lang.dashboard.active_theme.widget_title_default', 'context' => 'dashboard' ]); }); }
php
protected function registerBackendReportWidgets() { WidgetManager::instance()->registerReportWidgets(function ($manager) { $manager->registerReportWidget(\Cms\ReportWidgets\ActiveTheme::class, [ 'label' => 'cms::lang.dashboard.active_theme.widget_title_default', 'context' => 'dashboard' ]); }); }
[ "protected", "function", "registerBackendReportWidgets", "(", ")", "{", "WidgetManager", "::", "instance", "(", ")", "->", "registerReportWidgets", "(", "function", "(", "$", "manager", ")", "{", "$", "manager", "->", "registerReportWidget", "(", "\\", "Cms", "\...
/* Register report widgets
[ "/", "*", "Register", "report", "widgets" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/ServiceProvider.php#L175-L183
train
Registers the report widgets for the backend
[ 30522, 5123, 3853, 4236, 5963, 10497, 2890, 6442, 9148, 28682, 1006, 1007, 1063, 15536, 24291, 24805, 4590, 1024, 1024, 6013, 1006, 1007, 1011, 1028, 4236, 2890, 6442, 9148, 28682, 1006, 3853, 1006, 1002, 3208, 1007, 1063, 1002, 3208, 1011,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/backend/widgets/MediaManager.php
MediaManager.splitPathToSegments
protected function splitPathToSegments($path) { $path = MediaLibrary::validatePath($path, true); $path = explode('/', ltrim($path, '/')); $result = []; while (count($path) > 0) { $folder = array_pop($path); $result[$folder] = implode('/', $path).'/'.$folder; if (substr($result[$folder], 0, 1) != '/') { $result[$folder] = '/'.$result[$folder]; } } return array_reverse($result, true); }
php
protected function splitPathToSegments($path) { $path = MediaLibrary::validatePath($path, true); $path = explode('/', ltrim($path, '/')); $result = []; while (count($path) > 0) { $folder = array_pop($path); $result[$folder] = implode('/', $path).'/'.$folder; if (substr($result[$folder], 0, 1) != '/') { $result[$folder] = '/'.$result[$folder]; } } return array_reverse($result, true); }
[ "protected", "function", "splitPathToSegments", "(", "$", "path", ")", "{", "$", "path", "=", "MediaLibrary", "::", "validatePath", "(", "$", "path", ",", "true", ")", ";", "$", "path", "=", "explode", "(", "'/'", ",", "ltrim", "(", "$", "path", ",", ...
Splits a path in to segments @param string $path @return array
[ "Splits", "a", "path", "in", "to", "segments" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/MediaManager.php#L1106-L1122
train
Split path to segments
[ 30522, 5123, 3853, 3975, 15069, 22282, 21693, 11187, 1006, 1002, 4130, 1007, 1063, 1002, 4130, 1027, 23828, 12322, 19848, 2100, 1024, 1024, 9398, 3686, 15069, 1006, 1002, 4130, 1010, 2995, 1007, 1025, 1002, 4130, 1027, 15044, 1006, 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...
z-song/laravel-admin
src/Traits/ModelTree.php
ModelTree.selectOptions
public static function selectOptions(\Closure $closure = null, $rootText = 'Root') { $options = (new static())->withQuery($closure)->buildSelectOptions(); return collect($options)->prepend($rootText, 0)->all(); }
php
public static function selectOptions(\Closure $closure = null, $rootText = 'Root') { $options = (new static())->withQuery($closure)->buildSelectOptions(); return collect($options)->prepend($rootText, 0)->all(); }
[ "public", "static", "function", "selectOptions", "(", "\\", "Closure", "$", "closure", "=", "null", ",", "$", "rootText", "=", "'Root'", ")", "{", "$", "options", "=", "(", "new", "static", "(", ")", ")", "->", "withQuery", "(", "$", "closure", ")", ...
Get options for Select field in form. @param \Closure|null $closure @param string $rootText @return array
[ "Get", "options", "for", "Select", "field", "in", "form", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Traits/ModelTree.php#L238-L243
train
Get select options
[ 30522, 2270, 10763, 3853, 7276, 7361, 9285, 1006, 1032, 8503, 1002, 8503, 1027, 19701, 1010, 1002, 7117, 18209, 1027, 1005, 7117, 1005, 1007, 1063, 1002, 7047, 1027, 1006, 2047, 10763, 1006, 1007, 1007, 1011, 1028, 2007, 4226, 2854, 1006, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/Tracker.php
Tracker.initCorePiwikInTrackerMode
public static function initCorePiwikInTrackerMode() { if (SettingsServer::isTrackerApiRequest() && self::$initTrackerMode === false ) { self::$initTrackerMode = true; require_once PIWIK_INCLUDE_PATH . '/core/Option.php'; Access::getInstance(); Config::getInstance(); try { Db::get(); } catch (Exception $e) { Db::createDatabaseObject(); } PluginManager::getInstance()->loadCorePluginsDuringTracker(); } }
php
public static function initCorePiwikInTrackerMode() { if (SettingsServer::isTrackerApiRequest() && self::$initTrackerMode === false ) { self::$initTrackerMode = true; require_once PIWIK_INCLUDE_PATH . '/core/Option.php'; Access::getInstance(); Config::getInstance(); try { Db::get(); } catch (Exception $e) { Db::createDatabaseObject(); } PluginManager::getInstance()->loadCorePluginsDuringTracker(); } }
[ "public", "static", "function", "initCorePiwikInTrackerMode", "(", ")", "{", "if", "(", "SettingsServer", "::", "isTrackerApiRequest", "(", ")", "&&", "self", "::", "$", "initTrackerMode", "===", "false", ")", "{", "self", "::", "$", "initTrackerMode", "=", "t...
Used to initialize core Piwik components on a piwik.php request Eg. when cache is missed and we will be calling some APIs to generate cache
[ "Used", "to", "initialize", "core", "Piwik", "components", "on", "a", "piwik", ".", "php", "request", "Eg", ".", "when", "cache", "is", "missed", "and", "we", "will", "be", "calling", "some", "APIs", "to", "generate", "cache" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Tracker.php#L150-L169
train
Initialize core piwik in tracker mode
[ 30522, 2270, 10763, 3853, 1999, 4183, 17345, 8197, 9148, 4939, 6494, 9102, 5302, 3207, 1006, 1007, 1063, 2065, 1006, 10906, 8043, 30524, 9331, 7442, 15500, 1006, 1007, 1004, 1004, 2969, 1024, 1024, 1002, 1999, 12474, 22648, 5484, 5302, 3207...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Eloquent/SoftDeletes.php
SoftDeletes.runSoftDelete
protected function runSoftDelete() { $query = $this->setKeysForSaveQuery($this->newModelQuery()); $time = $this->freshTimestamp(); $columns = [$this->getDeletedAtColumn() => $this->fromDateTime($time)]; $this->{$this->getDeletedAtColumn()} = $time; if ($this->timestamps && ! is_null($this->getUpdatedAtColumn())) { $this->{$this->getUpdatedAtColumn()} = $time; $columns[$this->getUpdatedAtColumn()] = $this->fromDateTime($time); } $query->update($columns); }
php
protected function runSoftDelete() { $query = $this->setKeysForSaveQuery($this->newModelQuery()); $time = $this->freshTimestamp(); $columns = [$this->getDeletedAtColumn() => $this->fromDateTime($time)]; $this->{$this->getDeletedAtColumn()} = $time; if ($this->timestamps && ! is_null($this->getUpdatedAtColumn())) { $this->{$this->getUpdatedAtColumn()} = $time; $columns[$this->getUpdatedAtColumn()] = $this->fromDateTime($time); } $query->update($columns); }
[ "protected", "function", "runSoftDelete", "(", ")", "{", "$", "query", "=", "$", "this", "->", "setKeysForSaveQuery", "(", "$", "this", "->", "newModelQuery", "(", ")", ")", ";", "$", "time", "=", "$", "this", "->", "freshTimestamp", "(", ")", ";", "$"...
Perform the actual delete query on this model instance. @return void
[ "Perform", "the", "actual", "delete", "query", "on", "this", "model", "instance", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/SoftDeletes.php#L79-L96
train
Soft Delete Model
[ 30522, 5123, 3853, 3216, 15794, 9247, 12870, 1006, 1007, 1063, 1002, 23032, 1027, 1002, 2023, 1011, 1028, 2275, 14839, 22747, 5668, 10696, 4226, 2854, 1006, 1002, 2023, 1011, 1028, 2047, 5302, 9247, 4226, 2854, 1006, 1007, 1007, 1025, 1002,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Security/Core/Authentication/Provider/PreAuthenticatedAuthenticationProvider.php
PreAuthenticatedAuthenticationProvider.authenticate
public function authenticate(TokenInterface $token) { if (!$this->supports($token)) { throw new AuthenticationException('The token is not supported by this authentication provider.'); } if (!$user = $token->getUser()) { throw new BadCredentialsException('No pre-authenticated principal found in request.'); } $user = $this->userProvider->loadUserByUsername($user); $this->userChecker->checkPostAuth($user); $authenticatedToken = new PreAuthenticatedToken($user, $token->getCredentials(), $this->providerKey, $user->getRoles()); $authenticatedToken->setAttributes($token->getAttributes()); return $authenticatedToken; }
php
public function authenticate(TokenInterface $token) { if (!$this->supports($token)) { throw new AuthenticationException('The token is not supported by this authentication provider.'); } if (!$user = $token->getUser()) { throw new BadCredentialsException('No pre-authenticated principal found in request.'); } $user = $this->userProvider->loadUserByUsername($user); $this->userChecker->checkPostAuth($user); $authenticatedToken = new PreAuthenticatedToken($user, $token->getCredentials(), $this->providerKey, $user->getRoles()); $authenticatedToken->setAttributes($token->getAttributes()); return $authenticatedToken; }
[ "public", "function", "authenticate", "(", "TokenInterface", "$", "token", ")", "{", "if", "(", "!", "$", "this", "->", "supports", "(", "$", "token", ")", ")", "{", "throw", "new", "AuthenticationException", "(", "'The token is not supported by this authenticatio...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Security/Core/Authentication/Provider/PreAuthenticatedAuthenticationProvider.php#L47-L65
train
Authenticate a token
[ 30522, 2270, 3853, 14469, 3686, 1006, 19204, 18447, 2121, 12172, 1002, 19204, 1007, 1063, 2065, 1006, 999, 1002, 2023, 1011, 1028, 6753, 1006, 1002, 19204, 1007, 1007, 1063, 5466, 2047, 27280, 10288, 24422, 1006, 1005, 1996, 19204, 2003, 20...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Cache/Core.php
Zend_Cache_Core._validateTagsArray
protected static function _validateTagsArray($tags) { if (!is_array($tags)) { Zend_Cache::throwException('Invalid tags array : must be an array'); } foreach($tags as $tag) { self::_validateIdOrTag($tag); } reset($tags); }
php
protected static function _validateTagsArray($tags) { if (!is_array($tags)) { Zend_Cache::throwException('Invalid tags array : must be an array'); } foreach($tags as $tag) { self::_validateIdOrTag($tag); } reset($tags); }
[ "protected", "static", "function", "_validateTagsArray", "(", "$", "tags", ")", "{", "if", "(", "!", "is_array", "(", "$", "tags", ")", ")", "{", "Zend_Cache", "::", "throwException", "(", "'Invalid tags array : must be an array'", ")", ";", "}", "foreach", "(...
Validate a tags array (security, reliable filenames, reserved prefixes...) Throw an exception if a problem is found @param array $tags Array of tags @throws Zend_Cache_Exception @return void
[ "Validate", "a", "tags", "array", "(", "security", "reliable", "filenames", "reserved", "prefixes", "...", ")" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Cache/Core.php#L691-L700
train
Validate tags array
[ 30522, 5123, 10763, 3853, 1035, 9398, 3686, 15900, 10286, 9447, 1006, 1002, 22073, 1007, 1063, 2065, 1006, 999, 2003, 1035, 9140, 1006, 1002, 22073, 1007, 1007, 1063, 16729, 2094, 1035, 17053, 1024, 1024, 5466, 10288, 24422, 1006, 1005, 195...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Concerns/ManagesLayouts.php
ManagesLayouts.yieldContent
public function yieldContent($section, $default = '') { $sectionContent = $default instanceof View ? $default : e($default); if (isset($this->sections[$section])) { $sectionContent = $this->sections[$section]; } $sectionContent = str_replace('@@parent', '--parent--holder--', $sectionContent); return str_replace( '--parent--holder--', '@parent', str_replace(static::parentPlaceholder($section), '', $sectionContent) ); }
php
public function yieldContent($section, $default = '') { $sectionContent = $default instanceof View ? $default : e($default); if (isset($this->sections[$section])) { $sectionContent = $this->sections[$section]; } $sectionContent = str_replace('@@parent', '--parent--holder--', $sectionContent); return str_replace( '--parent--holder--', '@parent', str_replace(static::parentPlaceholder($section), '', $sectionContent) ); }
[ "public", "function", "yieldContent", "(", "$", "section", ",", "$", "default", "=", "''", ")", "{", "$", "sectionContent", "=", "$", "default", "instanceof", "View", "?", "$", "default", ":", "e", "(", "$", "default", ")", ";", "if", "(", "isset", "...
Get the string contents of a section. @param string $section @param string $default @return string
[ "Get", "the", "string", "contents", "of", "a", "section", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/View/Concerns/ManagesLayouts.php#L147-L160
train
Yields content of a section
[ 30522, 2270, 3853, 10750, 8663, 6528, 2102, 1006, 1002, 2930, 1010, 1002, 12398, 1027, 1005, 1005, 1007, 1063, 1002, 2930, 8663, 6528, 2102, 1027, 1002, 12398, 6013, 11253, 3193, 1029, 1002, 12398, 1024, 1041, 1006, 1002, 12398, 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...
overtrue/wechat
src/OfficialAccount/Broadcasting/Client.php
Client.sendVoice
public function sendVoice(string $mediaId, $reception = null, array $attributes = []) { return $this->sendMessage(new Media($mediaId, 'voice'), $reception, $attributes); }
php
public function sendVoice(string $mediaId, $reception = null, array $attributes = []) { return $this->sendMessage(new Media($mediaId, 'voice'), $reception, $attributes); }
[ "public", "function", "sendVoice", "(", "string", "$", "mediaId", ",", "$", "reception", "=", "null", ",", "array", "$", "attributes", "=", "[", "]", ")", "{", "return", "$", "this", "->", "sendMessage", "(", "new", "Media", "(", "$", "mediaId", ",", ...
Send a voice message. @param string $mediaId @param mixed $reception @param array $attributes @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException @throws \EasyWeChat\Kernel\Exceptions\RuntimeException
[ "Send", "a", "voice", "message", "." ]
120c72faaa93c270365bc75c73c362d5fd583209
https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/OfficialAccount/Broadcasting/Client.php#L163-L166
train
Send voice message
[ 30522, 2270, 3853, 4604, 6767, 6610, 1006, 5164, 1002, 2865, 3593, 1010, 1002, 7684, 1027, 19701, 1010, 9140, 1002, 12332, 1027, 1031, 1033, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 4604, 7834, 3736, 3351, 1006, 2047, 2865, 1006, 1002, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
z-song/laravel-admin
src/Form/Field/MultipleImage.php
MultipleImage.prepareForeach
protected function prepareForeach(UploadedFile $image = null) { $this->name = $this->getStoreName($image); $this->callInterventionMethods($image->getRealPath()); return tap($this->upload($image), function () { $this->name = null; }); }
php
protected function prepareForeach(UploadedFile $image = null) { $this->name = $this->getStoreName($image); $this->callInterventionMethods($image->getRealPath()); return tap($this->upload($image), function () { $this->name = null; }); }
[ "protected", "function", "prepareForeach", "(", "UploadedFile", "$", "image", "=", "null", ")", "{", "$", "this", "->", "name", "=", "$", "this", "->", "getStoreName", "(", "$", "image", ")", ";", "$", "this", "->", "callInterventionMethods", "(", "$", "...
Prepare for each file. @param UploadedFile $image @return mixed|string
[ "Prepare", "for", "each", "file", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Form/Field/MultipleImage.php#L30-L39
train
Prepare the image for upload.
[ 30522, 5123, 3853, 7374, 29278, 5243, 2818, 1006, 21345, 8873, 2571, 1002, 3746, 1027, 19701, 1007, 1063, 1002, 2023, 1011, 1028, 2171, 1027, 1002, 2023, 1011, 1028, 4152, 19277, 18442, 1006, 1002, 3746, 1007, 1025, 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/UsersManager/UserPreferences.php
UserPreferences.getDefaultPeriod
public function getDefaultPeriod($defaultDate = null) { list($defaultDate, $defaultPeriod) = $this->getDefaultDateAndPeriod($defaultDate); return $defaultPeriod; }
php
public function getDefaultPeriod($defaultDate = null) { list($defaultDate, $defaultPeriod) = $this->getDefaultDateAndPeriod($defaultDate); return $defaultPeriod; }
[ "public", "function", "getDefaultPeriod", "(", "$", "defaultDate", "=", "null", ")", "{", "list", "(", "$", "defaultDate", ",", "$", "defaultPeriod", ")", "=", "$", "this", "->", "getDefaultDateAndPeriod", "(", "$", "defaultDate", ")", ";", "return", "$", ...
Returns default period type for Piwik reports. @param string $defaultDate the default date string from which the default period will be guessed @return string `'day'`, `'week'`, `'month'`, `'year'` or `'range'` @api
[ "Returns", "default", "period", "type", "for", "Piwik", "reports", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/UsersManager/UserPreferences.php#L100-L105
train
getDefaultPeriod - Get default period
[ 30522, 2270, 3853, 2131, 3207, 7011, 11314, 4842, 3695, 2094, 1006, 1002, 12398, 13701, 1027, 19701, 1007, 1063, 2862, 1006, 1002, 12398, 13701, 1010, 1002, 12398, 4842, 3695, 2094, 1007, 1027, 1002, 2023, 1011, 1028, 2131, 3207, 7011, 1131...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Core.php
Zend_Cache_Core.getMetadatas
public function getMetadatas($id) { if (!$this->_extendedBackend) { Zend_Cache::throwException(self::BACKEND_NOT_IMPLEMENTS_EXTENDED_IF); } $id = $this->_id($id); // cache id may need prefix return $this->_backend->getMetadatas($id); }
php
public function getMetadatas($id) { if (!$this->_extendedBackend) { Zend_Cache::throwException(self::BACKEND_NOT_IMPLEMENTS_EXTENDED_IF); } $id = $this->_id($id); // cache id may need prefix return $this->_backend->getMetadatas($id); }
[ "public", "function", "getMetadatas", "(", "$", "id", ")", "{", "if", "(", "!", "$", "this", "->", "_extendedBackend", ")", "{", "Zend_Cache", "::", "throwException", "(", "self", "::", "BACKEND_NOT_IMPLEMENTS_EXTENDED_IF", ")", ";", "}", "$", "id", "=", "...
Return an array of metadatas for the given cache id The array will include these keys : - expire : the expire timestamp - tags : a string array of tags - mtime : timestamp of last modification time @param string $id cache id @return array array of metadatas (false if the cache id is not found)
[ "Return", "an", "array", "of", "metadatas", "for", "the", "given", "cache", "id" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Cache/Core.php#L633-L640
train
Get all the metadata for the given cache id
[ 30522, 2270, 3853, 2131, 11368, 8447, 10230, 1006, 1002, 8909, 1007, 1063, 2065, 1006, 999, 1002, 2023, 1011, 1028, 1035, 3668, 5963, 10497, 1007, 1063, 16729, 2094, 1035, 17053, 1024, 1024, 5466, 10288, 24422, 1006, 2969, 1024, 1024, 2067,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/MailManager.php
MailManager.render
public function render($content, $data = []) { if (!$content) { return ''; } $html = $this->renderTwig($content, $data); $html = Markdown::parseSafe($html); return $html; }
php
public function render($content, $data = []) { if (!$content) { return ''; } $html = $this->renderTwig($content, $data); $html = Markdown::parseSafe($html); return $html; }
[ "public", "function", "render", "(", "$", "content", ",", "$", "data", "=", "[", "]", ")", "{", "if", "(", "!", "$", "content", ")", "{", "return", "''", ";", "}", "$", "html", "=", "$", "this", "->", "renderTwig", "(", "$", "content", ",", "$"...
Render the Markdown template into HTML. @param string $content @param array $data @return string
[ "Render", "the", "Markdown", "template", "into", "HTML", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/MailManager.php#L171-L182
train
Render Twig Template
[ 30522, 2270, 3853, 17552, 1006, 1002, 4180, 1010, 1002, 2951, 1027, 1031, 1033, 1007, 1063, 2065, 1006, 999, 1002, 4180, 1007, 1063, 2709, 1005, 1005, 1025, 1065, 1002, 16129, 1027, 1002, 2023, 1011, 1028, 17552, 2102, 16279, 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/Workflow/Definition.php
Definition.getInitialPlace
public function getInitialPlace() { @trigger_error(sprintf('Calling %s::getInitialPlace() is deprecated. Call %s::getInitialPlaces() instead.', __CLASS__, __CLASS__)); if (!$this->initialPlaces) { return null; } return reset($this->initialPlaces); }
php
public function getInitialPlace() { @trigger_error(sprintf('Calling %s::getInitialPlace() is deprecated. Call %s::getInitialPlaces() instead.', __CLASS__, __CLASS__)); if (!$this->initialPlaces) { return null; } return reset($this->initialPlaces); }
[ "public", "function", "getInitialPlace", "(", ")", "{", "@", "trigger_error", "(", "sprintf", "(", "'Calling %s::getInitialPlace() is deprecated. Call %s::getInitialPlaces() instead.'", ",", "__CLASS__", ",", "__CLASS__", ")", ")", ";", "if", "(", "!", "$", "this", "-...
@deprecated since Symfony 4.3. Use the getInitialPlaces() instead. @return string|null
[ "@deprecated", "since", "Symfony", "4", ".", "3", ".", "Use", "the", "getInitialPlaces", "()", "instead", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Workflow/Definition.php#L55-L64
train
Returns the initial place
[ 30522, 2270, 3853, 2131, 5498, 20925, 24759, 10732, 1006, 1007, 1063, 1030, 9495, 1035, 7561, 1006, 9043, 2546, 1006, 1005, 4214, 1003, 1055, 1024, 1024, 2131, 5498, 20925, 24759, 10732, 1006, 1007, 2003, 2139, 28139, 12921, 1012, 2655, 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
libs/Zend/Validate/InArray.php
Zend_Validate_InArray.isValid
public function isValid($value) { $this->_setValue($value); if ($this->getRecursive()) { $iterator = new RecursiveIteratorIterator(new RecursiveArrayIterator($this->_haystack)); foreach($iterator as $element) { if ($this->_strict) { if ($element === $value) { return true; } } else if ($element == $value) { return true; } } } else { if (in_array($value, $this->_haystack, $this->_strict)) { return true; } } $this->_error(self::NOT_IN_ARRAY); return false; }
php
public function isValid($value) { $this->_setValue($value); if ($this->getRecursive()) { $iterator = new RecursiveIteratorIterator(new RecursiveArrayIterator($this->_haystack)); foreach($iterator as $element) { if ($this->_strict) { if ($element === $value) { return true; } } else if ($element == $value) { return true; } } } else { if (in_array($value, $this->_haystack, $this->_strict)) { return true; } } $this->_error(self::NOT_IN_ARRAY); return false; }
[ "public", "function", "isValid", "(", "$", "value", ")", "{", "$", "this", "->", "_setValue", "(", "$", "value", ")", ";", "if", "(", "$", "this", "->", "getRecursive", "(", ")", ")", "{", "$", "iterator", "=", "new", "RecursiveIteratorIterator", "(", ...
Defined by Zend_Validate_Interface Returns true if and only if $value is contained in the haystack option. If the strict option is true, then the type of $value is also checked. @param mixed $value @return boolean
[ "Defined", "by", "Zend_Validate_Interface" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Validate/InArray.php#L181-L203
train
Checks if the value is in the array
[ 30522, 2270, 3853, 2003, 10175, 3593, 1006, 1002, 3643, 1007, 1063, 1002, 2023, 1011, 1028, 1035, 2275, 10175, 5657, 1006, 1002, 3643, 1007, 1025, 2065, 1006, 1002, 2023, 1011, 1028, 2131, 2890, 10841, 2869, 3512, 1006, 1007, 1007, 1063, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
z-song/laravel-admin
src/Grid/Tools/TotalRow.php
TotalRow.total
protected function total($column, $display) { if (!is_callable($display) && !is_null($display)) { return $display; } $sum = $this->query->sum($column); if (is_callable($display)) { return call_user_func($display, $sum); } return $sum; }
php
protected function total($column, $display) { if (!is_callable($display) && !is_null($display)) { return $display; } $sum = $this->query->sum($column); if (is_callable($display)) { return call_user_func($display, $sum); } return $sum; }
[ "protected", "function", "total", "(", "$", "column", ",", "$", "display", ")", "{", "if", "(", "!", "is_callable", "(", "$", "display", ")", "&&", "!", "is_null", "(", "$", "display", ")", ")", "{", "return", "$", "display", ";", "}", "$", "sum", ...
Get total value of current column. @param string $column @param mixed $display @return mixed
[ "Get", "total", "value", "of", "current", "column", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid/Tools/TotalRow.php#L42-L55
train
Return the sum of a column
[ 30522, 5123, 3853, 2561, 1006, 1002, 5930, 1010, 1002, 4653, 1007, 1063, 2065, 1006, 999, 2003, 1035, 2655, 3085, 1006, 1002, 4653, 1007, 1004, 1004, 999, 2003, 1035, 19701, 1006, 1002, 4653, 1007, 1007, 1063, 2709, 1002, 4653, 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...
symfony/symfony
src/Symfony/Component/BrowserKit/CookieJar.php
CookieJar.flushExpiredCookies
public function flushExpiredCookies() { foreach ($this->cookieJar as $domain => $pathCookies) { foreach ($pathCookies as $path => $namedCookies) { foreach ($namedCookies as $name => $cookie) { if ($cookie->isExpired()) { unset($this->cookieJar[$domain][$path][$name]); } } } } }
php
public function flushExpiredCookies() { foreach ($this->cookieJar as $domain => $pathCookies) { foreach ($pathCookies as $path => $namedCookies) { foreach ($namedCookies as $name => $cookie) { if ($cookie->isExpired()) { unset($this->cookieJar[$domain][$path][$name]); } } } } }
[ "public", "function", "flushExpiredCookies", "(", ")", "{", "foreach", "(", "$", "this", "->", "cookieJar", "as", "$", "domain", "=>", "$", "pathCookies", ")", "{", "foreach", "(", "$", "pathCookies", "as", "$", "path", "=>", "$", "namedCookies", ")", "{...
Removes all expired cookies.
[ "Removes", "all", "expired", "cookies", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/BrowserKit/CookieJar.php#L227-L238
train
Flush expired cookies
[ 30522, 2270, 3853, 13862, 10288, 21649, 3597, 23212, 2229, 1006, 1007, 1063, 18921, 6776, 1006, 1002, 2023, 1011, 1028, 17387, 16084, 2004, 1002, 5884, 1027, 1028, 1002, 4130, 3597, 23212, 2229, 1007, 1063, 18921, 6776, 1006, 1002, 4130, 35...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Support/ServiceProvider.php
ServiceProvider.pathsToPublish
public static function pathsToPublish($provider = null, $group = null) { if (! is_null($paths = static::pathsForProviderOrGroup($provider, $group))) { return $paths; } return collect(static::$publishes)->reduce(function ($paths, $p) { return array_merge($paths, $p); }, []); }
php
public static function pathsToPublish($provider = null, $group = null) { if (! is_null($paths = static::pathsForProviderOrGroup($provider, $group))) { return $paths; } return collect(static::$publishes)->reduce(function ($paths, $p) { return array_merge($paths, $p); }, []); }
[ "public", "static", "function", "pathsToPublish", "(", "$", "provider", "=", "null", ",", "$", "group", "=", "null", ")", "{", "if", "(", "!", "is_null", "(", "$", "paths", "=", "static", "::", "pathsForProviderOrGroup", "(", "$", "provider", ",", "$", ...
Get the paths to publish. @param string $provider @param string $group @return array
[ "Get", "the", "paths", "to", "publish", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Support/ServiceProvider.php#L204-L213
train
Get all paths to publish
[ 30522, 2270, 10763, 3853, 10425, 14399, 12083, 13602, 1006, 1002, 10802, 1027, 19701, 1010, 1002, 2177, 1027, 19701, 1007, 1063, 2065, 1006, 999, 2003, 1035, 19701, 1006, 1002, 10425, 1027, 10763, 1024, 1024, 10425, 29278, 21572, 17258, 10624...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/models/MailPartial.php
MailPartial.createPartials
public static function createPartials() { $dbPartials = self::lists('code', 'code'); $definitions = MailManager::instance()->listRegisteredPartials(); foreach ($definitions as $code => $path) { if (array_key_exists($code, $dbPartials)) { continue; } $partial = new static; $partial->code = $code; $partial->is_custom = 0; $partial->fillFromView($path); $partial->save(); } }
php
public static function createPartials() { $dbPartials = self::lists('code', 'code'); $definitions = MailManager::instance()->listRegisteredPartials(); foreach ($definitions as $code => $path) { if (array_key_exists($code, $dbPartials)) { continue; } $partial = new static; $partial->code = $code; $partial->is_custom = 0; $partial->fillFromView($path); $partial->save(); } }
[ "public", "static", "function", "createPartials", "(", ")", "{", "$", "dbPartials", "=", "self", "::", "lists", "(", "'code'", ",", "'code'", ")", ";", "$", "definitions", "=", "MailManager", "::", "instance", "(", ")", "->", "listRegisteredPartials", "(", ...
Loops over each mail layout and ensures the system has a layout, if the layout does not exist, it will create one. @return void
[ "Loops", "over", "each", "mail", "layout", "and", "ensures", "the", "system", "has", "a", "layout", "if", "the", "layout", "does", "not", "exist", "it", "will", "create", "one", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/models/MailPartial.php#L73-L89
train
Create partials for all mails
[ 30522, 2270, 10763, 3853, 3443, 19362, 20925, 2015, 1006, 1007, 1063, 1002, 16962, 19362, 20925, 2015, 1027, 2969, 1024, 1024, 7201, 1006, 1005, 3642, 1005, 1010, 1005, 3642, 1005, 1007, 1025, 1002, 15182, 1027, 5653, 24805, 4590, 1024, 102...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/Utils.php
Utils.arrayFlattenDotNotation
public static function arrayFlattenDotNotation($array, $prepend = '') { $results = array(); foreach ($array as $key => $value) { if (is_array($value)) { $results = array_merge($results, static::arrayFlattenDotNotation($value, $prepend.$key.'.')); } else { $results[$prepend.$key] = $value; } } return $results; }
php
public static function arrayFlattenDotNotation($array, $prepend = '') { $results = array(); foreach ($array as $key => $value) { if (is_array($value)) { $results = array_merge($results, static::arrayFlattenDotNotation($value, $prepend.$key.'.')); } else { $results[$prepend.$key] = $value; } } return $results; }
[ "public", "static", "function", "arrayFlattenDotNotation", "(", "$", "array", ",", "$", "prepend", "=", "''", ")", "{", "$", "results", "=", "array", "(", ")", ";", "foreach", "(", "$", "array", "as", "$", "key", "=>", "$", "value", ")", "{", "if", ...
Flatten a multi-dimensional associative array into dot notation @param array $array @param string $prepend @return array
[ "Flatten", "a", "multi", "-", "dimensional", "associative", "array", "into", "dot", "notation" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Utils.php#L929-L941
train
Flatten a dot notation array into a single level
[ 30522, 2270, 10763, 3853, 9140, 10258, 19321, 10497, 4140, 17048, 3370, 1006, 1002, 9140, 1010, 1002, 17463, 10497, 1027, 1005, 1005, 1007, 1063, 1002, 3463, 1027, 9140, 1006, 1007, 1025, 18921, 6776, 1006, 1002, 9140, 2004, 1002, 3145, 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/Settings/Plugin/UserSettings.php
UserSettings.makeSetting
protected function makeSetting($name, $defaultValue, $type, $configureCallback) { $userLogin = Piwik::getCurrentUserLogin(); $setting = new UserSetting($name, $defaultValue, $type, $this->pluginName, $userLogin); $setting->setConfigureCallback($configureCallback); $this->addSetting($setting); return $setting; }
php
protected function makeSetting($name, $defaultValue, $type, $configureCallback) { $userLogin = Piwik::getCurrentUserLogin(); $setting = new UserSetting($name, $defaultValue, $type, $this->pluginName, $userLogin); $setting->setConfigureCallback($configureCallback); $this->addSetting($setting); return $setting; }
[ "protected", "function", "makeSetting", "(", "$", "name", ",", "$", "defaultValue", ",", "$", "type", ",", "$", "configureCallback", ")", "{", "$", "userLogin", "=", "Piwik", "::", "getCurrentUserLogin", "(", ")", ";", "$", "setting", "=", "new", "UserSett...
Creates a new user setting. Settings will be displayed in the UI depending on the order of `makeSetting` calls. This means you can define the order of the displayed settings by calling makeSetting first for more important settings. @param string $name The name of the setting that shall be created @param mixed $defaultValue The default value for this setting. Note the value will not be converted to the specified type. @param string $type The PHP internal type the value of this setting should have. Use one of FieldConfig::TYPE_* constancts @param \Closure $fieldConfigCallback A callback method to configure the field that shall be displayed in the UI to define the value for this setting @return UserSetting Returns an instance of the created measurable setting.
[ "Creates", "a", "new", "user", "setting", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Settings/Plugin/UserSettings.php#L57-L66
train
Create a new user setting and add it to the user setting list
[ 30522, 5123, 3853, 3084, 18319, 3070, 1006, 1002, 2171, 1010, 1002, 12398, 10175, 5657, 1010, 1002, 2828, 1010, 1002, 9530, 8873, 27390, 19281, 3363, 5963, 1007, 1063, 1002, 5310, 21197, 2378, 1027, 14255, 9148, 2243, 1024, 1024, 2131, 1084...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Translation/MessageCatalogue.php
MessageCatalogue.addMetadata
private function addMetadata(array $values) { foreach ($values as $domain => $keys) { foreach ($keys as $key => $value) { $this->setMetadata($key, $value, $domain); } } }
php
private function addMetadata(array $values) { foreach ($values as $domain => $keys) { foreach ($keys as $key => $value) { $this->setMetadata($key, $value, $domain); } } }
[ "private", "function", "addMetadata", "(", "array", "$", "values", ")", "{", "foreach", "(", "$", "values", "as", "$", "domain", "=>", "$", "keys", ")", "{", "foreach", "(", "$", "keys", "as", "$", "key", "=>", "$", "value", ")", "{", "$", "this", ...
Adds current values with the new values. @param array $values Values to add
[ "Adds", "current", "values", "with", "the", "new", "values", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Translation/MessageCatalogue.php#L293-L300
train
Add metadata to the page
[ 30522, 2797, 3853, 5587, 11368, 8447, 2696, 1006, 9140, 1002, 5300, 1007, 1063, 18921, 6776, 1006, 1002, 5300, 2004, 1002, 5884, 1027, 1028, 1002, 6309, 1007, 1063, 18921, 6776, 1006, 1002, 6309, 2004, 1002, 3145, 1027, 1028, 1002, 3643, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/GPM/Licenses.php
Licenses.set
public static function set($slug, $license) { $licenses = self::getLicenseFile(); $data = (array)$licenses->content(); $slug = strtolower($slug); if ($license && !self::validate($license)) { return false; } if (!\is_string($license)) { if (isset($data['licenses'][$slug])) { unset($data['licenses'][$slug]); } else { return false; } } else { $data['licenses'][$slug] = $license; } $licenses->save($data); $licenses->free(); return true; }
php
public static function set($slug, $license) { $licenses = self::getLicenseFile(); $data = (array)$licenses->content(); $slug = strtolower($slug); if ($license && !self::validate($license)) { return false; } if (!\is_string($license)) { if (isset($data['licenses'][$slug])) { unset($data['licenses'][$slug]); } else { return false; } } else { $data['licenses'][$slug] = $license; } $licenses->save($data); $licenses->free(); return true; }
[ "public", "static", "function", "set", "(", "$", "slug", ",", "$", "license", ")", "{", "$", "licenses", "=", "self", "::", "getLicenseFile", "(", ")", ";", "$", "data", "=", "(", "array", ")", "$", "licenses", "->", "content", "(", ")", ";", "$", ...
Returns the license for a Premium package @param string $slug @param string $license @return bool
[ "Returns", "the", "license", "for", "a", "Premium", "package" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/GPM/Licenses.php#L41-L65
train
Set License.
[ 30522, 2270, 10763, 3853, 2275, 1006, 1002, 23667, 1010, 1002, 6105, 1007, 1063, 1002, 15943, 1027, 2969, 1024, 1024, 2131, 13231, 12325, 8873, 2571, 1006, 1007, 1025, 1002, 2951, 1027, 1006, 9140, 1007, 1002, 15943, 1011, 1028, 4180, 1006,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/ViewDataTable/Request.php
Request.loadDataTableFromAPI
public function loadDataTableFromAPI() { // we build the request (URL) to call the API $requestArray = $this->getRequestArray(); // we make the request to the API $request = new ApiRequest($requestArray); // and get the DataTable structure $dataTable = $request->process(); return $dataTable; }
php
public function loadDataTableFromAPI() { // we build the request (URL) to call the API $requestArray = $this->getRequestArray(); // we make the request to the API $request = new ApiRequest($requestArray); // and get the DataTable structure $dataTable = $request->process(); return $dataTable; }
[ "public", "function", "loadDataTableFromAPI", "(", ")", "{", "// we build the request (URL) to call the API", "$", "requestArray", "=", "$", "this", "->", "getRequestArray", "(", ")", ";", "// we make the request to the API", "$", "request", "=", "new", "ApiRequest", "(...
Function called by the ViewDataTable objects in order to fetch data from the API. The function init() must have been called before, so that the object knows which API module and action to call. It builds the API request string and uses Request to call the API. The requested DataTable object is stored in $this->dataTable.
[ "Function", "called", "by", "the", "ViewDataTable", "objects", "in", "order", "to", "fetch", "data", "from", "the", "API", ".", "The", "function", "init", "()", "must", "have", "been", "called", "before", "so", "that", "the", "object", "knows", "which", "A...
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/ViewDataTable/Request.php#L35-L47
train
Load the DataTable from the API
[ 30522, 2270, 3853, 7170, 2850, 29336, 3085, 19699, 9626, 8197, 1006, 1007, 1063, 1013, 1013, 2057, 3857, 1996, 5227, 1006, 24471, 2140, 1007, 2000, 2655, 1996, 17928, 1002, 5227, 2906, 9447, 1027, 1002, 2023, 1011, 1028, 2131, 2890, 15500, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Social.php
Social.getLogoFromUrl
public function getLogoFromUrl($domain) { $social = $this->getSocialNetworkFromDomain($domain); $socialNetworks = $this->getDefinitions(); $filePattern = 'plugins/Morpheus/icons/dist/socials/%s.png'; $socialDomains = array_keys($socialNetworks, $social); foreach ($socialDomains as $domain) { if (file_exists(PIWIK_INCLUDE_PATH . '/' . sprintf($filePattern, $domain))) { return sprintf($filePattern, $domain); } } return sprintf($filePattern, 'xx'); }
php
public function getLogoFromUrl($domain) { $social = $this->getSocialNetworkFromDomain($domain); $socialNetworks = $this->getDefinitions(); $filePattern = 'plugins/Morpheus/icons/dist/socials/%s.png'; $socialDomains = array_keys($socialNetworks, $social); foreach ($socialDomains as $domain) { if (file_exists(PIWIK_INCLUDE_PATH . '/' . sprintf($filePattern, $domain))) { return sprintf($filePattern, $domain); } } return sprintf($filePattern, 'xx'); }
[ "public", "function", "getLogoFromUrl", "(", "$", "domain", ")", "{", "$", "social", "=", "$", "this", "->", "getSocialNetworkFromDomain", "(", "$", "domain", ")", ";", "$", "socialNetworks", "=", "$", "this", "->", "getDefinitions", "(", ")", ";", "$", ...
Return social network logo path by URL @param string $domain @return string path @see plugins/Morpheus/icons/dist/socials/
[ "Return", "social", "network", "logo", "path", "by", "URL" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Referrers/Social.php#L187-L202
train
Get the social network name from the domain name
[ 30522, 2270, 3853, 2131, 21197, 11253, 21716, 3126, 2140, 1006, 1002, 5884, 1007, 1063, 1002, 2591, 1027, 1002, 2023, 1011, 1028, 4152, 10085, 4818, 7159, 6198, 19699, 5358, 9527, 8113, 1006, 1002, 5884, 1007, 1025, 1002, 2591, 7159, 9316, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/CustomVariables/API.php
API.getCustomVariablesValuesFromNameId
public function getCustomVariablesValuesFromNameId($idSite, $period, $date, $idSubtable, $segment = false, $_leavePriceViewedColumn = false) { Piwik::checkUserHasViewAccess($idSite); $dataTable = $this->getDataTable($idSite, $period, $date, $segment, $expanded = false, $flat = false, $idSubtable); if (!$_leavePriceViewedColumn) { $dataTable->deleteColumn('price_viewed'); } else { // Hack Ecommerce product price tracking to display correctly $dataTable->renameColumn('price_viewed', 'price'); } $dataTable->filter('Piwik\Plugins\CustomVariables\DataTable\Filter\CustomVariablesValuesFromNameId'); return $dataTable; }
php
public function getCustomVariablesValuesFromNameId($idSite, $period, $date, $idSubtable, $segment = false, $_leavePriceViewedColumn = false) { Piwik::checkUserHasViewAccess($idSite); $dataTable = $this->getDataTable($idSite, $period, $date, $segment, $expanded = false, $flat = false, $idSubtable); if (!$_leavePriceViewedColumn) { $dataTable->deleteColumn('price_viewed'); } else { // Hack Ecommerce product price tracking to display correctly $dataTable->renameColumn('price_viewed', 'price'); } $dataTable->filter('Piwik\Plugins\CustomVariables\DataTable\Filter\CustomVariablesValuesFromNameId'); return $dataTable; }
[ "public", "function", "getCustomVariablesValuesFromNameId", "(", "$", "idSite", ",", "$", "period", ",", "$", "date", ",", "$", "idSubtable", ",", "$", "segment", "=", "false", ",", "$", "_leavePriceViewedColumn", "=", "false", ")", "{", "Piwik", "::", "chec...
@param int $idSite @param string $period @param Date $date @param int $idSubtable @param string|bool $segment @param bool $_leavePriceViewedColumn @return DataTable|DataTable\Map
[ "@param", "int", "$idSite", "@param", "string", "$period", "@param", "Date", "$date", "@param", "int", "$idSubtable", "@param", "string|bool", "$segment", "@param", "bool", "$_leavePriceViewedColumn" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/CustomVariables/API.php#L108-L124
train
Returns the data table with values from the custom variables with the name name.
[ 30522, 2270, 3853, 2131, 7874, 20389, 10755, 19210, 2015, 10175, 15808, 19699, 5358, 18442, 3593, 1006, 1002, 8909, 28032, 2063, 1010, 1002, 2558, 1010, 1002, 3058, 1010, 1002, 8909, 6342, 19279, 3085, 1010, 1002, 6903, 1027, 6270, 1010, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/BrowserKit/Client.php
Client.clickLink
public function clickLink(string $linkText): Crawler { if (null === $this->crawler) { throw new BadMethodCallException(sprintf('The "request()" method must be called before "%s()".', __METHOD__)); } return $this->click($this->crawler->selectLink($linkText)->link()); }
php
public function clickLink(string $linkText): Crawler { if (null === $this->crawler) { throw new BadMethodCallException(sprintf('The "request()" method must be called before "%s()".', __METHOD__)); } return $this->click($this->crawler->selectLink($linkText)->link()); }
[ "public", "function", "clickLink", "(", "string", "$", "linkText", ")", ":", "Crawler", "{", "if", "(", "null", "===", "$", "this", "->", "crawler", ")", "{", "throw", "new", "BadMethodCallException", "(", "sprintf", "(", "'The \"request()\" method must be calle...
Clicks the first link (or clickable image) that contains the given text. @param string $linkText The text of the link or the alt attribute of the clickable image
[ "Clicks", "the", "first", "link", "(", "or", "clickable", "image", ")", "that", "contains", "the", "given", "text", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/BrowserKit/Client.php#L300-L307
train
Clicks a link in the current page.
[ 30522, 2270, 3853, 11562, 13767, 1006, 5164, 1002, 4957, 18209, 1007, 1024, 13529, 2121, 1063, 2065, 1006, 19701, 1027, 1027, 1027, 1002, 2023, 1011, 1028, 13529, 2121, 1007, 1063, 5466, 2047, 2919, 11368, 6806, 16409, 24164, 2595, 24422, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/DataTable.php
DataTable.makeFromIndexedArray
public static function makeFromIndexedArray($array, $subtablePerLabel = null) { $table = new DataTable(); foreach ($array as $label => $row) { $cleanRow = array(); // Support the case of an $array of single values if (!is_array($row)) { $row = array('value' => $row); } // Put the 'label' column first $cleanRow[Row::COLUMNS] = array('label' => $label) + $row; // Assign subtable if specified if (isset($subtablePerLabel[$label])) { $cleanRow[Row::DATATABLE_ASSOCIATED] = $subtablePerLabel[$label]; } $table->addRow(new Row($cleanRow)); } return $table; }
php
public static function makeFromIndexedArray($array, $subtablePerLabel = null) { $table = new DataTable(); foreach ($array as $label => $row) { $cleanRow = array(); // Support the case of an $array of single values if (!is_array($row)) { $row = array('value' => $row); } // Put the 'label' column first $cleanRow[Row::COLUMNS] = array('label' => $label) + $row; // Assign subtable if specified if (isset($subtablePerLabel[$label])) { $cleanRow[Row::DATATABLE_ASSOCIATED] = $subtablePerLabel[$label]; } $table->addRow(new Row($cleanRow)); } return $table; }
[ "public", "static", "function", "makeFromIndexedArray", "(", "$", "array", ",", "$", "subtablePerLabel", "=", "null", ")", "{", "$", "table", "=", "new", "DataTable", "(", ")", ";", "foreach", "(", "$", "array", "as", "$", "label", "=>", "$", "row", ")...
Rewrites the input `$array` array ( LABEL => array(col1 => X, col2 => Y), LABEL2 => array(col1 => X, col2 => Y), ) to a DataTable with rows that look like: array ( array( Row::COLUMNS => array('label' => LABEL, col1 => X, col2 => Y)), array( Row::COLUMNS => array('label' => LABEL2, col1 => X, col2 => Y)), ) Will also convert arrays like: array ( LABEL => X, LABEL2 => Y, ) to: array ( array( Row::COLUMNS => array('label' => LABEL, 'value' => X)), array( Row::COLUMNS => array('label' => LABEL2, 'value' => Y)), ) @param array $array Indexed array, two formats supported, see above. @param array|null $subtablePerLabel An array mapping label values with DataTable instances to associate as a subtable. @return \Piwik\DataTable
[ "Rewrites", "the", "input", "$array" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/DataTable.php#L1560-L1579
train
Makes a DataTable from an indexed array
[ 30522, 2270, 10763, 3853, 2191, 19699, 20936, 13629, 19068, 2906, 9447, 1006, 1002, 9140, 1010, 1002, 4942, 10880, 4842, 20470, 2884, 1027, 19701, 1007, 1063, 1002, 2795, 1027, 2047, 2951, 10880, 1006, 1007, 1025, 18921, 6776, 1006, 1002, 9...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/Live/Visualizations/VisitorLog.php
VisitorLog.beforeRender
public function beforeRender() { $this->config->show_as_content_block = false; $this->config->title = Piwik::translate('Live_VisitorLog'); $this->config->disable_row_actions = true; $this->config->datatable_js_type = 'VisitorLog'; $this->config->enable_sort = false; $this->config->show_search = false; $this->config->show_exclude_low_population = false; $this->config->show_offset_information = false; $this->config->show_all_views_icons = false; $this->config->show_table_all_columns = false; $this->config->show_export_as_rss_feed = false; $this->config->disable_all_rows_filter_limit = true; $this->config->documentation = Piwik::translate('Live_VisitorLogDocumentation', array('<br />', '<br />')); if (!is_array($this->config->custom_parameters)) { $this->config->custom_parameters = array(); } // ensure to show next link if there are enough rows for a next page if ($this->dataTable->getRowsCount() > $this->requestConfig->filter_limit) { $this->dataTable->deleteRowsOffset($this->requestConfig->filter_limit); $this->config->custom_parameters['totalRows'] = 10000000; } $this->config->custom_parameters['smallWidth'] = (1 == Common::getRequestVar('small', 0, 'int')); $this->config->custom_parameters['hideProfileLink'] = (1 == Common::getRequestVar('hideProfileLink', 0, 'int')); $this->config->custom_parameters['pageUrlNotDefined'] = Piwik::translate('General_NotDefined', Piwik::translate('Actions_ColumnPageURL')); $this->config->footer_icons = array( array( 'class' => 'tableAllColumnsSwitch', 'buttons' => array( array( 'id' => static::ID, 'title' => Piwik::translate('Live_LinkVisitorLog'), 'icon' => 'plugins/Morpheus/images/table.png' ) ) ) ); $enableAddNewSegment = Common::getRequestVar('enableAddNewSegment', false); if ($enableAddNewSegment) { $this->config->datatable_actions[] = [ 'id' => 'addSegmentToMatomo', 'title' => Piwik::translate('SegmentEditor_AddThisToMatomo'), 'icon' => 'icon-segment', ]; } }
php
public function beforeRender() { $this->config->show_as_content_block = false; $this->config->title = Piwik::translate('Live_VisitorLog'); $this->config->disable_row_actions = true; $this->config->datatable_js_type = 'VisitorLog'; $this->config->enable_sort = false; $this->config->show_search = false; $this->config->show_exclude_low_population = false; $this->config->show_offset_information = false; $this->config->show_all_views_icons = false; $this->config->show_table_all_columns = false; $this->config->show_export_as_rss_feed = false; $this->config->disable_all_rows_filter_limit = true; $this->config->documentation = Piwik::translate('Live_VisitorLogDocumentation', array('<br />', '<br />')); if (!is_array($this->config->custom_parameters)) { $this->config->custom_parameters = array(); } // ensure to show next link if there are enough rows for a next page if ($this->dataTable->getRowsCount() > $this->requestConfig->filter_limit) { $this->dataTable->deleteRowsOffset($this->requestConfig->filter_limit); $this->config->custom_parameters['totalRows'] = 10000000; } $this->config->custom_parameters['smallWidth'] = (1 == Common::getRequestVar('small', 0, 'int')); $this->config->custom_parameters['hideProfileLink'] = (1 == Common::getRequestVar('hideProfileLink', 0, 'int')); $this->config->custom_parameters['pageUrlNotDefined'] = Piwik::translate('General_NotDefined', Piwik::translate('Actions_ColumnPageURL')); $this->config->footer_icons = array( array( 'class' => 'tableAllColumnsSwitch', 'buttons' => array( array( 'id' => static::ID, 'title' => Piwik::translate('Live_LinkVisitorLog'), 'icon' => 'plugins/Morpheus/images/table.png' ) ) ) ); $enableAddNewSegment = Common::getRequestVar('enableAddNewSegment', false); if ($enableAddNewSegment) { $this->config->datatable_actions[] = [ 'id' => 'addSegmentToMatomo', 'title' => Piwik::translate('SegmentEditor_AddThisToMatomo'), 'icon' => 'icon-segment', ]; } }
[ "public", "function", "beforeRender", "(", ")", "{", "$", "this", "->", "config", "->", "show_as_content_block", "=", "false", ";", "$", "this", "->", "config", "->", "title", "=", "Piwik", "::", "translate", "(", "'Live_VisitorLog'", ")", ";", "$", "this"...
Configure visualization.
[ "Configure", "visualization", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Live/Visualizations/VisitorLog.php#L78-L130
train
Before render method
[ 30522, 2270, 3853, 2077, 7389, 4063, 1006, 1007, 1063, 1002, 2023, 1011, 1028, 9530, 8873, 2290, 1011, 1028, 2265, 1035, 2004, 1035, 4180, 1035, 3796, 1027, 6270, 1025, 1002, 2023, 1011, 1028, 9530, 8873, 2290, 1011, 1028, 2516, 1027, 142...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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.___expire
public function ___expire($id) { $metadatas = $this->_getMetadatas($id); if ($metadatas) { $metadatas['expire'] = 1; $this->_setMetadatas($id, $metadatas); } }
php
public function ___expire($id) { $metadatas = $this->_getMetadatas($id); if ($metadatas) { $metadatas['expire'] = 1; $this->_setMetadatas($id, $metadatas); } }
[ "public", "function", "___expire", "(", "$", "id", ")", "{", "$", "metadatas", "=", "$", "this", "->", "_getMetadatas", "(", "$", "id", ")", ";", "if", "(", "$", "metadatas", ")", "{", "$", "metadatas", "[", "'expire'", "]", "=", "1", ";", "$", "...
PUBLIC METHOD FOR UNIT TESTING ONLY ! Force a cache record to expire @param string $id cache id
[ "PUBLIC", "METHOD", "FOR", "UNIT", "TESTING", "ONLY", "!" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Cache/Backend/File.php#L460-L467
train
expire - 1 - 1
[ 30522, 2270, 3853, 1035, 1035, 1035, 4654, 20781, 1006, 1002, 8909, 1007, 1063, 1002, 27425, 2015, 1027, 1002, 2023, 1011, 1028, 1035, 2131, 11368, 8447, 10230, 1006, 1002, 8909, 1007, 1025, 2065, 1006, 1002, 27425, 2015, 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...
getgrav/grav
system/src/Grav/Common/Data/Data.php
Data.blueprints
public function blueprints() { if (!$this->blueprints){ $this->blueprints = new Blueprint; } elseif (\is_callable($this->blueprints)) { // Lazy load blueprints. $blueprints = $this->blueprints; $this->blueprints = $blueprints(); } return $this->blueprints; }
php
public function blueprints() { if (!$this->blueprints){ $this->blueprints = new Blueprint; } elseif (\is_callable($this->blueprints)) { // Lazy load blueprints. $blueprints = $this->blueprints; $this->blueprints = $blueprints(); } return $this->blueprints; }
[ "public", "function", "blueprints", "(", ")", "{", "if", "(", "!", "$", "this", "->", "blueprints", ")", "{", "$", "this", "->", "blueprints", "=", "new", "Blueprint", ";", "}", "elseif", "(", "\\", "is_callable", "(", "$", "this", "->", "blueprints", ...
Return blueprints. @return Blueprint
[ "Return", "blueprints", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Data/Data.php#L228-L238
train
Get blueprints.
[ 30522, 2270, 3853, 2630, 16550, 2015, 1006, 1007, 1063, 2065, 1006, 999, 1002, 2023, 1011, 1028, 2630, 16550, 2015, 1007, 1063, 1002, 2023, 1011, 1028, 2630, 16550, 2015, 1027, 2047, 2630, 16550, 1025, 1065, 2842, 10128, 1006, 1032, 2003, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
php-ai/php-ml
src/Math/Statistic/Covariance.php
Covariance.covarianceMatrix
public static function covarianceMatrix(array $data, ?array $means = null): array { $n = count($data[0]); if ($means === null) { $means = []; for ($i = 0; $i < $n; ++$i) { $means[] = Mean::arithmetic(array_column($data, $i)); } } $cov = []; for ($i = 0; $i < $n; ++$i) { for ($k = 0; $k < $n; ++$k) { if ($i > $k) { $cov[$i][$k] = $cov[$k][$i]; } else { $cov[$i][$k] = self::fromDataset( $data, $i, $k, true, $means[$i], $means[$k] ); } } } return $cov; }
php
public static function covarianceMatrix(array $data, ?array $means = null): array { $n = count($data[0]); if ($means === null) { $means = []; for ($i = 0; $i < $n; ++$i) { $means[] = Mean::arithmetic(array_column($data, $i)); } } $cov = []; for ($i = 0; $i < $n; ++$i) { for ($k = 0; $k < $n; ++$k) { if ($i > $k) { $cov[$i][$k] = $cov[$k][$i]; } else { $cov[$i][$k] = self::fromDataset( $data, $i, $k, true, $means[$i], $means[$k] ); } } } return $cov; }
[ "public", "static", "function", "covarianceMatrix", "(", "array", "$", "data", ",", "?", "array", "$", "means", "=", "null", ")", ":", "array", "{", "$", "n", "=", "count", "(", "$", "data", "[", "0", "]", ")", ";", "if", "(", "$", "means", "==="...
Returns the covariance matrix of n-dimensional data @param array|null $means
[ "Returns", "the", "covariance", "matrix", "of", "n", "-", "dimensional", "data" ]
f6aa1a59b0525b8fca3d2786d661ab3e70904016
https://github.com/php-ai/php-ml/blob/f6aa1a59b0525b8fca3d2786d661ab3e70904016/src/Math/Statistic/Covariance.php#L117-L147
train
Returns the covariance matrix of the given data
[ 30522, 30524, 2951, 1010, 1029, 9140, 1002, 2965, 1027, 19701, 1007, 1024, 9140, 1063, 1002, 1050, 1027, 4175, 1006, 1002, 2951, 1031, 1014, 1033, 1007, 1025, 2065, 1006, 1002, 2965, 1027, 1027, 1027, 19701, 1007, 1063, 1002, 2965, 1027, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Cache/Simple/ChainCache.php
ChainCache.prune
public function prune() { $pruned = true; foreach ($this->caches as $cache) { if ($cache instanceof PruneableInterface) { $pruned = $cache->prune() && $pruned; } } return $pruned; }
php
public function prune() { $pruned = true; foreach ($this->caches as $cache) { if ($cache instanceof PruneableInterface) { $pruned = $cache->prune() && $pruned; } } return $pruned; }
[ "public", "function", "prune", "(", ")", "{", "$", "pruned", "=", "true", ";", "foreach", "(", "$", "this", "->", "caches", "as", "$", "cache", ")", "{", "if", "(", "$", "cache", "instanceof", "PruneableInterface", ")", "{", "$", "pruned", "=", "$", ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Cache/Simple/ChainCache.php#L233-L244
train
Prune all caches
[ 30522, 2270, 3853, 10975, 9816, 1006, 1007, 1063, 1002, 10975, 9816, 2094, 1027, 2995, 1025, 18921, 6776, 1006, 1002, 2023, 1011, 1028, 17053, 2015, 2004, 1002, 17053, 1007, 1063, 2065, 1006, 1002, 17053, 6013, 11253, 10975, 9816, 3085, 184...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
php-ai/php-ml
src/Math/Comparison.php
Comparison.compare
public static function compare($a, $b, string $operator): bool { switch ($operator) { case '>': return $a > $b; case '>=': return $a >= $b; case '=': case '==': return $a == $b; case '===': return $a === $b; case '<=': return $a <= $b; case '<': return $a < $b; case '!=': case '<>': return $a != $b; case '!==': return $a !== $b; default: throw new InvalidArgumentException(sprintf('Invalid operator "%s" provided', $operator)); } }
php
public static function compare($a, $b, string $operator): bool { switch ($operator) { case '>': return $a > $b; case '>=': return $a >= $b; case '=': case '==': return $a == $b; case '===': return $a === $b; case '<=': return $a <= $b; case '<': return $a < $b; case '!=': case '<>': return $a != $b; case '!==': return $a !== $b; default: throw new InvalidArgumentException(sprintf('Invalid operator "%s" provided', $operator)); } }
[ "public", "static", "function", "compare", "(", "$", "a", ",", "$", "b", ",", "string", "$", "operator", ")", ":", "bool", "{", "switch", "(", "$", "operator", ")", "{", "case", "'>'", ":", "return", "$", "a", ">", "$", "b", ";", "case", "'>='", ...
@param mixed $a @param mixed $b @throws InvalidArgumentException
[ "@param", "mixed", "$a", "@param", "mixed", "$b" ]
f6aa1a59b0525b8fca3d2786d661ab3e70904016
https://github.com/php-ai/php-ml/blob/f6aa1a59b0525b8fca3d2786d661ab3e70904016/src/Math/Comparison.php#L17-L41
train
Compare two values using the operator
[ 30522, 2270, 10763, 3853, 12826, 1006, 1002, 1037, 1010, 1002, 1038, 1010, 5164, 1002, 6872, 1007, 1024, 22017, 2140, 1063, 6942, 1006, 1002, 6872, 1007, 1063, 2553, 1005, 1028, 1005, 1024, 2709, 1002, 1037, 1028, 1002, 1038, 1025, 2553, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Validator/Validator/RecursiveValidator.php
RecursiveValidator.inContext
public function inContext(ExecutionContextInterface $context) { return new RecursiveContextualValidator( $context, $this->metadataFactory, $this->validatorFactory, $this->objectInitializers ); }
php
public function inContext(ExecutionContextInterface $context) { return new RecursiveContextualValidator( $context, $this->metadataFactory, $this->validatorFactory, $this->objectInitializers ); }
[ "public", "function", "inContext", "(", "ExecutionContextInterface", "$", "context", ")", "{", "return", "new", "RecursiveContextualValidator", "(", "$", "context", ",", "$", "this", "->", "metadataFactory", ",", "$", "this", "->", "validatorFactory", ",", "$", ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Validator/Validator/RecursiveValidator.php#L68-L76
train
Returns a recursive validator that will be used to validate the result of the execution of the context.
[ 30522, 2270, 3853, 4297, 28040, 18413, 1006, 7781, 8663, 18209, 18447, 2121, 12172, 1002, 6123, 1007, 1063, 2709, 2047, 28667, 9236, 3512, 8663, 18209, 8787, 10175, 8524, 4263, 1006, 1002, 6123, 1010, 1002, 2023, 1011, 1028, 27425, 21450, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/UsersManager/API.php
API.getUserPreference
public function getUserPreference($userLogin, $preferenceName) { Piwik::checkUserHasSuperUserAccessOrIsTheUser($userLogin); $optionValue = $this->getPreferenceValue($userLogin, $preferenceName); if ($optionValue !== false) { return $optionValue; } return $this->getDefaultUserPreference($preferenceName, $userLogin); }
php
public function getUserPreference($userLogin, $preferenceName) { Piwik::checkUserHasSuperUserAccessOrIsTheUser($userLogin); $optionValue = $this->getPreferenceValue($userLogin, $preferenceName); if ($optionValue !== false) { return $optionValue; } return $this->getDefaultUserPreference($preferenceName, $userLogin); }
[ "public", "function", "getUserPreference", "(", "$", "userLogin", ",", "$", "preferenceName", ")", "{", "Piwik", "::", "checkUserHasSuperUserAccessOrIsTheUser", "(", "$", "userLogin", ")", ";", "$", "optionValue", "=", "$", "this", "->", "getPreferenceValue", "(",...
Gets a user preference @param string $userLogin @param string $preferenceName @return bool|string
[ "Gets", "a", "user", "preference" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/UsersManager/API.php#L199-L210
train
Returns the value of the specified user preference
[ 30522, 2270, 3853, 2131, 20330, 28139, 25523, 1006, 1002, 30524, 10175, 5657, 1027, 1002, 2023, 1011, 1028, 2131, 28139, 25523, 10175, 5657, 1006, 1002, 5310, 21197, 2378, 1010, 1002, 12157, 18442, 1007, 1025, 2065, 1006, 1002, 5724, 10175, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/FlexObject.php
FlexObject.create
public function create(string $key = null) { if ($key) { $this->setStorageKey($key); } if ($this->exists()) { throw new \RuntimeException('Cannot create new object (Already exists)'); } return $this->save(); }
php
public function create(string $key = null) { if ($key) { $this->setStorageKey($key); } if ($this->exists()) { throw new \RuntimeException('Cannot create new object (Already exists)'); } return $this->save(); }
[ "public", "function", "create", "(", "string", "$", "key", "=", "null", ")", "{", "if", "(", "$", "key", ")", "{", "$", "this", "->", "setStorageKey", "(", "$", "key", ")", ";", "}", "if", "(", "$", "this", "->", "exists", "(", ")", ")", "{", ...
{@inheritdoc} @see FlexObjectInterface::create()
[ "{" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Framework/Flex/FlexObject.php#L520-L531
train
Create new object
[ 30522, 2270, 3853, 3443, 1006, 30524, 1002, 3145, 1007, 1063, 1002, 2023, 1011, 1028, 4520, 4263, 4270, 14839, 1006, 1002, 3145, 1007, 1025, 1065, 2065, 1006, 1002, 2023, 1011, 1028, 6526, 1006, 1007, 1007, 1063, 5466, 2047, 1032, 2448, 7...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Support/MessageBag.php
MessageBag.first
public function first($key = null, $format = null) { $messages = is_null($key) ? $this->all($format) : $this->get($key, $format); $firstMessage = Arr::first($messages, null, ''); return is_array($firstMessage) ? Arr::first($firstMessage) : $firstMessage; }
php
public function first($key = null, $format = null) { $messages = is_null($key) ? $this->all($format) : $this->get($key, $format); $firstMessage = Arr::first($messages, null, ''); return is_array($firstMessage) ? Arr::first($firstMessage) : $firstMessage; }
[ "public", "function", "first", "(", "$", "key", "=", "null", ",", "$", "format", "=", "null", ")", "{", "$", "messages", "=", "is_null", "(", "$", "key", ")", "?", "$", "this", "->", "all", "(", "$", "format", ")", ":", "$", "this", "->", "get"...
Get the first message from the message bag for a given key. @param string $key @param string $format @return string
[ "Get", "the", "first", "message", "from", "the", "message", "bag", "for", "a", "given", "key", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Support/MessageBag.php#L157-L164
train
Get the first message from the messages array or the first message from the messages array
[ 30522, 2270, 3853, 2034, 1006, 1002, 3145, 1027, 19701, 1010, 1002, 4289, 1027, 19701, 1007, 1063, 1002, 7696, 1027, 2003, 1035, 19701, 1006, 1002, 3145, 1007, 1029, 1002, 2023, 1011, 1028, 2035, 1006, 1002, 4289, 1007, 1024, 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/DataCollector/FormDataExtractor.php
FormDataExtractor.buildId
private function buildId(FormInterface $form) { $id = $form->getName(); if (null !== $form->getParent()) { $id = $this->buildId($form->getParent()).'_'.$id; } return $id; }
php
private function buildId(FormInterface $form) { $id = $form->getName(); if (null !== $form->getParent()) { $id = $this->buildId($form->getParent()).'_'.$id; } return $id; }
[ "private", "function", "buildId", "(", "FormInterface", "$", "form", ")", "{", "$", "id", "=", "$", "form", "->", "getName", "(", ")", ";", "if", "(", "null", "!==", "$", "form", "->", "getParent", "(", ")", ")", "{", "$", "id", "=", "$", "this",...
Recursively builds an HTML ID for a form. @return string The HTML ID
[ "Recursively", "builds", "an", "HTML", "ID", "for", "a", "form", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Extension/DataCollector/FormDataExtractor.php#L160-L169
train
Build ID of form
[ 30522, 2797, 3853, 3857, 3593, 1006, 2433, 18447, 2121, 12172, 1002, 2433, 1007, 1063, 1002, 8909, 1027, 1002, 2433, 1011, 1028, 2131, 18442, 1006, 1007, 1025, 2065, 1006, 19701, 999, 1027, 1027, 1002, 2433, 1011, 1028, 2131, 19362, 4765, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/ArchiveProcessor.php
ArchiveProcessor.getAggregatedDataTableMap
protected function getAggregatedDataTableMap($data, $columnsAggregationOperation) { $table = new DataTable(); if (!empty($columnsAggregationOperation)) { $table->setMetadata(DataTable::COLUMN_AGGREGATION_OPS_METADATA_NAME, $columnsAggregationOperation); } if ($data instanceof DataTable\Map) { // as $date => $tableToSum $this->aggregatedDataTableMapsAsOne($data, $table); } else { $table->addDataTable($data); } return $table; }
php
protected function getAggregatedDataTableMap($data, $columnsAggregationOperation) { $table = new DataTable(); if (!empty($columnsAggregationOperation)) { $table->setMetadata(DataTable::COLUMN_AGGREGATION_OPS_METADATA_NAME, $columnsAggregationOperation); } if ($data instanceof DataTable\Map) { // as $date => $tableToSum $this->aggregatedDataTableMapsAsOne($data, $table); } else { $table->addDataTable($data); } return $table; }
[ "protected", "function", "getAggregatedDataTableMap", "(", "$", "data", ",", "$", "columnsAggregationOperation", ")", "{", "$", "table", "=", "new", "DataTable", "(", ")", ";", "if", "(", "!", "empty", "(", "$", "columnsAggregationOperation", ")", ")", "{", ...
If the DataTable is a Map, sums all DataTable in the map and return the DataTable. @param $data DataTable|DataTable\Map @param $columnsToRenameAfterAggregation array @return DataTable
[ "If", "the", "DataTable", "is", "a", "Map", "sums", "all", "DataTable", "in", "the", "map", "and", "return", "the", "DataTable", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/ArchiveProcessor.php#L503-L519
train
Get aggregated data table
[ 30522, 5123, 3853, 2131, 8490, 17603, 11644, 2850, 29336, 3085, 2863, 2361, 1006, 1002, 2951, 1010, 1002, 7753, 8490, 17603, 12540, 25918, 3370, 1007, 1063, 1002, 2795, 1027, 2047, 2951, 10880, 1006, 1007, 1025, 2065, 1006, 999, 4064, 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...
octobercms/october
modules/cms/controllers/Index.php
Index.onDeleteTemplates
public function onDeleteTemplates() { $this->validateRequestTheme(); $type = Request::input('type'); $templates = Request::input('template'); $error = null; $deleted = []; try { foreach ($templates as $path => $selected) { if ($selected) { $this->loadTemplate($type, $path)->delete(); $deleted[] = $path; } } } catch (Exception $ex) { $error = $ex->getMessage(); } /** * @event cms.template.delete * Fires after a CMS template (page|partial|layout|content|asset) has been deleted. * * Example usage: * * Event::listen('cms.template.delete', function ((\Cms\Controllers\Index) $controller, (string) $type) { * \Log::info("A $type has been deleted"); * }); * * Or * * $CmsIndexController->bindEvent('template.delete', function ((string) $type) { * \Log::info("A $type has been deleted"); * }); * */ $this->fireSystemEvent('cms.template.delete', [$type]); return [ 'deleted' => $deleted, 'error' => $error, 'theme' => Request::input('theme') ]; }
php
public function onDeleteTemplates() { $this->validateRequestTheme(); $type = Request::input('type'); $templates = Request::input('template'); $error = null; $deleted = []; try { foreach ($templates as $path => $selected) { if ($selected) { $this->loadTemplate($type, $path)->delete(); $deleted[] = $path; } } } catch (Exception $ex) { $error = $ex->getMessage(); } /** * @event cms.template.delete * Fires after a CMS template (page|partial|layout|content|asset) has been deleted. * * Example usage: * * Event::listen('cms.template.delete', function ((\Cms\Controllers\Index) $controller, (string) $type) { * \Log::info("A $type has been deleted"); * }); * * Or * * $CmsIndexController->bindEvent('template.delete', function ((string) $type) { * \Log::info("A $type has been deleted"); * }); * */ $this->fireSystemEvent('cms.template.delete', [$type]); return [ 'deleted' => $deleted, 'error' => $error, 'theme' => Request::input('theme') ]; }
[ "public", "function", "onDeleteTemplates", "(", ")", "{", "$", "this", "->", "validateRequestTheme", "(", ")", ";", "$", "type", "=", "Request", "::", "input", "(", "'type'", ")", ";", "$", "templates", "=", "Request", "::", "input", "(", "'template'", "...
Deletes multiple templates at the same time @return array
[ "Deletes", "multiple", "templates", "at", "the", "same", "time" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/controllers/Index.php#L285-L330
train
Delete all selected templates
[ 30522, 2270, 3853, 2006, 9247, 12870, 18532, 15725, 2015, 1006, 1007, 1063, 1002, 2023, 1011, 1028, 9398, 24932, 2063, 15500, 10760, 4168, 1006, 1007, 1025, 1002, 2828, 1027, 5227, 1024, 1024, 7953, 1006, 1005, 2828, 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...
matomo-org/matomo
plugins/Installation/FormDatabaseSetup.php
Rule_checkUserPrivileges.validateOwner
public function validateOwner() { // try and create the database object try { $this->createDatabaseObject(); } catch (Exception $ex) { if ($this->isAccessDenied($ex)) { return false; } else { return true; // if we can't create the database object, skip this validation } } $db = Db::get(); try { // try to drop tables before running privilege tests $this->dropExtraTables($db); } catch (Exception $ex) { if ($this->isAccessDenied($ex)) { return false; } else { throw $ex; } } // check each required privilege by running a query that uses it foreach (self::getRequiredPrivileges() as $privilegeType => $queries) { if (!is_array($queries)) { $queries = array($queries); } foreach ($queries as $sql) { try { if (in_array($privilegeType, array('SELECT'))) { $db->fetchAll($sql); } else { $db->exec($sql); } } catch (Exception $ex) { if ($this->isAccessDenied($ex)) { return false; } else { throw new Exception("Test SQL failed to execute: $sql\nError: " . $ex->getMessage()); } } } } // remove extra tables that were created $this->dropExtraTables($db); return true; }
php
public function validateOwner() { // try and create the database object try { $this->createDatabaseObject(); } catch (Exception $ex) { if ($this->isAccessDenied($ex)) { return false; } else { return true; // if we can't create the database object, skip this validation } } $db = Db::get(); try { // try to drop tables before running privilege tests $this->dropExtraTables($db); } catch (Exception $ex) { if ($this->isAccessDenied($ex)) { return false; } else { throw $ex; } } // check each required privilege by running a query that uses it foreach (self::getRequiredPrivileges() as $privilegeType => $queries) { if (!is_array($queries)) { $queries = array($queries); } foreach ($queries as $sql) { try { if (in_array($privilegeType, array('SELECT'))) { $db->fetchAll($sql); } else { $db->exec($sql); } } catch (Exception $ex) { if ($this->isAccessDenied($ex)) { return false; } else { throw new Exception("Test SQL failed to execute: $sql\nError: " . $ex->getMessage()); } } } } // remove extra tables that were created $this->dropExtraTables($db); return true; }
[ "public", "function", "validateOwner", "(", ")", "{", "// try and create the database object", "try", "{", "$", "this", "->", "createDatabaseObject", "(", ")", ";", "}", "catch", "(", "Exception", "$", "ex", ")", "{", "if", "(", "$", "this", "->", "isAccessD...
Checks that the DB user entered in the form has the necessary privileges for Piwik to run.
[ "Checks", "that", "the", "DB", "user", "entered", "in", "the", "form", "has", "the", "necessary", "privileges", "for", "Piwik", "to", "run", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Installation/FormDatabaseSetup.php#L193-L246
train
Validate owner.
[ 30522, 2270, 3853, 9398, 3686, 12384, 2121, 1006, 1007, 1063, 1013, 1013, 3046, 1998, 3443, 1996, 7809, 4874, 3046, 1063, 1002, 2023, 1011, 1028, 2580, 6790, 15058, 16429, 20614, 1006, 1007, 1025, 1065, 4608, 1006, 6453, 1002, 4654, 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/Eloquent/Concerns/HasEvents.php
HasEvents.filterModelEventResults
protected function filterModelEventResults($result) { if (is_array($result)) { $result = array_filter($result, function ($response) { return ! is_null($response); }); } return $result; }
php
protected function filterModelEventResults($result) { if (is_array($result)) { $result = array_filter($result, function ($response) { return ! is_null($response); }); } return $result; }
[ "protected", "function", "filterModelEventResults", "(", "$", "result", ")", "{", "if", "(", "is_array", "(", "$", "result", ")", ")", "{", "$", "result", "=", "array_filter", "(", "$", "result", ",", "function", "(", "$", "response", ")", "{", "return",...
Filter the model event results. @param mixed $result @return mixed
[ "Filter", "the", "model", "event", "results", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Concerns/HasEvents.php#L218-L227
train
Filter model event results
[ 30522, 5123, 3853, 11307, 5302, 9247, 18697, 3372, 6072, 11314, 2015, 1006, 1002, 2765, 1007, 1063, 2065, 1006, 2003, 1035, 9140, 1006, 1002, 2765, 1007, 1007, 1063, 1002, 2765, 1027, 9140, 1035, 11307, 1006, 1002, 2765, 1010, 3853, 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/Auth/CreatesUserProviders.php
CreatesUserProviders.createUserProvider
public function createUserProvider($provider = null) { if (is_null($config = $this->getProviderConfiguration($provider))) { return; } if (isset($this->customProviderCreators[$driver = ($config['driver'] ?? null)])) { return call_user_func( $this->customProviderCreators[$driver], $this->app, $config ); } switch ($driver) { case 'database': return $this->createDatabaseProvider($config); case 'eloquent': return $this->createEloquentProvider($config); default: throw new InvalidArgumentException( "Authentication user provider [{$driver}] is not defined." ); } }
php
public function createUserProvider($provider = null) { if (is_null($config = $this->getProviderConfiguration($provider))) { return; } if (isset($this->customProviderCreators[$driver = ($config['driver'] ?? null)])) { return call_user_func( $this->customProviderCreators[$driver], $this->app, $config ); } switch ($driver) { case 'database': return $this->createDatabaseProvider($config); case 'eloquent': return $this->createEloquentProvider($config); default: throw new InvalidArgumentException( "Authentication user provider [{$driver}] is not defined." ); } }
[ "public", "function", "createUserProvider", "(", "$", "provider", "=", "null", ")", "{", "if", "(", "is_null", "(", "$", "config", "=", "$", "this", "->", "getProviderConfiguration", "(", "$", "provider", ")", ")", ")", "{", "return", ";", "}", "if", "...
Create the user provider implementation for the driver. @param string|null $provider @return \Illuminate\Contracts\Auth\UserProvider|null @throws \InvalidArgumentException
[ "Create", "the", "user", "provider", "implementation", "for", "the", "driver", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Auth/CreatesUserProviders.php#L24-L46
train
Create user provider
[ 30522, 2270, 3853, 3443, 20330, 21572, 17258, 2121, 1006, 1002, 10802, 1027, 19701, 1007, 1063, 2065, 1006, 2003, 1035, 19701, 1006, 1002, 9530, 8873, 2290, 1027, 1002, 2023, 1011, 1028, 2131, 21572, 17258, 2121, 8663, 8873, 27390, 3370, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Cache/Psr16Cache.php
Psr16Cache.deleteMultiple
public function deleteMultiple($keys) { if ($keys instanceof \Traversable) { $keys = iterator_to_array($keys, false); } elseif (!\is_array($keys)) { throw new InvalidArgumentException(sprintf('Cache keys must be array or Traversable, "%s" given', \is_object($keys) ? \get_class($keys) : \gettype($keys))); } try { return $this->pool->deleteItems($keys); } catch (SimpleCacheException $e) { throw $e; } catch (Psr6CacheException $e) { throw new InvalidArgumentException($e->getMessage(), $e->getCode(), $e); } }
php
public function deleteMultiple($keys) { if ($keys instanceof \Traversable) { $keys = iterator_to_array($keys, false); } elseif (!\is_array($keys)) { throw new InvalidArgumentException(sprintf('Cache keys must be array or Traversable, "%s" given', \is_object($keys) ? \get_class($keys) : \gettype($keys))); } try { return $this->pool->deleteItems($keys); } catch (SimpleCacheException $e) { throw $e; } catch (Psr6CacheException $e) { throw new InvalidArgumentException($e->getMessage(), $e->getCode(), $e); } }
[ "public", "function", "deleteMultiple", "(", "$", "keys", ")", "{", "if", "(", "$", "keys", "instanceof", "\\", "Traversable", ")", "{", "$", "keys", "=", "iterator_to_array", "(", "$", "keys", ",", "false", ")", ";", "}", "elseif", "(", "!", "\\", "...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Cache/Psr16Cache.php#L233-L248
train
Delete multiple cache items
[ 30522, 2270, 3853, 3972, 12870, 12274, 7096, 11514, 2571, 1006, 1002, 6309, 1007, 1063, 2065, 1006, 1002, 6309, 6013, 11253, 1032, 29053, 3085, 1007, 1063, 1002, 6309, 1027, 2009, 6906, 4263, 1035, 2000, 1035, 9140, 1006, 1002, 6309, 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/Mail/Protocol/Imap.php
Zend_Mail_Protocol_Imap._decodeLine
protected function _decodeLine($line) { $tokens = array(); $stack = array(); /* We start to decode the response here. The unterstood tokens are: literal "literal" or also "lit\\er\"al" {bytes}<NL>literal (literals*) All tokens are returned in an array. Literals in braces (the last unterstood token in the list) are returned as an array of tokens. I.e. the following response: "foo" baz {3}<NL>bar ("f\\\"oo" bar) would be returned as: array('foo', 'baz', 'bar', array('f\\\"oo', 'bar')); // TODO: add handling of '[' and ']' to parser for easier handling of response text */ // replace any trailling <NL> including spaces with a single space $line = rtrim($line) . ' '; while (($pos = strpos($line, ' ')) !== false) { $token = substr($line, 0, $pos); while ($token[0] == '(') { array_push($stack, $tokens); $tokens = array(); $token = substr($token, 1); } if ($token[0] == '"') { if (preg_match('%^\(*"((.|\\\\|\\")*?)" *%', $line, $matches)) { $tokens[] = $matches[1]; $line = substr($line, strlen($matches[0])); continue; } } if ($token[0] == '{') { $endPos = strpos($token, '}'); $chars = substr($token, 1, $endPos - 1); if (is_numeric($chars)) { $token = ''; while (strlen($token) < $chars) { $token .= $this->_nextLine(); } $line = ''; if (strlen($token) > $chars) { $line = substr($token, $chars); $token = substr($token, 0, $chars); } else { $line .= $this->_nextLine(); } $tokens[] = $token; $line = trim($line) . ' '; continue; } } if ($stack && $token[strlen($token) - 1] == ')') { // closing braces are not seperated by spaces, so we need to count them $braces = strlen($token); $token = rtrim($token, ')'); // only count braces if more than one $braces -= strlen($token) + 1; // only add if token had more than just closing braces if (rtrim($token) != '') { $tokens[] = rtrim($token); } $token = $tokens; $tokens = array_pop($stack); // special handline if more than one closing brace while ($braces-- > 0) { $tokens[] = $token; $token = $tokens; $tokens = array_pop($stack); } } $tokens[] = $token; $line = substr($line, $pos + 1); } // maybe the server forgot to send some closing braces while ($stack) { $child = $tokens; $tokens = array_pop($stack); $tokens[] = $child; } return $tokens; }
php
protected function _decodeLine($line) { $tokens = array(); $stack = array(); /* We start to decode the response here. The unterstood tokens are: literal "literal" or also "lit\\er\"al" {bytes}<NL>literal (literals*) All tokens are returned in an array. Literals in braces (the last unterstood token in the list) are returned as an array of tokens. I.e. the following response: "foo" baz {3}<NL>bar ("f\\\"oo" bar) would be returned as: array('foo', 'baz', 'bar', array('f\\\"oo', 'bar')); // TODO: add handling of '[' and ']' to parser for easier handling of response text */ // replace any trailling <NL> including spaces with a single space $line = rtrim($line) . ' '; while (($pos = strpos($line, ' ')) !== false) { $token = substr($line, 0, $pos); while ($token[0] == '(') { array_push($stack, $tokens); $tokens = array(); $token = substr($token, 1); } if ($token[0] == '"') { if (preg_match('%^\(*"((.|\\\\|\\")*?)" *%', $line, $matches)) { $tokens[] = $matches[1]; $line = substr($line, strlen($matches[0])); continue; } } if ($token[0] == '{') { $endPos = strpos($token, '}'); $chars = substr($token, 1, $endPos - 1); if (is_numeric($chars)) { $token = ''; while (strlen($token) < $chars) { $token .= $this->_nextLine(); } $line = ''; if (strlen($token) > $chars) { $line = substr($token, $chars); $token = substr($token, 0, $chars); } else { $line .= $this->_nextLine(); } $tokens[] = $token; $line = trim($line) . ' '; continue; } } if ($stack && $token[strlen($token) - 1] == ')') { // closing braces are not seperated by spaces, so we need to count them $braces = strlen($token); $token = rtrim($token, ')'); // only count braces if more than one $braces -= strlen($token) + 1; // only add if token had more than just closing braces if (rtrim($token) != '') { $tokens[] = rtrim($token); } $token = $tokens; $tokens = array_pop($stack); // special handline if more than one closing brace while ($braces-- > 0) { $tokens[] = $token; $token = $tokens; $tokens = array_pop($stack); } } $tokens[] = $token; $line = substr($line, $pos + 1); } // maybe the server forgot to send some closing braces while ($stack) { $child = $tokens; $tokens = array_pop($stack); $tokens[] = $child; } return $tokens; }
[ "protected", "function", "_decodeLine", "(", "$", "line", ")", "{", "$", "tokens", "=", "array", "(", ")", ";", "$", "stack", "=", "array", "(", ")", ";", "/*\n We start to decode the response here. The unterstood tokens are:\n literal\n ...
split a given line in tokens. a token is literal of any form or a list @param string $line line to decode @return array tokens, literals are returned as string, lists as array @throws Zend_Mail_Protocol_Exception
[ "split", "a", "given", "line", "in", "tokens", ".", "a", "token", "is", "literal", "of", "any", "form", "or", "a", "list" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Mail/Protocol/Imap.php#L183-L269
train
Decode the response line
[ 30522, 5123, 3853, 1035, 21933, 9247, 3170, 1006, 1002, 2240, 1007, 1063, 1002, 19204, 2015, 1027, 9140, 1006, 1007, 1025, 1002, 9991, 1027, 9140, 1006, 1007, 1025, 1013, 1008, 2057, 2707, 2000, 21933, 3207, 1996, 3433, 2182, 1012, 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...