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
libs/HTML/QuickForm2/Element/Select.php
HTML_QuickForm2_Element_Select.getValue
public function getValue() { if (!empty($this->attributes['disabled']) || 0 == count($this->values) || ($this->data['intrinsic_validation'] && (0 == count($this->optionContainer) || 0 == count($this->possibleValues))) ) { return null; } $values = array(); foreach ($this->values as $value) { if (!$this->data['intrinsic_validation'] || !empty($this->possibleValues[$value])) { $values[] = $value; } } if (0 == count($values)) { return null; } elseif (!empty($this->attributes['multiple'])) { return $this->applyFilters($values); } elseif (1 == count($values)) { return $this->applyFilters($values[0]); } else { // The <select> is not multiple, but several options are to be // selected. At least IE and Mozilla select the last selected // option in this case, we should do the same foreach ($this->optionContainer->getRecursiveIterator() as $child) { if (is_array($child) && in_array($child['attr']['value'], $values)) { $lastValue = $child['attr']['value']; } } return $this->applyFilters($lastValue); } }
php
public function getValue() { if (!empty($this->attributes['disabled']) || 0 == count($this->values) || ($this->data['intrinsic_validation'] && (0 == count($this->optionContainer) || 0 == count($this->possibleValues))) ) { return null; } $values = array(); foreach ($this->values as $value) { if (!$this->data['intrinsic_validation'] || !empty($this->possibleValues[$value])) { $values[] = $value; } } if (0 == count($values)) { return null; } elseif (!empty($this->attributes['multiple'])) { return $this->applyFilters($values); } elseif (1 == count($values)) { return $this->applyFilters($values[0]); } else { // The <select> is not multiple, but several options are to be // selected. At least IE and Mozilla select the last selected // option in this case, we should do the same foreach ($this->optionContainer->getRecursiveIterator() as $child) { if (is_array($child) && in_array($child['attr']['value'], $values)) { $lastValue = $child['attr']['value']; } } return $this->applyFilters($lastValue); } }
[ "public", "function", "getValue", "(", ")", "{", "if", "(", "!", "empty", "(", "$", "this", "->", "attributes", "[", "'disabled'", "]", ")", "||", "0", "==", "count", "(", "$", "this", "->", "values", ")", "||", "(", "$", "this", "->", "data", "[...
Returns the value of the <select> element Please note that the returned value may not necessarily be equal to that passed to {@link setValue()}. It passes "intrinsic validation" confirming that such value could possibly be submitted by this <select> element. Specifically, this method will return null if the elements "disabled" attribute is set, it will not return values if there are no options having such a "value" attribute or if such options' "disabled" attribute is set. It will also only return a scalar value for single selects, mimicking the common browsers' behaviour. @return mixed "value" attribute of selected option in case of single select, array of selected options' "value" attributes in case of multiple selects, null if no options selected
[ "Returns", "the", "value", "of", "the", "<select", ">", "element" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/HTML/QuickForm2/Element/Select.php#L423-L455
train
Returns the value of the select field
[ 30522, 2270, 3853, 2131, 10175, 5657, 1006, 1007, 1063, 2065, 1006, 999, 4064, 1006, 1002, 2023, 1011, 1028, 12332, 1031, 1005, 9776, 1005, 1033, 1007, 1064, 1064, 1014, 1027, 1027, 4175, 1006, 1002, 2023, 1011, 1028, 5300, 1007, 1064, 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/Support/Collection.php
Collection.duplicates
public function duplicates($callback = null, $strict = false) { $items = $this->map($this->valueRetriever($callback)); $uniqueItems = $items->unique(null, $strict); $compare = $this->duplicateComparator($strict); $duplicates = new static; foreach ($items as $key => $value) { if ($uniqueItems->isNotEmpty() && $compare($value, $uniqueItems->first())) { $uniqueItems->shift(); } else { $duplicates[$key] = $value; } } return $duplicates; }
php
public function duplicates($callback = null, $strict = false) { $items = $this->map($this->valueRetriever($callback)); $uniqueItems = $items->unique(null, $strict); $compare = $this->duplicateComparator($strict); $duplicates = new static; foreach ($items as $key => $value) { if ($uniqueItems->isNotEmpty() && $compare($value, $uniqueItems->first())) { $uniqueItems->shift(); } else { $duplicates[$key] = $value; } } return $duplicates; }
[ "public", "function", "duplicates", "(", "$", "callback", "=", "null", ",", "$", "strict", "=", "false", ")", "{", "$", "items", "=", "$", "this", "->", "map", "(", "$", "this", "->", "valueRetriever", "(", "$", "callback", ")", ")", ";", "$", "uni...
Retrieve duplicate items from the collection. @param callable|null $callback @param bool $strict @return static
[ "Retrieve", "duplicate", "items", "from", "the", "collection", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Support/Collection.php#L415-L434
train
Get duplicate items
[ 30522, 2270, 3853, 24473, 2015, 1006, 1002, 2655, 5963, 1027, 19701, 1010, 1002, 9384, 1027, 6270, 1007, 1063, 1002, 5167, 1027, 1002, 2023, 1011, 1028, 4949, 1006, 1002, 2023, 1011, 1028, 3643, 13465, 7373, 6299, 1006, 1002, 2655, 5963, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Filesystem/Filesystem.php
Filesystem.rename
public function rename($origin, $target, $overwrite = false) { // we check that target does not exist if (!$overwrite && $this->isReadable($target)) { throw new IOException(sprintf('Cannot rename because the target "%s" already exists.', $target), 0, null, $target); } if (true !== @rename($origin, $target)) { if (is_dir($origin)) { // See https://bugs.php.net/bug.php?id=54097 & http://php.net/manual/en/function.rename.php#113943 $this->mirror($origin, $target, null, ['override' => $overwrite, 'delete' => $overwrite]); $this->remove($origin); return; } throw new IOException(sprintf('Cannot rename "%s" to "%s".', $origin, $target), 0, null, $target); } }
php
public function rename($origin, $target, $overwrite = false) { // we check that target does not exist if (!$overwrite && $this->isReadable($target)) { throw new IOException(sprintf('Cannot rename because the target "%s" already exists.', $target), 0, null, $target); } if (true !== @rename($origin, $target)) { if (is_dir($origin)) { // See https://bugs.php.net/bug.php?id=54097 & http://php.net/manual/en/function.rename.php#113943 $this->mirror($origin, $target, null, ['override' => $overwrite, 'delete' => $overwrite]); $this->remove($origin); return; } throw new IOException(sprintf('Cannot rename "%s" to "%s".', $origin, $target), 0, null, $target); } }
[ "public", "function", "rename", "(", "$", "origin", ",", "$", "target", ",", "$", "overwrite", "=", "false", ")", "{", "// we check that target does not exist", "if", "(", "!", "$", "overwrite", "&&", "$", "this", "->", "isReadable", "(", "$", "target", ")...
Renames a file or a directory. @param string $origin The origin filename or directory @param string $target The new filename or directory @param bool $overwrite Whether to overwrite the target if it already exists @throws IOException When target file or directory already exists @throws IOException When origin cannot be renamed
[ "Renames", "a", "file", "or", "a", "directory", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Filesystem/Filesystem.php#L275-L292
train
Renames a file or a directory.
[ 30522, 2270, 3853, 14916, 14074, 1006, 1002, 4761, 1010, 1002, 4539, 1010, 1002, 2058, 26373, 1027, 6270, 1007, 1063, 1013, 1013, 2057, 4638, 2008, 4539, 2515, 2025, 4839, 2065, 1006, 999, 1002, 2058, 26373, 1004, 1004, 1002, 2023, 1011, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
guzzle/guzzle
src/Cookie/CookieJar.php
CookieJar.getCookieByName
public function getCookieByName($name) { // don't allow a null name if ($name === null) { return null; } foreach ($this->cookies as $cookie) { if ($cookie->getName() !== null && strcasecmp($cookie->getName(), $name) === 0) { return $cookie; } } }
php
public function getCookieByName($name) { // don't allow a null name if ($name === null) { return null; } foreach ($this->cookies as $cookie) { if ($cookie->getName() !== null && strcasecmp($cookie->getName(), $name) === 0) { return $cookie; } } }
[ "public", "function", "getCookieByName", "(", "$", "name", ")", "{", "// don't allow a null name", "if", "(", "$", "name", "===", "null", ")", "{", "return", "null", ";", "}", "foreach", "(", "$", "this", "->", "cookies", "as", "$", "cookie", ")", "{", ...
Finds and returns the cookie based on the name @param string $name cookie name to search for @return SetCookie|null cookie that was found or null if not found
[ "Finds", "and", "returns", "the", "cookie", "based", "on", "the", "name" ]
bf595424e4d442a190582e088985dc835a789071
https://github.com/guzzle/guzzle/blob/bf595424e4d442a190582e088985dc835a789071/src/Cookie/CookieJar.php#L95-L106
train
Get the cookie by name
[ 30522, 2270, 3853, 2131, 3597, 23212, 15878, 18279, 4168, 1006, 1002, 2171, 1007, 1063, 1013, 1013, 2123, 1005, 1056, 3499, 1037, 19701, 2171, 2065, 1006, 1002, 2171, 1027, 1027, 1027, 19701, 1007, 1063, 2709, 19701, 1025, 1065, 18921, 6776...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
barryvdh/laravel-debugbar
src/DataCollector/QueryCollector.php
QueryCollector.getTwigInfo
protected function getTwigInfo($trace) { $file = $trace['object']->getTemplateName(); if (isset($trace['line'])) { foreach ($trace['object']->getDebugInfo() as $codeLine => $templateLine) { if ($codeLine <= $trace['line']) { return [$file, $templateLine]; } } } return [$file, -1]; }
php
protected function getTwigInfo($trace) { $file = $trace['object']->getTemplateName(); if (isset($trace['line'])) { foreach ($trace['object']->getDebugInfo() as $codeLine => $templateLine) { if ($codeLine <= $trace['line']) { return [$file, $templateLine]; } } } return [$file, -1]; }
[ "protected", "function", "getTwigInfo", "(", "$", "trace", ")", "{", "$", "file", "=", "$", "trace", "[", "'object'", "]", "->", "getTemplateName", "(", ")", ";", "if", "(", "isset", "(", "$", "trace", "[", "'line'", "]", ")", ")", "{", "foreach", ...
Get the filename/line from a Twig template trace @param array $trace @return array The file and line
[ "Get", "the", "filename", "/", "line", "from", "a", "Twig", "template", "trace" ]
2d195779ea4f809f69764a795e2ec371dbb76a96
https://github.com/barryvdh/laravel-debugbar/blob/2d195779ea4f809f69764a795e2ec371dbb76a96/src/DataCollector/QueryCollector.php#L341-L354
train
Returns the Twig info for the given trace
[ 30522, 5123, 3853, 2131, 2102, 16279, 2378, 14876, 1006, 1002, 7637, 1007, 1063, 1002, 5371, 1027, 1002, 7637, 1031, 1005, 4874, 1005, 1033, 1011, 1028, 2131, 18532, 15725, 18442, 1006, 1007, 1025, 2065, 1006, 26354, 3388, 1006, 1002, 7637,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/WebProfilerBundle/Csp/ContentSecurityPolicyHandler.php
ContentSecurityPolicyHandler.getCspHeaders
private function getCspHeaders(Response $response) { $headers = []; if ($response->headers->has('Content-Security-Policy')) { $headers['Content-Security-Policy'] = $this->parseDirectives($response->headers->get('Content-Security-Policy')); } if ($response->headers->has('Content-Security-Policy-Report-Only')) { $headers['Content-Security-Policy-Report-Only'] = $this->parseDirectives($response->headers->get('Content-Security-Policy-Report-Only')); } if ($response->headers->has('X-Content-Security-Policy')) { $headers['X-Content-Security-Policy'] = $this->parseDirectives($response->headers->get('X-Content-Security-Policy')); } return $headers; }
php
private function getCspHeaders(Response $response) { $headers = []; if ($response->headers->has('Content-Security-Policy')) { $headers['Content-Security-Policy'] = $this->parseDirectives($response->headers->get('Content-Security-Policy')); } if ($response->headers->has('Content-Security-Policy-Report-Only')) { $headers['Content-Security-Policy-Report-Only'] = $this->parseDirectives($response->headers->get('Content-Security-Policy-Report-Only')); } if ($response->headers->has('X-Content-Security-Policy')) { $headers['X-Content-Security-Policy'] = $this->parseDirectives($response->headers->get('X-Content-Security-Policy')); } return $headers; }
[ "private", "function", "getCspHeaders", "(", "Response", "$", "response", ")", "{", "$", "headers", "=", "[", "]", ";", "if", "(", "$", "response", "->", "headers", "->", "has", "(", "'Content-Security-Policy'", ")", ")", "{", "$", "headers", "[", "'Cont...
Retrieves the Content-Security-Policy headers (either X-Content-Security-Policy or Content-Security-Policy) from a response. @return array An associative array of headers
[ "Retrieves", "the", "Content", "-", "Security", "-", "Policy", "headers", "(", "either", "X", "-", "Content", "-", "Security", "-", "Policy", "or", "Content", "-", "Security", "-", "Policy", ")", "from", "a", "response", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bundle/WebProfilerBundle/Csp/ContentSecurityPolicyHandler.php#L253-L270
train
Get the headers for the response.
[ 30522, 2797, 3853, 2131, 6169, 8458, 13775, 2545, 1006, 3433, 1002, 3433, 1007, 1063, 1002, 20346, 2015, 1027, 1031, 1033, 1025, 2065, 1006, 1002, 3433, 1011, 1028, 20346, 2015, 1011, 1028, 2038, 1006, 1005, 4180, 1011, 3036, 1011, 3343, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/HTML/QuickForm2/Rule.php
HTML_QuickForm2_Rule.setOwner
public function setOwner(HTML_QuickForm2_Node $owner) { if (null !== $this->owner) { $this->owner->removeRule($this); } $this->owner = $owner; }
php
public function setOwner(HTML_QuickForm2_Node $owner) { if (null !== $this->owner) { $this->owner->removeRule($this); } $this->owner = $owner; }
[ "public", "function", "setOwner", "(", "HTML_QuickForm2_Node", "$", "owner", ")", "{", "if", "(", "null", "!==", "$", "this", "->", "owner", ")", "{", "$", "this", "->", "owner", "->", "removeRule", "(", "$", "this", ")", ";", "}", "$", "this", "->",...
Sets the element that will be validated by this rule @param HTML_QuickForm2_Node Element to validate
[ "Sets", "the", "element", "that", "will", "be", "validated", "by", "this", "rule" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/HTML/QuickForm2/Rule.php#L182-L188
train
Sets the owner node of this rule
[ 30522, 2270, 3853, 2275, 12384, 2121, 1006, 16129, 1035, 4248, 14192, 2475, 1035, 13045, 1002, 3954, 1007, 1063, 2065, 1006, 19701, 999, 1027, 1027, 1002, 2023, 1011, 1028, 3954, 1007, 1063, 1002, 2023, 1011, 1028, 3954, 1011, 1028, 6366, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/SettingsPiwik.php
SettingsPiwik.getPiwikUrl
public static function getPiwikUrl() { $url = Option::get(self::OPTION_PIWIK_URL); $isPiwikCoreDispatching = defined('PIWIK_ENABLE_DISPATCH') && PIWIK_ENABLE_DISPATCH; if (Common::isPhpCliMode() // in case core:archive command is triggered (often with localhost domain) || SettingsServer::isArchivePhpTriggered() // When someone else than core is dispatching this request then we return the URL as it is read only || !$isPiwikCoreDispatching ) { return $url; } $currentUrl = Common::sanitizeInputValue(Url::getCurrentUrlWithoutFileName()); // when script is called from /misc/cron/archive.php, Piwik URL is /index.php $currentUrl = str_replace("/misc/cron", "", $currentUrl); if (empty($url) // if URL changes, always update the cache || $currentUrl != $url ) { $host = Url::getHostFromUrl($currentUrl); if (strlen($currentUrl) >= strlen('http://a/') && !Url::isLocalHost($host)) { self::overwritePiwikUrl($currentUrl); } $url = $currentUrl; } if (ProxyHttp::isHttps()) { $url = str_replace("http://", "https://", $url); } return $url; }
php
public static function getPiwikUrl() { $url = Option::get(self::OPTION_PIWIK_URL); $isPiwikCoreDispatching = defined('PIWIK_ENABLE_DISPATCH') && PIWIK_ENABLE_DISPATCH; if (Common::isPhpCliMode() // in case core:archive command is triggered (often with localhost domain) || SettingsServer::isArchivePhpTriggered() // When someone else than core is dispatching this request then we return the URL as it is read only || !$isPiwikCoreDispatching ) { return $url; } $currentUrl = Common::sanitizeInputValue(Url::getCurrentUrlWithoutFileName()); // when script is called from /misc/cron/archive.php, Piwik URL is /index.php $currentUrl = str_replace("/misc/cron", "", $currentUrl); if (empty($url) // if URL changes, always update the cache || $currentUrl != $url ) { $host = Url::getHostFromUrl($currentUrl); if (strlen($currentUrl) >= strlen('http://a/') && !Url::isLocalHost($host)) { self::overwritePiwikUrl($currentUrl); } $url = $currentUrl; } if (ProxyHttp::isHttps()) { $url = str_replace("http://", "https://", $url); } return $url; }
[ "public", "static", "function", "getPiwikUrl", "(", ")", "{", "$", "url", "=", "Option", "::", "get", "(", "self", "::", "OPTION_PIWIK_URL", ")", ";", "$", "isPiwikCoreDispatching", "=", "defined", "(", "'PIWIK_ENABLE_DISPATCH'", ")", "&&", "PIWIK_ENABLE_DISPATC...
Returns the URL to this Piwik instance, eg. **http://demo.piwik.org/** or **http://example.org/piwik/**. @return string @api
[ "Returns", "the", "URL", "to", "this", "Piwik", "instance", "eg", ".", "**", "http", ":", "//", "demo", ".", "piwik", ".", "org", "/", "**", "or", "**", "http", ":", "//", "example", ".", "org", "/", "piwik", "/", "**", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/SettingsPiwik.php#L178-L214
train
Get Piwik URL
[ 30522, 2270, 10763, 3853, 2131, 8197, 9148, 18569, 2140, 1006, 1007, 1063, 1002, 24471, 2140, 1027, 5724, 1024, 1024, 2131, 1006, 2969, 1024, 1024, 5724, 1035, 14255, 9148, 2243, 1035, 24471, 2140, 1007, 1025, 1002, 2003, 8197, 9148, 2243, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Validation/Concerns/ValidatesAttributes.php
ValidatesAttributes.validateBefore
public function validateBefore($attribute, $value, $parameters) { $this->requireParameterCount(1, $parameters, 'before'); return $this->compareDates($attribute, $value, $parameters, '<'); }
php
public function validateBefore($attribute, $value, $parameters) { $this->requireParameterCount(1, $parameters, 'before'); return $this->compareDates($attribute, $value, $parameters, '<'); }
[ "public", "function", "validateBefore", "(", "$", "attribute", ",", "$", "value", ",", "$", "parameters", ")", "{", "$", "this", "->", "requireParameterCount", "(", "1", ",", "$", "parameters", ",", "'before'", ")", ";", "return", "$", "this", "->", "com...
Validate the date is before a given date. @param string $attribute @param mixed $value @param array $parameters @return bool
[ "Validate", "the", "date", "is", "before", "a", "given", "date", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Validation/Concerns/ValidatesAttributes.php#L86-L91
train
A generic validator for the < operator.
[ 30522, 2270, 3853, 9398, 3686, 4783, 29278, 2063, 1006, 1002, 17961, 1010, 1002, 3643, 1010, 1002, 11709, 1007, 1063, 1002, 2023, 1011, 1028, 5478, 28689, 22828, 3597, 16671, 1006, 1015, 1010, 1002, 11709, 1010, 1005, 2077, 1005, 1007, 1025...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Validation/Concerns/ValidatesAttributes.php
ValidatesAttributes.validateInArray
public function validateInArray($attribute, $value, $parameters) { $this->requireParameterCount(1, $parameters, 'in_array'); $explicitPath = ValidationData::getLeadingExplicitAttributePath($parameters[0]); $attributeData = ValidationData::extractDataFromPath($explicitPath, $this->data); $otherValues = Arr::where(Arr::dot($attributeData), function ($value, $key) use ($parameters) { return Str::is($parameters[0], $key); }); return in_array($value, $otherValues); }
php
public function validateInArray($attribute, $value, $parameters) { $this->requireParameterCount(1, $parameters, 'in_array'); $explicitPath = ValidationData::getLeadingExplicitAttributePath($parameters[0]); $attributeData = ValidationData::extractDataFromPath($explicitPath, $this->data); $otherValues = Arr::where(Arr::dot($attributeData), function ($value, $key) use ($parameters) { return Str::is($parameters[0], $key); }); return in_array($value, $otherValues); }
[ "public", "function", "validateInArray", "(", "$", "attribute", ",", "$", "value", ",", "$", "parameters", ")", "{", "$", "this", "->", "requireParameterCount", "(", "1", ",", "$", "parameters", ",", "'in_array'", ")", ";", "$", "explicitPath", "=", "Valid...
Validate that the values of an attribute is in another attribute. @param string $attribute @param mixed $value @param array $parameters @return bool
[ "Validate", "that", "the", "values", "of", "an", "attribute", "is", "in", "another", "attribute", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Validation/Concerns/ValidatesAttributes.php#L1025-L1038
train
Validate that an attribute is in an array
[ 30522, 2270, 3853, 9398, 3686, 3981, 11335, 2100, 1006, 1002, 17961, 1010, 1002, 3643, 1010, 1002, 11709, 1007, 1063, 1002, 2023, 1011, 1028, 5478, 28689, 22828, 3597, 16671, 1006, 1015, 1010, 1002, 11709, 1010, 1005, 1999, 1035, 9140, 1005...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/DependencyInjection/ContainerBuilder.php
ContainerBuilder.getExtension
public function getExtension($name) { if (isset($this->extensions[$name])) { return $this->extensions[$name]; } if (isset($this->extensionsByNs[$name])) { return $this->extensionsByNs[$name]; } throw new LogicException(sprintf('Container extension "%s" is not registered', $name)); }
php
public function getExtension($name) { if (isset($this->extensions[$name])) { return $this->extensions[$name]; } if (isset($this->extensionsByNs[$name])) { return $this->extensionsByNs[$name]; } throw new LogicException(sprintf('Container extension "%s" is not registered', $name)); }
[ "public", "function", "getExtension", "(", "$", "name", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "extensions", "[", "$", "name", "]", ")", ")", "{", "return", "$", "this", "->", "extensions", "[", "$", "name", "]", ";", "}", "if", "(...
Returns an extension by alias or namespace. @param string $name An alias or a namespace @return ExtensionInterface An extension instance @throws LogicException if the extension is not registered
[ "Returns", "an", "extension", "by", "alias", "or", "namespace", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DependencyInjection/ContainerBuilder.php#L207-L218
train
Get container extension
[ 30522, 2270, 3853, 2131, 10288, 29048, 1006, 1002, 2171, 1007, 1063, 2065, 1006, 26354, 3388, 30524, 1028, 14305, 1031, 1002, 2171, 1033, 1025, 1065, 2065, 1006, 26354, 3388, 1006, 1002, 2023, 1011, 1028, 14305, 3762, 3619, 1031, 1002, 2171...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Schema/Grammars/Grammar.php
Grammar.compileChange
public function compileChange(Blueprint $blueprint, Fluent $command, Connection $connection) { return ChangeColumn::compile($this, $blueprint, $command, $connection); }
php
public function compileChange(Blueprint $blueprint, Fluent $command, Connection $connection) { return ChangeColumn::compile($this, $blueprint, $command, $connection); }
[ "public", "function", "compileChange", "(", "Blueprint", "$", "blueprint", ",", "Fluent", "$", "command", ",", "Connection", "$", "connection", ")", "{", "return", "ChangeColumn", "::", "compile", "(", "$", "this", ",", "$", "blueprint", ",", "$", "command",...
Compile a change column command into a series of SQL statements. @param \Illuminate\Database\Schema\Blueprint $blueprint @param \Illuminate\Support\Fluent $command @param \Illuminate\Database\Connection $connection @return array @throws \RuntimeException
[ "Compile", "a", "change", "column", "command", "into", "a", "series", "of", "SQL", "statements", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Schema/Grammars/Grammar.php#L53-L56
train
Compiles a change column
[ 30522, 2270, 3853, 4012, 22090, 22305, 2063, 1006, 2630, 16550, 1002, 2630, 16550, 1010, 19376, 1002, 3094, 1010, 4434, 1002, 4434, 1007, 1063, 2709, 2689, 25778, 2819, 2078, 1024, 1024, 4012, 22090, 1006, 1002, 2023, 1010, 1002, 2630, 1655...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
domnikl/DesignPatternsPHP
Structural/Registry/Registry.php
Registry.get
public static function get(string $key) { if (!in_array($key, self::$allowedKeys) || !isset(self::$storedValues[$key])) { throw new \InvalidArgumentException('Invalid key given'); } return self::$storedValues[$key]; }
php
public static function get(string $key) { if (!in_array($key, self::$allowedKeys) || !isset(self::$storedValues[$key])) { throw new \InvalidArgumentException('Invalid key given'); } return self::$storedValues[$key]; }
[ "public", "static", "function", "get", "(", "string", "$", "key", ")", "{", "if", "(", "!", "in_array", "(", "$", "key", ",", "self", "::", "$", "allowedKeys", ")", "||", "!", "isset", "(", "self", "::", "$", "storedValues", "[", "$", "key", "]", ...
@param string $key @return mixed
[ "@param", "string", "$key" ]
5f5649b57ea94471e20b54eb439c6368dea07886
https://github.com/domnikl/DesignPatternsPHP/blob/5f5649b57ea94471e20b54eb439c6368dea07886/Structural/Registry/Registry.php#L44-L51
train
Get the value of a given key
[ 30522, 2270, 10763, 3853, 2131, 1006, 5164, 1002, 3145, 1007, 1063, 2065, 1006, 999, 1999, 1035, 9140, 1006, 1002, 3145, 1010, 2969, 1024, 1024, 1002, 3039, 14839, 2015, 1007, 1064, 1064, 999, 26354, 3388, 1006, 2969, 1024, 1024, 1002, 82...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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.sendmailSend
protected function sendmailSend($header, $body) { // CVE-2016-10033, CVE-2016-10045: Don't pass -f if characters will be escaped. if (!empty($this->Sender) and self::isShellSafe($this->Sender)) { if ('qmail' == $this->Mailer) { $sendmailFmt = '%s -f%s'; } else { $sendmailFmt = '%s -oi -f%s -t'; } } else { if ('qmail' == $this->Mailer) { $sendmailFmt = '%s'; } else { $sendmailFmt = '%s -oi -t'; } } $sendmail = sprintf($sendmailFmt, escapeshellcmd($this->Sendmail), $this->Sender); if ($this->SingleTo) { foreach ($this->SingleToArray as $toAddr) { $mail = @popen($sendmail, 'w'); if (!$mail) { throw new Exception($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL); } fwrite($mail, 'To: ' . $toAddr . "\n"); fwrite($mail, $header); fwrite($mail, $body); $result = pclose($mail); $this->doCallback( ($result == 0), [$toAddr], $this->cc, $this->bcc, $this->Subject, $body, $this->From, [] ); if (0 !== $result) { throw new Exception($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL); } } } else { $mail = @popen($sendmail, 'w'); if (!$mail) { throw new Exception($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL); } fwrite($mail, $header); fwrite($mail, $body); $result = pclose($mail); $this->doCallback( ($result == 0), $this->to, $this->cc, $this->bcc, $this->Subject, $body, $this->From, [] ); if (0 !== $result) { throw new Exception($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL); } } return true; }
php
protected function sendmailSend($header, $body) { // CVE-2016-10033, CVE-2016-10045: Don't pass -f if characters will be escaped. if (!empty($this->Sender) and self::isShellSafe($this->Sender)) { if ('qmail' == $this->Mailer) { $sendmailFmt = '%s -f%s'; } else { $sendmailFmt = '%s -oi -f%s -t'; } } else { if ('qmail' == $this->Mailer) { $sendmailFmt = '%s'; } else { $sendmailFmt = '%s -oi -t'; } } $sendmail = sprintf($sendmailFmt, escapeshellcmd($this->Sendmail), $this->Sender); if ($this->SingleTo) { foreach ($this->SingleToArray as $toAddr) { $mail = @popen($sendmail, 'w'); if (!$mail) { throw new Exception($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL); } fwrite($mail, 'To: ' . $toAddr . "\n"); fwrite($mail, $header); fwrite($mail, $body); $result = pclose($mail); $this->doCallback( ($result == 0), [$toAddr], $this->cc, $this->bcc, $this->Subject, $body, $this->From, [] ); if (0 !== $result) { throw new Exception($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL); } } } else { $mail = @popen($sendmail, 'w'); if (!$mail) { throw new Exception($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL); } fwrite($mail, $header); fwrite($mail, $body); $result = pclose($mail); $this->doCallback( ($result == 0), $this->to, $this->cc, $this->bcc, $this->Subject, $body, $this->From, [] ); if (0 !== $result) { throw new Exception($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL); } } return true; }
[ "protected", "function", "sendmailSend", "(", "$", "header", ",", "$", "body", ")", "{", "// CVE-2016-10033, CVE-2016-10045: Don't pass -f if characters will be escaped.", "if", "(", "!", "empty", "(", "$", "this", "->", "Sender", ")", "and", "self", "::", "isShellS...
Send mail using the $Sendmail program. @see PHPMailer::$Sendmail @param string $header The message headers @param string $body The message body @throws Exception @return bool
[ "Send", "mail", "using", "the", "$Sendmail", "program", "." ]
3d7132341659a8a201adbc3ba11b1e202ee2857c
https://github.com/PHPMailer/PHPMailer/blob/3d7132341659a8a201adbc3ba11b1e202ee2857c/src/PHPMailer.php#L1573-L1640
train
Sends the mail to the sender
[ 30522, 5123, 3853, 4604, 21397, 5054, 2094, 1006, 1002, 20346, 1010, 1002, 2303, 1007, 1063, 1013, 1013, 26226, 2063, 1011, 2355, 1011, 2531, 22394, 1010, 26226, 2063, 1011, 2355, 1011, 2531, 19961, 1024, 2123, 1005, 1056, 3413, 1011, 1042,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Inflector/Inflector.php
Inflector.pluralize
public static function pluralize(string $singular) { $singularRev = strrev($singular); $lowerSingularRev = strtolower($singularRev); $singularLength = \strlen($lowerSingularRev); // Check if the word is one which is not inflected, return early if so if (\in_array($lowerSingularRev, self::$uninflected, true)) { return $singular; } // The outer loop iterates over the entries of the singular table // The inner loop $j iterates over the characters of the singular suffix // in the singular table to compare them with the characters of the actual // given singular suffix foreach (self::$singularMap as $map) { $suffix = $map[0]; $suffixLength = $map[1]; $j = 0; // Compare characters in the singular table and of the suffix of the // given plural one by one while ($suffix[$j] === $lowerSingularRev[$j]) { // Let $j point to the next character ++$j; // Successfully compared the last character // Add an entry with the plural suffix to the plural array if ($j === $suffixLength) { // Is there any character preceding the suffix in the plural string? if ($j < $singularLength) { $nextIsVocal = false !== strpos('aeiou', $lowerSingularRev[$j]); if (!$map[2] && $nextIsVocal) { // suffix may not succeed a vocal but next char is one break; } if (!$map[3] && !$nextIsVocal) { // suffix may not succeed a consonant but next char is one break; } } $newBase = substr($singular, 0, $singularLength - $suffixLength); $newSuffix = $map[4]; // Check whether the first character in the singular suffix // is uppercased. If yes, uppercase the first character in // the singular suffix too $firstUpper = ctype_upper($singularRev[$j - 1]); if (\is_array($newSuffix)) { $plurals = []; foreach ($newSuffix as $newSuffixEntry) { $plurals[] = $newBase.($firstUpper ? ucfirst($newSuffixEntry) : $newSuffixEntry); } return $plurals; } return $newBase.($firstUpper ? ucfirst($newSuffix) : $newSuffix); } // Suffix is longer than word if ($j === $singularLength) { break; } } } // Assume that plural is singular with a trailing `s` return $singular.'s'; }
php
public static function pluralize(string $singular) { $singularRev = strrev($singular); $lowerSingularRev = strtolower($singularRev); $singularLength = \strlen($lowerSingularRev); // Check if the word is one which is not inflected, return early if so if (\in_array($lowerSingularRev, self::$uninflected, true)) { return $singular; } // The outer loop iterates over the entries of the singular table // The inner loop $j iterates over the characters of the singular suffix // in the singular table to compare them with the characters of the actual // given singular suffix foreach (self::$singularMap as $map) { $suffix = $map[0]; $suffixLength = $map[1]; $j = 0; // Compare characters in the singular table and of the suffix of the // given plural one by one while ($suffix[$j] === $lowerSingularRev[$j]) { // Let $j point to the next character ++$j; // Successfully compared the last character // Add an entry with the plural suffix to the plural array if ($j === $suffixLength) { // Is there any character preceding the suffix in the plural string? if ($j < $singularLength) { $nextIsVocal = false !== strpos('aeiou', $lowerSingularRev[$j]); if (!$map[2] && $nextIsVocal) { // suffix may not succeed a vocal but next char is one break; } if (!$map[3] && !$nextIsVocal) { // suffix may not succeed a consonant but next char is one break; } } $newBase = substr($singular, 0, $singularLength - $suffixLength); $newSuffix = $map[4]; // Check whether the first character in the singular suffix // is uppercased. If yes, uppercase the first character in // the singular suffix too $firstUpper = ctype_upper($singularRev[$j - 1]); if (\is_array($newSuffix)) { $plurals = []; foreach ($newSuffix as $newSuffixEntry) { $plurals[] = $newBase.($firstUpper ? ucfirst($newSuffixEntry) : $newSuffixEntry); } return $plurals; } return $newBase.($firstUpper ? ucfirst($newSuffix) : $newSuffix); } // Suffix is longer than word if ($j === $singularLength) { break; } } } // Assume that plural is singular with a trailing `s` return $singular.'s'; }
[ "public", "static", "function", "pluralize", "(", "string", "$", "singular", ")", "{", "$", "singularRev", "=", "strrev", "(", "$", "singular", ")", ";", "$", "lowerSingularRev", "=", "strtolower", "(", "$", "singularRev", ")", ";", "$", "singularLength", ...
Returns the plural form of a word. If the method can't determine the form with certainty, an array of the possible plurals is returned. @param string $singular A word in plural form @return string|array The plural form or an array of possible plural forms
[ "Returns", "the", "plural", "form", "of", "a", "word", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Inflector/Inflector.php#L417-L492
train
Returns the plural form of the word
[ 30522, 2270, 10763, 3853, 13994, 4697, 1006, 5164, 1002, 13048, 1007, 1063, 1002, 13048, 2890, 2615, 1027, 2358, 14343, 2615, 1006, 1002, 13048, 1007, 1025, 1002, 24950, 2075, 7934, 2890, 2615, 1027, 2358, 5339, 12898, 13777, 1006, 1002, 13...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Cache/Adapter/FilesystemTagAwareAdapter.php
FilesystemTagAwareAdapter.doSave
protected function doSave(array $values, ?int $lifetime, array $addTagData = [], array $removeTagData = []): array { $failed = $this->doSaveCache($values, $lifetime); $fs = $this->getFilesystem(); // Add Tags as symlinks foreach ($addTagData as $tagId => $ids) { $tagFolder = $this->getTagFolder($tagId); foreach ($ids as $id) { if ($failed && \in_array($id, $failed, true)) { continue; } $file = $this->getFile($id); $fs->symlink($file, $this->getFile($id, true, $tagFolder)); } } // Unlink removed Tags $files = []; foreach ($removeTagData as $tagId => $ids) { $tagFolder = $this->getTagFolder($tagId); foreach ($ids as $id) { if ($failed && \in_array($id, $failed, true)) { continue; } $files[] = $this->getFile($id, false, $tagFolder); } } $fs->remove($files); return $failed; }
php
protected function doSave(array $values, ?int $lifetime, array $addTagData = [], array $removeTagData = []): array { $failed = $this->doSaveCache($values, $lifetime); $fs = $this->getFilesystem(); // Add Tags as symlinks foreach ($addTagData as $tagId => $ids) { $tagFolder = $this->getTagFolder($tagId); foreach ($ids as $id) { if ($failed && \in_array($id, $failed, true)) { continue; } $file = $this->getFile($id); $fs->symlink($file, $this->getFile($id, true, $tagFolder)); } } // Unlink removed Tags $files = []; foreach ($removeTagData as $tagId => $ids) { $tagFolder = $this->getTagFolder($tagId); foreach ($ids as $id) { if ($failed && \in_array($id, $failed, true)) { continue; } $files[] = $this->getFile($id, false, $tagFolder); } } $fs->remove($files); return $failed; }
[ "protected", "function", "doSave", "(", "array", "$", "values", ",", "?", "int", "$", "lifetime", ",", "array", "$", "addTagData", "=", "[", "]", ",", "array", "$", "removeTagData", "=", "[", "]", ")", ":", "array", "{", "$", "failed", "=", "$", "t...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Cache/Adapter/FilesystemTagAwareAdapter.php#L56-L89
train
Save cache values
[ 30522, 5123, 3853, 9998, 10696, 1006, 9140, 1002, 5300, 1010, 1029, 20014, 1002, 6480, 1010, 9140, 1002, 5587, 15900, 2850, 2696, 1027, 1031, 1033, 1010, 9140, 1002, 6366, 15900, 2850, 2696, 1027, 1031, 1033, 1007, 1024, 9140, 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...
laravel/framework
src/Illuminate/Support/Collection.php
Collection.nth
public function nth($step, $offset = 0) { $new = []; $position = 0; foreach ($this->items as $item) { if ($position % $step === $offset) { $new[] = $item; } $position++; } return new static($new); }
php
public function nth($step, $offset = 0) { $new = []; $position = 0; foreach ($this->items as $item) { if ($position % $step === $offset) { $new[] = $item; } $position++; } return new static($new); }
[ "public", "function", "nth", "(", "$", "step", ",", "$", "offset", "=", "0", ")", "{", "$", "new", "=", "[", "]", ";", "$", "position", "=", "0", ";", "foreach", "(", "$", "this", "->", "items", "as", "$", "item", ")", "{", "if", "(", "$", ...
Create a new collection consisting of every n-th element. @param int $step @param int $offset @return static
[ "Create", "a", "new", "collection", "consisting", "of", "every", "n", "-", "th", "element", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Support/Collection.php#L1309-L1324
train
Get nth item
[ 30522, 2270, 3853, 23961, 2232, 1006, 1002, 3357, 1010, 1002, 16396, 1027, 1014, 1007, 1063, 1002, 2047, 1027, 1031, 1033, 1025, 1002, 2597, 1027, 1014, 1025, 18921, 6776, 1006, 1002, 2023, 1011, 1028, 5167, 2004, 1002, 8875, 1007, 1063, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Framework/ContentBlock/HtmlBlock.php
HtmlBlock.addStyle
public function addStyle($element, $priority = 0, $location = 'head') { if (!\is_array($element)) { $element = ['href' => (string) $element]; } if (empty($element['href'])) { return false; } if (!isset($this->styles[$location])) { $this->styles[$location] = []; } $id = !empty($element['id']) ? ['id' => (string) $element['id']] : []; $href = $element['href']; $type = !empty($element['type']) ? (string) $element['type'] : 'text/css'; $media = !empty($element['media']) ? (string) $element['media'] : null; unset( $element['tag'], $element['id'], $element['rel'], $element['content'], $element['href'], $element['type'], $element['media'] ); $this->styles[$location][md5($href) . sha1($href)] = [ ':type' => 'file', ':priority' => (int) $priority, 'href' => $href, 'type' => $type, 'media' => $media, 'element' => $element ] + $id; return true; }
php
public function addStyle($element, $priority = 0, $location = 'head') { if (!\is_array($element)) { $element = ['href' => (string) $element]; } if (empty($element['href'])) { return false; } if (!isset($this->styles[$location])) { $this->styles[$location] = []; } $id = !empty($element['id']) ? ['id' => (string) $element['id']] : []; $href = $element['href']; $type = !empty($element['type']) ? (string) $element['type'] : 'text/css'; $media = !empty($element['media']) ? (string) $element['media'] : null; unset( $element['tag'], $element['id'], $element['rel'], $element['content'], $element['href'], $element['type'], $element['media'] ); $this->styles[$location][md5($href) . sha1($href)] = [ ':type' => 'file', ':priority' => (int) $priority, 'href' => $href, 'type' => $type, 'media' => $media, 'element' => $element ] + $id; return true; }
[ "public", "function", "addStyle", "(", "$", "element", ",", "$", "priority", "=", "0", ",", "$", "location", "=", "'head'", ")", "{", "if", "(", "!", "\\", "is_array", "(", "$", "element", ")", ")", "{", "$", "element", "=", "[", "'href'", "=>", ...
@param string|array $element @param int $priority @param string $location @return bool @example $block->addStyle('assets/js/my.js'); @example $block->addStyle(['href' => 'assets/js/my.js', 'media' => 'screen']);
[ "@param", "string|array", "$element", "@param", "int", "$priority", "@param", "string", "$location", "@return", "bool" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Framework/ContentBlock/HtmlBlock.php#L133-L169
train
Adds a stylesheet to the list of stylesheets
[ 30522, 2270, 3853, 9909, 27983, 1006, 1002, 5783, 1010, 1002, 9470, 1027, 1014, 1010, 1002, 3295, 1027, 1005, 2132, 1005, 1007, 1063, 2065, 1006, 999, 1032, 2003, 1035, 9140, 1006, 1002, 5783, 1007, 1007, 1063, 1002, 5783, 1027, 1031, 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...
overtrue/wechat
src/OfficialAccount/User/TagClient.php
TagClient.untagUsers
public function untagUsers(array $openids, int $tagId) { $params = [ 'openid_list' => $openids, 'tagid' => $tagId, ]; return $this->httpPostJson('cgi-bin/tags/members/batchuntagging', $params); }
php
public function untagUsers(array $openids, int $tagId) { $params = [ 'openid_list' => $openids, 'tagid' => $tagId, ]; return $this->httpPostJson('cgi-bin/tags/members/batchuntagging', $params); }
[ "public", "function", "untagUsers", "(", "array", "$", "openids", ",", "int", "$", "tagId", ")", "{", "$", "params", "=", "[", "'openid_list'", "=>", "$", "openids", ",", "'tagid'", "=>", "$", "tagId", ",", "]", ";", "return", "$", "this", "->", "htt...
Untag users from a tag. @param array $openids @param int $tagId @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
[ "Untag", "users", "from", "a", "tag", "." ]
120c72faaa93c270365bc75c73c362d5fd583209
https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/OfficialAccount/User/TagClient.php#L159-L167
train
Untag users with a tag id
[ 30522, 2270, 3853, 4895, 15900, 20330, 2015, 1006, 9140, 1002, 2330, 9821, 1010, 20014, 1002, 6415, 3593, 1007, 1063, 1002, 11498, 5244, 1027, 1031, 1005, 2330, 3593, 1035, 2862, 1005, 1027, 1028, 1002, 2330, 9821, 1010, 1005, 6415, 3593, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Transport/Transport.php
Transport.numberOfRecipients
protected function numberOfRecipients(Swift_Mime_SimpleMessage $message) { return count(array_merge( (array) $message->getTo(), (array) $message->getCc(), (array) $message->getBcc() )); }
php
protected function numberOfRecipients(Swift_Mime_SimpleMessage $message) { return count(array_merge( (array) $message->getTo(), (array) $message->getCc(), (array) $message->getBcc() )); }
[ "protected", "function", "numberOfRecipients", "(", "Swift_Mime_SimpleMessage", "$", "message", ")", "{", "return", "count", "(", "array_merge", "(", "(", "array", ")", "$", "message", "->", "getTo", "(", ")", ",", "(", "array", ")", "$", "message", "->", ...
Get the number of recipients. @param \Swift_Mime_SimpleMessage $message @return int
[ "Get", "the", "number", "of", "recipients", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Mail/Transport/Transport.php#L102-L107
train
Count number of recipients in the message
[ 30522, 5123, 3853, 2193, 11253, 2890, 6895, 14756, 7666, 1006, 9170, 1035, 2771, 4168, 1035, 3722, 7834, 3736, 3351, 1002, 4471, 1007, 1063, 2709, 4175, 1006, 9140, 1035, 13590, 1006, 1006, 9140, 1007, 1002, 4471, 1011, 1028, 2131, 3406, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Support/ServiceProvider.php
ServiceProvider.loadMigrationsFrom
protected function loadMigrationsFrom($paths) { $this->app->afterResolving('migrator', function ($migrator) use ($paths) { foreach ((array) $paths as $path) { $migrator->path($path); } }); }
php
protected function loadMigrationsFrom($paths) { $this->app->afterResolving('migrator', function ($migrator) use ($paths) { foreach ((array) $paths as $path) { $migrator->path($path); } }); }
[ "protected", "function", "loadMigrationsFrom", "(", "$", "paths", ")", "{", "$", "this", "->", "app", "->", "afterResolving", "(", "'migrator'", ",", "function", "(", "$", "migrator", ")", "use", "(", "$", "paths", ")", "{", "foreach", "(", "(", "array",...
Register a database migration path. @param array|string $paths @return void
[ "Register", "a", "database", "migration", "path", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Support/ServiceProvider.php#L137-L144
train
Load migrations from paths
[ 30522, 5123, 3853, 7170, 4328, 29397, 22747, 21716, 1006, 1002, 10425, 1007, 1063, 1002, 2023, 1011, 1028, 10439, 1011, 1028, 2044, 6072, 4747, 6455, 1006, 1005, 19117, 16259, 1005, 1010, 3853, 1006, 1002, 19117, 16259, 1007, 2224, 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...
getgrav/grav
system/src/Grav/Common/Page/Medium/Medium.php
Medium.display
public function display($mode = 'source') { if ($this->mode === $mode) { return $this; } $this->mode = $mode; return $mode === 'thumbnail' ? ($this->getThumbnail() ? $this->getThumbnail()->reset() : null) : $this->reset(); }
php
public function display($mode = 'source') { if ($this->mode === $mode) { return $this; } $this->mode = $mode; return $mode === 'thumbnail' ? ($this->getThumbnail() ? $this->getThumbnail()->reset() : null) : $this->reset(); }
[ "public", "function", "display", "(", "$", "mode", "=", "'source'", ")", "{", "if", "(", "$", "this", "->", "mode", "===", "$", "mode", ")", "{", "return", "$", "this", ";", "}", "$", "this", "->", "mode", "=", "$", "mode", ";", "return", "$", ...
Switch display mode. @param string $mode @return $this
[ "Switch", "display", "mode", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Medium/Medium.php#L483-L493
train
Display the image
[ 30522, 2270, 3853, 4653, 1006, 1002, 5549, 1027, 1005, 3120, 1005, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 5549, 1027, 1027, 1027, 1002, 5549, 1007, 1063, 2709, 1002, 2023, 1025, 1065, 1002, 2023, 1011, 1028, 5549, 1027, 1002, 554...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Intl/DateFormatter/DateFormat/MonthTransformer.php
MonthTransformer.format
public function format(\DateTime $dateTime, int $length): string { $matchLengthMap = [ 1 => 'n', 2 => 'm', 3 => 'M', 4 => 'F', ]; if (isset($matchLengthMap[$length])) { return $dateTime->format($matchLengthMap[$length]); } if (5 === $length) { return substr($dateTime->format('M'), 0, 1); } return $this->padLeft($dateTime->format('m'), $length); }
php
public function format(\DateTime $dateTime, int $length): string { $matchLengthMap = [ 1 => 'n', 2 => 'm', 3 => 'M', 4 => 'F', ]; if (isset($matchLengthMap[$length])) { return $dateTime->format($matchLengthMap[$length]); } if (5 === $length) { return substr($dateTime->format('M'), 0, 1); } return $this->padLeft($dateTime->format('m'), $length); }
[ "public", "function", "format", "(", "\\", "DateTime", "$", "dateTime", ",", "int", "$", "length", ")", ":", "string", "{", "$", "matchLengthMap", "=", "[", "1", "=>", "'n'", ",", "2", "=>", "'m'", ",", "3", "=>", "'M'", ",", "4", "=>", "'F'", ",...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Intl/DateFormatter/DateFormat/MonthTransformer.php#L68-L86
train
Format a datetime with the specified length
[ 30522, 2270, 3853, 4289, 1006, 1032, 3058, 7292, 1002, 3058, 7292, 1010, 20014, 1002, 3091, 1007, 1024, 5164, 1063, 1002, 2674, 7770, 13512, 22444, 2361, 1027, 1031, 1015, 1027, 1028, 1005, 1050, 1005, 1010, 1016, 1027, 1028, 1005, 1049, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php
HasAttributes.getRelationshipFromMethod
protected function getRelationshipFromMethod($method) { $relation = $this->$method(); if (! $relation instanceof Relation) { throw new LogicException(sprintf( '%s::%s must return a relationship instance.', static::class, $method )); } return tap($relation->getResults(), function ($results) use ($method) { $this->setRelation($method, $results); }); }
php
protected function getRelationshipFromMethod($method) { $relation = $this->$method(); if (! $relation instanceof Relation) { throw new LogicException(sprintf( '%s::%s must return a relationship instance.', static::class, $method )); } return tap($relation->getResults(), function ($results) use ($method) { $this->setRelation($method, $results); }); }
[ "protected", "function", "getRelationshipFromMethod", "(", "$", "method", ")", "{", "$", "relation", "=", "$", "this", "->", "$", "method", "(", ")", ";", "if", "(", "!", "$", "relation", "instanceof", "Relation", ")", "{", "throw", "new", "LogicException"...
Get a relationship value from a method. @param string $method @return mixed @throws \LogicException
[ "Get", "a", "relationship", "value", "from", "a", "method", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php#L411-L424
train
Get a relationship from the method.
[ 30522, 5123, 3853, 2131, 16570, 10708, 5605, 19699, 5358, 11368, 6806, 2094, 1006, 1002, 4118, 1007, 1063, 1002, 7189, 1027, 1002, 2023, 1011, 1028, 1002, 4118, 1006, 1007, 1025, 2065, 1006, 999, 1002, 7189, 6013, 11253, 7189, 1007, 1063, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
z-song/laravel-admin
src/Grid.php
Grid.visibleColumns
public function visibleColumns() { $visible = array_filter(explode(',', request(Tools\ColumnSelector::SELECT_COLUMN_NAME))); if (empty($visible)) { return $this->columns; } array_push($visible, '__row_selector__', '__actions__'); return $this->columns->filter(function (Column $column) use ($visible) { return in_array($column->getName(), $visible); }); }
php
public function visibleColumns() { $visible = array_filter(explode(',', request(Tools\ColumnSelector::SELECT_COLUMN_NAME))); if (empty($visible)) { return $this->columns; } array_push($visible, '__row_selector__', '__actions__'); return $this->columns->filter(function (Column $column) use ($visible) { return in_array($column->getName(), $visible); }); }
[ "public", "function", "visibleColumns", "(", ")", "{", "$", "visible", "=", "array_filter", "(", "explode", "(", "','", ",", "request", "(", "Tools", "\\", "ColumnSelector", "::", "SELECT_COLUMN_NAME", ")", ")", ")", ";", "if", "(", "empty", "(", "$", "v...
Get all visible column instances. @return Collection|static
[ "Get", "all", "visible", "column", "instances", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid.php#L355-L368
train
Return all visible columns
[ 30522, 2270, 3853, 5710, 25778, 2819, 3619, 1006, 1007, 1063, 1002, 5710, 1027, 9140, 1035, 11307, 1006, 15044, 1006, 1005, 1010, 1005, 1010, 5227, 1006, 5906, 1032, 7753, 12260, 16761, 1024, 1024, 7276, 1035, 5930, 1035, 2171, 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...
octobercms/october
modules/backend/formwidgets/RichEditor.php
RichEditor.getValidEditorLang
protected function getValidEditorLang() { $locale = App::getLocale(); // English is baked in if ($locale == 'en') { return null; } $locale = str_replace('-', '_', strtolower($locale)); $path = base_path('modules/backend/formwidgets/richeditor/assets/vendor/froala/js/languages/'.$locale.'.js'); return File::exists($path) ? $locale : false; }
php
protected function getValidEditorLang() { $locale = App::getLocale(); // English is baked in if ($locale == 'en') { return null; } $locale = str_replace('-', '_', strtolower($locale)); $path = base_path('modules/backend/formwidgets/richeditor/assets/vendor/froala/js/languages/'.$locale.'.js'); return File::exists($path) ? $locale : false; }
[ "protected", "function", "getValidEditorLang", "(", ")", "{", "$", "locale", "=", "App", "::", "getLocale", "(", ")", ";", "// English is baked in", "if", "(", "$", "locale", "==", "'en'", ")", "{", "return", "null", ";", "}", "$", "locale", "=", "str_re...
Returns a valid language code for Redactor. @return string|mixed
[ "Returns", "a", "valid", "language", "code", "for", "Redactor", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/formwidgets/RichEditor.php#L143-L156
train
Returns the language code of the valid editor
[ 30522, 5123, 3853, 2131, 10175, 14097, 15660, 25023, 1006, 1007, 1063, 1002, 2334, 2063, 1027, 10439, 1024, 1024, 2131, 4135, 9289, 2063, 1006, 1007, 1025, 1013, 1013, 2394, 2003, 17776, 1999, 2065, 1006, 1002, 2334, 2063, 1027, 1027, 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/backend/widgets/MediaManager.php
MediaManager.onGenerateThumbnails
public function onGenerateThumbnails() { $batch = Input::get('batch'); if (!is_array($batch)) { return; } $result = []; foreach ($batch as $thumbnailInfo) { $result[] = $this->generateThumbnail($thumbnailInfo); } return [ 'generatedThumbnails'=>$result ]; }
php
public function onGenerateThumbnails() { $batch = Input::get('batch'); if (!is_array($batch)) { return; } $result = []; foreach ($batch as $thumbnailInfo) { $result[] = $this->generateThumbnail($thumbnailInfo); } return [ 'generatedThumbnails'=>$result ]; }
[ "public", "function", "onGenerateThumbnails", "(", ")", "{", "$", "batch", "=", "Input", "::", "get", "(", "'batch'", ")", ";", "if", "(", "!", "is_array", "(", "$", "batch", ")", ")", "{", "return", ";", "}", "$", "result", "=", "[", "]", ";", "...
Generate thumbnail AJAX handler @return array
[ "Generate", "thumbnail", "AJAX", "handler" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/MediaManager.php#L156-L171
train
Generate Thumbnails.
[ 30522, 2270, 3853, 2006, 6914, 22139, 2705, 25438, 25464, 2015, 1006, 1007, 1063, 1002, 14108, 1027, 7953, 1024, 1024, 2131, 1006, 1005, 14108, 1005, 1007, 1025, 2065, 1006, 999, 2003, 1035, 9140, 1006, 1002, 14108, 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...
symfony/symfony
src/Symfony/Component/Ldap/Ldap.php
Ldap.create
public static function create($adapter, array $config = []): self { if (!isset(self::$adapterMap[$adapter])) { throw new DriverNotFoundException(sprintf( 'Adapter "%s" not found. You should use one of: %s', $adapter, implode(', ', self::$adapterMap) )); } $class = self::$adapterMap[$adapter]; return new self(new $class($config)); }
php
public static function create($adapter, array $config = []): self { if (!isset(self::$adapterMap[$adapter])) { throw new DriverNotFoundException(sprintf( 'Adapter "%s" not found. You should use one of: %s', $adapter, implode(', ', self::$adapterMap) )); } $class = self::$adapterMap[$adapter]; return new self(new $class($config)); }
[ "public", "static", "function", "create", "(", "$", "adapter", ",", "array", "$", "config", "=", "[", "]", ")", ":", "self", "{", "if", "(", "!", "isset", "(", "self", "::", "$", "adapterMap", "[", "$", "adapter", "]", ")", ")", "{", "throw", "ne...
Creates a new Ldap instance. @param string $adapter The adapter name @param array $config The adapter's configuration @return static
[ "Creates", "a", "new", "Ldap", "instance", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Ldap/Ldap.php#L73-L86
train
Create new instance of the class
[ 30522, 2270, 10763, 3853, 3443, 1006, 1002, 15581, 2121, 1010, 9140, 1002, 9530, 8873, 2290, 1027, 1031, 1033, 1007, 1024, 2969, 1063, 2065, 1006, 999, 26354, 3388, 1006, 2969, 1024, 1024, 1002, 15581, 2121, 2863, 2361, 1031, 1002, 15581, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/XmlEncoder.php
XmlEncoder.buildXml
private function buildXml(\DOMNode $parentNode, $data, string $xmlRootNodeName = null): bool { $append = true; $removeEmptyTags = $this->context[self::REMOVE_EMPTY_TAGS] ?? $this->defaultContext[self::REMOVE_EMPTY_TAGS] ?? false; $encoderIgnoredNodeTypes = $this->context[self::ENCODER_IGNORED_NODE_TYPES] ?? $this->defaultContext[self::ENCODER_IGNORED_NODE_TYPES]; if (\is_array($data) || ($data instanceof \Traversable && !$this->serializer->supportsNormalization($data, $this->format))) { foreach ($data as $key => $data) { //Ah this is the magic @ attribute types. if (0 === strpos($key, '@') && $this->isElementNameValid($attributeName = substr($key, 1))) { if (!is_scalar($data)) { $data = $this->serializer->normalize($data, $this->format, $this->context); } $parentNode->setAttribute($attributeName, $data); } elseif ('#' === $key) { $append = $this->selectNodeType($parentNode, $data); } elseif ('#comment' === $key) { if (!\in_array(XML_COMMENT_NODE, $encoderIgnoredNodeTypes, true)) { $append = $this->appendComment($parentNode, $data); } } elseif (\is_array($data) && false === is_numeric($key)) { // Is this array fully numeric keys? if (ctype_digit(implode('', array_keys($data)))) { /* * Create nodes to append to $parentNode based on the $key of this array * Produces <xml><item>0</item><item>1</item></xml> * From ["item" => [0,1]];. */ foreach ($data as $subData) { $append = $this->appendNode($parentNode, $subData, $key); } } else { $append = $this->appendNode($parentNode, $data, $key); } } elseif (is_numeric($key) || !$this->isElementNameValid($key)) { $append = $this->appendNode($parentNode, $data, 'item', $key); } elseif (null !== $data || !$removeEmptyTags) { $append = $this->appendNode($parentNode, $data, $key); } } return $append; } if (\is_object($data)) { $data = $this->serializer->normalize($data, $this->format, $this->context); if (null !== $data && !is_scalar($data)) { return $this->buildXml($parentNode, $data, $xmlRootNodeName); } // top level data object was normalized into a scalar if (!$parentNode->parentNode->parentNode) { $root = $parentNode->parentNode; $root->removeChild($parentNode); return $this->appendNode($root, $data, $xmlRootNodeName); } return $this->appendNode($parentNode, $data, 'data'); } throw new NotEncodableValueException(sprintf('An unexpected value could not be serialized: %s', var_export($data, true))); }
php
private function buildXml(\DOMNode $parentNode, $data, string $xmlRootNodeName = null): bool { $append = true; $removeEmptyTags = $this->context[self::REMOVE_EMPTY_TAGS] ?? $this->defaultContext[self::REMOVE_EMPTY_TAGS] ?? false; $encoderIgnoredNodeTypes = $this->context[self::ENCODER_IGNORED_NODE_TYPES] ?? $this->defaultContext[self::ENCODER_IGNORED_NODE_TYPES]; if (\is_array($data) || ($data instanceof \Traversable && !$this->serializer->supportsNormalization($data, $this->format))) { foreach ($data as $key => $data) { //Ah this is the magic @ attribute types. if (0 === strpos($key, '@') && $this->isElementNameValid($attributeName = substr($key, 1))) { if (!is_scalar($data)) { $data = $this->serializer->normalize($data, $this->format, $this->context); } $parentNode->setAttribute($attributeName, $data); } elseif ('#' === $key) { $append = $this->selectNodeType($parentNode, $data); } elseif ('#comment' === $key) { if (!\in_array(XML_COMMENT_NODE, $encoderIgnoredNodeTypes, true)) { $append = $this->appendComment($parentNode, $data); } } elseif (\is_array($data) && false === is_numeric($key)) { // Is this array fully numeric keys? if (ctype_digit(implode('', array_keys($data)))) { /* * Create nodes to append to $parentNode based on the $key of this array * Produces <xml><item>0</item><item>1</item></xml> * From ["item" => [0,1]];. */ foreach ($data as $subData) { $append = $this->appendNode($parentNode, $subData, $key); } } else { $append = $this->appendNode($parentNode, $data, $key); } } elseif (is_numeric($key) || !$this->isElementNameValid($key)) { $append = $this->appendNode($parentNode, $data, 'item', $key); } elseif (null !== $data || !$removeEmptyTags) { $append = $this->appendNode($parentNode, $data, $key); } } return $append; } if (\is_object($data)) { $data = $this->serializer->normalize($data, $this->format, $this->context); if (null !== $data && !is_scalar($data)) { return $this->buildXml($parentNode, $data, $xmlRootNodeName); } // top level data object was normalized into a scalar if (!$parentNode->parentNode->parentNode) { $root = $parentNode->parentNode; $root->removeChild($parentNode); return $this->appendNode($root, $data, $xmlRootNodeName); } return $this->appendNode($parentNode, $data, 'data'); } throw new NotEncodableValueException(sprintf('An unexpected value could not be serialized: %s', var_export($data, true))); }
[ "private", "function", "buildXml", "(", "\\", "DOMNode", "$", "parentNode", ",", "$", "data", ",", "string", "$", "xmlRootNodeName", "=", "null", ")", ":", "bool", "{", "$", "append", "=", "true", ";", "$", "removeEmptyTags", "=", "$", "this", "->", "c...
Parse the data and convert it to DOMElements. @param array|object $data @throws NotEncodableValueException
[ "Parse", "the", "data", "and", "convert", "it", "to", "DOMElements", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php#L408-L470
train
Build XML from data
[ 30522, 2797, 3853, 3857, 2595, 19968, 1006, 1032, 14383, 3630, 3207, 1002, 6687, 3630, 3207, 1010, 1002, 2951, 1010, 5164, 1002, 20950, 3217, 4140, 3630, 4181, 14074, 1027, 19701, 1007, 1024, 22017, 2140, 1063, 1002, 10439, 10497, 1027, 299...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/traits/UrlMaker.php
UrlMaker.makeUrl
protected function makeUrl() { $controller = Controller::getController() ?: new Controller; return $controller->pageUrl($this->getUrlPageName(), $this->getUrlParams()); }
php
protected function makeUrl() { $controller = Controller::getController() ?: new Controller; return $controller->pageUrl($this->getUrlPageName(), $this->getUrlParams()); }
[ "protected", "function", "makeUrl", "(", ")", "{", "$", "controller", "=", "Controller", "::", "getController", "(", ")", "?", ":", "new", "Controller", ";", "return", "$", "controller", "->", "pageUrl", "(", "$", "this", "->", "getUrlPageName", "(", ")", ...
Generates a real URL based on the page, detected by the primary component. The CMS Controller is used for this process passing the declared params. @return string
[ "Generates", "a", "real", "URL", "based", "on", "the", "page", "detected", "by", "the", "primary", "component", ".", "The", "CMS", "Controller", "is", "used", "for", "this", "process", "passing", "the", "declared", "params", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/traits/UrlMaker.php#L203-L208
train
Make URL to current page
[ 30522, 5123, 3853, 2191, 3126, 2140, 1006, 1007, 1063, 1002, 11486, 1027, 11486, 1024, 1024, 2131, 8663, 13181, 10820, 1006, 1007, 1029, 1024, 2047, 11486, 1025, 2709, 1002, 11486, 1011, 1028, 3931, 3126, 2140, 1006, 1002, 2023, 1011, 1028,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
z-song/laravel-admin
src/Grid/Filter.php
Filter.chunk
public function chunk(callable $callback, $count = 100) { $conditions = array_merge( $this->conditions(), $this->scopeConditions() ); return $this->model->addConditions($conditions)->chunk($callback, $count); }
php
public function chunk(callable $callback, $count = 100) { $conditions = array_merge( $this->conditions(), $this->scopeConditions() ); return $this->model->addConditions($conditions)->chunk($callback, $count); }
[ "public", "function", "chunk", "(", "callable", "$", "callback", ",", "$", "count", "=", "100", ")", "{", "$", "conditions", "=", "array_merge", "(", "$", "this", "->", "conditions", "(", ")", ",", "$", "this", "->", "scopeConditions", "(", ")", ")", ...
@param callable $callback @param int $count @return bool
[ "@param", "callable", "$callback", "@param", "int", "$count" ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid/Filter.php#L509-L517
train
Add conditions to the model and return a chunk of the result set.
[ 30522, 2270, 3853, 20000, 1006, 2655, 3085, 1002, 2655, 5963, 1010, 1002, 4175, 1027, 2531, 1007, 1063, 1002, 3785, 1027, 9140, 1035, 13590, 1006, 1002, 2023, 1011, 30524, 1007, 1011, 1028, 20000, 1006, 1002, 2655, 5963, 1010, 1002, 4175, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Mysqli.php
Zend_Db_Adapter_Mysqli.describeTable
public function describeTable($tableName, $schemaName = null) { /** * @todo use INFORMATION_SCHEMA someday when * MySQL's implementation isn't too slow. */ if ($schemaName) { $sql = 'DESCRIBE ' . $this->quoteIdentifier("$schemaName.$tableName", true); } else { $sql = 'DESCRIBE ' . $this->quoteIdentifier($tableName, true); } /** * Use mysqli extension API, because DESCRIBE doesn't work * well as a prepared statement on MySQL 4.1. */ if ($queryResult = $this->getConnection()->query($sql)) { while ($row = $queryResult->fetch_assoc()) { $result[] = $row; } $queryResult->close(); } else { /** * @see Zend_Db_Adapter_Mysqli_Exception */ // require_once 'Zend/Db/Adapter/Mysqli/Exception.php'; throw new Zend_Db_Adapter_Mysqli_Exception($this->getConnection()->error); } $desc = array(); $row_defaults = array( 'Length' => null, 'Scale' => null, 'Precision' => null, 'Unsigned' => null, 'Primary' => false, 'PrimaryPosition' => null, 'Identity' => false ); $i = 1; $p = 1; foreach ($result as $key => $row) { $row = array_merge($row_defaults, $row); if (preg_match('/unsigned/', $row['Type'])) { $row['Unsigned'] = true; } if (preg_match('/^((?:var)?char)\((\d+)\)/', $row['Type'], $matches)) { $row['Type'] = $matches[1]; $row['Length'] = $matches[2]; } else if (preg_match('/^decimal\((\d+),(\d+)\)/', $row['Type'], $matches)) { $row['Type'] = 'decimal'; $row['Precision'] = $matches[1]; $row['Scale'] = $matches[2]; } else if (preg_match('/^float\((\d+),(\d+)\)/', $row['Type'], $matches)) { $row['Type'] = 'float'; $row['Precision'] = $matches[1]; $row['Scale'] = $matches[2]; } else if (preg_match('/^((?:big|medium|small|tiny)?int)\((\d+)\)/', $row['Type'], $matches)) { $row['Type'] = $matches[1]; /** * The optional argument of a MySQL int type is not precision * or length; it is only a hint for display width. */ } if (strtoupper($row['Key']) == 'PRI') { $row['Primary'] = true; $row['PrimaryPosition'] = $p; if ($row['Extra'] == 'auto_increment') { $row['Identity'] = true; } else { $row['Identity'] = false; } ++$p; } $desc[$this->foldCase($row['Field'])] = array( 'SCHEMA_NAME' => null, // @todo 'TABLE_NAME' => $this->foldCase($tableName), 'COLUMN_NAME' => $this->foldCase($row['Field']), 'COLUMN_POSITION' => $i, 'DATA_TYPE' => $row['Type'], 'DEFAULT' => $row['Default'], 'NULLABLE' => (bool) ($row['Null'] == 'YES'), 'LENGTH' => $row['Length'], 'SCALE' => $row['Scale'], 'PRECISION' => $row['Precision'], 'UNSIGNED' => $row['Unsigned'], 'PRIMARY' => $row['Primary'], 'PRIMARY_POSITION' => $row['PrimaryPosition'], 'IDENTITY' => $row['Identity'] ); ++$i; } return $desc; }
php
public function describeTable($tableName, $schemaName = null) { /** * @todo use INFORMATION_SCHEMA someday when * MySQL's implementation isn't too slow. */ if ($schemaName) { $sql = 'DESCRIBE ' . $this->quoteIdentifier("$schemaName.$tableName", true); } else { $sql = 'DESCRIBE ' . $this->quoteIdentifier($tableName, true); } /** * Use mysqli extension API, because DESCRIBE doesn't work * well as a prepared statement on MySQL 4.1. */ if ($queryResult = $this->getConnection()->query($sql)) { while ($row = $queryResult->fetch_assoc()) { $result[] = $row; } $queryResult->close(); } else { /** * @see Zend_Db_Adapter_Mysqli_Exception */ // require_once 'Zend/Db/Adapter/Mysqli/Exception.php'; throw new Zend_Db_Adapter_Mysqli_Exception($this->getConnection()->error); } $desc = array(); $row_defaults = array( 'Length' => null, 'Scale' => null, 'Precision' => null, 'Unsigned' => null, 'Primary' => false, 'PrimaryPosition' => null, 'Identity' => false ); $i = 1; $p = 1; foreach ($result as $key => $row) { $row = array_merge($row_defaults, $row); if (preg_match('/unsigned/', $row['Type'])) { $row['Unsigned'] = true; } if (preg_match('/^((?:var)?char)\((\d+)\)/', $row['Type'], $matches)) { $row['Type'] = $matches[1]; $row['Length'] = $matches[2]; } else if (preg_match('/^decimal\((\d+),(\d+)\)/', $row['Type'], $matches)) { $row['Type'] = 'decimal'; $row['Precision'] = $matches[1]; $row['Scale'] = $matches[2]; } else if (preg_match('/^float\((\d+),(\d+)\)/', $row['Type'], $matches)) { $row['Type'] = 'float'; $row['Precision'] = $matches[1]; $row['Scale'] = $matches[2]; } else if (preg_match('/^((?:big|medium|small|tiny)?int)\((\d+)\)/', $row['Type'], $matches)) { $row['Type'] = $matches[1]; /** * The optional argument of a MySQL int type is not precision * or length; it is only a hint for display width. */ } if (strtoupper($row['Key']) == 'PRI') { $row['Primary'] = true; $row['PrimaryPosition'] = $p; if ($row['Extra'] == 'auto_increment') { $row['Identity'] = true; } else { $row['Identity'] = false; } ++$p; } $desc[$this->foldCase($row['Field'])] = array( 'SCHEMA_NAME' => null, // @todo 'TABLE_NAME' => $this->foldCase($tableName), 'COLUMN_NAME' => $this->foldCase($row['Field']), 'COLUMN_POSITION' => $i, 'DATA_TYPE' => $row['Type'], 'DEFAULT' => $row['Default'], 'NULLABLE' => (bool) ($row['Null'] == 'YES'), 'LENGTH' => $row['Length'], 'SCALE' => $row['Scale'], 'PRECISION' => $row['Precision'], 'UNSIGNED' => $row['Unsigned'], 'PRIMARY' => $row['Primary'], 'PRIMARY_POSITION' => $row['PrimaryPosition'], 'IDENTITY' => $row['Identity'] ); ++$i; } return $desc; }
[ "public", "function", "describeTable", "(", "$", "tableName", ",", "$", "schemaName", "=", "null", ")", "{", "/**\n * @todo use INFORMATION_SCHEMA someday when\n * MySQL's implementation isn't too slow.\n */", "if", "(", "$", "schemaName", ")", "{", "...
Returns the column descriptions for a table. The return value is an associative array keyed by the column name, as returned by the RDBMS. The value of each array element is an associative array with the following keys: SCHEMA_NAME => string; name of database or schema TABLE_NAME => string; COLUMN_NAME => string; column name COLUMN_POSITION => number; ordinal position of column in table DATA_TYPE => string; SQL datatype name of column DEFAULT => string; default expression of column, null if none NULLABLE => boolean; true if column can have nulls LENGTH => number; length of CHAR/VARCHAR SCALE => number; scale of NUMERIC/DECIMAL PRECISION => number; precision of NUMERIC/DECIMAL UNSIGNED => boolean; unsigned property of an integer type PRIMARY => boolean; true if column is part of the primary key PRIMARY_POSITION => integer; position of column in primary key IDENTITY => integer; true if column is auto-generated with unique values @param string $tableName @param string $schemaName OPTIONAL @return array
[ "Returns", "the", "column", "descriptions", "for", "a", "table", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Adapter/Mysqli.php#L177-L272
train
Describe a table
[ 30522, 2270, 3853, 6235, 10880, 1006, 1002, 2795, 18442, 1010, 1002, 8040, 28433, 18442, 1027, 19701, 1007, 1063, 1013, 1008, 1008, 1008, 1030, 28681, 2080, 2224, 2592, 1035, 8040, 28433, 13834, 2043, 1008, 2026, 2015, 4160, 2140, 1005, 105...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Intl/DateFormatter/DateFormat/FullTransformer.php
FullTransformer.format
public function format(\DateTime $dateTime) { $formatted = preg_replace_callback($this->regExp, function ($matches) use ($dateTime) { return $this->formatReplace($matches[0], $dateTime); }, $this->pattern); return $formatted; }
php
public function format(\DateTime $dateTime) { $formatted = preg_replace_callback($this->regExp, function ($matches) use ($dateTime) { return $this->formatReplace($matches[0], $dateTime); }, $this->pattern); return $formatted; }
[ "public", "function", "format", "(", "\\", "DateTime", "$", "dateTime", ")", "{", "$", "formatted", "=", "preg_replace_callback", "(", "$", "this", "->", "regExp", ",", "function", "(", "$", "matches", ")", "use", "(", "$", "dateTime", ")", "{", "return"...
Format a DateTime using ICU dateformat pattern. @param \DateTime $dateTime A DateTime object to be used to generate the formatted value @return string The formatted value
[ "Format", "a", "DateTime", "using", "ICU", "dateformat", "pattern", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Intl/DateFormatter/DateFormat/FullTransformer.php#L89-L96
train
Format a DateTime with the current locale
[ 30522, 2270, 3853, 4289, 1006, 1032, 3058, 7292, 1002, 3058, 7292, 1007, 1063, 1002, 4289, 3064, 1027, 3653, 2290, 1035, 5672, 1035, 2655, 5963, 1006, 1002, 2023, 1011, 1028, 19723, 10288, 2361, 1010, 3853, 1006, 1002, 3503, 1007, 2224, 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/LockRegistry.php
LockRegistry.setFiles
public static function setFiles(array $files): array { $previousFiles = self::$files; self::$files = $files; foreach (self::$openedFiles as $file) { if ($file) { flock($file, LOCK_UN); fclose($file); } } self::$openedFiles = self::$lockedFiles = []; return $previousFiles; }
php
public static function setFiles(array $files): array { $previousFiles = self::$files; self::$files = $files; foreach (self::$openedFiles as $file) { if ($file) { flock($file, LOCK_UN); fclose($file); } } self::$openedFiles = self::$lockedFiles = []; return $previousFiles; }
[ "public", "static", "function", "setFiles", "(", "array", "$", "files", ")", ":", "array", "{", "$", "previousFiles", "=", "self", "::", "$", "files", ";", "self", "::", "$", "files", "=", "$", "files", ";", "foreach", "(", "self", "::", "$", "opened...
Defines a set of existing files that will be used as keys to acquire locks. @return array The previously defined set of files
[ "Defines", "a", "set", "of", "existing", "files", "that", "will", "be", "used", "as", "keys", "to", "acquire", "locks", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Cache/LockRegistry.php#L66-L80
train
Set the files array
[ 30522, 2270, 10763, 3853, 2275, 8873, 4244, 1006, 9140, 1002, 6764, 1007, 1024, 9140, 1063, 1002, 3025, 8873, 4244, 1027, 2969, 1024, 1024, 1002, 6764, 1025, 2969, 1024, 1024, 1002, 6764, 1027, 1002, 6764, 1025, 18921, 6776, 1006, 2969, 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/Container/Container.php
Container.afterResolving
public function afterResolving($abstract, Closure $callback = null) { if (is_string($abstract)) { $abstract = $this->getAlias($abstract); } if ($abstract instanceof Closure && is_null($callback)) { $this->globalAfterResolvingCallbacks[] = $abstract; } else { $this->afterResolvingCallbacks[$abstract][] = $callback; } }
php
public function afterResolving($abstract, Closure $callback = null) { if (is_string($abstract)) { $abstract = $this->getAlias($abstract); } if ($abstract instanceof Closure && is_null($callback)) { $this->globalAfterResolvingCallbacks[] = $abstract; } else { $this->afterResolvingCallbacks[$abstract][] = $callback; } }
[ "public", "function", "afterResolving", "(", "$", "abstract", ",", "Closure", "$", "callback", "=", "null", ")", "{", "if", "(", "is_string", "(", "$", "abstract", ")", ")", "{", "$", "abstract", "=", "$", "this", "->", "getAlias", "(", "$", "abstract"...
Register a new after resolving callback for all types. @param \Closure|string $abstract @param \Closure|null $callback @return void
[ "Register", "a", "new", "after", "resolving", "callback", "for", "all", "types", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Container/Container.php#L1003-L1014
train
After resolving callback
[ 30522, 2270, 3853, 2044, 6072, 4747, 6455, 1006, 1002, 10061, 1010, 8503, 1002, 2655, 5963, 1027, 19701, 1007, 1063, 2065, 1006, 2003, 1035, 5164, 1006, 1002, 10061, 1007, 1007, 1063, 1002, 10061, 1027, 1002, 2023, 1011, 1028, 2131, 22786, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/Piwik.php
Piwik.getAllSuperUserAccessEmailAddresses
public static function getAllSuperUserAccessEmailAddresses() { $emails = array(); try { $superUsers = APIUsersManager::getInstance()->getUsersHavingSuperUserAccess(); } catch (\Exception $e) { return $emails; } foreach ($superUsers as $superUser) { $emails[$superUser['login']] = $superUser['email']; } return $emails; }
php
public static function getAllSuperUserAccessEmailAddresses() { $emails = array(); try { $superUsers = APIUsersManager::getInstance()->getUsersHavingSuperUserAccess(); } catch (\Exception $e) { return $emails; } foreach ($superUsers as $superUser) { $emails[$superUser['login']] = $superUser['email']; } return $emails; }
[ "public", "static", "function", "getAllSuperUserAccessEmailAddresses", "(", ")", "{", "$", "emails", "=", "array", "(", ")", ";", "try", "{", "$", "superUsers", "=", "APIUsersManager", "::", "getInstance", "(", ")", "->", "getUsersHavingSuperUserAccess", "(", ")...
Get a list of all email addresses having Super User access. @return array
[ "Get", "a", "list", "of", "all", "email", "addresses", "having", "Super", "User", "access", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Piwik.php#L184-L199
train
Get all email addresses having Super User access
[ 30522, 2270, 10763, 3853, 2131, 8095, 6342, 4842, 20330, 6305, 9623, 3366, 21397, 4215, 16200, 11393, 2015, 1006, 1007, 1063, 1002, 22028, 30524, 2015, 1027, 17928, 20330, 11512, 17325, 1024, 1024, 2131, 7076, 26897, 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/system/classes/MediaLibraryItem.php
MediaLibraryItem.getFileType
public function getFileType() { if (!$this->isFile()) { return null; } if (!self::$imageExtensions) { self::$imageExtensions = array_map('strtolower', Config::get('cms.storage.media.imageExtensions', FileDefinitions::get('imageExtensions'))); self::$videoExtensions = array_map('strtolower', Config::get('cms.storage.media.videoExtensions', FileDefinitions::get('videoExtensions'))); self::$audioExtensions = array_map('strtolower', Config::get('cms.storage.media.audioExtensions', FileDefinitions::get('audioExtensions'))); } $extension = strtolower(pathinfo($this->path, PATHINFO_EXTENSION)); if (!strlen($extension)) { return self::FILE_TYPE_DOCUMENT; } if (in_array($extension, self::$imageExtensions)) { return self::FILE_TYPE_IMAGE; } if (in_array($extension, self::$videoExtensions)) { return self::FILE_TYPE_VIDEO; } if (in_array($extension, self::$audioExtensions)) { return self::FILE_TYPE_AUDIO; } return self::FILE_TYPE_DOCUMENT; }
php
public function getFileType() { if (!$this->isFile()) { return null; } if (!self::$imageExtensions) { self::$imageExtensions = array_map('strtolower', Config::get('cms.storage.media.imageExtensions', FileDefinitions::get('imageExtensions'))); self::$videoExtensions = array_map('strtolower', Config::get('cms.storage.media.videoExtensions', FileDefinitions::get('videoExtensions'))); self::$audioExtensions = array_map('strtolower', Config::get('cms.storage.media.audioExtensions', FileDefinitions::get('audioExtensions'))); } $extension = strtolower(pathinfo($this->path, PATHINFO_EXTENSION)); if (!strlen($extension)) { return self::FILE_TYPE_DOCUMENT; } if (in_array($extension, self::$imageExtensions)) { return self::FILE_TYPE_IMAGE; } if (in_array($extension, self::$videoExtensions)) { return self::FILE_TYPE_VIDEO; } if (in_array($extension, self::$audioExtensions)) { return self::FILE_TYPE_AUDIO; } return self::FILE_TYPE_DOCUMENT; }
[ "public", "function", "getFileType", "(", ")", "{", "if", "(", "!", "$", "this", "->", "isFile", "(", ")", ")", "{", "return", "null", ";", "}", "if", "(", "!", "self", "::", "$", "imageExtensions", ")", "{", "self", "::", "$", "imageExtensions", "...
Returns the file type by its name. The known file types are: image, video, audio, document @return string Returns the file type or NULL if the item is a folder.
[ "Returns", "the", "file", "type", "by", "its", "name", ".", "The", "known", "file", "types", "are", ":", "image", "video", "audio", "document" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/classes/MediaLibraryItem.php#L98-L128
train
Return the file type
[ 30522, 2270, 3853, 2131, 8873, 7485, 18863, 1006, 1007, 1063, 2065, 1006, 999, 1002, 2023, 1011, 1028, 2003, 8873, 2571, 1006, 1007, 1007, 1063, 2709, 19701, 1025, 1065, 2065, 1006, 999, 2969, 1024, 1024, 1002, 3746, 10288, 29048, 2015, 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/Database/Eloquent/Relations/MorphTo.php
MorphTo.gatherKeysByType
protected function gatherKeysByType($type) { return collect($this->dictionary[$type])->map(function ($models) { return head($models)->{$this->foreignKey}; })->values()->unique()->all(); }
php
protected function gatherKeysByType($type) { return collect($this->dictionary[$type])->map(function ($models) { return head($models)->{$this->foreignKey}; })->values()->unique()->all(); }
[ "protected", "function", "gatherKeysByType", "(", "$", "type", ")", "{", "return", "collect", "(", "$", "this", "->", "dictionary", "[", "$", "type", "]", ")", "->", "map", "(", "function", "(", "$", "models", ")", "{", "return", "head", "(", "$", "m...
Gather all of the foreign keys for a given type. @param string $type @return array
[ "Gather", "all", "of", "the", "foreign", "keys", "for", "a", "given", "type", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Relations/MorphTo.php#L127-L132
train
Gather all keys by type
[ 30522, 5123, 3853, 8587, 14839, 14478, 13874, 1006, 1002, 2828, 1007, 1063, 2709, 8145, 1006, 1002, 2023, 1011, 1028, 9206, 1031, 1002, 2828, 1033, 1007, 1011, 1028, 4949, 1006, 3853, 1006, 1002, 4275, 1007, 1063, 2709, 2132, 1006, 1002, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/Page/Page.php
Page.order
public function order($var = null) { if ($var !== null) { $order = $var ? sprintf('%02d.', (int)$var) : ''; $this->folder($order . preg_replace(PAGE_ORDER_PREFIX_REGEX, '', $this->folder)); return $order; } preg_match(PAGE_ORDER_PREFIX_REGEX, $this->folder, $order); return $order[0] ?? false; }
php
public function order($var = null) { if ($var !== null) { $order = $var ? sprintf('%02d.', (int)$var) : ''; $this->folder($order . preg_replace(PAGE_ORDER_PREFIX_REGEX, '', $this->folder)); return $order; } preg_match(PAGE_ORDER_PREFIX_REGEX, $this->folder, $order); return $order[0] ?? false; }
[ "public", "function", "order", "(", "$", "var", "=", "null", ")", "{", "if", "(", "$", "var", "!==", "null", ")", "{", "$", "order", "=", "$", "var", "?", "sprintf", "(", "'%02d.'", ",", "(", "int", ")", "$", "var", ")", ":", "''", ";", "$", ...
Get/set order number of this page. @param int $var @return int|bool
[ "Get", "/", "set", "order", "number", "of", "this", "page", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L1781-L1793
train
Get Page Order
[ 30522, 2270, 3853, 2344, 1006, 1002, 13075, 1027, 19701, 1007, 1063, 2065, 1006, 1002, 13075, 999, 1027, 1027, 19701, 1007, 1063, 1002, 2344, 1027, 1002, 13075, 1029, 9043, 2546, 1006, 1005, 1003, 6185, 2094, 1012, 1005, 1010, 1006, 20014, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/UsersManager/API.php
API.userExists
public function userExists($userLogin) { if ($userLogin == 'anonymous') { return true; } Piwik::checkUserIsNotAnonymous(); Piwik::checkUserHasSomeViewAccess(); if ($userLogin == Piwik::getCurrentUserLogin()) { return true; } return $this->model->userExists($userLogin); }
php
public function userExists($userLogin) { if ($userLogin == 'anonymous') { return true; } Piwik::checkUserIsNotAnonymous(); Piwik::checkUserHasSomeViewAccess(); if ($userLogin == Piwik::getCurrentUserLogin()) { return true; } return $this->model->userExists($userLogin); }
[ "public", "function", "userExists", "(", "$", "userLogin", ")", "{", "if", "(", "$", "userLogin", "==", "'anonymous'", ")", "{", "return", "true", ";", "}", "Piwik", "::", "checkUserIsNotAnonymous", "(", ")", ";", "Piwik", "::", "checkUserHasSomeViewAccess", ...
Returns true if the given userLogin is known in the database @param string $userLogin @return bool true if the user is known
[ "Returns", "true", "if", "the", "given", "userLogin", "is", "known", "in", "the", "database" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/UsersManager/API.php#L975-L989
train
Checks if a user exists in the database
[ 30522, 2270, 3853, 5310, 10288, 5130, 1006, 1002, 5310, 21197, 2378, 1007, 1063, 2065, 1006, 1002, 5310, 21197, 2378, 1027, 1027, 1005, 10812, 1005, 1007, 1063, 2709, 2995, 1025, 1065, 14255, 9148, 2243, 1024, 1024, 4638, 20330, 2483, 17048...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Cookie/SessionCookieJar.php
SessionCookieJar.save
public function save() { $json = []; foreach ($this as $cookie) { /** @var SetCookie $cookie */ if (CookieJar::shouldPersist($cookie, $this->storeSessionCookies)) { $json[] = $cookie->toArray(); } } $_SESSION[$this->sessionKey] = json_encode($json); }
php
public function save() { $json = []; foreach ($this as $cookie) { /** @var SetCookie $cookie */ if (CookieJar::shouldPersist($cookie, $this->storeSessionCookies)) { $json[] = $cookie->toArray(); } } $_SESSION[$this->sessionKey] = json_encode($json); }
[ "public", "function", "save", "(", ")", "{", "$", "json", "=", "[", "]", ";", "foreach", "(", "$", "this", "as", "$", "cookie", ")", "{", "/** @var SetCookie $cookie */", "if", "(", "CookieJar", "::", "shouldPersist", "(", "$", "cookie", ",", "$", "thi...
Save cookies to the client session
[ "Save", "cookies", "to", "the", "client", "session" ]
bf595424e4d442a190582e088985dc835a789071
https://github.com/guzzle/guzzle/blob/bf595424e4d442a190582e088985dc835a789071/src/Cookie/SessionCookieJar.php#L41-L52
train
Save session cookies
[ 30522, 2270, 3853, 3828, 1006, 1007, 1063, 1002, 1046, 3385, 1027, 1031, 1033, 1025, 18921, 6776, 1006, 1002, 2023, 2004, 1002, 17387, 1007, 1063, 1013, 1008, 1008, 1030, 13075, 2275, 3597, 23212, 2063, 1002, 17387, 1008, 1013, 2065, 1006, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/backend/widgets/MediaManager.php
MediaManager.cropImage
protected function cropImage($imageSrcPath, $selectionData, $cropSessionKey, $path) { $originalFileName = basename($path); $path = rtrim(dirname($path), '/').'/'; $fileName = basename($imageSrcPath); if ( strpos($fileName, '..') !== false || strpos($fileName, '/') !== false || strpos($fileName, '\\') !== false ) { throw new SystemException('Invalid image file name.'); } $selectionParams = ['x', 'y', 'w', 'h']; foreach ($selectionParams as $paramName) { if (!array_key_exists($paramName, $selectionData)) { throw new SystemException('Invalid selection data.'); } if (!is_numeric($selectionData[$paramName])) { throw new SystemException('Invalid selection data.'); } $selectionData[$paramName] = (int) $selectionData[$paramName]; } $sessionDirectoryPath = $this->getCropSessionDirPath($cropSessionKey); $fullSessionDirectoryPath = temp_path($sessionDirectoryPath); if (!File::isDirectory($fullSessionDirectoryPath)) { throw new SystemException('The image editing session is not found.'); } /* * Find the image on the disk and resize it */ $imagePath = $fullSessionDirectoryPath.'/'.$fileName; if (!File::isFile($imagePath)) { throw new SystemException('The image is not found on the disk.'); } $extension = pathinfo($originalFileName, PATHINFO_EXTENSION); $targetImageName = basename($originalFileName, '.'.$extension).'-' .$selectionData['x'].'-' .$selectionData['y'].'-' .$selectionData['w'].'-' .$selectionData['h'].'-'; $targetImageName .= time(); $targetImageName .= '.'.$extension; $targetTmpPath = $fullSessionDirectoryPath.'/'.$targetImageName; /* * Crop the image, otherwise copy original to target destination. */ if ($selectionData['w'] == 0 || $selectionData['h'] == 0) { File::copy($imagePath, $targetTmpPath); } else { Resizer::open($imagePath) ->crop( $selectionData['x'], $selectionData['y'], $selectionData['w'], $selectionData['h'], $selectionData['w'], $selectionData['h'] ) ->save($targetTmpPath) ; } /* * Upload the cropped file to the Library */ $targetFolder = $path.'cropped-images'; $targetPath = $targetFolder.'/'.$targetImageName; $library = MediaLibrary::instance(); $library->put($targetPath, file_get_contents($targetTmpPath)); return [ 'publicUrl' => $library->getPathUrl($targetPath), 'documentType' => MediaLibraryItem::FILE_TYPE_IMAGE, 'itemType' => MediaLibraryItem::TYPE_FILE, 'path' => $targetPath, 'title' => $targetImageName, 'folder' => $targetFolder ]; }
php
protected function cropImage($imageSrcPath, $selectionData, $cropSessionKey, $path) { $originalFileName = basename($path); $path = rtrim(dirname($path), '/').'/'; $fileName = basename($imageSrcPath); if ( strpos($fileName, '..') !== false || strpos($fileName, '/') !== false || strpos($fileName, '\\') !== false ) { throw new SystemException('Invalid image file name.'); } $selectionParams = ['x', 'y', 'w', 'h']; foreach ($selectionParams as $paramName) { if (!array_key_exists($paramName, $selectionData)) { throw new SystemException('Invalid selection data.'); } if (!is_numeric($selectionData[$paramName])) { throw new SystemException('Invalid selection data.'); } $selectionData[$paramName] = (int) $selectionData[$paramName]; } $sessionDirectoryPath = $this->getCropSessionDirPath($cropSessionKey); $fullSessionDirectoryPath = temp_path($sessionDirectoryPath); if (!File::isDirectory($fullSessionDirectoryPath)) { throw new SystemException('The image editing session is not found.'); } /* * Find the image on the disk and resize it */ $imagePath = $fullSessionDirectoryPath.'/'.$fileName; if (!File::isFile($imagePath)) { throw new SystemException('The image is not found on the disk.'); } $extension = pathinfo($originalFileName, PATHINFO_EXTENSION); $targetImageName = basename($originalFileName, '.'.$extension).'-' .$selectionData['x'].'-' .$selectionData['y'].'-' .$selectionData['w'].'-' .$selectionData['h'].'-'; $targetImageName .= time(); $targetImageName .= '.'.$extension; $targetTmpPath = $fullSessionDirectoryPath.'/'.$targetImageName; /* * Crop the image, otherwise copy original to target destination. */ if ($selectionData['w'] == 0 || $selectionData['h'] == 0) { File::copy($imagePath, $targetTmpPath); } else { Resizer::open($imagePath) ->crop( $selectionData['x'], $selectionData['y'], $selectionData['w'], $selectionData['h'], $selectionData['w'], $selectionData['h'] ) ->save($targetTmpPath) ; } /* * Upload the cropped file to the Library */ $targetFolder = $path.'cropped-images'; $targetPath = $targetFolder.'/'.$targetImageName; $library = MediaLibrary::instance(); $library->put($targetPath, file_get_contents($targetTmpPath)); return [ 'publicUrl' => $library->getPathUrl($targetPath), 'documentType' => MediaLibraryItem::FILE_TYPE_IMAGE, 'itemType' => MediaLibraryItem::TYPE_FILE, 'path' => $targetPath, 'title' => $targetImageName, 'folder' => $targetFolder ]; }
[ "protected", "function", "cropImage", "(", "$", "imageSrcPath", ",", "$", "selectionData", ",", "$", "cropSessionKey", ",", "$", "path", ")", "{", "$", "originalFileName", "=", "basename", "(", "$", "path", ")", ";", "$", "path", "=", "rtrim", "(", "dirn...
Business logic to crop a media library image @param string $imageSrcPath @param string $selectionData @param string $cropSessionKey @param string $path @return array
[ "Business", "logic", "to", "crop", "a", "media", "library", "image" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/MediaManager.php#L1759-L1853
train
Crop image.
[ 30522, 5123, 3853, 10416, 9581, 3351, 1006, 1002, 4871, 11890, 15069, 1010, 1002, 4989, 2850, 2696, 1010, 1002, 8765, 7971, 3258, 14839, 1010, 1002, 4130, 1007, 1063, 1002, 2434, 8873, 20844, 4168, 1027, 2918, 18442, 1006, 1002, 4130, 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
libs/Zend/Cache/Backend/File.php
Zend_Cache_Backend_File._remove
protected function _remove($file) { if (!is_file($file)) { return false; } if (!@unlink($file)) { # we can't remove the file (because of locks or any problem) $this->_log("Zend_Cache_Backend_File::_remove() : we can't remove $file"); return false; } return true; }
php
protected function _remove($file) { if (!is_file($file)) { return false; } if (!@unlink($file)) { # we can't remove the file (because of locks or any problem) $this->_log("Zend_Cache_Backend_File::_remove() : we can't remove $file"); return false; } return true; }
[ "protected", "function", "_remove", "(", "$", "file", ")", "{", "if", "(", "!", "is_file", "(", "$", "file", ")", ")", "{", "return", "false", ";", "}", "if", "(", "!", "@", "unlink", "(", "$", "file", ")", ")", "{", "# we can't remove the file (beca...
Remove a file If we can't remove the file (because of locks or any problem), we will touch the file to invalidate it @param string $file Complete file path @return boolean True if ok
[ "Remove", "a", "file" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Cache/Backend/File.php#L610-L621
train
Remove a file
[ 30522, 5123, 3853, 1035, 6366, 1006, 1002, 5371, 1007, 1063, 2065, 1006, 999, 2003, 1035, 5371, 1006, 1002, 5371, 1007, 1007, 1063, 2709, 6270, 1025, 1065, 2065, 1006, 999, 1030, 4895, 13767, 1006, 1002, 5371, 1007, 1007, 1063, 1001, 2057...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/Db/BatchInsert.php
BatchInsert.createCSVFile
protected static function createCSVFile($filePath, $fileSpec, $rows) { // Set up CSV delimiters, quotes, etc $delim = $fileSpec['delim']; $quote = $fileSpec['quote']; $eol = $fileSpec['eol']; $null = $fileSpec['null']; $escapespecial_cb = $fileSpec['escapespecial_cb']; $fp = @fopen($filePath, 'wb'); if (!$fp) { throw new Exception('Error creating the tmp file ' . $filePath . ', please check that the webserver has write permission to write this file.'); } foreach ($rows as $row) { $output = ''; foreach ($row as $value) { if (!isset($value) || is_null($value) || $value === false) { $output .= $null . $delim; } else { $output .= $quote . $escapespecial_cb($value) . $quote . $delim; } } // Replace delim with eol $output = substr_replace($output, $eol, -1); $ret = fwrite($fp, $output); if (!$ret) { fclose($fp); throw new Exception('Error writing to the tmp file ' . $filePath); } } fclose($fp); @chmod($filePath, 0777); }
php
protected static function createCSVFile($filePath, $fileSpec, $rows) { // Set up CSV delimiters, quotes, etc $delim = $fileSpec['delim']; $quote = $fileSpec['quote']; $eol = $fileSpec['eol']; $null = $fileSpec['null']; $escapespecial_cb = $fileSpec['escapespecial_cb']; $fp = @fopen($filePath, 'wb'); if (!$fp) { throw new Exception('Error creating the tmp file ' . $filePath . ', please check that the webserver has write permission to write this file.'); } foreach ($rows as $row) { $output = ''; foreach ($row as $value) { if (!isset($value) || is_null($value) || $value === false) { $output .= $null . $delim; } else { $output .= $quote . $escapespecial_cb($value) . $quote . $delim; } } // Replace delim with eol $output = substr_replace($output, $eol, -1); $ret = fwrite($fp, $output); if (!$ret) { fclose($fp); throw new Exception('Error writing to the tmp file ' . $filePath); } } fclose($fp); @chmod($filePath, 0777); }
[ "protected", "static", "function", "createCSVFile", "(", "$", "filePath", ",", "$", "fileSpec", ",", "$", "rows", ")", "{", "// Set up CSV delimiters, quotes, etc", "$", "delim", "=", "$", "fileSpec", "[", "'delim'", "]", ";", "$", "quote", "=", "$", "fileSp...
Create CSV (or other delimited) files @param string $filePath filename to create @param array $fileSpec File specifications (delimiter, line terminator, etc) @param array $rows Array of array corresponding to rows of values @throws Exception if unable to create or write to file
[ "Create", "CSV", "(", "or", "other", "delimited", ")", "files" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Db/BatchInsert.php#L238-L275
train
Create CSV file
[ 30522, 5123, 10763, 3853, 3443, 6169, 2615, 8873, 2571, 1006, 1002, 5371, 15069, 1010, 1002, 6764, 5051, 2278, 1010, 1002, 10281, 1007, 1063, 1013, 1013, 2275, 2039, 20116, 2615, 3972, 27605, 7747, 1010, 16614, 1010, 4385, 1002, 3972, 5714,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/MemberMetadata.php
MemberMetadata.addConstraint
public function addConstraint(Constraint $constraint) { if (!\in_array(Constraint::PROPERTY_CONSTRAINT, (array) $constraint->getTargets())) { throw new ConstraintDefinitionException(sprintf('The constraint %s cannot be put on properties or getters', \get_class($constraint))); } parent::addConstraint($constraint); return $this; }
php
public function addConstraint(Constraint $constraint) { if (!\in_array(Constraint::PROPERTY_CONSTRAINT, (array) $constraint->getTargets())) { throw new ConstraintDefinitionException(sprintf('The constraint %s cannot be put on properties or getters', \get_class($constraint))); } parent::addConstraint($constraint); return $this; }
[ "public", "function", "addConstraint", "(", "Constraint", "$", "constraint", ")", "{", "if", "(", "!", "\\", "in_array", "(", "Constraint", "::", "PROPERTY_CONSTRAINT", ",", "(", "array", ")", "$", "constraint", "->", "getTargets", "(", ")", ")", ")", "{",...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Validator/Mapping/MemberMetadata.php#L72-L81
train
Add a new constraint to the list of constraints
[ 30522, 2270, 3853, 5587, 8663, 20528, 18447, 1006, 27142, 1002, 27142, 1007, 1063, 2065, 1006, 999, 1032, 1999, 1035, 9140, 1006, 27142, 1024, 1024, 3200, 1035, 27142, 1010, 1006, 9140, 1007, 1002, 27142, 1011, 1028, 2131, 7559, 18150, 2015...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Transitions/API.php
API.deriveIdAction
private function deriveIdAction($actionName, $actionType) { switch ($actionType) { case 'url': $originalActionName = $actionName; $actionName = Common::unsanitizeInputValue($actionName); $id = TableLogAction::getIdActionFromSegment($actionName, 'idaction_url', SegmentExpression::MATCH_EQUAL, 'pageUrl'); if ($id < 0) { // an example where this is needed is urls containing < or > $actionName = $originalActionName; $id = TableLogAction::getIdActionFromSegment($actionName, 'idaction_url', SegmentExpression::MATCH_EQUAL, 'pageUrl'); } return $id; case 'title': $id = TableLogAction::getIdActionFromSegment($actionName, 'idaction_name', SegmentExpression::MATCH_EQUAL, 'pageTitle'); if ($id < 0) { $unknown = ArchivingHelper::getUnknownActionName(Action::TYPE_PAGE_TITLE); if (trim($actionName) == trim($unknown)) { $id = TableLogAction::getIdActionFromSegment('', 'idaction_name', SegmentExpression::MATCH_EQUAL, 'pageTitle'); } } return $id; default: throw new Exception('Unknown action type'); } }
php
private function deriveIdAction($actionName, $actionType) { switch ($actionType) { case 'url': $originalActionName = $actionName; $actionName = Common::unsanitizeInputValue($actionName); $id = TableLogAction::getIdActionFromSegment($actionName, 'idaction_url', SegmentExpression::MATCH_EQUAL, 'pageUrl'); if ($id < 0) { // an example where this is needed is urls containing < or > $actionName = $originalActionName; $id = TableLogAction::getIdActionFromSegment($actionName, 'idaction_url', SegmentExpression::MATCH_EQUAL, 'pageUrl'); } return $id; case 'title': $id = TableLogAction::getIdActionFromSegment($actionName, 'idaction_name', SegmentExpression::MATCH_EQUAL, 'pageTitle'); if ($id < 0) { $unknown = ArchivingHelper::getUnknownActionName(Action::TYPE_PAGE_TITLE); if (trim($actionName) == trim($unknown)) { $id = TableLogAction::getIdActionFromSegment('', 'idaction_name', SegmentExpression::MATCH_EQUAL, 'pageTitle'); } } return $id; default: throw new Exception('Unknown action type'); } }
[ "private", "function", "deriveIdAction", "(", "$", "actionName", ",", "$", "actionType", ")", "{", "switch", "(", "$", "actionType", ")", "{", "case", "'url'", ":", "$", "originalActionName", "=", "$", "actionName", ";", "$", "actionName", "=", "Common", "...
Derive the action ID from the request action name and type.
[ "Derive", "the", "action", "ID", "from", "the", "request", "action", "name", "and", "type", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Transitions/API.php#L128-L159
train
Derives the idaction from the action name and action type
[ 30522, 2797, 3853, 18547, 8524, 7542, 1006, 1002, 2895, 18442, 1010, 1002, 2895, 13874, 1007, 1063, 6942, 1006, 1002, 30524, 8909, 1027, 2795, 21197, 18908, 3258, 1024, 1024, 2131, 8524, 7542, 19699, 22225, 13910, 3672, 1006, 1002, 2895, 18...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Support/Collection.php
Collection.unique
public function unique($key = null, $strict = false) { $callback = $this->valueRetriever($key); $exists = []; return $this->reject(function ($item, $key) use ($callback, $strict, &$exists) { if (in_array($id = $callback($item, $key), $exists, $strict)) { return true; } $exists[] = $id; }); }
php
public function unique($key = null, $strict = false) { $callback = $this->valueRetriever($key); $exists = []; return $this->reject(function ($item, $key) use ($callback, $strict, &$exists) { if (in_array($id = $callback($item, $key), $exists, $strict)) { return true; } $exists[] = $id; }); }
[ "public", "function", "unique", "(", "$", "key", "=", "null", ",", "$", "strict", "=", "false", ")", "{", "$", "callback", "=", "$", "this", "->", "valueRetriever", "(", "$", "key", ")", ";", "$", "exists", "=", "[", "]", ";", "return", "$", "thi...
Return only unique items from the collection array. @param string|callable|null $key @param bool $strict @return static
[ "Return", "only", "unique", "items", "from", "the", "collection", "array", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Support/Collection.php#L1818-L1831
train
Return an array with unique items from the collection
[ 30522, 2270, 3853, 4310, 1006, 1002, 3145, 1027, 19701, 1010, 1002, 9384, 1027, 6270, 1007, 1063, 1002, 2655, 5963, 1027, 1002, 2023, 1011, 1028, 3643, 13465, 7373, 30524, 1002, 8909, 1027, 1002, 2655, 5963, 1006, 1002, 8875, 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...
overtrue/wechat
src/OfficialAccount/Comment/Client.php
Client.list
public function list(string $msgId, int $index, int $begin, int $count, int $type = 0) { $params = [ 'msg_data_id' => $msgId, 'index' => $index, 'begin' => $begin, 'count' => $count, 'type' => $type, ]; return $this->httpPostJson('cgi-bin/comment/list', $params); }
php
public function list(string $msgId, int $index, int $begin, int $count, int $type = 0) { $params = [ 'msg_data_id' => $msgId, 'index' => $index, 'begin' => $begin, 'count' => $count, 'type' => $type, ]; return $this->httpPostJson('cgi-bin/comment/list', $params); }
[ "public", "function", "list", "(", "string", "$", "msgId", ",", "int", "$", "index", ",", "int", "$", "begin", ",", "int", "$", "count", ",", "int", "$", "type", "=", "0", ")", "{", "$", "params", "=", "[", "'msg_data_id'", "=>", "$", "msgId", ",...
Get article comments. @param string $msgId @param int $index @param int $begin @param int $count @param int $type @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string
[ "Get", "article", "comments", "." ]
120c72faaa93c270365bc75c73c362d5fd583209
https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/OfficialAccount/Comment/Client.php#L70-L81
train
List comments in the site
[ 30522, 2270, 3853, 2862, 1006, 5164, 1002, 5796, 5856, 2094, 1010, 20014, 1002, 5950, 1010, 20014, 1002, 4088, 1010, 20014, 1002, 4175, 1010, 20014, 1002, 2828, 1027, 1014, 1007, 1063, 1002, 11498, 5244, 1027, 1031, 1005, 5796, 2290, 1035, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Console/Scheduling/Schedule.php
Schedule.useCache
public function useCache($store) { if ($this->eventMutex instanceof CacheEventMutex) { $this->eventMutex->useStore($store); } if ($this->schedulingMutex instanceof CacheSchedulingMutex) { $this->schedulingMutex->useStore($store); } return $this; }
php
public function useCache($store) { if ($this->eventMutex instanceof CacheEventMutex) { $this->eventMutex->useStore($store); } if ($this->schedulingMutex instanceof CacheSchedulingMutex) { $this->schedulingMutex->useStore($store); } return $this; }
[ "public", "function", "useCache", "(", "$", "store", ")", "{", "if", "(", "$", "this", "->", "eventMutex", "instanceof", "CacheEventMutex", ")", "{", "$", "this", "->", "eventMutex", "->", "useStore", "(", "$", "store", ")", ";", "}", "if", "(", "$", ...
Specify the cache store that should be used to store mutexes. @param string $store @return $this
[ "Specify", "the", "cache", "store", "that", "should", "be", "used", "to", "store", "mutexes", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Console/Scheduling/Schedule.php#L197-L208
train
Use cache for this thread
[ 30522, 2270, 3853, 2224, 3540, 5403, 1006, 1002, 3573, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 2724, 26746, 2595, 6013, 11253, 17053, 18697, 3372, 26746, 2595, 1007, 1063, 1002, 2023, 1011, 1028, 2724, 26746, 2595, 1011, 1028, 3594,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
barryvdh/laravel-debugbar
src/LaravelDebugbar.php
LaravelDebugbar.injectDebugbar
public function injectDebugbar(Response $response) { $content = $response->getContent(); $renderer = $this->getJavascriptRenderer(); if ($this->getStorage()) { $openHandlerUrl = route('debugbar.openhandler'); $renderer->setOpenHandlerUrl($openHandlerUrl); } $renderedContent = $renderer->renderHead() . $renderer->render(); $pos = strripos($content, '</body>'); if (false !== $pos) { $content = substr($content, 0, $pos) . $renderedContent . substr($content, $pos); } else { $content = $content . $renderedContent; } // Update the new content and reset the content length $response->setContent($content); $response->headers->remove('Content-Length'); }
php
public function injectDebugbar(Response $response) { $content = $response->getContent(); $renderer = $this->getJavascriptRenderer(); if ($this->getStorage()) { $openHandlerUrl = route('debugbar.openhandler'); $renderer->setOpenHandlerUrl($openHandlerUrl); } $renderedContent = $renderer->renderHead() . $renderer->render(); $pos = strripos($content, '</body>'); if (false !== $pos) { $content = substr($content, 0, $pos) . $renderedContent . substr($content, $pos); } else { $content = $content . $renderedContent; } // Update the new content and reset the content length $response->setContent($content); $response->headers->remove('Content-Length'); }
[ "public", "function", "injectDebugbar", "(", "Response", "$", "response", ")", "{", "$", "content", "=", "$", "response", "->", "getContent", "(", ")", ";", "$", "renderer", "=", "$", "this", "->", "getJavascriptRenderer", "(", ")", ";", "if", "(", "$", ...
Injects the web debug toolbar into the given Response. @param \Symfony\Component\HttpFoundation\Response $response A Response instance Based on https://github.com/symfony/WebProfilerBundle/blob/master/EventListener/WebDebugToolbarListener.php
[ "Injects", "the", "web", "debug", "toolbar", "into", "the", "given", "Response", "." ]
2d195779ea4f809f69764a795e2ec371dbb76a96
https://github.com/barryvdh/laravel-debugbar/blob/2d195779ea4f809f69764a795e2ec371dbb76a96/src/LaravelDebugbar.php#L841-L863
train
Injects the debugbar into the response
[ 30522, 2270, 3853, 1999, 20614, 3207, 8569, 18259, 2906, 1006, 3433, 1002, 3433, 1007, 1063, 1002, 4180, 1027, 1002, 3433, 1011, 1028, 2131, 8663, 6528, 2102, 1006, 1007, 1025, 1002, 17552, 2121, 1027, 1002, 2023, 1011, 1028, 2131, 3900, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Model.php
Model.setPaginate
protected function setPaginate() { $paginate = $this->findQueryByMethod('paginate'); $this->queries = $this->queries->reject(function ($query) { return $query['method'] == 'paginate'; }); if (!$this->usePaginate) { $query = [ 'method' => 'get', 'arguments' => [], ]; } else { $query = [ 'method' => 'paginate', 'arguments' => $this->resolvePerPage($paginate), ]; } $this->queries->push($query); }
php
protected function setPaginate() { $paginate = $this->findQueryByMethod('paginate'); $this->queries = $this->queries->reject(function ($query) { return $query['method'] == 'paginate'; }); if (!$this->usePaginate) { $query = [ 'method' => 'get', 'arguments' => [], ]; } else { $query = [ 'method' => 'paginate', 'arguments' => $this->resolvePerPage($paginate), ]; } $this->queries->push($query); }
[ "protected", "function", "setPaginate", "(", ")", "{", "$", "paginate", "=", "$", "this", "->", "findQueryByMethod", "(", "'paginate'", ")", ";", "$", "this", "->", "queries", "=", "$", "this", "->", "queries", "->", "reject", "(", "function", "(", "$", ...
Set the grid paginate. @return void
[ "Set", "the", "grid", "paginate", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid/Model.php#L439-L460
train
Set the paginator
[ 30522, 5123, 3853, 2275, 4502, 20876, 2618, 1006, 1007, 1063, 1002, 6643, 20876, 2618, 1027, 1002, 2023, 1011, 1028, 2424, 4226, 2854, 3762, 11368, 6806, 2094, 1006, 1005, 6643, 20876, 2618, 1005, 1007, 1025, 1002, 2023, 1011, 1028, 10861, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Authorizable.php
Authorizable.can
public function can($ability, $arguments = []) { return app(Gate::class)->forUser($this)->check($ability, $arguments); }
php
public function can($ability, $arguments = []) { return app(Gate::class)->forUser($this)->check($ability, $arguments); }
[ "public", "function", "can", "(", "$", "ability", ",", "$", "arguments", "=", "[", "]", ")", "{", "return", "app", "(", "Gate", "::", "class", ")", "->", "forUser", "(", "$", "this", ")", "->", "check", "(", "$", "ability", ",", "$", "arguments", ...
Determine if the entity has a given ability. @param string $ability @param array|mixed $arguments @return bool
[ "Determine", "if", "the", "entity", "has", "a", "given", "ability", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Foundation/Auth/Access/Authorizable.php#L16-L19
train
Can user access to this page?
[ 30522, 2270, 3853, 2064, 1006, 1002, 3754, 1010, 1002, 9918, 1027, 1031, 1033, 1007, 1063, 2709, 10439, 1006, 4796, 1024, 1024, 2465, 1007, 1011, 1028, 2005, 20330, 1006, 1002, 2023, 1007, 1011, 1028, 4638, 1006, 1002, 3754, 1010, 1002, 9...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/system/traits/AssetMaker.php
AssetMaker.combineAssets
public function combineAssets(array $assets, $localPath = '') { // Short circuit if no assets actually provided if (empty($assets)) { return ''; } $assetPath = !empty($localPath) ? $localPath : $this->assetPath; return Url::to(CombineAssets::combine($assets, $assetPath)); }
php
public function combineAssets(array $assets, $localPath = '') { // Short circuit if no assets actually provided if (empty($assets)) { return ''; } $assetPath = !empty($localPath) ? $localPath : $this->assetPath; return Url::to(CombineAssets::combine($assets, $assetPath)); }
[ "public", "function", "combineAssets", "(", "array", "$", "assets", ",", "$", "localPath", "=", "''", ")", "{", "// Short circuit if no assets actually provided", "if", "(", "empty", "(", "$", "assets", ")", ")", "{", "return", "''", ";", "}", "$", "assetPat...
Run the provided assets through the Asset Combiner @param array $assets Collection of assets @param string $localPath Prefix all assets with this path (optional) @return string
[ "Run", "the", "provided", "assets", "through", "the", "Asset", "Combiner" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/system/traits/AssetMaker.php#L198-L206
train
Combine assets with local path
[ 30522, 2270, 3853, 11506, 27241, 3215, 1006, 9140, 1002, 7045, 1010, 1002, 2334, 15069, 1027, 1005, 1005, 1007, 1063, 1013, 1013, 2460, 4984, 2065, 2053, 7045, 2941, 3024, 2065, 1006, 4064, 1006, 1002, 7045, 1007, 1007, 1063, 2709, 1005, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/DomCrawler/Field/FileFormField.php
FileFormField.initialize
protected function initialize() { if ('input' !== $this->node->nodeName) { throw new \LogicException(sprintf('A FileFormField can only be created from an input tag (%s given).', $this->node->nodeName)); } if ('file' !== strtolower($this->node->getAttribute('type'))) { throw new \LogicException(sprintf('A FileFormField can only be created from an input tag with a type of file (given type is %s).', $this->node->getAttribute('type'))); } $this->setValue(null); }
php
protected function initialize() { if ('input' !== $this->node->nodeName) { throw new \LogicException(sprintf('A FileFormField can only be created from an input tag (%s given).', $this->node->nodeName)); } if ('file' !== strtolower($this->node->getAttribute('type'))) { throw new \LogicException(sprintf('A FileFormField can only be created from an input tag with a type of file (given type is %s).', $this->node->getAttribute('type'))); } $this->setValue(null); }
[ "protected", "function", "initialize", "(", ")", "{", "if", "(", "'input'", "!==", "$", "this", "->", "node", "->", "nodeName", ")", "{", "throw", "new", "\\", "LogicException", "(", "sprintf", "(", "'A FileFormField can only be created from an input tag (%s given)....
Initializes the form field. @throws \LogicException When node type is incorrect
[ "Initializes", "the", "form", "field", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DomCrawler/Field/FileFormField.php#L96-L107
train
Initialize the FileFormField from the node
[ 30522, 5123, 3853, 3988, 4697, 1006, 1007, 1063, 2065, 1006, 1005, 7953, 1005, 999, 1027, 1027, 1002, 2023, 1011, 1028, 13045, 1011, 1028, 13045, 18442, 1007, 1063, 5466, 2047, 1032, 7961, 10288, 24422, 1006, 9043, 2546, 1006, 1005, 1037, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/Helpers/Excerpts.php
Excerpts.processMediaActions
public static function processMediaActions($medium, $url) { if (!is_array($url)) { $url_parts = parse_url($url); } else { $url_parts = $url; } $actions = []; // if there is a query, then parse it and build action calls if (isset($url_parts['query'])) { $actions = array_reduce(explode('&', $url_parts['query']), function ($carry, $item) { $parts = explode('=', $item, 2); $value = $parts[1] ?? null; $carry[] = ['method' => $parts[0], 'params' => $value]; return $carry; }, []); } if (Grav::instance()['config']->get('system.images.auto_fix_orientation')) { $actions[] = ['method' => 'fixOrientation', 'params' => '']; } $defaults = Grav::instance()['config']->get('system.images.defaults'); if (is_array($defaults) && count($defaults)) { foreach ($defaults as $method => $params) { $actions[] = [ 'method' => $method, 'params' => $params, ]; } } // loop through actions for the image and call them foreach ($actions as $action) { $matches = []; if (preg_match('/\[(.*)\]/', $action['params'], $matches)) { $args = [explode(',', $matches[1])]; } else { $args = explode(',', $action['params']); } $medium = call_user_func_array([$medium, $action['method']], $args); } if (isset($url_parts['fragment'])) { $medium->urlHash($url_parts['fragment']); } return $medium; }
php
public static function processMediaActions($medium, $url) { if (!is_array($url)) { $url_parts = parse_url($url); } else { $url_parts = $url; } $actions = []; // if there is a query, then parse it and build action calls if (isset($url_parts['query'])) { $actions = array_reduce(explode('&', $url_parts['query']), function ($carry, $item) { $parts = explode('=', $item, 2); $value = $parts[1] ?? null; $carry[] = ['method' => $parts[0], 'params' => $value]; return $carry; }, []); } if (Grav::instance()['config']->get('system.images.auto_fix_orientation')) { $actions[] = ['method' => 'fixOrientation', 'params' => '']; } $defaults = Grav::instance()['config']->get('system.images.defaults'); if (is_array($defaults) && count($defaults)) { foreach ($defaults as $method => $params) { $actions[] = [ 'method' => $method, 'params' => $params, ]; } } // loop through actions for the image and call them foreach ($actions as $action) { $matches = []; if (preg_match('/\[(.*)\]/', $action['params'], $matches)) { $args = [explode(',', $matches[1])]; } else { $args = explode(',', $action['params']); } $medium = call_user_func_array([$medium, $action['method']], $args); } if (isset($url_parts['fragment'])) { $medium->urlHash($url_parts['fragment']); } return $medium; }
[ "public", "static", "function", "processMediaActions", "(", "$", "medium", ",", "$", "url", ")", "{", "if", "(", "!", "is_array", "(", "$", "url", ")", ")", "{", "$", "url_parts", "=", "parse_url", "(", "$", "url", ")", ";", "}", "else", "{", "$", ...
Process media actions @param Medium $medium @param string|array $url @return Medium
[ "Process", "media", "actions" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Helpers/Excerpts.php#L275-L327
train
Process media actions
[ 30522, 2270, 10763, 3853, 2832, 16969, 18908, 8496, 1006, 1002, 5396, 1010, 1002, 24471, 2140, 1007, 1063, 2065, 1006, 999, 2003, 1035, 9140, 1006, 1002, 24471, 2140, 1007, 1007, 1063, 1002, 24471, 2140, 1035, 3033, 1027, 11968, 3366, 1035,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/cms/classes/Controller.php
Controller.verifyCsrfToken
protected function verifyCsrfToken() { if (!Config::get('cms.enableCsrfProtection')) { return true; } if (in_array(Request::method(), ['HEAD', 'GET', 'OPTIONS'])) { return true; } $token = Request::input('_token') ?: Request::header('X-CSRF-TOKEN'); if (!strlen($token)) { return false; } return hash_equals( Session::token(), $token ); }
php
protected function verifyCsrfToken() { if (!Config::get('cms.enableCsrfProtection')) { return true; } if (in_array(Request::method(), ['HEAD', 'GET', 'OPTIONS'])) { return true; } $token = Request::input('_token') ?: Request::header('X-CSRF-TOKEN'); if (!strlen($token)) { return false; } return hash_equals( Session::token(), $token ); }
[ "protected", "function", "verifyCsrfToken", "(", ")", "{", "if", "(", "!", "Config", "::", "get", "(", "'cms.enableCsrfProtection'", ")", ")", "{", "return", "true", ";", "}", "if", "(", "in_array", "(", "Request", "::", "method", "(", ")", ",", "[", "...
Checks the request data / headers for a valid CSRF token. Returns false if a valid token is not found. Override this method to disable the check. @return bool
[ "Checks", "the", "request", "data", "/", "headers", "for", "a", "valid", "CSRF", "token", ".", "Returns", "false", "if", "a", "valid", "token", "is", "not", "found", ".", "Override", "this", "method", "to", "disable", "the", "check", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/Controller.php#L1589-L1609
train
Verify if CSRF token is valid
[ 30522, 5123, 3853, 20410, 6169, 12881, 18715, 2368, 1006, 1007, 1063, 2065, 1006, 999, 9530, 8873, 2290, 1024, 1024, 2131, 1006, 1005, 4642, 2015, 1012, 9585, 6169, 12881, 21572, 26557, 3508, 1005, 1007, 1007, 1063, 2709, 2995, 1025, 1065, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Session/Middleware/StartSession.php
StartSession.handle
public function handle($request, Closure $next) { if (! $this->sessionConfigured()) { return $next($request); } // If a session driver has been configured, we will need to start the session here // so that the data is ready for an application. Note that the Laravel sessions // do not make use of PHP "native" sessions in any way since they are crappy. $request->setLaravelSession( $session = $this->startSession($request) ); $this->collectGarbage($session); $response = $next($request); $this->storeCurrentUrl($request, $session); $this->addCookieToResponse($response, $session); // Again, if the session has been configured we will need to close out the session // so that the attributes may be persisted to some storage medium. We will also // add the session identifier cookie to the application response headers now. $this->saveSession($request); return $response; }
php
public function handle($request, Closure $next) { if (! $this->sessionConfigured()) { return $next($request); } // If a session driver has been configured, we will need to start the session here // so that the data is ready for an application. Note that the Laravel sessions // do not make use of PHP "native" sessions in any way since they are crappy. $request->setLaravelSession( $session = $this->startSession($request) ); $this->collectGarbage($session); $response = $next($request); $this->storeCurrentUrl($request, $session); $this->addCookieToResponse($response, $session); // Again, if the session has been configured we will need to close out the session // so that the attributes may be persisted to some storage medium. We will also // add the session identifier cookie to the application response headers now. $this->saveSession($request); return $response; }
[ "public", "function", "handle", "(", "$", "request", ",", "Closure", "$", "next", ")", "{", "if", "(", "!", "$", "this", "->", "sessionConfigured", "(", ")", ")", "{", "return", "$", "next", "(", "$", "request", ")", ";", "}", "// If a session driver h...
Handle an incoming request. @param \Illuminate\Http\Request $request @param \Closure $next @return mixed
[ "Handle", "an", "incoming", "request", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Session/Middleware/StartSession.php#L41-L68
train
Handle the request and return the response.
[ 30522, 2270, 3853, 5047, 1006, 1002, 5227, 1010, 8503, 1002, 2279, 1007, 1063, 2065, 1006, 999, 1002, 2023, 1011, 1028, 5219, 8663, 8873, 27390, 2098, 1006, 1007, 1007, 1063, 2709, 1002, 2279, 1006, 1002, 5227, 1007, 1025, 1065, 1013, 101...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Intl/DateFormatter/IntlDateFormatter.php
IntlDateFormatter.create
public static function create($locale, $datetype, $timetype, $timezone = null, $calendar = self::GREGORIAN, $pattern = null) { return new self($locale, $datetype, $timetype, $timezone, $calendar, $pattern); }
php
public static function create($locale, $datetype, $timetype, $timezone = null, $calendar = self::GREGORIAN, $pattern = null) { return new self($locale, $datetype, $timetype, $timezone, $calendar, $pattern); }
[ "public", "static", "function", "create", "(", "$", "locale", ",", "$", "datetype", ",", "$", "timetype", ",", "$", "timezone", "=", "null", ",", "$", "calendar", "=", "self", "::", "GREGORIAN", ",", "$", "pattern", "=", "null", ")", "{", "return", "...
Static constructor. @param string $locale The locale code. The only currently supported locale is "en" (or null using the default locale, i.e. "en") @param int|null $datetype Type of date formatting, one of the format type constants @param int|null $timetype Type of time formatting, one of the format type constants @param \IntlTimeZone|\DateTimeZone|string|null $timezone Timezone identifier @param int $calendar Calendar to use for formatting or parsing; default is Gregorian One of the calendar constants @param string|null $pattern Optional pattern to use when formatting @return self @see http://www.php.net/manual/en/intldateformatter.create.php @see http://userguide.icu-project.org/formatparse/datetime @throws MethodArgumentValueNotImplementedException When $locale different than "en" or null is passed @throws MethodArgumentValueNotImplementedException When $calendar different than GREGORIAN is passed
[ "Static", "constructor", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Intl/DateFormatter/IntlDateFormatter.php#L171-L174
train
Create a new instance of the class
[ 30522, 2270, 10763, 3853, 3443, 1006, 1002, 2334, 2063, 1010, 1002, 3058, 13874, 1010, 1002, 2051, 13874, 1010, 1002, 2051, 15975, 1027, 19701, 1010, 1002, 8094, 1027, 2969, 1024, 1024, 25847, 1010, 1002, 5418, 1027, 19701, 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...
getgrav/grav
system/src/Grav/Common/Twig/TwigExtension.php
TwigExtension.getFunctions
public function getFunctions() { return [ new \Twig_SimpleFunction('array', [$this, 'arrayFilter']), new \Twig_SimpleFunction('array_key_value', [$this, 'arrayKeyValueFunc']), new \Twig_SimpleFunction('array_key_exists', 'array_key_exists'), new \Twig_SimpleFunction('array_unique', 'array_unique'), new \Twig_SimpleFunction('array_intersect', [$this, 'arrayIntersectFunc']), new \Twig_SimpleFunction('authorize', [$this, 'authorize']), new \Twig_SimpleFunction('debug', [$this, 'dump'], ['needs_context' => true, 'needs_environment' => true]), new \Twig_SimpleFunction('dump', [$this, 'dump'], ['needs_context' => true, 'needs_environment' => true]), new \Twig_SimpleFunction('vardump', [$this, 'vardumpFunc']), new \Twig_SimpleFunction('print_r', 'print_r'), new \Twig_SimpleFunction('http_response_code', 'http_response_code'), new \Twig_SimpleFunction('evaluate', [$this, 'evaluateStringFunc'], ['needs_context' => true]), new \Twig_SimpleFunction('evaluate_twig', [$this, 'evaluateTwigFunc'], ['needs_context' => true]), new \Twig_SimpleFunction('gist', [$this, 'gistFunc']), new \Twig_SimpleFunction('nonce_field', [$this, 'nonceFieldFunc']), new \Twig_SimpleFunction('pathinfo', 'pathinfo'), new \Twig_SimpleFunction('random_string', [$this, 'randomStringFunc']), new \Twig_SimpleFunction('repeat', [$this, 'repeatFunc']), new \Twig_SimpleFunction('regex_replace', [$this, 'regexReplace']), new \Twig_SimpleFunction('regex_filter', [$this, 'regexFilter']), new \Twig_SimpleFunction('string', [$this, 'stringFunc']), new \Twig_SimpleFunction('url', [$this, 'urlFunc']), new \Twig_SimpleFunction('json_decode', [$this, 'jsonDecodeFilter']), new \Twig_SimpleFunction('get_cookie', [$this, 'getCookie']), new \Twig_SimpleFunction('redirect_me', [$this, 'redirectFunc']), new \Twig_SimpleFunction('range', [$this, 'rangeFunc']), new \Twig_SimpleFunction('isajaxrequest', [$this, 'isAjaxFunc']), new \Twig_SimpleFunction('exif', [$this, 'exifFunc']), new \Twig_SimpleFunction('media_directory', [$this, 'mediaDirFunc']), new \Twig_SimpleFunction('body_class', [$this, 'bodyClassFunc']), new \Twig_SimpleFunction('theme_var', [$this, 'themeVarFunc']), new \Twig_SimpleFunction('header_var', [$this, 'pageHeaderVarFunc']), new \Twig_SimpleFunction('read_file', [$this, 'readFileFunc']), new \Twig_SimpleFunction('nicenumber', [$this, 'niceNumberFunc']), new \Twig_SimpleFunction('nicefilesize', [$this, 'niceFilesizeFunc']), new \Twig_SimpleFunction('nicetime', [$this, 'nicetimeFunc']), new \Twig_SimpleFunction('cron', [$this, 'cronFunc']), new \Twig_SimpleFunction('xss', [$this, 'xssFunc']), // Translations new \Twig_SimpleFunction('t', [$this, 'translate'], ['needs_environment' => true]), new \Twig_SimpleFunction('tl', [$this, 'translateLanguage']), new \Twig_SimpleFunction('ta', [$this, 'translateArray']), // Object Types new \Twig_SimpleFunction('get_type', [$this, 'getTypeFunc']), new \Twig_SimpleFunction('of_type', [$this, 'ofTypeFunc']) ]; }
php
public function getFunctions() { return [ new \Twig_SimpleFunction('array', [$this, 'arrayFilter']), new \Twig_SimpleFunction('array_key_value', [$this, 'arrayKeyValueFunc']), new \Twig_SimpleFunction('array_key_exists', 'array_key_exists'), new \Twig_SimpleFunction('array_unique', 'array_unique'), new \Twig_SimpleFunction('array_intersect', [$this, 'arrayIntersectFunc']), new \Twig_SimpleFunction('authorize', [$this, 'authorize']), new \Twig_SimpleFunction('debug', [$this, 'dump'], ['needs_context' => true, 'needs_environment' => true]), new \Twig_SimpleFunction('dump', [$this, 'dump'], ['needs_context' => true, 'needs_environment' => true]), new \Twig_SimpleFunction('vardump', [$this, 'vardumpFunc']), new \Twig_SimpleFunction('print_r', 'print_r'), new \Twig_SimpleFunction('http_response_code', 'http_response_code'), new \Twig_SimpleFunction('evaluate', [$this, 'evaluateStringFunc'], ['needs_context' => true]), new \Twig_SimpleFunction('evaluate_twig', [$this, 'evaluateTwigFunc'], ['needs_context' => true]), new \Twig_SimpleFunction('gist', [$this, 'gistFunc']), new \Twig_SimpleFunction('nonce_field', [$this, 'nonceFieldFunc']), new \Twig_SimpleFunction('pathinfo', 'pathinfo'), new \Twig_SimpleFunction('random_string', [$this, 'randomStringFunc']), new \Twig_SimpleFunction('repeat', [$this, 'repeatFunc']), new \Twig_SimpleFunction('regex_replace', [$this, 'regexReplace']), new \Twig_SimpleFunction('regex_filter', [$this, 'regexFilter']), new \Twig_SimpleFunction('string', [$this, 'stringFunc']), new \Twig_SimpleFunction('url', [$this, 'urlFunc']), new \Twig_SimpleFunction('json_decode', [$this, 'jsonDecodeFilter']), new \Twig_SimpleFunction('get_cookie', [$this, 'getCookie']), new \Twig_SimpleFunction('redirect_me', [$this, 'redirectFunc']), new \Twig_SimpleFunction('range', [$this, 'rangeFunc']), new \Twig_SimpleFunction('isajaxrequest', [$this, 'isAjaxFunc']), new \Twig_SimpleFunction('exif', [$this, 'exifFunc']), new \Twig_SimpleFunction('media_directory', [$this, 'mediaDirFunc']), new \Twig_SimpleFunction('body_class', [$this, 'bodyClassFunc']), new \Twig_SimpleFunction('theme_var', [$this, 'themeVarFunc']), new \Twig_SimpleFunction('header_var', [$this, 'pageHeaderVarFunc']), new \Twig_SimpleFunction('read_file', [$this, 'readFileFunc']), new \Twig_SimpleFunction('nicenumber', [$this, 'niceNumberFunc']), new \Twig_SimpleFunction('nicefilesize', [$this, 'niceFilesizeFunc']), new \Twig_SimpleFunction('nicetime', [$this, 'nicetimeFunc']), new \Twig_SimpleFunction('cron', [$this, 'cronFunc']), new \Twig_SimpleFunction('xss', [$this, 'xssFunc']), // Translations new \Twig_SimpleFunction('t', [$this, 'translate'], ['needs_environment' => true]), new \Twig_SimpleFunction('tl', [$this, 'translateLanguage']), new \Twig_SimpleFunction('ta', [$this, 'translateArray']), // Object Types new \Twig_SimpleFunction('get_type', [$this, 'getTypeFunc']), new \Twig_SimpleFunction('of_type', [$this, 'ofTypeFunc']) ]; }
[ "public", "function", "getFunctions", "(", ")", "{", "return", "[", "new", "\\", "Twig_SimpleFunction", "(", "'array'", ",", "[", "$", "this", ",", "'arrayFilter'", "]", ")", ",", "new", "\\", "Twig_SimpleFunction", "(", "'array_key_value'", ",", "[", "$", ...
Return a list of all functions. @return array
[ "Return", "a", "list", "of", "all", "functions", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Twig/TwigExtension.php#L137-L189
train
Get all functions that are available in the current context
[ 30522, 2270, 3853, 2131, 11263, 27989, 2015, 1006, 1007, 1063, 2709, 1031, 2047, 1032, 1056, 16279, 1035, 3722, 11263, 27989, 1006, 1005, 9140, 1005, 1010, 1031, 1002, 2023, 1010, 1005, 9140, 8873, 21928, 1005, 1033, 1007, 1010, 2047, 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...
octobercms/october
modules/cms/classes/CmsCompoundObject.php
CmsCompoundObject.fillViewBagArray
protected function fillViewBagArray() { $viewBag = $this->getViewBag(); foreach ($viewBag->getProperties() as $name => $value) { $this->viewBag[$name] = $value; } $this->fireEvent('cmsObject.fillViewBagArray'); }
php
protected function fillViewBagArray() { $viewBag = $this->getViewBag(); foreach ($viewBag->getProperties() as $name => $value) { $this->viewBag[$name] = $value; } $this->fireEvent('cmsObject.fillViewBagArray'); }
[ "protected", "function", "fillViewBagArray", "(", ")", "{", "$", "viewBag", "=", "$", "this", "->", "getViewBag", "(", ")", ";", "foreach", "(", "$", "viewBag", "->", "getProperties", "(", ")", "as", "$", "name", "=>", "$", "value", ")", "{", "$", "t...
Copies view bag properties to the view bag array. This is required for the back-end editors. @return void
[ "Copies", "view", "bag", "properties", "to", "the", "view", "bag", "array", ".", "This", "is", "required", "for", "the", "back", "-", "end", "editors", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/CmsCompoundObject.php#L378-L386
train
fillViewBagArray - Fills the view bag array with values from the view bag object
[ 30522, 5123, 3853, 6039, 8584, 16078, 2906, 9447, 1006, 1007, 1063, 1002, 3193, 16078, 1027, 1002, 2023, 1011, 1028, 2131, 8584, 16078, 1006, 1007, 1025, 18921, 6776, 1006, 1002, 3193, 16078, 1011, 1028, 2131, 21572, 4842, 7368, 1006, 1007,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Form/Extension/Core/DataMapper/CheckboxListMapper.php
CheckboxListMapper.mapFormsToData
public function mapFormsToData($checkboxes, &$choices) { if (!\is_array($choices)) { throw new UnexpectedTypeException($choices, 'array'); } $values = []; foreach ($checkboxes as $checkbox) { if ($checkbox->getData()) { // construct an array of choice values $values[] = $checkbox->getConfig()->getOption('value'); } } $choices = $values; }
php
public function mapFormsToData($checkboxes, &$choices) { if (!\is_array($choices)) { throw new UnexpectedTypeException($choices, 'array'); } $values = []; foreach ($checkboxes as $checkbox) { if ($checkbox->getData()) { // construct an array of choice values $values[] = $checkbox->getConfig()->getOption('value'); } } $choices = $values; }
[ "public", "function", "mapFormsToData", "(", "$", "checkboxes", ",", "&", "$", "choices", ")", "{", "if", "(", "!", "\\", "is_array", "(", "$", "choices", ")", ")", "{", "throw", "new", "UnexpectedTypeException", "(", "$", "choices", ",", "'array'", ")",...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Extension/Core/DataMapper/CheckboxListMapper.php#L50-L66
train
Maps the form to the data array
[ 30522, 2270, 3853, 4949, 22694, 3406, 2850, 2696, 1006, 1002, 4638, 8758, 2229, 1010, 1004, 1002, 9804, 1007, 1063, 2065, 1006, 999, 1032, 2003, 1035, 9140, 1006, 1002, 9804, 1007, 1007, 1063, 5466, 2047, 9223, 13874, 10288, 24422, 1006, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Bridge/Twig/AppVariable.php
AppVariable.getSession
public function getSession() { if (null === $this->requestStack) { throw new \RuntimeException('The "app.session" variable is not available.'); } if ($request = $this->getRequest()) { return $request->getSession(); } }
php
public function getSession() { if (null === $this->requestStack) { throw new \RuntimeException('The "app.session" variable is not available.'); } if ($request = $this->getRequest()) { return $request->getSession(); } }
[ "public", "function", "getSession", "(", ")", "{", "if", "(", "null", "===", "$", "this", "->", "requestStack", ")", "{", "throw", "new", "\\", "RuntimeException", "(", "'The \"app.session\" variable is not available.'", ")", ";", "}", "if", "(", "$", "request...
Returns the current session. @return Session|null The session
[ "Returns", "the", "current", "session", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bridge/Twig/AppVariable.php#L110-L119
train
Get the session
[ 30522, 2270, 3853, 4152, 7971, 3258, 1006, 1007, 1063, 2065, 1006, 19701, 1027, 1027, 1027, 1002, 2023, 1011, 1028, 11186, 2696, 3600, 1007, 1063, 5466, 2047, 1032, 2448, 7292, 10288, 24422, 1006, 1005, 1996, 1000, 10439, 1012, 5219, 1000, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Schema/Blueprint.php
Blueprint.unsignedDecimal
public function unsignedDecimal($column, $total = 8, $places = 2) { return $this->addColumn('decimal', $column, [ 'total' => $total, 'places' => $places, 'unsigned' => true, ]); }
php
public function unsignedDecimal($column, $total = 8, $places = 2) { return $this->addColumn('decimal', $column, [ 'total' => $total, 'places' => $places, 'unsigned' => true, ]); }
[ "public", "function", "unsignedDecimal", "(", "$", "column", ",", "$", "total", "=", "8", ",", "$", "places", "=", "2", ")", "{", "return", "$", "this", "->", "addColumn", "(", "'decimal'", ",", "$", "column", ",", "[", "'total'", "=>", "$", "total",...
Create a new unsigned decimal column on the table. @param string $column @param int $total @param int $places @return \Illuminate\Database\Schema\ColumnDefinition
[ "Create", "a", "new", "unsigned", "decimal", "column", "on", "the", "table", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Schema/Blueprint.php#L829-L834
train
Add a unsigned decimal column to the table
[ 30522, 2270, 3853, 27121, 3207, 6895, 9067, 1006, 1002, 5930, 1010, 1002, 2561, 1027, 1022, 1010, 1002, 3182, 1027, 1016, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 5587, 25778, 2819, 2078, 1006, 1005, 26066, 1005, 1010, 1002, 5930, 1010, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Mime.php
Zend_Mime.encodeBase64
public static function encodeBase64($str, $lineLength = self::LINELENGTH, $lineEnd = self::LINEEND) { return rtrim(chunk_split(base64_encode($str), $lineLength, $lineEnd)); }
php
public static function encodeBase64($str, $lineLength = self::LINELENGTH, $lineEnd = self::LINEEND) { return rtrim(chunk_split(base64_encode($str), $lineLength, $lineEnd)); }
[ "public", "static", "function", "encodeBase64", "(", "$", "str", ",", "$", "lineLength", "=", "self", "::", "LINELENGTH", ",", "$", "lineEnd", "=", "self", "::", "LINEEND", ")", "{", "return", "rtrim", "(", "chunk_split", "(", "base64_encode", "(", "$", ...
Encode a given string in base64 encoding and break lines according to the maximum linelength. @param string $str @param int $lineLength Defaults to {@link LINELENGTH} @param int $lineEnd Defaults to {@link LINEEND} @return string
[ "Encode", "a", "given", "string", "in", "base64", "encoding", "and", "break", "lines", "according", "to", "the", "maximum", "linelength", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Mime.php#L283-L288
train
Encodes a string in base64 and returns a chunk of the string
[ 30522, 2270, 10763, 3853, 4372, 16044, 15058, 21084, 1006, 1002, 2358, 2099, 1010, 1002, 2240, 7770, 13512, 2232, 1027, 2969, 1024, 1024, 2240, 7770, 13512, 2232, 1010, 1002, 2240, 10497, 1027, 2969, 1024, 1024, 2240, 10497, 1007, 1063, 270...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/AssetManager.php
AssetManager.getCompiledBaseCss
public function getCompiledBaseCss() { $mergedAsset = new InMemoryUIAsset(); $assetMerger = new StylesheetUIAssetMerger($mergedAsset, $this->minimalStylesheetFetcher, $this->cacheBuster); $assetMerger->generateFile(); return $mergedAsset; }
php
public function getCompiledBaseCss() { $mergedAsset = new InMemoryUIAsset(); $assetMerger = new StylesheetUIAssetMerger($mergedAsset, $this->minimalStylesheetFetcher, $this->cacheBuster); $assetMerger->generateFile(); return $mergedAsset; }
[ "public", "function", "getCompiledBaseCss", "(", ")", "{", "$", "mergedAsset", "=", "new", "InMemoryUIAsset", "(", ")", ";", "$", "assetMerger", "=", "new", "StylesheetUIAssetMerger", "(", "$", "mergedAsset", ",", "$", "this", "->", "minimalStylesheetFetcher", "...
Return the base.less compiled to css @return UIAsset
[ "Return", "the", "base", ".", "less", "compiled", "to", "css" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/AssetManager.php#L141-L150
train
Returns the base css file
[ 30522, 2270, 3853, 2131, 9006, 22090, 18939, 11022, 6169, 2015, 1006, 1007, 1063, 1002, 5314, 27241, 2102, 1027, 2047, 1999, 4168, 5302, 2854, 10179, 27241, 2102, 1006, 1007, 1025, 1002, 11412, 5017, 4590, 1027, 2047, 6782, 21030, 8525, 795...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/OptOutManager.php
OptOutManager.addQueryParameter
public function addQueryParameter($key, $value, $override = true) { if (!isset($this->queryParameters[$key]) || true === $override) { $this->queryParameters[$key] = $value; return true; } return false; }
php
public function addQueryParameter($key, $value, $override = true) { if (!isset($this->queryParameters[$key]) || true === $override) { $this->queryParameters[$key] = $value; return true; } return false; }
[ "public", "function", "addQueryParameter", "(", "$", "key", ",", "$", "value", ",", "$", "override", "=", "true", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "queryParameters", "[", "$", "key", "]", ")", "||", "true", "===", "$", "ov...
@param string $key @param string $value @param bool $override @return bool
[ "@param", "string", "$key", "@param", "string", "$value", "@param", "bool", "$override" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/CoreAdminHome/OptOutManager.php#L123-L131
train
Add a query parameter to the list of query parameters
[ 30522, 2270, 3853, 5587, 4226, 2854, 28689, 22828, 1006, 1002, 3145, 1010, 1002, 3643, 1010, 1002, 2058, 15637, 1027, 2995, 1007, 1063, 2065, 1006, 999, 26354, 3388, 1006, 1002, 2023, 1011, 1028, 23032, 28689, 22828, 2015, 1031, 1002, 3145,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Security/Http/Firewall/ContextListener.php
ContextListener.refreshUser
protected function refreshUser(TokenInterface $token) { $user = $token->getUser(); if (!$user instanceof UserInterface) { return $token; } $userNotFoundByProvider = false; $userDeauthenticated = false; foreach ($this->userProviders as $provider) { if (!$provider instanceof UserProviderInterface) { throw new \InvalidArgumentException(sprintf('User provider "%s" must implement "%s".', \get_class($provider), UserProviderInterface::class)); } try { $refreshedUser = $provider->refreshUser($user); $newToken = clone $token; $newToken->setUser($refreshedUser); // tokens can be deauthenticated if the user has been changed. if (!$newToken->isAuthenticated()) { $userDeauthenticated = true; if (null !== $this->logger) { $this->logger->debug('Cannot refresh token because user has changed.', ['username' => $refreshedUser->getUsername(), 'provider' => \get_class($provider)]); } continue; } $token->setUser($refreshedUser); if (null !== $this->logger) { $context = ['provider' => \get_class($provider), 'username' => $refreshedUser->getUsername()]; if ($token instanceof SwitchUserToken) { $context['impersonator_username'] = $token->getOriginalToken()->getUsername(); } else { foreach ($token->getRoles(false) as $role) { if ($role instanceof SwitchUserRole) { $context['impersonator_username'] = $role->getSource(false)->getUsername(); break; } } } $this->logger->debug('User was reloaded from a user provider.', $context); } return $token; } catch (UnsupportedUserException $e) { // let's try the next user provider } catch (UsernameNotFoundException $e) { if (null !== $this->logger) { $this->logger->warning('Username could not be found in the selected user provider.', ['username' => $e->getUsername(), 'provider' => \get_class($provider)]); } $userNotFoundByProvider = true; } } if ($userDeauthenticated) { if (null !== $this->logger) { $this->logger->debug('Token was deauthenticated after trying to refresh it.'); } if (null !== $this->dispatcher) { $this->dispatcher->dispatch(new DeauthenticatedEvent($token, $newToken), DeauthenticatedEvent::class); } return null; } if ($userNotFoundByProvider) { return null; } throw new \RuntimeException(sprintf('There is no user provider for user "%s".', \get_class($user))); }
php
protected function refreshUser(TokenInterface $token) { $user = $token->getUser(); if (!$user instanceof UserInterface) { return $token; } $userNotFoundByProvider = false; $userDeauthenticated = false; foreach ($this->userProviders as $provider) { if (!$provider instanceof UserProviderInterface) { throw new \InvalidArgumentException(sprintf('User provider "%s" must implement "%s".', \get_class($provider), UserProviderInterface::class)); } try { $refreshedUser = $provider->refreshUser($user); $newToken = clone $token; $newToken->setUser($refreshedUser); // tokens can be deauthenticated if the user has been changed. if (!$newToken->isAuthenticated()) { $userDeauthenticated = true; if (null !== $this->logger) { $this->logger->debug('Cannot refresh token because user has changed.', ['username' => $refreshedUser->getUsername(), 'provider' => \get_class($provider)]); } continue; } $token->setUser($refreshedUser); if (null !== $this->logger) { $context = ['provider' => \get_class($provider), 'username' => $refreshedUser->getUsername()]; if ($token instanceof SwitchUserToken) { $context['impersonator_username'] = $token->getOriginalToken()->getUsername(); } else { foreach ($token->getRoles(false) as $role) { if ($role instanceof SwitchUserRole) { $context['impersonator_username'] = $role->getSource(false)->getUsername(); break; } } } $this->logger->debug('User was reloaded from a user provider.', $context); } return $token; } catch (UnsupportedUserException $e) { // let's try the next user provider } catch (UsernameNotFoundException $e) { if (null !== $this->logger) { $this->logger->warning('Username could not be found in the selected user provider.', ['username' => $e->getUsername(), 'provider' => \get_class($provider)]); } $userNotFoundByProvider = true; } } if ($userDeauthenticated) { if (null !== $this->logger) { $this->logger->debug('Token was deauthenticated after trying to refresh it.'); } if (null !== $this->dispatcher) { $this->dispatcher->dispatch(new DeauthenticatedEvent($token, $newToken), DeauthenticatedEvent::class); } return null; } if ($userNotFoundByProvider) { return null; } throw new \RuntimeException(sprintf('There is no user provider for user "%s".', \get_class($user))); }
[ "protected", "function", "refreshUser", "(", "TokenInterface", "$", "token", ")", "{", "$", "user", "=", "$", "token", "->", "getUser", "(", ")", ";", "if", "(", "!", "$", "user", "instanceof", "UserInterface", ")", "{", "return", "$", "token", ";", "}...
Refreshes the user by reloading it from the user provider. @return TokenInterface|null @throws \RuntimeException
[ "Refreshes", "the", "user", "by", "reloading", "it", "from", "the", "user", "provider", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Security/Http/Firewall/ContextListener.php#L162-L241
train
Refreshes the user from all user providers
[ 30522, 5123, 3853, 25416, 21898, 20330, 1006, 19204, 18447, 2121, 12172, 1002, 19204, 1007, 1063, 1002, 5310, 1027, 1002, 19204, 1011, 1028, 2131, 20330, 1006, 1007, 1025, 2065, 1006, 999, 1002, 5310, 6013, 11253, 5310, 18447, 2121, 12172, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/backend/widgets/Filter.php
Filter.getScope
public function getScope($scope) { if (!isset($this->allScopes[$scope])) { throw new ApplicationException('No definition for scope ' . $scope); } return $this->allScopes[$scope]; }
php
public function getScope($scope) { if (!isset($this->allScopes[$scope])) { throw new ApplicationException('No definition for scope ' . $scope); } return $this->allScopes[$scope]; }
[ "public", "function", "getScope", "(", "$", "scope", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "allScopes", "[", "$", "scope", "]", ")", ")", "{", "throw", "new", "ApplicationException", "(", "'No definition for scope '", ".", "$", "scop...
Get a specified scope object @param string $scope @return mixed
[ "Get", "a", "specified", "scope", "object" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/widgets/Filter.php#L892-L899
train
Get scope of the current context
[ 30522, 2270, 3853, 4152, 16186, 1006, 1002, 9531, 1007, 1063, 2065, 1006, 999, 26354, 3388, 1006, 1002, 2023, 1011, 1028, 2035, 26127, 2015, 1031, 1002, 9531, 1033, 1007, 1007, 1063, 5466, 2047, 4646, 10288, 24422, 1006, 1005, 2053, 6210, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/Page/Page.php
Page.rawRoute
public function rawRoute($var = null) { if ($var !== null) { $this->raw_route = $var; } if (empty($this->raw_route)) { $parent = $this->parent(); $baseRoute = $parent ? (string)$parent->rawRoute() : null; $slug = $this->adjustRouteCase(preg_replace(PAGE_ORDER_PREFIX_REGEX, '', $this->folder)); $this->raw_route = isset($baseRoute) ? $baseRoute . '/' . $slug : null; } return $this->raw_route; }
php
public function rawRoute($var = null) { if ($var !== null) { $this->raw_route = $var; } if (empty($this->raw_route)) { $parent = $this->parent(); $baseRoute = $parent ? (string)$parent->rawRoute() : null; $slug = $this->adjustRouteCase(preg_replace(PAGE_ORDER_PREFIX_REGEX, '', $this->folder)); $this->raw_route = isset($baseRoute) ? $baseRoute . '/' . $slug : null; } return $this->raw_route; }
[ "public", "function", "rawRoute", "(", "$", "var", "=", "null", ")", "{", "if", "(", "$", "var", "!==", "null", ")", "{", "$", "this", "->", "raw_route", "=", "$", "var", ";", "}", "if", "(", "empty", "(", "$", "this", "->", "raw_route", ")", "...
Gets and Sets the page raw route @param null $var @return null|string
[ "Gets", "and", "Sets", "the", "page", "raw", "route" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L1936-L1952
train
Get raw route
[ 30522, 2270, 3853, 6315, 22494, 2618, 1006, 1002, 13075, 1027, 19701, 1007, 1063, 2065, 1006, 1002, 13075, 999, 1027, 1027, 19701, 1007, 1063, 1002, 2023, 1011, 1028, 6315, 1035, 2799, 1027, 1002, 13075, 1025, 1065, 2065, 1006, 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/Support/Collection.php
Collection.mapSpread
public function mapSpread(callable $callback) { return $this->map(function ($chunk, $key) use ($callback) { $chunk[] = $key; return $callback(...$chunk); }); }
php
public function mapSpread(callable $callback) { return $this->map(function ($chunk, $key) use ($callback) { $chunk[] = $key; return $callback(...$chunk); }); }
[ "public", "function", "mapSpread", "(", "callable", "$", "callback", ")", "{", "return", "$", "this", "->", "map", "(", "function", "(", "$", "chunk", ",", "$", "key", ")", "use", "(", "$", "callback", ")", "{", "$", "chunk", "[", "]", "=", "$", ...
Run a map over each nested chunk of items. @param callable $callback @return static
[ "Run", "a", "map", "over", "each", "nested", "chunk", "of", "items", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Support/Collection.php#L1131-L1138
train
Returns a new array containing the result of the callback
[ 30522, 2270, 3853, 7341, 28139, 4215, 1006, 2655, 3085, 1002, 2655, 5963, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 4949, 1006, 3853, 1006, 1002, 20000, 1010, 1002, 3145, 1007, 2224, 1006, 1002, 2655, 5963, 1007, 1063, 1002, 20000, 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...
symfony/symfony
src/Symfony/Component/Translation/Extractor/PhpExtractor.php
PhpExtractor.extract
public function extract($resource, MessageCatalogue $catalog) { $files = $this->extractFiles($resource); foreach ($files as $file) { $this->parseTokens(token_get_all(file_get_contents($file)), $catalog); gc_mem_caches(); } }
php
public function extract($resource, MessageCatalogue $catalog) { $files = $this->extractFiles($resource); foreach ($files as $file) { $this->parseTokens(token_get_all(file_get_contents($file)), $catalog); gc_mem_caches(); } }
[ "public", "function", "extract", "(", "$", "resource", ",", "MessageCatalogue", "$", "catalog", ")", "{", "$", "files", "=", "$", "this", "->", "extractFiles", "(", "$", "resource", ")", ";", "foreach", "(", "$", "files", "as", "$", "file", ")", "{", ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Translation/Extractor/PhpExtractor.php#L80-L88
train
Extract all tokens from a resource and parse them into a MessageCatalogue object
[ 30522, 2270, 3853, 14817, 1006, 1002, 7692, 1010, 4471, 11266, 23067, 9077, 1002, 12105, 1007, 1063, 1002, 6764, 1027, 1002, 2023, 1011, 1028, 14817, 8873, 4244, 1006, 1002, 7692, 1007, 1025, 18921, 6776, 1006, 1002, 6764, 2004, 1002, 5371,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Tree.php
Tree.script
protected function script() { $trans = [ 'delete_confirm' => trans('admin.delete_confirm'), 'save_succeeded' => trans('admin.save_succeeded'), 'refresh_succeeded' => trans('admin.refresh_succeeded'), 'delete_succeeded' => trans('admin.delete_succeeded'), 'confirm' => trans('admin.confirm'), 'cancel' => trans('admin.cancel'), ]; $nestableOptions = json_encode($this->nestableOptions); return <<<SCRIPT $('#{$this->elementId}').nestable($nestableOptions); $('.tree_branch_delete').click(function() { var id = $(this).data('id'); swal({ title: "{$trans['delete_confirm']}", type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "{$trans['confirm']}", showLoaderOnConfirm: true, cancelButtonText: "{$trans['cancel']}", preConfirm: function() { return new Promise(function(resolve) { $.ajax({ method: 'post', url: '{$this->path}/' + id, data: { _method:'delete', _token:LA.token, }, success: function (data) { $.pjax.reload('#pjax-container'); toastr.success('{$trans['delete_succeeded']}'); resolve(data); } }); }); } }).then(function(result) { var data = result.value; if (typeof data === 'object') { if (data.status) { swal(data.message, '', 'success'); } else { swal(data.message, '', 'error'); } } }); }); $('.{$this->elementId}-save').click(function () { var serialize = $('#{$this->elementId}').nestable('serialize'); $.post('{$this->path}', { _token: LA.token, _order: JSON.stringify(serialize) }, function(data){ $.pjax.reload('#pjax-container'); toastr.success('{$trans['save_succeeded']}'); }); }); $('.{$this->elementId}-refresh').click(function () { $.pjax.reload('#pjax-container'); toastr.success('{$trans['refresh_succeeded']}'); }); $('.{$this->elementId}-tree-tools').on('click', function(e){ var action = $(this).data('action'); if (action === 'expand') { $('.dd').nestable('expandAll'); } if (action === 'collapse') { $('.dd').nestable('collapseAll'); } }); SCRIPT; }
php
protected function script() { $trans = [ 'delete_confirm' => trans('admin.delete_confirm'), 'save_succeeded' => trans('admin.save_succeeded'), 'refresh_succeeded' => trans('admin.refresh_succeeded'), 'delete_succeeded' => trans('admin.delete_succeeded'), 'confirm' => trans('admin.confirm'), 'cancel' => trans('admin.cancel'), ]; $nestableOptions = json_encode($this->nestableOptions); return <<<SCRIPT $('#{$this->elementId}').nestable($nestableOptions); $('.tree_branch_delete').click(function() { var id = $(this).data('id'); swal({ title: "{$trans['delete_confirm']}", type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "{$trans['confirm']}", showLoaderOnConfirm: true, cancelButtonText: "{$trans['cancel']}", preConfirm: function() { return new Promise(function(resolve) { $.ajax({ method: 'post', url: '{$this->path}/' + id, data: { _method:'delete', _token:LA.token, }, success: function (data) { $.pjax.reload('#pjax-container'); toastr.success('{$trans['delete_succeeded']}'); resolve(data); } }); }); } }).then(function(result) { var data = result.value; if (typeof data === 'object') { if (data.status) { swal(data.message, '', 'success'); } else { swal(data.message, '', 'error'); } } }); }); $('.{$this->elementId}-save').click(function () { var serialize = $('#{$this->elementId}').nestable('serialize'); $.post('{$this->path}', { _token: LA.token, _order: JSON.stringify(serialize) }, function(data){ $.pjax.reload('#pjax-container'); toastr.success('{$trans['save_succeeded']}'); }); }); $('.{$this->elementId}-refresh').click(function () { $.pjax.reload('#pjax-container'); toastr.success('{$trans['refresh_succeeded']}'); }); $('.{$this->elementId}-tree-tools').on('click', function(e){ var action = $(this).data('action'); if (action === 'expand') { $('.dd').nestable('expandAll'); } if (action === 'collapse') { $('.dd').nestable('collapseAll'); } }); SCRIPT; }
[ "protected", "function", "script", "(", ")", "{", "$", "trans", "=", "[", "'delete_confirm'", "=>", "trans", "(", "'admin.delete_confirm'", ")", ",", "'save_succeeded'", "=>", "trans", "(", "'admin.save_succeeded'", ")", ",", "'refresh_succeeded'", "=>", "trans", ...
Build tree grid scripts. @return string
[ "Build", "tree", "grid", "scripts", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Tree.php#L220-L306
train
Returns the script to display the tree tree
[ 30522, 5123, 3853, 5896, 1006, 1007, 1063, 1002, 9099, 1027, 1031, 1005, 3972, 12870, 1035, 12210, 1005, 1027, 1028, 9099, 1006, 1005, 4748, 10020, 1012, 3972, 12870, 1035, 12210, 1005, 1007, 1010, 1005, 3828, 1035, 4594, 1005, 1027, 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/DependencyInjection/Compiler/ResolveHotPathPass.php
ResolveHotPathPass.process
public function process(ContainerBuilder $container) { try { parent::process($container); $container->getDefinition('service_container')->clearTag($this->tagName); } finally { $this->resolvedIds = []; } }
php
public function process(ContainerBuilder $container) { try { parent::process($container); $container->getDefinition('service_container')->clearTag($this->tagName); } finally { $this->resolvedIds = []; } }
[ "public", "function", "process", "(", "ContainerBuilder", "$", "container", ")", "{", "try", "{", "parent", "::", "process", "(", "$", "container", ")", ";", "$", "container", "->", "getDefinition", "(", "'service_container'", ")", "->", "clearTag", "(", "$"...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DependencyInjection/Compiler/ResolveHotPathPass.php#L37-L45
train
Remove all resolved ids and clear the tag
[ 30522, 2270, 3853, 2832, 1006, 11661, 8569, 23891, 2099, 1002, 11661, 1007, 1063, 3046, 1063, 6687, 1024, 1024, 2832, 1006, 1002, 11661, 1007, 1025, 1002, 11661, 1011, 1028, 2131, 3207, 16294, 22753, 1006, 1005, 2326, 1035, 11661, 1005, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Cache/Backend/File.php
Zend_Cache_Backend_File._isMetadatasFile
protected function _isMetadatasFile($fileName) { $id = $this->_fileNameToId($fileName); if (substr($id, 0, 21) == 'internal-metadatas---') { return true; } else { return false; } }
php
protected function _isMetadatasFile($fileName) { $id = $this->_fileNameToId($fileName); if (substr($id, 0, 21) == 'internal-metadatas---') { return true; } else { return false; } }
[ "protected", "function", "_isMetadatasFile", "(", "$", "fileName", ")", "{", "$", "id", "=", "$", "this", "->", "_fileNameToId", "(", "$", "fileName", ")", ";", "if", "(", "substr", "(", "$", "id", ",", "0", ",", "21", ")", "==", "'internal-metadatas--...
Check if the given filename is a metadatas one @param string $fileName File name @return boolean True if it's a metadatas one
[ "Check", "if", "the", "given", "filename", "is", "a", "metadatas", "one" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Cache/Backend/File.php#L591-L599
train
Check if a file is a metadatas file
[ 30522, 5123, 3853, 1035, 2003, 11368, 8447, 10230, 8873, 2571, 1006, 1002, 5371, 18442, 1007, 1063, 1002, 8909, 1027, 1002, 2023, 1011, 1028, 1035, 5371, 18442, 3406, 3593, 1006, 1002, 5371, 18442, 1007, 1025, 2065, 1006, 4942, 3367, 2099, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/ResponseFactory.php
ResponseFactory.download
public function download($file, $name = null, array $headers = [], $disposition = 'attachment') { $response = new BinaryFileResponse($file, 200, $headers, true, $disposition); if (! is_null($name)) { return $response->setContentDisposition($disposition, $name, $this->fallbackName($name)); } return $response; }
php
public function download($file, $name = null, array $headers = [], $disposition = 'attachment') { $response = new BinaryFileResponse($file, 200, $headers, true, $disposition); if (! is_null($name)) { return $response->setContentDisposition($disposition, $name, $this->fallbackName($name)); } return $response; }
[ "public", "function", "download", "(", "$", "file", ",", "$", "name", "=", "null", ",", "array", "$", "headers", "=", "[", "]", ",", "$", "disposition", "=", "'attachment'", ")", "{", "$", "response", "=", "new", "BinaryFileResponse", "(", "$", "file",...
Create a new file download response. @param \SplFileInfo|string $file @param string|null $name @param array $headers @param string|null $disposition @return \Symfony\Component\HttpFoundation\BinaryFileResponse
[ "Create", "a", "new", "file", "download", "response", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Routing/ResponseFactory.php#L159-L168
train
Download a file
[ 30522, 2270, 3853, 8816, 1006, 1002, 5371, 1010, 1002, 2171, 1027, 19701, 1010, 9140, 1002, 20346, 2015, 1027, 1031, 1033, 1010, 1002, 22137, 1027, 1005, 14449, 1005, 1007, 1063, 1002, 3433, 1027, 2047, 12441, 8873, 3917, 2229, 26029, 3366,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
z-song/laravel-admin
src/Form.php
Form.invalidColumn
protected function invalidColumn($columns, $oneToOneRelation = false) { foreach ((array) $columns as $column) { if ((!$oneToOneRelation && Str::contains($column, '.')) || ($oneToOneRelation && !Str::contains($column, '.'))) { return true; } } return false; }
php
protected function invalidColumn($columns, $oneToOneRelation = false) { foreach ((array) $columns as $column) { if ((!$oneToOneRelation && Str::contains($column, '.')) || ($oneToOneRelation && !Str::contains($column, '.'))) { return true; } } return false; }
[ "protected", "function", "invalidColumn", "(", "$", "columns", ",", "$", "oneToOneRelation", "=", "false", ")", "{", "foreach", "(", "(", "array", ")", "$", "columns", "as", "$", "column", ")", "{", "if", "(", "(", "!", "$", "oneToOneRelation", "&&", "...
@param string|array $columns @param bool $oneToOneRelation @return bool
[ "@param", "string|array", "$columns", "@param", "bool", "$oneToOneRelation" ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Form.php#L904-L914
train
Check if column is invalid
[ 30522, 5123, 3853, 19528, 25778, 2819, 2078, 1006, 1002, 7753, 1010, 1002, 2028, 3406, 5643, 16570, 3370, 1027, 6270, 1007, 1063, 18921, 6776, 1006, 1006, 9140, 1007, 1002, 7753, 2004, 1002, 5930, 1007, 1063, 2065, 1006, 1006, 999, 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/ContainerBuilder.php
ContainerBuilder.getDefinition
public function getDefinition($id) { $id = (string) $id; if (!isset($this->definitions[$id])) { throw new ServiceNotFoundException($id); } return $this->definitions[$id]; }
php
public function getDefinition($id) { $id = (string) $id; if (!isset($this->definitions[$id])) { throw new ServiceNotFoundException($id); } return $this->definitions[$id]; }
[ "public", "function", "getDefinition", "(", "$", "id", ")", "{", "$", "id", "=", "(", "string", ")", "$", "id", ";", "if", "(", "!", "isset", "(", "$", "this", "->", "definitions", "[", "$", "id", "]", ")", ")", "{", "throw", "new", "ServiceNotFo...
Gets a service definition. @param string $id The service identifier @return Definition A Definition instance @throws ServiceNotFoundException if the service definition does not exist
[ "Gets", "a", "service", "definition", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/DependencyInjection/ContainerBuilder.php#L1024-L1033
train
Get the definition
[ 30522, 2270, 3853, 2131, 3207, 16294, 22753, 1006, 1002, 8909, 1007, 1063, 1002, 8909, 1027, 1006, 5164, 1007, 1002, 8909, 1025, 2065, 1006, 999, 30524, 2023, 1011, 1028, 15182, 1031, 1002, 8909, 1033, 1025, 1065, 102, 0, 0, 0, 0, 0, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/DataTransformer/DateTimeToArrayTransformer.php
DateTimeToArrayTransformer.reverseTransform
public function reverseTransform($value) { if (null === $value) { return; } if (!\is_array($value)) { throw new TransformationFailedException('Expected an array.'); } if ('' === implode('', $value)) { return; } $emptyFields = []; foreach ($this->fields as $field) { if (!isset($value[$field])) { $emptyFields[] = $field; } } if (\count($emptyFields) > 0) { throw new TransformationFailedException(sprintf('The fields "%s" should not be empty', implode('", "', $emptyFields))); } if (isset($value['month']) && !ctype_digit((string) $value['month'])) { throw new TransformationFailedException('This month is invalid'); } if (isset($value['day']) && !ctype_digit((string) $value['day'])) { throw new TransformationFailedException('This day is invalid'); } if (isset($value['year']) && !ctype_digit((string) $value['year'])) { throw new TransformationFailedException('This year is invalid'); } if (!empty($value['month']) && !empty($value['day']) && !empty($value['year']) && false === checkdate($value['month'], $value['day'], $value['year'])) { throw new TransformationFailedException('This is an invalid date'); } if (isset($value['hour']) && !ctype_digit((string) $value['hour'])) { throw new TransformationFailedException('This hour is invalid'); } if (isset($value['minute']) && !ctype_digit((string) $value['minute'])) { throw new TransformationFailedException('This minute is invalid'); } if (isset($value['second']) && !ctype_digit((string) $value['second'])) { throw new TransformationFailedException('This second is invalid'); } try { $dateTime = new \DateTime(sprintf( '%s-%s-%s %s:%s:%s', empty($value['year']) ? '1970' : $value['year'], empty($value['month']) ? '1' : $value['month'], empty($value['day']) ? '1' : $value['day'], empty($value['hour']) ? '0' : $value['hour'], empty($value['minute']) ? '0' : $value['minute'], empty($value['second']) ? '0' : $value['second'] ), new \DateTimeZone($this->outputTimezone) ); if ($this->inputTimezone !== $this->outputTimezone) { $dateTime->setTimezone(new \DateTimeZone($this->inputTimezone)); } } catch (\Exception $e) { throw new TransformationFailedException($e->getMessage(), $e->getCode(), $e); } return $dateTime; }
php
public function reverseTransform($value) { if (null === $value) { return; } if (!\is_array($value)) { throw new TransformationFailedException('Expected an array.'); } if ('' === implode('', $value)) { return; } $emptyFields = []; foreach ($this->fields as $field) { if (!isset($value[$field])) { $emptyFields[] = $field; } } if (\count($emptyFields) > 0) { throw new TransformationFailedException(sprintf('The fields "%s" should not be empty', implode('", "', $emptyFields))); } if (isset($value['month']) && !ctype_digit((string) $value['month'])) { throw new TransformationFailedException('This month is invalid'); } if (isset($value['day']) && !ctype_digit((string) $value['day'])) { throw new TransformationFailedException('This day is invalid'); } if (isset($value['year']) && !ctype_digit((string) $value['year'])) { throw new TransformationFailedException('This year is invalid'); } if (!empty($value['month']) && !empty($value['day']) && !empty($value['year']) && false === checkdate($value['month'], $value['day'], $value['year'])) { throw new TransformationFailedException('This is an invalid date'); } if (isset($value['hour']) && !ctype_digit((string) $value['hour'])) { throw new TransformationFailedException('This hour is invalid'); } if (isset($value['minute']) && !ctype_digit((string) $value['minute'])) { throw new TransformationFailedException('This minute is invalid'); } if (isset($value['second']) && !ctype_digit((string) $value['second'])) { throw new TransformationFailedException('This second is invalid'); } try { $dateTime = new \DateTime(sprintf( '%s-%s-%s %s:%s:%s', empty($value['year']) ? '1970' : $value['year'], empty($value['month']) ? '1' : $value['month'], empty($value['day']) ? '1' : $value['day'], empty($value['hour']) ? '0' : $value['hour'], empty($value['minute']) ? '0' : $value['minute'], empty($value['second']) ? '0' : $value['second'] ), new \DateTimeZone($this->outputTimezone) ); if ($this->inputTimezone !== $this->outputTimezone) { $dateTime->setTimezone(new \DateTimeZone($this->inputTimezone)); } } catch (\Exception $e) { throw new TransformationFailedException($e->getMessage(), $e->getCode(), $e); } return $dateTime; }
[ "public", "function", "reverseTransform", "(", "$", "value", ")", "{", "if", "(", "null", "===", "$", "value", ")", "{", "return", ";", "}", "if", "(", "!", "\\", "is_array", "(", "$", "value", ")", ")", "{", "throw", "new", "TransformationFailedExcept...
Transforms a localized date into a normalized date. @param array $value Localized date @return \DateTime Normalized date @throws TransformationFailedException If the given value is not an array, if the value could not be transformed
[ "Transforms", "a", "localized", "date", "into", "a", "normalized", "date", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToArrayTransformer.php#L111-L186
train
Transforms a date array into a DateTime object
[ 30522, 2270, 3853, 7901, 6494, 3619, 14192, 1006, 1002, 3643, 1007, 1063, 2065, 1006, 19701, 1027, 1027, 1027, 1002, 3643, 1007, 1063, 2709, 1025, 1065, 2065, 1006, 999, 1032, 2003, 1035, 9140, 1006, 1002, 3643, 1007, 1007, 1063, 5466, 20...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/HTML/QuickForm2/Element/Input.php
HTML_QuickForm2_Element_Input.getFrozenHtml
protected function getFrozenHtml() { $value = $this->getAttribute('value'); return (('' != $value)? htmlspecialchars($value, ENT_QUOTES, self::getOption('charset')): '&nbsp;') . $this->getPersistentContent(); }
php
protected function getFrozenHtml() { $value = $this->getAttribute('value'); return (('' != $value)? htmlspecialchars($value, ENT_QUOTES, self::getOption('charset')): '&nbsp;') . $this->getPersistentContent(); }
[ "protected", "function", "getFrozenHtml", "(", ")", "{", "$", "value", "=", "$", "this", "->", "getAttribute", "(", "'value'", ")", ";", "return", "(", "(", "''", "!=", "$", "value", ")", "?", "htmlspecialchars", "(", "$", "value", ",", "ENT_QUOTES", "...
Returns the field's value without HTML tags @return string
[ "Returns", "the", "field", "s", "value", "without", "HTML", "tags" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/HTML/QuickForm2/Element/Input.php#L107-L112
train
Returns the frozen HTML code of the field
[ 30522, 5123, 3853, 2131, 19699, 18153, 2368, 11039, 19968, 1006, 1007, 1063, 1002, 3643, 1027, 1002, 2023, 1011, 1028, 2131, 19321, 3089, 8569, 2618, 1006, 1005, 3643, 1005, 1007, 1025, 2709, 1006, 1006, 1005, 1005, 999, 1027, 1002, 3643, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/backend/models/ExportModel.php
ExportModel.download
public function download($name, $outputName = null) { if (!preg_match('/^oc[0-9a-z]*$/i', $name)) { throw new ApplicationException(Lang::get('backend::lang.import_export.file_not_found_error')); } $csvPath = temp_path() . '/' . $name; if (!file_exists($csvPath)) { throw new ApplicationException(Lang::get('backend::lang.import_export.file_not_found_error')); } return Response::download($csvPath, $outputName)->deleteFileAfterSend(true); }
php
public function download($name, $outputName = null) { if (!preg_match('/^oc[0-9a-z]*$/i', $name)) { throw new ApplicationException(Lang::get('backend::lang.import_export.file_not_found_error')); } $csvPath = temp_path() . '/' . $name; if (!file_exists($csvPath)) { throw new ApplicationException(Lang::get('backend::lang.import_export.file_not_found_error')); } return Response::download($csvPath, $outputName)->deleteFileAfterSend(true); }
[ "public", "function", "download", "(", "$", "name", ",", "$", "outputName", "=", "null", ")", "{", "if", "(", "!", "preg_match", "(", "'/^oc[0-9a-z]*$/i'", ",", "$", "name", ")", ")", "{", "throw", "new", "ApplicationException", "(", "Lang", "::", "get",...
Download a previously compiled export file. @return void
[ "Download", "a", "previously", "compiled", "export", "file", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/models/ExportModel.php#L54-L66
train
Download CSV file
[ 30522, 2270, 3853, 8816, 1006, 1002, 2171, 1010, 1002, 6434, 18442, 1027, 19701, 1007, 1063, 2065, 1006, 999, 3653, 2290, 1035, 2674, 1006, 1005, 1013, 1034, 1051, 2278, 1031, 1014, 1011, 1023, 2050, 1011, 1062, 1033, 1008, 1002, 1013, 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/Cache/Console/ClearCommand.php
ClearCommand.flushFacades
public function flushFacades() { if (! $this->files->exists($storagePath = storage_path('framework/cache'))) { return; } foreach ($this->files->files($storagePath) as $file) { if (preg_match('/facade-.*\.php$/', $file)) { $this->files->delete($file); } } }
php
public function flushFacades() { if (! $this->files->exists($storagePath = storage_path('framework/cache'))) { return; } foreach ($this->files->files($storagePath) as $file) { if (preg_match('/facade-.*\.php$/', $file)) { $this->files->delete($file); } } }
[ "public", "function", "flushFacades", "(", ")", "{", "if", "(", "!", "$", "this", "->", "files", "->", "exists", "(", "$", "storagePath", "=", "storage_path", "(", "'framework/cache'", ")", ")", ")", "{", "return", ";", "}", "foreach", "(", "$", "this"...
Flush the real-time facades stored in the cache directory. @return void
[ "Flush", "the", "real", "-", "time", "facades", "stored", "in", "the", "cache", "directory", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Cache/Console/ClearCommand.php#L87-L98
train
Flush facades.
[ 30522, 2270, 3853, 13862, 7011, 21869, 2015, 1006, 1007, 1063, 2065, 1006, 999, 1002, 2023, 1011, 1028, 6764, 1011, 1028, 6526, 1006, 1002, 5527, 15069, 1027, 5527, 1035, 4130, 1006, 1005, 7705, 1013, 17053, 1005, 1007, 1007, 1007, 1063, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Db/Statement/Db2.php
Zend_Db_Statement_Db2._execute
public function _execute(array $params = null) { if (!$this->_stmt) { return false; } $retval = true; if ($params !== null) { $retval = @db2_execute($this->_stmt, $params); } else { $retval = @db2_execute($this->_stmt); } if ($retval === false) { /** * @see Zend_Db_Statement_Db2_Exception */ // require_once 'Zend/Db/Statement/Db2/Exception.php'; throw new Zend_Db_Statement_Db2_Exception( db2_stmt_errormsg(), db2_stmt_error()); } $this->_keys = array(); if ($field_num = $this->columnCount()) { for ($i = 0; $i < $field_num; $i++) { $name = db2_field_name($this->_stmt, $i); $this->_keys[] = $name; } } $this->_values = array(); if ($this->_keys) { $this->_values = array_fill(0, count($this->_keys), null); } return $retval; }
php
public function _execute(array $params = null) { if (!$this->_stmt) { return false; } $retval = true; if ($params !== null) { $retval = @db2_execute($this->_stmt, $params); } else { $retval = @db2_execute($this->_stmt); } if ($retval === false) { /** * @see Zend_Db_Statement_Db2_Exception */ // require_once 'Zend/Db/Statement/Db2/Exception.php'; throw new Zend_Db_Statement_Db2_Exception( db2_stmt_errormsg(), db2_stmt_error()); } $this->_keys = array(); if ($field_num = $this->columnCount()) { for ($i = 0; $i < $field_num; $i++) { $name = db2_field_name($this->_stmt, $i); $this->_keys[] = $name; } } $this->_values = array(); if ($this->_keys) { $this->_values = array_fill(0, count($this->_keys), null); } return $retval; }
[ "public", "function", "_execute", "(", "array", "$", "params", "=", "null", ")", "{", "if", "(", "!", "$", "this", "->", "_stmt", ")", "{", "return", "false", ";", "}", "$", "retval", "=", "true", ";", "if", "(", "$", "params", "!==", "null", ")"...
Executes a prepared statement. @param array $params OPTIONAL Values to bind to parameter placeholders. @return bool @throws Zend_Db_Statement_Db2_Exception
[ "Executes", "a", "prepared", "statement", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Statement/Db2.php#L194-L231
train
Execute the statement and return the result as an array
[ 30522, 2270, 3853, 1035, 15389, 1006, 9140, 1002, 11498, 5244, 1027, 19701, 1007, 1063, 2065, 1006, 999, 1002, 2023, 1011, 1028, 1035, 2358, 20492, 1007, 1063, 2709, 6270, 1025, 1065, 1002, 2128, 9189, 2389, 1027, 2995, 1025, 2065, 1006, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/backend/classes/NavigationManager.php
NavigationManager.addSideMenuItem
public function addSideMenuItem($owner, $code, $sideCode, array $definition) { $itemKey = $this->makeItemKey($owner, $code); if (!isset($this->items[$itemKey])) { return false; } $mainItem = $this->items[$itemKey]; $definition = array_merge($definition, [ 'code' => $sideCode, 'owner' => $owner ]); if (isset($mainItem->sideMenu[$sideCode])) { $definition = array_merge((array) $mainItem->sideMenu[$sideCode], $definition); } $item = (object) array_merge(self::$sideItemDefaults, $definition); $this->items[$itemKey]->sideMenu[$sideCode] = $item; }
php
public function addSideMenuItem($owner, $code, $sideCode, array $definition) { $itemKey = $this->makeItemKey($owner, $code); if (!isset($this->items[$itemKey])) { return false; } $mainItem = $this->items[$itemKey]; $definition = array_merge($definition, [ 'code' => $sideCode, 'owner' => $owner ]); if (isset($mainItem->sideMenu[$sideCode])) { $definition = array_merge((array) $mainItem->sideMenu[$sideCode], $definition); } $item = (object) array_merge(self::$sideItemDefaults, $definition); $this->items[$itemKey]->sideMenu[$sideCode] = $item; }
[ "public", "function", "addSideMenuItem", "(", "$", "owner", ",", "$", "code", ",", "$", "sideCode", ",", "array", "$", "definition", ")", "{", "$", "itemKey", "=", "$", "this", "->", "makeItemKey", "(", "$", "owner", ",", "$", "code", ")", ";", "if",...
Dynamically add a single side menu item @param string $owner @param string $code @param string $sideCode @param array $definitions
[ "Dynamically", "add", "a", "single", "side", "menu", "item" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/classes/NavigationManager.php#L261-L283
train
Add a side menu item
[ 30522, 2270, 3853, 9909, 5178, 3549, 14663, 6633, 1006, 1002, 3954, 1010, 1002, 3642, 1010, 1002, 2217, 16044, 1010, 9140, 1002, 6210, 1007, 1063, 1002, 8875, 14839, 1027, 1002, 2023, 1011, 1028, 2191, 4221, 2213, 14839, 1006, 1002, 3954, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/ThrottlesLogins.php
ThrottlesLogins.hasTooManyLoginAttempts
protected function hasTooManyLoginAttempts(Request $request) { return $this->limiter()->tooManyAttempts( $this->throttleKey($request), $this->maxAttempts() ); }
php
protected function hasTooManyLoginAttempts(Request $request) { return $this->limiter()->tooManyAttempts( $this->throttleKey($request), $this->maxAttempts() ); }
[ "protected", "function", "hasTooManyLoginAttempts", "(", "Request", "$", "request", ")", "{", "return", "$", "this", "->", "limiter", "(", ")", "->", "tooManyAttempts", "(", "$", "this", "->", "throttleKey", "(", "$", "request", ")", ",", "$", "this", "->"...
Determine if the user has too many failed login attempts. @param \Illuminate\Http\Request $request @return bool
[ "Determine", "if", "the", "user", "has", "too", "many", "failed", "login", "attempts", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Foundation/Auth/ThrottlesLogins.php#L20-L25
train
Has too many login attempts
[ 30522, 5123, 3853, 2038, 3406, 20778, 8516, 8649, 3981, 4674, 27718, 2015, 1006, 5227, 1002, 5227, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 5787, 2121, 1006, 1007, 1011, 1028, 2205, 2386, 26139, 18532, 22798, 1006, 1002, 2023, 1011, 1028, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/Session/SaveHandler/DbTable.php
DbTable.read
public function read($id) { $sql = 'SELECT ' . $this->config['dataColumn'] . ' FROM ' . $this->config['name'] . ' WHERE ' . $this->config['primary'] . ' = ?' . ' AND ' . $this->config['modifiedColumn'] . ' + ' . $this->config['lifetimeColumn'] . ' >= ?'; $result = $this->fetchOne($sql, array($id, time())); if (!$result) { $result = ''; } return $result; }
php
public function read($id) { $sql = 'SELECT ' . $this->config['dataColumn'] . ' FROM ' . $this->config['name'] . ' WHERE ' . $this->config['primary'] . ' = ?' . ' AND ' . $this->config['modifiedColumn'] . ' + ' . $this->config['lifetimeColumn'] . ' >= ?'; $result = $this->fetchOne($sql, array($id, time())); if (!$result) { $result = ''; } return $result; }
[ "public", "function", "read", "(", "$", "id", ")", "{", "$", "sql", "=", "'SELECT '", ".", "$", "this", "->", "config", "[", "'dataColumn'", "]", ".", "' FROM '", ".", "$", "this", "->", "config", "[", "'name'", "]", ".", "' WHERE '", ".", "$", "th...
Read session data @param string $id @return string
[ "Read", "session", "data" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Session/SaveHandler/DbTable.php#L80-L93
train
read the record
[ 30522, 2270, 3853, 3191, 1006, 1002, 8909, 1007, 1063, 1002, 29296, 1027, 1005, 7276, 1005, 1012, 1002, 2023, 1011, 1028, 9530, 8873, 2290, 1031, 1005, 2951, 25778, 2819, 2078, 1005, 1033, 1012, 1005, 2013, 1005, 1012, 1002, 2023, 1011, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Config/Definition/ArrayNode.php
ArrayNode.preNormalize
protected function preNormalize($value) { if (!$this->normalizeKeys || !\is_array($value)) { return $value; } $normalized = []; foreach ($value as $k => $v) { if (false !== strpos($k, '-') && false === strpos($k, '_') && !\array_key_exists($normalizedKey = str_replace('-', '_', $k), $value)) { $normalized[$normalizedKey] = $v; } else { $normalized[$k] = $v; } } return $normalized; }
php
protected function preNormalize($value) { if (!$this->normalizeKeys || !\is_array($value)) { return $value; } $normalized = []; foreach ($value as $k => $v) { if (false !== strpos($k, '-') && false === strpos($k, '_') && !\array_key_exists($normalizedKey = str_replace('-', '_', $k), $value)) { $normalized[$normalizedKey] = $v; } else { $normalized[$k] = $v; } } return $normalized; }
[ "protected", "function", "preNormalize", "(", "$", "value", ")", "{", "if", "(", "!", "$", "this", "->", "normalizeKeys", "||", "!", "\\", "is_array", "(", "$", "value", ")", ")", "{", "return", "$", "value", ";", "}", "$", "normalized", "=", "[", ...
Normalizes keys between the different configuration formats. Namely, you mostly have foo_bar in YAML while you have foo-bar in XML. After running this method, all keys are normalized to foo_bar. If you have a mixed key like foo-bar_moo, it will not be altered. The key will also not be altered if the target key already exists. @param mixed $value @return array The value with normalized keys
[ "Normalizes", "keys", "between", "the", "different", "configuration", "formats", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Config/Definition/ArrayNode.php#L53-L70
train
Pre normalize value
[ 30522, 5123, 3853, 3653, 12131, 9067, 4697, 1006, 1002, 3643, 1007, 1063, 2065, 1006, 999, 1002, 2023, 1011, 1028, 3671, 4697, 14839, 2015, 1064, 1064, 999, 1032, 2003, 1035, 9140, 1006, 1002, 3643, 1007, 1007, 1063, 2709, 1002, 3643, 102...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
z-song/laravel-admin
src/Controllers/UserController.php
UserController.detail
protected function detail($id) { $userModel = config('admin.database.users_model'); $show = new Show($userModel::findOrFail($id)); $show->id('ID'); $show->username(trans('admin.username')); $show->name(trans('admin.name')); $show->roles(trans('admin.roles'))->as(function ($roles) { return $roles->pluck('name'); })->label(); $show->permissions(trans('admin.permissions'))->as(function ($permission) { return $permission->pluck('name'); })->label(); $show->created_at(trans('admin.created_at')); $show->updated_at(trans('admin.updated_at')); return $show; }
php
protected function detail($id) { $userModel = config('admin.database.users_model'); $show = new Show($userModel::findOrFail($id)); $show->id('ID'); $show->username(trans('admin.username')); $show->name(trans('admin.name')); $show->roles(trans('admin.roles'))->as(function ($roles) { return $roles->pluck('name'); })->label(); $show->permissions(trans('admin.permissions'))->as(function ($permission) { return $permission->pluck('name'); })->label(); $show->created_at(trans('admin.created_at')); $show->updated_at(trans('admin.updated_at')); return $show; }
[ "protected", "function", "detail", "(", "$", "id", ")", "{", "$", "userModel", "=", "config", "(", "'admin.database.users_model'", ")", ";", "$", "show", "=", "new", "Show", "(", "$", "userModel", "::", "findOrFail", "(", "$", "id", ")", ")", ";", "$",...
Make a show builder. @param mixed $id @return Show
[ "Make", "a", "show", "builder", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Controllers/UserController.php#L112-L131
train
Detail show.
[ 30522, 5123, 3853, 6987, 1006, 1002, 8909, 1007, 1063, 1002, 5310, 5302, 9247, 1027, 9530, 8873, 2290, 1006, 1005, 4748, 10020, 1012, 7809, 1012, 5198, 1035, 2944, 1005, 1007, 1025, 1002, 2265, 1027, 2047, 2265, 1006, 1002, 5310, 5302, 92...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
overtrue/wechat
src/OpenWork/Corp/Client.php
Client.getPreAuthorizationUrl
public function getPreAuthorizationUrl(string $preAuthCode = '', string $redirectUri = '', string $state = '') { $redirectUri || $redirectUri = $this->app->config['redirect_uri_install']; $preAuthCode || $preAuthCode = $this->getPreAuthCode()['pre_auth_code']; $state || $state = rand(); $params = [ 'suite_id' => $this->app['config']['suite_id'], 'redirect_uri' => $redirectUri, 'pre_auth_code' => $preAuthCode, 'state' => $state, ]; return 'https://open.work.weixin.qq.com/3rdapp/install?'.http_build_query($params); }
php
public function getPreAuthorizationUrl(string $preAuthCode = '', string $redirectUri = '', string $state = '') { $redirectUri || $redirectUri = $this->app->config['redirect_uri_install']; $preAuthCode || $preAuthCode = $this->getPreAuthCode()['pre_auth_code']; $state || $state = rand(); $params = [ 'suite_id' => $this->app['config']['suite_id'], 'redirect_uri' => $redirectUri, 'pre_auth_code' => $preAuthCode, 'state' => $state, ]; return 'https://open.work.weixin.qq.com/3rdapp/install?'.http_build_query($params); }
[ "public", "function", "getPreAuthorizationUrl", "(", "string", "$", "preAuthCode", "=", "''", ",", "string", "$", "redirectUri", "=", "''", ",", "string", "$", "state", "=", "''", ")", "{", "$", "redirectUri", "||", "$", "redirectUri", "=", "$", "this", ...
企业微信安装应用授权 url. @param string $preAuthCode 预授权码 @param string $redirectUri 回调地址 @param string $state @return string @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
[ "企业微信安装应用授权", "url", "." ]
120c72faaa93c270365bc75c73c362d5fd583209
https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/OpenWork/Corp/Client.php#L46-L60
train
Get pre authorization url
[ 30522, 2270, 3853, 2131, 28139, 4887, 27844, 3989, 3126, 2140, 1006, 5164, 1002, 3653, 4887, 2705, 16044, 1027, 1005, 1005, 1010, 5164, 1002, 2417, 7442, 6593, 9496, 1027, 1005, 1005, 1010, 5164, 1002, 2110, 1027, 1005, 1005, 1007, 1063, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Session/DatabaseSessionHandler.php
DatabaseSessionHandler.performInsert
protected function performInsert($sessionId, $payload) { try { return $this->getQuery()->insert(Arr::set($payload, 'id', $sessionId)); } catch (QueryException $e) { $this->performUpdate($sessionId, $payload); } }
php
protected function performInsert($sessionId, $payload) { try { return $this->getQuery()->insert(Arr::set($payload, 'id', $sessionId)); } catch (QueryException $e) { $this->performUpdate($sessionId, $payload); } }
[ "protected", "function", "performInsert", "(", "$", "sessionId", ",", "$", "payload", ")", "{", "try", "{", "return", "$", "this", "->", "getQuery", "(", ")", "->", "insert", "(", "Arr", "::", "set", "(", "$", "payload", ",", "'id'", ",", "$", "sessi...
Perform an insert operation on the session ID. @param string $sessionId @param string $payload @return bool|null
[ "Perform", "an", "insert", "operation", "on", "the", "session", "ID", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Session/DatabaseSessionHandler.php#L147-L154
train
perform insert with session id and payload
[ 30522, 5123, 3853, 4685, 7076, 8743, 1006, 1002, 5219, 3593, 1010, 1002, 18093, 1007, 1063, 3046, 1063, 2709, 1002, 2023, 1011, 1028, 2131, 4226, 2854, 1006, 1007, 1011, 1028, 19274, 1006, 12098, 2099, 1024, 1024, 2275, 1006, 1002, 18093, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/HTML/QuickForm2/Rule/Regex.php
HTML_QuickForm2_Rule_Regex.getJavascriptCallback
protected function getJavascriptCallback() { $regex = $this->getConfig(); if ($pos = strpos($regex, 'u', strrpos($regex, '/'))) { $regex = substr($regex, 0, $pos) . substr($regex, $pos + 1); $regex = preg_replace('/(?<!\\\\)(?>\\\\\\\\)*\\\\x{([a-fA-F0-9]+)}/', '\\u$1', $regex); } return "function() { var regex = {$regex}; var value = " . $this->owner->getJavascriptValue() . "; return value == '' || regex.test(value); }"; }
php
protected function getJavascriptCallback() { $regex = $this->getConfig(); if ($pos = strpos($regex, 'u', strrpos($regex, '/'))) { $regex = substr($regex, 0, $pos) . substr($regex, $pos + 1); $regex = preg_replace('/(?<!\\\\)(?>\\\\\\\\)*\\\\x{([a-fA-F0-9]+)}/', '\\u$1', $regex); } return "function() { var regex = {$regex}; var value = " . $this->owner->getJavascriptValue() . "; return value == '' || regex.test(value); }"; }
[ "protected", "function", "getJavascriptCallback", "(", ")", "{", "$", "regex", "=", "$", "this", "->", "getConfig", "(", ")", ";", "if", "(", "$", "pos", "=", "strpos", "(", "$", "regex", ",", "'u'", ",", "strrpos", "(", "$", "regex", ",", "'/'", "...
Returns the client-side validation callback For this to work properly, slashes have to be used as regex delimiters. The method takes care of transforming PHP unicode escapes in regexps to JS unicode escapes if using 'u' modifier (see bug #12376) @return string
[ "Returns", "the", "client", "-", "side", "validation", "callback" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/HTML/QuickForm2/Rule/Regex.php#L120-L131
train
Returns the Javascript callback for the field
[ 30522, 5123, 3853, 2131, 3900, 12044, 23235, 9289, 20850, 8684, 1006, 1007, 1063, 1002, 19723, 10288, 1027, 1002, 2023, 1011, 1028, 2131, 8663, 30524, 1006, 1002, 19723, 10288, 1010, 1005, 1013, 1005, 1007, 1007, 1007, 1063, 1002, 19723, 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/Settings/Plugin/SystemConfigSetting.php
SystemConfigSetting.isWritableByCurrentUser
public function isWritableByCurrentUser() { if (isset($this->hasWritePermission)) { return $this->hasWritePermission; } // performance improvement, do not detect this in __construct otherwise likely rather "big" query to DB. $this->hasWritePermission = Piwik::hasUserSuperUserAccess(); return $this->hasWritePermission; }
php
public function isWritableByCurrentUser() { if (isset($this->hasWritePermission)) { return $this->hasWritePermission; } // performance improvement, do not detect this in __construct otherwise likely rather "big" query to DB. $this->hasWritePermission = Piwik::hasUserSuperUserAccess(); return $this->hasWritePermission; }
[ "public", "function", "isWritableByCurrentUser", "(", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "hasWritePermission", ")", ")", "{", "return", "$", "this", "->", "hasWritePermission", ";", "}", "// performance improvement, do not detect this in __construct...
Returns `true` if this setting is writable for the current user, `false` if otherwise. In case it returns writable for the current user it will be visible in the Plugin settings UI. @return bool
[ "Returns", "true", "if", "this", "setting", "is", "writable", "for", "the", "current", "user", "false", "if", "otherwise", ".", "In", "case", "it", "returns", "writable", "for", "the", "current", "user", "it", "will", "be", "visible", "in", "the", "Plugin"...
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Settings/Plugin/SystemConfigSetting.php#L52-L62
train
Returns true if the current user has write permission.
[ 30522, 2270, 3853, 2003, 13088, 6590, 3468, 3762, 10841, 14343, 3372, 20330, 1006, 1007, 1063, 2065, 1006, 26354, 3388, 1006, 1002, 2023, 1011, 1028, 2038, 26373, 4842, 25481, 1007, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 2038, 26373, 484...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Framework/Flex/FlexIndex.php
FlexIndex.getCacheKey
public function getCacheKey(): string { return $this->getTypePrefix() . $this->getFlexType() . '.' . sha1(json_encode($this->getKeys()) . $this->_keyField); }
php
public function getCacheKey(): string { return $this->getTypePrefix() . $this->getFlexType() . '.' . sha1(json_encode($this->getKeys()) . $this->_keyField); }
[ "public", "function", "getCacheKey", "(", ")", ":", "string", "{", "return", "$", "this", "->", "getTypePrefix", "(", ")", ".", "$", "this", "->", "getFlexType", "(", ")", ".", "'.'", ".", "sha1", "(", "json_encode", "(", "$", "this", "->", "getKeys", ...
{@inheritdoc} @see FlexCollectionInterface::getCacheKey()
[ "{" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Framework/Flex/FlexIndex.php#L144-L147
train
Get Cache Key
[ 30522, 2270, 3853, 2131, 3540, 5403, 14839, 1006, 1007, 1024, 5164, 1063, 2709, 1002, 2023, 1011, 1028, 2131, 13874, 28139, 8873, 2595, 1006, 1007, 1012, 1002, 2023, 1011, 1028, 2131, 21031, 18413, 18863, 1006, 1007, 1012, 1005, 1012, 1005,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
z-song/laravel-admin
src/Form/Field/UploadField.php
UploadField.setupDefaultOptions
protected function setupDefaultOptions() { $defaults = [ 'overwriteInitial' => false, 'initialPreviewAsData' => true, 'browseLabel' => trans('admin.browse'), 'cancelLabel' => trans('admin.cancel'), 'showRemove' => false, 'showUpload' => false, 'dropZoneEnabled' => false, 'deleteExtraData' => [ $this->formatName($this->column) => static::FILE_DELETE_FLAG, static::FILE_DELETE_FLAG => '', '_token' => csrf_token(), '_method' => 'PUT', ], ]; if ($this->form instanceof Form) { $defaults['deleteUrl'] = $this->form->resource().'/'.$this->form->model()->getKey(); } $defaults = array_merge($defaults, ['fileActionSettings' => $this->fileActionSettings]); $this->options($defaults); }
php
protected function setupDefaultOptions() { $defaults = [ 'overwriteInitial' => false, 'initialPreviewAsData' => true, 'browseLabel' => trans('admin.browse'), 'cancelLabel' => trans('admin.cancel'), 'showRemove' => false, 'showUpload' => false, 'dropZoneEnabled' => false, 'deleteExtraData' => [ $this->formatName($this->column) => static::FILE_DELETE_FLAG, static::FILE_DELETE_FLAG => '', '_token' => csrf_token(), '_method' => 'PUT', ], ]; if ($this->form instanceof Form) { $defaults['deleteUrl'] = $this->form->resource().'/'.$this->form->model()->getKey(); } $defaults = array_merge($defaults, ['fileActionSettings' => $this->fileActionSettings]); $this->options($defaults); }
[ "protected", "function", "setupDefaultOptions", "(", ")", "{", "$", "defaults", "=", "[", "'overwriteInitial'", "=>", "false", ",", "'initialPreviewAsData'", "=>", "true", ",", "'browseLabel'", "=>", "trans", "(", "'admin.browse'", ")", ",", "'cancelLabel'", "=>",...
Set default options form image field. @return void
[ "Set", "default", "options", "form", "image", "field", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Form/Field/UploadField.php#L79-L104
train
Setup default options
[ 30522, 5123, 3853, 16437, 3207, 7011, 11314, 7361, 9285, 1006, 1007, 1063, 1002, 12398, 2015, 1027, 1031, 1005, 2058, 26373, 5498, 20925, 1005, 1027, 1028, 6270, 1010, 1005, 3988, 28139, 8584, 3022, 2850, 2696, 1005, 1027, 1028, 2995, 1010,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/BrowserKit/Response.php
Response.buildHeader
protected function buildHeader($name, $value) { @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.3.', __METHOD__), E_USER_DEPRECATED); return sprintf("%s: %s\n", $name, $value); }
php
protected function buildHeader($name, $value) { @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.3.', __METHOD__), E_USER_DEPRECATED); return sprintf("%s: %s\n", $name, $value); }
[ "protected", "function", "buildHeader", "(", "$", "name", ",", "$", "value", ")", "{", "@", "trigger_error", "(", "sprintf", "(", "'The \"%s()\" method is deprecated since Symfony 4.3.'", ",", "__METHOD__", ")", ",", "E_USER_DEPRECATED", ")", ";", "return", "sprintf...
Returns the build header line. @param string $name The header name @param string $value The header value @return string The built header line @deprecated since Symfony 4.3
[ "Returns", "the", "build", "header", "line", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/BrowserKit/Response.php#L74-L79
train
Builds the header string for the next page.
[ 30522, 5123, 3853, 3857, 4974, 2121, 1006, 1002, 2171, 1010, 1002, 3643, 1007, 1063, 1030, 9495, 1035, 7561, 1006, 9043, 2546, 1006, 1005, 1996, 1000, 1003, 1055, 1006, 1007, 1000, 4118, 2003, 2139, 28139, 12921, 2144, 25353, 2213, 14876, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/HttpFoundation/FileBag.php
FileBag.convertFileInformation
protected function convertFileInformation($file) { if ($file instanceof UploadedFile) { return $file; } $file = $this->fixPhpFilesArray($file); if (\is_array($file)) { $keys = array_keys($file); sort($keys); if ($keys == self::$fileKeys) { if (UPLOAD_ERR_NO_FILE == $file['error']) { $file = null; } else { $file = new UploadedFile($file['tmp_name'], $file['name'], $file['type'], $file['error']); } } else { $file = array_map([$this, 'convertFileInformation'], $file); if (array_keys($keys) === $keys) { $file = array_filter($file); } } } return $file; }
php
protected function convertFileInformation($file) { if ($file instanceof UploadedFile) { return $file; } $file = $this->fixPhpFilesArray($file); if (\is_array($file)) { $keys = array_keys($file); sort($keys); if ($keys == self::$fileKeys) { if (UPLOAD_ERR_NO_FILE == $file['error']) { $file = null; } else { $file = new UploadedFile($file['tmp_name'], $file['name'], $file['type'], $file['error']); } } else { $file = array_map([$this, 'convertFileInformation'], $file); if (array_keys($keys) === $keys) { $file = array_filter($file); } } } return $file; }
[ "protected", "function", "convertFileInformation", "(", "$", "file", ")", "{", "if", "(", "$", "file", "instanceof", "UploadedFile", ")", "{", "return", "$", "file", ";", "}", "$", "file", "=", "$", "this", "->", "fixPhpFilesArray", "(", "$", "file", ")"...
Converts uploaded files to UploadedFile instances. @param array|UploadedFile $file A (multi-dimensional) array of uploaded file information @return UploadedFile[]|UploadedFile|null A (multi-dimensional) array of UploadedFile instances
[ "Converts", "uploaded", "files", "to", "UploadedFile", "instances", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpFoundation/FileBag.php#L72-L98
train
Convert file information to array
[ 30522, 5123, 3853, 10463, 8873, 19856, 14192, 3370, 1006, 1002, 5371, 1007, 1063, 2065, 1006, 1002, 5371, 6013, 11253, 21345, 8873, 2571, 1007, 1063, 2709, 1002, 5371, 1025, 1065, 1002, 5371, 1027, 1002, 2023, 1011, 1028, 8081, 8458, 14376,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/FactoryBuilder.php
FactoryBuilder.make
public function make(array $attributes = []) { if ($this->amount === null) { return tap($this->makeInstance($attributes), function ($instance) { $this->callAfterMaking(collect([$instance])); }); } if ($this->amount < 1) { return (new $this->class)->newCollection(); } $instances = (new $this->class)->newCollection(array_map(function () use ($attributes) { return $this->makeInstance($attributes); }, range(1, $this->amount))); $this->callAfterMaking($instances); return $instances; }
php
public function make(array $attributes = []) { if ($this->amount === null) { return tap($this->makeInstance($attributes), function ($instance) { $this->callAfterMaking(collect([$instance])); }); } if ($this->amount < 1) { return (new $this->class)->newCollection(); } $instances = (new $this->class)->newCollection(array_map(function () use ($attributes) { return $this->makeInstance($attributes); }, range(1, $this->amount))); $this->callAfterMaking($instances); return $instances; }
[ "public", "function", "make", "(", "array", "$", "attributes", "=", "[", "]", ")", "{", "if", "(", "$", "this", "->", "amount", "===", "null", ")", "{", "return", "tap", "(", "$", "this", "->", "makeInstance", "(", "$", "attributes", ")", ",", "fun...
Create a collection of models. @param array $attributes @return mixed
[ "Create", "a", "collection", "of", "models", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/FactoryBuilder.php#L216-L235
train
Make an instance of the class
[ 30522, 2270, 3853, 2191, 1006, 9140, 1002, 12332, 1027, 1031, 1033, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 3815, 1027, 1027, 1027, 19701, 1007, 1063, 2709, 11112, 1006, 1002, 2023, 1011, 1028, 2191, 7076, 26897, 1006, 1002, 12332, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Mime/Header/MailboxListHeader.php
MailboxListHeader.getAddressStrings
public function getAddressStrings(): array { $strings = []; foreach ($this->addresses as $address) { $str = $address->getEncodedAddress(); if ($address instanceof NamedAddress && $name = $address->getName()) { $str = $this->createPhrase($this, $name, $this->getCharset(), empty($strings)).' <'.$str.'>'; } $strings[] = $str; } return $strings; }
php
public function getAddressStrings(): array { $strings = []; foreach ($this->addresses as $address) { $str = $address->getEncodedAddress(); if ($address instanceof NamedAddress && $name = $address->getName()) { $str = $this->createPhrase($this, $name, $this->getCharset(), empty($strings)).' <'.$str.'>'; } $strings[] = $str; } return $strings; }
[ "public", "function", "getAddressStrings", "(", ")", ":", "array", "{", "$", "strings", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "addresses", "as", "$", "address", ")", "{", "$", "str", "=", "$", "address", "->", "getEncodedAddress", "(",...
Gets the full mailbox list of this Header as an array of valid RFC 2822 strings. @throws RfcComplianceException @return string[]
[ "Gets", "the", "full", "mailbox", "list", "of", "this", "Header", "as", "an", "array", "of", "valid", "RFC", "2822", "strings", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Mime/Header/MailboxListHeader.php#L109-L121
train
Get address strings
[ 30522, 2270, 3853, 2131, 4215, 16200, 4757, 3367, 4892, 2015, 1006, 1007, 1024, 9140, 1063, 1002, 7817, 1027, 1031, 1033, 1025, 18921, 6776, 1006, 1002, 2023, 1011, 1028, 11596, 2004, 1002, 4769, 1007, 1063, 1002, 2358, 2099, 1027, 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/Console/Input/ArrayInput.php
ArrayInput.parse
protected function parse() { foreach ($this->parameters as $key => $value) { if ('--' === $key) { return; } if (0 === strpos($key, '--')) { $this->addLongOption(substr($key, 2), $value); } elseif ('-' === $key[0]) { $this->addShortOption(substr($key, 1), $value); } else { $this->addArgument($key, $value); } } }
php
protected function parse() { foreach ($this->parameters as $key => $value) { if ('--' === $key) { return; } if (0 === strpos($key, '--')) { $this->addLongOption(substr($key, 2), $value); } elseif ('-' === $key[0]) { $this->addShortOption(substr($key, 1), $value); } else { $this->addArgument($key, $value); } } }
[ "protected", "function", "parse", "(", ")", "{", "foreach", "(", "$", "this", "->", "parameters", "as", "$", "key", "=>", "$", "value", ")", "{", "if", "(", "'--'", "===", "$", "key", ")", "{", "return", ";", "}", "if", "(", "0", "===", "strpos",...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Console/Input/ArrayInput.php#L127-L141
train
Parse parameters and add them to the options array
[ 30522, 5123, 3853, 11968, 3366, 1006, 1007, 1063, 18921, 6776, 1006, 1002, 2023, 1011, 1028, 11709, 2004, 1002, 3145, 1027, 1028, 1002, 3643, 1007, 1063, 2065, 1006, 1005, 1011, 1011, 1005, 1027, 1027, 1027, 1002, 3145, 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...
matomo-org/matomo
plugins/Dashboard/Controller.php
Controller.getAllDashboards
public function getAllDashboards() { $this->checkTokenInUrl(); if (Piwik::isUserIsAnonymous()) { Json::sendHeaderJSON(); return '[]'; } $login = Piwik::getCurrentUserLogin(); $dashboards = $this->dashboard->getAllDashboards($login); Json::sendHeaderJSON(); return json_encode($dashboards); }
php
public function getAllDashboards() { $this->checkTokenInUrl(); if (Piwik::isUserIsAnonymous()) { Json::sendHeaderJSON(); return '[]'; } $login = Piwik::getCurrentUserLogin(); $dashboards = $this->dashboard->getAllDashboards($login); Json::sendHeaderJSON(); return json_encode($dashboards); }
[ "public", "function", "getAllDashboards", "(", ")", "{", "$", "this", "->", "checkTokenInUrl", "(", ")", ";", "if", "(", "Piwik", "::", "isUserIsAnonymous", "(", ")", ")", "{", "Json", "::", "sendHeaderJSON", "(", ")", ";", "return", "'[]'", ";", "}", ...
Outputs all available dashboards for the current user as a JSON string
[ "Outputs", "all", "available", "dashboards", "for", "the", "current", "user", "as", "a", "JSON", "string" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Dashboard/Controller.php#L108-L122
train
Returns all the dashboards in the current user
[ 30522, 2270, 3853, 2131, 8095, 8883, 2232, 15271, 1006, 1007, 1063, 1002, 2023, 1011, 1028, 4638, 18715, 18595, 11231, 12190, 1006, 1007, 1025, 2065, 1006, 14255, 9148, 2243, 1024, 1024, 2003, 20330, 29196, 16585, 27711, 1006, 1007, 30524, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/cms/classes/Controller.php
Controller.themeUrl
public function themeUrl($url = null) { $themeDir = $this->getTheme()->getDirName(); if (is_array($url)) { $_url = Url::to(CombineAssets::combine($url, themes_path().'/'.$themeDir)); } else { $_url = Config::get('cms.themesPath', '/themes').'/'.$themeDir; if ($url !== null) { $_url .= '/'.$url; } $_url = Url::asset($_url); } return $_url; }
php
public function themeUrl($url = null) { $themeDir = $this->getTheme()->getDirName(); if (is_array($url)) { $_url = Url::to(CombineAssets::combine($url, themes_path().'/'.$themeDir)); } else { $_url = Config::get('cms.themesPath', '/themes').'/'.$themeDir; if ($url !== null) { $_url .= '/'.$url; } $_url = Url::asset($_url); } return $_url; }
[ "public", "function", "themeUrl", "(", "$", "url", "=", "null", ")", "{", "$", "themeDir", "=", "$", "this", "->", "getTheme", "(", ")", "->", "getDirName", "(", ")", ";", "if", "(", "is_array", "(", "$", "url", ")", ")", "{", "$", "_url", "=", ...
Converts supplied URL to a theme URL relative to the website root. If the URL provided is an array then the files will be combined. @param mixed $url Specifies the theme-relative URL. If null, the theme path is returned. @return string
[ "Converts", "supplied", "URL", "to", "a", "theme", "URL", "relative", "to", "the", "website", "root", ".", "If", "the", "URL", "provided", "is", "an", "array", "then", "the", "files", "will", "be", "combined", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/Controller.php#L1401-L1417
train
Return theme url
[ 30522, 2270, 3853, 4323, 3126, 2140, 1006, 1002, 24471, 2140, 1027, 19701, 1007, 1063, 1002, 11773, 4313, 1027, 1002, 2023, 1011, 1028, 2131, 10760, 4168, 1006, 1007, 1011, 1028, 2131, 4305, 12789, 4168, 1006, 1007, 1025, 2065, 1006, 2003, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...