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
walkor/Workerman
Connection/UdpConnection.php
UdpConnection.close
public function close($data = null, $raw = false) { if ($data !== null) { $this->send($data, $raw); } return true; }
php
public function close($data = null, $raw = false) { if ($data !== null) { $this->send($data, $raw); } return true; }
[ "public", "function", "close", "(", "$", "data", "=", "null", ",", "$", "raw", "=", "false", ")", "{", "if", "(", "$", "data", "!==", "null", ")", "{", "$", "this", "->", "send", "(", "$", "data", ",", "$", "raw", ")", ";", "}", "return", "tr...
Close connection. @param mixed $data @param bool $raw @return bool
[ "Close", "connection", "." ]
13649907f05014fcfffcfccaef01e63ad3339351
https://github.com/walkor/Workerman/blob/13649907f05014fcfffcfccaef01e63ad3339351/Connection/UdpConnection.php#L184-L190
train
Close the current session
[ 30522, 2270, 3853, 2485, 1006, 1002, 2951, 1027, 19701, 1010, 1002, 6315, 1027, 6270, 1007, 1063, 2065, 1006, 1002, 2951, 999, 1027, 1027, 19701, 1007, 1063, 1002, 2023, 1011, 1028, 4604, 1006, 1002, 2951, 1010, 1002, 6315, 1007, 1025, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/Diagnostics/Diagnostic/RequiredPhpSetting.php
RequiredPhpSetting.setErrorResult
public function setErrorResult($errorResult) { if ($errorResult !== DiagnosticResult::STATUS_WARNING && $errorResult !== DiagnosticResult::STATUS_ERROR) { throw new \InvalidArgumentException('Error result must be either DiagnosticResult::STATUS_WARNING or DiagnosticResult::STATUS_ERROR.'); } $this->errorResult = $errorResult; return $this; }
php
public function setErrorResult($errorResult) { if ($errorResult !== DiagnosticResult::STATUS_WARNING && $errorResult !== DiagnosticResult::STATUS_ERROR) { throw new \InvalidArgumentException('Error result must be either DiagnosticResult::STATUS_WARNING or DiagnosticResult::STATUS_ERROR.'); } $this->errorResult = $errorResult; return $this; }
[ "public", "function", "setErrorResult", "(", "$", "errorResult", ")", "{", "if", "(", "$", "errorResult", "!==", "DiagnosticResult", "::", "STATUS_WARNING", "&&", "$", "errorResult", "!==", "DiagnosticResult", "::", "STATUS_ERROR", ")", "{", "throw", "new", "\\"...
@param $errorResult @return $this
[ "@param", "$errorResult" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Diagnostics/Diagnostic/RequiredPhpSetting.php#L54-L63
train
Set error result
[ 30522, 2270, 3853, 2275, 2121, 29165, 6072, 11314, 1006, 1002, 7561, 6072, 11314, 1007, 1063, 2065, 1006, 1002, 7561, 6072, 11314, 999, 1027, 1027, 16474, 6072, 11314, 1024, 1024, 3570, 1035, 5432, 1004, 1004, 1002, 7561, 6072, 11314, 999, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
php-ai/php-ml
src/Math/Set.php
Set.intersection
public static function intersection(self $a, self $b): self { return new self(array_intersect($a->toArray(), $b->toArray())); }
php
public static function intersection(self $a, self $b): self { return new self(array_intersect($a->toArray(), $b->toArray())); }
[ "public", "static", "function", "intersection", "(", "self", "$", "a", ",", "self", "$", "b", ")", ":", "self", "{", "return", "new", "self", "(", "array_intersect", "(", "$", "a", "->", "toArray", "(", ")", ",", "$", "b", "->", "toArray", "(", ")"...
Creates the intersection of A and B.
[ "Creates", "the", "intersection", "of", "A", "and", "B", "." ]
f6aa1a59b0525b8fca3d2786d661ab3e70904016
https://github.com/php-ai/php-ml/blob/f6aa1a59b0525b8fca3d2786d661ab3e70904016/src/Math/Set.php#L36-L39
train
Returns a new set containing the intersection of two sets of objects.
[ 30522, 2270, 10763, 3853, 6840, 1006, 2969, 1002, 1037, 1010, 2969, 1002, 1038, 1007, 1024, 2969, 1063, 2709, 2047, 2969, 1006, 9140, 1035, 29261, 1006, 1002, 1037, 1011, 1028, 2000, 2906, 9447, 1006, 1007, 1010, 1002, 1038, 1011, 1028, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Support/Collection.php
Collection.duplicateComparator
protected function duplicateComparator($strict) { if ($strict) { return function ($a, $b) { return $a === $b; }; } return function ($a, $b) { return $a == $b; }; }
php
protected function duplicateComparator($strict) { if ($strict) { return function ($a, $b) { return $a === $b; }; } return function ($a, $b) { return $a == $b; }; }
[ "protected", "function", "duplicateComparator", "(", "$", "strict", ")", "{", "if", "(", "$", "strict", ")", "{", "return", "function", "(", "$", "a", ",", "$", "b", ")", "{", "return", "$", "a", "===", "$", "b", ";", "}", ";", "}", "return", "fu...
Get the comparison function to detect duplicates. @param bool $strict @return \Closure
[ "Get", "the", "comparison", "function", "to", "detect", "duplicates", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Support/Collection.php#L453-L464
train
duplicateComparator - Returns a function that will compare two arrays
[ 30522, 5123, 3853, 24473, 9006, 28689, 4263, 1006, 1002, 9384, 1007, 1063, 2065, 1006, 1002, 9384, 1007, 1063, 2709, 3853, 1006, 1002, 1037, 1010, 1002, 1038, 1007, 1063, 2709, 1002, 1037, 1027, 1027, 1027, 1002, 1038, 1025, 1065, 1025, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/Widget/WidgetsList.php
WidgetsList.isDefined
public function isDefined($module, $action) { foreach ($this->widgets as $widget) { if ($widget->getModule() === $module && $widget->getAction() === $action) { return true; } } return false; }
php
public function isDefined($module, $action) { foreach ($this->widgets as $widget) { if ($widget->getModule() === $module && $widget->getAction() === $action) { return true; } } return false; }
[ "public", "function", "isDefined", "(", "$", "module", ",", "$", "action", ")", "{", "foreach", "(", "$", "this", "->", "widgets", "as", "$", "widget", ")", "{", "if", "(", "$", "widget", "->", "getModule", "(", ")", "===", "$", "module", "&&", "$"...
Returns `true` if a widget exists in the widget list, `false` if otherwise. @param string $module The controller name of the widget. @param string $action The controller action of the widget. @return bool
[ "Returns", "true", "if", "a", "widget", "exists", "in", "the", "widget", "list", "false", "if", "otherwise", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Widget/WidgetsList.php#L158-L167
train
Checks if the widget is defined for the given module and action
[ 30522, 2270, 3853, 2003, 3207, 23460, 2094, 1006, 1002, 11336, 1010, 1002, 2895, 1007, 1063, 18921, 6776, 1006, 1002, 2023, 1011, 1028, 15536, 28682, 2004, 1002, 15536, 24291, 1007, 1063, 2065, 1006, 1002, 15536, 24291, 1011, 1028, 2131, 53...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/FormBuilder.php
FormBuilder.add
public function add($child, $type = null, array $options = []) { if ($this->locked) { throw new BadMethodCallException('FormBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.'); } if ($child instanceof FormBuilderInterface) { $this->children[$child->getName()] = $child; // In case an unresolved child with the same name exists unset($this->unresolvedChildren[$child->getName()]); return $this; } if (!\is_string($child) && !\is_int($child)) { throw new UnexpectedTypeException($child, 'string, integer or Symfony\Component\Form\FormBuilderInterface'); } if (null !== $type && !\is_string($type) && !$type instanceof FormTypeInterface) { throw new UnexpectedTypeException($type, 'string or Symfony\Component\Form\FormTypeInterface'); } // Add to "children" to maintain order $this->children[$child] = null; $this->unresolvedChildren[$child] = [$type, $options]; return $this; }
php
public function add($child, $type = null, array $options = []) { if ($this->locked) { throw new BadMethodCallException('FormBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.'); } if ($child instanceof FormBuilderInterface) { $this->children[$child->getName()] = $child; // In case an unresolved child with the same name exists unset($this->unresolvedChildren[$child->getName()]); return $this; } if (!\is_string($child) && !\is_int($child)) { throw new UnexpectedTypeException($child, 'string, integer or Symfony\Component\Form\FormBuilderInterface'); } if (null !== $type && !\is_string($type) && !$type instanceof FormTypeInterface) { throw new UnexpectedTypeException($type, 'string or Symfony\Component\Form\FormTypeInterface'); } // Add to "children" to maintain order $this->children[$child] = null; $this->unresolvedChildren[$child] = [$type, $options]; return $this; }
[ "public", "function", "add", "(", "$", "child", ",", "$", "type", "=", "null", ",", "array", "$", "options", "=", "[", "]", ")", "{", "if", "(", "$", "this", "->", "locked", ")", "{", "throw", "new", "BadMethodCallException", "(", "'FormBuilder methods...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/FormBuilder.php#L50-L78
train
Add a child to the children array
[ 30522, 2270, 3853, 5587, 1006, 1002, 2775, 1010, 1002, 2828, 1027, 19701, 1010, 9140, 1002, 7047, 1027, 1031, 1033, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 5299, 1007, 1063, 5466, 2047, 2919, 11368, 6806, 16409, 24164, 2595, 24422, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Descriptor/JsonDescriptor.php
JsonDescriptor.describeInputDefinition
protected function describeInputDefinition(InputDefinition $definition, array $options = []) { $this->writeData($this->getInputDefinitionData($definition), $options); }
php
protected function describeInputDefinition(InputDefinition $definition, array $options = []) { $this->writeData($this->getInputDefinitionData($definition), $options); }
[ "protected", "function", "describeInputDefinition", "(", "InputDefinition", "$", "definition", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "this", "->", "writeData", "(", "$", "this", "->", "getInputDefinitionData", "(", "$", "definition", ")",...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Console/Descriptor/JsonDescriptor.php#L48-L51
train
Describes an input definition
[ 30522, 5123, 3853, 6235, 2378, 18780, 3207, 16294, 22753, 1006, 7953, 3207, 16294, 22753, 1002, 6210, 1010, 9140, 1002, 7047, 1027, 1031, 1033, 1007, 1063, 1002, 2023, 1011, 1028, 4339, 2850, 2696, 1006, 1002, 2023, 1011, 1028, 2131, 2378, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/cms/controllers/Index.php
Index.index_onOpenTemplate
public function index_onOpenTemplate() { $this->validateRequestTheme(); $type = Request::input('type'); $template = $this->loadTemplate($type, Request::input('path')); $widget = $this->makeTemplateFormWidget($type, $template); $this->vars['templatePath'] = Request::input('path'); $this->vars['lastModified'] = DateTime::makeCarbon($template->mtime); if ($type === 'page') { $router = new RainRouter; $this->vars['pageUrl'] = $router->urlFromPattern($template->url); } return [ 'tabTitle' => $this->getTabTitle($type, $template), 'tab' => $this->makePartial('form_page', [ 'form' => $widget, 'templateType' => $type, 'templateTheme' => $this->theme->getDirName(), 'templateMtime' => $template->mtime ]) ]; }
php
public function index_onOpenTemplate() { $this->validateRequestTheme(); $type = Request::input('type'); $template = $this->loadTemplate($type, Request::input('path')); $widget = $this->makeTemplateFormWidget($type, $template); $this->vars['templatePath'] = Request::input('path'); $this->vars['lastModified'] = DateTime::makeCarbon($template->mtime); if ($type === 'page') { $router = new RainRouter; $this->vars['pageUrl'] = $router->urlFromPattern($template->url); } return [ 'tabTitle' => $this->getTabTitle($type, $template), 'tab' => $this->makePartial('form_page', [ 'form' => $widget, 'templateType' => $type, 'templateTheme' => $this->theme->getDirName(), 'templateMtime' => $template->mtime ]) ]; }
[ "public", "function", "index_onOpenTemplate", "(", ")", "{", "$", "this", "->", "validateRequestTheme", "(", ")", ";", "$", "type", "=", "Request", "::", "input", "(", "'type'", ")", ";", "$", "template", "=", "$", "this", "->", "loadTemplate", "(", "$",...
Opens an existing template from the index page @return array
[ "Opens", "an", "existing", "template", "from", "the", "index", "page" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/controllers/Index.php#L127-L152
train
index_onOpenTemplate - Returns array with template data
[ 30522, 2270, 3853, 5950, 1035, 21058, 11837, 18532, 15725, 1006, 1007, 1063, 1002, 2023, 1011, 1028, 9398, 24932, 2063, 15500, 10760, 4168, 1006, 1007, 1025, 1002, 2828, 1027, 5227, 1024, 1024, 7953, 1006, 1005, 2828, 1005, 1007, 1025, 1002...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/backend/models/ImportModel.php
ImportModel.import
public function import($matches, $options = []) { $sessionKey = array_get($options, 'sessionKey'); $path = $this->getImportFilePath($sessionKey); $data = $this->processImportData($path, $matches, $options); return $this->importData($data, $sessionKey); }
php
public function import($matches, $options = []) { $sessionKey = array_get($options, 'sessionKey'); $path = $this->getImportFilePath($sessionKey); $data = $this->processImportData($path, $matches, $options); return $this->importData($data, $sessionKey); }
[ "public", "function", "import", "(", "$", "matches", ",", "$", "options", "=", "[", "]", ")", "{", "$", "sessionKey", "=", "array_get", "(", "$", "options", ",", "'sessionKey'", ")", ";", "$", "path", "=", "$", "this", "->", "getImportFilePath", "(", ...
Import data based on column names matching header indexes in the CSV. The $matches array should be in the format of: [ 0 => [db_name1, db_name2], 1 => [db_name3], ... ] The key (0, 1) is the column index in the CSV and the value is another array of target database column names.
[ "Import", "data", "based", "on", "column", "names", "matching", "header", "indexes", "in", "the", "CSV", ".", "The", "$matches", "array", "should", "be", "in", "the", "format", "of", ":" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/models/ImportModel.php#L69-L75
train
Import the content of the matches into the grammar
[ 30522, 2270, 3853, 12324, 1006, 1002, 3503, 1010, 1002, 7047, 1027, 1031, 1033, 1007, 1063, 1002, 5219, 14839, 1027, 9140, 1035, 2131, 1006, 1002, 7047, 1010, 1005, 5219, 14839, 1005, 1007, 1025, 1002, 4130, 1027, 1002, 2023, 1011, 1028, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/HTML/QuickForm2/Container.php
HTML_QuickForm2_Container.addElement
public function addElement($elementOrType, $name = null, $attributes = null, array $data = array()) { if ($elementOrType instanceof HTML_QuickForm2_Node) { return $this->appendChild($elementOrType); } else { return $this->appendChild(HTML_QuickForm2_Factory::createElement( $elementOrType, $name, $attributes, $data )); } }
php
public function addElement($elementOrType, $name = null, $attributes = null, array $data = array()) { if ($elementOrType instanceof HTML_QuickForm2_Node) { return $this->appendChild($elementOrType); } else { return $this->appendChild(HTML_QuickForm2_Factory::createElement( $elementOrType, $name, $attributes, $data )); } }
[ "public", "function", "addElement", "(", "$", "elementOrType", ",", "$", "name", "=", "null", ",", "$", "attributes", "=", "null", ",", "array", "$", "data", "=", "array", "(", ")", ")", "{", "if", "(", "$", "elementOrType", "instanceof", "HTML_QuickForm...
Appends an element to the container (possibly creating it first) If the first parameter is an instance of HTML_QuickForm2_Node then all other parameters are ignored and the method just calls {@link appendChild()}. In the other case the element is first created via {@link HTML_QuickForm2_Factory::createElement()} and then added via the same method. This is a convenience method to reduce typing and ease porting from HTML_QuickForm. @param string|HTML_QuickForm2_Node Either type name (treated case-insensitively) or an element instance @param mixed Element name @param mixed Element attributes @param array Element-specific data @return HTML_QuickForm2_Node Added element @throws HTML_QuickForm2_InvalidArgumentException @throws HTML_QuickForm2_NotFoundException
[ "Appends", "an", "element", "to", "the", "container", "(", "possibly", "creating", "it", "first", ")" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/HTML/QuickForm2/Container.php#L218-L228
train
Adds an element to the form
[ 30522, 2270, 3853, 5587, 12260, 3672, 1006, 1002, 5783, 11589, 18863, 1010, 1002, 2171, 1027, 19701, 1010, 1002, 12332, 1027, 19701, 1010, 9140, 1002, 2951, 1027, 9140, 1006, 1007, 1007, 1063, 2065, 1006, 1002, 5783, 11589, 18863, 6013, 112...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Concurrency/DistributedList.php
DistributedList.remove
public function remove($items) { if (!is_array($items)) { $items = array($items); } $allItems = $this->getAll(); foreach ($items as $item) { $existingIndex = array_search($item, $allItems); if ($existingIndex === false) { return; } unset($allItems[$existingIndex]); } $this->setAll(array_values($allItems)); }
php
public function remove($items) { if (!is_array($items)) { $items = array($items); } $allItems = $this->getAll(); foreach ($items as $item) { $existingIndex = array_search($item, $allItems); if ($existingIndex === false) { return; } unset($allItems[$existingIndex]); } $this->setAll(array_values($allItems)); }
[ "public", "function", "remove", "(", "$", "items", ")", "{", "if", "(", "!", "is_array", "(", "$", "items", ")", ")", "{", "$", "items", "=", "array", "(", "$", "items", ")", ";", "}", "$", "allItems", "=", "$", "this", "->", "getAll", "(", ")"...
Removes one or more items by value from the list in the option table. Does not preserve array keys. @param string|array $items
[ "Removes", "one", "or", "more", "items", "by", "value", "from", "the", "list", "in", "the", "option", "table", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Concurrency/DistributedList.php#L114-L132
train
Remove one or more items from the list
[ 30522, 2270, 3853, 6366, 1006, 1002, 5167, 1007, 1063, 2065, 1006, 999, 2003, 1035, 9140, 1006, 1002, 5167, 1007, 1007, 1063, 1002, 5167, 1027, 9140, 1006, 1002, 5167, 1007, 1025, 1065, 1002, 2035, 4221, 5244, 1027, 1002, 2023, 1011, 1028...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/Markdown/ParsedownGravTrait.php
ParsedownGravTrait.isBlockCompletable
protected function isBlockCompletable($Type) { $completable = \in_array($Type, $this->completable_blocks) || method_exists($this, 'block' . $Type . 'Complete'); return $completable; }
php
protected function isBlockCompletable($Type) { $completable = \in_array($Type, $this->completable_blocks) || method_exists($this, 'block' . $Type . 'Complete'); return $completable; }
[ "protected", "function", "isBlockCompletable", "(", "$", "Type", ")", "{", "$", "completable", "=", "\\", "in_array", "(", "$", "Type", ",", "$", "this", "->", "completable_blocks", ")", "||", "method_exists", "(", "$", "this", ",", "'block'", ".", "$", ...
Overrides the default behavior to allow for plugin-provided blocks to be completable @param string $Type @return bool
[ "Overrides", "the", "default", "behavior", "to", "allow", "for", "plugin", "-", "provided", "blocks", "to", "be", "completable" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Markdown/ParsedownGravTrait.php#L129-L134
train
Check if a block type can be completed
[ 30522, 5123, 3853, 2003, 23467, 9006, 10814, 10880, 1006, 1002, 2828, 1007, 1063, 1002, 4012, 10814, 10880, 1027, 1032, 1999, 1035, 9140, 1006, 1002, 2828, 1010, 1002, 2023, 1011, 1028, 4012, 10814, 10880, 1035, 5991, 1007, 1064, 1064, 4118...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/AbstractRendererEngine.php
AbstractRendererEngine.setTheme
public function setTheme(FormView $view, $themes, $useDefaultThemes = true) { $cacheKey = $view->vars[self::CACHE_KEY_VAR]; // Do not cast, as casting turns objects into arrays of properties $this->themes[$cacheKey] = \is_array($themes) ? $themes : [$themes]; $this->useDefaultThemes[$cacheKey] = (bool) $useDefaultThemes; // Unset instead of resetting to an empty array, in order to allow // implementations (like TwigRendererEngine) to check whether $cacheKey // is set at all. unset($this->resources[$cacheKey], $this->resourceHierarchyLevels[$cacheKey]); }
php
public function setTheme(FormView $view, $themes, $useDefaultThemes = true) { $cacheKey = $view->vars[self::CACHE_KEY_VAR]; // Do not cast, as casting turns objects into arrays of properties $this->themes[$cacheKey] = \is_array($themes) ? $themes : [$themes]; $this->useDefaultThemes[$cacheKey] = (bool) $useDefaultThemes; // Unset instead of resetting to an empty array, in order to allow // implementations (like TwigRendererEngine) to check whether $cacheKey // is set at all. unset($this->resources[$cacheKey], $this->resourceHierarchyLevels[$cacheKey]); }
[ "public", "function", "setTheme", "(", "FormView", "$", "view", ",", "$", "themes", ",", "$", "useDefaultThemes", "=", "true", ")", "{", "$", "cacheKey", "=", "$", "view", "->", "vars", "[", "self", "::", "CACHE_KEY_VAR", "]", ";", "// Do not cast, as cast...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/AbstractRendererEngine.php#L47-L59
train
Sets the theme of the form view
[ 30522, 2270, 3853, 2275, 10760, 4168, 1006, 2433, 8584, 1002, 3193, 1010, 1002, 6991, 1010, 1002, 2109, 12879, 23505, 10760, 7834, 1027, 2995, 1007, 1063, 1002, 17053, 14839, 1027, 1002, 3193, 1011, 1028, 13075, 2015, 1031, 2969, 1024, 1024...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/Login/PasswordResetter.php
PasswordResetter.getPasswordToResetTo
private function getPasswordToResetTo($login) { $optionName = self::getPasswordResetInfoOptionName($login); $optionValue = Option::get($optionName); $optionValue = json_decode($optionValue, $isAssoc = true); return $optionValue; }
php
private function getPasswordToResetTo($login) { $optionName = self::getPasswordResetInfoOptionName($login); $optionValue = Option::get($optionName); $optionValue = json_decode($optionValue, $isAssoc = true); return $optionValue; }
[ "private", "function", "getPasswordToResetTo", "(", "$", "login", ")", "{", "$", "optionName", "=", "self", "::", "getPasswordResetInfoOptionName", "(", "$", "login", ")", ";", "$", "optionValue", "=", "Option", "::", "get", "(", "$", "optionName", ")", ";",...
Gets password hash stored in password reset info. @param string $login The user login to check for. @return string|false The hashed password or false if no reset info exists.
[ "Gets", "password", "hash", "stored", "in", "password", "reset", "info", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Login/PasswordResetter.php#L479-L485
train
Get password to reset to
[ 30522, 2797, 3853, 2131, 15194, 18351, 19277, 21678, 2080, 1006, 1002, 8833, 2378, 1007, 1063, 1002, 5724, 18442, 1027, 2969, 1024, 1024, 2131, 15194, 18351, 6072, 20624, 2078, 14876, 7361, 3508, 18442, 1006, 1002, 8833, 2378, 1007, 1025, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/FileIntegrity.php
FileIntegrity.isFileFromPluginNotInManifest
protected static function isFileFromPluginNotInManifest($file, $pluginsInManifest) { if (strpos($file, 'plugins/') !== 0) { return false; } if (substr_count($file, '/') < 2) { // must be a file plugins/abc.xyz and not a plugin directory return false; } $pluginName = self::getPluginNameFromFilepath($file); if(in_array($pluginName, $pluginsInManifest)) { return false; } return true; }
php
protected static function isFileFromPluginNotInManifest($file, $pluginsInManifest) { if (strpos($file, 'plugins/') !== 0) { return false; } if (substr_count($file, '/') < 2) { // must be a file plugins/abc.xyz and not a plugin directory return false; } $pluginName = self::getPluginNameFromFilepath($file); if(in_array($pluginName, $pluginsInManifest)) { return false; } return true; }
[ "protected", "static", "function", "isFileFromPluginNotInManifest", "(", "$", "file", ",", "$", "pluginsInManifest", ")", "{", "if", "(", "strpos", "(", "$", "file", ",", "'plugins/'", ")", "!==", "0", ")", "{", "return", "false", ";", "}", "if", "(", "s...
If a plugin folder is not tracked in the manifest then we don't try to report any files in this folder Could be a third party plugin or any plugin from the Marketplace @param $file @param $pluginsInManifest @return bool
[ "If", "a", "plugin", "folder", "is", "not", "tracked", "in", "the", "manifest", "then", "we", "don", "t", "try", "to", "report", "any", "files", "in", "this", "folder", "Could", "be", "a", "third", "party", "plugin", "or", "any", "plugin", "from", "the...
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/FileIntegrity.php#L285-L302
train
Check if a file is from a plugin not in the manifest
[ 30522, 5123, 10763, 3853, 2003, 8873, 2571, 19699, 25377, 7630, 11528, 17048, 2378, 20799, 14081, 1006, 1002, 5371, 1010, 1002, 13354, 7076, 2378, 20799, 14081, 1007, 1063, 2065, 1006, 2358, 14536, 2891, 1006, 1002, 5371, 1010, 1005, 13354, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Displayers/Actions.php
Actions.display
public function display($callback = null) { if ($callback instanceof \Closure) { $callback->call($this, $this); } $actions = $this->prepends; foreach ($this->actions as $action) { $method = 'render'.ucfirst($action); array_push($actions, $this->{$method}()); } $actions = array_merge($actions, $this->appends); return implode('', $actions); }
php
public function display($callback = null) { if ($callback instanceof \Closure) { $callback->call($this, $this); } $actions = $this->prepends; foreach ($this->actions as $action) { $method = 'render'.ucfirst($action); array_push($actions, $this->{$method}()); } $actions = array_merge($actions, $this->appends); return implode('', $actions); }
[ "public", "function", "display", "(", "$", "callback", "=", "null", ")", "{", "if", "(", "$", "callback", "instanceof", "\\", "Closure", ")", "{", "$", "callback", "->", "call", "(", "$", "this", ",", "$", "this", ")", ";", "}", "$", "actions", "="...
{@inheritdoc}
[ "{" ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid/Displayers/Actions.php#L144-L160
train
Display the page
[ 30522, 2270, 3853, 4653, 1006, 1002, 2655, 5963, 1027, 19701, 1007, 1063, 2065, 1006, 1002, 2655, 5963, 6013, 11253, 1032, 8503, 1007, 1063, 1002, 2655, 5963, 1011, 1028, 2655, 1006, 1002, 2023, 1010, 1002, 2023, 1007, 1025, 1065, 1002, 4...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Foundation/Auth/SendsPasswordResetEmails.php
SendsPasswordResetEmails.sendResetLinkFailedResponse
protected function sendResetLinkFailedResponse(Request $request, $response) { return back() ->withInput($request->only('email')) ->withErrors(['email' => trans($response)]); }
php
protected function sendResetLinkFailedResponse(Request $request, $response) { return back() ->withInput($request->only('email')) ->withErrors(['email' => trans($response)]); }
[ "protected", "function", "sendResetLinkFailedResponse", "(", "Request", "$", "request", ",", "$", "response", ")", "{", "return", "back", "(", ")", "->", "withInput", "(", "$", "request", "->", "only", "(", "'email'", ")", ")", "->", "withErrors", "(", "["...
Get the response for a failed password reset link. @param \Illuminate\Http\Request $request @param string $response @return \Illuminate\Http\RedirectResponse|\Illuminate\Http\JsonResponse
[ "Get", "the", "response", "for", "a", "failed", "password", "reset", "link", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Foundation/Auth/SendsPasswordResetEmails.php#L83-L88
train
Send the failed reset link response
[ 30522, 5123, 3853, 4604, 6072, 3388, 13767, 7011, 18450, 6072, 26029, 3366, 1006, 5227, 1002, 5227, 1010, 1002, 3433, 1007, 1063, 2709, 2067, 1006, 1007, 1011, 1028, 2306, 18780, 1006, 1002, 5227, 1011, 1028, 2069, 1006, 1005, 10373, 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...
matomo-org/matomo
plugins/CoreConsole/Commands/ClearCaches.php
ClearCaches.execute
protected function execute(InputInterface $input, OutputInterface $output) { // Note: the logic for this command must be refactored in this helper function below. Filesystem::deleteAllCacheOnUpdate(); $this->writeSuccessMessage($output, array('Caches cleared')); }
php
protected function execute(InputInterface $input, OutputInterface $output) { // Note: the logic for this command must be refactored in this helper function below. Filesystem::deleteAllCacheOnUpdate(); $this->writeSuccessMessage($output, array('Caches cleared')); }
[ "protected", "function", "execute", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "// Note: the logic for this command must be refactored in this helper function below.", "Filesystem", "::", "deleteAllCacheOnUpdate", "(", ")", ";", "$",...
Execute command like: ./console core:clear-caches
[ "Execute", "command", "like", ":", ".", "/", "console", "core", ":", "clear", "-", "caches" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/CoreConsole/Commands/ClearCaches.php#L31-L37
train
Delete all caches
[ 30522, 5123, 3853, 15389, 1006, 7953, 18447, 2121, 12172, 1002, 7953, 1010, 6434, 18447, 2121, 12172, 1002, 6434, 1007, 1063, 1013, 1013, 3602, 1024, 1996, 7961, 2005, 2023, 3094, 2442, 2022, 25416, 18908, 30524, 2121, 3853, 2917, 1012, 676...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/ThemeManager.php
ThemeManager.setInstalled
public function setInstalled($code, $dirName = null) { if (!$dirName) { $dirName = strtolower(str_replace('.', '-', $code)); } $history = Parameter::get('system::theme.history', []); $history[$code] = $dirName; Parameter::set('system::theme.history', $history); }
php
public function setInstalled($code, $dirName = null) { if (!$dirName) { $dirName = strtolower(str_replace('.', '-', $code)); } $history = Parameter::get('system::theme.history', []); $history[$code] = $dirName; Parameter::set('system::theme.history', $history); }
[ "public", "function", "setInstalled", "(", "$", "code", ",", "$", "dirName", "=", "null", ")", "{", "if", "(", "!", "$", "dirName", ")", "{", "$", "dirName", "=", "strtolower", "(", "str_replace", "(", "'.'", ",", "'-'", ",", "$", "code", ")", ")",...
Flags a theme as being installed, so it is not downloaded twice. @param string $code Theme code @param string|null $dirName
[ "Flags", "a", "theme", "as", "being", "installed", "so", "it", "is", "not", "downloaded", "twice", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/ThemeManager.php#L46-L55
train
Set installed theme
[ 30522, 2270, 3853, 2275, 7076, 9080, 3709, 1006, 1002, 3642, 1010, 1002, 16101, 18442, 1027, 19701, 1007, 1063, 2065, 1006, 999, 1002, 16101, 18442, 1007, 1063, 1002, 16101, 18442, 1027, 2358, 5339, 12898, 13777, 1006, 2358, 2099, 1035, 567...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Intl/DateFormatter/DateFormat/FullTransformer.php
FullTransformer.normalizeArray
protected function normalizeArray(array $data) { $ret = []; foreach ($data as $key => $value) { if (!\is_string($key)) { continue; } $ret[$key[0]] = [ 'value' => $value, 'pattern' => $key, ]; } return $ret; }
php
protected function normalizeArray(array $data) { $ret = []; foreach ($data as $key => $value) { if (!\is_string($key)) { continue; } $ret[$key[0]] = [ 'value' => $value, 'pattern' => $key, ]; } return $ret; }
[ "protected", "function", "normalizeArray", "(", "array", "$", "data", ")", "{", "$", "ret", "=", "[", "]", ";", "foreach", "(", "$", "data", "as", "$", "key", "=>", "$", "value", ")", "{", "if", "(", "!", "\\", "is_string", "(", "$", "key", ")", ...
Normalize a preg_replace match array, removing the numeric keys and returning an associative array with the value and pattern values for the matched Transformer. @return array
[ "Normalize", "a", "preg_replace", "match", "array", "removing", "the", "numeric", "keys", "and", "returning", "an", "associative", "array", "with", "the", "value", "and", "pattern", "values", "for", "the", "matched", "Transformer", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Intl/DateFormatter/DateFormat/FullTransformer.php#L256-L272
train
Normalize array to array
[ 30522, 5123, 3853, 3671, 4697, 2906, 9447, 1006, 9140, 1002, 2951, 1007, 1063, 1002, 2128, 2102, 1027, 1031, 1033, 1025, 18921, 6776, 1006, 1002, 2951, 2004, 1002, 3145, 1027, 1028, 1002, 3643, 1007, 1063, 2065, 1006, 999, 1032, 2003, 103...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Schema/PostgresBuilder.php
PostgresBuilder.getColumnListing
public function getColumnListing($table) { [$schema, $table] = $this->parseSchemaAndTable($table); $table = $this->connection->getTablePrefix().$table; $results = $this->connection->select( $this->grammar->compileColumnListing(), [$schema, $table] ); return $this->connection->getPostProcessor()->processColumnListing($results); }
php
public function getColumnListing($table) { [$schema, $table] = $this->parseSchemaAndTable($table); $table = $this->connection->getTablePrefix().$table; $results = $this->connection->select( $this->grammar->compileColumnListing(), [$schema, $table] ); return $this->connection->getPostProcessor()->processColumnListing($results); }
[ "public", "function", "getColumnListing", "(", "$", "table", ")", "{", "[", "$", "schema", ",", "$", "table", "]", "=", "$", "this", "->", "parseSchemaAndTable", "(", "$", "table", ")", ";", "$", "table", "=", "$", "this", "->", "connection", "->", "...
Get the column listing for a given table. @param string $table @return array
[ "Get", "the", "column", "listing", "for", "a", "given", "table", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Schema/PostgresBuilder.php#L108-L119
train
Returns a column listing of a table.
[ 30522, 2270, 3853, 2131, 25778, 2819, 20554, 2923, 2075, 1006, 1002, 2795, 1007, 1063, 1031, 1002, 8040, 28433, 1010, 1002, 2795, 1033, 1027, 1002, 2023, 1011, 1028, 11968, 8583, 5403, 2863, 5685, 10880, 1006, 1002, 2795, 1007, 1025, 1002, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
overtrue/wechat
src/OfficialAccount/Broadcasting/Client.php
Client.previewVideo
public function previewVideo(string $mediaId, $reception, $method = self::PREVIEW_BY_OPENID) { return $this->previewMessage(new Media($mediaId, 'mpvideo'), $reception, $method); }
php
public function previewVideo(string $mediaId, $reception, $method = self::PREVIEW_BY_OPENID) { return $this->previewMessage(new Media($mediaId, 'mpvideo'), $reception, $method); }
[ "public", "function", "previewVideo", "(", "string", "$", "mediaId", ",", "$", "reception", ",", "$", "method", "=", "self", "::", "PREVIEW_BY_OPENID", ")", "{", "return", "$", "this", "->", "previewMessage", "(", "new", "Media", "(", "$", "mediaId", ",", ...
Preview a video message. @param mixed $mediaId message @param string $reception @param string $method @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string @throws \EasyWeChat\Kernel\Exceptions\RuntimeException @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
[ "Preview", "a", "video", "message", "." ]
120c72faaa93c270365bc75c73c362d5fd583209
https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/OfficialAccount/Broadcasting/Client.php#L299-L302
train
Preview a video message
[ 30522, 2270, 3853, 19236, 17258, 8780, 1006, 5164, 1002, 2865, 3593, 1010, 1002, 7684, 1010, 1002, 4118, 1027, 2969, 1024, 1024, 19236, 1035, 2011, 1035, 2330, 3593, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 19236, 7834, 3736, 3351, 1006, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/Page/Page.php
Page.slug
public function slug($var = null) { if ($var !== null && $var !== '') { $this->slug = $var; } if (empty($this->slug)) { $this->slug = $this->adjustRouteCase(preg_replace(PAGE_ORDER_PREFIX_REGEX, '', $this->folder)) ?: null; } return $this->slug; }
php
public function slug($var = null) { if ($var !== null && $var !== '') { $this->slug = $var; } if (empty($this->slug)) { $this->slug = $this->adjustRouteCase(preg_replace(PAGE_ORDER_PREFIX_REGEX, '', $this->folder)) ?: null; } return $this->slug; }
[ "public", "function", "slug", "(", "$", "var", "=", "null", ")", "{", "if", "(", "$", "var", "!==", "null", "&&", "$", "var", "!==", "''", ")", "{", "$", "this", "->", "slug", "=", "$", "var", ";", "}", "if", "(", "empty", "(", "$", "this", ...
Gets and Sets the slug for the Page. The slug is used in the URL routing. If not set it uses the parent folder from the path @param string $var the slug, e.g. 'my-blog' @return string the slug
[ "Gets", "and", "Sets", "the", "slug", "for", "the", "Page", ".", "The", "slug", "is", "used", "in", "the", "URL", "routing", ".", "If", "not", "set", "it", "uses", "the", "parent", "folder", "from", "the", "path" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Page.php#L1761-L1772
train
Get the slug of the page
[ 30522, 2270, 3853, 23667, 1006, 1002, 13075, 1027, 19701, 1007, 1063, 2065, 1006, 1002, 13075, 999, 1027, 1027, 19701, 1004, 1004, 1002, 13075, 999, 1027, 1027, 1005, 1005, 1007, 1063, 1002, 2023, 1011, 1028, 23667, 1027, 1002, 13075, 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...
matomo-org/matomo
core/Archive/Chunk.php
Chunk.isRecordNameAChunk
public function isRecordNameAChunk($recordName) { $posAppendix = $this->getEndPosOfChunkAppendix($recordName); if (false === $posAppendix) { return false; } // will contain "0_99" of "chunk_0_99" $blobId = substr($recordName, $posAppendix); return $this->isChunkRange($blobId); }
php
public function isRecordNameAChunk($recordName) { $posAppendix = $this->getEndPosOfChunkAppendix($recordName); if (false === $posAppendix) { return false; } // will contain "0_99" of "chunk_0_99" $blobId = substr($recordName, $posAppendix); return $this->isChunkRange($blobId); }
[ "public", "function", "isRecordNameAChunk", "(", "$", "recordName", ")", "{", "$", "posAppendix", "=", "$", "this", "->", "getEndPosOfChunkAppendix", "(", "$", "recordName", ")", ";", "if", "(", "false", "===", "$", "posAppendix", ")", "{", "return", "false"...
Detects whether a recordName like 'Actions_ActionUrls_chunk_0_99' or 'Actions_ActionUrls' belongs to a chunk or not. To be a valid recordName that belongs to a chunk it must end with '_chunk_NUMERIC_NUMERIC'. @param string $recordName @return bool
[ "Detects", "whether", "a", "recordName", "like", "Actions_ActionUrls_chunk_0_99", "or", "Actions_ActionUrls", "belongs", "to", "a", "chunk", "or", "not", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Archive/Chunk.php#L77-L89
train
Is Record Name a chunk?
[ 30522, 2270, 3853, 2003, 2890, 27108, 28911, 4168, 6776, 16814, 1006, 1002, 2501, 18442, 1007, 1063, 1002, 13433, 3736, 21512, 16089, 2595, 1027, 1002, 2023, 1011, 1028, 2131, 10497, 6873, 6499, 11329, 17157, 2912, 30524, 4135, 17062, 1027, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
dompdf/dompdf
src/Css/Style.php
Style.set_border_spacing
function set_border_spacing($val) { $arr = explode(" ", $val); if (count($arr) == 1) { $arr[1] = $arr[0]; } //see __set and __get, on all assignments clear cache, not needed on direct set through __set $this->_prop_cache["border_spacing"] = null; $this->_props["border_spacing"] = "$arr[0] $arr[1]"; }
php
function set_border_spacing($val) { $arr = explode(" ", $val); if (count($arr) == 1) { $arr[1] = $arr[0]; } //see __set and __get, on all assignments clear cache, not needed on direct set through __set $this->_prop_cache["border_spacing"] = null; $this->_props["border_spacing"] = "$arr[0] $arr[1]"; }
[ "function", "set_border_spacing", "(", "$", "val", ")", "{", "$", "arr", "=", "explode", "(", "\" \"", ",", "$", "val", ")", ";", "if", "(", "count", "(", "$", "arr", ")", "==", "1", ")", "{", "$", "arr", "[", "1", "]", "=", "$", "arr", "[", ...
Sets the border spacing @link http://www.w3.org/TR/CSS21/box.html#border-properties @param float $val
[ "Sets", "the", "border", "spacing" ]
75f13c700009be21a1965dc2c5b68a8708c22ba2
https://github.com/dompdf/dompdf/blob/75f13c700009be21a1965dc2c5b68a8708c22ba2/src/Css/Style.php#L2484-L2495
train
set border spacing
[ 30522, 3853, 2275, 1035, 3675, 1035, 12403, 6129, 1006, 1002, 11748, 1007, 1063, 1002, 12098, 2099, 1027, 15044, 1006, 1000, 1000, 1010, 1002, 11748, 1007, 1025, 2065, 1006, 4175, 1006, 1002, 12098, 2099, 1007, 1027, 1027, 1015, 1007, 1063,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/HttpFoundation/Request.php
Request.getMethod
public function getMethod() { if (null !== $this->method) { return $this->method; } $this->method = strtoupper($this->server->get('REQUEST_METHOD', 'GET')); if ('POST' !== $this->method) { return $this->method; } $method = $this->headers->get('X-HTTP-METHOD-OVERRIDE'); if (!$method && self::$httpMethodParameterOverride) { $method = $this->request->get('_method', $this->query->get('_method', 'POST')); } if (!\is_string($method)) { return $this->method; } $method = strtoupper($method); if (\in_array($method, ['GET', 'HEAD', 'POST', 'PUT', 'DELETE', 'CONNECT', 'OPTIONS', 'PATCH', 'PURGE', 'TRACE'], true)) { return $this->method = $method; } if (!preg_match('/^[A-Z]++$/D', $method)) { throw new SuspiciousOperationException(sprintf('Invalid method override "%s".', $method)); } return $this->method = $method; }
php
public function getMethod() { if (null !== $this->method) { return $this->method; } $this->method = strtoupper($this->server->get('REQUEST_METHOD', 'GET')); if ('POST' !== $this->method) { return $this->method; } $method = $this->headers->get('X-HTTP-METHOD-OVERRIDE'); if (!$method && self::$httpMethodParameterOverride) { $method = $this->request->get('_method', $this->query->get('_method', 'POST')); } if (!\is_string($method)) { return $this->method; } $method = strtoupper($method); if (\in_array($method, ['GET', 'HEAD', 'POST', 'PUT', 'DELETE', 'CONNECT', 'OPTIONS', 'PATCH', 'PURGE', 'TRACE'], true)) { return $this->method = $method; } if (!preg_match('/^[A-Z]++$/D', $method)) { throw new SuspiciousOperationException(sprintf('Invalid method override "%s".', $method)); } return $this->method = $method; }
[ "public", "function", "getMethod", "(", ")", "{", "if", "(", "null", "!==", "$", "this", "->", "method", ")", "{", "return", "$", "this", "->", "method", ";", "}", "$", "this", "->", "method", "=", "strtoupper", "(", "$", "this", "->", "server", "-...
Gets the request "intended" method. If the X-HTTP-Method-Override header is set, and if the method is a POST, then it is used to determine the "real" intended HTTP method. The _method request parameter can also be used to determine the HTTP method, but only if enableHttpMethodParameterOverride() has been called. The method is always an uppercased string. @return string The request method @see getRealMethod()
[ "Gets", "the", "request", "intended", "method", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpFoundation/Request.php#L1215-L1248
train
Get HTTP method
[ 30522, 2270, 3853, 2131, 11368, 6806, 2094, 1006, 1007, 1063, 2065, 1006, 19701, 999, 1027, 1027, 1002, 2023, 1011, 1028, 4118, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 4118, 1025, 1065, 1002, 2023, 1011, 1028, 4118, 1027, 2358, 5339, 71...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
z-song/laravel-admin
src/Form/Tools.php
Tools.disableView
public function disableView(bool $disable = true) { if ($disable) { array_delete($this->tools, 'view'); } elseif (!in_array('view', $this->tools)) { array_push($this->tools, 'view'); } return $this; }
php
public function disableView(bool $disable = true) { if ($disable) { array_delete($this->tools, 'view'); } elseif (!in_array('view', $this->tools)) { array_push($this->tools, 'view'); } return $this; }
[ "public", "function", "disableView", "(", "bool", "$", "disable", "=", "true", ")", "{", "if", "(", "$", "disable", ")", "{", "array_delete", "(", "$", "this", "->", "tools", ",", "'view'", ")", ";", "}", "elseif", "(", "!", "in_array", "(", "'view'"...
Disable `edit` tool. @return $this
[ "Disable", "edit", "tool", "." ]
3e65086f806b54699145f58af53843e5dbbb7994
https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Form/Tools.php#L115-L124
train
Disable view tools
[ 30522, 2270, 3853, 4487, 19150, 8584, 1006, 22017, 2140, 1002, 4487, 19150, 1027, 2995, 1007, 1063, 2065, 1006, 1002, 4487, 19150, 1007, 1063, 9140, 1035, 3972, 12870, 1006, 1002, 2023, 1011, 1028, 5906, 1010, 1005, 3193, 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/Foundation/Console/MailMakeCommand.php
MailMakeCommand.handle
public function handle() { if (parent::handle() === false && ! $this->option('force')) { return; } if ($this->option('markdown')) { $this->writeMarkdownTemplate(); } }
php
public function handle() { if (parent::handle() === false && ! $this->option('force')) { return; } if ($this->option('markdown')) { $this->writeMarkdownTemplate(); } }
[ "public", "function", "handle", "(", ")", "{", "if", "(", "parent", "::", "handle", "(", ")", "===", "false", "&&", "!", "$", "this", "->", "option", "(", "'force'", ")", ")", "{", "return", ";", "}", "if", "(", "$", "this", "->", "option", "(", ...
Execute the console command. @return void
[ "Execute", "the", "console", "command", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Foundation/Console/MailMakeCommand.php#L36-L45
train
Handle the page
[ 30522, 2270, 3853, 5047, 1006, 1007, 1063, 2065, 1006, 6687, 1024, 1024, 5047, 1006, 1007, 1027, 1027, 1027, 6270, 1004, 1004, 999, 1002, 2023, 1011, 1028, 5724, 1006, 1005, 2486, 1005, 1007, 1007, 1063, 2709, 1025, 1065, 2065, 1006, 1002...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/SettingsPiwik.php
SettingsPiwik.getKnownSegmentsToArchiveForSite
public static function getKnownSegmentsToArchiveForSite($idSite) { $cacheId = 'KnownSegmentsToArchiveForSite' . $idSite; $cache = PiwikCache::getTransientCache(); if ($cache->contains($cacheId)) { return $cache->fetch($cacheId); } $segments = array(); /** * Triggered during the cron archiving process to collect segments that * should be pre-processed for one specific site. The archiving process will be launched * for each of these segments when archiving data for that one site. * * This event can be used to add segments to be pre-processed for one site. * * _Note: If you just want to add a segment that is managed by the user, you should use the * SegmentEditor API._ * * **Example** * * Piwik::addAction('Segments.getKnownSegmentsToArchiveForSite', function (&$segments, $idSite) { * $segments[] = 'country=jp;city=Tokyo'; * }); * * @param array &$segmentsToProcess List of segment definitions, eg, * * array( * 'browserCode=ff;resolution=800x600', * 'country=JP;city=Tokyo' * ) * * Add segments to this array in your event handler. * @param int $idSite The ID of the site to get segments for. */ Piwik::postEvent('Segments.getKnownSegmentsToArchiveForSite', array(&$segments, $idSite)); $segments = array_unique($segments); $cache->save($cacheId, $segments); return $segments; }
php
public static function getKnownSegmentsToArchiveForSite($idSite) { $cacheId = 'KnownSegmentsToArchiveForSite' . $idSite; $cache = PiwikCache::getTransientCache(); if ($cache->contains($cacheId)) { return $cache->fetch($cacheId); } $segments = array(); /** * Triggered during the cron archiving process to collect segments that * should be pre-processed for one specific site. The archiving process will be launched * for each of these segments when archiving data for that one site. * * This event can be used to add segments to be pre-processed for one site. * * _Note: If you just want to add a segment that is managed by the user, you should use the * SegmentEditor API._ * * **Example** * * Piwik::addAction('Segments.getKnownSegmentsToArchiveForSite', function (&$segments, $idSite) { * $segments[] = 'country=jp;city=Tokyo'; * }); * * @param array &$segmentsToProcess List of segment definitions, eg, * * array( * 'browserCode=ff;resolution=800x600', * 'country=JP;city=Tokyo' * ) * * Add segments to this array in your event handler. * @param int $idSite The ID of the site to get segments for. */ Piwik::postEvent('Segments.getKnownSegmentsToArchiveForSite', array(&$segments, $idSite)); $segments = array_unique($segments); $cache->save($cacheId, $segments); return $segments; }
[ "public", "static", "function", "getKnownSegmentsToArchiveForSite", "(", "$", "idSite", ")", "{", "$", "cacheId", "=", "'KnownSegmentsToArchiveForSite'", ".", "$", "idSite", ";", "$", "cache", "=", "PiwikCache", "::", "getTransientCache", "(", ")", ";", "if", "(...
Returns the list of stored segments to pre-process for an individual site when executing cron archiving. @param int $idSite The ID of the site to get stored segments for. @return string[] The list of stored segments that apply to the requested site.
[ "Returns", "the", "list", "of", "stored", "segments", "to", "pre", "-", "process", "for", "an", "individual", "site", "when", "executing", "cron", "archiving", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/SettingsPiwik.php#L116-L158
train
Returns the list of all segments that should be pre - processed for a specific site.
[ 30522, 2270, 10763, 3853, 2131, 2243, 19779, 12325, 21693, 11187, 3406, 2906, 5428, 3726, 29278, 28032, 2063, 1006, 1002, 8909, 28032, 2063, 1007, 1063, 1002, 17053, 3593, 1027, 1005, 2124, 3366, 21693, 11187, 3406, 2906, 5428, 3726, 29278, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
php-ai/php-ml
src/Classification/Linear/Adaline.php
Adaline.runTraining
protected function runTraining(array $samples, array $targets): void { // The cost function is the sum of squares $callback = function ($weights, $sample, $target) { $this->weights = $weights; $output = $this->output($sample); $gradient = $output - $target; $error = $gradient ** 2; return [$error, $gradient]; }; $isBatch = $this->trainingType == self::BATCH_TRAINING; parent::runGradientDescent($samples, $targets, $callback, $isBatch); }
php
protected function runTraining(array $samples, array $targets): void { // The cost function is the sum of squares $callback = function ($weights, $sample, $target) { $this->weights = $weights; $output = $this->output($sample); $gradient = $output - $target; $error = $gradient ** 2; return [$error, $gradient]; }; $isBatch = $this->trainingType == self::BATCH_TRAINING; parent::runGradientDescent($samples, $targets, $callback, $isBatch); }
[ "protected", "function", "runTraining", "(", "array", "$", "samples", ",", "array", "$", "targets", ")", ":", "void", "{", "// The cost function is the sum of squares", "$", "callback", "=", "function", "(", "$", "weights", ",", "$", "sample", ",", "$", "targe...
Adapts the weights with respect to given samples and targets by use of gradient descent learning rule
[ "Adapts", "the", "weights", "with", "respect", "to", "given", "samples", "and", "targets", "by", "use", "of", "gradient", "descent", "learning", "rule" ]
f6aa1a59b0525b8fca3d2786d661ab3e70904016
https://github.com/php-ai/php-ml/blob/f6aa1a59b0525b8fca3d2786d661ab3e70904016/src/Classification/Linear/Adaline.php#L58-L74
train
Runs the gradient descent
[ 30522, 5123, 3853, 2448, 23654, 2075, 1006, 9140, 1002, 8168, 1010, 9140, 1002, 7889, 1007, 1024, 11675, 1063, 1013, 1013, 1996, 3465, 3853, 2003, 1996, 7680, 1997, 14320, 1002, 2655, 5963, 1027, 3853, 1006, 1002, 15871, 1010, 1002, 7099, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Validate/File/IsImage.php
Zend_Validate_File_IsImage._throw
protected function _throw($file, $errorType) { $this->_value = $file['name']; switch($errorType) { case Zend_Validate_File_MimeType::FALSE_TYPE : $errorType = self::FALSE_TYPE; break; case Zend_Validate_File_MimeType::NOT_DETECTED : $errorType = self::NOT_DETECTED; break; case Zend_Validate_File_MimeType::NOT_READABLE : $errorType = self::NOT_READABLE; break; } $this->_error($errorType); return false; }
php
protected function _throw($file, $errorType) { $this->_value = $file['name']; switch($errorType) { case Zend_Validate_File_MimeType::FALSE_TYPE : $errorType = self::FALSE_TYPE; break; case Zend_Validate_File_MimeType::NOT_DETECTED : $errorType = self::NOT_DETECTED; break; case Zend_Validate_File_MimeType::NOT_READABLE : $errorType = self::NOT_READABLE; break; } $this->_error($errorType); return false; }
[ "protected", "function", "_throw", "(", "$", "file", ",", "$", "errorType", ")", "{", "$", "this", "->", "_value", "=", "$", "file", "[", "'name'", "]", ";", "switch", "(", "$", "errorType", ")", "{", "case", "Zend_Validate_File_MimeType", "::", "FALSE_T...
Throws an error of the given type Duplicates parent method due to OOP Problem with late static binding in PHP 5.2 @param string $file @param string $errorType @return false
[ "Throws", "an", "error", "of", "the", "given", "type", "Duplicates", "parent", "method", "due", "to", "OOP", "Problem", "with", "late", "static", "binding", "in", "PHP", "5", ".", "2" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Validate/File/IsImage.php#L155-L172
train
Throw an error for a file
[ 30522, 5123, 3853, 1035, 5466, 1006, 1002, 5371, 1010, 1002, 7561, 13874, 1007, 1063, 1002, 2023, 1011, 1028, 1035, 3643, 1027, 1002, 5371, 1031, 1005, 2171, 1005, 1033, 1025, 6942, 1006, 1002, 7561, 13874, 1007, 1063, 2553, 16729, 2094, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Bridge/Doctrine/ContainerAwareEventManager.php
ContainerAwareEventManager.removeEventListener
public function removeEventListener($events, $listener) { if (\is_string($listener)) { $hash = '_service_'.$listener; } else { // Picks the hash code related to that listener $hash = spl_object_hash($listener); } foreach ((array) $events as $event) { // Check if actually have this listener associated if (isset($this->listeners[$event][$hash])) { unset($this->listeners[$event][$hash]); } } }
php
public function removeEventListener($events, $listener) { if (\is_string($listener)) { $hash = '_service_'.$listener; } else { // Picks the hash code related to that listener $hash = spl_object_hash($listener); } foreach ((array) $events as $event) { // Check if actually have this listener associated if (isset($this->listeners[$event][$hash])) { unset($this->listeners[$event][$hash]); } } }
[ "public", "function", "removeEventListener", "(", "$", "events", ",", "$", "listener", ")", "{", "if", "(", "\\", "is_string", "(", "$", "listener", ")", ")", "{", "$", "hash", "=", "'_service_'", ".", "$", "listener", ";", "}", "else", "{", "// Picks ...
Removes an event listener from the specified events. @param string|array $events @param object|string $listener
[ "Removes", "an", "event", "listener", "from", "the", "specified", "events", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bridge/Doctrine/ContainerAwareEventManager.php#L125-L140
train
Removes an event listener
[ 30522, 2270, 3853, 6366, 18697, 3372, 9863, 24454, 1006, 1002, 2824, 1010, 1002, 19373, 1007, 1063, 2065, 1006, 1032, 2003, 1035, 5164, 1006, 1002, 19373, 1007, 1007, 1063, 1002, 23325, 1027, 1005, 1035, 2326, 1035, 1005, 1012, 1002, 19373,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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.php
Db.dropTables
public static function dropTables($tables) { if (!is_array($tables)) { $tables = array($tables); } return self::query("DROP TABLE `" . implode('`,`', $tables) . "`"); }
php
public static function dropTables($tables) { if (!is_array($tables)) { $tables = array($tables); } return self::query("DROP TABLE `" . implode('`,`', $tables) . "`"); }
[ "public", "static", "function", "dropTables", "(", "$", "tables", ")", "{", "if", "(", "!", "is_array", "(", "$", "tables", ")", ")", "{", "$", "tables", "=", "array", "(", "$", "tables", ")", ";", "}", "return", "self", "::", "query", "(", "\"DROP...
Drops the supplied table or tables. @param string|array $tables The name of the table to drop or an array of table names to drop. Table names must be prefixed (see {@link Piwik\Common::prefixTable()}). @return \Zend_Db_Statement
[ "Drops", "the", "supplied", "table", "or", "tables", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Db.php#L397-L404
train
Drops all tables in the current language
[ 30522, 2270, 10763, 3853, 4530, 10880, 2015, 1006, 1002, 7251, 1007, 1063, 2065, 1006, 999, 2003, 1035, 9140, 1006, 1002, 7251, 1007, 1007, 1063, 1002, 30524, 1002, 7251, 1007, 1012, 1000, 1036, 1000, 1007, 1025, 1065, 102, 0, 0, 0, 0, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Eloquent/Relations/Concerns/AsPivot.php
AsPivot.fromAttributes
public static function fromAttributes(Model $parent, $attributes, $table, $exists = false) { $instance = new static; $instance->timestamps = $instance->hasTimestampAttributes($attributes); // The pivot model is a "dynamic" model since we will set the tables dynamically // for the instance. This allows it work for any intermediate tables for the // many to many relationship that are defined by this developer's classes. $instance->setConnection($parent->getConnectionName()) ->setTable($table) ->forceFill($attributes) ->syncOriginal(); // We store off the parent instance so we will access the timestamp column names // for the model, since the pivot model timestamps aren't easily configurable // from the developer's point of view. We can use the parents to get these. $instance->pivotParent = $parent; $instance->exists = $exists; return $instance; }
php
public static function fromAttributes(Model $parent, $attributes, $table, $exists = false) { $instance = new static; $instance->timestamps = $instance->hasTimestampAttributes($attributes); // The pivot model is a "dynamic" model since we will set the tables dynamically // for the instance. This allows it work for any intermediate tables for the // many to many relationship that are defined by this developer's classes. $instance->setConnection($parent->getConnectionName()) ->setTable($table) ->forceFill($attributes) ->syncOriginal(); // We store off the parent instance so we will access the timestamp column names // for the model, since the pivot model timestamps aren't easily configurable // from the developer's point of view. We can use the parents to get these. $instance->pivotParent = $parent; $instance->exists = $exists; return $instance; }
[ "public", "static", "function", "fromAttributes", "(", "Model", "$", "parent", ",", "$", "attributes", ",", "$", "table", ",", "$", "exists", "=", "false", ")", "{", "$", "instance", "=", "new", "static", ";", "$", "instance", "->", "timestamps", "=", ...
Create a new pivot model instance. @param \Illuminate\Database\Eloquent\Model $parent @param array $attributes @param string $table @param bool $exists @return static
[ "Create", "a", "new", "pivot", "model", "instance", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Relations/Concerns/AsPivot.php#L41-L63
train
Create a new instance of the class based on the attributes
[ 30522, 2270, 10763, 3853, 2013, 19321, 3089, 8569, 4570, 1006, 2944, 1002, 6687, 1010, 1002, 12332, 1010, 1002, 2795, 1010, 1002, 6526, 1027, 6270, 1007, 1063, 1002, 6013, 1027, 2047, 10763, 1025, 1002, 6013, 1011, 1028, 2335, 15464, 4523, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/thrift
lib/php/lib/Transport/TFramedTransport.php
TFramedTransport.readFrame
private function readFrame() { $buf = $this->transport_->readAll(4); $val = unpack('N', $buf); $sz = $val[1]; $this->rBuf_ = $this->transport_->readAll($sz); }
php
private function readFrame() { $buf = $this->transport_->readAll(4); $val = unpack('N', $buf); $sz = $val[1]; $this->rBuf_ = $this->transport_->readAll($sz); }
[ "private", "function", "readFrame", "(", ")", "{", "$", "buf", "=", "$", "this", "->", "transport_", "->", "readAll", "(", "4", ")", ";", "$", "val", "=", "unpack", "(", "'N'", ",", "$", "buf", ")", ";", "$", "sz", "=", "$", "val", "[", "1", ...
Reads a chunk of data into the internal read buffer.
[ "Reads", "a", "chunk", "of", "data", "into", "the", "internal", "read", "buffer", "." ]
acdd4226c210336e9e15eb812e5932a645fcd5ce
https://github.com/apache/thrift/blob/acdd4226c210336e9e15eb812e5932a645fcd5ce/lib/php/lib/Transport/TFramedTransport.php#L145-L152
train
Read the next frame from the transport stream.
[ 30522, 2797, 3853, 3191, 15643, 1006, 1007, 1063, 1002, 20934, 2546, 1027, 1002, 2023, 1011, 1028, 3665, 1035, 1011, 1028, 3191, 8095, 1006, 1018, 1007, 1025, 1002, 11748, 1027, 4895, 23947, 1006, 1005, 1050, 1005, 1010, 1002, 20934, 2546, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/RouteGroup.php
RouteGroup.formatPrefix
protected static function formatPrefix($new, $old) { $old = $old['prefix'] ?? null; return isset($new['prefix']) ? trim($old, '/').'/'.trim($new['prefix'], '/') : $old; }
php
protected static function formatPrefix($new, $old) { $old = $old['prefix'] ?? null; return isset($new['prefix']) ? trim($old, '/').'/'.trim($new['prefix'], '/') : $old; }
[ "protected", "static", "function", "formatPrefix", "(", "$", "new", ",", "$", "old", ")", "{", "$", "old", "=", "$", "old", "[", "'prefix'", "]", "??", "null", ";", "return", "isset", "(", "$", "new", "[", "'prefix'", "]", ")", "?", "trim", "(", ...
Format the prefix for the new group attributes. @param array $new @param array $old @return string|null
[ "Format", "the", "prefix", "for", "the", "new", "group", "attributes", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Routing/RouteGroup.php#L58-L63
train
Format the prefix of the new page
[ 30522, 5123, 10763, 3853, 4289, 28139, 8873, 2595, 1006, 1002, 2047, 1010, 1002, 2214, 1007, 1063, 1002, 2214, 1027, 1002, 2214, 1031, 1005, 17576, 1005, 1033, 1029, 1029, 19701, 1025, 2709, 26354, 3388, 1006, 1002, 2047, 1031, 1005, 17576,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/GPM/GPM.php
GPM.getUpdatableThemes
public function getUpdatableThemes() { $items = []; $repository = $this->repository['themes']; // local cache to speed things up if (isset($this->cache[__METHOD__])) { return $this->cache[__METHOD__]; } foreach ($this->installed['themes'] as $slug => $plugin) { if (!isset($repository[$slug]) || $plugin->symlink || !$plugin->version || $plugin->gpm === false) { continue; } $local_version = $plugin->version ?: 'Unknown'; $remote_version = $repository[$slug]->version; if (version_compare($local_version, $remote_version) < 0) { $repository[$slug]->available = $remote_version; $repository[$slug]->version = $local_version; $repository[$slug]->type = $repository[$slug]->release_type; $items[$slug] = $repository[$slug]; } } $this->cache[__METHOD__] = $items; return $items; }
php
public function getUpdatableThemes() { $items = []; $repository = $this->repository['themes']; // local cache to speed things up if (isset($this->cache[__METHOD__])) { return $this->cache[__METHOD__]; } foreach ($this->installed['themes'] as $slug => $plugin) { if (!isset($repository[$slug]) || $plugin->symlink || !$plugin->version || $plugin->gpm === false) { continue; } $local_version = $plugin->version ?: 'Unknown'; $remote_version = $repository[$slug]->version; if (version_compare($local_version, $remote_version) < 0) { $repository[$slug]->available = $remote_version; $repository[$slug]->version = $local_version; $repository[$slug]->type = $repository[$slug]->release_type; $items[$slug] = $repository[$slug]; } } $this->cache[__METHOD__] = $items; return $items; }
[ "public", "function", "getUpdatableThemes", "(", ")", "{", "$", "items", "=", "[", "]", ";", "$", "repository", "=", "$", "this", "->", "repository", "[", "'themes'", "]", ";", "// local cache to speed things up", "if", "(", "isset", "(", "$", "this", "->"...
Returns an array of Themes that can be updated. The Themes are extended with the `available` property that relies to the remote version @return array Array of updatable Themes
[ "Returns", "an", "array", "of", "Themes", "that", "can", "be", "updated", ".", "The", "Themes", "are", "extended", "with", "the", "available", "property", "that", "relies", "to", "the", "remote", "version" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/GPM/GPM.php#L312-L341
train
Return list of themes that are updatable
[ 30522, 2270, 3853, 2131, 6279, 2850, 10880, 10760, 7834, 1006, 1007, 1063, 1002, 5167, 1027, 1031, 1033, 1025, 1002, 22409, 1027, 1002, 2023, 1011, 1028, 22409, 1031, 1005, 6991, 1005, 1033, 1025, 1013, 1013, 2334, 17053, 2000, 3177, 2477, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/Tracker/Model.php
Model.isSiteEmpty
public function isSiteEmpty($siteId) { $sql = sprintf('SELECT idsite FROM %s WHERE idsite = ? limit 1', Common::prefixTable('log_visit')); $result = \Piwik\Db::fetchOne($sql, array($siteId)); return $result == null; }
php
public function isSiteEmpty($siteId) { $sql = sprintf('SELECT idsite FROM %s WHERE idsite = ? limit 1', Common::prefixTable('log_visit')); $result = \Piwik\Db::fetchOne($sql, array($siteId)); return $result == null; }
[ "public", "function", "isSiteEmpty", "(", "$", "siteId", ")", "{", "$", "sql", "=", "sprintf", "(", "'SELECT idsite FROM %s WHERE idsite = ? limit 1'", ",", "Common", "::", "prefixTable", "(", "'log_visit'", ")", ")", ";", "$", "result", "=", "\\", "Piwik", "\...
Returns true if the site doesn't have raw data. @param int $siteId @return bool
[ "Returns", "true", "if", "the", "site", "doesn", "t", "have", "raw", "data", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/Tracker/Model.php#L421-L428
train
Returns true if the site is empty.
[ 30522, 2270, 3853, 26354, 4221, 6633, 13876, 2100, 1006, 1002, 2609, 3593, 1007, 1063, 1002, 29296, 1027, 9043, 2546, 1006, 1005, 7276, 8909, 28032, 2063, 2013, 1003, 1055, 2073, 8909, 28032, 2063, 1027, 1029, 5787, 1015, 1005, 1010, 2691, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/DataTable/Renderer/Php.php
Php.flatRender
public function flatRender($dataTable = null) { if (is_null($dataTable)) { $dataTable = $this->table; } if (is_array($dataTable)) { $flatArray = $dataTable; if (self::shouldWrapArrayBeforeRendering($flatArray)) { $flatArray = array($flatArray); } } elseif ($dataTable instanceof DataTable\Map) { $flatArray = array(); foreach ($dataTable->getDataTables() as $keyName => $table) { $serializeSave = $this->serialize; $this->serialize = false; $flatArray[$keyName] = $this->flatRender($table); $this->serialize = $serializeSave; } } elseif ($dataTable instanceof Simple) { $flatArray = $this->renderSimpleTable($dataTable); // if we return only one numeric value then we print out the result in a simple <result> tag // keep it simple! if (count($flatArray) == 1) { $flatArray = current($flatArray); } } // A normal DataTable needs to be handled specifically else { $array = $this->renderTable($dataTable); $flatArray = $this->flattenArray($array); } if ($this->serialize) { $flatArray = serialize($flatArray); } return $flatArray; }
php
public function flatRender($dataTable = null) { if (is_null($dataTable)) { $dataTable = $this->table; } if (is_array($dataTable)) { $flatArray = $dataTable; if (self::shouldWrapArrayBeforeRendering($flatArray)) { $flatArray = array($flatArray); } } elseif ($dataTable instanceof DataTable\Map) { $flatArray = array(); foreach ($dataTable->getDataTables() as $keyName => $table) { $serializeSave = $this->serialize; $this->serialize = false; $flatArray[$keyName] = $this->flatRender($table); $this->serialize = $serializeSave; } } elseif ($dataTable instanceof Simple) { $flatArray = $this->renderSimpleTable($dataTable); // if we return only one numeric value then we print out the result in a simple <result> tag // keep it simple! if (count($flatArray) == 1) { $flatArray = current($flatArray); } } // A normal DataTable needs to be handled specifically else { $array = $this->renderTable($dataTable); $flatArray = $this->flattenArray($array); } if ($this->serialize) { $flatArray = serialize($flatArray); } return $flatArray; }
[ "public", "function", "flatRender", "(", "$", "dataTable", "=", "null", ")", "{", "if", "(", "is_null", "(", "$", "dataTable", ")", ")", "{", "$", "dataTable", "=", "$", "this", "->", "table", ";", "}", "if", "(", "is_array", "(", "$", "dataTable", ...
Produces a flat php array from the DataTable, putting "columns" and "metadata" on the same level. For example, when a originalRender() would be array( 'columns' => array( 'col1_name' => value1, 'col2_name' => value2 ), 'metadata' => array( 'metadata1_name' => value_metadata) ) a flatRender() is array( 'col1_name' => value1, 'col2_name' => value2, 'metadata1_name' => value_metadata ) @param null|DataTable|DataTable\Map|Simple $dataTable @return array Php array representing the 'flat' version of the datatable
[ "Produces", "a", "flat", "php", "array", "from", "the", "DataTable", "putting", "columns", "and", "metadata", "on", "the", "same", "level", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/DataTable/Renderer/Php.php#L103-L141
train
Figure out the flat array of the DataTable
[ 30522, 2270, 3853, 4257, 7389, 4063, 1006, 1002, 2951, 10880, 1027, 19701, 1007, 1063, 2065, 1006, 2003, 1035, 19701, 1006, 1002, 2951, 10880, 1007, 1007, 1063, 1002, 2951, 10880, 1027, 1002, 2023, 1011, 1028, 2795, 1025, 1065, 2065, 1006, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Framework/File/AbstractFile.php
AbstractFile.rename
public function rename(string $path): bool { if ($this->exists() && !@rename($this->filepath, $path)) { return false; } $this->setFilepath($path); return true; }
php
public function rename(string $path): bool { if ($this->exists() && !@rename($this->filepath, $path)) { return false; } $this->setFilepath($path); return true; }
[ "public", "function", "rename", "(", "string", "$", "path", ")", ":", "bool", "{", "if", "(", "$", "this", "->", "exists", "(", ")", "&&", "!", "@", "rename", "(", "$", "this", "->", "filepath", ",", "$", "path", ")", ")", "{", "return", "false",...
{@inheritdoc} @see FileInterface::rename()
[ "{" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Framework/File/AbstractFile.php#L307-L316
train
Renames the file
[ 30522, 2270, 3853, 14916, 14074, 1006, 5164, 1002, 4130, 1007, 1024, 22017, 2140, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 6526, 1006, 30524, 1025, 2709, 2995, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
walkor/Workerman
Worker.php
Worker.writeConnectionsStatisticsToStatusFile
protected static function writeConnectionsStatisticsToStatusFile() { // For master process. if (static::$_masterPid === posix_getpid()) { file_put_contents(static::$_statisticsFile, "--------------------------------------------------------------------- WORKERMAN CONNECTION STATUS --------------------------------------------------------------------------------\n", FILE_APPEND); file_put_contents(static::$_statisticsFile, "PID Worker CID Trans Protocol ipv4 ipv6 Recv-Q Send-Q Bytes-R Bytes-W Status Local Address Foreign Address\n", FILE_APPEND); chmod(static::$_statisticsFile, 0722); foreach (static::getAllWorkerPids() as $worker_pid) { posix_kill($worker_pid, SIGIO); } return; } // For child processes. $bytes_format = function($bytes) { if($bytes > 1024*1024*1024*1024) { return round($bytes/(1024*1024*1024*1024), 1)."TB"; } if($bytes > 1024*1024*1024) { return round($bytes/(1024*1024*1024), 1)."GB"; } if($bytes > 1024*1024) { return round($bytes/(1024*1024), 1)."MB"; } if($bytes > 1024) { return round($bytes/(1024), 1)."KB"; } return $bytes."B"; }; $pid = posix_getpid(); $str = ''; reset(static::$_workers); $current_worker = current(static::$_workers); $default_worker_name = $current_worker->name; /** @var \Workerman\Worker $worker */ foreach(TcpConnection::$connections as $connection) { /** @var \Workerman\Connection\TcpConnection $connection */ $transport = $connection->transport; $ipv4 = $connection->isIpV4() ? ' 1' : ' 0'; $ipv6 = $connection->isIpV6() ? ' 1' : ' 0'; $recv_q = $bytes_format($connection->getRecvBufferQueueSize()); $send_q = $bytes_format($connection->getSendBufferQueueSize()); $local_address = trim($connection->getLocalAddress()); $remote_address = trim($connection->getRemoteAddress()); $state = $connection->getStatus(false); $bytes_read = $bytes_format($connection->bytesRead); $bytes_written = $bytes_format($connection->bytesWritten); $id = $connection->id; $protocol = $connection->protocol ? $connection->protocol : $connection->transport; $pos = strrpos($protocol, '\\'); if ($pos) { $protocol = substr($protocol, $pos+1); } if (strlen($protocol) > 15) { $protocol = substr($protocol, 0, 13) . '..'; } $worker_name = isset($connection->worker) ? $connection->worker->name : $default_worker_name; if (strlen($worker_name) > 14) { $worker_name = substr($worker_name, 0, 12) . '..'; } $str .= str_pad($pid, 9) . str_pad($worker_name, 16) . str_pad($id, 10) . str_pad($transport, 8) . str_pad($protocol, 16) . str_pad($ipv4, 7) . str_pad($ipv6, 7) . str_pad($recv_q, 13) . str_pad($send_q, 13) . str_pad($bytes_read, 13) . str_pad($bytes_written, 13) . ' ' . str_pad($state, 14) . ' ' . str_pad($local_address, 22) . ' ' . str_pad($remote_address, 22) ."\n"; } if ($str) { file_put_contents(static::$_statisticsFile, $str, FILE_APPEND); } }
php
protected static function writeConnectionsStatisticsToStatusFile() { // For master process. if (static::$_masterPid === posix_getpid()) { file_put_contents(static::$_statisticsFile, "--------------------------------------------------------------------- WORKERMAN CONNECTION STATUS --------------------------------------------------------------------------------\n", FILE_APPEND); file_put_contents(static::$_statisticsFile, "PID Worker CID Trans Protocol ipv4 ipv6 Recv-Q Send-Q Bytes-R Bytes-W Status Local Address Foreign Address\n", FILE_APPEND); chmod(static::$_statisticsFile, 0722); foreach (static::getAllWorkerPids() as $worker_pid) { posix_kill($worker_pid, SIGIO); } return; } // For child processes. $bytes_format = function($bytes) { if($bytes > 1024*1024*1024*1024) { return round($bytes/(1024*1024*1024*1024), 1)."TB"; } if($bytes > 1024*1024*1024) { return round($bytes/(1024*1024*1024), 1)."GB"; } if($bytes > 1024*1024) { return round($bytes/(1024*1024), 1)."MB"; } if($bytes > 1024) { return round($bytes/(1024), 1)."KB"; } return $bytes."B"; }; $pid = posix_getpid(); $str = ''; reset(static::$_workers); $current_worker = current(static::$_workers); $default_worker_name = $current_worker->name; /** @var \Workerman\Worker $worker */ foreach(TcpConnection::$connections as $connection) { /** @var \Workerman\Connection\TcpConnection $connection */ $transport = $connection->transport; $ipv4 = $connection->isIpV4() ? ' 1' : ' 0'; $ipv6 = $connection->isIpV6() ? ' 1' : ' 0'; $recv_q = $bytes_format($connection->getRecvBufferQueueSize()); $send_q = $bytes_format($connection->getSendBufferQueueSize()); $local_address = trim($connection->getLocalAddress()); $remote_address = trim($connection->getRemoteAddress()); $state = $connection->getStatus(false); $bytes_read = $bytes_format($connection->bytesRead); $bytes_written = $bytes_format($connection->bytesWritten); $id = $connection->id; $protocol = $connection->protocol ? $connection->protocol : $connection->transport; $pos = strrpos($protocol, '\\'); if ($pos) { $protocol = substr($protocol, $pos+1); } if (strlen($protocol) > 15) { $protocol = substr($protocol, 0, 13) . '..'; } $worker_name = isset($connection->worker) ? $connection->worker->name : $default_worker_name; if (strlen($worker_name) > 14) { $worker_name = substr($worker_name, 0, 12) . '..'; } $str .= str_pad($pid, 9) . str_pad($worker_name, 16) . str_pad($id, 10) . str_pad($transport, 8) . str_pad($protocol, 16) . str_pad($ipv4, 7) . str_pad($ipv6, 7) . str_pad($recv_q, 13) . str_pad($send_q, 13) . str_pad($bytes_read, 13) . str_pad($bytes_written, 13) . ' ' . str_pad($state, 14) . ' ' . str_pad($local_address, 22) . ' ' . str_pad($remote_address, 22) ."\n"; } if ($str) { file_put_contents(static::$_statisticsFile, $str, FILE_APPEND); } }
[ "protected", "static", "function", "writeConnectionsStatisticsToStatusFile", "(", ")", "{", "// For master process.", "if", "(", "static", "::", "$", "_masterPid", "===", "posix_getpid", "(", ")", ")", "{", "file_put_contents", "(", "static", "::", "$", "_statistics...
Write statistics data to disk. @return void
[ "Write", "statistics", "data", "to", "disk", "." ]
13649907f05014fcfffcfccaef01e63ad3339351
https://github.com/walkor/Workerman/blob/13649907f05014fcfffcfccaef01e63ad3339351/Worker.php#L1930-L2001
train
Writes the statistics to the status file
[ 30522, 5123, 10763, 3853, 4339, 8663, 2638, 22014, 9153, 16774, 6558, 13122, 29336, 2271, 8873, 2571, 1006, 1007, 1063, 1013, 1013, 2005, 3040, 2832, 1012, 2065, 1006, 10763, 1024, 1024, 1002, 1035, 3040, 23267, 1027, 1027, 1027, 13433, 533...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Semantic/Client.php
Client.query
public function query(string $keyword, string $categories, array $optional = []) { $params = [ 'query' => $keyword, 'category' => $categories, 'appid' => $this->app['config']['app_id'], ]; return $this->httpPostJson('semantic/semproxy/search', array_merge($params, $optional)); }
php
public function query(string $keyword, string $categories, array $optional = []) { $params = [ 'query' => $keyword, 'category' => $categories, 'appid' => $this->app['config']['app_id'], ]; return $this->httpPostJson('semantic/semproxy/search', array_merge($params, $optional)); }
[ "public", "function", "query", "(", "string", "$", "keyword", ",", "string", "$", "categories", ",", "array", "$", "optional", "=", "[", "]", ")", "{", "$", "params", "=", "[", "'query'", "=>", "$", "keyword", ",", "'category'", "=>", "$", "categories"...
Get the semantic content of giving string. @param string $keyword @param string $categories @param array $optional @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string
[ "Get", "the", "semantic", "content", "of", "giving", "string", "." ]
120c72faaa93c270365bc75c73c362d5fd583209
https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/OfficialAccount/Semantic/Client.php#L32-L41
train
Search for words in the semantic proxy.
[ 30522, 2270, 3853, 23032, 1006, 5164, 1002, 3145, 18351, 1010, 5164, 1002, 7236, 1010, 9140, 1002, 11887, 1027, 1031, 1033, 1007, 1063, 1002, 11498, 5244, 1027, 1031, 1005, 23032, 1005, 1027, 1028, 1002, 3145, 18351, 1010, 1005, 4696, 1005,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Cache/Backend/Xcache.php
Zend_Cache_Backend_Xcache.save
public function save($data, $id, $tags = array(), $specificLifetime = false) { $lifetime = $this->getLifetime($specificLifetime); $result = xcache_set($id, array($data, time()), $lifetime); if (count($tags) > 0) { $this->_log(self::TAGS_UNSUPPORTED_BY_SAVE_OF_XCACHE_BACKEND); } return $result; }
php
public function save($data, $id, $tags = array(), $specificLifetime = false) { $lifetime = $this->getLifetime($specificLifetime); $result = xcache_set($id, array($data, time()), $lifetime); if (count($tags) > 0) { $this->_log(self::TAGS_UNSUPPORTED_BY_SAVE_OF_XCACHE_BACKEND); } return $result; }
[ "public", "function", "save", "(", "$", "data", ",", "$", "id", ",", "$", "tags", "=", "array", "(", ")", ",", "$", "specificLifetime", "=", "false", ")", "{", "$", "lifetime", "=", "$", "this", "->", "getLifetime", "(", "$", "specificLifetime", ")",...
Save some string datas into a cache record Note : $data is always "string" (serialization is done by the core not by the backend) @param string $data datas to cache @param string $id cache id @param array $tags array of strings, the cache record will be tagged by each string entry @param int $specificLifetime if != false, set a specific lifetime for this cache record (null => infinite lifetime) @return boolean true if no problem
[ "Save", "some", "string", "datas", "into", "a", "cache", "record" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Cache/Backend/Xcache.php#L131-L139
train
Save data into XCache
[ 30522, 2270, 3853, 30524, 1027, 6270, 1007, 1063, 1002, 6480, 1027, 1002, 2023, 1011, 1028, 2131, 15509, 7292, 1006, 1002, 3563, 15509, 7292, 1007, 1025, 1002, 2765, 1027, 1060, 3540, 5403, 1035, 2275, 1006, 1002, 8909, 1010, 9140, 1006, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
octobercms/october
modules/backend/classes/NavigationManager.php
NavigationManager.getActiveMainMenuItem
public function getActiveMainMenuItem() { foreach ($this->listMainMenuItems() as $item) { if ($this->isMainMenuItemActive($item)) { return $item; } } return null; }
php
public function getActiveMainMenuItem() { foreach ($this->listMainMenuItems() as $item) { if ($this->isMainMenuItemActive($item)) { return $item; } } return null; }
[ "public", "function", "getActiveMainMenuItem", "(", ")", "{", "foreach", "(", "$", "this", "->", "listMainMenuItems", "(", ")", "as", "$", "item", ")", "{", "if", "(", "$", "this", "->", "isMainMenuItemActive", "(", "$", "item", ")", ")", "{", "return", ...
Returns the currently active main menu item @param mixed $item Returns the item object or null.
[ "Returns", "the", "currently", "active", "main", "menu", "item" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/classes/NavigationManager.php#L419-L428
train
Returns the active main menu item
[ 30522, 2270, 3853, 2131, 19620, 24238, 3549, 14663, 6633, 1006, 1007, 1063, 18921, 6776, 1006, 1002, 2023, 1011, 1028, 2862, 24238, 3549, 14663, 6633, 2015, 1006, 1007, 2004, 1002, 8875, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 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...
apache/thrift
lib/php/lib/Protocol/TProtocolDecorator.php
TProtocolDecorator.writeMessageBegin
public function writeMessageBegin($name, $type, $seqid) { return $this->concreteProtocol_->writeMessageBegin($name, $type, $seqid); }
php
public function writeMessageBegin($name, $type, $seqid) { return $this->concreteProtocol_->writeMessageBegin($name, $type, $seqid); }
[ "public", "function", "writeMessageBegin", "(", "$", "name", ",", "$", "type", ",", "$", "seqid", ")", "{", "return", "$", "this", "->", "concreteProtocol_", "->", "writeMessageBegin", "(", "$", "name", ",", "$", "type", ",", "$", "seqid", ")", ";", "}...
Writes the message header. @param string $name Function name @param int $type message type TMessageType::CALL or TMessageType::REPLY @param int $seqid The sequence id of this message
[ "Writes", "the", "message", "header", "." ]
acdd4226c210336e9e15eb812e5932a645fcd5ce
https://github.com/apache/thrift/blob/acdd4226c210336e9e15eb812e5932a645fcd5ce/lib/php/lib/Protocol/TProtocolDecorator.php#L64-L67
train
Write message begin
[ 30522, 2270, 3853, 4339, 7834, 3736, 3351, 4783, 11528, 1006, 1002, 2171, 1010, 1002, 2828, 1010, 1002, 7367, 14702, 2094, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 5509, 21572, 3406, 25778, 1035, 1011, 1028, 4339, 7834, 3736, 3351, 4783, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/FormTabs.php
FormTabs.evalConfig
protected function evalConfig($config) { if (array_key_exists('defaultTab', $config)) { $this->defaultTab = $config['defaultTab']; } if (array_key_exists('icons', $config)) { $this->icons = $config['icons']; } if (array_key_exists('stretch', $config)) { $this->stretch = $config['stretch']; } if (array_key_exists('suppressTabs', $config)) { $this->suppressTabs = $config['suppressTabs']; } if (array_key_exists('cssClass', $config)) { $this->cssClass = $config['cssClass']; } if (array_key_exists('paneCssClass', $config)) { $this->paneCssClass = $config['paneCssClass']; } }
php
protected function evalConfig($config) { if (array_key_exists('defaultTab', $config)) { $this->defaultTab = $config['defaultTab']; } if (array_key_exists('icons', $config)) { $this->icons = $config['icons']; } if (array_key_exists('stretch', $config)) { $this->stretch = $config['stretch']; } if (array_key_exists('suppressTabs', $config)) { $this->suppressTabs = $config['suppressTabs']; } if (array_key_exists('cssClass', $config)) { $this->cssClass = $config['cssClass']; } if (array_key_exists('paneCssClass', $config)) { $this->paneCssClass = $config['paneCssClass']; } }
[ "protected", "function", "evalConfig", "(", "$", "config", ")", "{", "if", "(", "array_key_exists", "(", "'defaultTab'", ",", "$", "config", ")", ")", "{", "$", "this", "->", "defaultTab", "=", "$", "config", "[", "'defaultTab'", "]", ";", "}", "if", "...
Process options and apply them to this object. @param array $config @return array
[ "Process", "options", "and", "apply", "them", "to", "this", "object", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/classes/FormTabs.php#L84-L109
train
Evaluate the config array
[ 30522, 5123, 3853, 9345, 22499, 2078, 8873, 2290, 1006, 30524, 1002, 9530, 8873, 2290, 1031, 1005, 12398, 2696, 2497, 1005, 1033, 1025, 1065, 2065, 1006, 9140, 1035, 3145, 1035, 6526, 1006, 1005, 18407, 1005, 1010, 1002, 9530, 8873, 2290, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Form/Extension/Core/Type/LocaleType.php
LocaleType.loadValuesForChoices
public function loadValuesForChoices(array $choices, $value = null) { @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use the "choice_loader" option instead.', __METHOD__), E_USER_DEPRECATED); // Optimize $choices = array_filter($choices); if (empty($choices)) { return []; } // If no callable is set, choices are the same as values if (null === $value) { return $choices; } return $this->loadChoiceList($value)->getValuesForChoices($choices); }
php
public function loadValuesForChoices(array $choices, $value = null) { @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use the "choice_loader" option instead.', __METHOD__), E_USER_DEPRECATED); // Optimize $choices = array_filter($choices); if (empty($choices)) { return []; } // If no callable is set, choices are the same as values if (null === $value) { return $choices; } return $this->loadChoiceList($value)->getValuesForChoices($choices); }
[ "public", "function", "loadValuesForChoices", "(", "array", "$", "choices", ",", "$", "value", "=", "null", ")", "{", "@", "trigger_error", "(", "sprintf", "(", "'The \"%s()\" method is deprecated since Symfony 4.1, use the \"choice_loader\" option instead.'", ",", "__METHO...
{@inheritdoc} @deprecated since Symfony 4.1
[ "{", "@inheritdoc", "}" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/Extension/Core/Type/LocaleType.php#L112-L128
train
Loads the values for the choices.
[ 30522, 2270, 3853, 7170, 10175, 15808, 29278, 9905, 23522, 1006, 9140, 1002, 9804, 1010, 1002, 3643, 1027, 19701, 1007, 1063, 1030, 9495, 1035, 7561, 1006, 9043, 2546, 1006, 1005, 1996, 1000, 1003, 1055, 1006, 1007, 1000, 4118, 2003, 2139, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Eloquent/Model.php
Model.fresh
public function fresh($with = []) { if (! $this->exists) { return; } return static::newQueryWithoutScopes() ->with(is_string($with) ? func_get_args() : $with) ->where($this->getKeyName(), $this->getKey()) ->first(); }
php
public function fresh($with = []) { if (! $this->exists) { return; } return static::newQueryWithoutScopes() ->with(is_string($with) ? func_get_args() : $with) ->where($this->getKeyName(), $this->getKey()) ->first(); }
[ "public", "function", "fresh", "(", "$", "with", "=", "[", "]", ")", "{", "if", "(", "!", "$", "this", "->", "exists", ")", "{", "return", ";", "}", "return", "static", "::", "newQueryWithoutScopes", "(", ")", "->", "with", "(", "is_string", "(", "...
Reload a fresh model instance from the database. @param array|string $with @return static|null
[ "Reload", "a", "fresh", "model", "instance", "from", "the", "database", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Model.php#L1122-L1132
train
Get fresh instance of the model
[ 30522, 2270, 3853, 4840, 1006, 1002, 2007, 1027, 1031, 1033, 1007, 1063, 2065, 1006, 999, 1002, 2023, 1011, 1028, 6526, 1007, 1063, 2709, 1025, 1065, 2709, 10763, 1024, 1024, 2047, 4226, 2854, 24415, 12166, 16186, 2015, 1006, 1007, 1011, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Schema/Builder.php
Builder.hasTable
public function hasTable($table) { $table = $this->connection->getTablePrefix().$table; return count($this->connection->selectFromWriteConnection( $this->grammar->compileTableExists(), [$table] )) > 0; }
php
public function hasTable($table) { $table = $this->connection->getTablePrefix().$table; return count($this->connection->selectFromWriteConnection( $this->grammar->compileTableExists(), [$table] )) > 0; }
[ "public", "function", "hasTable", "(", "$", "table", ")", "{", "$", "table", "=", "$", "this", "->", "connection", "->", "getTablePrefix", "(", ")", ".", "$", "table", ";", "return", "count", "(", "$", "this", "->", "connection", "->", "selectFromWriteCo...
Determine if the given table exists. @param string $table @return bool
[ "Determine", "if", "the", "given", "table", "exists", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Schema/Builder.php#L70-L77
train
Checks if a table exists in the current connection
[ 30522, 2270, 3853, 2038, 10880, 1006, 1002, 2795, 1007, 1063, 1002, 2795, 1027, 1002, 2023, 1011, 1028, 4434, 1011, 1028, 2131, 10880, 28139, 8873, 2595, 1006, 1007, 1012, 1002, 2795, 1025, 2709, 4175, 1006, 1002, 2023, 1011, 1028, 4434, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Workflow/DefinitionBuilder.php
DefinitionBuilder.clear
public function clear() { $this->places = []; $this->transitions = []; $this->initialPlace = null; $this->metadataStore = null; return $this; }
php
public function clear() { $this->places = []; $this->transitions = []; $this->initialPlace = null; $this->metadataStore = null; return $this; }
[ "public", "function", "clear", "(", ")", "{", "$", "this", "->", "places", "=", "[", "]", ";", "$", "this", "->", "transitions", "=", "[", "]", ";", "$", "this", "->", "initialPlace", "=", "null", ";", "$", "this", "->", "metadataStore", "=", "null...
Clear all data in the builder. @return $this
[ "Clear", "all", "data", "in", "the", "builder", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Workflow/DefinitionBuilder.php#L53-L61
train
Clear all the places transitions initialPlace and metadataStore
[ 30522, 2270, 3853, 3154, 1006, 1007, 1063, 1002, 2023, 1011, 1028, 3182, 1027, 1031, 1033, 1025, 1002, 2023, 1011, 1028, 30524, 2023, 1011, 1028, 27425, 23809, 2063, 1027, 19701, 1025, 2709, 1002, 2023, 1025, 1065, 102, 0, 0, 0, 0, 0, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Doctrine/Form/ChoiceList/DoctrineChoiceLoader.php
DoctrineChoiceLoader.loadChoiceList
public function loadChoiceList($value = null) { if ($this->choiceList) { return $this->choiceList; } $objects = $this->objectLoader ? $this->objectLoader->getEntities() : $this->manager->getRepository($this->class)->findAll(); return $this->choiceList = new ArrayChoiceList($objects, $value); }
php
public function loadChoiceList($value = null) { if ($this->choiceList) { return $this->choiceList; } $objects = $this->objectLoader ? $this->objectLoader->getEntities() : $this->manager->getRepository($this->class)->findAll(); return $this->choiceList = new ArrayChoiceList($objects, $value); }
[ "public", "function", "loadChoiceList", "(", "$", "value", "=", "null", ")", "{", "if", "(", "$", "this", "->", "choiceList", ")", "{", "return", "$", "this", "->", "choiceList", ";", "}", "$", "objects", "=", "$", "this", "->", "objectLoader", "?", ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Bridge/Doctrine/Form/ChoiceList/DoctrineChoiceLoader.php#L78-L89
train
Load Choice List
[ 30522, 2270, 3853, 7170, 9905, 6610, 9863, 1006, 1002, 3643, 1027, 19701, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 3601, 9863, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 3601, 9863, 1025, 1065, 1002, 5200, 1027, 1002, 2023, 1011, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/HttpKernel/HttpKernel.php
HttpKernel.filterResponse
private function filterResponse(Response $response, Request $request, int $type) { $event = new ResponseEvent($this, $request, $type, $response); $this->dispatcher->dispatch($event, KernelEvents::RESPONSE); $this->finishRequest($request, $type); return $event->getResponse(); }
php
private function filterResponse(Response $response, Request $request, int $type) { $event = new ResponseEvent($this, $request, $type, $response); $this->dispatcher->dispatch($event, KernelEvents::RESPONSE); $this->finishRequest($request, $type); return $event->getResponse(); }
[ "private", "function", "filterResponse", "(", "Response", "$", "response", ",", "Request", "$", "request", ",", "int", "$", "type", ")", "{", "$", "event", "=", "new", "ResponseEvent", "(", "$", "this", ",", "$", "request", ",", "$", "type", ",", "$", ...
Filters a response object. @param Response $response A Response instance @param Request $request An error message in case the response is not a Response object @param int $type The type of the request (one of HttpKernelInterface::MASTER_REQUEST or HttpKernelInterface::SUB_REQUEST) @return Response The filtered Response instance @throws \RuntimeException if the passed object is not a Response instance
[ "Filters", "a", "response", "object", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/HttpKernel/HttpKernel.php#L186-L195
train
Filter the response to the correct type
[ 30522, 2797, 3853, 11307, 6072, 26029, 3366, 1006, 3433, 1002, 3433, 1010, 5227, 1002, 5227, 1010, 20014, 1002, 2828, 1007, 1063, 1002, 2724, 1027, 2047, 3433, 18697, 3372, 1006, 1002, 2023, 1010, 1002, 5227, 1010, 1002, 2828, 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...
laravel/framework
src/Illuminate/Database/Schema/Blueprint.php
Blueprint.unique
public function unique($columns, $name = null, $algorithm = null) { return $this->indexCommand('unique', $columns, $name, $algorithm); }
php
public function unique($columns, $name = null, $algorithm = null) { return $this->indexCommand('unique', $columns, $name, $algorithm); }
[ "public", "function", "unique", "(", "$", "columns", ",", "$", "name", "=", "null", ",", "$", "algorithm", "=", "null", ")", "{", "return", "$", "this", "->", "indexCommand", "(", "'unique'", ",", "$", "columns", ",", "$", "name", ",", "$", "algorith...
Specify a unique index for the table. @param string|array $columns @param string $name @param string|null $algorithm @return \Illuminate\Support\Fluent
[ "Specify", "a", "unique", "index", "for", "the", "table", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Schema/Blueprint.php#L488-L491
train
Unique index of columns
[ 30522, 2270, 3853, 4310, 1006, 1002, 7753, 1010, 1002, 2171, 1027, 19701, 1010, 1002, 9896, 1027, 19701, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 5950, 9006, 2386, 2094, 1006, 1005, 4310, 1005, 1010, 1002, 7753, 1010, 1002, 2171, 1010, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/UsersManager/API.php
API.userEmailExists
public function userEmailExists($userEmail) { Piwik::checkUserIsNotAnonymous(); Piwik::checkUserHasSomeViewAccess(); return $this->model->userEmailExists($userEmail); }
php
public function userEmailExists($userEmail) { Piwik::checkUserIsNotAnonymous(); Piwik::checkUserHasSomeViewAccess(); return $this->model->userEmailExists($userEmail); }
[ "public", "function", "userEmailExists", "(", "$", "userEmail", ")", "{", "Piwik", "::", "checkUserIsNotAnonymous", "(", ")", ";", "Piwik", "::", "checkUserHasSomeViewAccess", "(", ")", ";", "return", "$", "this", "->", "model", "->", "userEmailExists", "(", "...
Returns true if user with given email (userEmail) is known in the database, or the Super User @param string $userEmail @return bool true if the user is known
[ "Returns", "true", "if", "user", "with", "given", "email", "(", "userEmail", ")", "is", "known", "in", "the", "database", "or", "the", "Super", "User" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/UsersManager/API.php#L997-L1003
train
Checks if a user email exists in the database
[ 30522, 2270, 3853, 5310, 14545, 9463, 9048, 12837, 1006, 1002, 5310, 14545, 4014, 1007, 1063, 14255, 9148, 2243, 1024, 1024, 4638, 20330, 2483, 17048, 6761, 4890, 30524, 12837, 1006, 1002, 5310, 14545, 4014, 1007, 1025, 1065, 102, 0, 0, 0...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/DataTable/Filter/MetadataCallbackAddMetadata.php
MetadataCallbackAddMetadata.filter
public function filter($table) { if ($this->applyToSummaryRow) { $rows = $table->getRows(); } else { $rows = $table->getRowsWithoutSummaryRow(); } foreach ($rows as $key => $row) { $params = array(); foreach ($this->metadataToRead as $name) { $params[] = $row->getMetadata($name); } $newValue = call_user_func_array($this->functionToApply, $params); if ($newValue !== false) { $row->addMetadata($this->metadataToAdd, $newValue); } } }
php
public function filter($table) { if ($this->applyToSummaryRow) { $rows = $table->getRows(); } else { $rows = $table->getRowsWithoutSummaryRow(); } foreach ($rows as $key => $row) { $params = array(); foreach ($this->metadataToRead as $name) { $params[] = $row->getMetadata($name); } $newValue = call_user_func_array($this->functionToApply, $params); if ($newValue !== false) { $row->addMetadata($this->metadataToAdd, $newValue); } } }
[ "public", "function", "filter", "(", "$", "table", ")", "{", "if", "(", "$", "this", "->", "applyToSummaryRow", ")", "{", "$", "rows", "=", "$", "table", "->", "getRows", "(", ")", ";", "}", "else", "{", "$", "rows", "=", "$", "table", "->", "get...
See {@link MetadataCallbackAddMetadata}. @param DataTable $table
[ "See", "{", "@link", "MetadataCallbackAddMetadata", "}", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/DataTable/Filter/MetadataCallbackAddMetadata.php#L63-L82
train
Filter the table
[ 30522, 2270, 3853, 11307, 1006, 1002, 2795, 1007, 1063, 2065, 1006, 1002, 2023, 1011, 1028, 6611, 13122, 2819, 7849, 12541, 5004, 1007, 1063, 1002, 10281, 1027, 1002, 2795, 1011, 1028, 2131, 10524, 2015, 1006, 1007, 1025, 1065, 2842, 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/Common/Data/Validation.php
Validation.validate
public static function validate($value, array $field) { if (!isset($field['type'])) { $field['type'] = 'text'; } $type = $validate['type'] ?? $field['type']; $validate = (array)($field['validate'] ?? null); $required = $validate['required'] ?? false; // If value isn't required, we will stop validation if empty value is given. if ($required !== true && ($value === null || $value === '' || (($field['type'] === 'checkbox' || $field['type'] === 'switch') && $value == false)) ) { return []; } // Get language class. $language = Grav::instance()['language']; $name = ucfirst($field['label'] ?? $field['name']); $message = (string) isset($field['validate']['message']) ? $language->translate($field['validate']['message']) : $language->translate('GRAV.FORM.INVALID_INPUT', null, true) . ' "' . $language->translate($name) . '"'; // Validate type with fallback type text. $method = 'type' . str_replace('-', '_', $type); // If this is a YAML field validate/filter as such if (isset($field['yaml']) && $field['yaml'] === true) { $method = 'typeYaml'; } $messages = []; $success = method_exists(__CLASS__, $method) ? self::$method($value, $validate, $field) : true; if (!$success) { $messages[$field['name']][] = $message; } // Check individual rules. foreach ($validate as $rule => $params) { $method = 'validate' . ucfirst(str_replace('-', '_', $rule)); if (method_exists(__CLASS__, $method)) { $success = self::$method($value, $params); if (!$success) { $messages[$field['name']][] = $message; } } } return $messages; }
php
public static function validate($value, array $field) { if (!isset($field['type'])) { $field['type'] = 'text'; } $type = $validate['type'] ?? $field['type']; $validate = (array)($field['validate'] ?? null); $required = $validate['required'] ?? false; // If value isn't required, we will stop validation if empty value is given. if ($required !== true && ($value === null || $value === '' || (($field['type'] === 'checkbox' || $field['type'] === 'switch') && $value == false)) ) { return []; } // Get language class. $language = Grav::instance()['language']; $name = ucfirst($field['label'] ?? $field['name']); $message = (string) isset($field['validate']['message']) ? $language->translate($field['validate']['message']) : $language->translate('GRAV.FORM.INVALID_INPUT', null, true) . ' "' . $language->translate($name) . '"'; // Validate type with fallback type text. $method = 'type' . str_replace('-', '_', $type); // If this is a YAML field validate/filter as such if (isset($field['yaml']) && $field['yaml'] === true) { $method = 'typeYaml'; } $messages = []; $success = method_exists(__CLASS__, $method) ? self::$method($value, $validate, $field) : true; if (!$success) { $messages[$field['name']][] = $message; } // Check individual rules. foreach ($validate as $rule => $params) { $method = 'validate' . ucfirst(str_replace('-', '_', $rule)); if (method_exists(__CLASS__, $method)) { $success = self::$method($value, $params); if (!$success) { $messages[$field['name']][] = $message; } } } return $messages; }
[ "public", "static", "function", "validate", "(", "$", "value", ",", "array", "$", "field", ")", "{", "if", "(", "!", "isset", "(", "$", "field", "[", "'type'", "]", ")", ")", "{", "$", "field", "[", "'type'", "]", "=", "'text'", ";", "}", "$", ...
Validate value against a blueprint field definition. @param mixed $value @param array $field @return array
[ "Validate", "value", "against", "a", "blueprint", "field", "definition", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Data/Validation.php#L25-L78
train
Validate a value with the type and optional validation rules.
[ 30522, 2270, 10763, 3853, 9398, 3686, 1006, 1002, 3643, 1010, 9140, 1002, 2492, 1007, 1063, 2065, 1006, 999, 26354, 3388, 1006, 1002, 2492, 1031, 1005, 2828, 1005, 1033, 1007, 1007, 1063, 1002, 2492, 1031, 1005, 2828, 1005, 1033, 1027, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Messenger/Transport/AmqpExt/AmqpTransport.php
AmqpTransport.reject
public function reject(Envelope $envelope): void { ($this->receiver ?? $this->getReceiver())->reject($envelope); }
php
public function reject(Envelope $envelope): void { ($this->receiver ?? $this->getReceiver())->reject($envelope); }
[ "public", "function", "reject", "(", "Envelope", "$", "envelope", ")", ":", "void", "{", "(", "$", "this", "->", "receiver", "??", "$", "this", "->", "getReceiver", "(", ")", ")", "->", "reject", "(", "$", "envelope", ")", ";", "}" ]
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Messenger/Transport/AmqpExt/AmqpTransport.php#L58-L61
train
Rejects an envelope
[ 30522, 2270, 3853, 15454, 1006, 11255, 1002, 11255, 1007, 1024, 11675, 1063, 1006, 1002, 2023, 1011, 1028, 8393, 1029, 1029, 1002, 2023, 1011, 1028, 2131, 2890, 3401, 16402, 1006, 1007, 1007, 1011, 1028, 15454, 1006, 1002, 11255, 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...
apache/thrift
lib/php/lib/Transport/TSocket.php
TSocket.write
public function write($buf) { $null = null; $write = array($this->handle_); // keep writing until all the data has been written while (TStringFuncFactory::create()->strlen($buf) > 0) { // wait for stream to become available for writing $writable = @stream_select( $null, $write, $null, $this->sendTimeoutSec_, $this->sendTimeoutUsec_ ); if ($writable > 0) { // write buffer to stream $written = fwrite($this->handle_, $buf); if ($written === -1 || $written === false) { throw new TTransportException( 'TSocket: Could not write ' . TStringFuncFactory::create()->strlen($buf) . ' bytes ' . $this->host_ . ':' . $this->port_ ); } // determine how much of the buffer is left to write $buf = TStringFuncFactory::create()->substr($buf, $written); } elseif ($writable === 0) { throw new TTransportException( 'TSocket: timed out writing ' . TStringFuncFactory::create()->strlen($buf) . ' bytes from ' . $this->host_ . ':' . $this->port_ ); } else { throw new TTransportException( 'TSocket: Could not write ' . TStringFuncFactory::create()->strlen($buf) . ' bytes ' . $this->host_ . ':' . $this->port_ ); } } }
php
public function write($buf) { $null = null; $write = array($this->handle_); // keep writing until all the data has been written while (TStringFuncFactory::create()->strlen($buf) > 0) { // wait for stream to become available for writing $writable = @stream_select( $null, $write, $null, $this->sendTimeoutSec_, $this->sendTimeoutUsec_ ); if ($writable > 0) { // write buffer to stream $written = fwrite($this->handle_, $buf); if ($written === -1 || $written === false) { throw new TTransportException( 'TSocket: Could not write ' . TStringFuncFactory::create()->strlen($buf) . ' bytes ' . $this->host_ . ':' . $this->port_ ); } // determine how much of the buffer is left to write $buf = TStringFuncFactory::create()->substr($buf, $written); } elseif ($writable === 0) { throw new TTransportException( 'TSocket: timed out writing ' . TStringFuncFactory::create()->strlen($buf) . ' bytes from ' . $this->host_ . ':' . $this->port_ ); } else { throw new TTransportException( 'TSocket: Could not write ' . TStringFuncFactory::create()->strlen($buf) . ' bytes ' . $this->host_ . ':' . $this->port_ ); } } }
[ "public", "function", "write", "(", "$", "buf", ")", "{", "$", "null", "=", "null", ";", "$", "write", "=", "array", "(", "$", "this", "->", "handle_", ")", ";", "// keep writing until all the data has been written", "while", "(", "TStringFuncFactory", "::", ...
Write to the socket. @param string $buf The data to write
[ "Write", "to", "the", "socket", "." ]
acdd4226c210336e9e15eb812e5932a645fcd5ce
https://github.com/apache/thrift/blob/acdd4226c210336e9e15eb812e5932a645fcd5ce/lib/php/lib/Transport/TSocket.php#L313-L351
train
Write to the socket
[ 30522, 2270, 3853, 4339, 1006, 1002, 20934, 2546, 1007, 1063, 1002, 19701, 1027, 19701, 1025, 1002, 4339, 1027, 9140, 1006, 1002, 2023, 1011, 1028, 5047, 1035, 1007, 1025, 1013, 1013, 2562, 3015, 2127, 2035, 1996, 2951, 2038, 2042, 2517, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Templating/PhpEngine.php
PhpEngine.addHelpers
public function addHelpers(array $helpers) { foreach ($helpers as $alias => $helper) { $this->set($helper, \is_int($alias) ? null : $alias); } }
php
public function addHelpers(array $helpers) { foreach ($helpers as $alias => $helper) { $this->set($helper, \is_int($alias) ? null : $alias); } }
[ "public", "function", "addHelpers", "(", "array", "$", "helpers", ")", "{", "foreach", "(", "$", "helpers", "as", "$", "alias", "=>", "$", "helper", ")", "{", "$", "this", "->", "set", "(", "$", "helper", ",", "\\", "is_int", "(", "$", "alias", ")"...
Adds some helpers. @param HelperInterface[] $helpers An array of helper
[ "Adds", "some", "helpers", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Templating/PhpEngine.php#L224-L229
train
Adds the helpers to the current context
[ 30522, 2270, 3853, 5587, 16001, 7347, 1006, 9140, 1002, 2393, 2545, 1007, 1063, 18921, 6776, 1006, 1002, 2393, 2545, 2004, 1002, 14593, 1027, 1028, 1002, 2393, 2121, 1007, 1063, 1002, 2023, 1011, 1028, 2275, 1006, 1002, 2393, 2121, 1010, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/SitesManager/SitesManager.php
SitesManager.getTrackerExcludedIps
private function getTrackerExcludedIps($website) { $excludedIps = $website['excluded_ips']; $globalExcludedIps = API::getInstance()->getExcludedIpsGlobal(); $excludedIps .= ',' . $globalExcludedIps; $ipRanges = array(); foreach (explode(',', $excludedIps) as $ip) { $ipRange = API::getInstance()->getIpsForRange($ip); if ($ipRange !== false) { $ipRanges[] = $ipRange; } } return $ipRanges; }
php
private function getTrackerExcludedIps($website) { $excludedIps = $website['excluded_ips']; $globalExcludedIps = API::getInstance()->getExcludedIpsGlobal(); $excludedIps .= ',' . $globalExcludedIps; $ipRanges = array(); foreach (explode(',', $excludedIps) as $ip) { $ipRange = API::getInstance()->getIpsForRange($ip); if ($ipRange !== false) { $ipRanges[] = $ipRange; } } return $ipRanges; }
[ "private", "function", "getTrackerExcludedIps", "(", "$", "website", ")", "{", "$", "excludedIps", "=", "$", "website", "[", "'excluded_ips'", "]", ";", "$", "globalExcludedIps", "=", "API", "::", "getInstance", "(", ")", "->", "getExcludedIpsGlobal", "(", ")"...
Returns the array of excluded IPs to save in the config file @param array $website @return array
[ "Returns", "the", "array", "of", "excluded", "IPs", "to", "save", "in", "the", "config", "file" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/SitesManager/SitesManager.php#L233-L248
train
Get excluded IPs from website
[ 30522, 2797, 3853, 2131, 6494, 9102, 10288, 20464, 13936, 11514, 2015, 1006, 1002, 4037, 1007, 1063, 1002, 12421, 11514, 2015, 1027, 1002, 4037, 1031, 1005, 12421, 1035, 12997, 2015, 1005, 1033, 1025, 1002, 3795, 10288, 20464, 13936, 11514, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/ShakeAround/DeviceClient.php
DeviceClient.list
public function list(int $lastId, int $count) { $params = [ 'type' => 2, 'last_seen' => $lastId, 'count' => $count, ]; return $this->search($params); }
php
public function list(int $lastId, int $count) { $params = [ 'type' => 2, 'last_seen' => $lastId, 'count' => $count, ]; return $this->search($params); }
[ "public", "function", "list", "(", "int", "$", "lastId", ",", "int", "$", "count", ")", "{", "$", "params", "=", "[", "'type'", "=>", "2", ",", "'last_seen'", "=>", "$", "lastId", ",", "'count'", "=>", "$", "count", ",", "]", ";", "return", "$", ...
Pagination to get batch of devices. @param int $lastId @param int $count @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string
[ "Pagination", "to", "get", "batch", "of", "devices", "." ]
120c72faaa93c270365bc75c73c362d5fd583209
https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/OfficialAccount/ShakeAround/DeviceClient.php#L132-L141
train
List all terms
[ 30522, 2270, 3853, 2862, 1006, 20014, 1002, 2197, 3593, 1010, 20014, 1002, 4175, 1007, 1063, 1002, 11498, 5244, 1027, 1031, 1005, 2828, 1005, 1027, 1028, 1016, 1010, 1005, 2197, 1035, 2464, 1005, 1027, 1028, 1002, 2197, 3593, 1010, 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/Translation/MessageCatalogue.php
MessageCatalogue.all
public function all($domain = null) { if (null !== $domain) { return ($this->messages[$domain.self::INTL_DOMAIN_SUFFIX] ?? []) + ($this->messages[$domain] ?? []); } $allMessages = []; $suffixLength = \strlen(self::INTL_DOMAIN_SUFFIX); foreach ($this->messages as $domain => $messages) { if (\strlen($domain) > $suffixLength && false !== $i = strpos($domain, self::INTL_DOMAIN_SUFFIX, -$suffixLength)) { $domain = substr($domain, 0, $i); $allMessages[$domain] = $messages + ($allMessages[$domain] ?? []); } else { $allMessages[$domain] = ($allMessages[$domain] ?? []) + $messages; } } return $allMessages; }
php
public function all($domain = null) { if (null !== $domain) { return ($this->messages[$domain.self::INTL_DOMAIN_SUFFIX] ?? []) + ($this->messages[$domain] ?? []); } $allMessages = []; $suffixLength = \strlen(self::INTL_DOMAIN_SUFFIX); foreach ($this->messages as $domain => $messages) { if (\strlen($domain) > $suffixLength && false !== $i = strpos($domain, self::INTL_DOMAIN_SUFFIX, -$suffixLength)) { $domain = substr($domain, 0, $i); $allMessages[$domain] = $messages + ($allMessages[$domain] ?? []); } else { $allMessages[$domain] = ($allMessages[$domain] ?? []) + $messages; } } return $allMessages; }
[ "public", "function", "all", "(", "$", "domain", "=", "null", ")", "{", "if", "(", "null", "!==", "$", "domain", ")", "{", "return", "(", "$", "this", "->", "messages", "[", "$", "domain", ".", "self", "::", "INTL_DOMAIN_SUFFIX", "]", "??", "[", "]...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Translation/MessageCatalogue.php#L68-L87
train
Get all messages from all domains
[ 30522, 2270, 3853, 2035, 1006, 1002, 5884, 1027, 19701, 1007, 1063, 2065, 1006, 19701, 999, 1027, 1027, 1002, 5884, 1007, 1063, 2709, 1006, 1002, 2023, 1011, 1028, 7696, 1031, 1002, 5884, 1012, 2969, 1024, 1024, 20014, 2140, 1035, 5884, 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/Simple/ChainCache.php
ChainCache.clear
public function clear() { $cleared = true; $i = $this->cacheCount; while ($i--) { $cleared = $this->caches[$i]->clear() && $cleared; } return $cleared; }
php
public function clear() { $cleared = true; $i = $this->cacheCount; while ($i--) { $cleared = $this->caches[$i]->clear() && $cleared; } return $cleared; }
[ "public", "function", "clear", "(", ")", "{", "$", "cleared", "=", "true", ";", "$", "i", "=", "$", "this", "->", "cacheCount", ";", "while", "(", "$", "i", "--", ")", "{", "$", "cleared", "=", "$", "this", "->", "caches", "[", "$", "i", "]", ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Cache/Simple/ChainCache.php#L141-L151
train
Clear all cache entries
[ 30522, 2270, 3853, 3154, 1006, 1007, 1063, 1002, 5985, 1027, 2995, 1025, 1002, 1045, 1027, 1002, 2023, 1011, 1028, 17053, 3597, 16671, 1025, 2096, 1006, 1002, 1045, 1011, 1011, 1007, 1063, 1002, 5985, 1027, 1002, 2023, 1011, 1028, 17053, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/PrivacyManager/PrivacyManager.php
PrivacyManager.deleteReportData
public function deleteReportData() { $settings = self::getPurgeDataSettings(); // Make sure, data deletion is enabled if ($settings['delete_reports_enable'] == 0) { return false; } // make sure purging should run at this time (unless this is a forced purge) if (!$this->shouldPurgeData($settings, self::OPTION_LAST_DELETE_PIWIK_REPORTS, 'delete_logs_schedule_lowest_interval')) { return false; } // set last run time Option::set(self::OPTION_LAST_DELETE_PIWIK_REPORTS, Date::factory('today')->getTimestamp()); ReportsPurger::make($settings, self::getAllMetricsToKeep())->purgeData(); return true; }
php
public function deleteReportData() { $settings = self::getPurgeDataSettings(); // Make sure, data deletion is enabled if ($settings['delete_reports_enable'] == 0) { return false; } // make sure purging should run at this time (unless this is a forced purge) if (!$this->shouldPurgeData($settings, self::OPTION_LAST_DELETE_PIWIK_REPORTS, 'delete_logs_schedule_lowest_interval')) { return false; } // set last run time Option::set(self::OPTION_LAST_DELETE_PIWIK_REPORTS, Date::factory('today')->getTimestamp()); ReportsPurger::make($settings, self::getAllMetricsToKeep())->purgeData(); return true; }
[ "public", "function", "deleteReportData", "(", ")", "{", "$", "settings", "=", "self", "::", "getPurgeDataSettings", "(", ")", ";", "// Make sure, data deletion is enabled", "if", "(", "$", "settings", "[", "'delete_reports_enable'", "]", "==", "0", ")", "{", "r...
Deletes old archived data (reports & metrics). Archive tables are not optimized after, as that is handled by a separate scheduled task in CoreAdminHome. This is a scheduled task and will only execute every N days. The number of days is determined by the delete_logs_schedule_lowest_interval config option. If delete_reports_enable is set to 1, old archive data is deleted. The following config options can tweak this behavior: - delete_reports_older_than: The number of months after which archive data is considered old. The current month is not considered when applying this value. - delete_reports_keep_basic_metrics: If set to 1, keeps certain metric data. Right now, all metric data is kept. - delete_reports_keep_day_reports: If set to 1, keeps old daily reports. - delete_reports_keep_week_reports: If set to 1, keeps old weekly reports. - delete_reports_keep_month_reports: If set to 1, keeps old monthly reports. - delete_reports_keep_year_reports: If set to 1, keeps old yearly reports.
[ "Deletes", "old", "archived", "data", "(", "reports", "&", "metrics", ")", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/PrivacyManager/PrivacyManager.php#L342-L361
train
Delete report data
[ 30522, 2270, 3853, 3972, 15141, 13699, 11589, 2850, 2696, 1006, 1007, 1063, 1002, 10906, 1027, 2969, 1024, 1024, 2131, 5311, 5999, 6790, 21678, 8613, 1006, 1007, 1025, 1013, 1013, 2191, 2469, 1010, 2951, 3972, 20624, 2239, 2003, 9124, 2065,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Schema/Grammars/MySqlGrammar.php
MySqlGrammar.modifyAfter
protected function modifyAfter(Blueprint $blueprint, Fluent $column) { if (! is_null($column->after)) { return ' after '.$this->wrap($column->after); } }
php
protected function modifyAfter(Blueprint $blueprint, Fluent $column) { if (! is_null($column->after)) { return ' after '.$this->wrap($column->after); } }
[ "protected", "function", "modifyAfter", "(", "Blueprint", "$", "blueprint", ",", "Fluent", "$", "column", ")", "{", "if", "(", "!", "is_null", "(", "$", "column", "->", "after", ")", ")", "{", "return", "' after '", ".", "$", "this", "->", "wrap", "(",...
Get the SQL for an "after" column modifier. @param \Illuminate\Database\Schema\Blueprint $blueprint @param \Illuminate\Support\Fluent $column @return string|null
[ "Get", "the", "SQL", "for", "an", "after", "column", "modifier", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Schema/Grammars/MySqlGrammar.php#L996-L1001
train
Protected modifyAfter method
[ 30522, 5123, 3853, 19933, 10354, 3334, 1006, 2630, 16550, 1002, 2630, 16550, 1010, 19376, 1002, 5930, 1007, 1063, 2065, 1006, 999, 2003, 1035, 19701, 1006, 1002, 5930, 1011, 1028, 2044, 1007, 1007, 1063, 2709, 1005, 2044, 1005, 1012, 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/Traits/CapsuleManagerTrait.php
CapsuleManagerTrait.setupContainer
protected function setupContainer(Container $container) { $this->container = $container; if (! $this->container->bound('config')) { $this->container->instance('config', new Fluent); } }
php
protected function setupContainer(Container $container) { $this->container = $container; if (! $this->container->bound('config')) { $this->container->instance('config', new Fluent); } }
[ "protected", "function", "setupContainer", "(", "Container", "$", "container", ")", "{", "$", "this", "->", "container", "=", "$", "container", ";", "if", "(", "!", "$", "this", "->", "container", "->", "bound", "(", "'config'", ")", ")", "{", "$", "th...
Setup the IoC container instance. @param \Illuminate\Contracts\Container\Container $container @return void
[ "Setup", "the", "IoC", "container", "instance", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Support/Traits/CapsuleManagerTrait.php#L30-L37
train
Setup the container
[ 30522, 5123, 3853, 16437, 8663, 18249, 2121, 1006, 11661, 1002, 11661, 1007, 1063, 1002, 2023, 1011, 1028, 11661, 1027, 1002, 11661, 1025, 2065, 1006, 999, 1002, 2023, 1011, 1028, 30524, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Db/Select.php
Zend_Db_Select.joinCross
public function joinCross($name, $cols = self::SQL_WILDCARD, $schema = null) { return $this->_join(self::CROSS_JOIN, $name, null, $cols, $schema); }
php
public function joinCross($name, $cols = self::SQL_WILDCARD, $schema = null) { return $this->_join(self::CROSS_JOIN, $name, null, $cols, $schema); }
[ "public", "function", "joinCross", "(", "$", "name", ",", "$", "cols", "=", "self", "::", "SQL_WILDCARD", ",", "$", "schema", "=", "null", ")", "{", "return", "$", "this", "->", "_join", "(", "self", "::", "CROSS_JOIN", ",", "$", "name", ",", "null",...
Add a CROSS JOIN table and colums to the query. A cross join is a cartesian product; there is no join condition. The $name and $cols parameters follow the same logic as described in the from() method. @param array|string|Zend_Db_Expr $name The table name. @param array|string $cols The columns to select from the joined table. @param string $schema The database name to specify, if any. @return Zend_Db_Select This Zend_Db_Select object.
[ "Add", "a", "CROSS", "JOIN", "table", "and", "colums", "to", "the", "query", ".", "A", "cross", "join", "is", "a", "cartesian", "product", ";", "there", "is", "no", "join", "condition", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Select.php#L416-L419
train
Join cross table
[ 30522, 2270, 3853, 3693, 16458, 1006, 1002, 2171, 1010, 1002, 8902, 2015, 1027, 2969, 1024, 1024, 29296, 1035, 3748, 11522, 1010, 1002, 8040, 28433, 1027, 19701, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 1035, 3693, 1006, 2969, 1024, 1024, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Cache/Repository.php
Repository.rememberForever
public function rememberForever($key, Closure $callback) { $value = $this->get($key); // If the item exists in the cache we will just return this immediately // and if not we will execute the given Closure and cache the result // of that forever so it is available for all subsequent requests. if (! is_null($value)) { return $value; } $this->forever($key, $value = $callback()); return $value; }
php
public function rememberForever($key, Closure $callback) { $value = $this->get($key); // If the item exists in the cache we will just return this immediately // and if not we will execute the given Closure and cache the result // of that forever so it is available for all subsequent requests. if (! is_null($value)) { return $value; } $this->forever($key, $value = $callback()); return $value; }
[ "public", "function", "rememberForever", "(", "$", "key", ",", "Closure", "$", "callback", ")", "{", "$", "value", "=", "$", "this", "->", "get", "(", "$", "key", ")", ";", "// If the item exists in the cache we will just return this immediately", "// and if not we ...
Get an item from the cache, or execute the given Closure and store the result forever. @param string $key @param \Closure $callback @return mixed
[ "Get", "an", "item", "from", "the", "cache", "or", "execute", "the", "given", "Closure", "and", "store", "the", "result", "forever", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Cache/Repository.php#L411-L425
train
Remember the value of the given key in the cache for a given Closure and return it.
[ 30522, 2270, 3853, 30524, 1013, 2065, 1996, 8875, 6526, 1999, 1996, 17053, 2057, 2097, 2074, 2709, 2023, 3202, 1013, 1013, 1998, 2065, 2025, 2057, 2097, 15389, 1996, 2445, 8503, 1998, 17053, 1996, 2765, 1013, 1013, 1997, 2008, 5091, 2061, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/FormFactory.php
FormFactory.createNamedBuilder
public function createNamedBuilder($name, $type = 'Symfony\Component\Form\Extension\Core\Type\FormType', $data = null, array $options = []) { if (null !== $data && !\array_key_exists('data', $options)) { $options['data'] = $data; } if (!\is_string($type)) { throw new UnexpectedTypeException($type, 'string'); } $type = $this->registry->getType($type); $builder = $type->createBuilder($this, $name, $options); // Explicitly call buildForm() in order to be able to override either // createBuilder() or buildForm() in the resolved form type $type->buildForm($builder, $builder->getOptions()); return $builder; }
php
public function createNamedBuilder($name, $type = 'Symfony\Component\Form\Extension\Core\Type\FormType', $data = null, array $options = []) { if (null !== $data && !\array_key_exists('data', $options)) { $options['data'] = $data; } if (!\is_string($type)) { throw new UnexpectedTypeException($type, 'string'); } $type = $this->registry->getType($type); $builder = $type->createBuilder($this, $name, $options); // Explicitly call buildForm() in order to be able to override either // createBuilder() or buildForm() in the resolved form type $type->buildForm($builder, $builder->getOptions()); return $builder; }
[ "public", "function", "createNamedBuilder", "(", "$", "name", ",", "$", "type", "=", "'Symfony\\Component\\Form\\Extension\\Core\\Type\\FormType'", ",", "$", "data", "=", "null", ",", "array", "$", "options", "=", "[", "]", ")", "{", "if", "(", "null", "!==", ...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Form/FormFactory.php#L64-L83
train
Creates a form builder for the given name and type
[ 30522, 2270, 3853, 3443, 18442, 18939, 19231, 4063, 1006, 1002, 2171, 1010, 1002, 2828, 1027, 1005, 25353, 2213, 14876, 4890, 1032, 6922, 1032, 2433, 1032, 5331, 1032, 4563, 1032, 2828, 1032, 2433, 13874, 1005, 1010, 1002, 2951, 1027, 19701...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Loader/QtFileLoader.php
QtFileLoader.load
public function load($resource, $locale, $domain = 'messages') { if (!stream_is_local($resource)) { throw new InvalidResourceException(sprintf('This is not a local file "%s".', $resource)); } if (!file_exists($resource)) { throw new NotFoundResourceException(sprintf('File "%s" not found.', $resource)); } try { $dom = XmlUtils::loadFile($resource); } catch (\InvalidArgumentException $e) { throw new InvalidResourceException(sprintf('Unable to load "%s".', $resource), $e->getCode(), $e); } $internalErrors = libxml_use_internal_errors(true); libxml_clear_errors(); $xpath = new \DOMXPath($dom); $nodes = $xpath->evaluate('//TS/context/name[text()="'.$domain.'"]'); $catalogue = new MessageCatalogue($locale); if (1 == $nodes->length) { $translations = $nodes->item(0)->nextSibling->parentNode->parentNode->getElementsByTagName('message'); foreach ($translations as $translation) { $translationValue = (string) $translation->getElementsByTagName('translation')->item(0)->nodeValue; if (!empty($translationValue)) { $catalogue->set( (string) $translation->getElementsByTagName('source')->item(0)->nodeValue, $translationValue, $domain ); } $translation = $translation->nextSibling; } if (class_exists('Symfony\Component\Config\Resource\FileResource')) { $catalogue->addResource(new FileResource($resource)); } } libxml_use_internal_errors($internalErrors); return $catalogue; }
php
public function load($resource, $locale, $domain = 'messages') { if (!stream_is_local($resource)) { throw new InvalidResourceException(sprintf('This is not a local file "%s".', $resource)); } if (!file_exists($resource)) { throw new NotFoundResourceException(sprintf('File "%s" not found.', $resource)); } try { $dom = XmlUtils::loadFile($resource); } catch (\InvalidArgumentException $e) { throw new InvalidResourceException(sprintf('Unable to load "%s".', $resource), $e->getCode(), $e); } $internalErrors = libxml_use_internal_errors(true); libxml_clear_errors(); $xpath = new \DOMXPath($dom); $nodes = $xpath->evaluate('//TS/context/name[text()="'.$domain.'"]'); $catalogue = new MessageCatalogue($locale); if (1 == $nodes->length) { $translations = $nodes->item(0)->nextSibling->parentNode->parentNode->getElementsByTagName('message'); foreach ($translations as $translation) { $translationValue = (string) $translation->getElementsByTagName('translation')->item(0)->nodeValue; if (!empty($translationValue)) { $catalogue->set( (string) $translation->getElementsByTagName('source')->item(0)->nodeValue, $translationValue, $domain ); } $translation = $translation->nextSibling; } if (class_exists('Symfony\Component\Config\Resource\FileResource')) { $catalogue->addResource(new FileResource($resource)); } } libxml_use_internal_errors($internalErrors); return $catalogue; }
[ "public", "function", "load", "(", "$", "resource", ",", "$", "locale", ",", "$", "domain", "=", "'messages'", ")", "{", "if", "(", "!", "stream_is_local", "(", "$", "resource", ")", ")", "{", "throw", "new", "InvalidResourceException", "(", "sprintf", "...
{@inheritdoc}
[ "{" ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Translation/Loader/QtFileLoader.php#L30-L76
train
Load a message catalogue from a local file
[ 30522, 2270, 3853, 7170, 1006, 1002, 7692, 1010, 1002, 2334, 2063, 1010, 1002, 5884, 1027, 1005, 7696, 1005, 1007, 1063, 2065, 1006, 999, 5460, 1035, 2003, 1035, 2334, 1006, 1002, 7692, 1007, 1007, 1063, 5466, 2047, 19528, 6072, 8162, 340...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Database/Eloquent/Builder.php
Builder.firstOrCreate
public function firstOrCreate(array $attributes, array $values = []) { if (! is_null($instance = $this->where($attributes)->first())) { return $instance; } return tap($this->newModelInstance($attributes + $values), function ($instance) { $instance->save(); }); }
php
public function firstOrCreate(array $attributes, array $values = []) { if (! is_null($instance = $this->where($attributes)->first())) { return $instance; } return tap($this->newModelInstance($attributes + $values), function ($instance) { $instance->save(); }); }
[ "public", "function", "firstOrCreate", "(", "array", "$", "attributes", ",", "array", "$", "values", "=", "[", "]", ")", "{", "if", "(", "!", "is_null", "(", "$", "instance", "=", "$", "this", "->", "where", "(", "$", "attributes", ")", "->", "first"...
Get the first record matching the attributes or create it. @param array $attributes @param array $values @return \Illuminate\Database\Eloquent\Model|static
[ "Get", "the", "first", "record", "matching", "the", "attributes", "or", "create", "it", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Database/Eloquent/Builder.php#L413-L422
train
Get first or create new record
[ 30522, 2270, 3853, 2034, 2953, 16748, 3686, 1006, 9140, 1002, 12332, 1010, 9140, 1002, 5300, 1027, 1031, 1033, 1007, 1063, 2065, 1006, 999, 2003, 1035, 19701, 1006, 1002, 6013, 1027, 1002, 2023, 1011, 1028, 2073, 1006, 1002, 12332, 1007, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/ExpressionLanguage/ExpressionLanguage.php
ExpressionLanguage.evaluate
public function evaluate($expression, $values = []) { return $this->parse($expression, array_keys($values))->getNodes()->evaluate($this->functions, $values); }
php
public function evaluate($expression, $values = []) { return $this->parse($expression, array_keys($values))->getNodes()->evaluate($this->functions, $values); }
[ "public", "function", "evaluate", "(", "$", "expression", ",", "$", "values", "=", "[", "]", ")", "{", "return", "$", "this", "->", "parse", "(", "$", "expression", ",", "array_keys", "(", "$", "values", ")", ")", "->", "getNodes", "(", ")", "->", ...
Evaluate an expression. @param Expression|string $expression The expression to compile @param array $values An array of values @return mixed The result of the evaluation of the expression
[ "Evaluate", "an", "expression", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/ExpressionLanguage/ExpressionLanguage.php#L65-L68
train
Evaluate an expression and return the result
[ 30522, 2270, 3853, 16157, 1006, 1002, 3670, 1010, 1002, 5300, 1027, 1031, 1033, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 11968, 3366, 1006, 1002, 3670, 1010, 9140, 1035, 6309, 1006, 1002, 5300, 1007, 1007, 1011, 1028, 2131, 3630, 6155, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/Installation/ServerFilesGenerator.php
ServerFilesGenerator.createWebRootFiles
public static function createWebRootFiles() { $filesToCreate = array( '/robots.txt', '/favicon.ico', ); foreach ($filesToCreate as $file) { $path = PIWIK_DOCUMENT_ROOT . $file; if(!file_exists($path)) { @file_put_contents($path, ''); } } }
php
public static function createWebRootFiles() { $filesToCreate = array( '/robots.txt', '/favicon.ico', ); foreach ($filesToCreate as $file) { $path = PIWIK_DOCUMENT_ROOT . $file; if(!file_exists($path)) { @file_put_contents($path, ''); } } }
[ "public", "static", "function", "createWebRootFiles", "(", ")", "{", "$", "filesToCreate", "=", "array", "(", "'/robots.txt'", ",", "'/favicon.ico'", ",", ")", ";", "foreach", "(", "$", "filesToCreate", "as", "$", "file", ")", "{", "$", "path", "=", "PIWIK...
Generate default robots.txt, favicon.ico, etc to suppress 404 (Not Found) errors in the web server logs, if Piwik is installed in the web root (or top level of subdomain). @see misc/crossdomain.xml
[ "Generate", "default", "robots", ".", "txt", "favicon", ".", "ico", "etc", "to", "suppress", "404", "(", "Not", "Found", ")", "errors", "in", "the", "web", "server", "logs", "if", "Piwik", "is", "installed", "in", "the", "web", "root", "(", "or", "top"...
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Installation/ServerFilesGenerator.php#L196-L208
train
Create web root files
[ 30522, 2270, 10763, 3853, 3443, 8545, 12618, 4140, 8873, 4244, 1006, 1007, 1063, 1002, 6764, 3406, 16748, 3686, 1027, 9140, 1006, 1005, 1013, 13507, 1012, 19067, 2102, 1005, 1010, 1005, 1013, 6904, 7903, 2239, 1012, 24582, 2080, 1005, 1010,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Cache/Frontend/Output.php
Zend_Cache_Frontend_Output.end
public function end($tags = array(), $specificLifetime = false, $forcedDatas = null, $echoData = true, $priority = 8) { if ($forcedDatas === null) { $data = ob_get_clean(); } else { $data =& $forcedDatas; } $id = array_pop($this->_idStack); if ($id === null) { Zend_Cache::throwException('use of end() without a start()'); } $this->save($data, $id, $tags, $specificLifetime, $priority); if ($echoData) { echo($data); } }
php
public function end($tags = array(), $specificLifetime = false, $forcedDatas = null, $echoData = true, $priority = 8) { if ($forcedDatas === null) { $data = ob_get_clean(); } else { $data =& $forcedDatas; } $id = array_pop($this->_idStack); if ($id === null) { Zend_Cache::throwException('use of end() without a start()'); } $this->save($data, $id, $tags, $specificLifetime, $priority); if ($echoData) { echo($data); } }
[ "public", "function", "end", "(", "$", "tags", "=", "array", "(", ")", ",", "$", "specificLifetime", "=", "false", ",", "$", "forcedDatas", "=", "null", ",", "$", "echoData", "=", "true", ",", "$", "priority", "=", "8", ")", "{", "if", "(", "$", ...
Stop the cache @param array $tags Tags array @param int $specificLifetime If != false, set a specific lifetime for this cache record (null => infinite lifetime) @param string $forcedDatas If not null, force written datas with this @param boolean $echoData If set to true, datas are sent to the browser @param int $priority integer between 0 (very low priority) and 10 (maximum priority) used by some particular backends @return void
[ "Stop", "the", "cache" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Cache/Frontend/Output.php#L88-L103
train
End cache entry
[ 30522, 2270, 3853, 2203, 1006, 1002, 22073, 1027, 9140, 1006, 1007, 1010, 1002, 3563, 15509, 7292, 1027, 6270, 1010, 1002, 3140, 2850, 10230, 1027, 19701, 1010, 1002, 9052, 2850, 2696, 1027, 2995, 1010, 1002, 9470, 1027, 1022, 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...
octobercms/october
modules/cms/classes/Theme.php
Theme.exists
public static function exists($dirName) { $theme = static::load($dirName); $path = $theme->getPath(); return File::isDirectory($path); }
php
public static function exists($dirName) { $theme = static::load($dirName); $path = $theme->getPath(); return File::isDirectory($path); }
[ "public", "static", "function", "exists", "(", "$", "dirName", ")", "{", "$", "theme", "=", "static", "::", "load", "(", "$", "dirName", ")", ";", "$", "path", "=", "$", "theme", "->", "getPath", "(", ")", ";", "return", "File", "::", "isDirectory", ...
Determines if a theme with given directory name exists @param string $dirName The theme directory @return bool
[ "Determines", "if", "a", "theme", "with", "given", "directory", "name", "exists" ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/cms/classes/Theme.php#L112-L118
train
Checks if a directory exists in the theme.
[ 30522, 2270, 10763, 3853, 6526, 1006, 1002, 16101, 18442, 1007, 1063, 1002, 4323, 1027, 10763, 1024, 1024, 7170, 1006, 1002, 16101, 18442, 1007, 1025, 1002, 4130, 1027, 1002, 4323, 1011, 1028, 2131, 15069, 1006, 1007, 1025, 2709, 5371, 1024...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
core/DataTable.php
DataTable.getLastRow
public function getLastRow() { if (!is_null($this->summaryRow)) { return $this->summaryRow; } if (count($this->rows) == 0) { return false; } return end($this->rows); }
php
public function getLastRow() { if (!is_null($this->summaryRow)) { return $this->summaryRow; } if (count($this->rows) == 0) { return false; } return end($this->rows); }
[ "public", "function", "getLastRow", "(", ")", "{", "if", "(", "!", "is_null", "(", "$", "this", "->", "summaryRow", ")", ")", "{", "return", "$", "this", "->", "summaryRow", ";", "}", "if", "(", "count", "(", "$", "this", "->", "rows", ")", "==", ...
Returns the last row of the DataTable. If there is a summary row, it will always be considered the last row. @return Row|false The last row or `false` if it cannot be found.
[ "Returns", "the", "last", "row", "of", "the", "DataTable", ".", "If", "there", "is", "a", "summary", "row", "it", "will", "always", "be", "considered", "the", "last", "row", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/core/DataTable.php#L1030-L1041
train
Return last row
[ 30522, 2270, 3853, 2131, 8523, 13181, 2860, 1006, 1007, 1063, 2065, 1006, 999, 2003, 1035, 19701, 1006, 1002, 2023, 1011, 1028, 12654, 10524, 1007, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 12654, 30524, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
symfony/symfony
src/Symfony/Component/Console/Application.php
Application.get
public function get($name) { $this->init(); if (!$this->has($name)) { throw new CommandNotFoundException(sprintf('The command "%s" does not exist.', $name)); } $command = $this->commands[$name]; if ($this->wantHelps) { $this->wantHelps = false; $helpCommand = $this->get('help'); $helpCommand->setCommand($command); return $helpCommand; } return $command; }
php
public function get($name) { $this->init(); if (!$this->has($name)) { throw new CommandNotFoundException(sprintf('The command "%s" does not exist.', $name)); } $command = $this->commands[$name]; if ($this->wantHelps) { $this->wantHelps = false; $helpCommand = $this->get('help'); $helpCommand->setCommand($command); return $helpCommand; } return $command; }
[ "public", "function", "get", "(", "$", "name", ")", "{", "$", "this", "->", "init", "(", ")", ";", "if", "(", "!", "$", "this", "->", "has", "(", "$", "name", ")", ")", "{", "throw", "new", "CommandNotFoundException", "(", "sprintf", "(", "'The com...
Returns a registered command by name or alias. @param string $name The command name or alias @return Command A Command object @throws CommandNotFoundException When given command name does not exist
[ "Returns", "a", "registered", "command", "by", "name", "or", "alias", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Console/Application.php#L504-L524
train
Get the command by name
[ 30522, 2270, 3853, 2131, 1006, 1002, 2171, 1007, 1063, 1002, 2023, 1011, 1028, 1999, 4183, 1006, 1007, 1025, 2065, 1006, 999, 1002, 2023, 1011, 1028, 2038, 1006, 1002, 2171, 1007, 1007, 1063, 5466, 2047, 3094, 17048, 14876, 8630, 10288, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
overtrue/wechat
src/Kernel/Log/LogManager.php
LogManager.createStackDriver
protected function createStackDriver(array $config) { $handlers = []; foreach ($config['channels'] ?? [] as $channel) { $handlers = \array_merge($handlers, $this->channel($channel)->getHandlers()); } return new Monolog($this->parseChannel($config), $handlers); }
php
protected function createStackDriver(array $config) { $handlers = []; foreach ($config['channels'] ?? [] as $channel) { $handlers = \array_merge($handlers, $this->channel($channel)->getHandlers()); } return new Monolog($this->parseChannel($config), $handlers); }
[ "protected", "function", "createStackDriver", "(", "array", "$", "config", ")", "{", "$", "handlers", "=", "[", "]", ";", "foreach", "(", "$", "config", "[", "'channels'", "]", "??", "[", "]", "as", "$", "channel", ")", "{", "$", "handlers", "=", "\\...
Create an aggregate log driver instance. @param array $config @return \Monolog\Logger
[ "Create", "an", "aggregate", "log", "driver", "instance", "." ]
120c72faaa93c270365bc75c73c362d5fd583209
https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/Kernel/Log/LogManager.php#L197-L206
train
Create a stack driver
[ 30522, 5123, 3853, 9005, 2696, 3600, 23663, 2099, 1006, 9140, 1002, 9530, 8873, 2290, 1007, 1063, 1002, 28213, 2015, 1027, 1031, 1033, 1025, 18921, 6776, 1006, 1002, 9530, 8873, 2290, 1031, 1005, 6833, 1005, 1033, 1029, 1029, 1031, 1033, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/SegmentEditor/API.php
API.getAll
public function getAll($idSite = false) { if (!empty($idSite)) { Piwik::checkUserHasViewAccess($idSite); } else { Piwik::checkUserHasSomeViewAccess(); } $userLogin = Piwik::getCurrentUserLogin(); $model = $this->getModel(); if(Piwik::hasUserSuperUserAccess()) { $segments = $model->getAllSegmentsForAllUsers($idSite); } else { if (empty($idSite)) { $segments = $model->getAllSegments($userLogin); } else { $segments = $model->getAllSegmentsForSite($idSite, $userLogin); } } $segments = $this->sortSegmentsCreatedByUserFirst($segments); return $segments; }
php
public function getAll($idSite = false) { if (!empty($idSite)) { Piwik::checkUserHasViewAccess($idSite); } else { Piwik::checkUserHasSomeViewAccess(); } $userLogin = Piwik::getCurrentUserLogin(); $model = $this->getModel(); if(Piwik::hasUserSuperUserAccess()) { $segments = $model->getAllSegmentsForAllUsers($idSite); } else { if (empty($idSite)) { $segments = $model->getAllSegments($userLogin); } else { $segments = $model->getAllSegmentsForSite($idSite, $userLogin); } } $segments = $this->sortSegmentsCreatedByUserFirst($segments); return $segments; }
[ "public", "function", "getAll", "(", "$", "idSite", "=", "false", ")", "{", "if", "(", "!", "empty", "(", "$", "idSite", ")", ")", "{", "Piwik", "::", "checkUserHasViewAccess", "(", "$", "idSite", ")", ";", "}", "else", "{", "Piwik", "::", "checkUser...
Returns all stored segments. @param bool|int $idSite Whether to return stored segments for a specific idSite, or all of them. If supplied, must be a valid site ID. @return array
[ "Returns", "all", "stored", "segments", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/SegmentEditor/API.php#L343-L367
train
Get all segments for a given site
[ 30522, 2270, 3853, 2131, 8095, 1006, 1002, 8909, 28032, 2063, 1027, 6270, 1007, 1063, 2065, 1006, 999, 4064, 1006, 1002, 8909, 28032, 2063, 1007, 1007, 1063, 14255, 9148, 2243, 1024, 1024, 4638, 20330, 14949, 8584, 6305, 9623, 2015, 1006, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Db/Profiler.php
Zend_Db_Profiler.getTotalElapsedSecs
public function getTotalElapsedSecs($queryType = null) { $elapsedSecs = 0; foreach ($this->_queryProfiles as $key => $qp) { if (null === $queryType) { $condition = true; } else { $condition = ($qp->getQueryType() & $queryType); } if (($qp->hasEnded()) && $condition) { $elapsedSecs += $qp->getElapsedSecs(); } } return $elapsedSecs; }
php
public function getTotalElapsedSecs($queryType = null) { $elapsedSecs = 0; foreach ($this->_queryProfiles as $key => $qp) { if (null === $queryType) { $condition = true; } else { $condition = ($qp->getQueryType() & $queryType); } if (($qp->hasEnded()) && $condition) { $elapsedSecs += $qp->getElapsedSecs(); } } return $elapsedSecs; }
[ "public", "function", "getTotalElapsedSecs", "(", "$", "queryType", "=", "null", ")", "{", "$", "elapsedSecs", "=", "0", ";", "foreach", "(", "$", "this", "->", "_queryProfiles", "as", "$", "key", "=>", "$", "qp", ")", "{", "if", "(", "null", "===", ...
Get the total elapsed time (in seconds) of all of the profiled queries. Only queries that have ended will be counted. If $queryType is set to one or more of the Zend_Db_Profiler::* constants, the elapsed time will be calculated only for queries of the given type(s). @param integer $queryType OPTIONAL @return float
[ "Get", "the", "total", "elapsed", "time", "(", "in", "seconds", ")", "of", "all", "of", "the", "profiled", "queries", ".", "Only", "queries", "that", "have", "ended", "will", "be", "counted", ".", "If", "$queryType", "is", "set", "to", "one", "or", "mo...
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Profiler.php#L412-L426
train
Returns the total elapsed seconds of all query profiles
[ 30522, 2270, 3853, 2131, 3406, 22059, 2721, 29251, 5104, 8586, 2015, 1006, 1002, 23032, 13874, 1027, 19701, 1007, 1063, 1002, 3449, 9331, 6924, 3366, 6169, 1027, 1014, 1025, 18921, 6776, 1006, 1002, 2023, 1011, 1028, 1035, 23032, 21572, 887...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/Themes.php
Themes.loadConfiguration
protected function loadConfiguration($name, Config $config) { $themeConfig = CompiledYamlFile::instance("themes://{$name}/{$name}" . YAML_EXT)->content(); $config->joinDefaults("themes.{$name}", $themeConfig); }
php
protected function loadConfiguration($name, Config $config) { $themeConfig = CompiledYamlFile::instance("themes://{$name}/{$name}" . YAML_EXT)->content(); $config->joinDefaults("themes.{$name}", $themeConfig); }
[ "protected", "function", "loadConfiguration", "(", "$", "name", ",", "Config", "$", "config", ")", "{", "$", "themeConfig", "=", "CompiledYamlFile", "::", "instance", "(", "\"themes://{$name}/{$name}\"", ".", "YAML_EXT", ")", "->", "content", "(", ")", ";", "$...
Load theme configuration. @param string $name Theme name @param Config $config Configuration class
[ "Load", "theme", "configuration", "." ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Themes.php#L276-L280
train
Load theme configuration
[ 30522, 5123, 3853, 7170, 8663, 8873, 27390, 3370, 1006, 1002, 2171, 1010, 9530, 8873, 2290, 1002, 9530, 8873, 2290, 1007, 1063, 1002, 4323, 8663, 8873, 2290, 1027, 9227, 14852, 10270, 9463, 1024, 1024, 6013, 1006, 1000, 6991, 1024, 1013, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Mail.php
Zend_Mail.setReplyToFromDefault
public function setReplyToFromDefault() { $replyTo = self::getDefaultReplyTo(); if($replyTo === null) { // require_once 'Zend/Mail/Exception.php'; throw new Zend_Mail_Exception( 'No default Reply-To Address set to use'); } $this->setReplyTo($replyTo['email'], $replyTo['name']); return $this; }
php
public function setReplyToFromDefault() { $replyTo = self::getDefaultReplyTo(); if($replyTo === null) { // require_once 'Zend/Mail/Exception.php'; throw new Zend_Mail_Exception( 'No default Reply-To Address set to use'); } $this->setReplyTo($replyTo['email'], $replyTo['name']); return $this; }
[ "public", "function", "setReplyToFromDefault", "(", ")", "{", "$", "replyTo", "=", "self", "::", "getDefaultReplyTo", "(", ")", ";", "if", "(", "$", "replyTo", "===", "null", ")", "{", "// require_once 'Zend/Mail/Exception.php';", "throw", "new", "Zend_Mail_Except...
Sets ReplyTo-name and -email based on the defaults @return Zend_Mail Provides fluent interface
[ "Sets", "ReplyTo", "-", "name", "and", "-", "email", "based", "on", "the", "defaults" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Mail.php#L850-L861
train
Set Reply - To Address From Default
[ 30522, 2270, 3853, 2275, 2890, 22086, 3406, 19699, 5358, 3207, 7011, 11314, 1006, 1007, 1063, 1002, 7514, 3406, 1027, 2969, 1024, 1024, 2131, 3207, 7011, 11314, 2890, 22086, 3406, 1006, 1007, 1025, 2065, 1006, 1002, 7514, 3406, 1027, 1027, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Routing/SortedMiddleware.php
SortedMiddleware.sortMiddleware
protected function sortMiddleware($priorityMap, $middlewares) { $lastIndex = 0; foreach ($middlewares as $index => $middleware) { if (! is_string($middleware)) { continue; } $stripped = head(explode(':', $middleware)); if (in_array($stripped, $priorityMap)) { $priorityIndex = array_search($stripped, $priorityMap); // This middleware is in the priority map. If we have encountered another middleware // that was also in the priority map and was at a lower priority than the current // middleware, we will move this middleware to be above the previous encounter. if (isset($lastPriorityIndex) && $priorityIndex < $lastPriorityIndex) { return $this->sortMiddleware( $priorityMap, array_values($this->moveMiddleware($middlewares, $index, $lastIndex)) ); } // This middleware is in the priority map; but, this is the first middleware we have // encountered from the map thus far. We'll save its current index plus its index // from the priority map so we can compare against them on the next iterations. $lastIndex = $index; $lastPriorityIndex = $priorityIndex; } } return array_values(array_unique($middlewares, SORT_REGULAR)); }
php
protected function sortMiddleware($priorityMap, $middlewares) { $lastIndex = 0; foreach ($middlewares as $index => $middleware) { if (! is_string($middleware)) { continue; } $stripped = head(explode(':', $middleware)); if (in_array($stripped, $priorityMap)) { $priorityIndex = array_search($stripped, $priorityMap); // This middleware is in the priority map. If we have encountered another middleware // that was also in the priority map and was at a lower priority than the current // middleware, we will move this middleware to be above the previous encounter. if (isset($lastPriorityIndex) && $priorityIndex < $lastPriorityIndex) { return $this->sortMiddleware( $priorityMap, array_values($this->moveMiddleware($middlewares, $index, $lastIndex)) ); } // This middleware is in the priority map; but, this is the first middleware we have // encountered from the map thus far. We'll save its current index plus its index // from the priority map so we can compare against them on the next iterations. $lastIndex = $index; $lastPriorityIndex = $priorityIndex; } } return array_values(array_unique($middlewares, SORT_REGULAR)); }
[ "protected", "function", "sortMiddleware", "(", "$", "priorityMap", ",", "$", "middlewares", ")", "{", "$", "lastIndex", "=", "0", ";", "foreach", "(", "$", "middlewares", "as", "$", "index", "=>", "$", "middleware", ")", "{", "if", "(", "!", "is_string"...
Sort the middlewares by the given priority map. Each call to this method makes one discrete middleware movement if necessary. @param array $priorityMap @param array $middlewares @return array
[ "Sort", "the", "middlewares", "by", "the", "given", "priority", "map", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Routing/SortedMiddleware.php#L34-L66
train
Sort the middlewares in the priority map
[ 30522, 5123, 3853, 4066, 4328, 20338, 8059, 1006, 1002, 9470, 2863, 2361, 1010, 1002, 2690, 8059, 2015, 1007, 1063, 1002, 2197, 22254, 10288, 1027, 1014, 1025, 18921, 6776, 1006, 1002, 2690, 8059, 2015, 2004, 1002, 5950, 1027, 1028, 1002, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Cache/Backend/Sqlite.php
Zend_Cache_Backend_Sqlite.getIdsMatchingTags
public function getIdsMatchingTags($tags = array()) { $first = true; $ids = array(); foreach ($tags as $tag) { $res = $this->_query("SELECT DISTINCT(id) AS id FROM tag WHERE name='$tag'"); if (!$res) { return array(); } $rows = @sqlite_fetch_all($res, SQLITE_ASSOC); $ids2 = array(); foreach ($rows as $row) { $ids2[] = $row['id']; } if ($first) { $ids = $ids2; $first = false; } else { $ids = array_intersect($ids, $ids2); } } $result = array(); foreach ($ids as $id) { $result[] = $id; } return $result; }
php
public function getIdsMatchingTags($tags = array()) { $first = true; $ids = array(); foreach ($tags as $tag) { $res = $this->_query("SELECT DISTINCT(id) AS id FROM tag WHERE name='$tag'"); if (!$res) { return array(); } $rows = @sqlite_fetch_all($res, SQLITE_ASSOC); $ids2 = array(); foreach ($rows as $row) { $ids2[] = $row['id']; } if ($first) { $ids = $ids2; $first = false; } else { $ids = array_intersect($ids, $ids2); } } $result = array(); foreach ($ids as $id) { $result[] = $id; } return $result; }
[ "public", "function", "getIdsMatchingTags", "(", "$", "tags", "=", "array", "(", ")", ")", "{", "$", "first", "=", "true", ";", "$", "ids", "=", "array", "(", ")", ";", "foreach", "(", "$", "tags", "as", "$", "tag", ")", "{", "$", "res", "=", "...
Return an array of stored cache ids which match given tags In case of multiple tags, a logical AND is made between tags @param array $tags array of tags @return array array of matching cache ids (string)
[ "Return", "an", "array", "of", "stored", "cache", "ids", "which", "match", "given", "tags" ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Cache/Backend/Sqlite.php#L266-L292
train
Returns all the ids matching the given tags
[ 30522, 2270, 3853, 2131, 9821, 18900, 8450, 15900, 2015, 1006, 1002, 22073, 1027, 9140, 1006, 1007, 1007, 1063, 1002, 2034, 1027, 2995, 1025, 1002, 8909, 2015, 1027, 9140, 1006, 1007, 1025, 18921, 6776, 1006, 1002, 22073, 2004, 1002, 6415, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/SitesManager/SitesManager.php
SitesManager.shouldKeepURLFragmentsFor
private static function shouldKeepURLFragmentsFor($site) { if ($site['keep_url_fragment'] == self::KEEP_URL_FRAGMENT_YES) { return true; } else if ($site['keep_url_fragment'] == self::KEEP_URL_FRAGMENT_NO) { return false; } return API::getInstance()->getKeepURLFragmentsGlobal(); }
php
private static function shouldKeepURLFragmentsFor($site) { if ($site['keep_url_fragment'] == self::KEEP_URL_FRAGMENT_YES) { return true; } else if ($site['keep_url_fragment'] == self::KEEP_URL_FRAGMENT_NO) { return false; } return API::getInstance()->getKeepURLFragmentsGlobal(); }
[ "private", "static", "function", "shouldKeepURLFragmentsFor", "(", "$", "site", ")", "{", "if", "(", "$", "site", "[", "'keep_url_fragment'", "]", "==", "self", "::", "KEEP_URL_FRAGMENT_YES", ")", "{", "return", "true", ";", "}", "else", "if", "(", "$", "s...
Returns whether we should keep URL fragments for a specific site. @param array $site DB data for the site. @return bool
[ "Returns", "whether", "we", "should", "keep", "URL", "fragments", "for", "a", "specific", "site", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/SitesManager/SitesManager.php#L198-L207
train
Returns true if the keep_url_fragment setting is TRUE
[ 30522, 2797, 10763, 3853, 2323, 20553, 5311, 10270, 29181, 8163, 29278, 1006, 1002, 2609, 1007, 1063, 2065, 1006, 1002, 2609, 1031, 1005, 2562, 1035, 24471, 2140, 1035, 15778, 1005, 1033, 1027, 1027, 2969, 1024, 1024, 2562, 1035, 24471, 214...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/ConstraintValidator.php
ConstraintValidator.formatValue
protected function formatValue($value, $format = 0) { $isDateTime = $value instanceof \DateTimeInterface; if (($format & self::PRETTY_DATE) && $isDateTime) { if (class_exists('IntlDateFormatter')) { $locale = \Locale::getDefault(); $formatter = new \IntlDateFormatter($locale, \IntlDateFormatter::MEDIUM, \IntlDateFormatter::SHORT); // neither the native nor the stub IntlDateFormatter support // DateTimeImmutable as of yet if (!$value instanceof \DateTime) { $value = new \DateTime( $value->format('Y-m-d H:i:s.u e'), $value->getTimezone() ); } return $formatter->format($value); } return $value->format('Y-m-d H:i:s'); } if (\is_object($value)) { if (($format & self::OBJECT_TO_STRING) && method_exists($value, '__toString')) { return $value->__toString(); } return 'object'; } if (\is_array($value)) { return 'array'; } if (\is_string($value)) { return '"'.$value.'"'; } if (\is_resource($value)) { return 'resource'; } if (null === $value) { return 'null'; } if (false === $value) { return 'false'; } if (true === $value) { return 'true'; } return (string) $value; }
php
protected function formatValue($value, $format = 0) { $isDateTime = $value instanceof \DateTimeInterface; if (($format & self::PRETTY_DATE) && $isDateTime) { if (class_exists('IntlDateFormatter')) { $locale = \Locale::getDefault(); $formatter = new \IntlDateFormatter($locale, \IntlDateFormatter::MEDIUM, \IntlDateFormatter::SHORT); // neither the native nor the stub IntlDateFormatter support // DateTimeImmutable as of yet if (!$value instanceof \DateTime) { $value = new \DateTime( $value->format('Y-m-d H:i:s.u e'), $value->getTimezone() ); } return $formatter->format($value); } return $value->format('Y-m-d H:i:s'); } if (\is_object($value)) { if (($format & self::OBJECT_TO_STRING) && method_exists($value, '__toString')) { return $value->__toString(); } return 'object'; } if (\is_array($value)) { return 'array'; } if (\is_string($value)) { return '"'.$value.'"'; } if (\is_resource($value)) { return 'resource'; } if (null === $value) { return 'null'; } if (false === $value) { return 'false'; } if (true === $value) { return 'true'; } return (string) $value; }
[ "protected", "function", "formatValue", "(", "$", "value", ",", "$", "format", "=", "0", ")", "{", "$", "isDateTime", "=", "$", "value", "instanceof", "\\", "DateTimeInterface", ";", "if", "(", "(", "$", "format", "&", "self", "::", "PRETTY_DATE", ")", ...
Returns a string representation of the value. This method returns the equivalent PHP tokens for most scalar types (i.e. "false" for false, "1" for 1 etc.). Strings are always wrapped in double quotes ("). Objects, arrays and resources are formatted as "object", "array" and "resource". If the $format bitmask contains the PRETTY_DATE bit, then {@link \DateTime} objects will be formatted as RFC-3339 dates ("Y-m-d H:i:s"). Be careful when passing message parameters to a constraint violation that (may) contain objects, arrays or resources. These parameters should only be displayed for technical users. Non-technical users won't know what an "object", "array" or "resource" is and will be confused by the violation message. @param mixed $value The value to format as string @param int $format A bitwise combination of the format constants in this class @return string The string representation of the passed value
[ "Returns", "a", "string", "representation", "of", "the", "value", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Validator/ConstraintValidator.php#L86-L143
train
Formats the value according to the format parameter
[ 30522, 5123, 3853, 4289, 10175, 5657, 1006, 1002, 3643, 1010, 1002, 4289, 1027, 1014, 1007, 1063, 1002, 2003, 13701, 7292, 1027, 1002, 3643, 6013, 11253, 1032, 3058, 7292, 18447, 2121, 12172, 1025, 2065, 1006, 1006, 1002, 4289, 1004, 2969, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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.urlHash
public function urlHash($hash = null, $withHash = true) { if ($hash) { $this->set('urlHash', ltrim($hash, '#')); } $hash = $this->get('urlHash', ''); return $withHash && !empty($hash) ? '#' . $hash : $hash; }
php
public function urlHash($hash = null, $withHash = true) { if ($hash) { $this->set('urlHash', ltrim($hash, '#')); } $hash = $this->get('urlHash', ''); return $withHash && !empty($hash) ? '#' . $hash : $hash; }
[ "public", "function", "urlHash", "(", "$", "hash", "=", "null", ",", "$", "withHash", "=", "true", ")", "{", "if", "(", "$", "hash", ")", "{", "$", "this", "->", "set", "(", "'urlHash'", ",", "ltrim", "(", "$", "hash", ",", "'#'", ")", ")", ";"...
Get/set hash for the file's url @param string $hash @param bool $withHash @return string
[ "Get", "/", "set", "hash", "for", "the", "file", "s", "url" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Medium/Medium.php#L334-L343
train
Get or set the urlHash
[ 30522, 2270, 3853, 24471, 2140, 14949, 2232, 1006, 1002, 23325, 1027, 19701, 1010, 1002, 2007, 14949, 2232, 1027, 30524, 2140, 14949, 2232, 1005, 1010, 8318, 20026, 1006, 1002, 23325, 1010, 1005, 1001, 1005, 1007, 1007, 1025, 1065, 1002, 23...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Db/Adapter/Oracle.php
Zend_Db_Adapter_Oracle._commit
protected function _commit() { if (!oci_commit($this->_connection)) { /** * @see Zend_Db_Adapter_Oracle_Exception */ // require_once 'Zend/Db/Adapter/Oracle/Exception.php'; throw new Zend_Db_Adapter_Oracle_Exception(oci_error($this->_connection)); } $this->_setExecuteMode(OCI_COMMIT_ON_SUCCESS); }
php
protected function _commit() { if (!oci_commit($this->_connection)) { /** * @see Zend_Db_Adapter_Oracle_Exception */ // require_once 'Zend/Db/Adapter/Oracle/Exception.php'; throw new Zend_Db_Adapter_Oracle_Exception(oci_error($this->_connection)); } $this->_setExecuteMode(OCI_COMMIT_ON_SUCCESS); }
[ "protected", "function", "_commit", "(", ")", "{", "if", "(", "!", "oci_commit", "(", "$", "this", "->", "_connection", ")", ")", "{", "/**\n * @see Zend_Db_Adapter_Oracle_Exception\n */", "// require_once 'Zend/Db/Adapter/Oracle/Exception.php';", "thr...
Commit a transaction and return to autocommit mode. @return void @throws Zend_Db_Adapter_Oracle_Exception
[ "Commit", "a", "transaction", "and", "return", "to", "autocommit", "mode", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Adapter/Oracle.php#L465-L475
train
Commit the connection to the Oracle server
[ 30522, 5123, 3853, 1035, 10797, 1006, 1007, 1063, 2065, 1006, 999, 1051, 6895, 1035, 10797, 1006, 1002, 2023, 1011, 1028, 1035, 4434, 1007, 1007, 1063, 1013, 1008, 1008, 1008, 1030, 2156, 16729, 2094, 1035, 16962, 1035, 15581, 2121, 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...
matomo-org/matomo
plugins/Login/SessionInitializer.php
SessionInitializer.processFailedSession
protected function processFailedSession($rememberMe) { $cookie = $this->getAuthCookie($rememberMe); $cookie->delete(); throw new Exception(Piwik::translate('Login_LoginPasswordNotCorrect')); }
php
protected function processFailedSession($rememberMe) { $cookie = $this->getAuthCookie($rememberMe); $cookie->delete(); throw new Exception(Piwik::translate('Login_LoginPasswordNotCorrect')); }
[ "protected", "function", "processFailedSession", "(", "$", "rememberMe", ")", "{", "$", "cookie", "=", "$", "this", "->", "getAuthCookie", "(", "$", "rememberMe", ")", ";", "$", "cookie", "->", "delete", "(", ")", ";", "throw", "new", "Exception", "(", "...
Executed when the session could not authenticate. @param bool $rememberMe Whether the authenticated session should be remembered after the browser is closed or not. @throws Exception always.
[ "Executed", "when", "the", "session", "could", "not", "authenticate", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/Login/SessionInitializer.php#L167-L173
train
Throws an exception if the login failed.
[ 30522, 5123, 3853, 2832, 7011, 18450, 8583, 10992, 1006, 1002, 3342, 4168, 1007, 1063, 1002, 17387, 1027, 1002, 2023, 1011, 1028, 2131, 4887, 2705, 3597, 23212, 2063, 1006, 1002, 3342, 4168, 1007, 1025, 1002, 17387, 1011, 1028, 3972, 12870,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Dotenv/Dotenv.php
Dotenv.overload
public function overload(string $path, string ...$extraPaths): void { $this->doLoad(true, \func_get_args()); }
php
public function overload(string $path, string ...$extraPaths): void { $this->doLoad(true, \func_get_args()); }
[ "public", "function", "overload", "(", "string", "$", "path", ",", "string", "...", "$", "extraPaths", ")", ":", "void", "{", "$", "this", "->", "doLoad", "(", "true", ",", "\\", "func_get_args", "(", ")", ")", ";", "}" ]
Loads one or several .env files and enables override existing vars. @param string $path A file to load @param ...string $extraPaths A list of additional files to load @throws FormatException when a file has a syntax error @throws PathException when a file does not exist or is not readable
[ "Loads", "one", "or", "several", ".", "env", "files", "and", "enables", "override", "existing", "vars", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Dotenv/Dotenv.php#L121-L124
train
Overload the content of the current page.
[ 30522, 2270, 3853, 2058, 11066, 1006, 5164, 1002, 4130, 1010, 5164, 1012, 1012, 1012, 1002, 4469, 15069, 2015, 1007, 1024, 11675, 1063, 1002, 2023, 1011, 1028, 2079, 11066, 1006, 2995, 1010, 1032, 4569, 2278, 1035, 2131, 1035, 12098, 5620, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/BasicService/QrCode/Client.php
Client.forever
public function forever($sceneValue) { if (is_int($sceneValue) && $sceneValue > 0 && $sceneValue < self::SCENE_MAX_VALUE) { $type = self::SCENE_QR_FOREVER; $sceneKey = 'scene_id'; } else { $type = self::SCENE_QR_FOREVER_STR; $sceneKey = 'scene_str'; } $scene = [$sceneKey => $sceneValue]; return $this->create($type, $scene, false); }
php
public function forever($sceneValue) { if (is_int($sceneValue) && $sceneValue > 0 && $sceneValue < self::SCENE_MAX_VALUE) { $type = self::SCENE_QR_FOREVER; $sceneKey = 'scene_id'; } else { $type = self::SCENE_QR_FOREVER_STR; $sceneKey = 'scene_str'; } $scene = [$sceneKey => $sceneValue]; return $this->create($type, $scene, false); }
[ "public", "function", "forever", "(", "$", "sceneValue", ")", "{", "if", "(", "is_int", "(", "$", "sceneValue", ")", "&&", "$", "sceneValue", ">", "0", "&&", "$", "sceneValue", "<", "self", "::", "SCENE_MAX_VALUE", ")", "{", "$", "type", "=", "self", ...
Create forever QR code. @param string|int $sceneValue @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string
[ "Create", "forever", "QR", "code", "." ]
120c72faaa93c270365bc75c73c362d5fd583209
https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/BasicService/QrCode/Client.php#L43-L55
train
Create forever QrCode
[ 30522, 2270, 3853, 5091, 1006, 1002, 3496, 10175, 5657, 1007, 1063, 2065, 1006, 2003, 1035, 20014, 1006, 1002, 3496, 10175, 5657, 1007, 1004, 1004, 1002, 3496, 10175, 5657, 1028, 1014, 1004, 1004, 1002, 3496, 10175, 5657, 1026, 2969, 1024, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Console/Gpm/IndexCommand.php
IndexCommand.filter
public function filter($data) { // filtering and sorting if ($this->options['plugins-only']) { unset($data['themes']); } if ($this->options['themes-only']) { unset($data['plugins']); } $filter = [ $this->options['filter'], $this->options['installed-only'], $this->options['updates-only'], $this->options['desc'] ]; if (\count(array_filter($filter))) { foreach ($data as $type => $packages) { foreach ($packages as $slug => $package) { $filter = true; // Filtering by string if ($this->options['filter']) { $filter = preg_grep('/(' . implode('|', $this->options['filter']) . ')/i', [$slug, $package->name]); } // Filtering updatables only if ($filter && $this->options['installed-only']) { $method = ucfirst(preg_replace('/s$/', '', $package->package_type)); $function = 'is' . $method . 'Installed'; $filter = $this->gpm->{$function}($package->slug); } // Filtering updatables only if ($filter && $this->options['updates-only']) { $method = ucfirst(preg_replace('/s$/', '', $package->package_type)); $function = 'is' . $method . 'Updatable'; $filter = $this->gpm->{$function}($package->slug); } if (!$filter) { unset($data[$type][$slug]); } } } } return $data; }
php
public function filter($data) { // filtering and sorting if ($this->options['plugins-only']) { unset($data['themes']); } if ($this->options['themes-only']) { unset($data['plugins']); } $filter = [ $this->options['filter'], $this->options['installed-only'], $this->options['updates-only'], $this->options['desc'] ]; if (\count(array_filter($filter))) { foreach ($data as $type => $packages) { foreach ($packages as $slug => $package) { $filter = true; // Filtering by string if ($this->options['filter']) { $filter = preg_grep('/(' . implode('|', $this->options['filter']) . ')/i', [$slug, $package->name]); } // Filtering updatables only if ($filter && $this->options['installed-only']) { $method = ucfirst(preg_replace('/s$/', '', $package->package_type)); $function = 'is' . $method . 'Installed'; $filter = $this->gpm->{$function}($package->slug); } // Filtering updatables only if ($filter && $this->options['updates-only']) { $method = ucfirst(preg_replace('/s$/', '', $package->package_type)); $function = 'is' . $method . 'Updatable'; $filter = $this->gpm->{$function}($package->slug); } if (!$filter) { unset($data[$type][$slug]); } } } } return $data; }
[ "public", "function", "filter", "(", "$", "data", ")", "{", "// filtering and sorting", "if", "(", "$", "this", "->", "options", "[", "'plugins-only'", "]", ")", "{", "unset", "(", "$", "data", "[", "'themes'", "]", ")", ";", "}", "if", "(", "$", "th...
@param array $data @return mixed
[ "@param", "array", "$data" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Console/Gpm/IndexCommand.php#L195-L244
train
Filter the array by the given options
[ 30522, 2270, 3853, 11307, 1006, 1002, 2951, 1007, 1063, 1013, 1013, 22910, 1998, 22210, 2065, 1006, 1002, 2023, 1011, 1028, 7047, 1031, 1005, 13354, 7076, 1011, 2069, 1005, 1033, 1007, 1063, 4895, 13462, 1006, 1002, 2951, 1031, 1005, 6991, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/ImageMedium.php
ImageMedium.link
public function link($reset = true, array $attributes = []) { $attributes['href'] = $this->url(false); $srcset = $this->srcset(false); if ($srcset) { $attributes['data-srcset'] = $srcset; } return parent::link($reset, $attributes); }
php
public function link($reset = true, array $attributes = []) { $attributes['href'] = $this->url(false); $srcset = $this->srcset(false); if ($srcset) { $attributes['data-srcset'] = $srcset; } return parent::link($reset, $attributes); }
[ "public", "function", "link", "(", "$", "reset", "=", "true", ",", "array", "$", "attributes", "=", "[", "]", ")", "{", "$", "attributes", "[", "'href'", "]", "=", "$", "this", "->", "url", "(", "false", ")", ";", "$", "srcset", "=", "$", "this",...
Turn the current Medium into a Link @param bool $reset @param array $attributes @return Link
[ "Turn", "the", "current", "Medium", "into", "a", "Link" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Page/Medium/ImageMedium.php#L385-L394
train
Link to the page
[ 30522, 2270, 3853, 4957, 1006, 1002, 25141, 1027, 2995, 1010, 9140, 1002, 12332, 1027, 1031, 1033, 1007, 1063, 1002, 12332, 1031, 1005, 17850, 12879, 1005, 1033, 1027, 1002, 2023, 1011, 1028, 24471, 2140, 1006, 6270, 1007, 1025, 1002, 5034,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
plugins/SitesManager/SitesManager.php
SitesManager.filterBlankFromCommaSepList
private static function filterBlankFromCommaSepList($parameters) { $parameters = explode(',', $parameters); $parameters = array_filter($parameters, 'strlen'); $parameters = array_unique($parameters); return $parameters; }
php
private static function filterBlankFromCommaSepList($parameters) { $parameters = explode(',', $parameters); $parameters = array_filter($parameters, 'strlen'); $parameters = array_unique($parameters); return $parameters; }
[ "private", "static", "function", "filterBlankFromCommaSepList", "(", "$", "parameters", ")", "{", "$", "parameters", "=", "explode", "(", "','", ",", "$", "parameters", ")", ";", "$", "parameters", "=", "array_filter", "(", "$", "parameters", ",", "'strlen'", ...
Trims each element of a comma-separated list of strings, removes empty elements and returns the result (as an array). @param string $parameters The unfiltered list. @return array The filtered list of strings as an array.
[ "Trims", "each", "element", "of", "a", "comma", "-", "separated", "list", "of", "strings", "removes", "empty", "elements", "and", "returns", "the", "result", "(", "as", "an", "array", ")", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/plugins/SitesManager/SitesManager.php#L288-L294
train
Filter the parameters by blanks from comma separated list.
[ 30522, 2797, 10763, 3853, 11307, 28522, 8950, 19699, 5358, 9006, 9335, 13699, 9863, 1006, 1002, 11709, 1007, 1063, 1002, 11709, 1027, 15044, 1006, 1005, 1010, 1005, 1010, 1002, 11709, 1007, 1025, 1002, 11709, 1027, 9140, 1035, 11307, 1006, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
laravel/framework
src/Illuminate/Cache/MemcachedStore.php
MemcachedStore.putMany
public function putMany(array $values, $seconds) { $prefixedValues = []; foreach ($values as $key => $value) { $prefixedValues[$this->prefix.$key] = $value; } return $this->memcached->setMulti( $prefixedValues, $this->calculateExpiration($seconds) ); }
php
public function putMany(array $values, $seconds) { $prefixedValues = []; foreach ($values as $key => $value) { $prefixedValues[$this->prefix.$key] = $value; } return $this->memcached->setMulti( $prefixedValues, $this->calculateExpiration($seconds) ); }
[ "public", "function", "putMany", "(", "array", "$", "values", ",", "$", "seconds", ")", "{", "$", "prefixedValues", "=", "[", "]", ";", "foreach", "(", "$", "values", "as", "$", "key", "=>", "$", "value", ")", "{", "$", "prefixedValues", "[", "$", ...
Store multiple items in the cache for a given number of seconds. @param array $values @param int $seconds @return bool
[ "Store", "multiple", "items", "in", "the", "cache", "for", "a", "given", "number", "of", "seconds", "." ]
0e0a428a50fc8378e3f77d18f3caae76c19e8c7a
https://github.com/laravel/framework/blob/0e0a428a50fc8378e3f77d18f3caae76c19e8c7a/src/Illuminate/Cache/MemcachedStore.php#L117-L128
train
Put many values in cache
[ 30522, 2270, 3853, 2404, 2386, 2100, 1006, 9140, 1002, 5300, 1010, 1002, 3823, 1007, 1063, 1002, 17576, 2098, 10175, 15808, 1027, 1031, 1033, 1025, 18921, 6776, 1006, 1002, 5300, 2004, 1002, 3145, 1027, 1028, 1002, 3643, 1007, 1063, 1002, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
matomo-org/matomo
libs/Zend/Db/Select.php
Zend_Db_Select.from
public function from($name, $cols = '*', $schema = null) { return $this->_join(self::FROM, $name, null, $cols, $schema); }
php
public function from($name, $cols = '*', $schema = null) { return $this->_join(self::FROM, $name, null, $cols, $schema); }
[ "public", "function", "from", "(", "$", "name", ",", "$", "cols", "=", "'*'", ",", "$", "schema", "=", "null", ")", "{", "return", "$", "this", "->", "_join", "(", "self", "::", "FROM", ",", "$", "name", ",", "null", ",", "$", "cols", ",", "$",...
Adds a FROM table and optional columns to the query. The first parameter $name can be a simple string, in which case the correlation name is generated automatically. If you want to specify the correlation name, the first parameter must be an associative array in which the key is the correlation name, and the value is the physical table name. For example, array('alias' => 'table'). The correlation name is prepended to all columns fetched for this table. The second parameter can be a single string or Zend_Db_Expr object, or else an array of strings or Zend_Db_Expr objects. The first parameter can be null or an empty string, in which case no correlation name is generated or prepended to the columns named in the second parameter. @param array|string|Zend_Db_Expr $name The table name or an associative array relating correlation name to table name. @param array|string|Zend_Db_Expr $cols The columns to select from this table. @param string $schema The schema name to specify, if any. @return Zend_Db_Select This Zend_Db_Select object.
[ "Adds", "a", "FROM", "table", "and", "optional", "columns", "to", "the", "query", "." ]
72df150735664275a60a7861e468c6ff3b152a14
https://github.com/matomo-org/matomo/blob/72df150735664275a60a7861e468c6ff3b152a14/libs/Zend/Db/Select.php#L228-L231
train
Create a JOIN statement
[ 30522, 2270, 3853, 2013, 1006, 1002, 2171, 1010, 1002, 8902, 2015, 1027, 1005, 1008, 1005, 1010, 1002, 8040, 28433, 1027, 19701, 1007, 1063, 2709, 1002, 2023, 1011, 1028, 1035, 3693, 1006, 2969, 1024, 1024, 2013, 1010, 1002, 2171, 1010, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getgrav/grav
system/src/Grav/Common/Uri.php
Uri.convertUrl
public static function convertUrl(PageInterface $page, $url, $type = 'link', $absolute = false, $route_only = false) { $grav = Grav::instance(); $uri = $grav['uri']; // Link processing should prepend language $language = $grav['language']; $language_append = ''; if ($type === 'link' && $language->enabled()) { $language_append = $language->getLanguageURLPrefix(); } // Handle Excerpt style $url array $url_path = is_array($url) ? $url['path'] : $url; $external = false; $base = $grav['base_url_relative']; $base_url = rtrim($base . $grav['pages']->base(), '/') . $language_append; $pages_dir = $grav['locator']->findResource('page://'); // if absolute and starts with a base_url move on if (isset($url['scheme']) && Utils::startsWith($url['scheme'], 'http')) { $external = true; } elseif ($url_path === '' && isset($url['fragment'])) { $external = true; } elseif ($url_path === '/' || ($base_url !== '' && Utils::startsWith($url_path, $base_url))) { $url_path = $base_url . $url_path; } else { // see if page is relative to this or absolute if (Utils::startsWith($url_path, '/')) { $normalized_url = Utils::normalizePath($base_url . $url_path); $normalized_path = Utils::normalizePath($pages_dir . $url_path); } else { $page_route = ($page->home() && !empty($url_path)) ? $page->rawRoute() : $page->route(); $normalized_url = $base_url . Utils::normalizePath(rtrim($page_route, '/') . '/' . $url_path); $normalized_path = Utils::normalizePath($page->path() . '/' . $url_path); } // special check to see if path checking is required. $just_path = str_replace($normalized_url, '', $normalized_path); if ($normalized_url === '/' || $just_path === $page->path()) { $url_path = $normalized_url; } else { $url_bits = static::parseUrl($normalized_path); $full_path = $url_bits['path']; $raw_full_path = rawurldecode($full_path); if (file_exists($raw_full_path)) { $full_path = $raw_full_path; } elseif (!file_exists($full_path)) { $full_path = false; } if ($full_path) { $path_info = pathinfo($full_path); $page_path = $path_info['dirname']; $filename = ''; if ($url_path === '..') { $page_path = $full_path; } else { // save the filename if a file is part of the path if (is_file($full_path)) { if ($path_info['extension'] !== 'md') { $filename = '/' . $path_info['basename']; } } else { $page_path = $full_path; } } // get page instances and try to find one that fits $instances = $grav['pages']->instances(); if (isset($instances[$page_path])) { /** @var PageInterface $target */ $target = $instances[$page_path]; $url_bits['path'] = $base_url . rtrim($target->route(), '/') . $filename; $url_path = Uri::buildUrl($url_bits); } else { $url_path = $normalized_url; } } else { $url_path = $normalized_url; } } } // handle absolute URLs if (\is_array($url) && !$external && ($absolute === true || $grav['config']->get('system.absolute_urls', false))) { $url['scheme'] = $uri->scheme(true); $url['host'] = $uri->host(); $url['port'] = $uri->port(true); // check if page exists for this route, and if so, check if it has SSL enabled $pages = $grav['pages']; $routes = $pages->routes(); // if this is an image, get the proper path $url_bits = pathinfo($url_path); if (isset($url_bits['extension'])) { $target_path = $url_bits['dirname']; } else { $target_path = $url_path; } // strip base from this path $target_path = str_replace($uri->rootUrl(), '', $target_path); // set to / if root if (empty($target_path)) { $target_path = '/'; } // look to see if this page exists and has ssl enabled if (isset($routes[$target_path])) { $target_page = $pages->get($routes[$target_path]); if ($target_page) { $ssl_enabled = $target_page->ssl(); if ($ssl_enabled !== null) { if ($ssl_enabled) { $url['scheme'] = 'https'; } else { $url['scheme'] = 'http'; } } } } } // Handle route only if ($route_only) { $url_path = str_replace(static::filterPath($base_url), '', $url_path); } // transform back to string/array as needed if (is_array($url)) { $url['path'] = $url_path; } else { $url = $url_path; } return $url; }
php
public static function convertUrl(PageInterface $page, $url, $type = 'link', $absolute = false, $route_only = false) { $grav = Grav::instance(); $uri = $grav['uri']; // Link processing should prepend language $language = $grav['language']; $language_append = ''; if ($type === 'link' && $language->enabled()) { $language_append = $language->getLanguageURLPrefix(); } // Handle Excerpt style $url array $url_path = is_array($url) ? $url['path'] : $url; $external = false; $base = $grav['base_url_relative']; $base_url = rtrim($base . $grav['pages']->base(), '/') . $language_append; $pages_dir = $grav['locator']->findResource('page://'); // if absolute and starts with a base_url move on if (isset($url['scheme']) && Utils::startsWith($url['scheme'], 'http')) { $external = true; } elseif ($url_path === '' && isset($url['fragment'])) { $external = true; } elseif ($url_path === '/' || ($base_url !== '' && Utils::startsWith($url_path, $base_url))) { $url_path = $base_url . $url_path; } else { // see if page is relative to this or absolute if (Utils::startsWith($url_path, '/')) { $normalized_url = Utils::normalizePath($base_url . $url_path); $normalized_path = Utils::normalizePath($pages_dir . $url_path); } else { $page_route = ($page->home() && !empty($url_path)) ? $page->rawRoute() : $page->route(); $normalized_url = $base_url . Utils::normalizePath(rtrim($page_route, '/') . '/' . $url_path); $normalized_path = Utils::normalizePath($page->path() . '/' . $url_path); } // special check to see if path checking is required. $just_path = str_replace($normalized_url, '', $normalized_path); if ($normalized_url === '/' || $just_path === $page->path()) { $url_path = $normalized_url; } else { $url_bits = static::parseUrl($normalized_path); $full_path = $url_bits['path']; $raw_full_path = rawurldecode($full_path); if (file_exists($raw_full_path)) { $full_path = $raw_full_path; } elseif (!file_exists($full_path)) { $full_path = false; } if ($full_path) { $path_info = pathinfo($full_path); $page_path = $path_info['dirname']; $filename = ''; if ($url_path === '..') { $page_path = $full_path; } else { // save the filename if a file is part of the path if (is_file($full_path)) { if ($path_info['extension'] !== 'md') { $filename = '/' . $path_info['basename']; } } else { $page_path = $full_path; } } // get page instances and try to find one that fits $instances = $grav['pages']->instances(); if (isset($instances[$page_path])) { /** @var PageInterface $target */ $target = $instances[$page_path]; $url_bits['path'] = $base_url . rtrim($target->route(), '/') . $filename; $url_path = Uri::buildUrl($url_bits); } else { $url_path = $normalized_url; } } else { $url_path = $normalized_url; } } } // handle absolute URLs if (\is_array($url) && !$external && ($absolute === true || $grav['config']->get('system.absolute_urls', false))) { $url['scheme'] = $uri->scheme(true); $url['host'] = $uri->host(); $url['port'] = $uri->port(true); // check if page exists for this route, and if so, check if it has SSL enabled $pages = $grav['pages']; $routes = $pages->routes(); // if this is an image, get the proper path $url_bits = pathinfo($url_path); if (isset($url_bits['extension'])) { $target_path = $url_bits['dirname']; } else { $target_path = $url_path; } // strip base from this path $target_path = str_replace($uri->rootUrl(), '', $target_path); // set to / if root if (empty($target_path)) { $target_path = '/'; } // look to see if this page exists and has ssl enabled if (isset($routes[$target_path])) { $target_page = $pages->get($routes[$target_path]); if ($target_page) { $ssl_enabled = $target_page->ssl(); if ($ssl_enabled !== null) { if ($ssl_enabled) { $url['scheme'] = 'https'; } else { $url['scheme'] = 'http'; } } } } } // Handle route only if ($route_only) { $url_path = str_replace(static::filterPath($base_url), '', $url_path); } // transform back to string/array as needed if (is_array($url)) { $url['path'] = $url_path; } else { $url = $url_path; } return $url; }
[ "public", "static", "function", "convertUrl", "(", "PageInterface", "$", "page", ",", "$", "url", ",", "$", "type", "=", "'link'", ",", "$", "absolute", "=", "false", ",", "$", "route_only", "=", "false", ")", "{", "$", "grav", "=", "Grav", "::", "in...
Converts links from absolute '/' or relative (../..) to a Grav friendly format @param PageInterface $page the current page to use as reference @param string|array $url the URL as it was written in the markdown @param string $type the type of URL, image | link @param bool $absolute if null, will use system default, if true will use absolute links internally @param bool $route_only only return the route, not full URL path @return string|array the more friendly formatted url
[ "Converts", "links", "from", "absolute", "/", "or", "relative", "(", "..", "/", "..", ")", "to", "a", "Grav", "friendly", "format" ]
1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72
https://github.com/getgrav/grav/blob/1a41e00a4f0f5d17b6c0ce5150a5d656a8c5be72/system/src/Grav/Common/Uri.php#L745-L891
train
Convert a URL to a page
[ 30522, 2270, 10763, 3853, 10463, 3126, 2140, 1006, 3931, 18447, 2121, 12172, 1002, 3931, 1010, 1002, 24471, 2140, 1010, 1002, 2828, 1027, 1005, 4957, 1005, 1010, 1002, 7619, 1027, 6270, 1010, 1002, 2799, 1035, 2069, 1027, 6270, 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...
octobercms/october
modules/backend/traits/FormModelSaver.php
FormModelSaver.prepareModelsToSave
protected function prepareModelsToSave($model, $saveData) { $this->modelsToSave = []; $this->setModelAttributes($model, $saveData); $this->modelsToSave = array_reverse($this->modelsToSave); return $this->modelsToSave; }
php
protected function prepareModelsToSave($model, $saveData) { $this->modelsToSave = []; $this->setModelAttributes($model, $saveData); $this->modelsToSave = array_reverse($this->modelsToSave); return $this->modelsToSave; }
[ "protected", "function", "prepareModelsToSave", "(", "$", "model", ",", "$", "saveData", ")", "{", "$", "this", "->", "modelsToSave", "=", "[", "]", ";", "$", "this", "->", "setModelAttributes", "(", "$", "model", ",", "$", "saveData", ")", ";", "$", "...
Takes a model and fills it with data from a multidimensional array. If an attribute is found to be a relationship, that relationship is also filled. $modelsToSave = $this->prepareModelsToSave($model, [...]); foreach ($modelsToSave as $modelToSave) { $modelToSave->save(); } @param \October\Rain\Database\Model $model Model to fill. @param array $saveData Attribute values to fill model. @return array The collection of models to save.
[ "Takes", "a", "model", "and", "fills", "it", "with", "data", "from", "a", "multidimensional", "array", ".", "If", "an", "attribute", "is", "found", "to", "be", "a", "relationship", "that", "relationship", "is", "also", "filled", "." ]
3118660d834f161d513da08477be92281a2eb96a
https://github.com/octobercms/october/blob/3118660d834f161d513da08477be92281a2eb96a/modules/backend/traits/FormModelSaver.php#L37-L43
train
Prepare the models to save
[ 30522, 5123, 3853, 7374, 5302, 9247, 16033, 3736, 3726, 1006, 1002, 2944, 1010, 1002, 5552, 6790, 1007, 1063, 1002, 2023, 1011, 1028, 4275, 13122, 10696, 1027, 1031, 1033, 1025, 1002, 2023, 1011, 1028, 2275, 5302, 9247, 19321, 3089, 8569, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/ExceptionListener.php
ExceptionListener.onKernelException
public function onKernelException(GetResponseForExceptionEvent $event) { $exception = $event->getException(); do { if ($exception instanceof AuthenticationException) { return $this->handleAuthenticationException($event, $exception); } elseif ($exception instanceof AccessDeniedException) { return $this->handleAccessDeniedException($event, $exception); } elseif ($exception instanceof LogoutException) { return $this->handleLogoutException($exception); } } while (null !== $exception = $exception->getPrevious()); }
php
public function onKernelException(GetResponseForExceptionEvent $event) { $exception = $event->getException(); do { if ($exception instanceof AuthenticationException) { return $this->handleAuthenticationException($event, $exception); } elseif ($exception instanceof AccessDeniedException) { return $this->handleAccessDeniedException($event, $exception); } elseif ($exception instanceof LogoutException) { return $this->handleLogoutException($exception); } } while (null !== $exception = $exception->getPrevious()); }
[ "public", "function", "onKernelException", "(", "GetResponseForExceptionEvent", "$", "event", ")", "{", "$", "exception", "=", "$", "event", "->", "getException", "(", ")", ";", "do", "{", "if", "(", "$", "exception", "instanceof", "AuthenticationException", ")"...
Handles security related exceptions.
[ "Handles", "security", "related", "exceptions", "." ]
b82b09eefb084e487997f4af753400d721edd0a8
https://github.com/symfony/symfony/blob/b82b09eefb084e487997f4af753400d721edd0a8/src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php#L90-L102
train
This method is called when an exception occurs in the kernel.
[ 30522, 2270, 3853, 2006, 5484, 11877, 10288, 24422, 1006, 2131, 6072, 26029, 20106, 5686, 2595, 24422, 18697, 3372, 1002, 2724, 1007, 1063, 1002, 6453, 1027, 1002, 2724, 1011, 1028, 2131, 10288, 24422, 1006, 1007, 1025, 2079, 1063, 2065, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
overtrue/wechat
src/OfficialAccount/POI/Client.php
Client.update
public function update(int $poiId, array $baseInfo) { $params = [ 'business' => [ 'base_info' => array_merge($baseInfo, ['poi_id' => $poiId]), ], ]; return $this->httpPostJson('cgi-bin/poi/updatepoi', $params); }
php
public function update(int $poiId, array $baseInfo) { $params = [ 'business' => [ 'base_info' => array_merge($baseInfo, ['poi_id' => $poiId]), ], ]; return $this->httpPostJson('cgi-bin/poi/updatepoi', $params); }
[ "public", "function", "update", "(", "int", "$", "poiId", ",", "array", "$", "baseInfo", ")", "{", "$", "params", "=", "[", "'business'", "=>", "[", "'base_info'", "=>", "array_merge", "(", "$", "baseInfo", ",", "[", "'poi_id'", "=>", "$", "poiId", "]"...
Update a POI. @param int $poiId @param array $baseInfo @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string
[ "Update", "a", "POI", "." ]
120c72faaa93c270365bc75c73c362d5fd583209
https://github.com/overtrue/wechat/blob/120c72faaa93c270365bc75c73c362d5fd583209/src/OfficialAccount/POI/Client.php#L99-L108
train
Update a POI
[ 30522, 2270, 3853, 10651, 1006, 20014, 1002, 13433, 6137, 2094, 1010, 9140, 1002, 2918, 2378, 14876, 1007, 1063, 1002, 11498, 5244, 1027, 1031, 1005, 2449, 1005, 1027, 1028, 1031, 1005, 2918, 1035, 18558, 1005, 1027, 1028, 9140, 1035, 13590...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...