repo
stringclasses
21 values
path
stringlengths
10
100
func_name
stringlengths
6
71
original_string
stringlengths
115
97k
language
stringclasses
1 value
code
stringlengths
115
97k
code_tokens
listlengths
27
7.5k
docstring
stringlengths
6
1.88k
docstring_tokens
listlengths
1
177
sha
stringclasses
21 values
url
stringlengths
100
189
partition
stringclasses
1 value
summary
stringlengths
9
340
input_ids
listlengths
502
502
token_type_ids
listlengths
502
502
attention_mask
listlengths
502
502
labels
listlengths
502
502
matomo-org/matomo
core/API/Proxy.php
Proxy.getRequestParametersArray
private function getRequestParametersArray($requiredParameters, $parametersRequest) { $finalParameters = array(); foreach ($requiredParameters as $name => $defaultValue) { try { if ($defaultValue instanceof NoDefaultValue) { $requestValue = Common::getRequestVar($name, null, null, $parametersRequest); } else { try { if ($name == 'segment' && !empty($parametersRequest['segment'])) { // segment parameter is an exception: we do not want to sanitize user input or it would break the segment encoding $requestValue = ($parametersRequest['segment']); } else { $requestValue = Common::getRequestVar($name, $defaultValue, null, $parametersRequest); } } catch (Exception $e) { // Special case: empty parameter in the URL, should return the empty string if (isset($parametersRequest[$name]) && $parametersRequest[$name] === '' ) { $requestValue = ''; } else { $requestValue = $defaultValue; } } } } catch (Exception $e) { throw new Exception(Piwik::translate('General_PleaseSpecifyValue', array($name))); } $finalParameters[$name] = $requestValue; } return $finalParameters; }
php
private function getRequestParametersArray($requiredParameters, $parametersRequest) { $finalParameters = array(); foreach ($requiredParameters as $name => $defaultValue) { try { if ($defaultValue instanceof NoDefaultValue) { $requestValue = Common::getRequestVar($name, null, null, $parametersRequest); } else { try { if ($name == 'segment' && !empty($parametersRequest['segment'])) { // segment parameter is an exception: we do not want to sanitize user input or it would break the segment encoding $requestValue = ($parametersRequest['segment']); } else { $requestValue = Common::getRequestVar($name, $defaultValue, null, $parametersRequest); } } catch (Exception $e) { // Special case: empty parameter in the URL, should return the empty string if (isset($parametersRequest[$name]) && $parametersRequest[$name] === '' ) { $requestValue = ''; } else { $requestValue = $defaultValue; } } } } catch (Exception $e) { throw new Exception(Piwik::translate('General_PleaseSpecifyValue', array($name))); } $finalParameters[$name] = $requestValue; } return $finalParameters; }
[ "private", "function", "getRequestParametersArray", "(", "$", "requiredParameters", ",", "$", "parametersRequest", ")", "{", "$", "finalParameters", "=", "array", "(", ")", ";", "foreach", "(", "$", "requiredParameters", "as", "$", "name", "=>", "$", "defaultVal...
Returns an array containing the values of the parameters to pass to the method to call @param array $requiredParameters array of (parameter name, default value) @param array $parametersRequest @throws Exception @return array values to pass to the function call
[ "Returns", "an", "array", "containing", "the", "values", "of", "the", "parameters", "to", "pass", "to", "the", "method", "to", "call" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/API/Proxy.php#L402-L434
train
Returns an array with all parameters that are required by the request
[ 30522, 2797, 3853, 2131, 2890, 15500, 28689, 22828, 10286, 9447, 1006, 1002, 3223, 28689, 22828, 2015, 1010, 1002, 11709, 2890, 15500, 1007, 1063, 1002, 2345, 28689, 22828, 2015, 1027, 9140, 1006, 1007, 1025, 18921, 6776, 1006, 1002, 3223, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Serializer/Encoder/YamlEncoder.php
YamlEncoder.decode
public function decode($data, $format, array $context = []) { $context = array_merge($this->defaultContext, $context); return $this->parser->parse($data, $context['yaml_flags']); }
php
public function decode($data, $format, array $context = []) { $context = array_merge($this->defaultContext, $context); return $this->parser->parse($data, $context['yaml_flags']); }
[ "public", "function", "decode", "(", "$", "data", ",", "$", "format", ",", "array", "$", "context", "=", "[", "]", ")", "{", "$", "context", "=", "array_merge", "(", "$", "this", "->", "defaultContext", ",", "$", "context", ")", ";", "return", "$", ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Serializer/Encoder/YamlEncoder.php#L64-L69
train
Decode a YAML string into a array of terms
[ 30522, 2270, 3853, 21933, 3207, 1006, 1002, 2951, 1010, 1002, 4289, 1010, 9140, 1002, 6123, 1027, 1031, 1033, 1007, 1063, 1002, 6123, 1027, 9140, 1035, 13590, 1006, 1002, 2023, 1011, 1028, 12398, 8663, 18209, 1010, 1002, 6123, 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...
symfony/symfony
src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php
YamlFileLoader.load
public function load($resource, $type = null) { $path = $this->locator->locate($resource); $content = $this->loadFile($path); $this->container->fileExists($path); // empty file if (null === $content) { return; } // imports $this->parseImports($content, $path); // parameters if (isset($content['parameters'])) { if (!\is_array($content['parameters'])) { throw new InvalidArgumentException(sprintf('The "parameters" key should contain an array in %s. Check your YAML syntax.', $path)); } foreach ($content['parameters'] as $key => $value) { $this->container->setParameter($key, $this->resolveServices($value, $path, true)); } } // extensions $this->loadFromExtensions($content); // services $this->anonymousServicesCount = 0; $this->anonymousServicesSuffix = '~'.ContainerBuilder::hash($path); $this->setCurrentDir(\dirname($path)); try { $this->parseDefinitions($content, $path); } finally { $this->instanceof = []; } }
php
public function load($resource, $type = null) { $path = $this->locator->locate($resource); $content = $this->loadFile($path); $this->container->fileExists($path); // empty file if (null === $content) { return; } // imports $this->parseImports($content, $path); // parameters if (isset($content['parameters'])) { if (!\is_array($content['parameters'])) { throw new InvalidArgumentException(sprintf('The "parameters" key should contain an array in %s. Check your YAML syntax.', $path)); } foreach ($content['parameters'] as $key => $value) { $this->container->setParameter($key, $this->resolveServices($value, $path, true)); } } // extensions $this->loadFromExtensions($content); // services $this->anonymousServicesCount = 0; $this->anonymousServicesSuffix = '~'.ContainerBuilder::hash($path); $this->setCurrentDir(\dirname($path)); try { $this->parseDefinitions($content, $path); } finally { $this->instanceof = []; } }
[ "public", "function", "load", "(", "$", "resource", ",", "$", "type", "=", "null", ")", "{", "$", "path", "=", "$", "this", "->", "locator", "->", "locate", "(", "$", "resource", ")", ";", "$", "content", "=", "$", "this", "->", "loadFile", "(", ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php#L115-L154
train
Loads the content of a resource and parses it into the container.
[ 30522, 2270, 3853, 7170, 1006, 1002, 7692, 1010, 1002, 2828, 1027, 19701, 1007, 1063, 1002, 4130, 1027, 1002, 2023, 1011, 1028, 8840, 11266, 2953, 1011, 1028, 12453, 1006, 1002, 7692, 1007, 1025, 1002, 4180, 1027, 1002, 2023, 1011, 1028, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Filesystem/Filesystem.php
Filesystem.readlink
public function readlink($path, $canonicalize = false) { if (!$canonicalize && !is_link($path)) { return; } if ($canonicalize) { if (!$this->exists($path)) { return; } if ('\\' === \DIRECTORY_SEPARATOR) { $path = readlink($path); } return realpath($path); } if ('\\' === \DIRECTORY_SEPARATOR) { return realpath($path); } return readlink($path); }
php
public function readlink($path, $canonicalize = false) { if (!$canonicalize && !is_link($path)) { return; } if ($canonicalize) { if (!$this->exists($path)) { return; } if ('\\' === \DIRECTORY_SEPARATOR) { $path = readlink($path); } return realpath($path); } if ('\\' === \DIRECTORY_SEPARATOR) { return realpath($path); } return readlink($path); }
[ "public", "function", "readlink", "(", "$", "path", ",", "$", "canonicalize", "=", "false", ")", "{", "if", "(", "!", "$", "canonicalize", "&&", "!", "is_link", "(", "$", "path", ")", ")", "{", "return", ";", "}", "if", "(", "$", "canonicalize", ")...
Resolves links in paths. With $canonicalize = false (default) - if $path does not exist or is not a link, returns null - if $path is a link, returns the next direct target of the link without considering the existence of the target With $canonicalize = true - if $path does not exist, returns null - if $path exists, returns its absolute fully resolved final version @param string $path A filesystem path @param bool $canonicalize Whether or not to return a canonicalized path @return string|null
[ "Resolves", "links", "in", "paths", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Filesystem/Filesystem.php#L414-L437
train
Read link.
[ 30522, 2270, 3853, 3191, 13767, 1006, 1002, 4130, 1010, 1002, 18562, 4697, 1027, 6270, 1007, 1063, 2065, 1006, 999, 1002, 18562, 4697, 1004, 1004, 999, 2003, 1035, 4957, 1006, 1002, 4130, 1007, 1007, 1063, 2709, 1025, 1065, 2065, 1006, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/DomCrawler/Crawler.php
Crawler.attr
public function attr($attribute) { if (!$this->nodes) { throw new \InvalidArgumentException('The current node list is empty.'); } $node = $this->getNode(0); return $node->hasAttribute($attribute) ? $node->getAttribute($attribute) : null; }
php
public function attr($attribute) { if (!$this->nodes) { throw new \InvalidArgumentException('The current node list is empty.'); } $node = $this->getNode(0); return $node->hasAttribute($attribute) ? $node->getAttribute($attribute) : null; }
[ "public", "function", "attr", "(", "$", "attribute", ")", "{", "if", "(", "!", "$", "this", "->", "nodes", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'The current node list is empty.'", ")", ";", "}", "$", "node", "=", "$", "this", ...
Returns the attribute value of the first node of the list. @param string $attribute The attribute name @return string|null The attribute value or null if the attribute does not exist @throws \InvalidArgumentException When current node is empty
[ "Returns", "the", "attribute", "value", "of", "the", "first", "node", "of", "the", "list", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DomCrawler/Crawler.php#L534-L543
train
Get the attribute value of the first node in the node list
[ 30522, 2270, 3853, 2012, 16344, 1006, 1002, 17961, 1007, 1063, 2065, 1006, 999, 1002, 2023, 1011, 1028, 14164, 1007, 1063, 5466, 2047, 1032, 19528, 2906, 22850, 15781, 2595, 24422, 1006, 1005, 1996, 2783, 13045, 2862, 2003, 4064, 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...
octobercms/october
modules/system/classes/MediaLibrary.php
MediaLibrary.getPathUrl
public function getPathUrl($path) { $path = $this->validatePath($path); $fullPath = $this->storagePath.implode("/", array_map("rawurlencode", explode("/", $path))); return Url::to($fullPath); }
php
public function getPathUrl($path) { $path = $this->validatePath($path); $fullPath = $this->storagePath.implode("/", array_map("rawurlencode", explode("/", $path))); return Url::to($fullPath); }
[ "public", "function", "getPathUrl", "(", "$", "path", ")", "{", "$", "path", "=", "$", "this", "->", "validatePath", "(", "$", "path", ")", ";", "$", "fullPath", "=", "$", "this", "->", "storagePath", ".", "implode", "(", "\"/\"", ",", "array_map", "...
Returns a public file URL. @param string $path Specifies the file path relative the the Library root. @return string
[ "Returns", "a", "public", "file", "URL", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/MediaLibrary.php#L534-L541
train
Get path url
[ 30522, 2270, 3853, 2131, 15069, 3126, 2140, 1006, 1002, 4130, 1007, 1063, 1002, 4130, 1027, 1002, 2023, 1011, 1028, 9398, 3686, 15069, 1006, 1002, 4130, 1007, 1025, 1002, 2440, 15069, 1027, 1002, 2023, 1011, 1028, 5527, 15069, 1012, 17727, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Static.php
Zend_Cache_Backend_Static._octdec
protected function _octdec($val) { if (is_string($val) && decoct(octdec($val)) == $val) { return octdec($val); } return $val; }
php
protected function _octdec($val) { if (is_string($val) && decoct(octdec($val)) == $val) { return octdec($val); } return $val; }
[ "protected", "function", "_octdec", "(", "$", "val", ")", "{", "if", "(", "is_string", "(", "$", "val", ")", "&&", "decoct", "(", "octdec", "(", "$", "val", ")", ")", "==", "$", "val", ")", "{", "return", "octdec", "(", "$", "val", ")", ";", "}...
Detect an octal string and return its octal value for file permission ops otherwise return the non-string (assumed octal or decimal int already) @param string $val The potential octal in need of conversion @return int
[ "Detect", "an", "octal", "string", "and", "return", "its", "octal", "value", "for", "file", "permission", "ops", "otherwise", "return", "the", "non", "-", "string", "(", "assumed", "octal", "or", "decimal", "int", "already", ")" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Cache/Backend/Static.php#L546-L552
train
Convert octdec to unix timestamp
[ 30522, 5123, 3853, 1035, 13323, 3207, 2278, 1006, 1002, 11748, 1007, 1063, 2065, 1006, 2003, 1035, 5164, 1006, 1002, 11748, 1007, 1004, 1004, 21933, 6593, 1006, 13323, 3207, 2278, 1006, 1002, 11748, 1007, 1007, 1027, 1027, 1002, 11748, 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...
getgrav/grav
system/src/Grav/Common/Config/ConfigFileFinder.php
ConfigFileFinder.locateFile
public function locateFile(array $paths, $name, $ext = '.yaml') { $filename = preg_replace('|[.\/]+|', '/', $name) . $ext; $list = []; foreach ($paths as $folder) { $path = trim(Folder::getRelativePath($folder), '/'); if (is_file("{$folder}/{$filename}")) { $modified = filemtime("{$folder}/{$filename}"); } else { $modified = 0; } $basename = $this->base . $name; $list[$path] = [$basename => ['file' => "{$path}/{$filename}", 'modified' => $modified]]; } return $list; }
php
public function locateFile(array $paths, $name, $ext = '.yaml') { $filename = preg_replace('|[.\/]+|', '/', $name) . $ext; $list = []; foreach ($paths as $folder) { $path = trim(Folder::getRelativePath($folder), '/'); if (is_file("{$folder}/{$filename}")) { $modified = filemtime("{$folder}/{$filename}"); } else { $modified = 0; } $basename = $this->base . $name; $list[$path] = [$basename => ['file' => "{$path}/{$filename}", 'modified' => $modified]]; } return $list; }
[ "public", "function", "locateFile", "(", "array", "$", "paths", ",", "$", "name", ",", "$", "ext", "=", "'.yaml'", ")", "{", "$", "filename", "=", "preg_replace", "(", "'|[.\\/]+|'", ",", "'/'", ",", "$", "name", ")", ".", "$", "ext", ";", "$", "li...
Return all existing locations for a single file with a timestamp. @param array $paths Filesystem paths to look up from. @param string $name Configuration file to be located. @param string $ext File extension (optional, defaults to .yaml). @return array
[ "Return", "all", "existing", "locations", "for", "a", "single", "file", "with", "a", "timestamp", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Config/ConfigFileFinder.php#L127-L145
train
Locates a file in a list of paths
[ 30522, 2270, 3853, 12453, 8873, 2571, 1006, 9140, 1002, 10425, 1010, 1002, 2171, 1010, 1002, 4654, 2102, 1027, 1005, 1012, 8038, 19968, 1005, 1007, 1063, 1002, 5371, 18442, 1027, 3653, 2290, 1035, 5672, 1006, 1005, 1064, 1031, 1012, 1032, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Broadcasting/Broadcasters/RedisBroadcaster.php
RedisBroadcaster.validAuthenticationResponse
public function validAuthenticationResponse($request, $result) { if (is_bool($result)) { return json_encode($result); } $channelName = $this->normalizeChannelName($request->channel_name); return json_encode(['channel_data' => [ 'user_id' => $this->retrieveUser($request, $channelName)->getAuthIdentifier(), 'user_info' => $result, ]]); }
php
public function validAuthenticationResponse($request, $result) { if (is_bool($result)) { return json_encode($result); } $channelName = $this->normalizeChannelName($request->channel_name); return json_encode(['channel_data' => [ 'user_id' => $this->retrieveUser($request, $channelName)->getAuthIdentifier(), 'user_info' => $result, ]]); }
[ "public", "function", "validAuthenticationResponse", "(", "$", "request", ",", "$", "result", ")", "{", "if", "(", "is_bool", "(", "$", "result", ")", ")", "{", "return", "json_encode", "(", "$", "result", ")", ";", "}", "$", "channelName", "=", "$", "...
Return the valid authentication response. @param \Illuminate\Http\Request $request @param mixed $result @return mixed
[ "Return", "the", "valid", "authentication", "response", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Broadcasting/Broadcasters/RedisBroadcaster.php#L69-L81
train
validAuthenticationResponse - Callback for the validAuthenticationResponse method
[ 30522, 2270, 3853, 9398, 4887, 10760, 16778, 10719, 6072, 26029, 3366, 1006, 1002, 5227, 1010, 1002, 2765, 1007, 1063, 2065, 1006, 2003, 1035, 22017, 2140, 1006, 1002, 2765, 1007, 1007, 1063, 2709, 1046, 3385, 1035, 4372, 16044, 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.getBodyText
public function getBodyText($textOnly = false) { if ($textOnly && $this->_bodyText) { $body = $this->_bodyText; return $body->getContent(); } return $this->_bodyText; }
php
public function getBodyText($textOnly = false) { if ($textOnly && $this->_bodyText) { $body = $this->_bodyText; return $body->getContent(); } return $this->_bodyText; }
[ "public", "function", "getBodyText", "(", "$", "textOnly", "=", "false", ")", "{", "if", "(", "$", "textOnly", "&&", "$", "this", "->", "_bodyText", ")", "{", "$", "body", "=", "$", "this", "->", "_bodyText", ";", "return", "$", "body", "->", "getCon...
Return text body Zend_Mime_Part or string @param bool textOnly Whether to return just the body text content or the MIME part; defaults to false, the MIME part @return false|Zend_Mime_Part|string
[ "Return", "text", "body", "Zend_Mime_Part", "or", "string" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Mail.php#L384-L392
train
Get Body Text
[ 30522, 2270, 3853, 2131, 23684, 18209, 1006, 1002, 3793, 2239, 2135, 1027, 6270, 1007, 1063, 2065, 1006, 1002, 3793, 2239, 2135, 1004, 1004, 1002, 2023, 1011, 1028, 1035, 2303, 18209, 1007, 1063, 1002, 2303, 1027, 1002, 2023, 1011, 1028, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Routing/MiddlewareNameResolver.php
MiddlewareNameResolver.parseMiddlewareGroup
protected static function parseMiddlewareGroup($name, $map, $middlewareGroups) { $results = []; foreach ($middlewareGroups[$name] as $middleware) { // If the middleware is another middleware group we will pull in the group and // merge its middleware into the results. This allows groups to conveniently // reference other groups without needing to repeat all their middlewares. if (isset($middlewareGroups[$middleware])) { $results = array_merge($results, static::parseMiddlewareGroup( $middleware, $map, $middlewareGroups )); continue; } [$middleware, $parameters] = array_pad( explode(':', $middleware, 2), 2, null ); // If this middleware is actually a route middleware, we will extract the full // class name out of the middleware list now. Then we'll add the parameters // back onto this class' name so the pipeline will properly extract them. if (isset($map[$middleware])) { $middleware = $map[$middleware]; } $results[] = $middleware.($parameters ? ':'.$parameters : ''); } return $results; }
php
protected static function parseMiddlewareGroup($name, $map, $middlewareGroups) { $results = []; foreach ($middlewareGroups[$name] as $middleware) { // If the middleware is another middleware group we will pull in the group and // merge its middleware into the results. This allows groups to conveniently // reference other groups without needing to repeat all their middlewares. if (isset($middlewareGroups[$middleware])) { $results = array_merge($results, static::parseMiddlewareGroup( $middleware, $map, $middlewareGroups )); continue; } [$middleware, $parameters] = array_pad( explode(':', $middleware, 2), 2, null ); // If this middleware is actually a route middleware, we will extract the full // class name out of the middleware list now. Then we'll add the parameters // back onto this class' name so the pipeline will properly extract them. if (isset($map[$middleware])) { $middleware = $map[$middleware]; } $results[] = $middleware.($parameters ? ':'.$parameters : ''); } return $results; }
[ "protected", "static", "function", "parseMiddlewareGroup", "(", "$", "name", ",", "$", "map", ",", "$", "middlewareGroups", ")", "{", "$", "results", "=", "[", "]", ";", "foreach", "(", "$", "middlewareGroups", "[", "$", "name", "]", "as", "$", "middlewa...
Parse the middleware group and format it for usage. @param string $name @param array $map @param array $middlewareGroups @return array
[ "Parse", "the", "middleware", "group", "and", "format", "it", "for", "usage", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Routing/MiddlewareNameResolver.php#L53-L84
train
Parse the middleware group
[ 30522, 5123, 10763, 3853, 11968, 3366, 4328, 20338, 8059, 17058, 1006, 1002, 2171, 1010, 1002, 4949, 1010, 1002, 2690, 8059, 17058, 2015, 1007, 1063, 1002, 3463, 1027, 1031, 1033, 1025, 18921, 6776, 1006, 1002, 2690, 8059, 17058, 2015, 1031...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Framework/Filesystem/Filesystem.php
Filesystem.getInstance
public static function getInstance(bool $normalize = null): Filesystem { if ($normalize === true) { $instance = &static::$safe; } elseif ($normalize === false) { $instance = &static::$unsafe; } else { $instance = &static::$default; } if (null === $instance) { $instance = new static($normalize); } return $instance; }
php
public static function getInstance(bool $normalize = null): Filesystem { if ($normalize === true) { $instance = &static::$safe; } elseif ($normalize === false) { $instance = &static::$unsafe; } else { $instance = &static::$default; } if (null === $instance) { $instance = new static($normalize); } return $instance; }
[ "public", "static", "function", "getInstance", "(", "bool", "$", "normalize", "=", "null", ")", ":", "Filesystem", "{", "if", "(", "$", "normalize", "===", "true", ")", "{", "$", "instance", "=", "&", "static", "::", "$", "safe", ";", "}", "elseif", ...
@param bool|null $normalize See $this->setNormalization() @return Filesystem
[ "@param", "bool|null", "$normalize", "See", "$this", "-", ">", "setNormalization", "()" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Framework/Filesystem/Filesystem.php#L35-L50
train
Returns the instance of the filesystem
[ 30522, 2270, 10763, 3853, 2131, 7076, 26897, 1006, 22017, 2140, 1002, 3671, 4697, 1027, 19701, 1007, 1024, 6764, 27268, 6633, 1063, 2065, 1006, 1002, 3671, 4697, 1027, 1027, 1027, 2995, 1007, 1063, 1002, 6013, 1027, 1004, 10763, 1024, 1024,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/MultiSites/API.php
API.calculateEvolutionPercentages
private function calculateEvolutionPercentages($currentData, $pastData, $apiMetrics) { if (get_class($currentData) != get_class($pastData)) { // sanity check for regressions throw new Exception("Expected \$pastData to be of type " . get_class($currentData) . " - got " . get_class($pastData) . "."); } if ($currentData instanceof DataTable\Map) { $pastArray = $pastData->getDataTables(); foreach ($currentData->getDataTables() as $subTable) { $this->calculateEvolutionPercentages($subTable, current($pastArray), $apiMetrics); next($pastArray); } } else { $extraProcessedMetrics = $currentData->getMetadata(DataTable::EXTRA_PROCESSED_METRICS_METADATA_NAME); foreach ($apiMetrics as $metricSettings) { $evolutionMetricClass = $this->isEcommerceEvolutionMetric($metricSettings) ? "Piwik\\Plugins\\MultiSites\\Columns\\Metrics\\EcommerceOnlyEvolutionMetric" : "Piwik\\Plugins\\CoreHome\\Columns\\Metrics\\EvolutionMetric"; $extraProcessedMetrics[] = new $evolutionMetricClass( $metricSettings[self::METRIC_RECORD_NAME_KEY], $pastData, $metricSettings[self::METRIC_EVOLUTION_COL_NAME_KEY], $quotientPrecision = 1 ); } $currentData->setMetadata(DataTable::EXTRA_PROCESSED_METRICS_METADATA_NAME, $extraProcessedMetrics); } }
php
private function calculateEvolutionPercentages($currentData, $pastData, $apiMetrics) { if (get_class($currentData) != get_class($pastData)) { // sanity check for regressions throw new Exception("Expected \$pastData to be of type " . get_class($currentData) . " - got " . get_class($pastData) . "."); } if ($currentData instanceof DataTable\Map) { $pastArray = $pastData->getDataTables(); foreach ($currentData->getDataTables() as $subTable) { $this->calculateEvolutionPercentages($subTable, current($pastArray), $apiMetrics); next($pastArray); } } else { $extraProcessedMetrics = $currentData->getMetadata(DataTable::EXTRA_PROCESSED_METRICS_METADATA_NAME); foreach ($apiMetrics as $metricSettings) { $evolutionMetricClass = $this->isEcommerceEvolutionMetric($metricSettings) ? "Piwik\\Plugins\\MultiSites\\Columns\\Metrics\\EcommerceOnlyEvolutionMetric" : "Piwik\\Plugins\\CoreHome\\Columns\\Metrics\\EvolutionMetric"; $extraProcessedMetrics[] = new $evolutionMetricClass( $metricSettings[self::METRIC_RECORD_NAME_KEY], $pastData, $metricSettings[self::METRIC_EVOLUTION_COL_NAME_KEY], $quotientPrecision = 1 ); } $currentData->setMetadata(DataTable::EXTRA_PROCESSED_METRICS_METADATA_NAME, $extraProcessedMetrics); } }
[ "private", "function", "calculateEvolutionPercentages", "(", "$", "currentData", ",", "$", "pastData", ",", "$", "apiMetrics", ")", "{", "if", "(", "get_class", "(", "$", "currentData", ")", "!=", "get_class", "(", "$", "pastData", ")", ")", "{", "// sanity ...
Performs a binary filter of two DataTables in order to correctly calculate evolution metrics. @param DataTable|DataTable\Map $currentData @param DataTable|DataTable\Map $pastData @param array $apiMetrics The array of string fields to calculate evolution metrics for. @throws Exception
[ "Performs", "a", "binary", "filter", "of", "two", "DataTables", "in", "order", "to", "correctly", "calculate", "evolution", "metrics", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/MultiSites/API.php#L321-L350
train
Calculates evolution percentages for the current data table
[ 30522, 2797, 3853, 18422, 6777, 4747, 13700, 4842, 13013, 13923, 1006, 1002, 2783, 2850, 2696, 1010, 1002, 2627, 2850, 2696, 1010, 1002, 17928, 12589, 2015, 1007, 1063, 2065, 1006, 2131, 1035, 2465, 1006, 1002, 2783, 2850, 2696, 1007, 999, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/DataTable/Filter/Limit.php
Limit.filter
public function filter($table) { $table->setMetadata(DataTable::TOTAL_ROWS_BEFORE_LIMIT_METADATA_NAME, $table->getRowsCount()); if ($this->keepSummaryRow) { $summaryRow = $table->getRowFromId(DataTable::ID_SUMMARY_ROW); } // we delete from 0 to offset if ($this->offset > 0) { $table->deleteRowsOffset(0, $this->offset); } // at this point the array has offset less elements. We delete from limit to the end if ($this->limit >= 0) { $table->deleteRowsOffset($this->limit); } if ($this->keepSummaryRow && !empty($summaryRow)) { $table->addSummaryRow($summaryRow); } }
php
public function filter($table) { $table->setMetadata(DataTable::TOTAL_ROWS_BEFORE_LIMIT_METADATA_NAME, $table->getRowsCount()); if ($this->keepSummaryRow) { $summaryRow = $table->getRowFromId(DataTable::ID_SUMMARY_ROW); } // we delete from 0 to offset if ($this->offset > 0) { $table->deleteRowsOffset(0, $this->offset); } // at this point the array has offset less elements. We delete from limit to the end if ($this->limit >= 0) { $table->deleteRowsOffset($this->limit); } if ($this->keepSummaryRow && !empty($summaryRow)) { $table->addSummaryRow($summaryRow); } }
[ "public", "function", "filter", "(", "$", "table", ")", "{", "$", "table", "->", "setMetadata", "(", "DataTable", "::", "TOTAL_ROWS_BEFORE_LIMIT_METADATA_NAME", ",", "$", "table", "->", "getRowsCount", "(", ")", ")", ";", "if", "(", "$", "this", "->", "kee...
See {@link Limit}. @param DataTable $table
[ "See", "{", "@link", "Limit", "}", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/DataTable/Filter/Limit.php#L48-L68
train
Filter the table
[ 30522, 2270, 3853, 11307, 1006, 1002, 2795, 1007, 1063, 1002, 2795, 1011, 1028, 2275, 11368, 8447, 2696, 1006, 2951, 10880, 1024, 1024, 2561, 1035, 10281, 1035, 2077, 1035, 5787, 1035, 27425, 1035, 2171, 1010, 1002, 2795, 1011, 1028, 2131, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/HttpFoundation/HeaderBag.php
HeaderBag.contains
public function contains($key, $value) { return \in_array($value, $this->get($key, null, false)); }
php
public function contains($key, $value) { return \in_array($value, $this->get($key, null, false)); }
[ "public", "function", "contains", "(", "$", "key", ",", "$", "value", ")", "{", "return", "\\", "in_array", "(", "$", "value", ",", "$", "this", "->", "get", "(", "$", "key", ",", "null", ",", "false", ")", ")", ";", "}" ]
Returns true if the given HTTP header contains the given value. @param string $key The HTTP header name @param string $value The HTTP value @return bool true if the value is contained in the header, false otherwise
[ "Returns", "true", "if", "the", "given", "HTTP", "header", "contains", "the", "given", "value", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpFoundation/HeaderBag.php#L182-L185
train
Returns true if the array contains the given value
[ 30522, 2270, 3853, 3397, 1006, 1002, 3145, 1010, 1002, 3643, 1007, 1063, 2709, 1032, 1999, 1035, 9140, 1006, 1002, 3643, 1010, 1002, 2023, 1011, 1028, 2131, 1006, 1002, 3145, 1010, 19701, 1010, 6270, 1007, 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, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
PHPMailer/PHPMailer
src/SMTP.php
SMTP.connected
public function connected() { if (is_resource($this->smtp_conn)) { $sock_status = stream_get_meta_data($this->smtp_conn); if ($sock_status['eof']) { // The socket is valid but we are not connected $this->edebug( 'SMTP NOTICE: EOF caught while checking if connected', self::DEBUG_CLIENT ); $this->close(); return false; } return true; // everything looks good } return false; }
php
public function connected() { if (is_resource($this->smtp_conn)) { $sock_status = stream_get_meta_data($this->smtp_conn); if ($sock_status['eof']) { // The socket is valid but we are not connected $this->edebug( 'SMTP NOTICE: EOF caught while checking if connected', self::DEBUG_CLIENT ); $this->close(); return false; } return true; // everything looks good } return false; }
[ "public", "function", "connected", "(", ")", "{", "if", "(", "is_resource", "(", "$", "this", "->", "smtp_conn", ")", ")", "{", "$", "sock_status", "=", "stream_get_meta_data", "(", "$", "this", "->", "smtp_conn", ")", ";", "if", "(", "$", "sock_status",...
Check connection state. @return bool True if connected
[ "Check", "connection", "state", "." ]
3d7132341659a8a201adbc3ba11b1e202ee2857c
https://github.com/PHPMailer/PHPMailer/blob/3d7132341659a8a201adbc3ba11b1e202ee2857c/src/SMTP.php#L588-L607
train
Check if connected to the socket
[ 30522, 2270, 3853, 4198, 1006, 1007, 1063, 2065, 1006, 2003, 1035, 7692, 1006, 1002, 2023, 1011, 1028, 15488, 25856, 1035, 9530, 2078, 1007, 1007, 1063, 1002, 28407, 1035, 3570, 1027, 5460, 1035, 2131, 1035, 18804, 1035, 2951, 1006, 1002, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
z-song/laravel-admin
src/Show/Tools.php
Tools.renderCustomTools
protected function renderCustomTools($tools) { return $tools->map(function ($tool) { if ($tool instanceof Renderable) { return $tool->render(); } if ($tool instanceof Htmlable) { return $tool->toHtml(); } return (string) $tool; })->implode(' '); }
php
protected function renderCustomTools($tools) { return $tools->map(function ($tool) { if ($tool instanceof Renderable) { return $tool->render(); } if ($tool instanceof Htmlable) { return $tool->toHtml(); } return (string) $tool; })->implode(' '); }
[ "protected", "function", "renderCustomTools", "(", "$", "tools", ")", "{", "return", "$", "tools", "->", "map", "(", "function", "(", "$", "tool", ")", "{", "if", "(", "$", "tool", "instanceof", "Renderable", ")", "{", "return", "$", "tool", "->", "ren...
Render custom tools. @param Collection $tools @return mixed
[ "Render", "custom", "tools", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Show/Tools.php#L294-L307
train
Render custom tools
[ 30522, 5123, 3853, 17552, 7874, 20389, 3406, 27896, 1006, 1002, 5906, 1007, 1063, 2709, 1002, 5906, 1011, 1028, 4949, 1006, 3853, 1006, 1002, 6994, 1007, 1063, 2065, 1006, 1002, 6994, 6013, 11253, 17552, 3085, 1007, 1063, 2709, 1002, 6994, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Dumper/GraphvizDumper.php
GraphvizDumper.dump
public function dump(Definition $definition, Marking $marking = null, array $options = []) { $places = $this->findPlaces($definition, $marking); $transitions = $this->findTransitions($definition); $edges = $this->findEdges($definition); $options = array_replace_recursive(self::$defaultOptions, $options); return $this->startDot($options) .$this->addPlaces($places) .$this->addTransitions($transitions) .$this->addEdges($edges) .$this->endDot(); }
php
public function dump(Definition $definition, Marking $marking = null, array $options = []) { $places = $this->findPlaces($definition, $marking); $transitions = $this->findTransitions($definition); $edges = $this->findEdges($definition); $options = array_replace_recursive(self::$defaultOptions, $options); return $this->startDot($options) .$this->addPlaces($places) .$this->addTransitions($transitions) .$this->addEdges($edges) .$this->endDot(); }
[ "public", "function", "dump", "(", "Definition", "$", "definition", ",", "Marking", "$", "marking", "=", "null", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "places", "=", "$", "this", "->", "findPlaces", "(", "$", "definition", ",", ...
{@inheritdoc} Dumps the workflow as a graphviz graph. Available options: * graph: The default options for the whole graph * node: The default options for nodes (places + transitions) * edge: The default options for edges
[ "{", "@inheritdoc", "}" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Workflow/Dumper/GraphvizDumper.php#L46-L59
train
Dump a definition into a string
[ 30522, 2270, 3853, 15653, 1006, 6210, 1002, 6210, 1010, 10060, 1002, 10060, 1027, 19701, 1010, 9140, 1002, 7047, 1027, 1031, 1033, 1007, 1063, 1002, 3182, 1027, 1002, 2023, 1011, 1028, 2424, 24759, 10732, 2015, 1006, 1002, 6210, 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...
symfony/symfony
src/Symfony/Component/Form/Extension/Core/Type/CurrencyType.php
CurrencyType.configureOptions
public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults([ 'choice_loader' => function (Options $options) { $choiceTranslationLocale = $options['choice_translation_locale']; return new IntlCallbackChoiceLoader(function () use ($choiceTranslationLocale) { return array_flip(Currencies::getNames($choiceTranslationLocale)); }); }, 'choice_translation_domain' => false, 'choice_translation_locale' => null, ]); $resolver->setAllowedTypes('choice_translation_locale', ['null', 'string']); }
php
public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults([ 'choice_loader' => function (Options $options) { $choiceTranslationLocale = $options['choice_translation_locale']; return new IntlCallbackChoiceLoader(function () use ($choiceTranslationLocale) { return array_flip(Currencies::getNames($choiceTranslationLocale)); }); }, 'choice_translation_domain' => false, 'choice_translation_locale' => null, ]); $resolver->setAllowedTypes('choice_translation_locale', ['null', 'string']); }
[ "public", "function", "configureOptions", "(", "OptionsResolver", "$", "resolver", ")", "{", "$", "resolver", "->", "setDefaults", "(", "[", "'choice_loader'", "=>", "function", "(", "Options", "$", "options", ")", "{", "$", "choiceTranslationLocale", "=", "$", ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Extension/Core/Type/CurrencyType.php#L40-L55
train
Adds the locale options to the options resolver.
[ 30522, 2270, 3853, 9530, 8873, 27390, 8780, 16790, 2015, 1006, 7047, 6072, 4747, 6299, 30524, 1035, 7170, 2121, 1005, 1027, 1028, 3853, 1006, 7047, 1002, 7047, 1007, 1063, 1002, 3601, 6494, 3619, 13490, 4135, 9289, 2063, 1027, 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/Http/RememberMe/AbstractRememberMeServices.php
AbstractRememberMeServices.loginSuccess
final public function loginSuccess(Request $request, Response $response, TokenInterface $token) { // Make sure any old remember-me cookies are cancelled $this->cancelCookie($request); if (!$token->getUser() instanceof UserInterface) { if (null !== $this->logger) { $this->logger->debug('Remember-me ignores token since it does not contain a UserInterface implementation.'); } return; } if (!$this->isRememberMeRequested($request)) { if (null !== $this->logger) { $this->logger->debug('Remember-me was not requested.'); } return; } if (null !== $this->logger) { $this->logger->debug('Remember-me was requested; setting cookie.'); } // Remove attribute from request that sets a NULL cookie. // It was set by $this->cancelCookie() // (cancelCookie does other things too for some RememberMeServices // so we should still call it at the start of this method) $request->attributes->remove(self::COOKIE_ATTR_NAME); $this->onLoginSuccess($request, $response, $token); }
php
final public function loginSuccess(Request $request, Response $response, TokenInterface $token) { // Make sure any old remember-me cookies are cancelled $this->cancelCookie($request); if (!$token->getUser() instanceof UserInterface) { if (null !== $this->logger) { $this->logger->debug('Remember-me ignores token since it does not contain a UserInterface implementation.'); } return; } if (!$this->isRememberMeRequested($request)) { if (null !== $this->logger) { $this->logger->debug('Remember-me was not requested.'); } return; } if (null !== $this->logger) { $this->logger->debug('Remember-me was requested; setting cookie.'); } // Remove attribute from request that sets a NULL cookie. // It was set by $this->cancelCookie() // (cancelCookie does other things too for some RememberMeServices // so we should still call it at the start of this method) $request->attributes->remove(self::COOKIE_ATTR_NAME); $this->onLoginSuccess($request, $response, $token); }
[ "final", "public", "function", "loginSuccess", "(", "Request", "$", "request", ",", "Response", "$", "response", ",", "TokenInterface", "$", "token", ")", "{", "// Make sure any old remember-me cookies are cancelled", "$", "this", "->", "cancelCookie", "(", "$", "re...
Implementation for RememberMeServicesInterface. This is called when an authentication is successful.
[ "Implementation", "for", "RememberMeServicesInterface", ".", "This", "is", "called", "when", "an", "authentication", "is", "successful", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Security/Http/RememberMe/AbstractRememberMeServices.php#L171-L203
train
Called when the login success
[ 30522, 2345, 2270, 3853, 8833, 7076, 14194, 9623, 2015, 1006, 5227, 1002, 5227, 1010, 3433, 1002, 3433, 1010, 19204, 18447, 2121, 12172, 1002, 19204, 1007, 1063, 1013, 1013, 2191, 2469, 2151, 2214, 3342, 1011, 2033, 16324, 2024, 8014, 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/Routing/Redirector.php
Redirector.secure
public function secure($path, $status = 302, $headers = []) { return $this->to($path, $status, $headers, true); }
php
public function secure($path, $status = 302, $headers = []) { return $this->to($path, $status, $headers, true); }
[ "public", "function", "secure", "(", "$", "path", ",", "$", "status", "=", "302", ",", "$", "headers", "=", "[", "]", ")", "{", "return", "$", "this", "->", "to", "(", "$", "path", ",", "$", "status", ",", "$", "headers", ",", "true", ")", ";",...
Create a new redirect response to the given HTTPS path. @param string $path @param int $status @param array $headers @return \Illuminate\Http\RedirectResponse
[ "Create", "a", "new", "redirect", "response", "to", "the", "given", "HTTPS", "path", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Routing/Redirector.php#L160-L163
train
Secure redirect to path
[ 30522, 2270, 3853, 5851, 1006, 1002, 4130, 1010, 1002, 3570, 1027, 22060, 1010, 1002, 20346, 2015, 1027, 1031, 1033, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 2000, 1006, 1002, 4130, 1010, 1002, 3570, 1010, 1002, 20346, 2015, 1010, 2995, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Validator/Mapping/ClassMetadata.php
ClassMetadata.setGroupSequence
public function setGroupSequence($groupSequence) { if ($this->isGroupSequenceProvider()) { throw new GroupDefinitionException('Defining a static group sequence is not allowed with a group sequence provider'); } if (\is_array($groupSequence)) { $groupSequence = new GroupSequence($groupSequence); } if (\in_array(Constraint::DEFAULT_GROUP, $groupSequence->groups, true)) { throw new GroupDefinitionException(sprintf('The group "%s" is not allowed in group sequences', Constraint::DEFAULT_GROUP)); } if (!\in_array($this->getDefaultGroup(), $groupSequence->groups, true)) { throw new GroupDefinitionException(sprintf('The group "%s" is missing in the group sequence', $this->getDefaultGroup())); } $this->groupSequence = $groupSequence; return $this; }
php
public function setGroupSequence($groupSequence) { if ($this->isGroupSequenceProvider()) { throw new GroupDefinitionException('Defining a static group sequence is not allowed with a group sequence provider'); } if (\is_array($groupSequence)) { $groupSequence = new GroupSequence($groupSequence); } if (\in_array(Constraint::DEFAULT_GROUP, $groupSequence->groups, true)) { throw new GroupDefinitionException(sprintf('The group "%s" is not allowed in group sequences', Constraint::DEFAULT_GROUP)); } if (!\in_array($this->getDefaultGroup(), $groupSequence->groups, true)) { throw new GroupDefinitionException(sprintf('The group "%s" is missing in the group sequence', $this->getDefaultGroup())); } $this->groupSequence = $groupSequence; return $this; }
[ "public", "function", "setGroupSequence", "(", "$", "groupSequence", ")", "{", "if", "(", "$", "this", "->", "isGroupSequenceProvider", "(", ")", ")", "{", "throw", "new", "GroupDefinitionException", "(", "'Defining a static group sequence is not allowed with a group sequ...
Sets the default group sequence for this class. @param string[]|GroupSequence $groupSequence An array of group names @return $this @throws GroupDefinitionException
[ "Sets", "the", "default", "group", "sequence", "for", "this", "class", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Validator/Mapping/ClassMetadata.php#L401-L422
train
Set the group sequence
[ 30522, 2270, 3853, 2275, 17058, 3366, 4226, 5897, 1006, 1002, 2967, 2063, 4226, 5897, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 2003, 17058, 3366, 4226, 5897, 21572, 17258, 2121, 1006, 1007, 1007, 1063, 5466, 2047, 2177, 3207, 16294, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Button.php
Button.createView
public function createView(FormView $parent = null) { if (null === $parent && $this->parent) { $parent = $this->parent->createView(); } $type = $this->config->getType(); $options = $this->config->getOptions(); $view = $type->createView($this, $parent); $type->buildView($view, $this, $options); $type->finishView($view, $this, $options); return $view; }
php
public function createView(FormView $parent = null) { if (null === $parent && $this->parent) { $parent = $this->parent->createView(); } $type = $this->config->getType(); $options = $this->config->getOptions(); $view = $type->createView($this, $parent); $type->buildView($view, $this, $options); $type->finishView($view, $this, $options); return $view; }
[ "public", "function", "createView", "(", "FormView", "$", "parent", "=", "null", ")", "{", "if", "(", "null", "===", "$", "parent", "&&", "$", "this", "->", "parent", ")", "{", "$", "parent", "=", "$", "this", "->", "parent", "->", "createView", "(",...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Button.php#L417-L432
train
Create a form view
[ 30522, 2270, 3853, 3443, 8584, 1006, 2433, 8584, 1002, 6687, 1027, 19701, 1007, 1063, 2065, 1006, 19701, 1027, 1027, 1027, 1002, 6687, 1004, 1004, 1002, 2023, 1011, 1028, 6687, 1007, 1063, 1002, 6687, 1027, 1002, 2023, 1011, 1028, 6687, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Cache/Psr16Cache.php
Psr16Cache.getMultiple
public function getMultiple($keys, $default = null) { 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 { $items = $this->pool->getItems($keys); } catch (SimpleCacheException $e) { throw $e; } catch (Psr6CacheException $e) { throw new InvalidArgumentException($e->getMessage(), $e->getCode(), $e); } $values = []; if (!$this->pool instanceof AdapterInterface) { foreach ($items as $key => $item) { $values[$key] = $item->isHit() ? $item->get() : $default; } return $values; } foreach ($items as $key => $item) { if (!$item->isHit()) { $values[$key] = $default; continue; } $values[$key] = $item->get(); if (!$metadata = $item->getMetadata()) { continue; } unset($metadata[CacheItem::METADATA_TAGS]); if ($metadata) { $values[$key] = ["\x9D".pack('VN', (int) $metadata[CacheItem::METADATA_EXPIRY] - self::METADATA_EXPIRY_OFFSET, $metadata[CacheItem::METADATA_CTIME])."\x5F" => $values[$key]]; } } return $values; }
php
public function getMultiple($keys, $default = null) { 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 { $items = $this->pool->getItems($keys); } catch (SimpleCacheException $e) { throw $e; } catch (Psr6CacheException $e) { throw new InvalidArgumentException($e->getMessage(), $e->getCode(), $e); } $values = []; if (!$this->pool instanceof AdapterInterface) { foreach ($items as $key => $item) { $values[$key] = $item->isHit() ? $item->get() : $default; } return $values; } foreach ($items as $key => $item) { if (!$item->isHit()) { $values[$key] = $default; continue; } $values[$key] = $item->get(); if (!$metadata = $item->getMetadata()) { continue; } unset($metadata[CacheItem::METADATA_TAGS]); if ($metadata) { $values[$key] = ["\x9D".pack('VN', (int) $metadata[CacheItem::METADATA_EXPIRY] - self::METADATA_EXPIRY_OFFSET, $metadata[CacheItem::METADATA_CTIME])."\x5F" => $values[$key]]; } } return $values; }
[ "public", "function", "getMultiple", "(", "$", "keys", ",", "$", "default", "=", "null", ")", "{", "if", "(", "$", "keys", "instanceof", "\\", "Traversable", ")", "{", "$", "keys", "=", "iterator_to_array", "(", "$", "keys", ",", "false", ")", ";", "...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Cache/Psr16Cache.php#L134-L177
train
Get multiple cache items
[ 30522, 2270, 3853, 2131, 12274, 7096, 11514, 2571, 1006, 1002, 6309, 1010, 1002, 12398, 1027, 19701, 1007, 1063, 2065, 1006, 1002, 6309, 6013, 11253, 1032, 29053, 3085, 1007, 1063, 1002, 6309, 1027, 2009, 6906, 4263, 1035, 2000, 30524, 1705...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Period/Week.php
Week.generate
protected function generate() { if ($this->subperiodsProcessed) { return; } parent::generate(); $date = $this->date; if ($date->toString('N') > 1) { $date = $date->subDay($date->toString('N') - 1); } $startWeek = $date; $currentDay = clone $startWeek; while ($currentDay->compareWeek($startWeek) == 0) { $this->addSubperiod(new Day($currentDay)); $currentDay = $currentDay->addDay(1); } }
php
protected function generate() { if ($this->subperiodsProcessed) { return; } parent::generate(); $date = $this->date; if ($date->toString('N') > 1) { $date = $date->subDay($date->toString('N') - 1); } $startWeek = $date; $currentDay = clone $startWeek; while ($currentDay->compareWeek($startWeek) == 0) { $this->addSubperiod(new Day($currentDay)); $currentDay = $currentDay->addDay(1); } }
[ "protected", "function", "generate", "(", ")", "{", "if", "(", "$", "this", "->", "subperiodsProcessed", ")", "{", "return", ";", "}", "parent", "::", "generate", "(", ")", ";", "$", "date", "=", "$", "this", "->", "date", ";", "if", "(", "$", "dat...
Generates the subperiods - one for each day in the week
[ "Generates", "the", "subperiods", "-", "one", "for", "each", "day", "in", "the", "week" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Period/Week.php#L60-L80
train
Generate subperiods
[ 30522, 5123, 3853, 9699, 1006, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 4942, 4842, 3695, 5104, 21572, 9623, 6924, 1007, 1063, 2709, 1025, 1065, 6687, 1024, 1024, 9699, 1006, 1007, 1025, 1002, 3058, 1027, 1002, 2023, 1011, 1028, 30...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Exceptions/Handler.php
Handler.renderHttpException
protected function renderHttpException(HttpExceptionInterface $e) { $this->registerErrorViewPaths(); if (view()->exists($view = "errors::{$e->getStatusCode()}")) { return response()->view($view, [ 'errors' => new ViewErrorBag, 'exception' => $e, ], $e->getStatusCode(), $e->getHeaders()); } return $this->convertExceptionToResponse($e); }
php
protected function renderHttpException(HttpExceptionInterface $e) { $this->registerErrorViewPaths(); if (view()->exists($view = "errors::{$e->getStatusCode()}")) { return response()->view($view, [ 'errors' => new ViewErrorBag, 'exception' => $e, ], $e->getStatusCode(), $e->getHeaders()); } return $this->convertExceptionToResponse($e); }
[ "protected", "function", "renderHttpException", "(", "HttpExceptionInterface", "$", "e", ")", "{", "$", "this", "->", "registerErrorViewPaths", "(", ")", ";", "if", "(", "view", "(", ")", "->", "exists", "(", "$", "view", "=", "\"errors::{$e->getStatusCode()}\""...
Render the given HttpException. @param \Symfony\Component\HttpKernel\Exception\HttpExceptionInterface $e @return \Symfony\Component\HttpFoundation\Response
[ "Render", "the", "given", "HttpException", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Foundation/Exceptions/Handler.php#L372-L384
train
Render HTTP Exception
[ 30522, 5123, 3853, 17552, 11039, 25856, 10288, 24422, 1006, 8299, 10288, 24422, 18447, 2121, 12172, 1002, 1041, 1007, 1063, 1002, 2023, 1011, 1028, 4236, 2121, 29165, 8584, 15069, 2015, 1006, 30524, 1007, 1065, 1000, 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/Eloquent/Builder.php
Builder.addNewWheresWithinGroup
protected function addNewWheresWithinGroup(QueryBuilder $query, $originalWhereCount) { // Here, we totally remove all of the where clauses since we are going to // rebuild them as nested queries by slicing the groups of wheres into // their own sections. This is to prevent any confusing logic order. $allWheres = $query->wheres; $query->wheres = []; $this->groupWhereSliceForScope( $query, array_slice($allWheres, 0, $originalWhereCount) ); $this->groupWhereSliceForScope( $query, array_slice($allWheres, $originalWhereCount) ); }
php
protected function addNewWheresWithinGroup(QueryBuilder $query, $originalWhereCount) { // Here, we totally remove all of the where clauses since we are going to // rebuild them as nested queries by slicing the groups of wheres into // their own sections. This is to prevent any confusing logic order. $allWheres = $query->wheres; $query->wheres = []; $this->groupWhereSliceForScope( $query, array_slice($allWheres, 0, $originalWhereCount) ); $this->groupWhereSliceForScope( $query, array_slice($allWheres, $originalWhereCount) ); }
[ "protected", "function", "addNewWheresWithinGroup", "(", "QueryBuilder", "$", "query", ",", "$", "originalWhereCount", ")", "{", "// Here, we totally remove all of the where clauses since we are going to", "// rebuild them as nested queries by slicing the groups of wheres into", "// thei...
Nest where conditions by slicing them at the given where count. @param \Illuminate\Database\Query\Builder $query @param int $originalWhereCount @return void
[ "Nest", "where", "conditions", "by", "slicing", "them", "at", "the", "given", "where", "count", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Builder.php#L1018-L1034
train
Add new where clauses within the group of where clauses
[ 30522, 5123, 3853, 5587, 2638, 2860, 2860, 5886, 2229, 24415, 2075, 22107, 1006, 23032, 8569, 23891, 2099, 1002, 23032, 1010, 1002, 2434, 2860, 5886, 8586, 21723, 1007, 1063, 1013, 1013, 2182, 1010, 2057, 6135, 6366, 2035, 1997, 1996, 2073,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/FormConfigBuilder.php
FormConfigBuilder.getRequestHandler
public function getRequestHandler() { if (null === $this->requestHandler) { if (null === self::$nativeRequestHandler) { self::$nativeRequestHandler = new NativeRequestHandler(); } $this->requestHandler = self::$nativeRequestHandler; } return $this->requestHandler; }
php
public function getRequestHandler() { if (null === $this->requestHandler) { if (null === self::$nativeRequestHandler) { self::$nativeRequestHandler = new NativeRequestHandler(); } $this->requestHandler = self::$nativeRequestHandler; } return $this->requestHandler; }
[ "public", "function", "getRequestHandler", "(", ")", "{", "if", "(", "null", "===", "$", "this", "->", "requestHandler", ")", "{", "if", "(", "null", "===", "self", "::", "$", "nativeRequestHandler", ")", "{", "self", "::", "$", "nativeRequestHandler", "="...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/FormConfigBuilder.php#L423-L433
train
Get Request Handler
[ 30522, 2270, 3853, 2131, 2890, 15500, 11774, 3917, 1006, 1007, 1063, 2065, 1006, 19701, 1027, 1027, 1027, 1002, 2023, 1011, 1028, 5227, 11774, 3917, 1007, 1063, 2065, 1006, 19701, 1027, 1027, 1027, 2969, 1024, 1024, 1002, 3128, 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
libs/Zend/Cache/Backend/Sqlite.php
Zend_Cache_Backend_Sqlite._registerTag
private function _registerTag($id, $tag) { $res = $this->_query("DELETE FROM TAG WHERE name='$tag' AND id='$id'"); $res = $this->_query("INSERT INTO tag (name, id) VALUES ('$tag', '$id')"); if (!$res) { $this->_log("Zend_Cache_Backend_Sqlite::_registerTag() : impossible to register tag=$tag on id=$id"); return false; } return true; }
php
private function _registerTag($id, $tag) { $res = $this->_query("DELETE FROM TAG WHERE name='$tag' AND id='$id'"); $res = $this->_query("INSERT INTO tag (name, id) VALUES ('$tag', '$id')"); if (!$res) { $this->_log("Zend_Cache_Backend_Sqlite::_registerTag() : impossible to register tag=$tag on id=$id"); return false; } return true; }
[ "private", "function", "_registerTag", "(", "$", "id", ",", "$", "tag", ")", "{", "$", "res", "=", "$", "this", "->", "_query", "(", "\"DELETE FROM TAG WHERE name='$tag' AND id='$id'\"", ")", ";", "$", "res", "=", "$", "this", "->", "_query", "(", "\"INSER...
Register a cache id with the given tag @param string $id Cache id @param string $tag Tag @return boolean True if no problem
[ "Register", "a", "cache", "id", "with", "the", "given", "tag" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Cache/Backend/Sqlite.php#L544-L552
train
Register a tag
[ 30522, 2797, 3853, 1035, 4236, 15900, 1006, 1002, 8909, 1010, 1002, 6415, 1007, 1063, 1002, 24501, 1027, 1002, 2023, 1011, 1028, 1035, 23032, 1006, 1000, 3972, 12870, 2013, 6415, 2073, 2171, 30524, 1005, 1002, 8909, 1005, 1007, 1000, 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/Notifications/Channels/BroadcastChannel.php
BroadcastChannel.send
public function send($notifiable, Notification $notification) { $message = $this->getData($notifiable, $notification); $event = new BroadcastNotificationCreated( $notifiable, $notification, is_array($message) ? $message : $message->data ); if ($message instanceof BroadcastMessage) { $event->onConnection($message->connection) ->onQueue($message->queue); } return $this->events->dispatch($event); }
php
public function send($notifiable, Notification $notification) { $message = $this->getData($notifiable, $notification); $event = new BroadcastNotificationCreated( $notifiable, $notification, is_array($message) ? $message : $message->data ); if ($message instanceof BroadcastMessage) { $event->onConnection($message->connection) ->onQueue($message->queue); } return $this->events->dispatch($event); }
[ "public", "function", "send", "(", "$", "notifiable", ",", "Notification", "$", "notification", ")", "{", "$", "message", "=", "$", "this", "->", "getData", "(", "$", "notifiable", ",", "$", "notification", ")", ";", "$", "event", "=", "new", "BroadcastN...
Send the given notification. @param mixed $notifiable @param \Illuminate\Notifications\Notification $notification @return array|null
[ "Send", "the", "given", "notification", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Notifications/Channels/BroadcastChannel.php#L38-L52
train
Send a BroadcastNotification
[ 30522, 2270, 3853, 4604, 1006, 1002, 2025, 10128, 19210, 1010, 26828, 1002, 26828, 1007, 1063, 1002, 4471, 1027, 1002, 2023, 1011, 1028, 2131, 2850, 2696, 1006, 1002, 2025, 10128, 19210, 1010, 1002, 26828, 1007, 1025, 1002, 2724, 1027, 2047...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/Helpers/Excerpts.php
Excerpts.getHtmlFromExcerpt
public static function getHtmlFromExcerpt($excerpt) { $element = $excerpt['element']; $html = '<'.$element['name']; if (isset($element['attributes'])) { foreach ($element['attributes'] as $name => $value) { if ($value === null) { continue; } $html .= ' '.$name.'="'.$value.'"'; } } if (isset($element['text'])) { $html .= '>'; $html .= $element['text']; $html .= '</'.$element['name'].'>'; } else { $html .= ' />'; } return $html; }
php
public static function getHtmlFromExcerpt($excerpt) { $element = $excerpt['element']; $html = '<'.$element['name']; if (isset($element['attributes'])) { foreach ($element['attributes'] as $name => $value) { if ($value === null) { continue; } $html .= ' '.$name.'="'.$value.'"'; } } if (isset($element['text'])) { $html .= '>'; $html .= $element['text']; $html .= '</'.$element['name'].'>'; } else { $html .= ' />'; } return $html; }
[ "public", "static", "function", "getHtmlFromExcerpt", "(", "$", "excerpt", ")", "{", "$", "element", "=", "$", "excerpt", "[", "'element'", "]", ";", "$", "html", "=", "'<'", ".", "$", "element", "[", "'name'", "]", ";", "if", "(", "isset", "(", "$",...
Rebuild HTML tag from an excerpt array @param array $excerpt @return string
[ "Rebuild", "HTML", "tag", "from", "an", "excerpt", "array" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Helpers/Excerpts.php#L86-L109
train
Returns the HTML code of an excerpt
[ 30522, 2270, 10763, 3853, 2131, 11039, 19968, 19699, 8462, 2595, 17119, 13876, 1006, 1002, 28142, 1007, 1063, 1002, 5783, 1027, 1002, 28142, 1031, 1005, 5783, 1005, 1033, 1025, 1002, 16129, 1027, 1005, 1026, 1005, 1012, 1002, 5783, 1031, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Eloquent/Collection.php
Collection.merge
public function merge($items) { $dictionary = $this->getDictionary(); foreach ($items as $item) { $dictionary[$item->getKey()] = $item; } return new static(array_values($dictionary)); }
php
public function merge($items) { $dictionary = $this->getDictionary(); foreach ($items as $item) { $dictionary[$item->getKey()] = $item; } return new static(array_values($dictionary)); }
[ "public", "function", "merge", "(", "$", "items", ")", "{", "$", "dictionary", "=", "$", "this", "->", "getDictionary", "(", ")", ";", "foreach", "(", "$", "items", "as", "$", "item", ")", "{", "$", "dictionary", "[", "$", "item", "->", "getKey", "...
Merge the collection with the given items. @param \ArrayAccess|array $items @return static
[ "Merge", "the", "collection", "with", "the", "given", "items", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Collection.php#L235-L244
train
Merge the items of the current instance with the items of the passed array.
[ 30522, 2270, 3853, 13590, 1006, 1002, 5167, 1007, 1063, 1002, 9206, 1027, 1002, 2023, 1011, 1028, 2131, 29201, 3258, 5649, 1006, 1007, 1025, 18921, 6776, 1006, 1002, 5167, 2004, 1002, 8875, 1007, 1063, 1002, 9206, 1031, 1002, 8875, 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...
getgrav/grav
system/src/Grav/Common/Twig/Node/TwigNodeStyle.php
TwigNodeStyle.compile
public function compile(Compiler $compiler) { $compiler->addDebugInfo($this); $compiler->write("\$assets = \\Grav\\Common\\Grav::instance()['assets'];\n"); if ($this->getNode('attributes') !== null) { $compiler ->write('$attributes = ') ->subcompile($this->getNode('attributes')) ->raw(";\n") ->write("if (!is_array(\$attributes)) {\n") ->indent() ->write("throw new UnexpectedValueException('{% {$this->tagName} with x %}: x is not an array');\n") ->outdent() ->write("}\n"); } else { $compiler->write('$attributes = [];' . "\n"); } if ($this->getNode('group') !== null) { $compiler ->write("\$attributes['group'] = ") ->subcompile($this->getNode('group')) ->raw(";\n") ->write("if (!is_string(\$attributes['group'])) {\n") ->indent() ->write("throw new UnexpectedValueException('{% {$this->tagName} in x %}: x is not a string');\n") ->outdent() ->write("}\n"); } if ($this->getNode('priority') !== null) { $compiler ->write("\$attributes['priority'] = (int)(") ->subcompile($this->getNode('priority')) ->raw(");\n"); } if ($this->getNode('file') !== null) { $compiler ->write('$assets->addCss(') ->subcompile($this->getNode('file')) ->raw(", \$attributes);\n"); } else { $compiler ->write("ob_start();\n") ->subcompile($this->getNode('body')) ->write('$content = ob_get_clean();' . "\n") ->write("\$assets->addInlineCss(\$content, \$attributes);\n"); } }
php
public function compile(Compiler $compiler) { $compiler->addDebugInfo($this); $compiler->write("\$assets = \\Grav\\Common\\Grav::instance()['assets'];\n"); if ($this->getNode('attributes') !== null) { $compiler ->write('$attributes = ') ->subcompile($this->getNode('attributes')) ->raw(";\n") ->write("if (!is_array(\$attributes)) {\n") ->indent() ->write("throw new UnexpectedValueException('{% {$this->tagName} with x %}: x is not an array');\n") ->outdent() ->write("}\n"); } else { $compiler->write('$attributes = [];' . "\n"); } if ($this->getNode('group') !== null) { $compiler ->write("\$attributes['group'] = ") ->subcompile($this->getNode('group')) ->raw(";\n") ->write("if (!is_string(\$attributes['group'])) {\n") ->indent() ->write("throw new UnexpectedValueException('{% {$this->tagName} in x %}: x is not a string');\n") ->outdent() ->write("}\n"); } if ($this->getNode('priority') !== null) { $compiler ->write("\$attributes['priority'] = (int)(") ->subcompile($this->getNode('priority')) ->raw(");\n"); } if ($this->getNode('file') !== null) { $compiler ->write('$assets->addCss(') ->subcompile($this->getNode('file')) ->raw(", \$attributes);\n"); } else { $compiler ->write("ob_start();\n") ->subcompile($this->getNode('body')) ->write('$content = ob_get_clean();' . "\n") ->write("\$assets->addInlineCss(\$content, \$attributes);\n"); } }
[ "public", "function", "compile", "(", "Compiler", "$", "compiler", ")", "{", "$", "compiler", "->", "addDebugInfo", "(", "$", "this", ")", ";", "$", "compiler", "->", "write", "(", "\"\\$assets = \\\\Grav\\\\Common\\\\Grav::instance()['assets'];\\n\"", ")", ";", "...
Compiles the node to PHP. @param Compiler $compiler A Twig_Compiler instance @throws \LogicException
[ "Compiles", "the", "node", "to", "PHP", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Twig/Node/TwigNodeStyle.php#L49-L100
train
Compiles the node into CSS code
[ 30522, 2270, 3853, 4012, 22090, 1006, 21624, 1002, 21624, 1007, 1063, 1002, 21624, 1011, 1028, 5587, 3207, 8569, 11528, 14876, 1006, 1002, 2023, 1007, 1025, 1002, 21624, 1011, 1028, 4339, 1006, 1000, 1032, 1002, 7045, 1027, 1032, 1032, 2466...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/ChoiceList/ArrayChoiceList.php
ArrayChoiceList.castableToString
private function castableToString(array $choices, array &$cache = []) { foreach ($choices as $choice) { if (\is_array($choice)) { if (!$this->castableToString($choice, $cache)) { return false; } continue; } elseif (!is_scalar($choice)) { return false; } // prevent having false casted to the empty string by isset() $choice = false === $choice ? '0' : (string) $choice; if (isset($cache[$choice])) { return false; } $cache[$choice] = true; } return true; }
php
private function castableToString(array $choices, array &$cache = []) { foreach ($choices as $choice) { if (\is_array($choice)) { if (!$this->castableToString($choice, $cache)) { return false; } continue; } elseif (!is_scalar($choice)) { return false; } // prevent having false casted to the empty string by isset() $choice = false === $choice ? '0' : (string) $choice; if (isset($cache[$choice])) { return false; } $cache[$choice] = true; } return true; }
[ "private", "function", "castableToString", "(", "array", "$", "choices", ",", "array", "&", "$", "cache", "=", "[", "]", ")", "{", "foreach", "(", "$", "choices", "as", "$", "choice", ")", "{", "if", "(", "\\", "is_array", "(", "$", "choice", ")", ...
Checks whether the given choices can be cast to strings without generating duplicates. This method is responsible for preventing conflict between scalar values and the empty value. @param array $choices The choices @param array|null $cache The cache for previously checked entries. Internal @return bool returns true if the choices can be cast to strings and false otherwise
[ "Checks", "whether", "the", "given", "choices", "can", "be", "cast", "to", "strings", "without", "generating", "duplicates", ".", "This", "method", "is", "responsible", "for", "preventing", "conflict", "between", "scalar", "values", "and", "the", "empty", "value...
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/ChoiceList/ArrayChoiceList.php#L219-L243
train
Casts the choices to string
[ 30522, 2797, 3853, 3459, 3085, 13122, 18886, 3070, 1006, 9140, 1002, 9804, 1010, 9140, 1004, 1002, 17053, 1027, 1031, 1033, 1007, 1063, 18921, 6776, 1006, 1002, 9804, 2004, 1002, 3601, 1007, 1063, 2065, 1006, 1032, 2003, 1035, 9140, 1006, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Routing/ResourceRegistrar.php
ResourceRegistrar.getResourceWildcard
public function getResourceWildcard($value) { if (isset($this->parameters[$value])) { $value = $this->parameters[$value]; } elseif (isset(static::$parameterMap[$value])) { $value = static::$parameterMap[$value]; } elseif ($this->parameters === 'singular' || static::$singularParameters) { $value = Str::singular($value); } return str_replace('-', '_', $value); }
php
public function getResourceWildcard($value) { if (isset($this->parameters[$value])) { $value = $this->parameters[$value]; } elseif (isset(static::$parameterMap[$value])) { $value = static::$parameterMap[$value]; } elseif ($this->parameters === 'singular' || static::$singularParameters) { $value = Str::singular($value); } return str_replace('-', '_', $value); }
[ "public", "function", "getResourceWildcard", "(", "$", "value", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "parameters", "[", "$", "value", "]", ")", ")", "{", "$", "value", "=", "$", "this", "->", "parameters", "[", "$", "value", "]", "...
Format a resource parameter for usage. @param string $value @return string
[ "Format", "a", "resource", "parameter", "for", "usage", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Routing/ResourceRegistrar.php#L338-L349
train
Returns the resource wildcard value.
[ 30522, 2270, 3853, 2131, 6072, 8162, 3401, 29602, 16409, 4232, 1006, 1002, 3643, 1007, 1063, 2065, 1006, 26354, 3388, 1006, 1002, 2023, 1011, 1028, 11709, 1031, 1002, 3643, 1033, 1007, 1007, 1063, 1002, 3643, 1027, 1002, 2023, 1011, 1028, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/Db/Adapter/Mysqli.php
Mysqli.isErrNo
public function isErrNo($e, $errno) { if (is_null($this->_connection)) { if (preg_match('/(?:\[|\s)([0-9]{4})(?:\]|\s)/', $e->getMessage(), $match)) { return $match[1] == $errno; } return mysqli_connect_errno() == $errno; } return mysqli_errno($this->_connection) == $errno; }
php
public function isErrNo($e, $errno) { if (is_null($this->_connection)) { if (preg_match('/(?:\[|\s)([0-9]{4})(?:\]|\s)/', $e->getMessage(), $match)) { return $match[1] == $errno; } return mysqli_connect_errno() == $errno; } return mysqli_errno($this->_connection) == $errno; }
[ "public", "function", "isErrNo", "(", "$", "e", ",", "$", "errno", ")", "{", "if", "(", "is_null", "(", "$", "this", "->", "_connection", ")", ")", "{", "if", "(", "preg_match", "(", "'/(?:\\[|\\s)([0-9]{4})(?:\\]|\\s)/'", ",", "$", "e", "->", "getMessag...
Test error number @param Exception $e @param string $errno @return bool
[ "Test", "error", "number" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Db/Adapter/Mysqli.php#L186-L196
train
Is error no?
[ 30522, 2270, 3853, 2003, 2121, 19139, 1006, 1002, 1041, 1010, 1002, 9413, 19139, 1007, 1063, 2065, 1006, 2003, 1035, 19701, 1006, 1002, 2023, 1011, 1028, 1035, 4434, 1007, 1007, 1063, 2065, 1006, 3653, 2290, 1035, 2674, 1006, 1005, 1013, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
walkor/Workerman
Protocols/Websocket.php
Websocket.dealHandshake
protected static function dealHandshake($buffer, $connection) { // HTTP protocol. if (0 === strpos($buffer, 'GET')) { // Find \r\n\r\n. $heder_end_pos = strpos($buffer, "\r\n\r\n"); if (!$heder_end_pos) { return 0; } $header_length = $heder_end_pos + 4; // Get Sec-WebSocket-Key. $Sec_WebSocket_Key = ''; if (preg_match("/Sec-WebSocket-Key: *(.*?)\r\n/i", $buffer, $match)) { $Sec_WebSocket_Key = $match[1]; } else { $connection->send("HTTP/1.1 400 Bad Request\r\n\r\n<b>400 Bad Request</b><br>Sec-WebSocket-Key not found.<br>This is a WebSocket service and can not be accessed via HTTP.<br>See <a href=\"http://wiki.workerman.net/Error1\">http://wiki.workerman.net/Error1</a> for detail.", true); $connection->close(); return 0; } // Calculation websocket key. $new_key = base64_encode(sha1($Sec_WebSocket_Key . "258EAFA5-E914-47DA-95CA-C5AB0DC85B11", true)); // Handshake response data. $handshake_message = "HTTP/1.1 101 Switching Protocols\r\n"; $handshake_message .= "Upgrade: websocket\r\n"; $handshake_message .= "Sec-WebSocket-Version: 13\r\n"; $handshake_message .= "Connection: Upgrade\r\n"; $handshake_message .= "Sec-WebSocket-Accept: " . $new_key . "\r\n"; // Websocket data buffer. $connection->websocketDataBuffer = ''; // Current websocket frame length. $connection->websocketCurrentFrameLength = 0; // Current websocket frame data. $connection->websocketCurrentFrameBuffer = ''; // Consume handshake data. $connection->consumeRecvBuffer($header_length); // blob or arraybuffer if (empty($connection->websocketType)) { $connection->websocketType = static::BINARY_TYPE_BLOB; } $has_server_header = false; // Try to emit onWebSocketConnect callback. if (isset($connection->onWebSocketConnect) || isset($connection->worker->onWebSocketConnect)) { static::parseHttpHeader($buffer); try { call_user_func(isset($connection->onWebSocketConnect)?$connection->onWebSocketConnect:$connection->worker->onWebSocketConnect, $connection, $buffer); } catch (\Exception $e) { Worker::log($e); exit(250); } catch (\Error $e) { Worker::log($e); exit(250); } if (!empty($_SESSION) && class_exists('\GatewayWorker\Lib\Context')) { $connection->session = \GatewayWorker\Lib\Context::sessionEncode($_SESSION); } $_GET = $_SERVER = $_SESSION = $_COOKIE = array(); if (isset($connection->headers)) { if (is_array($connection->headers)) { foreach ($connection->headers as $header) { if (strpos($header, 'Server:') === 0) { $has_server_header = true; } $handshake_message .= "$header\r\n"; } } else { $handshake_message .= "$connection->headers\r\n"; } } } if (!$has_server_header) { $handshake_message .= "Server: workerman/".Worker::VERSION."\r\n"; } $handshake_message .= "\r\n"; // Send handshake response. $connection->send($handshake_message, true); // Mark handshake complete.. $connection->websocketHandshake = true; // There are data waiting to be sent. if (!empty($connection->tmpWebsocketData)) { $connection->send($connection->tmpWebsocketData, true); $connection->tmpWebsocketData = ''; } if (strlen($buffer) > $header_length) { return static::input(substr($buffer, $header_length), $connection); } return 0; } // Is flash policy-file-request. elseif (0 === strpos($buffer, '<polic')) { $policy_xml = '<?xml version="1.0"?><cross-domain-policy><site-control permitted-cross-domain-policies="all"/><allow-access-from domain="*" to-ports="*"/></cross-domain-policy>' . "\0"; $connection->send($policy_xml, true); $connection->consumeRecvBuffer(strlen($buffer)); return 0; } // Bad websocket handshake request. $connection->send("HTTP/1.1 400 Bad Request\r\n\r\n<b>400 Bad Request</b><br>Invalid handshake data for websocket. <br> See <a href=\"http://wiki.workerman.net/Error1\">http://wiki.workerman.net/Error1</a> for detail.", true); $connection->close(); return 0; }
php
protected static function dealHandshake($buffer, $connection) { // HTTP protocol. if (0 === strpos($buffer, 'GET')) { // Find \r\n\r\n. $heder_end_pos = strpos($buffer, "\r\n\r\n"); if (!$heder_end_pos) { return 0; } $header_length = $heder_end_pos + 4; // Get Sec-WebSocket-Key. $Sec_WebSocket_Key = ''; if (preg_match("/Sec-WebSocket-Key: *(.*?)\r\n/i", $buffer, $match)) { $Sec_WebSocket_Key = $match[1]; } else { $connection->send("HTTP/1.1 400 Bad Request\r\n\r\n<b>400 Bad Request</b><br>Sec-WebSocket-Key not found.<br>This is a WebSocket service and can not be accessed via HTTP.<br>See <a href=\"http://wiki.workerman.net/Error1\">http://wiki.workerman.net/Error1</a> for detail.", true); $connection->close(); return 0; } // Calculation websocket key. $new_key = base64_encode(sha1($Sec_WebSocket_Key . "258EAFA5-E914-47DA-95CA-C5AB0DC85B11", true)); // Handshake response data. $handshake_message = "HTTP/1.1 101 Switching Protocols\r\n"; $handshake_message .= "Upgrade: websocket\r\n"; $handshake_message .= "Sec-WebSocket-Version: 13\r\n"; $handshake_message .= "Connection: Upgrade\r\n"; $handshake_message .= "Sec-WebSocket-Accept: " . $new_key . "\r\n"; // Websocket data buffer. $connection->websocketDataBuffer = ''; // Current websocket frame length. $connection->websocketCurrentFrameLength = 0; // Current websocket frame data. $connection->websocketCurrentFrameBuffer = ''; // Consume handshake data. $connection->consumeRecvBuffer($header_length); // blob or arraybuffer if (empty($connection->websocketType)) { $connection->websocketType = static::BINARY_TYPE_BLOB; } $has_server_header = false; // Try to emit onWebSocketConnect callback. if (isset($connection->onWebSocketConnect) || isset($connection->worker->onWebSocketConnect)) { static::parseHttpHeader($buffer); try { call_user_func(isset($connection->onWebSocketConnect)?$connection->onWebSocketConnect:$connection->worker->onWebSocketConnect, $connection, $buffer); } catch (\Exception $e) { Worker::log($e); exit(250); } catch (\Error $e) { Worker::log($e); exit(250); } if (!empty($_SESSION) && class_exists('\GatewayWorker\Lib\Context')) { $connection->session = \GatewayWorker\Lib\Context::sessionEncode($_SESSION); } $_GET = $_SERVER = $_SESSION = $_COOKIE = array(); if (isset($connection->headers)) { if (is_array($connection->headers)) { foreach ($connection->headers as $header) { if (strpos($header, 'Server:') === 0) { $has_server_header = true; } $handshake_message .= "$header\r\n"; } } else { $handshake_message .= "$connection->headers\r\n"; } } } if (!$has_server_header) { $handshake_message .= "Server: workerman/".Worker::VERSION."\r\n"; } $handshake_message .= "\r\n"; // Send handshake response. $connection->send($handshake_message, true); // Mark handshake complete.. $connection->websocketHandshake = true; // There are data waiting to be sent. if (!empty($connection->tmpWebsocketData)) { $connection->send($connection->tmpWebsocketData, true); $connection->tmpWebsocketData = ''; } if (strlen($buffer) > $header_length) { return static::input(substr($buffer, $header_length), $connection); } return 0; } // Is flash policy-file-request. elseif (0 === strpos($buffer, '<polic')) { $policy_xml = '<?xml version="1.0"?><cross-domain-policy><site-control permitted-cross-domain-policies="all"/><allow-access-from domain="*" to-ports="*"/></cross-domain-policy>' . "\0"; $connection->send($policy_xml, true); $connection->consumeRecvBuffer(strlen($buffer)); return 0; } // Bad websocket handshake request. $connection->send("HTTP/1.1 400 Bad Request\r\n\r\n<b>400 Bad Request</b><br>Invalid handshake data for websocket. <br> See <a href=\"http://wiki.workerman.net/Error1\">http://wiki.workerman.net/Error1</a> for detail.", true); $connection->close(); return 0; }
[ "protected", "static", "function", "dealHandshake", "(", "$", "buffer", ",", "$", "connection", ")", "{", "// HTTP protocol.", "if", "(", "0", "===", "strpos", "(", "$", "buffer", ",", "'GET'", ")", ")", "{", "// Find \\r\\n\\r\\n.", "$", "heder_end_pos", "=...
Websocket handshake. @param string $buffer @param \Workerman\Connection\TcpConnection $connection @return int
[ "Websocket", "handshake", "." ]
13649907f05014fcfffcfccaef01e63ad3339351
https://github.com/walkor/Workerman/blob/13649907f05014fcfffcfccaef01e63ad3339351/Protocols/Websocket.php#L343-L448
train
Decides the handshake response
[ 30522, 5123, 10763, 3853, 3066, 11774, 7377, 3489, 1006, 1002, 17698, 1010, 1002, 4434, 1007, 1063, 1013, 1013, 8299, 8778, 1012, 2065, 1006, 1014, 1027, 1027, 1027, 2358, 14536, 2891, 1006, 1002, 17698, 1010, 1005, 2131, 1005, 1007, 1007, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Validator/Violation/ConstraintViolationBuilder.php
ConstraintViolationBuilder.addViolation
public function addViolation() { if (null === $this->plural) { $translatedMessage = $this->translator->trans( $this->message, $this->parameters, $this->translationDomain ); } elseif ($this->translator instanceof TranslatorInterface) { $translatedMessage = $this->translator->trans( $this->message, ['%count%' => $this->plural] + $this->parameters, $this->translationDomain ); } else { try { $translatedMessage = $this->translator->transChoice( $this->message, $this->plural, $this->parameters, $this->translationDomain ); } catch (\InvalidArgumentException $e) { $translatedMessage = $this->translator->trans( $this->message, $this->parameters, $this->translationDomain ); } } $this->violations->add(new ConstraintViolation( $translatedMessage, $this->message, $this->parameters, $this->root, $this->propertyPath, $this->invalidValue, $this->plural, $this->code, $this->constraint, $this->cause )); }
php
public function addViolation() { if (null === $this->plural) { $translatedMessage = $this->translator->trans( $this->message, $this->parameters, $this->translationDomain ); } elseif ($this->translator instanceof TranslatorInterface) { $translatedMessage = $this->translator->trans( $this->message, ['%count%' => $this->plural] + $this->parameters, $this->translationDomain ); } else { try { $translatedMessage = $this->translator->transChoice( $this->message, $this->plural, $this->parameters, $this->translationDomain ); } catch (\InvalidArgumentException $e) { $translatedMessage = $this->translator->trans( $this->message, $this->parameters, $this->translationDomain ); } } $this->violations->add(new ConstraintViolation( $translatedMessage, $this->message, $this->parameters, $this->root, $this->propertyPath, $this->invalidValue, $this->plural, $this->code, $this->constraint, $this->cause )); }
[ "public", "function", "addViolation", "(", ")", "{", "if", "(", "null", "===", "$", "this", "->", "plural", ")", "{", "$", "translatedMessage", "=", "$", "this", "->", "translator", "->", "trans", "(", "$", "this", "->", "message", ",", "$", "this", ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Validator/Violation/ConstraintViolationBuilder.php#L149-L192
train
Adds a constraint violation to the violations collection.
[ 30522, 2270, 3853, 5587, 25500, 13490, 1006, 1007, 1063, 2065, 1006, 19701, 1027, 1027, 1027, 1002, 2023, 1011, 1028, 13994, 1007, 1063, 1002, 5421, 7834, 3736, 3351, 1027, 1002, 2023, 1011, 1028, 11403, 1011, 1028, 9099, 1006, 1002, 2023, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/UsersManager/Controller.php
Controller.recordAnonymousUserSettings
public function recordAnonymousUserSettings() { $response = new ResponseBuilder(Common::getRequestVar('format')); try { Piwik::checkUserHasSuperUserAccess(); $this->checkTokenInUrl(); $anonymousDefaultReport = Common::getRequestVar('anonymousDefaultReport'); $anonymousDefaultDate = Common::getRequestVar('anonymousDefaultDate'); $userLogin = 'anonymous'; APIUsersManager::getInstance()->setUserPreference($userLogin, APIUsersManager::PREFERENCE_DEFAULT_REPORT, $anonymousDefaultReport); APIUsersManager::getInstance()->setUserPreference($userLogin, APIUsersManager::PREFERENCE_DEFAULT_REPORT_DATE, $anonymousDefaultDate); $toReturn = $response->getResponse(); } catch (Exception $e) { $toReturn = $response->getResponseException($e); } return $toReturn; }
php
public function recordAnonymousUserSettings() { $response = new ResponseBuilder(Common::getRequestVar('format')); try { Piwik::checkUserHasSuperUserAccess(); $this->checkTokenInUrl(); $anonymousDefaultReport = Common::getRequestVar('anonymousDefaultReport'); $anonymousDefaultDate = Common::getRequestVar('anonymousDefaultDate'); $userLogin = 'anonymous'; APIUsersManager::getInstance()->setUserPreference($userLogin, APIUsersManager::PREFERENCE_DEFAULT_REPORT, $anonymousDefaultReport); APIUsersManager::getInstance()->setUserPreference($userLogin, APIUsersManager::PREFERENCE_DEFAULT_REPORT_DATE, $anonymousDefaultDate); $toReturn = $response->getResponse(); } catch (Exception $e) { $toReturn = $response->getResponseException($e); } return $toReturn; }
[ "public", "function", "recordAnonymousUserSettings", "(", ")", "{", "$", "response", "=", "new", "ResponseBuilder", "(", "Common", "::", "getRequestVar", "(", "'format'", ")", ")", ";", "try", "{", "Piwik", "::", "checkUserHasSuperUserAccess", "(", ")", ";", "...
Records settings for the anonymous users (default report, default date)
[ "Records", "settings", "for", "the", "anonymous", "users", "(", "default", "report", "default", "date", ")" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/UsersManager/Controller.php#L339-L361
train
This method is used to record the user s settings in the API users preferences
[ 30522, 2270, 3853, 2501, 6761, 4890, 27711, 20330, 21678, 8613, 1006, 1007, 1063, 1002, 3433, 1027, 2047, 3433, 8569, 23891, 2099, 1006, 2691, 1024, 1024, 2131, 2890, 15500, 10755, 1006, 1005, 4289, 1005, 1007, 1007, 1025, 3046, 1063, 14255...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Foundation/Console/ViewCacheCommand.php
ViewCacheCommand.handle
public function handle() { $this->call('view:clear'); $this->paths()->each(function ($path) { $this->compileViews($this->bladeFilesIn([$path])); }); $this->info('Blade templates cached successfully!'); }
php
public function handle() { $this->call('view:clear'); $this->paths()->each(function ($path) { $this->compileViews($this->bladeFilesIn([$path])); }); $this->info('Blade templates cached successfully!'); }
[ "public", "function", "handle", "(", ")", "{", "$", "this", "->", "call", "(", "'view:clear'", ")", ";", "$", "this", "->", "paths", "(", ")", "->", "each", "(", "function", "(", "$", "path", ")", "{", "$", "this", "->", "compileViews", "(", "$", ...
Execute the console command. @return mixed
[ "Execute", "the", "console", "command", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Foundation/Console/ViewCacheCommand.php#L31-L40
train
Handle all cached Blade templates
[ 30522, 2270, 3853, 5047, 1006, 1007, 1063, 1002, 2023, 1011, 1028, 2655, 1006, 1005, 3193, 1024, 3154, 1005, 1007, 1025, 1002, 2023, 1011, 1028, 10425, 1006, 1007, 1011, 1028, 2169, 1006, 3853, 1006, 1002, 4130, 1007, 1063, 1002, 2023, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Eloquent/Relations/Concerns/AsPivot.php
AsPivot.delete
public function delete() { if (isset($this->attributes[$this->getKeyName()])) { return (int) parent::delete(); } if ($this->fireModelEvent('deleting') === false) { return 0; } $this->touchOwners(); return tap($this->getDeleteQuery()->delete(), function () { $this->fireModelEvent('deleted', false); }); }
php
public function delete() { if (isset($this->attributes[$this->getKeyName()])) { return (int) parent::delete(); } if ($this->fireModelEvent('deleting') === false) { return 0; } $this->touchOwners(); return tap($this->getDeleteQuery()->delete(), function () { $this->fireModelEvent('deleted', false); }); }
[ "public", "function", "delete", "(", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "attributes", "[", "$", "this", "->", "getKeyName", "(", ")", "]", ")", ")", "{", "return", "(", "int", ")", "parent", "::", "delete", "(", ")", ";", "}", ...
Delete the pivot model record from the database. @return int
[ "Delete", "the", "pivot", "model", "record", "from", "the", "database", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Relations/Concerns/AsPivot.php#L111-L126
train
Delete the record.
[ 30522, 2270, 3853, 3972, 12870, 1006, 1007, 1063, 2065, 1006, 26354, 3388, 1006, 1002, 2023, 1011, 1028, 12332, 1031, 1002, 2023, 1011, 1028, 2131, 14839, 18442, 1006, 1007, 1033, 1007, 1007, 1063, 2709, 1006, 20014, 1007, 6687, 1024, 1024,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Validate/Regex.php
Zend_Validate_Regex.isValid
public function isValid($value) { if (!is_string($value) && !is_int($value) && !is_float($value)) { $this->_error(self::INVALID); return false; } $this->_setValue($value); $status = @preg_match($this->_pattern, $value); if (false === $status) { $this->_error(self::ERROROUS); return false; } if (!$status) { $this->_error(self::NOT_MATCH); return false; } return true; }
php
public function isValid($value) { if (!is_string($value) && !is_int($value) && !is_float($value)) { $this->_error(self::INVALID); return false; } $this->_setValue($value); $status = @preg_match($this->_pattern, $value); if (false === $status) { $this->_error(self::ERROROUS); return false; } if (!$status) { $this->_error(self::NOT_MATCH); return false; } return true; }
[ "public", "function", "isValid", "(", "$", "value", ")", "{", "if", "(", "!", "is_string", "(", "$", "value", ")", "&&", "!", "is_int", "(", "$", "value", ")", "&&", "!", "is_float", "(", "$", "value", ")", ")", "{", "$", "this", "->", "_error", ...
Defined by Zend_Validate_Interface Returns true if and only if $value matches against the pattern option @param string $value @return boolean
[ "Defined", "by", "Zend_Validate_Interface" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Validate/Regex.php#L125-L146
train
Valida o valor de uma string
[ 30522, 2270, 3853, 2003, 10175, 3593, 1006, 1002, 3643, 1007, 1063, 2065, 1006, 999, 2003, 1035, 5164, 1006, 1002, 3643, 1007, 1004, 1004, 999, 2003, 1035, 20014, 1006, 1002, 3643, 1007, 1004, 1004, 999, 2003, 1035, 14257, 1006, 1002, 364...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Loader/AnnotationDirectoryLoader.php
AnnotationDirectoryLoader.load
public function load($path, $type = null) { if (!is_dir($dir = $this->locator->locate($path))) { return parent::supports($path, $type) ? parent::load($path, $type) : new RouteCollection(); } $collection = new RouteCollection(); $collection->addResource(new DirectoryResource($dir, '/\.php$/')); $files = iterator_to_array(new \RecursiveIteratorIterator( new \RecursiveCallbackFilterIterator( new \RecursiveDirectoryIterator($dir, \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS), function (\SplFileInfo $current) { return '.' !== substr($current->getBasename(), 0, 1); } ), \RecursiveIteratorIterator::LEAVES_ONLY )); usort($files, function (\SplFileInfo $a, \SplFileInfo $b) { return (string) $a > (string) $b ? 1 : -1; }); foreach ($files as $file) { if (!$file->isFile() || '.php' !== substr($file->getFilename(), -4)) { continue; } if ($class = $this->findClass($file)) { $refl = new \ReflectionClass($class); if ($refl->isAbstract()) { continue; } $collection->addCollection($this->loader->load($class, $type)); } } return $collection; }
php
public function load($path, $type = null) { if (!is_dir($dir = $this->locator->locate($path))) { return parent::supports($path, $type) ? parent::load($path, $type) : new RouteCollection(); } $collection = new RouteCollection(); $collection->addResource(new DirectoryResource($dir, '/\.php$/')); $files = iterator_to_array(new \RecursiveIteratorIterator( new \RecursiveCallbackFilterIterator( new \RecursiveDirectoryIterator($dir, \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS), function (\SplFileInfo $current) { return '.' !== substr($current->getBasename(), 0, 1); } ), \RecursiveIteratorIterator::LEAVES_ONLY )); usort($files, function (\SplFileInfo $a, \SplFileInfo $b) { return (string) $a > (string) $b ? 1 : -1; }); foreach ($files as $file) { if (!$file->isFile() || '.php' !== substr($file->getFilename(), -4)) { continue; } if ($class = $this->findClass($file)) { $refl = new \ReflectionClass($class); if ($refl->isAbstract()) { continue; } $collection->addCollection($this->loader->load($class, $type)); } } return $collection; }
[ "public", "function", "load", "(", "$", "path", ",", "$", "type", "=", "null", ")", "{", "if", "(", "!", "is_dir", "(", "$", "dir", "=", "$", "this", "->", "locator", "->", "locate", "(", "$", "path", ")", ")", ")", "{", "return", "parent", "::...
Loads from annotations from a directory. @param string $path A directory path @param string|null $type The resource type @return RouteCollection A RouteCollection instance @throws \InvalidArgumentException When the directory does not exist or its routes cannot be parsed
[ "Loads", "from", "annotations", "from", "a", "directory", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Routing/Loader/AnnotationDirectoryLoader.php#L35-L72
train
Load all routes from the given path
[ 30522, 2270, 3853, 7170, 1006, 1002, 4130, 1010, 1002, 2828, 1027, 19701, 1007, 1063, 2065, 1006, 999, 2003, 1035, 16101, 1006, 1002, 16101, 1027, 1002, 2023, 1011, 1028, 8840, 11266, 2953, 1011, 1028, 12453, 1006, 1002, 4130, 1007, 1007, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Console/Helper/Table.php
Table.setColumnWidth
public function setColumnWidth($columnIndex, $width) { $this->columnWidths[(int) $columnIndex] = (int) $width; return $this; }
php
public function setColumnWidth($columnIndex, $width) { $this->columnWidths[(int) $columnIndex] = (int) $width; return $this; }
[ "public", "function", "setColumnWidth", "(", "$", "columnIndex", ",", "$", "width", ")", "{", "$", "this", "->", "columnWidths", "[", "(", "int", ")", "$", "columnIndex", "]", "=", "(", "int", ")", "$", "width", ";", "return", "$", "this", ";", "}" ]
Sets the minimum width of a column. @param int $columnIndex Column index @param int $width Minimum column width in characters @return $this
[ "Sets", "the", "minimum", "width", "of", "a", "column", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Console/Helper/Table.php#L200-L205
train
Set the width of a column
[ 30522, 2270, 3853, 2275, 25778, 2819, 2078, 9148, 11927, 2232, 1006, 1002, 5930, 22254, 10288, 1010, 1002, 9381, 1007, 1063, 1002, 2023, 1011, 1028, 5930, 9148, 11927, 7898, 1031, 1006, 20014, 1007, 1002, 5930, 22254, 10288, 1033, 1027, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Cache/CacheItem.php
CacheItem.expiresAfter
public function expiresAfter($time) { if (null === $time) { $this->expiry = $this->defaultLifetime > 0 ? microtime(true) + $this->defaultLifetime : null; } elseif ($time instanceof \DateInterval) { $this->expiry = microtime(true) + \DateTime::createFromFormat('U', 0)->add($time)->format('U.u'); } elseif (\is_int($time)) { $this->expiry = $time + microtime(true); } else { throw new InvalidArgumentException(sprintf('Expiration date must be an integer, a DateInterval or null, "%s" given', \is_object($time) ? \get_class($time) : \gettype($time))); } return $this; }
php
public function expiresAfter($time) { if (null === $time) { $this->expiry = $this->defaultLifetime > 0 ? microtime(true) + $this->defaultLifetime : null; } elseif ($time instanceof \DateInterval) { $this->expiry = microtime(true) + \DateTime::createFromFormat('U', 0)->add($time)->format('U.u'); } elseif (\is_int($time)) { $this->expiry = $time + microtime(true); } else { throw new InvalidArgumentException(sprintf('Expiration date must be an integer, a DateInterval or null, "%s" given', \is_object($time) ? \get_class($time) : \gettype($time))); } return $this; }
[ "public", "function", "expiresAfter", "(", "$", "time", ")", "{", "if", "(", "null", "===", "$", "time", ")", "{", "$", "this", "->", "expiry", "=", "$", "this", "->", "defaultLifetime", ">", "0", "?", "microtime", "(", "true", ")", "+", "$", "this...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Cache/CacheItem.php#L90-L103
train
Set expiration date
[ 30522, 2270, 3853, 4654, 20781, 3736, 6199, 2121, 1006, 1002, 2051, 1007, 1063, 2065, 1006, 19701, 1027, 1027, 1027, 1002, 2051, 1007, 1063, 1002, 2023, 1011, 1028, 4654, 8197, 2854, 1027, 1002, 2023, 1011, 1028, 12398, 15509, 7292, 1028, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Stopwatch/Stopwatch.php
Stopwatch.openSection
public function openSection($id = null) { $current = end($this->activeSections); if (null !== $id && null === $current->get($id)) { throw new \LogicException(sprintf('The section "%s" has been started at an other level and can not be opened.', $id)); } $this->start('__section__.child', 'section'); $this->activeSections[] = $current->open($id); $this->start('__section__'); }
php
public function openSection($id = null) { $current = end($this->activeSections); if (null !== $id && null === $current->get($id)) { throw new \LogicException(sprintf('The section "%s" has been started at an other level and can not be opened.', $id)); } $this->start('__section__.child', 'section'); $this->activeSections[] = $current->open($id); $this->start('__section__'); }
[ "public", "function", "openSection", "(", "$", "id", "=", "null", ")", "{", "$", "current", "=", "end", "(", "$", "this", "->", "activeSections", ")", ";", "if", "(", "null", "!==", "$", "id", "&&", "null", "===", "$", "current", "->", "get", "(", ...
Creates a new section or re-opens an existing section. @param string|null $id The id of the session to re-open, null to create a new one @throws \LogicException When the section to re-open is not reachable
[ "Creates", "a", "new", "section", "or", "re", "-", "opens", "an", "existing", "section", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Stopwatch/Stopwatch.php#L62-L73
train
Opens a section
[ 30522, 2270, 3853, 7480, 18491, 1006, 1002, 8909, 1027, 19701, 1007, 1063, 1002, 2783, 1027, 2203, 1006, 1002, 2023, 1011, 1028, 3161, 29015, 2015, 1007, 1025, 2065, 1006, 19701, 999, 1027, 1027, 1002, 8909, 1004, 1004, 19701, 1027, 1027, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Form/Extension/Validator/Type/UploadValidatorExtension.php
UploadValidatorExtension.configureOptions
public function configureOptions(OptionsResolver $resolver) { $translator = $this->translator; $translationDomain = $this->translationDomain; $resolver->setNormalizer('upload_max_size_message', function (Options $options, $message) use ($translator, $translationDomain) { return function () use ($translator, $translationDomain, $message) { return $translator->trans($message(), [], $translationDomain); }; }); }
php
public function configureOptions(OptionsResolver $resolver) { $translator = $this->translator; $translationDomain = $this->translationDomain; $resolver->setNormalizer('upload_max_size_message', function (Options $options, $message) use ($translator, $translationDomain) { return function () use ($translator, $translationDomain, $message) { return $translator->trans($message(), [], $translationDomain); }; }); }
[ "public", "function", "configureOptions", "(", "OptionsResolver", "$", "resolver", ")", "{", "$", "translator", "=", "$", "this", "->", "translator", ";", "$", "translationDomain", "=", "$", "this", "->", "translationDomain", ";", "$", "resolver", "->", "setNo...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Extension/Validator/Type/UploadValidatorExtension.php#L45-L54
train
Adds the upload_max_size_message normalizer to the options resolver
[ 30522, 2270, 3853, 9530, 8873, 27390, 8780, 16790, 2015, 1006, 7047, 6072, 4747, 6299, 1002, 10663, 2099, 1007, 1063, 1002, 11403, 1027, 1002, 2023, 1011, 1028, 11403, 1025, 1002, 5449, 9527, 8113, 1027, 1002, 2023, 1011, 1028, 5449, 9527, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Work/User/Client.php
Client.userIdToOpenid
public function userIdToOpenid(string $userId, int $agentId = null) { $params = [ 'userid' => $userId, 'agentid' => $agentId, ]; return $this->httpPostJson('cgi-bin/user/convert_to_openid', $params); }
php
public function userIdToOpenid(string $userId, int $agentId = null) { $params = [ 'userid' => $userId, 'agentid' => $agentId, ]; return $this->httpPostJson('cgi-bin/user/convert_to_openid', $params); }
[ "public", "function", "userIdToOpenid", "(", "string", "$", "userId", ",", "int", "$", "agentId", "=", "null", ")", "{", "$", "params", "=", "[", "'userid'", "=>", "$", "userId", ",", "'agentid'", "=>", "$", "agentId", ",", "]", ";", "return", "$", "...
Convert userId to openid. @param string $userId @param int|null $agentId @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string
[ "Convert", "userId", "to", "openid", "." ]
120c72faaa93c270365bc75c73c362d5fd583209
https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/Work/User/Client.php#L132-L140
train
Convert user id to openid
[ 30522, 2270, 3853, 5310, 3593, 3406, 26915, 3593, 1006, 5164, 1002, 5310, 3593, 1010, 20014, 1002, 4005, 3593, 1027, 19701, 1007, 1063, 1002, 11498, 5244, 1027, 1031, 1005, 5310, 3593, 1005, 1027, 1028, 1002, 5310, 3593, 1010, 1005, 4005, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/cms/classes/CmsObject.php
CmsObject.bootDefaultTheme
protected static function bootDefaultTheme() { $resolver = static::getDatasourceResolver(); if ($resolver->getDefaultDatasource()) { return; } $defaultTheme = App::runningInBackend() ? Theme::getEditThemeCode() : Theme::getActiveThemeCode(); Theme::load($defaultTheme); $resolver->setDefaultDatasource($defaultTheme); }
php
protected static function bootDefaultTheme() { $resolver = static::getDatasourceResolver(); if ($resolver->getDefaultDatasource()) { return; } $defaultTheme = App::runningInBackend() ? Theme::getEditThemeCode() : Theme::getActiveThemeCode(); Theme::load($defaultTheme); $resolver->setDefaultDatasource($defaultTheme); }
[ "protected", "static", "function", "bootDefaultTheme", "(", ")", "{", "$", "resolver", "=", "static", "::", "getDatasourceResolver", "(", ")", ";", "if", "(", "$", "resolver", "->", "getDefaultDatasource", "(", ")", ")", "{", "return", ";", "}", "$", "defa...
Boot all of the bootable traits on the model. @return void
[ "Boot", "all", "of", "the", "bootable", "traits", "on", "the", "model", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/CmsObject.php#L70-L84
train
Boots the default theme
[ 30522, 5123, 10763, 3853, 9573, 3207, 7011, 11314, 10760, 4168, 1006, 1007, 1063, 1002, 10663, 2099, 1027, 10763, 1024, 1024, 2131, 2850, 10230, 8162, 17119, 2229, 4747, 6299, 1006, 1007, 1025, 2065, 1006, 1002, 10663, 2099, 1011, 1028, 213...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/Dashboard/Controller.php
Controller.saveLayout
public function saveLayout() { $this->checkTokenInUrl(); $layout = Common::unsanitizeInputValue(Common::getRequestVar('layout')); $layout = strip_tags($layout); $idDashboard = Common::getRequestVar('idDashboard', 1, 'int'); $name = Common::getRequestVar('name', '', 'string'); if (Piwik::isUserIsAnonymous()) { $session = new SessionNamespace("Dashboard"); $session->dashboardLayout = $layout; $session->setExpirationSeconds(1800); } else { $this->getModel()->createOrUpdateDashboard(Piwik::getCurrentUserLogin(), $idDashboard, $layout); if (!empty($name)) { $this->getModel()->updateDashboardName(Piwik::getCurrentUserLogin(), $idDashboard, $name); } } }
php
public function saveLayout() { $this->checkTokenInUrl(); $layout = Common::unsanitizeInputValue(Common::getRequestVar('layout')); $layout = strip_tags($layout); $idDashboard = Common::getRequestVar('idDashboard', 1, 'int'); $name = Common::getRequestVar('name', '', 'string'); if (Piwik::isUserIsAnonymous()) { $session = new SessionNamespace("Dashboard"); $session->dashboardLayout = $layout; $session->setExpirationSeconds(1800); } else { $this->getModel()->createOrUpdateDashboard(Piwik::getCurrentUserLogin(), $idDashboard, $layout); if (!empty($name)) { $this->getModel()->updateDashboardName(Piwik::getCurrentUserLogin(), $idDashboard, $name); } } }
[ "public", "function", "saveLayout", "(", ")", "{", "$", "this", "->", "checkTokenInUrl", "(", ")", ";", "$", "layout", "=", "Common", "::", "unsanitizeInputValue", "(", "Common", "::", "getRequestVar", "(", "'layout'", ")", ")", ";", "$", "layout", "=", ...
Saves the layout for the current user anonymous = in the session authenticated user = in the DB
[ "Saves", "the", "layout", "for", "the", "current", "user", "anonymous", "=", "in", "the", "session", "authenticated", "user", "=", "in", "the", "DB" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Dashboard/Controller.php#L129-L148
train
Save the layout in the session
[ 30522, 2270, 3853, 3828, 8485, 5833, 1006, 1007, 1063, 1002, 2023, 1011, 1028, 4638, 18715, 18595, 11231, 12190, 1006, 1007, 1025, 1002, 9621, 1027, 2691, 1024, 1024, 4895, 8791, 25090, 4371, 2378, 18780, 10175, 5657, 1006, 2691, 1024, 1024...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/ArchiveProcessor/PluginsArchiver.php
PluginsArchiver.getPluginArchivers
protected static function getPluginArchivers() { if (empty(static::$archivers)) { $pluginNames = \Piwik\Plugin\Manager::getInstance()->getActivatedPlugins(); $archivers = array(); foreach ($pluginNames as $pluginName) { $archivers[$pluginName] = self::getPluginArchiverClass($pluginName); } static::$archivers = array_filter($archivers); } return static::$archivers; }
php
protected static function getPluginArchivers() { if (empty(static::$archivers)) { $pluginNames = \Piwik\Plugin\Manager::getInstance()->getActivatedPlugins(); $archivers = array(); foreach ($pluginNames as $pluginName) { $archivers[$pluginName] = self::getPluginArchiverClass($pluginName); } static::$archivers = array_filter($archivers); } return static::$archivers; }
[ "protected", "static", "function", "getPluginArchivers", "(", ")", "{", "if", "(", "empty", "(", "static", "::", "$", "archivers", ")", ")", "{", "$", "pluginNames", "=", "\\", "Piwik", "\\", "Plugin", "\\", "Manager", "::", "getInstance", "(", ")", "->"...
Loads Archiver class from any plugin that defines one. @return \Piwik\Plugin\Archiver[]
[ "Loads", "Archiver", "class", "from", "any", "plugin", "that", "defines", "one", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/ArchiveProcessor/PluginsArchiver.php#L217-L228
train
Get all plugin archivers
[ 30522, 5123, 10763, 3853, 2131, 24759, 15916, 3981, 11140, 16402, 2015, 1006, 1007, 1063, 2065, 1006, 4064, 1006, 10763, 1024, 1024, 1002, 8756, 2869, 1007, 1007, 1063, 1002, 13354, 23111, 14074, 2015, 1027, 1032, 14255, 9148, 2243, 1032, 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/Period/Range.php
Range.generate
protected function generate() { if ($this->subperiodsProcessed) { return; } $this->loadAllFromCache(); if ($this->subperiodsProcessed) { return; } parent::generate(); if (preg_match('/(last|previous)([0-9]*)/', $this->strDate, $regs)) { $lastN = $regs[2]; $lastOrPrevious = $regs[1]; if (!is_null($this->defaultEndDate)) { $defaultEndDate = $this->defaultEndDate; } else { $defaultEndDate = $this->today; } $period = $this->strPeriod; if ($period == 'range') { $period = 'day'; } if ($lastOrPrevious == 'last') { $endDate = $defaultEndDate; } elseif ($lastOrPrevious == 'previous') { if ('month' == $period) { $endDate = $defaultEndDate->subMonth(1); } else { $endDate = $defaultEndDate->subPeriod(1, $period); } } $lastN = $this->getMaxN($lastN); // last1 means only one result ; last2 means 2 results so we remove only 1 to the days/weeks/etc $lastN--; if ($lastN < 0) { $lastN = 0; } $startDate = $endDate->addPeriod(-1 * $lastN, $period); } elseif ($dateRange = Range::parseDateRange($this->strDate)) { $strDateStart = $dateRange[1]; $strDateEnd = $dateRange[2]; $startDate = Date::factory($strDateStart); // we set the timezone in the Date object only if the date is relative eg. 'today', 'yesterday', 'now' $timezone = null; if (strpos($strDateEnd, '-') === false) { $timezone = $this->timezone; } $endDate = Date::factory($strDateEnd, $timezone); } else { throw new Exception($this->translator->translate('General_ExceptionInvalidDateRange', array($this->strDate, ' \'lastN\', \'previousN\', \'YYYY-MM-DD,YYYY-MM-DD\''))); } if ($this->strPeriod != 'range') { $this->fillArraySubPeriods($startDate, $endDate, $this->strPeriod); $this->cacheAll(); return; } $this->processOptimalSubperiods($startDate, $endDate); // When period=range, we want End Date to be the actual specified end date, // rather than the end of the month / week / whatever is used for processing this range $this->endDate = $endDate; $this->cacheAll(); }
php
protected function generate() { if ($this->subperiodsProcessed) { return; } $this->loadAllFromCache(); if ($this->subperiodsProcessed) { return; } parent::generate(); if (preg_match('/(last|previous)([0-9]*)/', $this->strDate, $regs)) { $lastN = $regs[2]; $lastOrPrevious = $regs[1]; if (!is_null($this->defaultEndDate)) { $defaultEndDate = $this->defaultEndDate; } else { $defaultEndDate = $this->today; } $period = $this->strPeriod; if ($period == 'range') { $period = 'day'; } if ($lastOrPrevious == 'last') { $endDate = $defaultEndDate; } elseif ($lastOrPrevious == 'previous') { if ('month' == $period) { $endDate = $defaultEndDate->subMonth(1); } else { $endDate = $defaultEndDate->subPeriod(1, $period); } } $lastN = $this->getMaxN($lastN); // last1 means only one result ; last2 means 2 results so we remove only 1 to the days/weeks/etc $lastN--; if ($lastN < 0) { $lastN = 0; } $startDate = $endDate->addPeriod(-1 * $lastN, $period); } elseif ($dateRange = Range::parseDateRange($this->strDate)) { $strDateStart = $dateRange[1]; $strDateEnd = $dateRange[2]; $startDate = Date::factory($strDateStart); // we set the timezone in the Date object only if the date is relative eg. 'today', 'yesterday', 'now' $timezone = null; if (strpos($strDateEnd, '-') === false) { $timezone = $this->timezone; } $endDate = Date::factory($strDateEnd, $timezone); } else { throw new Exception($this->translator->translate('General_ExceptionInvalidDateRange', array($this->strDate, ' \'lastN\', \'previousN\', \'YYYY-MM-DD,YYYY-MM-DD\''))); } if ($this->strPeriod != 'range') { $this->fillArraySubPeriods($startDate, $endDate, $this->strPeriod); $this->cacheAll(); return; } $this->processOptimalSubperiods($startDate, $endDate); // When period=range, we want End Date to be the actual specified end date, // rather than the end of the month / week / whatever is used for processing this range $this->endDate = $endDate; $this->cacheAll(); }
[ "protected", "function", "generate", "(", ")", "{", "if", "(", "$", "this", "->", "subperiodsProcessed", ")", "{", "return", ";", "}", "$", "this", "->", "loadAllFromCache", "(", ")", ";", "if", "(", "$", "this", "->", "subperiodsProcessed", ")", "{", ...
Generates the subperiods @throws Exception
[ "Generates", "the", "subperiods" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Period/Range.php#L209-L282
train
Generate the subperiods
[ 30522, 5123, 3853, 9699, 1006, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 4942, 4842, 3695, 5104, 21572, 9623, 6924, 1007, 1063, 2709, 1025, 1065, 1002, 2023, 1011, 1028, 7170, 8095, 19699, 5358, 3540, 5403, 1006, 1007, 1025, 2065, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Config/ResourceCheckerConfigCache.php
ResourceCheckerConfigCache.write
public function write($content, array $metadata = null) { $mode = 0666; $umask = umask(); $filesystem = new Filesystem(); $filesystem->dumpFile($this->file, $content); try { $filesystem->chmod($this->file, $mode, $umask); } catch (IOException $e) { // discard chmod failure (some filesystem may not support it) } if (null !== $metadata) { $filesystem->dumpFile($this->getMetaFile(), serialize($metadata)); try { $filesystem->chmod($this->getMetaFile(), $mode, $umask); } catch (IOException $e) { // discard chmod failure (some filesystem may not support it) } } if (\function_exists('opcache_invalidate') && filter_var(ini_get('opcache.enable'), FILTER_VALIDATE_BOOLEAN)) { @opcache_invalidate($this->file, true); } }
php
public function write($content, array $metadata = null) { $mode = 0666; $umask = umask(); $filesystem = new Filesystem(); $filesystem->dumpFile($this->file, $content); try { $filesystem->chmod($this->file, $mode, $umask); } catch (IOException $e) { // discard chmod failure (some filesystem may not support it) } if (null !== $metadata) { $filesystem->dumpFile($this->getMetaFile(), serialize($metadata)); try { $filesystem->chmod($this->getMetaFile(), $mode, $umask); } catch (IOException $e) { // discard chmod failure (some filesystem may not support it) } } if (\function_exists('opcache_invalidate') && filter_var(ini_get('opcache.enable'), FILTER_VALIDATE_BOOLEAN)) { @opcache_invalidate($this->file, true); } }
[ "public", "function", "write", "(", "$", "content", ",", "array", "$", "metadata", "=", "null", ")", "{", "$", "mode", "=", "0666", ";", "$", "umask", "=", "umask", "(", ")", ";", "$", "filesystem", "=", "new", "Filesystem", "(", ")", ";", "$", "...
Writes cache. @param string $content The content to write in the cache @param ResourceInterface[] $metadata An array of metadata @throws \RuntimeException When cache file can't be written
[ "Writes", "cache", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Config/ResourceCheckerConfigCache.php#L119-L143
train
Write the content to the file
[ 30522, 2270, 3853, 4339, 1006, 1002, 4180, 1010, 9140, 1002, 27425, 1027, 19701, 1007, 1063, 1002, 5549, 1027, 5757, 28756, 1025, 1002, 8529, 19895, 1027, 8529, 19895, 1006, 1007, 1025, 1002, 6764, 27268, 6633, 1027, 2047, 6764, 27268, 6633...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Payment/Merchant/Client.php
Client.manage
protected function manage(array $params, array $query) { $params = array_merge($params, [ 'appid' => $this->app['config']->app_id, 'nonce_str' => '', 'sub_mch_id' => '', 'sub_appid' => '', ]); return $this->safeRequest('secapi/mch/submchmanage', $params, 'post', compact('query')); }
php
protected function manage(array $params, array $query) { $params = array_merge($params, [ 'appid' => $this->app['config']->app_id, 'nonce_str' => '', 'sub_mch_id' => '', 'sub_appid' => '', ]); return $this->safeRequest('secapi/mch/submchmanage', $params, 'post', compact('query')); }
[ "protected", "function", "manage", "(", "array", "$", "params", ",", "array", "$", "query", ")", "{", "$", "params", "=", "array_merge", "(", "$", "params", ",", "[", "'appid'", "=>", "$", "this", "->", "app", "[", "'config'", "]", "->", "app_id", ",...
@param array $params @param array $query @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
[ "@param", "array", "$params", "@param", "array", "$query" ]
120c72faaa93c270365bc75c73c362d5fd583209
https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/Payment/Merchant/Client.php#L81-L91
train
manage submch
[ 30522, 5123, 3853, 6133, 1006, 9140, 1002, 11498, 5244, 1010, 9140, 1002, 23032, 1007, 1063, 1002, 11498, 5244, 1027, 9140, 1035, 13590, 1006, 1002, 11498, 5244, 1010, 1031, 1005, 10439, 3593, 1005, 1027, 1028, 1002, 2023, 1011, 1028, 10439...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Lists.php
Lists.getSetupPerPageOptions
protected function getSetupPerPageOptions() { $perPageOptions = [20, 40, 80, 100, 120]; if (!in_array($this->recordsPerPage, $perPageOptions)) { $perPageOptions[] = $this->recordsPerPage; } sort($perPageOptions); return $perPageOptions; }
php
protected function getSetupPerPageOptions() { $perPageOptions = [20, 40, 80, 100, 120]; if (!in_array($this->recordsPerPage, $perPageOptions)) { $perPageOptions[] = $this->recordsPerPage; } sort($perPageOptions); return $perPageOptions; }
[ "protected", "function", "getSetupPerPageOptions", "(", ")", "{", "$", "perPageOptions", "=", "[", "20", ",", "40", ",", "80", ",", "100", ",", "120", "]", ";", "if", "(", "!", "in_array", "(", "$", "this", "->", "recordsPerPage", ",", "$", "perPageOpt...
Returns an array of allowable records per page.
[ "Returns", "an", "array", "of", "allowable", "records", "per", "page", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/Lists.php#L1601-L1610
train
Get setup per page options
[ 30522, 5123, 3853, 4152, 3388, 29547, 14536, 4270, 7361, 9285, 1006, 1007, 1063, 1002, 2566, 13704, 7361, 9285, 1027, 1031, 2322, 1010, 2871, 1010, 3770, 1010, 2531, 1010, 6036, 1033, 1025, 2065, 1006, 999, 1999, 1035, 9140, 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...
symfony/symfony
src/Symfony/Component/HttpFoundation/AcceptHeader.php
AcceptHeader.get
public function get($value) { return $this->items[$value] ?? $this->items[explode('/', $value)[0].'/*'] ?? $this->items['*/*'] ?? $this->items['*'] ?? null; }
php
public function get($value) { return $this->items[$value] ?? $this->items[explode('/', $value)[0].'/*'] ?? $this->items['*/*'] ?? $this->items['*'] ?? null; }
[ "public", "function", "get", "(", "$", "value", ")", "{", "return", "$", "this", "->", "items", "[", "$", "value", "]", "??", "$", "this", "->", "items", "[", "explode", "(", "'/'", ",", "$", "value", ")", "[", "0", "]", ".", "'/*'", "]", "??",...
Returns given value's item, if exists. @param string $value @return AcceptHeaderItem|null
[ "Returns", "given", "value", "s", "item", "if", "exists", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpFoundation/AcceptHeader.php#L97-L100
train
Get a page from the page tree
[ 30522, 2270, 3853, 2131, 1006, 1002, 3643, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 5167, 1031, 1002, 3643, 1033, 1029, 1029, 1002, 2023, 1011, 1028, 5167, 1031, 15044, 1006, 1005, 1013, 1005, 1010, 1002, 3643, 1007, 1031, 1014, 1033, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Validator/Validator/TraceableValidator.php
TraceableValidator.validateProperty
public function validateProperty($object, $propertyName, $groups = null) { return $this->validator->validateProperty($object, $propertyName, $groups); }
php
public function validateProperty($object, $propertyName, $groups = null) { return $this->validator->validateProperty($object, $propertyName, $groups); }
[ "public", "function", "validateProperty", "(", "$", "object", ",", "$", "propertyName", ",", "$", "groups", "=", "null", ")", "{", "return", "$", "this", "->", "validator", "->", "validateProperty", "(", "$", "object", ",", "$", "propertyName", ",", "$", ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Validator/Validator/TraceableValidator.php#L108-L111
train
Validate a property of an object
[ 30522, 2270, 3853, 9398, 3686, 21572, 4842, 3723, 1006, 1002, 4874, 1010, 1002, 3200, 18442, 1010, 1002, 2967, 1027, 19701, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 9398, 8844, 1011, 1028, 9398, 3686, 21572, 4842, 3723, 1006, 1002, 4874, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/helpers/Backend.php
Backend.redirectGuest
public function redirectGuest($path, $status = 302, $headers = [], $secure = null) { return Redirect::guest($this->uri() . '/' . $path, $status, $headers, $secure); }
php
public function redirectGuest($path, $status = 302, $headers = [], $secure = null) { return Redirect::guest($this->uri() . '/' . $path, $status, $headers, $secure); }
[ "public", "function", "redirectGuest", "(", "$", "path", ",", "$", "status", "=", "302", ",", "$", "headers", "=", "[", "]", ",", "$", "secure", "=", "null", ")", "{", "return", "Redirect", "::", "guest", "(", "$", "this", "->", "uri", "(", ")", ...
Create a new backend redirect response, while putting the current URL in the session.
[ "Create", "a", "new", "backend", "redirect", "response", "while", "putting", "the", "current", "URL", "in", "the", "session", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/helpers/Backend.php#L73-L76
train
Redirect guest to another path
[ 30522, 2270, 3853, 2417, 7442, 6593, 22967, 2102, 1006, 1002, 4130, 1010, 1002, 3570, 1027, 22060, 1010, 1002, 20346, 2015, 1027, 1031, 1033, 1010, 1002, 5851, 1027, 19701, 1007, 1063, 2709, 2417, 7442, 6593, 1024, 1024, 4113, 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...
overtrue/wechat
src/OpenPlatform/Component/Client.php
Client.getRegistrationStatus
public function getRegistrationStatus(string $companyName, string $legalPersonaWechat, string $legalPersonaName) { $params = [ 'name' => $companyName, 'legal_persona_wechat' => $legalPersonaWechat, 'legal_persona_name' => $legalPersonaName, ]; return $this->httpPostJson('cgi-bin/component/fastregisterweapp', $params, ['action' => 'search']); }
php
public function getRegistrationStatus(string $companyName, string $legalPersonaWechat, string $legalPersonaName) { $params = [ 'name' => $companyName, 'legal_persona_wechat' => $legalPersonaWechat, 'legal_persona_name' => $legalPersonaName, ]; return $this->httpPostJson('cgi-bin/component/fastregisterweapp', $params, ['action' => 'search']); }
[ "public", "function", "getRegistrationStatus", "(", "string", "$", "companyName", ",", "string", "$", "legalPersonaWechat", ",", "string", "$", "legalPersonaName", ")", "{", "$", "params", "=", "[", "'name'", "=>", "$", "companyName", ",", "'legal_persona_wechat'"...
查询创建任务状态. @param string $companyName @param string $legalPersonaWechat @param string $legalPersonaName @return array @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
[ "查询创建任务状态", "." ]
120c72faaa93c270365bc75c73c362d5fd583209
https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/OpenPlatform/Component/Client.php#L48-L57
train
Get Registration Status
[ 30522, 2270, 3853, 2131, 2890, 24063, 28893, 29336, 2271, 1006, 5164, 1002, 2194, 18442, 1010, 5164, 1002, 3423, 27576, 10376, 15937, 4017, 1010, 5164, 1002, 3423, 27576, 5162, 4168, 1007, 1063, 1002, 11498, 5244, 1027, 1031, 1005, 2171, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Foundation/Exceptions/Handler.php
Handler.renderExceptionWithSymfony
protected function renderExceptionWithSymfony(Exception $e, $debug) { return (new SymfonyExceptionHandler($debug))->getHtml( FlattenException::create($e) ); }
php
protected function renderExceptionWithSymfony(Exception $e, $debug) { return (new SymfonyExceptionHandler($debug))->getHtml( FlattenException::create($e) ); }
[ "protected", "function", "renderExceptionWithSymfony", "(", "Exception", "$", "e", ",", "$", "debug", ")", "{", "return", "(", "new", "SymfonyExceptionHandler", "(", "$", "debug", ")", ")", "->", "getHtml", "(", "FlattenException", "::", "create", "(", "$", ...
Render an exception to a string using Symfony. @param \Exception $e @param bool $debug @return string
[ "Render", "an", "exception", "to", "a", "string", "using", "Symfony", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Foundation/Exceptions/Handler.php#L359-L364
train
Render exception with Symfony exception handler
[ 30522, 5123, 3853, 17552, 10288, 24422, 24415, 6508, 2213, 14876, 4890, 1006, 6453, 1002, 1041, 1010, 1002, 2139, 8569, 2290, 1007, 1063, 2709, 1006, 2047, 25353, 2213, 14876, 4890, 10288, 24422, 11774, 3917, 1006, 1002, 2139, 8569, 2290, 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...
guzzle/guzzle
src/Handler/Proxy.php
Proxy.wrapStreaming
public static function wrapStreaming( callable $default, callable $streaming ) { return function (RequestInterface $request, array $options) use ($default, $streaming) { return empty($options['stream']) ? $default($request, $options) : $streaming($request, $options); }; }
php
public static function wrapStreaming( callable $default, callable $streaming ) { return function (RequestInterface $request, array $options) use ($default, $streaming) { return empty($options['stream']) ? $default($request, $options) : $streaming($request, $options); }; }
[ "public", "static", "function", "wrapStreaming", "(", "callable", "$", "default", ",", "callable", "$", "streaming", ")", "{", "return", "function", "(", "RequestInterface", "$", "request", ",", "array", "$", "options", ")", "use", "(", "$", "default", ",", ...
Sends streaming requests to a streaming compatible handler while sending all other requests to a default handler. This, for example, could be useful for taking advantage of the performance benefits of curl while still supporting true streaming through the StreamHandler. @param callable $default Handler used for non-streaming responses @param callable $streaming Handler used for streaming responses @return callable Returns the composed handler.
[ "Sends", "streaming", "requests", "to", "a", "streaming", "compatible", "handler", "while", "sending", "all", "other", "requests", "to", "a", "default", "handler", "." ]
bf595424e4d442a190582e088985dc835a789071
https://github.com/guzzle/guzzle/blob/bf595424e4d442a190582e088985dc835a789071/src/Handler/Proxy.php#L45-L54
train
Wrap the default and streaming functions in a closure that wraps the request with the stream option.
[ 30522, 2270, 10763, 3853, 19735, 25379, 2075, 1006, 2655, 3085, 1002, 12398, 1010, 2655, 3085, 1002, 11058, 1007, 1063, 2709, 3853, 1006, 5227, 18447, 2121, 12172, 1002, 5227, 1010, 9140, 1002, 7047, 1007, 2224, 1006, 1002, 12398, 1010, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Security/Http/Authentication/SimpleAuthenticationHandler.php
SimpleAuthenticationHandler.onAuthenticationSuccess
public function onAuthenticationSuccess(Request $request, TokenInterface $token) { if ($this->simpleAuthenticator instanceof AuthenticationSuccessHandlerInterface) { if ($this->logger) { $this->logger->debug('Selected an authentication success handler.', ['handler' => \get_class($this->simpleAuthenticator)]); } $response = $this->simpleAuthenticator->onAuthenticationSuccess($request, $token); if ($response instanceof Response) { return $response; } if (null !== $response) { throw new \UnexpectedValueException(sprintf('The %s::onAuthenticationSuccess method must return null to use the default success handler, or a Response object', \get_class($this->simpleAuthenticator))); } } if ($this->logger) { $this->logger->debug('Fallback to the default authentication success handler.'); } return $this->successHandler->onAuthenticationSuccess($request, $token); }
php
public function onAuthenticationSuccess(Request $request, TokenInterface $token) { if ($this->simpleAuthenticator instanceof AuthenticationSuccessHandlerInterface) { if ($this->logger) { $this->logger->debug('Selected an authentication success handler.', ['handler' => \get_class($this->simpleAuthenticator)]); } $response = $this->simpleAuthenticator->onAuthenticationSuccess($request, $token); if ($response instanceof Response) { return $response; } if (null !== $response) { throw new \UnexpectedValueException(sprintf('The %s::onAuthenticationSuccess method must return null to use the default success handler, or a Response object', \get_class($this->simpleAuthenticator))); } } if ($this->logger) { $this->logger->debug('Fallback to the default authentication success handler.'); } return $this->successHandler->onAuthenticationSuccess($request, $token); }
[ "public", "function", "onAuthenticationSuccess", "(", "Request", "$", "request", ",", "TokenInterface", "$", "token", ")", "{", "if", "(", "$", "this", "->", "simpleAuthenticator", "instanceof", "AuthenticationSuccessHandlerInterface", ")", "{", "if", "(", "$", "t...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Security/Http/Authentication/SimpleAuthenticationHandler.php#L58-L80
train
Return Response object if authentication success
[ 30522, 2270, 3853, 2006, 4887, 10760, 16778, 10719, 6342, 9468, 7971, 1006, 5227, 1002, 5227, 1010, 19204, 18447, 2121, 12172, 1002, 19204, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 3722, 4887, 10760, 16778, 11266, 2953, 6013, 11253, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Query/Builder.php
Builder.offset
public function offset($value) { $property = $this->unions ? 'unionOffset' : 'offset'; $this->$property = max(0, $value); return $this; }
php
public function offset($value) { $property = $this->unions ? 'unionOffset' : 'offset'; $this->$property = max(0, $value); return $this; }
[ "public", "function", "offset", "(", "$", "value", ")", "{", "$", "property", "=", "$", "this", "->", "unions", "?", "'unionOffset'", ":", "'offset'", ";", "$", "this", "->", "$", "property", "=", "max", "(", "0", ",", "$", "value", ")", ";", "retu...
Set the "offset" value of the query. @param int $value @return $this
[ "Set", "the", "offset", "value", "of", "the", "query", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Query/Builder.php#L1896-L1903
train
Set the offset value of the union
[ 30522, 2270, 3853, 16396, 1006, 1002, 3643, 1007, 1063, 1002, 3200, 1027, 1002, 2023, 1011, 1028, 9209, 1029, 1005, 2586, 27475, 3388, 1005, 1024, 1005, 16396, 1005, 1025, 1002, 2023, 1011, 1028, 1002, 3200, 1027, 4098, 1006, 1014, 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...
overtrue/wechat
src/Payment/Transfer/Client.php
Client.queryBankCardOrder
public function queryBankCardOrder(string $partnerTradeNo) { $params = [ 'mch_id' => $this->app['config']->mch_id, 'partner_trade_no' => $partnerTradeNo, ]; return $this->safeRequest('mmpaysptrans/query_bank', $params); }
php
public function queryBankCardOrder(string $partnerTradeNo) { $params = [ 'mch_id' => $this->app['config']->mch_id, 'partner_trade_no' => $partnerTradeNo, ]; return $this->safeRequest('mmpaysptrans/query_bank', $params); }
[ "public", "function", "queryBankCardOrder", "(", "string", "$", "partnerTradeNo", ")", "{", "$", "params", "=", "[", "'mch_id'", "=>", "$", "this", "->", "app", "[", "'config'", "]", "->", "mch_id", ",", "'partner_trade_no'", "=>", "$", "partnerTradeNo", ","...
Query MerchantPay order to BankCard. @param string $partnerTradeNo @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
[ "Query", "MerchantPay", "order", "to", "BankCard", "." ]
120c72faaa93c270365bc75c73c362d5fd583209
https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/Payment/Transfer/Client.php#L79-L87
train
Query Bank Card Order
[ 30522, 2270, 3853, 23032, 9299, 11522, 8551, 2121, 1006, 5164, 1002, 4256, 6494, 4181, 2080, 1007, 1063, 1002, 11498, 5244, 1027, 1031, 1005, 11338, 2232, 1035, 8909, 1005, 1027, 1028, 1002, 2023, 1011, 1028, 10439, 1031, 1005, 9530, 8873, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Redis/Connectors/PhpRedisConnector.php
PhpRedisConnector.createRedisClusterInstance
protected function createRedisClusterInstance(array $servers, array $options) { return new RedisCluster( null, array_values($servers), $options['timeout'] ?? 0, $options['read_timeout'] ?? 0, isset($options['persistent']) && $options['persistent'] ); }
php
protected function createRedisClusterInstance(array $servers, array $options) { return new RedisCluster( null, array_values($servers), $options['timeout'] ?? 0, $options['read_timeout'] ?? 0, isset($options['persistent']) && $options['persistent'] ); }
[ "protected", "function", "createRedisClusterInstance", "(", "array", "$", "servers", ",", "array", "$", "options", ")", "{", "return", "new", "RedisCluster", "(", "null", ",", "array_values", "(", "$", "servers", ")", ",", "$", "options", "[", "'timeout'", "...
Create a new redis cluster instance. @param array $servers @param array $options @return \RedisCluster
[ "Create", "a", "new", "redis", "cluster", "instance", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Redis/Connectors/PhpRedisConnector.php#L119-L128
train
Create a RedisCluster instance
[ 30522, 5123, 3853, 3443, 5596, 2483, 20464, 19966, 23282, 12693, 3401, 1006, 9140, 1002, 14903, 1010, 9140, 1002, 7047, 1007, 1063, 2709, 2047, 2417, 2483, 20464, 19966, 2121, 1006, 19701, 1010, 9140, 1035, 5300, 1006, 1002, 14903, 1007, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Console/Helper/TableStyle.php
TableStyle.getCrossingChars
public function getCrossingChars(): array { return [ $this->crossingChar, $this->crossingTopLeftChar, $this->crossingTopMidChar, $this->crossingTopRightChar, $this->crossingMidRightChar, $this->crossingBottomRightChar, $this->crossingBottomMidChar, $this->crossingBottomLeftChar, $this->crossingMidLeftChar, $this->crossingTopLeftBottomChar, $this->crossingTopMidBottomChar, $this->crossingTopRightBottomChar, ]; }
php
public function getCrossingChars(): array { return [ $this->crossingChar, $this->crossingTopLeftChar, $this->crossingTopMidChar, $this->crossingTopRightChar, $this->crossingMidRightChar, $this->crossingBottomRightChar, $this->crossingBottomMidChar, $this->crossingBottomLeftChar, $this->crossingMidLeftChar, $this->crossingTopLeftBottomChar, $this->crossingTopMidBottomChar, $this->crossingTopRightBottomChar, ]; }
[ "public", "function", "getCrossingChars", "(", ")", ":", "array", "{", "return", "[", "$", "this", "->", "crossingChar", ",", "$", "this", "->", "crossingTopLeftChar", ",", "$", "this", "->", "crossingTopMidChar", ",", "$", "this", "->", "crossingTopRightChar"...
Gets crossing characters. @internal
[ "Gets", "crossing", "characters", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Console/Helper/TableStyle.php#L293-L309
train
Returns the crossing characters
[ 30522, 2270, 3853, 2131, 16458, 2075, 7507, 2869, 1006, 1007, 1024, 9140, 1063, 2709, 1031, 1002, 2023, 1011, 1028, 5153, 7507, 2099, 1010, 1002, 2023, 1011, 1028, 5153, 14399, 2571, 6199, 7507, 2099, 1010, 1002, 2023, 1011, 1028, 5153, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Cache/Psr16Cache.php
Psr16Cache.delete
public function delete($key) { try { return $this->pool->deleteItem($key); } catch (SimpleCacheException $e) { throw $e; } catch (Psr6CacheException $e) { throw new InvalidArgumentException($e->getMessage(), $e->getCode(), $e); } }
php
public function delete($key) { try { return $this->pool->deleteItem($key); } catch (SimpleCacheException $e) { throw $e; } catch (Psr6CacheException $e) { throw new InvalidArgumentException($e->getMessage(), $e->getCode(), $e); } }
[ "public", "function", "delete", "(", "$", "key", ")", "{", "try", "{", "return", "$", "this", "->", "pool", "->", "deleteItem", "(", "$", "key", ")", ";", "}", "catch", "(", "SimpleCacheException", "$", "e", ")", "{", "throw", "$", "e", ";", "}", ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Cache/Psr16Cache.php#L112-L121
train
Delete an item from the cache
[ 30522, 2270, 3853, 3972, 12870, 1006, 1002, 3145, 1007, 1063, 3046, 1063, 2709, 1002, 2023, 1011, 1028, 4770, 1011, 1028, 3972, 12870, 4221, 2213, 1006, 1002, 3145, 1007, 1025, 1065, 4608, 1006, 3722, 3540, 25923, 2595, 24422, 1002, 1041, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Validate/File/Count.php
Zend_Validate_File_Count.isValid
public function isValid($value, $file = null) { if (($file !== null) && !array_key_exists('destination', $file)) { $file['destination'] = dirname($value); } if (($file !== null) && array_key_exists('tmp_name', $file)) { $value = $file['destination'] . DIRECTORY_SEPARATOR . $file['name']; } if (($file === null) || !empty($file['tmp_name'])) { $this->addFile($value); } $this->_count = count($this->_files); if (($this->_max !== null) && ($this->_count > $this->_max)) { return $this->_throw($file, self::TOO_MANY); } if (($this->_min !== null) && ($this->_count < $this->_min)) { return $this->_throw($file, self::TOO_FEW); } return true; }
php
public function isValid($value, $file = null) { if (($file !== null) && !array_key_exists('destination', $file)) { $file['destination'] = dirname($value); } if (($file !== null) && array_key_exists('tmp_name', $file)) { $value = $file['destination'] . DIRECTORY_SEPARATOR . $file['name']; } if (($file === null) || !empty($file['tmp_name'])) { $this->addFile($value); } $this->_count = count($this->_files); if (($this->_max !== null) && ($this->_count > $this->_max)) { return $this->_throw($file, self::TOO_MANY); } if (($this->_min !== null) && ($this->_count < $this->_min)) { return $this->_throw($file, self::TOO_FEW); } return true; }
[ "public", "function", "isValid", "(", "$", "value", ",", "$", "file", "=", "null", ")", "{", "if", "(", "(", "$", "file", "!==", "null", ")", "&&", "!", "array_key_exists", "(", "'destination'", ",", "$", "file", ")", ")", "{", "$", "file", "[", ...
Defined by Zend_Validate_Interface Returns true if and only if the file count of all checked files is at least min and not bigger than max (when max is not null). Attention: When checking with set min you must give all files with the first call, otherwise you will get an false. @param string|array $value Filenames to check for count @param array $file File data from Zend_File_Transfer @return boolean
[ "Defined", "by", "Zend_Validate_Interface" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Validate/File/Count.php#L242-L266
train
Valida o valor de fichier
[ 30522, 2270, 3853, 2003, 10175, 3593, 1006, 1002, 3643, 1010, 1002, 5371, 1027, 19701, 1007, 1063, 2065, 1006, 1006, 1002, 5371, 999, 1027, 1027, 19701, 1007, 1004, 1004, 999, 9140, 1035, 3145, 1035, 6526, 1006, 1005, 7688, 1005, 1010, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/Url.php
Url.getCurrentScriptPath
public static function getCurrentScriptPath() { $queryString = self::getCurrentScriptName(); //add a fake letter case /test/test2/ returns /test which is not expected $urlDir = dirname($queryString . 'x'); $urlDir = str_replace('\\', '/', $urlDir); // if we are in a subpath we add a trailing slash if (strlen($urlDir) > 1) { $urlDir .= '/'; } return $urlDir; }
php
public static function getCurrentScriptPath() { $queryString = self::getCurrentScriptName(); //add a fake letter case /test/test2/ returns /test which is not expected $urlDir = dirname($queryString . 'x'); $urlDir = str_replace('\\', '/', $urlDir); // if we are in a subpath we add a trailing slash if (strlen($urlDir) > 1) { $urlDir .= '/'; } return $urlDir; }
[ "public", "static", "function", "getCurrentScriptPath", "(", ")", "{", "$", "queryString", "=", "self", "::", "getCurrentScriptName", "(", ")", ";", "//add a fake letter case /test/test2/ returns /test which is not expected", "$", "urlDir", "=", "dirname", "(", "$", "qu...
Returns the path to the script being executed. The script file name is not included. @return string eg, `"/dir1/dir2/"` if the current URL is `"http://example.org/dir1/dir2/index.php?param1=value1&param2=value2"` @api
[ "Returns", "the", "path", "to", "the", "script", "being", "executed", ".", "The", "script", "file", "name", "is", "not", "included", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Url.php#L105-L117
train
Get the path of the current script
[ 30522, 2270, 10763, 3853, 2131, 10841, 14343, 7666, 23235, 15069, 1006, 1007, 1063, 1002, 23032, 3367, 4892, 1027, 2969, 1024, 1024, 2131, 10841, 14343, 7666, 23235, 18442, 1006, 1007, 1025, 1013, 1013, 5587, 1037, 8275, 3661, 2553, 1013, 3...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
z-song/laravel-admin
src/Grid/Filter/AbstractFilter.php
AbstractFilter.siblings
public function siblings($index = null) { if (!is_null($index)) { return Arr::get($this->parent->filters(), $index); } return $this->parent->filters(); }
php
public function siblings($index = null) { if (!is_null($index)) { return Arr::get($this->parent->filters(), $index); } return $this->parent->filters(); }
[ "public", "function", "siblings", "(", "$", "index", "=", "null", ")", "{", "if", "(", "!", "is_null", "(", "$", "index", ")", ")", "{", "return", "Arr", "::", "get", "(", "$", "this", "->", "parent", "->", "filters", "(", ")", ",", "$", "index",...
Get siblings of current filter. @param null $index @return AbstractFilter[]|mixed
[ "Get", "siblings", "of", "current", "filter", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid/Filter/AbstractFilter.php#L182-L189
train
Get siblings of this filter
[ 30522, 2270, 3853, 9504, 1006, 1002, 5950, 1027, 19701, 1007, 1063, 2065, 1006, 999, 2003, 1035, 19701, 1006, 1002, 5950, 1007, 1007, 1063, 2709, 12098, 2099, 1024, 1024, 2131, 1006, 1002, 2023, 1011, 1028, 6687, 1011, 1028, 17736, 1006, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Cache/Backend/TwoLevels.php
Zend_Cache_Backend_TwoLevels.save
public function save($data, $id, $tags = array(), $specificLifetime = false, $priority = 8) { $usage = $this->_getFastFillingPercentage('saving'); $boolFast = true; $lifetime = $this->getLifetime($specificLifetime); $preparedData = $this->_prepareData($data, $lifetime, $priority); if (($priority > 0) && (10 * $priority >= $usage)) { $fastLifetime = $this->_getFastLifetime($lifetime, $priority); $boolFast = $this->_fastBackend->save($preparedData, $id, array(), $fastLifetime); $boolSlow = $this->_slowBackend->save($preparedData, $id, $tags, $lifetime); } else { $boolSlow = $this->_slowBackend->save($preparedData, $id, $tags, $lifetime); if ($boolSlow === true) { $boolFast = $this->_fastBackend->remove($id); if (!$boolFast && !$this->_fastBackend->test($id)) { // some backends return false on remove() even if the key never existed. (and it won't if fast is full) // all we care about is that the key doesn't exist now $boolFast = true; } } } return ($boolFast && $boolSlow); }
php
public function save($data, $id, $tags = array(), $specificLifetime = false, $priority = 8) { $usage = $this->_getFastFillingPercentage('saving'); $boolFast = true; $lifetime = $this->getLifetime($specificLifetime); $preparedData = $this->_prepareData($data, $lifetime, $priority); if (($priority > 0) && (10 * $priority >= $usage)) { $fastLifetime = $this->_getFastLifetime($lifetime, $priority); $boolFast = $this->_fastBackend->save($preparedData, $id, array(), $fastLifetime); $boolSlow = $this->_slowBackend->save($preparedData, $id, $tags, $lifetime); } else { $boolSlow = $this->_slowBackend->save($preparedData, $id, $tags, $lifetime); if ($boolSlow === true) { $boolFast = $this->_fastBackend->remove($id); if (!$boolFast && !$this->_fastBackend->test($id)) { // some backends return false on remove() even if the key never existed. (and it won't if fast is full) // all we care about is that the key doesn't exist now $boolFast = true; } } } return ($boolFast && $boolSlow); }
[ "public", "function", "save", "(", "$", "data", ",", "$", "id", ",", "$", "tags", "=", "array", "(", ")", ",", "$", "specificLifetime", "=", "false", ",", "$", "priority", "=", "8", ")", "{", "$", "usage", "=", "$", "this", "->", "_getFastFillingPe...
Save some string datas into a cache record Note : $data is always "string" (serialization is done by the core not by the backend) @param string $data Datas to cache @param string $id Cache id @param array $tags Array of strings, the cache record will be tagged by each string entry @param int $specificLifetime If != false, set a specific lifetime for this cache record (null => infinite lifetime) @param int $priority integer between 0 (very low priority) and 10 (maximum priority) used by some particular backends @return boolean true if no problem
[ "Save", "some", "string", "datas", "into", "a", "cache", "record" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Cache/Backend/TwoLevels.php#L190-L213
train
Save the data to the database
[ 30522, 2270, 3853, 3828, 1006, 1002, 2951, 1010, 1002, 8909, 1010, 1002, 22073, 1027, 9140, 1006, 1007, 1010, 1002, 3563, 15509, 7292, 1027, 6270, 1010, 1002, 9470, 1027, 1022, 1007, 1063, 1002, 8192, 1027, 1002, 2023, 1011, 1028, 1035, 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...
laravel/framework
src/Illuminate/Database/Query/Builder.php
Builder.whereExists
public function whereExists(Closure $callback, $boolean = 'and', $not = false) { $query = $this->forSubQuery(); // Similar to the sub-select clause, we will create a new query instance so // the developer may cleanly specify the entire exists query and we will // compile the whole thing in the grammar and insert it into the SQL. call_user_func($callback, $query); return $this->addWhereExistsQuery($query, $boolean, $not); }
php
public function whereExists(Closure $callback, $boolean = 'and', $not = false) { $query = $this->forSubQuery(); // Similar to the sub-select clause, we will create a new query instance so // the developer may cleanly specify the entire exists query and we will // compile the whole thing in the grammar and insert it into the SQL. call_user_func($callback, $query); return $this->addWhereExistsQuery($query, $boolean, $not); }
[ "public", "function", "whereExists", "(", "Closure", "$", "callback", ",", "$", "boolean", "=", "'and'", ",", "$", "not", "=", "false", ")", "{", "$", "query", "=", "$", "this", "->", "forSubQuery", "(", ")", ";", "// Similar to the sub-select clause, we wil...
Add an exists clause to the query. @param \Closure $callback @param string $boolean @param bool $not @return $this
[ "Add", "an", "exists", "clause", "to", "the", "query", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Query/Builder.php#L1403-L1413
train
Adds a whereExists clause to the current query
[ 30522, 2270, 3853, 2073, 10288, 5130, 1006, 8503, 1002, 2655, 5963, 1010, 1002, 22017, 20898, 1027, 1005, 1998, 1005, 1010, 1002, 2025, 1027, 6270, 1007, 1063, 1002, 23032, 1027, 1002, 2023, 1011, 1028, 2005, 6342, 2497, 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...
z-song/laravel-admin
src/Form.php
Form.disableReset
public function disableReset(bool $disable = true) { $this->builder()->getFooter()->disableReset($disable); return $this; }
php
public function disableReset(bool $disable = true) { $this->builder()->getFooter()->disableReset($disable); return $this; }
[ "public", "function", "disableReset", "(", "bool", "$", "disable", "=", "true", ")", "{", "$", "this", "->", "builder", "(", ")", "->", "getFooter", "(", ")", "->", "disableReset", "(", "$", "disable", ")", ";", "return", "$", "this", ";", "}" ]
Disable form reset. @param bool $disable @return $this @deprecated
[ "Disable", "form", "reset", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Form.php#L1279-L1284
train
Disable Reset of the page
[ 30522, 2270, 3853, 4487, 19150, 6072, 3388, 1006, 22017, 2140, 1002, 4487, 19150, 1027, 2995, 1007, 1063, 1002, 2023, 1011, 1028, 12508, 1006, 1007, 1011, 1028, 2131, 13064, 2121, 1006, 1007, 1011, 1028, 4487, 19150, 6072, 3388, 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/Security/Http/Authentication/CustomAuthenticationSuccessHandler.php
CustomAuthenticationSuccessHandler.onAuthenticationSuccess
public function onAuthenticationSuccess(Request $request, TokenInterface $token) { return $this->handler->onAuthenticationSuccess($request, $token); }
php
public function onAuthenticationSuccess(Request $request, TokenInterface $token) { return $this->handler->onAuthenticationSuccess($request, $token); }
[ "public", "function", "onAuthenticationSuccess", "(", "Request", "$", "request", ",", "TokenInterface", "$", "token", ")", "{", "return", "$", "this", "->", "handler", "->", "onAuthenticationSuccess", "(", "$", "request", ",", "$", "token", ")", ";", "}" ]
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Security/Http/Authentication/CustomAuthenticationSuccessHandler.php#L43-L46
train
Called when authentication is successful.
[ 30522, 2270, 3853, 2006, 4887, 10760, 16778, 10719, 6342, 9468, 7971, 1006, 5227, 1002, 5227, 1010, 19204, 18447, 2121, 12172, 1002, 19204, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 28213, 1011, 1028, 2006, 4887, 10760, 16778, 10719, 6342, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php
PdoSessionHandler.doAdvisoryLock
private function doAdvisoryLock(string $sessionId) { switch ($this->driver) { case 'mysql': // MySQL 5.7.5 and later enforces a maximum length on lock names of 64 characters. Previously, no limit was enforced. $lockId = \substr($sessionId, 0, 64); // should we handle the return value? 0 on timeout, null on error // we use a timeout of 50 seconds which is also the default for innodb_lock_wait_timeout $stmt = $this->pdo->prepare('SELECT GET_LOCK(:key, 50)'); $stmt->bindValue(':key', $lockId, \PDO::PARAM_STR); $stmt->execute(); $releaseStmt = $this->pdo->prepare('DO RELEASE_LOCK(:key)'); $releaseStmt->bindValue(':key', $lockId, \PDO::PARAM_STR); return $releaseStmt; case 'pgsql': // Obtaining an exclusive session level advisory lock requires an integer key. // When session.sid_bits_per_character > 4, the session id can contain non-hex-characters. // So we cannot just use hexdec(). if (4 === \PHP_INT_SIZE) { $sessionInt1 = $this->convertStringToInt($sessionId); $sessionInt2 = $this->convertStringToInt(substr($sessionId, 4, 4)); $stmt = $this->pdo->prepare('SELECT pg_advisory_lock(:key1, :key2)'); $stmt->bindValue(':key1', $sessionInt1, \PDO::PARAM_INT); $stmt->bindValue(':key2', $sessionInt2, \PDO::PARAM_INT); $stmt->execute(); $releaseStmt = $this->pdo->prepare('SELECT pg_advisory_unlock(:key1, :key2)'); $releaseStmt->bindValue(':key1', $sessionInt1, \PDO::PARAM_INT); $releaseStmt->bindValue(':key2', $sessionInt2, \PDO::PARAM_INT); } else { $sessionBigInt = $this->convertStringToInt($sessionId); $stmt = $this->pdo->prepare('SELECT pg_advisory_lock(:key)'); $stmt->bindValue(':key', $sessionBigInt, \PDO::PARAM_INT); $stmt->execute(); $releaseStmt = $this->pdo->prepare('SELECT pg_advisory_unlock(:key)'); $releaseStmt->bindValue(':key', $sessionBigInt, \PDO::PARAM_INT); } return $releaseStmt; case 'sqlite': throw new \DomainException('SQLite does not support advisory locks.'); default: throw new \DomainException(sprintf('Advisory locks are currently not implemented for PDO driver "%s".', $this->driver)); } }
php
private function doAdvisoryLock(string $sessionId) { switch ($this->driver) { case 'mysql': // MySQL 5.7.5 and later enforces a maximum length on lock names of 64 characters. Previously, no limit was enforced. $lockId = \substr($sessionId, 0, 64); // should we handle the return value? 0 on timeout, null on error // we use a timeout of 50 seconds which is also the default for innodb_lock_wait_timeout $stmt = $this->pdo->prepare('SELECT GET_LOCK(:key, 50)'); $stmt->bindValue(':key', $lockId, \PDO::PARAM_STR); $stmt->execute(); $releaseStmt = $this->pdo->prepare('DO RELEASE_LOCK(:key)'); $releaseStmt->bindValue(':key', $lockId, \PDO::PARAM_STR); return $releaseStmt; case 'pgsql': // Obtaining an exclusive session level advisory lock requires an integer key. // When session.sid_bits_per_character > 4, the session id can contain non-hex-characters. // So we cannot just use hexdec(). if (4 === \PHP_INT_SIZE) { $sessionInt1 = $this->convertStringToInt($sessionId); $sessionInt2 = $this->convertStringToInt(substr($sessionId, 4, 4)); $stmt = $this->pdo->prepare('SELECT pg_advisory_lock(:key1, :key2)'); $stmt->bindValue(':key1', $sessionInt1, \PDO::PARAM_INT); $stmt->bindValue(':key2', $sessionInt2, \PDO::PARAM_INT); $stmt->execute(); $releaseStmt = $this->pdo->prepare('SELECT pg_advisory_unlock(:key1, :key2)'); $releaseStmt->bindValue(':key1', $sessionInt1, \PDO::PARAM_INT); $releaseStmt->bindValue(':key2', $sessionInt2, \PDO::PARAM_INT); } else { $sessionBigInt = $this->convertStringToInt($sessionId); $stmt = $this->pdo->prepare('SELECT pg_advisory_lock(:key)'); $stmt->bindValue(':key', $sessionBigInt, \PDO::PARAM_INT); $stmt->execute(); $releaseStmt = $this->pdo->prepare('SELECT pg_advisory_unlock(:key)'); $releaseStmt->bindValue(':key', $sessionBigInt, \PDO::PARAM_INT); } return $releaseStmt; case 'sqlite': throw new \DomainException('SQLite does not support advisory locks.'); default: throw new \DomainException(sprintf('Advisory locks are currently not implemented for PDO driver "%s".', $this->driver)); } }
[ "private", "function", "doAdvisoryLock", "(", "string", "$", "sessionId", ")", "{", "switch", "(", "$", "this", "->", "driver", ")", "{", "case", "'mysql'", ":", "// MySQL 5.7.5 and later enforces a maximum length on lock names of 64 characters. Previously, no limit was enfor...
Executes an application-level lock on the database. @return \PDOStatement The statement that needs to be executed later to release the lock @throws \DomainException When an unsupported PDO driver is used @todo implement missing advisory locks - for oci using DBMS_LOCK.REQUEST - for sqlsrv using sp_getapplock with LockOwner = Session
[ "Executes", "an", "application", "-", "level", "lock", "on", "the", "database", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php#L679-L728
train
Executes the advisory lock on the database
[ 30522, 2797, 3853, 2079, 4215, 11365, 10253, 7878, 1006, 5164, 1002, 5219, 3593, 1007, 1063, 6942, 1006, 1002, 2023, 1011, 1028, 4062, 1007, 1063, 2553, 1005, 2026, 2015, 4160, 2140, 1005, 1024, 1013, 1013, 2026, 2015, 4160, 2140, 1019, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Cache/RateLimiter.php
RateLimiter.hit
public function hit($key, $decaySeconds = 60) { $this->cache->add( $key.':timer', $this->availableAt($decaySeconds), $decaySeconds ); $added = $this->cache->add($key, 0, $decaySeconds); $hits = (int) $this->cache->increment($key); if (! $added && $hits == 1) { $this->cache->put($key, 1, $decaySeconds); } return $hits; }
php
public function hit($key, $decaySeconds = 60) { $this->cache->add( $key.':timer', $this->availableAt($decaySeconds), $decaySeconds ); $added = $this->cache->add($key, 0, $decaySeconds); $hits = (int) $this->cache->increment($key); if (! $added && $hits == 1) { $this->cache->put($key, 1, $decaySeconds); } return $hits; }
[ "public", "function", "hit", "(", "$", "key", ",", "$", "decaySeconds", "=", "60", ")", "{", "$", "this", "->", "cache", "->", "add", "(", "$", "key", ".", "':timer'", ",", "$", "this", "->", "availableAt", "(", "$", "decaySeconds", ")", ",", "$", ...
Increment the counter for a given key for a given decay time. @param string $key @param int $decaySeconds @return int
[ "Increment", "the", "counter", "for", "a", "given", "key", "for", "a", "given", "decay", "time", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Cache/RateLimiter.php#L57-L72
train
Hit the cache for the given key
[ 30522, 2270, 3853, 2718, 1006, 1002, 3145, 1010, 1002, 13121, 3366, 8663, 5104, 1027, 3438, 1007, 1063, 1002, 2023, 1011, 1028, 17053, 1011, 1028, 5587, 1006, 1002, 3145, 1012, 1005, 1024, 25309, 1005, 1010, 1002, 2023, 1011, 1028, 2800, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/CoreAdminHome/Tasks.php
Tasks.notifyTrackingFailures
public function notifyTrackingFailures() { $failures = $this->trackingFailures->getAllFailures(); if (!empty($failures)) { $superUsers = Piwik::getAllSuperUserAccessEmailAddresses(); foreach ($superUsers as $login => $email) { $email = new TrackingFailuresEmail($login, $email, count($failures)); $email->send(); } } }
php
public function notifyTrackingFailures() { $failures = $this->trackingFailures->getAllFailures(); if (!empty($failures)) { $superUsers = Piwik::getAllSuperUserAccessEmailAddresses(); foreach ($superUsers as $login => $email) { $email = new TrackingFailuresEmail($login, $email, count($failures)); $email->send(); } } }
[ "public", "function", "notifyTrackingFailures", "(", ")", "{", "$", "failures", "=", "$", "this", "->", "trackingFailures", "->", "getAllFailures", "(", ")", ";", "if", "(", "!", "empty", "(", "$", "failures", ")", ")", "{", "$", "superUsers", "=", "Piwi...
To test execute the following command: `./console core:run-scheduled-tasks "Piwik\Plugins\CoreAdminHome\Tasks.notifyTrackingFailures"` @throws \Exception
[ "To", "test", "execute", "the", "following", "command", ":", ".", "/", "console", "core", ":", "run", "-", "scheduled", "-", "tasks", "Piwik", "\\", "Plugins", "\\", "CoreAdminHome", "\\", "Tasks", ".", "notifyTrackingFailures" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/CoreAdminHome/Tasks.php#L174-L184
train
Send tracking failures to all super users
[ 30522, 2270, 3853, 2025, 8757, 6494, 23177, 7011, 4014, 14900, 1006, 1007, 1063, 1002, 15428, 1027, 1002, 2023, 1011, 1028, 9651, 7011, 4014, 14900, 1011, 1028, 2131, 8095, 7011, 4014, 14900, 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...
laravel/framework
src/Illuminate/Cache/RedisStore.php
RedisStore.lock
public function lock($name, $seconds = 0, $owner = null) { return new RedisLock($this->connection(), $this->prefix.$name, $seconds, $owner); }
php
public function lock($name, $seconds = 0, $owner = null) { return new RedisLock($this->connection(), $this->prefix.$name, $seconds, $owner); }
[ "public", "function", "lock", "(", "$", "name", ",", "$", "seconds", "=", "0", ",", "$", "owner", "=", "null", ")", "{", "return", "new", "RedisLock", "(", "$", "this", "->", "connection", "(", ")", ",", "$", "this", "->", "prefix", ".", "$", "na...
Get a lock instance. @param string $name @param int $seconds @param string|null $owner @return \Illuminate\Contracts\Cache\Lock
[ "Get", "a", "lock", "instance", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Cache/RedisStore.php#L182-L185
train
Lock a key
[ 30522, 2270, 3853, 5843, 1006, 1002, 2171, 1010, 1002, 3823, 1027, 1014, 1010, 1002, 3954, 1027, 19701, 1007, 1063, 2709, 2047, 2417, 2483, 7878, 1006, 1002, 2023, 1011, 1028, 4434, 1006, 1007, 1010, 1002, 2023, 1011, 1028, 17576, 1012, 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...
PHPMailer/PHPMailer
src/PHPMailer.php
PHPMailer.isValidHost
public static function isValidHost($host) { //Simple syntax limits if (empty($host) or !is_string($host) or strlen($host) > 256 ) { return false; } //Looks like a bracketed IPv6 address if (trim($host, '[]') != $host) { return (bool) filter_var(trim($host, '[]'), FILTER_VALIDATE_IP, FILTER_FLAG_IPV6); } //If removing all the dots results in a numeric string, it must be an IPv4 address. //Need to check this first because otherwise things like `999.0.0.0` are considered valid host names if (is_numeric(str_replace('.', '', $host))) { //Is it a valid IPv4 address? return (bool) filter_var($host, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4); } if (filter_var('http://' . $host, FILTER_VALIDATE_URL)) { //Is it a syntactically valid hostname? return true; } return false; }
php
public static function isValidHost($host) { //Simple syntax limits if (empty($host) or !is_string($host) or strlen($host) > 256 ) { return false; } //Looks like a bracketed IPv6 address if (trim($host, '[]') != $host) { return (bool) filter_var(trim($host, '[]'), FILTER_VALIDATE_IP, FILTER_FLAG_IPV6); } //If removing all the dots results in a numeric string, it must be an IPv4 address. //Need to check this first because otherwise things like `999.0.0.0` are considered valid host names if (is_numeric(str_replace('.', '', $host))) { //Is it a valid IPv4 address? return (bool) filter_var($host, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4); } if (filter_var('http://' . $host, FILTER_VALIDATE_URL)) { //Is it a syntactically valid hostname? return true; } return false; }
[ "public", "static", "function", "isValidHost", "(", "$", "host", ")", "{", "//Simple syntax limits", "if", "(", "empty", "(", "$", "host", ")", "or", "!", "is_string", "(", "$", "host", ")", "or", "strlen", "(", "$", "host", ")", ">", "256", ")", "{"...
Validate whether a string contains a valid value to use as a hostname or IP address. IPv6 addresses must include [], e.g. `[::1]`, not just `::1`. @param string $host The host name or IP address to check @return bool
[ "Validate", "whether", "a", "string", "contains", "a", "valid", "value", "to", "use", "as", "a", "hostname", "or", "IP", "address", ".", "IPv6", "addresses", "must", "include", "[]", "e", ".", "g", ".", "[", "::", "1", "]", "not", "just", "::", "1", ...
3d7132341659a8a201adbc3ba11b1e202ee2857c
https://github.com/PHPMailer/PHPMailer/blob/3d7132341659a8a201adbc3ba11b1e202ee2857c/src/PHPMailer.php#L3660-L3685
train
Check if the given host is a valid hostname
[ 30522, 2270, 10763, 3853, 2003, 10175, 3593, 15006, 2102, 1006, 1002, 3677, 1007, 1063, 1013, 1013, 3722, 20231, 6537, 2065, 1006, 4064, 1006, 1002, 3677, 1007, 2030, 999, 2003, 1035, 5164, 1006, 1002, 3677, 1007, 2030, 2358, 20927, 2078, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/cms/classes/Router.php
Router.findByFile
public function findByFile($fileName, $parameters = []) { if (!strlen(File::extension($fileName))) { $fileName .= '.htm'; } $router = $this->getRouterObject(); return $router->url($fileName, $parameters); }
php
public function findByFile($fileName, $parameters = []) { if (!strlen(File::extension($fileName))) { $fileName .= '.htm'; } $router = $this->getRouterObject(); return $router->url($fileName, $parameters); }
[ "public", "function", "findByFile", "(", "$", "fileName", ",", "$", "parameters", "=", "[", "]", ")", "{", "if", "(", "!", "strlen", "(", "File", "::", "extension", "(", "$", "fileName", ")", ")", ")", "{", "$", "fileName", ".=", "'.htm'", ";", "}"...
Finds a URL by it's page. Returns the URL route for linking to the page and uses the supplied parameters in it's address. @param string $fileName Page file name. @param array $parameters Route parameters to consider in the URL. @return string A built URL matching the page route.
[ "Finds", "a", "URL", "by", "it", "s", "page", ".", "Returns", "the", "URL", "route", "for", "linking", "to", "the", "page", "and", "uses", "the", "supplied", "parameters", "in", "it", "s", "address", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/Router.php#L170-L178
train
Find a page by its file name
[ 30522, 2270, 3853, 2424, 3762, 8873, 2571, 1006, 1002, 5371, 18442, 1010, 1002, 11709, 1027, 1031, 1033, 1007, 1063, 2065, 1006, 999, 2358, 20927, 2078, 1006, 5371, 1024, 1024, 5331, 1006, 1002, 5371, 18442, 1007, 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/DependencyInjection/Dumper/XmlDumper.php
XmlDumper.convertParameters
private function convertParameters(array $parameters, $type, \DOMElement $parent, $keyAttribute = 'key') { $withKeys = array_keys($parameters) !== range(0, \count($parameters) - 1); foreach ($parameters as $key => $value) { $element = $this->document->createElement($type); if ($withKeys) { $element->setAttribute($keyAttribute, $key); } if ($value instanceof ServiceClosureArgument) { $value = $value->getValues()[0]; } if (\is_array($tag = $value)) { $element->setAttribute('type', 'collection'); $this->convertParameters($value, $type, $element, 'key'); } elseif ($value instanceof TaggedIteratorArgument || ($value instanceof ServiceLocatorArgument && $tag = $value->getTaggedIteratorArgument())) { $element->setAttribute('type', $value instanceof TaggedIteratorArgument ? 'tagged' : 'tagged_locator'); $element->setAttribute('tag', $tag->getTag()); if (null !== $tag->getIndexAttribute()) { $element->setAttribute('index-by', $tag->getIndexAttribute()); if (null !== $tag->getDefaultIndexMethod()) { $element->setAttribute('default-index-method', $tag->getDefaultIndexMethod()); } } } elseif ($value instanceof IteratorArgument) { $element->setAttribute('type', 'iterator'); $this->convertParameters($value->getValues(), $type, $element, 'key'); } elseif ($value instanceof ServiceLocatorArgument) { $element->setAttribute('type', 'service_locator'); $this->convertParameters($value->getValues(), $type, $element, 'key'); } elseif ($value instanceof Reference) { $element->setAttribute('type', 'service'); $element->setAttribute('id', (string) $value); $behavior = $value->getInvalidBehavior(); if (ContainerInterface::NULL_ON_INVALID_REFERENCE == $behavior) { $element->setAttribute('on-invalid', 'null'); } elseif (ContainerInterface::IGNORE_ON_INVALID_REFERENCE == $behavior) { $element->setAttribute('on-invalid', 'ignore'); } elseif (ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE == $behavior) { $element->setAttribute('on-invalid', 'ignore_uninitialized'); } } elseif ($value instanceof Definition) { $element->setAttribute('type', 'service'); $this->addService($value, null, $element); } elseif ($value instanceof Expression) { $element->setAttribute('type', 'expression'); $text = $this->document->createTextNode(self::phpToXml((string) $value)); $element->appendChild($text); } elseif (\is_string($value) && !preg_match('/^[^\x00-\x08\x0B\x0E-\x1A\x1C-\x1F\x7F]*+$/u', $value)) { $element->setAttribute('type', 'binary'); $text = $this->document->createTextNode(self::phpToXml(base64_encode($value))); $element->appendChild($text); } else { if (\in_array($value, ['null', 'true', 'false'], true)) { $element->setAttribute('type', 'string'); } $text = $this->document->createTextNode(self::phpToXml($value)); $element->appendChild($text); } $parent->appendChild($element); } }
php
private function convertParameters(array $parameters, $type, \DOMElement $parent, $keyAttribute = 'key') { $withKeys = array_keys($parameters) !== range(0, \count($parameters) - 1); foreach ($parameters as $key => $value) { $element = $this->document->createElement($type); if ($withKeys) { $element->setAttribute($keyAttribute, $key); } if ($value instanceof ServiceClosureArgument) { $value = $value->getValues()[0]; } if (\is_array($tag = $value)) { $element->setAttribute('type', 'collection'); $this->convertParameters($value, $type, $element, 'key'); } elseif ($value instanceof TaggedIteratorArgument || ($value instanceof ServiceLocatorArgument && $tag = $value->getTaggedIteratorArgument())) { $element->setAttribute('type', $value instanceof TaggedIteratorArgument ? 'tagged' : 'tagged_locator'); $element->setAttribute('tag', $tag->getTag()); if (null !== $tag->getIndexAttribute()) { $element->setAttribute('index-by', $tag->getIndexAttribute()); if (null !== $tag->getDefaultIndexMethod()) { $element->setAttribute('default-index-method', $tag->getDefaultIndexMethod()); } } } elseif ($value instanceof IteratorArgument) { $element->setAttribute('type', 'iterator'); $this->convertParameters($value->getValues(), $type, $element, 'key'); } elseif ($value instanceof ServiceLocatorArgument) { $element->setAttribute('type', 'service_locator'); $this->convertParameters($value->getValues(), $type, $element, 'key'); } elseif ($value instanceof Reference) { $element->setAttribute('type', 'service'); $element->setAttribute('id', (string) $value); $behavior = $value->getInvalidBehavior(); if (ContainerInterface::NULL_ON_INVALID_REFERENCE == $behavior) { $element->setAttribute('on-invalid', 'null'); } elseif (ContainerInterface::IGNORE_ON_INVALID_REFERENCE == $behavior) { $element->setAttribute('on-invalid', 'ignore'); } elseif (ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE == $behavior) { $element->setAttribute('on-invalid', 'ignore_uninitialized'); } } elseif ($value instanceof Definition) { $element->setAttribute('type', 'service'); $this->addService($value, null, $element); } elseif ($value instanceof Expression) { $element->setAttribute('type', 'expression'); $text = $this->document->createTextNode(self::phpToXml((string) $value)); $element->appendChild($text); } elseif (\is_string($value) && !preg_match('/^[^\x00-\x08\x0B\x0E-\x1A\x1C-\x1F\x7F]*+$/u', $value)) { $element->setAttribute('type', 'binary'); $text = $this->document->createTextNode(self::phpToXml(base64_encode($value))); $element->appendChild($text); } else { if (\in_array($value, ['null', 'true', 'false'], true)) { $element->setAttribute('type', 'string'); } $text = $this->document->createTextNode(self::phpToXml($value)); $element->appendChild($text); } $parent->appendChild($element); } }
[ "private", "function", "convertParameters", "(", "array", "$", "parameters", ",", "$", "type", ",", "\\", "DOMElement", "$", "parent", ",", "$", "keyAttribute", "=", "'key'", ")", "{", "$", "withKeys", "=", "array_keys", "(", "$", "parameters", ")", "!==",...
Converts parameters. @param array $parameters @param string $type @param \DOMElement $parent @param string $keyAttribute
[ "Converts", "parameters", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php#L274-L337
train
Convert parameters to DOM
[ 30522, 2797, 3853, 10463, 28689, 22828, 2015, 1006, 9140, 1002, 11709, 1010, 1002, 2828, 1010, 1032, 8514, 16930, 4765, 1002, 6687, 1010, 1002, 3145, 19321, 3089, 8569, 2618, 1027, 1005, 3145, 1005, 1007, 1063, 1002, 2007, 14839, 2015, 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/Db2.php
Zend_Db_Adapter_Db2.limit
public function limit($sql, $count, $offset = 0) { $count = intval($count); if ($count <= 0) { /** * @see Zend_Db_Adapter_Db2_Exception */ // require_once 'Zend/Db/Adapter/Db2/Exception.php'; throw new Zend_Db_Adapter_Db2_Exception("LIMIT argument count=$count is not valid"); } $offset = intval($offset); if ($offset < 0) { /** * @see Zend_Db_Adapter_Db2_Exception */ // require_once 'Zend/Db/Adapter/Db2/Exception.php'; throw new Zend_Db_Adapter_Db2_Exception("LIMIT argument offset=$offset is not valid"); } if ($offset == 0) { $limit_sql = $sql . " FETCH FIRST $count ROWS ONLY"; return $limit_sql; } /** * DB2 does not implement the LIMIT clause as some RDBMS do. * We have to simulate it with subqueries and ROWNUM. * Unfortunately because we use the column wildcard "*", * this puts an extra column into the query result set. */ $limit_sql = "SELECT z2.* FROM ( SELECT ROW_NUMBER() OVER() AS \"ZEND_DB_ROWNUM\", z1.* FROM ( " . $sql . " ) z1 ) z2 WHERE z2.zend_db_rownum BETWEEN " . ($offset+1) . " AND " . ($offset+$count); return $limit_sql; }
php
public function limit($sql, $count, $offset = 0) { $count = intval($count); if ($count <= 0) { /** * @see Zend_Db_Adapter_Db2_Exception */ // require_once 'Zend/Db/Adapter/Db2/Exception.php'; throw new Zend_Db_Adapter_Db2_Exception("LIMIT argument count=$count is not valid"); } $offset = intval($offset); if ($offset < 0) { /** * @see Zend_Db_Adapter_Db2_Exception */ // require_once 'Zend/Db/Adapter/Db2/Exception.php'; throw new Zend_Db_Adapter_Db2_Exception("LIMIT argument offset=$offset is not valid"); } if ($offset == 0) { $limit_sql = $sql . " FETCH FIRST $count ROWS ONLY"; return $limit_sql; } /** * DB2 does not implement the LIMIT clause as some RDBMS do. * We have to simulate it with subqueries and ROWNUM. * Unfortunately because we use the column wildcard "*", * this puts an extra column into the query result set. */ $limit_sql = "SELECT z2.* FROM ( SELECT ROW_NUMBER() OVER() AS \"ZEND_DB_ROWNUM\", z1.* FROM ( " . $sql . " ) z1 ) z2 WHERE z2.zend_db_rownum BETWEEN " . ($offset+1) . " AND " . ($offset+$count); return $limit_sql; }
[ "public", "function", "limit", "(", "$", "sql", ",", "$", "count", ",", "$", "offset", "=", "0", ")", "{", "$", "count", "=", "intval", "(", "$", "count", ")", ";", "if", "(", "$", "count", "<=", "0", ")", "{", "/**\n * @see Zend_Db_Adapt...
Adds an adapter-specific LIMIT clause to the SELECT statement. @param string $sql @param integer $count @param integer $offset OPTIONAL @return string
[ "Adds", "an", "adapter", "-", "specific", "LIMIT", "clause", "to", "the", "SELECT", "statement", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Adapter/Db2.php#L663-L703
train
Return the limit clause
[ 30522, 2270, 3853, 5787, 1006, 1002, 29296, 1010, 1002, 4175, 1010, 1002, 16396, 1027, 1014, 1007, 1063, 1002, 4175, 1027, 20014, 10175, 1006, 1002, 4175, 1007, 1025, 2065, 1006, 1002, 4175, 1026, 1027, 1014, 1007, 1063, 1013, 1008, 1008, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Db/Statement/Sqlsrv.php
Zend_Db_Statement_Sqlsrv.rowCount
public function rowCount() { if (!$this->_stmt) { return false; } if (!$this->_executed) { return 0; } $num_rows = sqlsrv_rows_affected($this->_stmt); // Strict check is necessary; 0 is a valid return value if ($num_rows === false) { // require_once 'Zend/Db/Statement/Sqlsrv/Exception.php'; throw new Zend_Db_Statement_Sqlsrv_Exception(sqlsrv_errors()); } return $num_rows; }
php
public function rowCount() { if (!$this->_stmt) { return false; } if (!$this->_executed) { return 0; } $num_rows = sqlsrv_rows_affected($this->_stmt); // Strict check is necessary; 0 is a valid return value if ($num_rows === false) { // require_once 'Zend/Db/Statement/Sqlsrv/Exception.php'; throw new Zend_Db_Statement_Sqlsrv_Exception(sqlsrv_errors()); } return $num_rows; }
[ "public", "function", "rowCount", "(", ")", "{", "if", "(", "!", "$", "this", "->", "_stmt", ")", "{", "return", "false", ";", "}", "if", "(", "!", "$", "this", "->", "_executed", ")", "{", "return", "0", ";", "}", "$", "num_rows", "=", "sqlsrv_r...
Returns the number of rows affected by the execution of the last INSERT, DELETE, or UPDATE statement executed by this statement object. @return int The number of rows affected. @throws Zend_Db_Statement_Exception
[ "Returns", "the", "number", "of", "rows", "affected", "by", "the", "execution", "of", "the", "last", "INSERT", "DELETE", "or", "UPDATE", "statement", "executed", "by", "this", "statement", "object", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Statement/Sqlsrv.php#L394-L413
train
Return the number of rows affected by the statement
[ 30522, 2270, 3853, 5216, 3597, 16671, 1006, 1007, 1063, 2065, 1006, 999, 1002, 2023, 1011, 1028, 1035, 2358, 20492, 1007, 1063, 2709, 6270, 1025, 1065, 2065, 1006, 999, 1002, 2023, 1011, 1028, 1035, 6472, 1007, 1063, 2709, 1014, 1025, 106...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/API/API.php
API.getBulkRequest
public function getBulkRequest($urls) { if (empty($urls)) { return array(); } $urls = array_map('urldecode', $urls); $urls = array_map(array('Piwik\Common', 'unsanitizeInputValue'), $urls); $result = array(); foreach ($urls as $url) { $params = Request::getRequestArrayFromString($url . '&format=php&serialize=0'); if (isset($params['urls']) && $params['urls'] == $urls) { // by default 'urls' is added to $params as Request::getRequestArrayFromString adds all $_GET/$_POST // default parameters unset($params['urls']); } if (!empty($params['segment']) && strpos($url, 'segment=') > -1) { // only unsanitize input when segment is actually present in URL, not when it was used from // $defaultRequest in Request::getRequestArrayFromString from $_GET/$_POST $params['segment'] = urlencode(Common::unsanitizeInputValue($params['segment'])); } $req = new Request($params); $result[] = $req->process(); } return $result; }
php
public function getBulkRequest($urls) { if (empty($urls)) { return array(); } $urls = array_map('urldecode', $urls); $urls = array_map(array('Piwik\Common', 'unsanitizeInputValue'), $urls); $result = array(); foreach ($urls as $url) { $params = Request::getRequestArrayFromString($url . '&format=php&serialize=0'); if (isset($params['urls']) && $params['urls'] == $urls) { // by default 'urls' is added to $params as Request::getRequestArrayFromString adds all $_GET/$_POST // default parameters unset($params['urls']); } if (!empty($params['segment']) && strpos($url, 'segment=') > -1) { // only unsanitize input when segment is actually present in URL, not when it was used from // $defaultRequest in Request::getRequestArrayFromString from $_GET/$_POST $params['segment'] = urlencode(Common::unsanitizeInputValue($params['segment'])); } $req = new Request($params); $result[] = $req->process(); } return $result; }
[ "public", "function", "getBulkRequest", "(", "$", "urls", ")", "{", "if", "(", "empty", "(", "$", "urls", ")", ")", "{", "return", "array", "(", ")", ";", "}", "$", "urls", "=", "array_map", "(", "'urldecode'", ",", "$", "urls", ")", ";", "$", "u...
Performs multiple API requests at once and returns every result. @param array $urls The array of API requests. @return array
[ "Performs", "multiple", "API", "requests", "at", "once", "and", "returns", "every", "result", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/API/API.php#L516-L545
train
Returns an array of HTTP requests for a list of URLs
[ 30522, 2270, 3853, 2131, 8569, 13687, 2890, 15500, 1006, 1002, 24471, 4877, 1007, 1063, 2065, 1006, 4064, 1006, 1002, 24471, 4877, 1007, 1007, 1063, 2709, 9140, 1006, 1007, 1025, 1065, 1002, 24471, 4877, 1027, 9140, 1035, 4949, 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...
matomo-org/matomo
core/Common.php
Common.getRandomString
public static function getRandomString($length = 16, $alphabet = "abcdefghijklmnoprstuvwxyz0123456789") { $chars = $alphabet; $str = ''; for ($i = 0; $i < $length; $i++) { $rand_key = self::getRandomInt(0, strlen($chars) - 1); $str .= substr($chars, $rand_key, 1); } return str_shuffle($str); }
php
public static function getRandomString($length = 16, $alphabet = "abcdefghijklmnoprstuvwxyz0123456789") { $chars = $alphabet; $str = ''; for ($i = 0; $i < $length; $i++) { $rand_key = self::getRandomInt(0, strlen($chars) - 1); $str .= substr($chars, $rand_key, 1); } return str_shuffle($str); }
[ "public", "static", "function", "getRandomString", "(", "$", "length", "=", "16", ",", "$", "alphabet", "=", "\"abcdefghijklmnoprstuvwxyz0123456789\"", ")", "{", "$", "chars", "=", "$", "alphabet", ";", "$", "str", "=", "''", ";", "for", "(", "$", "i", "...
Generate random string. @param int $length string length @param string $alphabet characters allowed in random string @return string random string with given length
[ "Generate", "random", "string", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Common.php#L643-L654
train
Get Random String
[ 30522, 2270, 10763, 3853, 2131, 13033, 22225, 18886, 3070, 1006, 1002, 3091, 1027, 2385, 1010, 1002, 12440, 1027, 1000, 5925, 3207, 2546, 28891, 15992, 13728, 3630, 18098, 3367, 2226, 2615, 2860, 18037, 2480, 24096, 21926, 19961, 2575, 2581, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Eloquent/Relations/HasOneOrMany.php
HasOneOrMany.getRelationExistenceQuery
public function getRelationExistenceQuery(Builder $query, Builder $parentQuery, $columns = ['*']) { if ($query->getQuery()->from == $parentQuery->getQuery()->from) { return $this->getRelationExistenceQueryForSelfRelation($query, $parentQuery, $columns); } return parent::getRelationExistenceQuery($query, $parentQuery, $columns); }
php
public function getRelationExistenceQuery(Builder $query, Builder $parentQuery, $columns = ['*']) { if ($query->getQuery()->from == $parentQuery->getQuery()->from) { return $this->getRelationExistenceQueryForSelfRelation($query, $parentQuery, $columns); } return parent::getRelationExistenceQuery($query, $parentQuery, $columns); }
[ "public", "function", "getRelationExistenceQuery", "(", "Builder", "$", "query", ",", "Builder", "$", "parentQuery", ",", "$", "columns", "=", "[", "'*'", "]", ")", "{", "if", "(", "$", "query", "->", "getQuery", "(", ")", "->", "from", "==", "$", "par...
Add the constraints for a relationship query. @param \Illuminate\Database\Eloquent\Builder $query @param \Illuminate\Database\Eloquent\Builder $parentQuery @param array|mixed $columns @return \Illuminate\Database\Eloquent\Builder
[ "Add", "the", "constraints", "for", "a", "relationship", "query", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Relations/HasOneOrMany.php#L321-L328
train
Get the relationship existence query for the parent table.
[ 30522, 2270, 3853, 2131, 16570, 3370, 10288, 27870, 5897, 4226, 2854, 1006, 12508, 1002, 23032, 1010, 12508, 1002, 6687, 4226, 2854, 1010, 1002, 7753, 1027, 1031, 1005, 1008, 1005, 1033, 1007, 1063, 2065, 1006, 1002, 23032, 1011, 1028, 2131...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Eloquent/Relations/BelongsTo.php
BelongsTo.getRelationExistenceQueryForSelfRelation
public function getRelationExistenceQueryForSelfRelation(Builder $query, Builder $parentQuery, $columns = ['*']) { $query->select($columns)->from( $query->getModel()->getTable().' as '.$hash = $this->getRelationCountHash() ); $query->getModel()->setTable($hash); return $query->whereColumn( $hash.'.'.$this->ownerKey, '=', $this->getQualifiedForeignKeyName() ); }
php
public function getRelationExistenceQueryForSelfRelation(Builder $query, Builder $parentQuery, $columns = ['*']) { $query->select($columns)->from( $query->getModel()->getTable().' as '.$hash = $this->getRelationCountHash() ); $query->getModel()->setTable($hash); return $query->whereColumn( $hash.'.'.$this->ownerKey, '=', $this->getQualifiedForeignKeyName() ); }
[ "public", "function", "getRelationExistenceQueryForSelfRelation", "(", "Builder", "$", "query", ",", "Builder", "$", "parentQuery", ",", "$", "columns", "=", "[", "'*'", "]", ")", "{", "$", "query", "->", "select", "(", "$", "columns", ")", "->", "from", "...
Add the constraints for a relationship query on the same table. @param \Illuminate\Database\Eloquent\Builder $query @param \Illuminate\Database\Eloquent\Builder $parentQuery @param array|mixed $columns @return \Illuminate\Database\Eloquent\Builder
[ "Add", "the", "constraints", "for", "a", "relationship", "query", "on", "the", "same", "table", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Relations/BelongsTo.php#L267-L278
train
Get Query for relation existence for self relation
[ 30522, 2270, 3853, 2131, 16570, 3370, 10288, 27870, 5897, 4226, 2854, 29278, 11246, 19699, 10581, 3508, 1006, 12508, 1002, 23032, 1010, 12508, 1002, 6687, 4226, 2854, 1010, 1002, 7753, 1027, 1031, 1005, 1008, 1005, 1033, 1007, 1063, 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...
matomo-org/matomo
core/Menu/MenuAbstract.php
MenuAbstract.applyRenames
private function applyRenames() { foreach ($this->renames as $rename) { $mainMenuOriginal = $rename[0]; $subMenuOriginal = $rename[1]; $mainMenuRenamed = $rename[2]; $subMenuRenamed = $rename[3]; // Are we changing a submenu? if (!empty($subMenuOriginal)) { if (isset($this->menu[$mainMenuOriginal][$subMenuOriginal])) { $save = $this->menu[$mainMenuOriginal][$subMenuOriginal]; $save['_name'] = $subMenuRenamed; unset($this->menu[$mainMenuOriginal][$subMenuOriginal]); $this->menu[$mainMenuRenamed][$subMenuRenamed] = $save; } } // Changing a first-level element elseif (isset($this->menu[$mainMenuOriginal])) { $save = $this->menu[$mainMenuOriginal]; $save['_name'] = $mainMenuRenamed; unset($this->menu[$mainMenuOriginal]); $this->menu[$mainMenuRenamed] = $save; } } }
php
private function applyRenames() { foreach ($this->renames as $rename) { $mainMenuOriginal = $rename[0]; $subMenuOriginal = $rename[1]; $mainMenuRenamed = $rename[2]; $subMenuRenamed = $rename[3]; // Are we changing a submenu? if (!empty($subMenuOriginal)) { if (isset($this->menu[$mainMenuOriginal][$subMenuOriginal])) { $save = $this->menu[$mainMenuOriginal][$subMenuOriginal]; $save['_name'] = $subMenuRenamed; unset($this->menu[$mainMenuOriginal][$subMenuOriginal]); $this->menu[$mainMenuRenamed][$subMenuRenamed] = $save; } } // Changing a first-level element elseif (isset($this->menu[$mainMenuOriginal])) { $save = $this->menu[$mainMenuOriginal]; $save['_name'] = $mainMenuRenamed; unset($this->menu[$mainMenuOriginal]); $this->menu[$mainMenuRenamed] = $save; } } }
[ "private", "function", "applyRenames", "(", ")", "{", "foreach", "(", "$", "this", "->", "renames", "as", "$", "rename", ")", "{", "$", "mainMenuOriginal", "=", "$", "rename", "[", "0", "]", ";", "$", "subMenuOriginal", "=", "$", "rename", "[", "1", ...
Applies renames to the menu.
[ "Applies", "renames", "to", "the", "menu", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Menu/MenuAbstract.php#L276-L300
train
Apply renames to menu
[ 30522, 2797, 3853, 6611, 7389, 14074, 2015, 1006, 1007, 1063, 18921, 6776, 1006, 1002, 2023, 1011, 1028, 14916, 14074, 2015, 2004, 1002, 14916, 14074, 1007, 1063, 1002, 2364, 3549, 19098, 3089, 24965, 1027, 1002, 14916, 14074, 1031, 1014, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Mail/Mailable.php
Mailable.buildRecipients
protected function buildRecipients($message) { foreach (['to', 'cc', 'bcc', 'replyTo'] as $type) { foreach ($this->{$type} as $recipient) { $message->{$type}($recipient['address'], $recipient['name']); } } return $this; }
php
protected function buildRecipients($message) { foreach (['to', 'cc', 'bcc', 'replyTo'] as $type) { foreach ($this->{$type} as $recipient) { $message->{$type}($recipient['address'], $recipient['name']); } } return $this; }
[ "protected", "function", "buildRecipients", "(", "$", "message", ")", "{", "foreach", "(", "[", "'to'", ",", "'cc'", ",", "'bcc'", ",", "'replyTo'", "]", "as", "$", "type", ")", "{", "foreach", "(", "$", "this", "->", "{", "$", "type", "}", "as", "...
Add all of the recipients to the message. @param \Illuminate\Mail\Message $message @return $this
[ "Add", "all", "of", "the", "recipients", "to", "the", "message", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Mail/Mailable.php#L330-L339
train
Build the recipients of the message
[ 30522, 5123, 3853, 3857, 2890, 6895, 14756, 7666, 1006, 1002, 4471, 1007, 1063, 18921, 6776, 1006, 1031, 1005, 2000, 1005, 1010, 1005, 10507, 1005, 1010, 1005, 4647, 2278, 1005, 1010, 1005, 7514, 3406, 1005, 1033, 2004, 1002, 2828, 1007, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/CoreAdminHome/Tasks.php
Tasks.purgeOrphanedArchives
public function purgeOrphanedArchives() { $segmentHashesByIdSite = $this->getSegmentHashesByIdSite(); $archiveTables = ArchiveTableCreator::getTablesArchivesInstalled('numeric'); $datesPurged = array(); foreach ($archiveTables as $table) { $date = ArchiveTableCreator::getDateFromTableName($table); list($year, $month) = explode('_', $date); $dateObj = Date::factory("$year-$month-15"); $this->archivePurger->purgeDeletedSiteArchives($dateObj); $this->archivePurger->purgeDeletedSegmentArchives($dateObj, $segmentHashesByIdSite); $datesPurged[$date] = true; } }
php
public function purgeOrphanedArchives() { $segmentHashesByIdSite = $this->getSegmentHashesByIdSite(); $archiveTables = ArchiveTableCreator::getTablesArchivesInstalled('numeric'); $datesPurged = array(); foreach ($archiveTables as $table) { $date = ArchiveTableCreator::getDateFromTableName($table); list($year, $month) = explode('_', $date); $dateObj = Date::factory("$year-$month-15"); $this->archivePurger->purgeDeletedSiteArchives($dateObj); $this->archivePurger->purgeDeletedSegmentArchives($dateObj, $segmentHashesByIdSite); $datesPurged[$date] = true; } }
[ "public", "function", "purgeOrphanedArchives", "(", ")", "{", "$", "segmentHashesByIdSite", "=", "$", "this", "->", "getSegmentHashesByIdSite", "(", ")", ";", "$", "archiveTables", "=", "ArchiveTableCreator", "::", "getTablesArchivesInstalled", "(", "'numeric'", ")", ...
To test execute the following command: `./console core:run-scheduled-tasks "Piwik\Plugins\CoreAdminHome\Tasks.purgeOrphanedArchives"` @throws \Exception
[ "To", "test", "execute", "the", "following", "command", ":", ".", "/", "console", "core", ":", "run", "-", "scheduled", "-", "tasks", "Piwik", "\\", "Plugins", "\\", "CoreAdminHome", "\\", "Tasks", ".", "purgeOrphanedArchives" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/CoreAdminHome/Tasks.php#L271-L288
train
Purges archive tables that have been deleted since the last stage
[ 30522, 2270, 3853, 24694, 2953, 21890, 7228, 2906, 5428, 6961, 1006, 1007, 1063, 1002, 6903, 14949, 15689, 3762, 9821, 4221, 1027, 1002, 2023, 1011, 1028, 4152, 13910, 3672, 14949, 15689, 3762, 9821, 4221, 1006, 1007, 1025, 1002, 8756, 1088...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Filesystem/Filesystem.php
Filesystem.tempnam
public function tempnam($dir, $prefix) { list($scheme, $hierarchy) = $this->getSchemeAndHierarchy($dir); // If no scheme or scheme is "file" or "gs" (Google Cloud) create temp file in local filesystem if (null === $scheme || 'file' === $scheme || 'gs' === $scheme) { $tmpFile = @tempnam($hierarchy, $prefix); // If tempnam failed or no scheme return the filename otherwise prepend the scheme if (false !== $tmpFile) { if (null !== $scheme && 'gs' !== $scheme) { return $scheme.'://'.$tmpFile; } return $tmpFile; } throw new IOException('A temporary file could not be created.'); } // Loop until we create a valid temp file or have reached 10 attempts for ($i = 0; $i < 10; ++$i) { // Create a unique filename $tmpFile = $dir.'/'.$prefix.uniqid(mt_rand(), true); // Use fopen instead of file_exists as some streams do not support stat // Use mode 'x+' to atomically check existence and create to avoid a TOCTOU vulnerability $handle = @fopen($tmpFile, 'x+'); // If unsuccessful restart the loop if (false === $handle) { continue; } // Close the file if it was successfully opened @fclose($handle); return $tmpFile; } throw new IOException('A temporary file could not be created.'); }
php
public function tempnam($dir, $prefix) { list($scheme, $hierarchy) = $this->getSchemeAndHierarchy($dir); // If no scheme or scheme is "file" or "gs" (Google Cloud) create temp file in local filesystem if (null === $scheme || 'file' === $scheme || 'gs' === $scheme) { $tmpFile = @tempnam($hierarchy, $prefix); // If tempnam failed or no scheme return the filename otherwise prepend the scheme if (false !== $tmpFile) { if (null !== $scheme && 'gs' !== $scheme) { return $scheme.'://'.$tmpFile; } return $tmpFile; } throw new IOException('A temporary file could not be created.'); } // Loop until we create a valid temp file or have reached 10 attempts for ($i = 0; $i < 10; ++$i) { // Create a unique filename $tmpFile = $dir.'/'.$prefix.uniqid(mt_rand(), true); // Use fopen instead of file_exists as some streams do not support stat // Use mode 'x+' to atomically check existence and create to avoid a TOCTOU vulnerability $handle = @fopen($tmpFile, 'x+'); // If unsuccessful restart the loop if (false === $handle) { continue; } // Close the file if it was successfully opened @fclose($handle); return $tmpFile; } throw new IOException('A temporary file could not be created.'); }
[ "public", "function", "tempnam", "(", "$", "dir", ",", "$", "prefix", ")", "{", "list", "(", "$", "scheme", ",", "$", "hierarchy", ")", "=", "$", "this", "->", "getSchemeAndHierarchy", "(", "$", "dir", ")", ";", "// If no scheme or scheme is \"file\" or \"gs...
Creates a temporary file with support for custom stream wrappers. @param string $dir The directory where the temporary filename will be created @param string $prefix The prefix of the generated temporary filename Note: Windows uses only the first three characters of prefix @return string The new temporary filename (with path), or throw an exception on failure
[ "Creates", "a", "temporary", "file", "with", "support", "for", "custom", "stream", "wrappers", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Filesystem/Filesystem.php#L620-L661
train
Create a unique filename in local filesystem
[ 30522, 2270, 3853, 8915, 8737, 13129, 1006, 1002, 16101, 1010, 1002, 17576, 1007, 1063, 2862, 1006, 1002, 5679, 1010, 1002, 12571, 1007, 1027, 1002, 2023, 1011, 1028, 4152, 5403, 4168, 5685, 4048, 6906, 29389, 1006, 1002, 16101, 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...
symfony/symfony
src/Symfony/Bundle/FrameworkBundle/Controller/ControllerTrait.php
ControllerTrait.isCsrfTokenValid
protected function isCsrfTokenValid(string $id, ?string $token): bool { if (!$this->container->has('security.csrf.token_manager')) { throw new \LogicException('CSRF protection is not enabled in your application. Enable it with the "csrf_protection" key in "config/packages/framework.yaml".'); } return $this->container->get('security.csrf.token_manager')->isTokenValid(new CsrfToken($id, $token)); }
php
protected function isCsrfTokenValid(string $id, ?string $token): bool { if (!$this->container->has('security.csrf.token_manager')) { throw new \LogicException('CSRF protection is not enabled in your application. Enable it with the "csrf_protection" key in "config/packages/framework.yaml".'); } return $this->container->get('security.csrf.token_manager')->isTokenValid(new CsrfToken($id, $token)); }
[ "protected", "function", "isCsrfTokenValid", "(", "string", "$", "id", ",", "?", "string", "$", "token", ")", ":", "bool", "{", "if", "(", "!", "$", "this", "->", "container", "->", "has", "(", "'security.csrf.token_manager'", ")", ")", "{", "throw", "ne...
Checks the validity of a CSRF token. @param string $id The id used when generating the token @param string|null $token The actual token sent with the request that should be validated @final
[ "Checks", "the", "validity", "of", "a", "CSRF", "token", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/FrameworkBundle/Controller/ControllerTrait.php#L388-L395
train
Checks if a CSRF token is valid
[ 30522, 5123, 3853, 2003, 6169, 12881, 18715, 2368, 10175, 3593, 1006, 5164, 1002, 8909, 1010, 1029, 5164, 1002, 19204, 1007, 1024, 22017, 2140, 1063, 2065, 1006, 999, 1002, 2023, 1011, 1028, 11661, 1011, 1028, 2038, 1006, 1005, 3036, 1012, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Mail/Storage/Imap.php
Zend_Mail_Storage_Imap.getRawContent
public function getRawContent($id, $part = null) { if ($part !== null) { // TODO: implement /** * @see Zend_Mail_Storage_Exception */ // require_once 'Zend/Mail/Storage/Exception.php'; throw new Zend_Mail_Storage_Exception('not implemented'); } return $this->_protocol->fetch('RFC822.TEXT', $id); }
php
public function getRawContent($id, $part = null) { if ($part !== null) { // TODO: implement /** * @see Zend_Mail_Storage_Exception */ // require_once 'Zend/Mail/Storage/Exception.php'; throw new Zend_Mail_Storage_Exception('not implemented'); } return $this->_protocol->fetch('RFC822.TEXT', $id); }
[ "public", "function", "getRawContent", "(", "$", "id", ",", "$", "part", "=", "null", ")", "{", "if", "(", "$", "part", "!==", "null", ")", "{", "// TODO: implement", "/**\n * @see Zend_Mail_Storage_Exception\n */", "// require_once 'Zend/Mail/St...
/* Get raw content of message or part @param int $id number of message @param null|array|string $part path to part or null for messsage content @return string raw content @throws Zend_Mail_Protocol_Exception @throws Zend_Mail_Storage_Exception
[ "/", "*", "Get", "raw", "content", "of", "message", "or", "part" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Mail/Storage/Imap.php#L209-L221
train
Get raw content
[ 30522, 2270, 3853, 2131, 2527, 16526, 28040, 3372, 1006, 1002, 8909, 1010, 1002, 2112, 1027, 19701, 1007, 1063, 2065, 1006, 1002, 2112, 999, 1027, 1027, 19701, 1007, 1063, 1013, 1013, 28681, 2080, 1024, 10408, 1013, 1008, 1008, 1008, 1030, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/HasMany.php
HasMany.formatValidationAttribute
protected function formatValidationAttribute($input, $label, $column) { $new = $attributes = []; if (is_array($column)) { foreach ($column as $index => $col) { $new[$col.$index] = $col; } } foreach (array_keys(Arr::dot($input)) as $key) { if (is_string($column)) { if (Str::endsWith($key, ".$column")) { $attributes[$key] = $label; } } else { foreach ($new as $k => $val) { if (Str::endsWith($key, ".$k")) { $attributes[$key] = $label."[$val]"; } } } } return $attributes; }
php
protected function formatValidationAttribute($input, $label, $column) { $new = $attributes = []; if (is_array($column)) { foreach ($column as $index => $col) { $new[$col.$index] = $col; } } foreach (array_keys(Arr::dot($input)) as $key) { if (is_string($column)) { if (Str::endsWith($key, ".$column")) { $attributes[$key] = $label; } } else { foreach ($new as $k => $val) { if (Str::endsWith($key, ".$k")) { $attributes[$key] = $label."[$val]"; } } } } return $attributes; }
[ "protected", "function", "formatValidationAttribute", "(", "$", "input", ",", "$", "label", ",", "$", "column", ")", "{", "$", "new", "=", "$", "attributes", "=", "[", "]", ";", "if", "(", "is_array", "(", "$", "column", ")", ")", "{", "foreach", "("...
Format validation attributes. @param array $input @param string $label @param string $column @return array
[ "Format", "validation", "attributes", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Form/Field/HasMany.php#L173-L198
train
Format validation attribute
[ 30522, 5123, 3853, 4289, 10175, 8524, 3508, 19321, 3089, 8569, 2618, 1006, 1002, 7953, 1010, 1002, 3830, 1010, 1002, 5930, 1007, 1063, 1002, 2047, 1027, 1002, 12332, 1027, 1031, 1033, 1025, 2065, 1006, 2003, 1035, 9140, 1006, 1002, 5930, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Events/DiscoverEvents.php
DiscoverEvents.within
public static function within($listenerPath, $basePath) { return collect(static::getListenerEvents( (new Finder)->files()->in($listenerPath), $basePath ))->mapToDictionary(function ($event, $listener) { return [$event => $listener]; })->all(); }
php
public static function within($listenerPath, $basePath) { return collect(static::getListenerEvents( (new Finder)->files()->in($listenerPath), $basePath ))->mapToDictionary(function ($event, $listener) { return [$event => $listener]; })->all(); }
[ "public", "static", "function", "within", "(", "$", "listenerPath", ",", "$", "basePath", ")", "{", "return", "collect", "(", "static", "::", "getListenerEvents", "(", "(", "new", "Finder", ")", "->", "files", "(", ")", "->", "in", "(", "$", "listenerPat...
Get all of the events and listeners by searching the given listener directory. @param string $listenerPath @param string $basePath @return array
[ "Get", "all", "of", "the", "events", "and", "listeners", "by", "searching", "the", "given", "listener", "directory", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Foundation/Events/DiscoverEvents.php#L20-L27
train
Get all events from a listener path and return a dictionary with the event name as key and the listener s name as value
[ 30522, 2270, 10763, 3853, 2306, 1006, 1002, 19373, 15069, 1010, 1002, 2918, 15069, 1007, 1063, 2709, 8145, 1006, 10763, 1024, 1024, 2131, 9863, 24454, 18697, 7666, 1006, 1006, 2047, 2424, 2121, 1007, 1011, 1028, 6764, 1006, 1007, 1011, 1028...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/backend/classes/FormField.php
FormField.getValueFromData
public function getValueFromData($data, $default = null) { $fieldName = $this->valueFrom ?: $this->fieldName; return $this->getFieldNameFromData($fieldName, $data, $default); }
php
public function getValueFromData($data, $default = null) { $fieldName = $this->valueFrom ?: $this->fieldName; return $this->getFieldNameFromData($fieldName, $data, $default); }
[ "public", "function", "getValueFromData", "(", "$", "data", ",", "$", "default", "=", "null", ")", "{", "$", "fieldName", "=", "$", "this", "->", "valueFrom", "?", ":", "$", "this", "->", "fieldName", ";", "return", "$", "this", "->", "getFieldNameFromDa...
Returns this fields value from a supplied data set, which can be an array or a model or another generic collection. @param mixed $data @param mixed $default @return mixed
[ "Returns", "this", "fields", "value", "from", "a", "supplied", "data", "set", "which", "can", "be", "an", "array", "or", "a", "model", "or", "another", "generic", "collection", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/classes/FormField.php#L620-L624
train
Get value from data
[ 30522, 2270, 3853, 2131, 10175, 5657, 19699, 5358, 2850, 2696, 1006, 1002, 2951, 1010, 1002, 12398, 1027, 19701, 1007, 1063, 1002, 2492, 18442, 1027, 1002, 2023, 1011, 1028, 3643, 19699, 5358, 1029, 1024, 1002, 2023, 1011, 1028, 2492, 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...
laravel/framework
src/Illuminate/Database/Query/Builder.php
Builder.whereIntegerNotInRaw
public function whereIntegerNotInRaw($column, $values, $boolean = 'and') { return $this->whereIntegerInRaw($column, $values, $boolean, true); }
php
public function whereIntegerNotInRaw($column, $values, $boolean = 'and') { return $this->whereIntegerInRaw($column, $values, $boolean, true); }
[ "public", "function", "whereIntegerNotInRaw", "(", "$", "column", ",", "$", "values", ",", "$", "boolean", "=", "'and'", ")", "{", "return", "$", "this", "->", "whereIntegerInRaw", "(", "$", "column", ",", "$", "values", ",", "$", "boolean", ",", "true",...
Add a "where not in raw" clause for integer values to the query. @param string $column @param \Illuminate\Contracts\Support\Arrayable|array $values @param string $boolean @return $this
[ "Add", "a", "where", "not", "in", "raw", "clause", "for", "integer", "values", "to", "the", "query", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Query/Builder.php#L991-L994
train
Where Integer Not In Raw
[ 30522, 2270, 3853, 16726, 2618, 4590, 17048, 2378, 2527, 2860, 1006, 1002, 5930, 1010, 1002, 5300, 1010, 1002, 22017, 20898, 1027, 1005, 1998, 1005, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 16726, 2618, 4590, 2378, 2527, 2860, 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/Auth/Access/AuthorizesRequests.php
AuthorizesRequests.authorizeResource
public function authorizeResource($model, $parameter = null, array $options = [], $request = null) { $parameter = $parameter ?: Str::snake(class_basename($model)); $middleware = []; foreach ($this->resourceAbilityMap() as $method => $ability) { $modelName = in_array($method, $this->resourceMethodsWithoutModels()) ? $model : $parameter; $middleware["can:{$ability},{$modelName}"][] = $method; } foreach ($middleware as $middlewareName => $methods) { $this->middleware($middlewareName, $options)->only($methods); } }
php
public function authorizeResource($model, $parameter = null, array $options = [], $request = null) { $parameter = $parameter ?: Str::snake(class_basename($model)); $middleware = []; foreach ($this->resourceAbilityMap() as $method => $ability) { $modelName = in_array($method, $this->resourceMethodsWithoutModels()) ? $model : $parameter; $middleware["can:{$ability},{$modelName}"][] = $method; } foreach ($middleware as $middlewareName => $methods) { $this->middleware($middlewareName, $options)->only($methods); } }
[ "public", "function", "authorizeResource", "(", "$", "model", ",", "$", "parameter", "=", "null", ",", "array", "$", "options", "=", "[", "]", ",", "$", "request", "=", "null", ")", "{", "$", "parameter", "=", "$", "parameter", "?", ":", "Str", "::",...
Authorize a resource action based on the incoming request. @param string $model @param string|null $parameter @param array $options @param \Illuminate\Http\Request|null $request @return void
[ "Authorize", "a", "resource", "action", "based", "on", "the", "incoming", "request", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Foundation/Auth/Access/AuthorizesRequests.php#L83-L98
train
Authorize a resource
[ 30522, 2270, 3853, 3166, 17629, 2229, 8162, 3401, 1006, 1002, 30524, 7488, 1006, 2465, 1035, 2918, 18442, 1006, 1002, 2944, 1007, 1007, 1025, 1002, 2690, 8059, 1027, 1031, 1033, 1025, 18921, 6776, 1006, 1002, 2023, 1011, 1028, 7692, 8010, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/VersionManager.php
VersionManager.getDatabaseHistory
protected function getDatabaseHistory($code) { if ($this->databaseHistory !== null && array_key_exists($code, $this->databaseHistory)) { return $this->databaseHistory[$code]; } $historyInfo = Db::table('system_plugin_history') ->where('code', $code) ->orderBy('id') ->get() ->all(); return $this->databaseHistory[$code] = $historyInfo; }
php
protected function getDatabaseHistory($code) { if ($this->databaseHistory !== null && array_key_exists($code, $this->databaseHistory)) { return $this->databaseHistory[$code]; } $historyInfo = Db::table('system_plugin_history') ->where('code', $code) ->orderBy('id') ->get() ->all(); return $this->databaseHistory[$code] = $historyInfo; }
[ "protected", "function", "getDatabaseHistory", "(", "$", "code", ")", "{", "if", "(", "$", "this", "->", "databaseHistory", "!==", "null", "&&", "array_key_exists", "(", "$", "code", ",", "$", "this", "->", "databaseHistory", ")", ")", "{", "return", "$", ...
Returns all the update history for a plugin.
[ "Returns", "all", "the", "update", "history", "for", "a", "plugin", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/VersionManager.php#L431-L444
train
Get the database history for a plugin
[ 30522, 5123, 3853, 2131, 2850, 2696, 15058, 24158, 7062, 1006, 1002, 3642, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 7809, 24158, 7062, 999, 1027, 1027, 19701, 1004, 1004, 9140, 1035, 3145, 1035, 6526, 1006, 1002, 3642, 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
plugins/SitesManager/Model.php
Model.getAllKnownUrlsForAllSites
public function getAllKnownUrlsForAllSites() { $db = $this->getDb(); $mainUrls = $db->fetchAll("SELECT idsite, main_url as url FROM " . Common::prefixTable("site")); $aliasUrls = $db->fetchAll("SELECT idsite, url FROM " . Common::prefixTable("site_url")); return array_merge($mainUrls, $aliasUrls); }
php
public function getAllKnownUrlsForAllSites() { $db = $this->getDb(); $mainUrls = $db->fetchAll("SELECT idsite, main_url as url FROM " . Common::prefixTable("site")); $aliasUrls = $db->fetchAll("SELECT idsite, url FROM " . Common::prefixTable("site_url")); return array_merge($mainUrls, $aliasUrls); }
[ "public", "function", "getAllKnownUrlsForAllSites", "(", ")", "{", "$", "db", "=", "$", "this", "->", "getDb", "(", ")", ";", "$", "mainUrls", "=", "$", "db", "->", "fetchAll", "(", "\"SELECT idsite, main_url as url FROM \"", ".", "Common", "::", "prefixTable"...
Returns the list of alias URLs registered for the given idSite. The website ID must be valid when calling this method! @param int $idSite @return array list of alias URLs
[ "Returns", "the", "list", "of", "alias", "URLs", "registered", "for", "the", "given", "idSite", ".", "The", "website", "ID", "must", "be", "valid", "when", "calling", "this", "method!" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/SitesManager/Model.php#L304-L311
train
Get all known urls for all sites
[ 30522, 2270, 3853, 2131, 8095, 2243, 19779, 11231, 12190, 22747, 6525, 12718, 7616, 1006, 1007, 1063, 1002, 16962, 1027, 1002, 2023, 1011, 1028, 2131, 18939, 1006, 1007, 1025, 1002, 2364, 3126, 4877, 1027, 1002, 16962, 1011, 1028, 18584, 80...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...